[bold]sozieg wrote:[/bold]
Hi Erik.
my partner and i started writing out c# version of DROD, and we have few questions for you:
1. how do you insure that an object is reached by only one other object at a time (simultaneously)? , does handling on the data is being done through mutexs,semaphores?
Code in DROD runs in a single thread with the exception of the audio library and maybe some SDL library stuff, so thread synchronization on data access isn't necessary. If I needed to have multiple threads accessing data, I'd have a lot of work to do, but 90% of it would be completed by adding thread synchronization to the public methods of classes beginning with "
CDb"
(data access classes). Note that Metakit, the database library, isn't designed for simultaneous access, so this is an important reason to add thread synch. to the data access classes. If you can run the data access in a single thread, all of this isn't necessary.
2. we need an explanation of the "timing" algorithem you use in order to choose which object will activate his functions next,how do you choose when to move "focus" to a given object (e.g: if the swordman perform an action, how do you choose which monster shell responde first ,ect..)
Beethro always moves first, followed by mimics, followed by the 'Neather, followed by other monsters. The order of movement in each one of those groups is dependant on when the monster was created (either in the editor or during gameplay, i.e. roach spawn). Monsters created earlier move before monsters created later. It's not very sophisticated and if you aren't bound to complete compatibility with DROD, I recommend improving on this last part. For example, you could make multiple passes over the monster list while processing movement, and only stop making passes when on one pass every monster has either moved or had its movement blocked.
-Erik
____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals |
twitch stream |
youtube archive (NSFW)