Event driven game flow

Started by
1 comment, last by lucky6969b 10 years, 11 months ago

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

Advertisement

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

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

This topic is closed to new replies.

Advertisement