Photo
Ahh Time to Update. The first Update is http://www.littlekrakengames.blogspot.co.uk/2012/08/if-you-wish-to-make-video-game-from.htmlAs I’ve mentioned I’ve started a company with 4 fellow students and we have been working hard over the summer holidays to build the office to a usable state and build up money in the company. I wont go into detail as thats what the blog is for.With OpenGL I have managed to implement a spritebatch system which can batch sprites based on its texture and render it out to the screen. In the image I have a single textured sprite which is rendered 100 time and has a framerate of ~220 with gDEbugger (though I will get a better reading tomorrow). Its not very good at the moment as I would like it closer to 1000 fps with that many sprites and with sprites that have the same texture so no constant rebinding per sprite.I have a feeling its down to me calling glbufferdata(…) each spritebatch (will be called twice per render in the current scene once for vertex and the other for texture coords) I also set it to static draw which may also limit it.Once I get a better performance monitor I will try and optimise it to get to 1000fps as much as possible so I can render 10000+ sprites ideally of the same type without going under 60fps.Will post again once I get some better performance out of the batch renderer.

Ahh Time to Update. The first Update is http://www.littlekrakengames.blogspot.co.uk/2012/08/if-you-wish-to-make-video-game-from.html

As I’ve mentioned I’ve started a company with 4 fellow students and we have been working hard over the summer holidays to build the office to a usable state and build up money in the company. I wont go into detail as thats what the blog is for.

With OpenGL I have managed to implement a spritebatch system which can batch sprites based on its texture and render it out to the screen. In the image I have a single textured sprite which is rendered 100 time and has a framerate of ~220 with gDEbugger (though I will get a better reading tomorrow). Its not very good at the moment as I would like it closer to 1000 fps with that many sprites and with sprites that have the same texture so no constant rebinding per sprite.

I have a feeling its down to me calling glbufferdata(…) each spritebatch (will be called twice per render in the current scene once for vertex and the other for texture coords) I also set it to static draw which may also limit it.

Once I get a better performance monitor I will try and optimise it to get to 1000fps as much as possible so I can render 10000+ sprites ideally of the same type without going under 60fps.

Will post again once I get some better performance out of the batch renderer.

Photo
Managed to get alpha working which only required 2 lines of code so now I can load PNG images with alpha and have it render correctly.I have also spent most of the day looking at methods to create a good sprite structure rather than just create a VBO for each sprite as I mentioned in the previous post. In the previous post I mentioned trying to do it in one draw call though this seems to be rather imposable without hacking a sprite system and seems to only benefit particle effects. What I have spent a bit of time looking into is using a spritebatch system which will deal with the draw calls and I believe use a dynamic VBO rather than a static one. I will put some more research into this but it seems to be the best way to go and is very similar to the way that XNA deals with sprites.I will also try to implement ttf before I start this so I can have some better error output and information about the current render. The implementation of font in OpenGL seems like a huge time consumer but I will try to get it implemented

Managed to get alpha working which only required 2 lines of code so now I can load PNG images with alpha and have it render correctly.

I have also spent most of the day looking at methods to create a good sprite structure rather than just create a VBO for each sprite as I mentioned in the previous post.

In the previous post I mentioned trying to do it in one draw call though this seems to be rather imposable without hacking a sprite system and seems to only benefit particle effects. What I have spent a bit of time looking into is using a spritebatch system which will deal with the draw calls and I believe use a dynamic VBO rather than a static one. I will put some more research into this but it seems to be the best way to go and is very similar to the way that XNA deals with sprites.

I will also try to implement ttf before I start this so I can have some better error output and information about the current render. The implementation of font in OpenGL seems like a huge time consumer but I will try to get it implemented

Photoset

Took a little less time than I was expecting to get textures working.

So I have a very basic texturing using FreeImage which allows me to use many different Image formats for textures.

At the moment I dont have any blending set up and I also need to read through the FreeImage documentation to see if the images are flipped on load as the texture coords dont quite match up to what I would expect so it wouldn’t surprise me if it was flipped on load (I know thats how BMP’s are stored).
Also it uses BGR for the colour format which is also the same way that Bitmaps store the colour data so it seems to be loading like a bitmap.

There is also another odd issue which I noticed yesterday but didn’t really understand why it was doing it. when the program is loaded the sprite object gets rendered slightly higher than it should as you should be able to see in the two images. I found this was due to using the windows WM_SIZE call back as it would set the screen size to 792, 570 when it should be 800,600. So its set to 792,570 on load and then the viewport get set to 800, 600 causing the odd cut off as the window is still at 792, 570. So when the window is resized even by a pixel it will set the viewport to 792, 571 it moved down 1 pixel.

I need to work out how to fix this but I now know what is causing it.

Photo
Ok so a little progress over last time but still need to improve a lot of stuff and get a lot of other items working in OpenGL.So I have the orthographic mode set up properly now as well as a basic camera (though lookat seems to be broken) and have the model view matrix.The next step is to get a texture onto the quad and sort a few little things out.After that I will move on to doing a few tests with the geometry shader and look into instancing and reducing the amount of draw calls within the renderer.I’ve been looking around at different ways to optimise and try and modernise the way im using OpenGL. Though as per usual with most communities there are people saying one thing and others saying another. From the sounds of it if I wish to reduce the amount of draw calls I may have to look into texture atlasing however that doesn’t sound like a great idea for multiple sprites of different types. I can see it being very useful for particle effects and static levels.I will have to ask around a bit I think and also experiment with different techniques.

Ok so a little progress over last time but still need to improve a lot of stuff and get a lot of other items working in OpenGL.

So I have the orthographic mode set up properly now as well as a basic camera (though lookat seems to be broken) and have the model view matrix.

The next step is to get a texture onto the quad and sort a few little things out.

After that I will move on to doing a few tests with the geometry shader and look into instancing and reducing the amount of draw calls within the renderer.

I’ve been looking around at different ways to optimise and try and modernise the way im using OpenGL. Though as per usual with most communities there are people saying one thing and others saying another. From the sounds of it if I wish to reduce the amount of draw calls I may have to look into texture atlasing however that doesn’t sound like a great idea for multiple sprites of different types. I can see it being very useful for particle effects and static levels.

I will have to ask around a bit I think and also experiment with different techniques.

Photo
Been a while again to update but im currently working on openGL and trying to get GLSL 4.00 setup so that I can uses the latest openGL has to offer.I spent a while trying to get the triangle working as it kept crashing my drivers every time it came to draw the vertex array but then I managed to get it working for once sec and then it broke again. I worked out that it may be my graphics cards causing the issue as I have crossfire set up. Low and behold I turned it off and it worked. So im going to see if I can find the fix for it or I will sadly have to work around it which I would rather not.Now I have a base to work on I will try and get a lot more working and get a few shaders set up

Been a while again to update but im currently working on openGL and trying to get GLSL 4.00 setup so that I can uses the latest openGL has to offer.

I spent a while trying to get the triangle working as it kept crashing my drivers every time it came to draw the vertex array but then I managed to get it working for once sec and then it broke again. I worked out that it may be my graphics cards causing the issue as I have crossfire set up. Low and behold I turned it off and it worked. So im going to see if I can find the fix for it or I will sadly have to work around it which I would rather not.

Now I have a base to work on I will try and get a lot more working and get a few shaders set up

Photo
Finally I am nearing the end of Lua :)I managed to get a class bound to Lua and then pass objects of that class in and out of Lua which give me loads of control over Lua as well as my class objects.It does take a lot of work to get a class binded to Lua but once it is done there is no need to mess with it unless you need to add extra functions to the class.I have added the current testbed I have been using in the content source section but if you cant find it, its also here www.chrismillin.co.uk/LuaTesting.rarthere are still 2 errors I need to fix but they arn’t causing major damage atm. The first is that in Lua class1 = class2 means that class1 is pointing to class2 which is not what it should do. I have a feeling its something to do with the __newindex that i need to add a function which copies the data over correctly similar to the overload operator in c++ and c.The second issue is not cleaning up memory correctly as class objects are pushed into a vector and then when the release function of the class object is called it will delete the pointer but the vector will still be pointing to it. I know how to solve this issue and will look into some automatic unique ID generators so they can be deleted correctly.Thats all for now. I will be creating a mock framework soon which I can embed Lua into to see if there are any issues that I have not seen already and to see how data flows in a more real project.

Finally I am nearing the end of Lua :)

I managed to get a class bound to Lua and then pass objects of that class in and out of Lua which give me loads of control over Lua as well as my class objects.

It does take a lot of work to get a class binded to Lua but once it is done there is no need to mess with it unless you need to add extra functions to the class.

I have added the current testbed I have been using in the content source section but if you cant find it, its also here www.chrismillin.co.uk/LuaTesting.rar

there are still 2 errors I need to fix but they arn’t causing major damage atm. The first is that in Lua class1 = class2 means that class1 is pointing to class2 which is not what it should do. I have a feeling its something to do with the __newindex that i need to add a function which copies the data over correctly similar to the overload operator in c++ and c.
The second issue is not cleaning up memory correctly as class objects are pushed into a vector and then when the release function of the class object is called it will delete the pointer but the vector will still be pointing to it. I know how to solve this issue and will look into some automatic unique ID generators so they can be deleted correctly.

Thats all for now. I will be creating a mock framework soon which I can embed Lua into to see if there are any issues that I have not seen already and to see how data flows in a more real project.

(Source: )

Text

Some Old Stuff

I did this a while ago but though I would share it so anyone interested in assembly can look at the implementation and see how some of it works.

Pastebin seems so have de-formated my code but it should still be readable.

It is the ASM code that is used for the collision in the black paw library I wrote for the GBA. I will get round to uploading the whole thing sometime since I need to put it on my portfolio.

Photo
Well I’ve done 2 of the goals I had today for Lua which was getting tables implemented so that I could send and receive tables. It was fairly easy but then most of it has been so far its just making sure the stack is managed correctly which can prove difficult at times.
The next step for tomorrow is to look into getting classes/Userdata implemented into Lua so that I can pass classes to and from Lua and also have access to their functions and possibly their variables within Lua. This is going to be the biggest task so far as it involves using and setting up metatables within c++ which look to be a pain but I will carry on until it is done and then I can start to implement a basic mock framework and test if everything works. After I have finished this I will be uploading a link to the code for the testbed and mock so that the implementation for everything can be used by other people that may be new to Lua.The image above is generated using the following script and also some prints within c++http://pastebin.com/018vsybB
Edit: when in C++ the table values all get incremented by 1 hence why table and t end up with different results

Well I’ve done 2 of the goals I had today for Lua which was getting tables implemented so that I could send and receive tables. It was fairly easy but then most of it has been so far its just making sure the stack is managed correctly which can prove difficult at times.

The next step for tomorrow is to look into getting classes/Userdata implemented into Lua so that I can pass classes to and from Lua and also have access to their functions and possibly their variables within Lua. This is going to be the biggest task so far as it involves using and setting up metatables within c++ which look to be a pain but I will carry on until it is done and then I can start to implement a basic mock framework and test if everything works.

After I have finished this I will be uploading a link to the code for the testbed and mock so that the implementation for everything can be used by other people that may be new to Lua.

The image above is generated using the following script and also some prints within c++
http://pastebin.com/018vsybB

Edit: when in C++ the table values all get incremented by 1 hence why table and t end up with different results

Text

Lazy Work!

So I haven’t posted on tumblr for a very long time it feels like and in that time I have done a lot physically but not a lot code wise.

I’m currently working with 4 fellow students in a company started by us called Little Kraken. were currently working on our first project which is going to be a awesome little flash game. I will post a bit more about this later as well as how the company was started and what we’ve all been doing in it.

In my free time im still trying to work on Lua but have kinda been slow to work on it. Last weekend though I came back to it and started to work on it and got a few things completed but also hit a huge wall.
During that weekend I Set up a call function which was a simple non-parameter Lua function caller which I will use for simple calls. I have tested to see how to call C functions from lua which is also fairly basic and simple. I also got enumerations set up with a read-only table which is awesome as it allows me to add c enumerations to Lua and use them in the exact same way.

For the enumerations I used the code from a blog post by Tom Distler (source should be in the content source area). I have slightly modified it myself as there were one or two bugs in his code.

The brick wall that I came to was that I had used the enumeration to create a even manager that could take an event enumeration and then a function to be called when that event is triggered.
The problem I had came from the enumeration code as one of the functions pushed a value onto the stack and then never popped it off. This then cause the luaL_ref function to store a number and not the function.

This has all been fixed now and I have the ability to add events with functions to an event manager and them to run the code linked to them.

My next task is to start adding classes and Userdata to Lua and try and get that passed around so that my events can send classes into the function to assist with the handling of that event.

After all this is complete I will move onto looking into OpenGL 4.0 and getting a sprite geometry shader created.

Any future development in my own project I will try to update as much as possible but its hard to find the time to work on them now.

(Source: tdistler.com)

Photo
So like the ludum dare gamejam this year was another disaster on the GBA. So I think its time to move on and take all the skills I have gained from the GBA and build something I want to use.Im going to aim to create a 2D Engine which will allow games to be built through an Editor. My plan is not try and rush this like I normally do and also to keep with this project (which is going to be the hardest part).One of the areas im going to try and focus on most is adding lua script to the engine and allow the user to create a full game solely through lua. This is important to me as it will separate engine from game code and will also introduce me to scripting. This however will mean I need to create nearly every functionality possible in my engine that the user does not need to try and recreate it in lua.The engine will hopefully have all the following functionally (though I need to create a document for all this and break it down):Scripting through Lua with tolua++2D created on the Geometry shaderSupport for custom pixel shadersPhysics and collision through Box2DWindows Ribbon user interfaceMap EditorAnimation EditorPixel Art EditorThere will also be many different modes and formatting for the engine as well such as pixel art games can be made like normal or they can be made by creating a tile map or the pixel art editor could be used to palette based sprites which will limit the user to a single palette of a chosen size and will also allow for palette shifting which I have not seen implemented in any engine I have seen.This is going to be a huge project but im going to try and break it down and develop it over the next year+. I will keep my tumblr updated with development.

So like the ludum dare gamejam this year was another disaster on the GBA. So I think its time to move on and take all the skills I have gained from the GBA and build something I want to use.

Im going to aim to create a 2D Engine which will allow games to be built through an Editor. My plan is not try and rush this like I normally do and also to keep with this project (which is going to be the hardest part).

One of the areas im going to try and focus on most is adding lua script to the engine and allow the user to create a full game solely through lua. This is important to me as it will separate engine from game code and will also introduce me to scripting. This however will mean I need to create nearly every functionality possible in my engine that the user does not need to try and recreate it in lua.

The engine will hopefully have all the following functionally (though I need to create a document for all this and break it down):

Scripting through Lua with tolua++
2D created on the Geometry shader
Support for custom pixel shaders
Physics and collision through Box2D
Windows Ribbon user interface
Map Editor
Animation Editor
Pixel Art Editor

There will also be many different modes and formatting for the engine as well such as pixel art games can be made like normal or they can be made by creating a tile map or the pixel art editor could be used to palette based sprites which will limit the user to a single palette of a chosen size and will also allow for palette shifting which I have not seen implemented in any engine I have seen.

This is going to be a huge project but im going to try and break it down and develop it over the next year+. I will keep my tumblr updated with development.

Photoset

Day 3 and I’ve broken the AI, and Maps with Map scrolling but I have managed to get it kind of working and have also implemented the sprite and Animations from Joe Thompson.

I also have started work re-wrtting the world coordinate system which broke when added the map scrolling.
Since the collision is done on a world coordinate system based on the map rather than on the screen coordinates I have to constantly know where the player or any moving object is within the world. Originally I had a rather fragmented design for this and there was a global map position but it wasn’t used properly across the application.

As I have said I have re-written this and have adopted it into the player so his collision is now accurate and i believe 100% correct.

As before I was complaining about my cpu usage I had a cunning idea to only render the map when it moved up a tile (so the screen moves 8 pixels and then is reset and the map is re-rendered + 1). This has made a huge improvement though I expect there to be a slight stutter when the tiles are switching when I add more maps. Though this wont be ruin gameplay as the player can only shoot when stationary.

Photo
Day 2 of UOP GameJam and I’ve made a lot of progress in the code (though still not enough id say)Got 2 of the 3 AI’s that I was hoping to get done today which is the inocent AI that just walks backwards and fowards and the Shooter AI that will just stand and shoot.Both Rather simple but I made a system that allows for quick AI addition and removal so once I have all the AI set up I will only need to call the addAI function (with 2 parameters) and then it will add that AI.So plan of action tomorrow is to get the last AI implemented (though it may be a bit hard in the screen space I have at the moment since hes meant to run away if you get too close. I will also be implementing the A map scroll test and cry when all the AI positioning breaks with it (which I can foresee haha). Finally I have all the Character sprites ready form conversion so I will do that as well and set up all the player animations.Also to point out there is an odd screen tearing happening which I dont really know how to fix and I believe is down to me having slow copy functions or VBlackWait needs to be called at the start maybe rather than at the end but I will experiment.Im also running at 57% CPU atm with and will likely be around 68-75 with enough AI and bullets. Little scared to see if I can render a second map! though Im hoping I have about 15-20 CPU left (though I dont want to be running at ~100 constantly!)

Day 2 of UOP GameJam and I’ve made a lot of progress in the code (though still not enough id say)

Got 2 of the 3 AI’s that I was hoping to get done today which is the inocent AI that just walks backwards and fowards and the Shooter AI that will just stand and shoot.

Both Rather simple but I made a system that allows for quick AI addition and removal so once I have all the AI set up I will only need to call the addAI function (with 2 parameters) and then it will add that AI.

So plan of action tomorrow is to get the last AI implemented (though it may be a bit hard in the screen space I have at the moment since hes meant to run away if you get too close. I will also be implementing the A map scroll test and cry when all the AI positioning breaks with it (which I can foresee haha). Finally I have all the Character sprites ready form conversion so I will do that as well and set up all the player animations.


Also to point out there is an odd screen tearing happening which I dont really know how to fix and I believe is down to me having slow copy functions or VBlackWait needs to be called at the start maybe rather than at the end but I will experiment.
Im also running at 57% CPU atm with and will likely be around 68-75 with enough AI and bullets. Little scared to see if I can render a second map! though Im hoping I have about 15-20 CPU left (though I dont want to be running at ~100 constantly!)