So these past 2 weeks I’ve been adding some “bits and bytes” to the engine.
Taking a rest between some more complex game mechanisms I decided to start doing a video player.
After a bit research I decided to choose theora, but a bit skeptic, I’ve used it before on a game company I worked at and I remember being a tiny nightmare, specially because of YUV->RGB(A) conversion and because of video/audio sync.
If I remember correctly we couldn’t play audio, we where using separated tracks and paying the audio via a normal music play and big resolution videos (>500??) where a killer.
Anyway, since I’m already using OpenAL for audio I decided to give it a try. Unfortunately I didn’t had that code we where using back then so I had to do some digging on the internet.
So after a few days I had it working but bumped into the same problem, a bit slow. Not as slow as before cause computers have evolved. But after some reading I discovered that you can actually cache some YUV->RBG values and speed went up by like 10 fold.
I can decode 1080p videos with audio on my Core2Duo @ 2 GHz. And I mention the core since I have the decoding from the file on a separated thread so on a single core it’s probably a bit slower.
But we probably will be placing videos around 512px width so there’s no problem there. I wonder if we could do the YUV->RGBA on the GPU side via a shader?
It’s also worth mentioning that I’m using OpenGL and “glTexSubImage2D” for updating the texture. I found out that it’s much faster than “glTexImage2D” because it respecifies the entire texture, changing its size, deleting the previous data, and so forth. “glTexSubImage2D” only modifies pixel data within the texture.
Tools
On the tools realm there was a need for a better Particle System Editor, the one we had has many things but adding stuff was turning into a nightmare, the old editor was build on XNA 3.1 which isn’t supported by VS2010.
Since the engine is already in C++ I started from scratch and built this handy tool in 3 days or so:
Not vary fancy but it gets the job done.
My next step was to fix most of the Sprite Sheet Editor bugs and issues my designer had been complaining about.
I already have an offline tool that grabs a bunch of tiny images and place them in an Atlas but most of the time the designer has the pieces together already on Photoshop so I incorporated a snippet of code that on double clicking an area tries to automatically detect the region around it. Anything that fails can be manually defined, the old fashioned way.
So in the next few days I’m working on the Animation Editor so the artist can quickly create and preview the animations from the sprite sheets without the need for me to place them in the game before hand.
I had most of these tools but they where awful. They did the trick for Vizati but now I’m trying to do things a bit better.
See you soon…