Game Structure

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
EglStrk
Posts: 7
Joined: Mon Apr 09, 2007 6:52 pm

Game Structure

Post by EglStrk »

How do I effeciently manage different scenes in a game? What I mean is, how do I switch between, say, a menu screen and different levels of a game?

On a side note, what 3d model format would you recommend for animation? I was thinking .X. Am I right?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

If your scene management is strayforward (like intro->menu->game->credits) then you can write code directly.

1. create intro objects ....destroy intro objects
2. create menu object ...let user make his choices ...destroy menu objects
3. ...and so on ...

If however your scene management is dynamic (user is allowed to switch between scenes on run time) you need some kind of scene manager (your own, not Irrlicht build) to handle scenes. It should be some class probably.

Simple manager like that would for example:

If M key clicked ...clear all objects ...then load menu scene
If some other key clicked ...save one scene, clear it, then load another scene
... and so on ...

As for 3D format ...x is something like native Irrlicht format so it should be best. However I saw some posts which complain that there are some bugs in Irrlicht 1.3 related to x.
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

I handle scene switching by assigning an empty scene node to each scene, acting as the parent for all scene nodes part of that scene. Same for gui elements. Just hide the scene's root node when it gets inactive (ie. another scene is activated) and show it when it gets activated. I recommend you create all scenes are initialization time, and destroy them when the program is about to exit.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Post by Nadro »

You must create special memory cleaner;)
Post Reply