Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorial] the drawcheck procedure!
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mazer




PostPosted: Wed Jun 11, 2003 7:19 am   Post subject: [Tutorial] the drawcheck procedure!

I'd like to start this tutorial by quoting Homer Simpson (the character, not the guy with the marijuana leaf for an avatar Wink ):
"Patent pending, patent pending, patent pending."
ok, there ya go let's start this.

the whole idea behind using the drawcheck procedure is because if you don't and you draw with many processes, chances are you'll get some butt ugly-- make that butt fugly-- results. mainly a whole bunch of flickering.

this happens, i suppose, because you are clearing the entire screen after a delay in your main loop that is different from the delay in your process. this means that you could end up drawing something in your process that'll end up on the screen for perhaps 10ms before getting cleared away. that may suck quite a bit.

take this for example:
code:

I used this in a popular Turing game. I think the "don't use processes" crowd got upset when they found out about it, but hey I was just a dump kid and it's all behind me. Smile.

yuck, right?

so how do we solve this? well, i suppose we could stop using processes altogether. but no, when i made evasive maneuvers, i had a shitload of processes going and i didn't really want to change it around to use procs instead. so i invented the drawcheck procedure (at least i think i did... i don't recall seeing anything like it before i made it).

which works pretty much like this:
- make a boolean variable to show if it's okay to draw in a process
- set the variable to false right before you View.Update inside your main loop (or put it before you draw in your main loop if you don't have much to draw)
- set the variable to true right after you clear the screen.
- make all processes wait until it's ok to draw before they actually draw anything.

code:

I was at my friend's house working on a Turing version of the game "Dungeon Dice Monsters" from Yu-gi-oh because I used to be a big nerd like that in my younger and more vulnerable days, when another friend called and asked me to explain this procedure. I felt cool for having invented something, and disgusting because I had just finished my shift at McDonald's and not having time to shower. My friend seemed to not mind which is cool, and we ended up getting around 150% percent on the project so I guess he liked that to. Happier days.


so it's like this:
- the process wants to draw the oval
- it calls drawcheck and goes into a loop, constantly checking if drawokay is true
- stuff happens in your main loop. if there is enough time between now and when you use View.Update, drawokay is true and if there isn't much time (or if View.Update has already been used), it's set to false
- once drawokay is true, the loop is exited, the procedure is complete, and it's back into the process
- the process draws to the screen


NOTE: the drawcheck concept was invented and copyrighted by Nick Coutsos. Any use of it without the express written consent of the author is very FROWNED UPON. Because let's face it, if someone uses my idea without asking, what can I do about it. Besides, why wouldn't I let you use it?!


well, that's about it i guess. questions and comments should of course be posted here. i hope this helps you out.
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Fri Jun 13, 2003 5:02 pm   Post subject: (No subject)

is mr tod ur idol or smoething nick?
Mazer




PostPosted: Sat Jun 14, 2003 9:03 am   Post subject: (No subject)

um... who the fuck is mr. tod?
Andy




PostPosted: Sat Jun 14, 2003 4:09 pm   Post subject: (No subject)

whoa nick, watch the language... pg 13...
and mr.tod is our school's history teacher who gets 50% of his resources from the simpsons...
PaddyLong




PostPosted: Sat Jun 14, 2003 4:17 pm   Post subject: (No subject)

dodge_tomahawk wrote:
mr.tod is our school's history teacher who gets 50% of his resources from the simpsons...


a sound source of information.
Andy




PostPosted: Sat Jun 14, 2003 4:47 pm   Post subject: (No subject)

its a good show, and u can learn alot about history and politics from it
Mazer




PostPosted: Sat Jun 14, 2003 8:51 pm   Post subject: (No subject)

oh, mr. todd! ah... well, i wouldn't know, because bad things happen to me: i had hamdon for history last year Evil or Very Mad

but damn, mr. todd is cool. i went to him for help on studying for my history exam last year and he knew that hamdon was worthless as a teacher so he really helped me out.
Andy




PostPosted: Sun Jun 15, 2003 3:14 pm   Post subject: (No subject)

ya but he's lazy tho, we handed in an assignment in november, and we still didn't get it back
Sponsor
Sponsor
Sponsor
sponsor
PaddyLong




PostPosted: Sun Jun 15, 2003 3:32 pm   Post subject: (No subject)

lol the funniest was in grade 10 our english teacher looked in the drawer of a filing cabinet and found all these unmarked assignments we did in grade 9 (grade 9 and 10 teachers were different...)
Andy




PostPosted: Sun Jun 15, 2003 7:03 pm   Post subject: (No subject)

ya the assignments were asigned in the 1920s unit and now we're in 1970s, i was like "SIR its been 50 freaking years!!! i want my paper back"
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: