Page 1 of 1

How to create multiple game files ( .dll etc.) and use them

PostPosted: Tue Apr 17, 2018 9:49 am
by tdmxross
my question is, how to export game levels as multiple game files that the user cannot access directly, but through the executable game which contains links to open them. here is an example- user123 opens the 'game folder'. then clicks on 'game.exe' . when game.exe runs, it shows 3 levels on the screen. user123 clicks on 1st level.' game.exe' runs the 'level1' game file and user123 plays it. when the level1 is finished, it automatically opens the 'game.exe' again.

i know how to export a single windows executable file, but how to export them into a format which the user cannot run without the main .exe file.
:?: please help :?:

Re: How to create multiple game files ( .dll etc.) and use t

PostPosted: Tue Apr 17, 2018 1:55 pm
by lcl
For that use case there is the export option Game Data Only (iPhone, iPad or game level without the executable engine). Use that to export the different levels. Then you have to use LoadGame(); (LoadGame on GE Script Reference) function to load the game from that file to be executed.

Let's say you have your main game.ged exported as game.exe and then you have your level1.ged exported as level1.dat. Here's how to use the LoadGame(); to switch between the games:
This code goes to the event where you want to move to level1:
Code: Select all
LoadGame("level1.dat");

And this code goes to the event where you want to change back to game.exe:
Code: Select all
LoadGame("game.exe");


Hope this helps. If you don't understand something, just ask and I'll try my best to answer you. :)

(Also, just in case you're wondering, yes, the function name looks like it has something to do with loading saved games (player's saved progress in a game), but no, the function doesn't have anything to do with those, it's just named a bit badly. :P Should probably be something like "RunGame" or "ExecuteGame" instead.)

Re: How to create multiple game files ( .dll etc.) and use t

PostPosted: Tue Apr 17, 2018 4:30 pm
by tdmxross
Thank you so much, this helped! :D i am going to make a open world game with sixteen different zones to prevent lagging and this will surely will be helpful for such condition. i knew how the Loadgame feature works but was not able to export the files into .dll format. again, thank you so so much for your help, game editor will surely be revived because we have great people like you in our community. 8) Game editor rocks!! 8)

Re: How to create multiple game files ( .dll etc.) and use t

PostPosted: Sat Feb 27, 2021 4:51 am
by Kaushik21
You can statically link all the libraries together. The resources can
all be converted to C code that you can compile and link into your
program and use RWops to read them from memory. Turns out all SDL
functions that read from files actually use a RWop to do the file IO and
there are RWops that let you treat a constant in memory as a file.