Page 1 of 1

Gosub or procedures for game development?

Posted: Sat Jul 01, 2006 1:05 pm
by yabune
Is there any difference between gosub and procedures in terms of speed?
I want to create a game and I noticed in Waponez II example, the game is structured with gosubs.

thanks!

Posted: Sat Jul 01, 2006 2:09 pm
by Pupil
Procedures have some overhead (i.e clearing local vars etc) so it'll probably be faster with gosubs, but i think readability will suffer alot if you go the GOSUB way. If i were you i would use procedures if the project is going to be larger than Waponez, for smaller programs it doesn't really matter.

Posted: Sat Jul 01, 2006 3:26 pm
by Joakim Christiansen
I don think there can be much difference, I allways use procedures since I think it's more readable.

Posted: Sat Jul 01, 2006 6:09 pm
by blueznl
go for the most readable version on good hardware

once you're done, you can then optimize your code for worse hardware

or code on mid range hardware

by the time your program is finished the hardware is so much faster that it won't matter :-)