Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Multithreading!

Multithreading!

mousetail
mousetail
mousetails RPG · · 1 min read
2,023 0
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.

Discussion

Loading comments...