| I've never designed games beyond tetris, could someone explain in a few words, what the architecture of a RPG looks like? Some assumptions that may be terribly wrong: - The user input loop (keyboard, mouse) is still the main loop somewhere at the very bottom. Or is it different in RPGs? - Spawn threads each with their own inner loop, for each complex agent. Not necessarily an OS thread, but something that has its main loop and a stack. - Objects that don't have a "brain" don't need a thread, e.g. the ball in the tennis game. All such objects are managed from a single thread. - There's a rendering loop, possibly with its own complex multithreaded architecture. I don't know, did I come close to what's actually happening in complex RPG games? |
delta_t = time between last frame and now
fetch input status
for each entity: entity.think(delta_t) (for example, if a monster is in the state of moving towards me, it will move speed*delta_t units)
Render()
Never saw loops with real threads, that looks like asking for trouble.
If it was a multiplayer game then the think part was on the server and the client would just ready entity state from the network, sent input to server, and render().