It is currently Tue Oct 16, 2018 10:22 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Mon Dec 04, 2017 9:38 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10893
Location: Rio de Janeiro - Brazil
ccovell wrote:
If I recall, Tepples, or some other person here, made a "Sprite" demo where each sprite was its own thread. So a demo has been made.

I think that was blargg. IIRC, the demo consisted basically in giving each object its own PC, that was restored before its logic ran, and then backed up for next time. No interrupts were used, each object was responsible for transferring control to the next.


Top
 Profile  
 
PostPosted: Mon Dec 04, 2017 10:37 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1107
Location: Pennsylvania, USA
tokumaru wrote:
ccovell wrote:
If I recall, Tepples, or some other person here, made a "Sprite" demo where each sprite was its own thread. So a demo has been made.

I think that was blargg. IIRC, the demo consisted basically in giving each object its own PC, that was restored before its logic ran, and then backed up for next time. No interrupts were used, each object was responsible for transferring control to the next.

So basically coroutines then?


Top
 Profile  
 
PostPosted: Mon Dec 04, 2017 11:14 am 
Offline

Joined: Sun Mar 27, 2011 10:49 am
Posts: 265
Location: Seattle
Ideally coroutines would/should save/restore the stack as well.

I implemented a coroutine system for my Game Boy game but ultimately scrapped it because it didn't win me much, and there were costs in terms of performance and complexity and flexibility (I had to be really conscious of my stack height because each routine had such a small one allocated to it).

My favourite thing to use coroutines for is scripting - in an RPG or something, you can write scripts right in assembly, no need for a separate bytecode or managing a state machine or anything.

On a more powerful platform with more spare RAM it might be worthwhile - you could have larger stacks and more memory per process, and you wouldn't take such a large performance hit. You could have tons of different tasks handling different things - collision detection, scripting, animation, physics, etc.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: yaros and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group