←  Media

ComputerCraft | Programmable Computers for Minecraft

»

ComputerCraft Event System Flowchart

KingofGamesYami's Photo KingofGamesYami 02 Apr 2016

I decided to make a visual of the event system. It's not by any means perfect, but I'd like to say it's pretty nice.

Posted Image

Made with lucidchart.
Edited by KingofGamesYami, 04 April 2016 - 01:52 AM.
Quote

wilcomega's Photo wilcomega 02 Apr 2016

Could have used this when i was making blueframes :P this makes lifes easier
Quote

Lupus590's Photo Lupus590 03 Apr 2016

This could be a handy image for learning how to use coroutines, or for anyone making a tutorial on the usage of coroutines (@BombBloke this may break up your wall of text quite nicely)
Quote

Bomb Bloke's Photo Bomb Bloke 03 Apr 2016

It's a pretty good graphic. I assume you don't mind if I yoink it?
Quote

KingofGamesYami's Photo KingofGamesYami 03 Apr 2016

Go ahead; however it'd be good to keep in mind the image updates if I make changes to the flowchart. I won't remove anything, but I am considering adding to it.

Actually, while we're on the subject: Is there anything in particular I should add?
Edited by KingofGamesYami, 04 April 2016 - 12:02 AM.
Quote

Bomb Bloke's Photo Bomb Bloke 04 Apr 2016

I'd be inclined to expand on "waiting for an event" - you don't really do that if there're already events in the queue. There's also the matter of resuming other coroutines the manager may be handling.

You may also consider adding arrows for cases where os.pullEventRaw() is bypassed by calling coroutine.yield() directly. Adding columns for coroutine.yield() and coroutine.resume() may help you better visualise how data goes in/out of the coroutine.
Quote

KingofGamesYami's Photo KingofGamesYami 04 Apr 2016

I have modified my graphic to better describe how waiting for events works, including a separate process which adds events to the queue as the occur.

I also added a part which shows at which point other coroutines are resumed; I'm not sure if that's adequate or if I should have a better indicator that this process happens for each one.

The arrows for coroutine.yield() have been added, however I did not add columns for yield / resume. I just can't visualize how that would work, in my mind they are essentially the same; an analogy I would use to describe them is the sides of a coin (heads/tails).

Finally, I added how errors work. This added a lot of stuff. Unfortunately I have lines that cross, I'll work on sorting that out without adding a lot of whitespace or making the arrows extremely ugly.
Quote

cmdpwnd's Photo cmdpwnd 05 Apr 2016

This makes life so much easier when writing coroutines! Actually with this much detail I actually think I could pretty easily write a non-coroutine program that still functions rather similarly to coroutines. ....... I think I will. hehe :)

Thank you so much for making this!
Quote