ENIGMA Forums

Outsourcing saves money => Programming Help => Topic started by: gondur on July 10, 2016, 03:16:13 pm

Title: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: gondur on July 10, 2016, 03:16:13 pm
Hi everyone, I today stumbled upon your project for the first time and was excited to see an open source alternative to Gamemaker.

Now, to test your software what I tried was to load an existing, open source gamemaker project.  (Disclaimer, while I have programming experience, I'm not a game programmer nor have I used gamemaker before)

So I download the portable package (version Version: 1.8.6.831) which installed nicely for me under windows.

I selected spelunky which is missing a linux port where the multiplatform ENIGMA could shimn. For spelunky there are 2 variants available.
http://www.derekyu.com/games/spelunky_1_1_src.zip
http://files.ausgamers.com/downloads/1468172671/Spelunky_v1.3_Source.zip

(Somewhere it was mentioned in the forum that an early test existed, but the link was broken and google revealed nothting too)

I could open both fine and ran for both into different problems (where I currently stuck)

Both seems to rely on the caster extension (http://moacube.com/resources/caster-multi-platform-ogg-extension-for-gamemaker/) which is available as gex, which seems to be not supported (https://enigma-dev.org/docs/Wiki/GEX_format).

OK, then I tried to mass remove this audio functionality... but I was unable to find with the inbuild editor a way to substitute scripts/functions throughout the project. (Had to click and open every individual file)

This project seemed to provide this functionality (which is missing in GM too?) but failed for me to work. http://gmc.yoyogames.com/index.php?showtopic=621186

The same problem with another error: rand() expects now 1 parameter in former times it seems it was 2. This could be mapped to random_range if  I could mass rename / refactor the project.

Scoping/shadowing, by making a script "rand" which shadows the internal "rand" function I was also not able to bring to work.

Are there other alternatives (external editor also not worked on first try... notepad++)?
Dumping a project to pure text file and than replacing all instance in all files would be a possibility too, but I didn't found a dump possiblity.

Tipps and help would be very appreciated.

thanks :)
Title: Re: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: Yambam on July 11, 2016, 04:22:42 am
What worked for me is saving the game as .egm format (also choose EGM on the right pane of the save dialog) and then rename the .egm extension to .zip. Then you can find/replace in all plain text files using Notepad++. :)
Title: Re: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: gondur on July 12, 2016, 05:22:21 pm
What worked for me is saving the game as .egm format (also choose EGM on the right pane of the save dialog) and then rename the .egm extension to .zip. Then you can find/replace in all plain text files using Notepad++. :)

Thanks!

This helped enormously .... now I'm in the compile step and facing a bunch of errors and C++11 warnings, some subset:

C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:2060:47: error: expected unqualified-id before 'new'
         enigma::varaccess_holdItem(int(self)).new = 0;

C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h: In destructor 'virtual enigma::OBJ_oJar::~OBJ_oJar()':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h:19779:14: error: 'ENOBJ_ITER_myevent_collision' was not declared in this scope
       delete ENOBJ_ITER_myevent_collision;
              ^

C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h:14154:17: warning: inline function 'bool enigma::OBJ_oShopkeeper::myevent_collision_175_subcheck()' used but never defined [enabled by default]
     inline bool myevent_collision_175_subcheck();

mingw32-make.exe[1]: Leaving directory `C:/Users/ll/Downloads/ENIGMA/enigma-dev/ENIGMAsystem/SHELL'
mingw32-make.exe: *** [Game] Error 2


some idea? download here https://www.dropbox.com/s/m5410ewqu64wl1t/Spelunky136.egm?dl=0
Title: Re: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: TheExDeus on July 13, 2016, 01:39:44 pm
You have a variable called "new" in the holdItem object. It is reserved name in C++ and parser doesn't handle reserved names in any way. So open your project and replace the local variable "new".

The collision error is weird. You can try changing the collision subsystem and see if that works.
Title: Re: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: gondur on July 14, 2016, 02:50:10 pm
You have a variable called "new" in the holdItem object. It is reserved name in C++ and parser doesn't handle reserved names in any way. So open your project and replace the local variable "new".

The collision error is weird. You can try changing the collision subsystem and see if that works.

Thank you!
I followed your advice and renamed all instance of new as variable and changed the collision system from "precise" to "bounding box.


Still, I have several errors...

In file included from SHELLmain.cpp:105:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h: In destructor 'virtual enigma::OBJ_oGiantSpider::~OBJ_oGiantSpider()':

C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h:13000:14: error: 'ENOBJ_ITER_myevent_alarm' was not declared in this scope
       delete ENOBJ_ITER_myevent_alarm;In file included from SHELLmain.cpp:109:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_canLandOnPlatforms(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:50:55: error: assignment of read-only member 'enigma::object_basic::object_index'
     return enigma::glaccess(int(self))-> object_index = oCharacter or object_get_parent(enigma::glaccess(int(self))-> object_index)== oCharacter;

In file included from SHELLmain.cpp:109:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_scrInit(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:5457:7: error: expected '}' before 'else'
       else
       ^
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: At global scope:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:5470:3: error: expected unqualified-id before 'return'
   return 0;
   ^
In file included from SHELLmain.cpp:105:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h: In destructor 'virtual enigma::OBJ_oGiantSpider::~OBJ_oGiantSpider()':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h:13000:14: error: 'ENOBJ_ITER_myevent_alarm' was not declared in this scope
       delete ENOBJ_ITER_myevent_alarm;
              ^
In file included from SHELLmain.cpp:109:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_canLandOnPlatforms(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:50:55: error: assignment of read-only member 'enigma::object_basic::object_index'
     return enigma::glaccess(int(self))-> object_index = oCharacter or object_get_parent(enigma::glaccess(int(self))-> object_index)== oCharacter;

                                                                                  ^
(and warnings
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:2505:82: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
     else if((enigma::varaccess_type(int(enigma::varaccess_holdItem(int(self))))=="Web Cannon"and enigma::varaccess_cost(int(enigma::varaccess_holdItem(int(self))))> 0)
)
                                                                           
Title: Re: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: faissaloo on July 14, 2016, 04:51:52 pm
"error: 'ENOBJ_ITER_myevent_alarm' was not declared in this scope" is being actively dealt with here: https://github.com/enigma-dev/enigma-dev/issues/981#issuecomment-232766024
Title: Re: First time try to bring Enigma/LaterGM to work: code refactoring & GEX extension
Post by: Goombert on September 28, 2016, 02:35:56 am
Yes and the fix is available here:
https://github.com/enigma-dev/enigma-dev/pull/987

It should be in the new portable ZIP on GitHub too.