How to structure a game with Irrlicht?

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
t

How to structure a game with Irrlicht?

Post by t »

Hello,
I am wondering how to structure a game using Irrlicht. Let's say the game loop contains these functions

UpdatePlayer()
UpdateMap()
UpdateNPCs()
UpdateDisplay()

Where should they be placed?

The use of callbacks for input etc makes me confused as to where to put things. eg, should I read from the keyboard somehow during UpdatePlayer, or should I respond to a callback event in the callback class?

I would find the source to even a very simple game very helpful.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Hi,
Updates can be conditionned by :
- time
- events
- actions

you don't put updates in the same place together with this theory.

for example :
A timer bomb is linked by time, in this case the periodic update is necessary.

A displacement of player is conditionned by the events of keyboard, periodic update is useless in this case.

That why, i think that irrlicht framework is really good, you have :
- a event receiver function
- a main loop (while(device->run())

It's really important to write your idea on paper, make a diagramm is important too, and check the interaction between class...

bye
t

Post by t »

Thanks for your reply, cyberbobjr. I think the framework is really good, too.

I wish there were an example showing all these things in a simple game.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

I think to publish some code or datagramm, but i don't have some space for putting this... (I'm in work and FTP doesn't be allowed :( )
t

Post by t »

You could email me at jjenkin3 then the at symbol, followed by bigpond.net.au
I could also put it on a website for a little while if you'd like.
cyberbobjr
Posts: 64
Joined: Mon Sep 08, 2003 8:21 am
Location: Paris, France

Post by cyberbobjr »

Hehe... you don't like spamm spider ;)

let me some time to document all and reorganize my code (about 1 weeek or 2) and i'll send you the package :)
t

Post by t »

hehe, no, I hate spam.

Thanks for your kind offer.
Post Reply