Multithreading!

posted in mousetails RPG
Published September 27, 2015
Advertisement
Been a bit buizy with school, but found enough time to make a system where the level is generated in a separate process. The idea is that I can use that later to pregenerate the next level while still playing the previous one. Unfortunately, I can't do much loading while the level is being generated since I don't know what type of objects will be on the map. I might implement a system to load some common monster types ahead of time, and then unload unload and load any differences based on the actual level.
I am also kinda confused on what the best way to handle errors is. Right now the game keeps on running but does nothing if it has crashed since the level generation process is still running. A try... finally... that closes that process could work, but I don't know what would happen if that process throws a error.
The process itself was really easy using the "Multiprocessing" Library. It handles calling functions, sending complex objects, arguments, terminating, joining, and most of the stuff I thought I might have to do myself using subprocess. (That would have been a nightmare)
My todo list:

  • Propper progress bar on level generation, I broke my old console based system.
  • Loading the generated next level
  • Finding a way to customize the level generator for special rooms etc.
1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement