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

Learn how to start making games.

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

Postby tdmxross » Tue Apr 17, 2018 9:49 am

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 :?:
GE is better than every single game engine
User avatar
tdmxross
 
Posts: 48
Joined: Sun Dec 24, 2017 7:12 pm
Location: Maharashtra, India
Score: 4 Give a positive score

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

Postby lcl » Tue Apr 17, 2018 1:55 pm

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.)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

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

Postby tdmxross » Tue Apr 17, 2018 4:30 pm

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)
GE is better than every single game engine
User avatar
tdmxross
 
Posts: 48
Joined: Sun Dec 24, 2017 7:12 pm
Location: Maharashtra, India
Score: 4 Give a positive score

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

Postby Kaushik21 » Sat Feb 27, 2021 4:51 am

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.
Kaushik21
 
Posts: 1
Joined: Wed Feb 10, 2021 6:41 am
Location: Dhaka, Bangladesh
Score: 0 Give a positive score


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 1 guest