I have been very busy with school this last days, but this weekend I have some free time to keep working on Carcode, today I'm working on my OpenGL branch, currently I have the old car ported to new rendering (using glRecti), I tried with textures but admittedly I'm not very good at graphics so we'll keep the plain rectangle for now.
Added some framerate controlling code which yields a pretty and smooth animation, with current code we can have a world as big as we want, I already added a new object, the Road class which draws a simple road, which is currently just for test purposes.
The next thing on the list is to document the API for creating drawable objects, which mostly comprise of implementing the update and draw function, then layout the specs for collision detection and scripting.
Talking about scripting, I'm looking at two approaches to it, one would be have a function on the scripted object which may modify its behavior or internal data like "update", this could be nicely integrated with the current mainloop, however, it could be limiting for the car scripts, for example, for loops would not be very useful for things like moving the car, as updating and drawing of the car will only occur after execution, which means that in order to move the car to a desired place you cannot just loop and wait, however, given the nature of the car control (by acceleration and direction angle) I don't think this could be a problem, we should however stop comparing carcode with LOGO, as dynamics of carcode are very different.
The other approach to scripting could be threading, with this we could have non-blocking loops inside scripts, however, this could cause a nightmare of possible synchronization issues if not done right, it is possible that it would be more work implementing it than is worth, we could probably use yield and have some code checking if the script returns an iterator and keep executing the iterator each frame.
A snapshot of my opengl branch is available at http://cdrv.centralnogales.com/carcode-opengl.zip
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario