Multiple geds in one game?

Non-platform specific questions.

Multiple geds in one game?

Postby jcflysrc » Mon May 16, 2011 6:56 am

How can I include multiple geds in a single game. I got the Start screen, and the first level, but am unclear how to make other geds a part of the game. Each level will be on a seperate ged or file. Can it be done? Explain any code that is invovlved as I am not too good at coding, so clear instructions would help a lot. Thanks.
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby skydereign » Mon May 16, 2011 7:06 am

Multiple geds can form a single game, but they are definitely separate files. The only coding that you really need is the LoadGame function.
Code: Select all
LoadGame("gameName");


So, if you want to load Level1.ged, use this.
Code: Select all
LoadGame("Level1.ged");


Since you already have the mechanics in one game built, you simply save that file under another name, and change the level design and anything else to make it another level. If you want to transfer information over the files, you can use saveVars and loadVars. If you need help with that I can forward you some more information about it, there's plenty of information on the forums about it as well. But as far as creating multiple levels with geds, it is pretty much just using LoadGame. The start screen menu loads the first level, and the first level loads the second, and so on. Each level would also probably have a load menu screen, but that all depends on how you make your game.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple geds in one game?

Postby Kodo » Mon May 16, 2011 10:16 am

A word of caution though, if you have a game that works in this way and you have lots of levels, every time you change something in the code to do with how the game actually works and not just the layout of the level you will need to make that same change in all your files, which turns in to a nightmare very quickly. So if you had 10 levels and you change one line of code in order to say improve the way your character jumps (as an example) you would need to load up all 10 files and edit that one line of code in each. In one of my games I used three different files and that was bad enough. For many though this multiple Ged method of putting a game together is easier than the alternatives so I'm not saying its all bad, it kind of depends on your requirements and your level of experience. It can also be usefull if your game is very big and you want to split it up in order to improve its organisation and/or performance.
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Re: Multiple geds in one game?

Postby jcflysrc » Tue May 17, 2011 2:29 am

OK, I'm definately having trouble. I have two levels made so far, on seperate geds. I have an collision event with an actor to trigger the load game command, which loads the second level. When I test it in Game Editor it works fine, except my score keeper doesn't work on second level. However when I make the first level an executable, it doesn't load the second level when the collision event takes place. So I have two issues. Non working load game command, and non working score keeper once made into an executable. Any idea why, and what I might do to overcome this?

Would I be better off using regions, and putting both levels in one ged file?
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby skydereign » Tue May 17, 2011 5:27 am

Chances are you have the LoadGame name wrong. When you create an executable, it is supposed to convert it to the proper name, for example game.ged will turn into game.exe for windows exports, but this isn't always the case. For the score keeping, what part doesn't work? The variables won't transfer unless you use loadVars, so if something else is happening, do explain the score method. I usually put levels into a single ged, unless they get pretty large, but really it is a matter of preference.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple geds in one game?

Postby jcflysrc » Tue May 17, 2011 5:47 am

I set up my scoring the same way as in the tutorial on this site. Not sure what you mean by variables. I used the exact names of each ged file in the load game commands.
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby skydereign » Tue May 17, 2011 5:58 am

You can get the game to load fine in gameEditor's stage mode, but you sometimes have to change the string in the LoadGame call to match the executable version. So, what works in editor doesn't necessarily work in executable. So situation A will work in the editor, while it won't work in an exported version, while situation b will only work in exported versions.
A
Code: Select all
LoadGame("level1.ged");

B
Code: Select all
LoadGame("level1.exe");


Not sure which scoring tutorial you used, as there are quite a few, and that doesn't quite answer what I asked. By variables I mean the variables you used to save your score, because from your description I really don't know what about it is going wrong.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple geds in one game?

Postby jcflysrc » Tue May 17, 2011 7:36 am

viewtopic.php?f=2&t=9034 That is a link to the score tutorial. I followed those instructions precisely, and my score counter works. I went back and renamed all the load game command lines to the .exe file they point to. However I am not able to rename the ged files in Game Editor. Such as the first level and the second level. I asumed they would be renamed when I exported the game. Basically I have a splash screen that points to the first level. That level loads up fine, and score works. I then have a collision event set up to trigger the loading of the second level splash screen. In that Load game command instance I used the .exe extension. That splash screen never loads. So I dont know if the counter is working in the second level or not. Does that make sense?
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby skydereign » Tue May 17, 2011 7:53 am

I keep being pointed to krenisis' tutorials, and as expected they have taught some questionable practices. A bit of advice, do not use textNumber as a variable, only a method of display. So, instead create a variable named score, and whenever you want the score to increase, add to that. Then in the text actor's draw event, use this.
Code: Select all
textNumber=score;


textNumber has been known to have some glitches in it, I believe I remember trying to help someone in a similar situation to yours. Not sure if that will fix it, but it can save you some grief in the future.

Not quite sure I follow with the loading problem. Why can't you rename them? Not that it matters as long as the names match the games that are supposed to load. Using .ged as the extension works perfectly with Linux I believe (at least I haven't heard of problems for Linux gE exporting to Linux), but with switching between windows is where it gets tricky. Would it be possible to upload the files, or if you want email it to me? Alternatively just put the game file name, and the LoadGame calls each game has, so we can see exactly how they connect. So for example...
Splash.ged
splash -> Destroy Actor -> Script Editor
Code: Select all
LoadGame("level1.ged");


level1.ged
player -> Collision with flag (repeat disabled) -> Script Editor
Code: Select all
LoadGame("level2.ged");
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple geds in one game?

Postby jcflysrc » Tue May 17, 2011 10:16 am

OK I re coded my scoring on level 2 and it seems to work ok now. I am still having a problem though with my collision event in level one triggering the Load Game command. So what I want to know is this; can I have the level change by the score reaching a certain point, rather than use a collision event? Say when the score reaches 4000, then the level ends and next one begins. I am sorry for being a dumbass, but I know very little coding, but I do appreciatee you helping me. I am learning a bit I feel like now. Anyway if you could offer some help with that.

I have my actors (zombies) being created off screen by another actor using a timer, alla Moon Defender style. I was trying to set one of the actors timers to only create a zombie like in 5 minutes, and by killing him it would load the next level. In game mode it seems to work ok, but when I make the file an .exe it doesnt work. The other zombies are being created right on schedule, but that one just doesnt seem to act right. So thats why I think it would be better if my score were the trigger instead. If that's doable. Thanks man.
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby skydereign » Tue May 17, 2011 6:33 pm

Assuming you added the score variable, you can do this.
Code: Select all
if(score>=4000)
{
    LoadGame("yourgameName");
}


Otherwise you'd have to do this.
Code: Select all
if(textNumber>=4000)
{
    LoadGame("yourgameName");
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple geds in one game?

Postby jcflysrc » Tue May 17, 2011 11:43 pm

Worked like a charm :D . You are the man. I knew it had to be a simple thing, but I just dont understand the code that much, but with your help I do a little more now. Still, there is much to be learned. Thanks man you ROCK!
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby jcflysrc » Wed May 18, 2011 12:14 am

Well maybe I spoke too soon. It works in game mode, but not when I make it an .exe :( . I added the script to the score actor twice, one pointing to the ged, and once pointing to the .exe. That is how my first level splash screen is set up, and it works fine in the .exe, but I am using a mouse button down event to start the first level. When the score reaches 4000 in the first level nothing happens in the .exe. Dang it, I thought I had it. Any ideas?
jcflysrc
 
Posts: 49
Joined: Wed Apr 27, 2011 9:56 am
Score: 0 Give a positive score

Re: Multiple geds in one game?

Postby sonicfire » Wed May 18, 2011 10:13 am

if you want to have different levels in your game and load these from the running *.exe, you have to use
dat files as far as i know, so compile your levels as game-data only DAT files.
(while testing the game in GE itself, you would have to use LoadGame("level2.ged") and so on.

level1 / game.exe:
Code: Select all
if(score>=4000)
{
    LoadGame("level2.dat");
}


level2.dat:
Code: Select all
if(score>=4000)
{
    LoadGame("level3.dat");
}


and so on. is that what you want?
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: Multiple geds in one game?

Postby skydereign » Wed May 18, 2011 10:22 am

Loading exe's should work, but in the end you would be using .dat files like sonicfire is suggesting. Have exe's means each level has the gE engine in it, which really is a waste of space if you only want the player to load the menu. That way it prevents the player from loading level1.exe... still your LoadGame problem is rather weird as it works fine when I export.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest