A Change of Pace

I’ve taken a few nights off coding to start thinking about game design for the fleet battles. I want to just start with probably a fleshed out game revolving around just the fleet battles.

There probably won’t be too much “game” in this game as fleet battles are not determined much by the player, but only influenced. What it will do is let me see how this influences affect the course of a battle.

So I’ve got a big spreadsheet with numbers and formulas to start working it all out. It’s beginning to come together nicely, especially the way a ship is fitted-out.

Continue reading “A Change of Pace”

More UI work completed

I’ve done a bit of refactoring of my UI code and brought it down a few hundred lines of code.

I’ve also started noting the performance. Right now, a window with a table and a bit of text and another window with just text gets me around 500-550 fps. This is from a base of about 2500 (if nothing is being drawn to the screen).

I have no idea if this is acceptable or not. In contrast, my scene with a sun and an earth runs at about 200-250 fps. The thing is; I’m doing things in the most inefficient way.

So; I put some work into speeding up the code. Everything in the UI uses a single shader for one. Next is to get everything to use a single VBO; it’s not doing that now because my text quads are drawn with position info in the vertices, whereas everything else uses a translation and scale matrix to define the position.

If they both use the translation matrix, I can remove any need to bind different buffers between calls. This should make things faster.

Also, everything at the moment binds it’s texture. However everything uses the same texture (except text); so I may be able to remove the  glBindTexture calls for a lot of the time. Probably via a texture manager or something.

If it’s still not fast enough; I’ve been reading about instance drawing and also about using textures to hold position info (R,G is x,y and B,A is w,h). I think I can combine these so that my gl_InstanceID in the vertex shader is my lookup into the texture of position info. I’d probably also need a second texture to hold UV coords seeing as these don’t change much either (textures rather than providing a lookup array to the shader, only because that would need to be updated and passed each frame anyway).

Here’s a picture:

SpaceEngineUI 2015-01-02 23-16-02-99