Since i'm planning on making an rpg with a quest/map/chara/animations editor, I was wondering how events are processed in such games: let me explain a bit more where i'm getting stucked:
My main loop looks something like this:
LoadEverything() //loads graphics,sounds,musics,chara,map and so on...
While not EndOfGame() //test various cases of possible end of game
MovePlayer()
MoveNPCs()
HandleEnnemies()
ProcessEvents() ??
Cls
DrawEverything()
Flip
Wend
the problem here is what should be inside the ProcessEvents() method... Because there can be 1 or 2 or more event to be processed at the same time, they will all have a beginning and an end (for instance, one event could be "move this NPC toward player until it reaches it and then display this dialogu..." the event stops when the dialogu ends... but it dosn't prevent the player from moving nor does it prevent other event from launching... on the other side, another event could be StopMusic or changeMusic...) My question is how can I deal with all those kind of events in one method (well it can be separated in several call to many other methods but it s almost the same)?
I was thinking of maybe making things go in threads... one thread by event but I m not sure if it s a good idea or not, I don t know much about thread...
Any experienced programmer that could share a bit of his knowledge here?
I have a veeeeeeeeery small and tiny experience in script coding so I 'd like another solution that having a whole script language developped for the event editor/interpreter. I already thought of using BMAx's LUA scripting ability but even like this I don't see how I could write some script that would allow what I described for the events...
HELP!!!!
My main loop looks something like this:
LoadEverything() //loads graphics,sounds,musics,chara,map and so on...
While not EndOfGame() //test various cases of possible end of game
MovePlayer()
MoveNPCs()
HandleEnnemies()
ProcessEvents() ??
Cls
DrawEverything()
Flip
Wend
the problem here is what should be inside the ProcessEvents() method... Because there can be 1 or 2 or more event to be processed at the same time, they will all have a beginning and an end (for instance, one event could be "move this NPC toward player until it reaches it and then display this dialogu..." the event stops when the dialogu ends... but it dosn't prevent the player from moving nor does it prevent other event from launching... on the other side, another event could be StopMusic or changeMusic...) My question is how can I deal with all those kind of events in one method (well it can be separated in several call to many other methods but it s almost the same)?
I was thinking of maybe making things go in threads... one thread by event but I m not sure if it s a good idea or not, I don t know much about thread...
Any experienced programmer that could share a bit of his knowledge here?
I have a veeeeeeeeery small and tiny experience in script coding so I 'd like another solution that having a whole script language developped for the event editor/interpreter. I already thought of using BMAx's LUA scripting ability but even like this I don't see how I could write some script that would allow what I described for the events...
HELP!!!!