Is this the guy who made Terraria? Because, that seems like a simple solution, but it's a bit naive. You still need to continue the clock for each object off screen in case it needs to send a signal to the event coordinator. Maybe Terraria doesn't require this. I haven't played it.
In my implementation, there is a "Global Event Queue". It's basically an array of time stamps with a pointer that points to the object that needs to send an event signal. So, if an object needs to send a signal in, say, 2 minutes, it logs itself into the signal coordinator. There is an event loop each frame that finds each object that needs to signal this frame and tells it to fire. This way, an object stays "alive" when it's off screen but the expensive procedures like draw() aren't called.
4 comments
0 u/derram 09 Dec 2019 02:41
https://www.invidio.us/watch?v=YIDbhVPHZbs :
This has been an automated message.
0 u/Le_Squish 09 Dec 2019 05:44
Oi, I actuality was casually wondering about this.
0 u/Master_Foo 09 Dec 2019 06:36
Is this the guy who made Terraria? Because, that seems like a simple solution, but it's a bit naive. You still need to continue the clock for each object off screen in case it needs to send a signal to the event coordinator. Maybe Terraria doesn't require this. I haven't played it.
In my implementation, there is a "Global Event Queue". It's basically an array of time stamps with a pointer that points to the object that needs to send an event signal. So, if an object needs to send a signal in, say, 2 minutes, it logs itself into the signal coordinator. There is an event loop each frame that finds each object that needs to signal this frame and tells it to fire. This way, an object stays "alive" when it's off screen but the expensive procedures like draw() aren't called.
0 u/BitChuteArchive 09 Dec 2019 06:50
https://www.bitchute.com/video/P9SpNDxg75g8