Sign in to follow this  
BoBanducci

opening/level transition - how do they work?

Recommended Posts

BoBanducci    100
[font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color=#000000][font=Verdana, Helvetica, sans-serif]Hi,[/font][/color][/color][/font]
[font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color=#000000][font=Verdana, Helvetica, sans-serif]
[/font][/color][/color][/font]
[font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color=#000000][font=Verdana, Helvetica, sans-serif]I'm using Flash, but I think my issue is more about general programming concepts, and not necessarilly Flash specific.[/font][/color][/color][/font]
[font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color=#000000][font=Verdana, Helvetica, sans-serif]
I don't know how to structure the beginning of my game and level transitions. I've got my game logic and I'm beginning to think through how I'll transition between levels and stuff, and how to do the opening menus, but I could definitely use some suggestions from someone who has done it before. I'm looking for tips or tutorials about that subject.

For instance, what's a good way to encapsulate your levels and load them/remove them? How do people do the beginning intro screens and menu, and how does that flow into the game itself? Timers? removedFromStage events? Custom events?

Thanks for your help

Bo[/font][/color][/color][/font]

Share this post


Link to post
Share on other sites
Ashaman73    13715
A simple "game" setup is a layered model:
[code]
1 - user layer
2 - character layer
2.1 - character inventory
3 - level layer
3.1 - npcs
3.2 - objects
3.3 - triggers
[/code]

When your game starts, you only need to start the user layer. This could be a simple gui controlled by a finit-state machine. The second layer will started after the user chooses the character with which he wants to play. This could be embedded in a save file, a character selection screen etc.
After this you need to load and init your level layer (maybe recover the level from a saved file), once the level layer has been initialized, you need to place the character in the level and give the character control to the user.

To change the level you often got some trigger which tells your "user layer" that the game want to change the level.

When changing the level you need to carefully "unload" all necessary data from bottom up, that is:
1. take the character control from the user
2. remove the character from the level
3. deactivate and unload the whole level layer
4. load and init the new level
5. place the character into your new level
6. give the character control back to the user.

Share this post


Link to post
Share on other sites
Krohm    5030
[quote name='bbanducci' timestamp='1306375580' post='4815878'][font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color="#000000"][font="Verdana, Helvetica, sans-serif"]I don't know how to structure the beginning of my game and level transitions.[font="arial, verdana, tahoma, sans-serif"][/quote]An often used way is to have a special brush which when hit, triggers a "LoadAnotherLevel" function. Those brushes are generally assigned to special entities which encode the required information, for example the next world file name.[/font][/font][/color][/color][/font]
[font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color="#000000"][font="Verdana, Helvetica, sans-serif"][font="arial, verdana, tahoma, sans-serif"][/font][/font][/color][/color][/font]
[font="Arial, Helvetica, sans-serif"][color="#d2d8e3"][color="#000000"][font="Verdana, Helvetica, sans-serif"][font="arial, verdana, tahoma, sans-serif"][quote name='bbanducci' timestamp='1306375580' post='4815878'][/font]For instance, what's a good way to encapsulate your levels and load them/remove them?[/font][/color][/color][/font][/quote]Using objects? This might require some work for C/C++ but managed environments like Flash have possibly some advantages when it comes to that. Thinking OOP way is very viable here as there are little performance paths to take care of. For example, most world-collision work would be internal to this object.

[font="Verdana, Helvetica, sans-serif"][font="arial, verdana, tahoma, sans-serif"][quote name='bbanducci' timestamp='1306375580' post='4815878'][/font][/font][font="Verdana, Helvetica, sans-serif"]How do people do the beginning intro screens and menu, and how does that flow into the game itself?[/font][/quote]In the past, I've hardcoded them with mixed results. It's a bit boring but viable for simple projects. Right now I'm experimenting a bit with scripting but so far I am having some difficulties in figuring out inadequate interfaces. While it''s obvious that you need some kind of timing, it does not have to be necessarily time-based. You might have to have "events" as well - for example:
[source]if(someObject.Dead() == true) BeginStandardGameplay()[/source]
Note that this might require variable amount of time if [i]someObject [/i]is bashed with variable-damage weapons.

In general, you first need to figure out what you need. FIRST.
Then, implement the features you need (possibly slightly better).
For example in the ID engines, the level transition was very simple: when hit (exit brush) --> go next level.
Levels had a set of timers and stuff that would build some (generally simple, but they improved) animations, some would trigger at level load (by having a timer that triggers at t=0), and that's it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this