Skip to main content
GameDev.net gamedev.net
🔒 Locked

Event driven game flow

Started by lucky6969b May 17, 2013 at 9:04 AM 1 replies 1.2k views
Original Post
lucky6969b
lucky6969b

Last time people told me about data driven style of game programming.

Now I want to finish this part first, then consider data driven later.

I learn that a game should be data+event driven,

With the event driven part,

a class would have something like

OnLeftClick

OnUpdate

OnRender

On... whatever,

What are the principles behind all these?

cause I don't want to do this.


do  {
   assignWork();
   findPath();
   
   work();
   
} while (!finished)

Thanks

Jack

lucky6969b
lucky6969b

I know now, they are called state machines. But state machines don't merely change states, they have to do something.

When do they start to do real work? Like when I change the state of a goblin to "live", when do I make it attack the player (update animations and render)?

Thanks

Jack

lucky6969b
lucky6969b

Should each object have its own state machine?

class Horse

{

FSMclass m_StateMachine;

};

class Dog

{

FSMclass m_StateMachine;

};

Of course, I can have an abstract class to contain it.

Jack

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.