38
« on: March 05, 2010, 01:10:27 pm »
I have not replied for posts on the forum for ages. But seeing some of the lack of knowledge in the forum I just feel that I need to do a short post.
No excuse my language for a bit good folks.
First of all sdl is slow as FUCK, this is one of the main problems today, it's not about how big area you draw, if it's just "2d" etc. The costly part is the number of draw calls and what handles the actual drawing.
I am taking some of this data from my memory so stay with me. A non size changed Dwarf fortress screen is 80*25 units. Thats 2000 objects. In a simple SDL layout that would be roughly 2000 blit calls per frame with access to diffrent part of different textures containing the data needed. To keep a frame rate of 30 fps. thats 60 000 blits per second.
With sdl most of this is handled on cpu level, the logic is also handled on the cpu, if the rendering takes to long it will affect the logic and wise versa.
A modern computer in this day of age has a Graphical Processing Unit. This is called a GPU, in most cases it got it's own memory and this card is a master of floating point math operations. The card is built mostly for 3d operations, but it also got registers for 2d textures.
With something like OpenGL, you can transfer the workload of rendering, from the cpu to the gpu. We still need to know what we want to render where but the actual process of getting all our 2000 tiles on screen is now more of gpu issue.
I would like to try to do a full focused window version using the gpu as the workhorse as well. But i don't know if I have the time with current projects going on.
I am impressed and know the amount of work people have put in to this.
Quite simply, just doing it trough SDL won't cut it.
Sorry for my rambeling, and have a great weekend all you dwarf lovers out there.
By now someone have probably posted more things regarding this.
//TheSpaceMan