Jordan Bonser
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout

Development Blog

XML Parsing: Asset Loading

28/1/2014

0 Comments

 
The past few days I have been finishing up some of the extra functionality for the GUI and fixing a few bugs. After doing this I decided it was time to make my engine a lot more data driven and decided to allow for the parsing of XML to load the assets such as Meshes, Animation Data, Sounds and Textures. 

This luckily didn't take much work as I had already created generic classes for parsing XML in a previous project( Another Win for reusable code! ). 

So now Instead of having a couple hundred lines of code for importing the assets for the engine I now have two lines:


ParseAssets parser( mEngine );
parser.ParseFile( "Assets.xml" );

With a tidy XML document that looks a little like this:
Picture
There are still plenty of adjustments to make and I'm hoping that even more of the engine can be loaded using XML, such as:
  • All Game Entities with positioning
  • GUI Layouts
  • Engine Settings i.e. Resolution/Shader Detail/Shadows Toggle

One massive advantage to this way of loading is the most obvious in that the code is a lot less cluttered but it also means that you don't need to recompile when you only want to tweak game specific values; further than that it means that you can load radically different levels/assets that you may need for testing without having to change any source code. 

Cheers :)
0 Comments

JBEngine: GUI Progression

24/1/2014

0 Comments

 
I have been working solely on the GUI aspect of my work for a while and have now come up with what is hopefully close to a final implementation. I've had to deal with issues to do with working in different spaces. i.e. converting from Mouse Co-ordinates and manipulating texture co-ordinates to finally get the final image in clip space co-ordinates. It has been tough and taken a few iterations to get it all right. 

I finally have a semi-finished example showing the use of GUI Buttons, Layovers and Text:

One of the more difficult decisions I made was deciding how to do the events for the GUI elements such as OnClickEvent. After doing some searching around I settled on using a C++ 11 feature the std::function. The important aspect of this feature is that it allows you to store a reference to a member function. Here is an example of how it is used: 
 //Create a function object for member function for this instance 
function<void()> myOnClickFnc = bind( &MyClass::FunctionName, this );
//Then Set the OnClickFunction for my GuiElement
button->SetOnClickEvent( myOnClickFnc );
The main advantage of this is that it is now fairly easy for any class to set their own member functions to work as the event function for an element and it is much safer than using normal function pointers. The std::function does still work for normal functions and also static class functions, the only difference is that you wouldn't need to use the "bind()" function. so it would simply be:
 //Create a function object for static class function
function<void()> myOnClickFnc = &MyStaticClass::FunctionName;
or:
 //Create a function object for function 
function<void()> myOnClickFnc = &functionName;
//Then Set the OnClickFunction for my GuiElement
button->SetOnClickEvent( myOnClickFnc );
I have read online that this new feature can be quite slow although at the moment I haven't noticed any performance issues and as a general rule a GUI isn't as performance critical as other parts of a game.

This project is really coming along and I am now looking to tidy up some bits and really design how the "Engine" will be exposed to the user.

Keep coding :)
0 Comments

And then there was sound... FMOD Ex

6/1/2014

0 Comments

 
I wanted to take a break from implementing the design for weight blended animations and so I thought I would take this opportunity to implement sound into the JBEngine. 

I had written some classes for the FMOD libraries for a previous project so luckily this was fairly "low hanging fruit". It was literally a case of copying the classes across and then including the libraries and away we go. I did add some debug logging to make sure that any problems would be supported. Anyway here is a quick demo of the sound implemented for the racquet swing in the squash game:

This is only a very simple demo to show a real game example of how the sounds are going to be used. This video does highlight some issues with the shadow mapping that wasn't there before so that will need looking at. 

I need to refactor some of the sound code to ensure it follows the same coding standards as the rest of the project and some testing to ensure no bugs have crept in.

All in all this little task went well and takes the project into the realms of an Audio/Visual Project. I do need to now get back to working on the design for animation blending otherwise it will never get done.

Cheers :)
0 Comments

Simple Blended Animation and GUI Improvements

24/12/2013

0 Comments

 
I have now managed to get a very simple implementation of blending two animations together. I created a snowman in 3DS Max and applied two animations to it, a slide forward (since snowmen can't walk) and a jump. This didn't take long at all to get a simple version working but it is lacking a lot in design which is my next major step. 

Unfortunately my artistic skills are pretty poor and I have been trying with no avail for a while to create a simple character with walk and run animations. This would allow me to properly test the blending, introducing fade in/out values and blend points. 

As the art has been taking me so long and I needed a break I decided to tackle some low hanging fruit( Double Buffering ). This was already partially implemented but could really do with some wrapping up in preparation for the next task after animation( GUI/Fonts ). I have now created a double buffer object that has two framebuffers and that object deals with switching between the two buffers and allows you to get at the Texture associated with them. Once the double buffering has finished rendering it is finally rendered to the default buffer to present to the screen.

Using this I have laid the foundations of some core GUI classes, the first being a GUI Layover, which is basically just a full screen texture like a HUD. User Interface design is such a large part of a game that I will be approaching this with a lot of care to try and create a flexible design that will easily allow me to create, draw and interact with the GUI components. Anyway I have been babbling on for too long here is the video: 

The video has two layovers active, the writing and the boxes on the top and bottom and also a blue gradient from the sides. This gradient effect is similar to how some games visualise damage being taken but is normally a red gradient. 

Next few things are getting my artistic finger out and produce a model I can actually test some of this blending with properly. Could also potentially add sound into the engine as that is low hanging fruit as well.

Much more to come, hoping to get some done over the holidays in between the alcohol and merriment but it is unlikely.

Merry Christmas :)
0 Comments

Loading Multiple Animations

18/12/2013

4 Comments

 
Since finishing the first working version of the animation I started testing out different file types and cleaning up a lot of my code. Since then I have been attempting to implement multiple animations and animation blending.

First off I have created an "AnimationTrack" class which hold all the keyframe data for one animation regarding one bone. That is slightly confusing to say, basically the bones no longer hold the keyframes for an animation, instead they have a number of tracks which hold the keyframe data for each specific animation. This way multiple animations can be realted to one bone hierarchy. 

Second of all I needed some way of importing multiple types of animation, which wasn't so easy. Assimp supports multiple animations and with the right files it is fairly straightforward. The problem is that I am using 3DS Max and ideally collada files for all my models and the combination of the two has been a pain. Apparently 3DS Maxx doesn't allow you to easily export multiple animations in one collada file(Why?? I have no idea!!). This meant I would either have to use a different file type such as ".x" or find some way to get around this issue. After some searching I found that there are ways in which people have had to get round this before, specifically for importing into the Unity Engine.

The way in which unity deals with this is to have all animations represented on a single timeline in 3DS Max and then using the Start and End KeyFrames breaks the animations up when loading. Personally I don't like this as it means you can't just load a file and it will all work perfectly. 

The approach I thought of was to have seperate collada files all with the same bind pose model but with different animations inside. This way when the file is loaded it will check to see if the model already exists and if it does just check to see if there is a new animation and just load that. That way all you ever have to do is load as many or as little files as you need, i.e. the animations you will need and you aren't altering one file all the time to change one animation. This approach has caused more trouble than I thought, mostly due to 3DS Max once again. Max was naming all the animations the same when being exported and also often didn't supply a name for the RootNode of the scene, which was what I was using to check the model was the same.

Ideally I would want my approach to work but I decided I had spent too much time on it and instead implemented the "All in one timeline" approach. I have now got this working and although I do have to provide extra input it works fairly well. There is more than likely going to be extra input for things like bone masking and specifying blend points so It doesn't seem too bad, also it seems to be the standard way that artists do it so that is always a benefit.

I have got the animations loaded in this manner now, although there isn't much to show. I should shortly have a demo of multiway blended animations.

Keep Coding :)
4 Comments

Skeletal Animation Completed!

20/11/2013

0 Comments

 
Here it is, I have finally finished Skeletal Animation. It has been a long time coming but I have polished it off at last.There were a couple of things that tripped me up and I managed to spot them by simplifying everything down and using a basic 3D model of a cylinder with just three bones, bending in one direction. This is some advice I would give to anybody that is trying to implement this. I think one of the main reasons I didn't do this to start with is purely because of the amount of time it would have taken me(I attempted it a few times in Blender). I had to bite the bullet eventually but I created it in 3DS Max and had it created within about 10 minutes. Just goes to show you the difference between an intuitive and non intuitive UI design. If anybody wants a copy of this model it is here:

Here is the Collada Version and the 3DSMax Version

The two bugs I found were both to do with assimp in some way. Firstly there was a flag I had set for the importer "aiProcess_FindInvalidData" which was causing any Keys from ym keyframes to only appear once if they were the same through the entire animation. After changing this the animation was almost perfect but a few of the bones were still off quite a bit.

This comes to the second issue I had which was from the assimp documentation telling me that the transformations for the Key Frame should be applied as: Scale * Rotation * Translation, when in actual fact I had to change it to Translation * Rotation * Scale. 

Anyway enough of my ramblings, here is the finished product that shows the model finally animating correctly:

This project has taken me quite a long time and I think that if I had just simplified it all much earlier on then this would have been done much sooner. Whilst doing this I noticed that debugging the matrix data for the animation was actually rather complex. This was due to the fact that keyframes aren't stored as Matrices so the only thing you can really check is the positions. I am hoping to put together a simple application at some point that will allow the user to load a model with animations and then be able to check the data assocciated with any bone at any point in time. This will hopefully make other peoples debugging much simpler as they will have a correct version of the running animation with the key frame data exposed for them to compare against their own version.

Okay so this isn't quite the end yet, there is still plenty more to do. Next few things on my list are:

  • Tidy up all the animation code
  • Do some testing on various file formats to ensure they work
  • Add support for blending multiple animations
  • Do some performance testing and see how I can make the animation more efficient
  • Look into ways to incorporate the animation with player input

Once all these things are done I can look into either creating a squash player or outsourcing to an artist and get them to create the player and all its animations, which is a much better option. 

Cheers :)
0 Comments

Animation: Parent Hierarchy Working

13/11/2013

0 Comments

 
As a quick test on the transformation hierarchy and the vertex weights I decided to leave out the key frame data and apply a simple transformation myself to just one bone. 

This can be seen below: 
As you can see the arm rotates smoothly in a circle which proves that the Bone Hierarchy transformations are correct(at least for the bind pose). This points out that the issue is solely with how the key frame data is being loaded or that an extra transformation step needs to be done in order for the key frame data to be used. 

I'm definitely nearly there with this now, can't wait till its cracked.

Keep Coding :)
0 Comments

Animation: Almost there now..

12/11/2013

0 Comments

 
I've had another breakthrough with the animation and it now animates in a similar way to how it is supposed to look. There was some issues with the timing that caused the animation to jitter between only a few keyframes. Since getting this sorted and playing with a few of the transformations I have now got it pretty close, take a look: 

As you can see it is still quite a bit off, I definitely believe that this is now just an issue with the transformations and will hopefully get this figured out pretty soon. 

Just do what makes you happy :)
0 Comments

Animation Aggrevation

8/11/2013

0 Comments

 
Still struggling with this animation problem, which is starting to set me back quite a lot. After trying every which order of transformation and looking online at a few different implementations I still can't figure out what is going wrong. 

My next step is to take it back to loading of the animation and see if I can see any problems with the matrices as they are being loaded. Luckily the model I'm using is stored in a human readable format so I can compare the data for the key frames easily.

The only other problem that I could see it being is an issue with the quaternions for the keyframes not being correct. This again can be tested by doing some debugging at the animation load time. 

Hopefully I will get there soon.

Keep Coding :)
0 Comments

Animation - Getting There

31/10/2013

0 Comments

 
I have had a couple of break through's in the past week, finding some major bugs in various parts of my code. Firstly not all the bones were being gathered correctly from the importer. The per frame calculations were off and I believe they still are slightly. Finally and probably the hardest to track was that the bone data was not being passed to the shader correctly. After fixing these few issues I am pretty close to having this animation finished. At the moment the character is loaded and does move frame by frame the only problem is that the character looks slightly different, see if you can spot it:

Picture
Picture
Can you see it yet? 

All joking aside I think I am definitely very close to having this animation nailed. The final problems are more than likely just due to some matrices being transformed in the wrong order. I am hoping to get this polished off as soon as. 

Peace :)
0 Comments

Assimp Animation

23/10/2013

1 Comment

 
It is about time I put an update about what I have been getting upto. In the squash game I have currently been working on implementing full skeletal animation so that I will be able to use full character models for the players rather than just a racket. I think once this part is implemented and I have got some decent models moving around the court it will start to look quite impressive and will really allow me to progress much further with the game play aspects of the game. 

I have had to take a pretty in depth look into the way in which animation works and specifically how Assimp imports all the animation data. This has taken a lot longer than I first thought. firstly getting my head around how Assimp imports and then deciding a good way to represent that in my code to allow for flexibility. 

I am finally at a point where all the animation data has been imported successfully and I have new classes to represent this data such as: Animations, Bones, KeyFrames. I have also added all the per vertex weights for the bone data. The part that I am currently working on is performing all the bone transformations per update and then using that in the shader to move the mesh. This is taking me longer than I originally thought but I am hoping to get it nailed pretty soon. I will upload a video of the animation as soon as it is done. I may optionally provide a tutorial to show other Assimp users how to gather all this animation data from a loaded model.

Keep it Easy :) 

1 Comment

Simple Shadow Mapping

29/7/2013

0 Comments

 
It's been a while since my last blog post, but I've not just been sat on my arse doing nothing. Well I did go to cyrpus for a week so that is a bit of a lie. Since getting back I have been working on Shadow Mapping which has taken me a fair few hours. First getting the theory of it down and then diving in and trying to implement it. This failed pretty quickly and I decided to break it down into much smaller parts. First I created a second framebuffer to use to render the depth map. To check that this framebuffer was working correctly I created a Render Method that did a straight copy from one texture to the screen. This also gave me the chance to output the depth map to ensure that it was being created properly. 

The second part was creating the shader that would calculate whether the pixel was in shadow or not. This part was a little difficult as I was using various sources of information for this and they all did things slightly differently. The most difficult was ensuring that the texture co-ordinates were being calculated correctly. Which meant I had to pass in the Lights View Projection Matrix. My confusion came mostly whether It needed to include the lights model matrix or not, or the actual model matrix for the object. After a lot of shader debugging I managed to get it all Working and here it is: 

As you can see the shadow maps are pretty solid and it still needs a little work. Luckily I decided early on to use the Colour Buffer for rendering the depth which means I can now easily port this to use Variance Shadow Maps. This will allow for a more gradual fade from shadow to light.

As I have implemented the render method for a full screen texture and a new framebuffer, it now means I will easily be able to add post processing effects into my project. by bouncing from the default frame buffer to my newly created one and back until finally displaying the final image on screen using the full screen texture render method.

All of which I am hoping are things to come.
0 Comments

Physx Replacement

26/6/2013

0 Comments

 
I have recently changed the Physics Engine I am using to nVidia's PhysX as this had much better documentation than bullet and I didn't get much response from the Bullet Forums. The Bullet Functionality is still there so I could revert back if needs be. 

It has taken me a while to get PhysX integrated with my engine and also trying to maintain a generic structure. I finally got it working well and I have also implemented the one thing I was struggling to do with Bullet, which is callbacks. 

Essentially all they do is report when specified pairs collide so you can do some sort of game logic, in my case this was when the ball bounced with the floor or with an area that was out of play. Anyway enough talking here is a video of it in action: 

Okay so it isn't that impressive but it is the foundation for every other sort of interaction between physics objects and in game logic. Now that I have got these bare essentials in I can now put the physics stuff to one side and concentrate on some of the game logic. The next few things that are coming up are: 

  • A game class that can send messages to the desired parts of the game and deal with keeping score and stopping and starting play.
  • Shadow Mapping for the ball as it is hard to visualise depth at the moment.
  • Mouse Picking to allow you to use the mouse to aim your shot.
  • Animation to allow the use of a full character model instead of a racquet

Well there is still lots to be done and most of these things are pretty large pieces of functionality, I'm hoping to get at least one thing done very shortly as I seem to be on a roll at the moment. 

Cheers :)
0 Comments

Squash Game: Physics Dilemma

1/6/2013

0 Comments

 
So far in my game I have been using Bullet Physics which is a free to use, open source physics engine. This was great for quite a while but I ran into some issues fairly early on. The next part of the functionality I wanted to implement was the ability to let the game know when the ball goes out of play. This can be done either by the ball bouncing twice or hitting the wall in a invalid position. To implement this needed some ability to test the collision of two certain objects and then call some sort of callback or trigger to do the game specific logic, which turned out to be more difficult than it first seemed in Bullet. I played around with it for quite a while, attempted to look at the documentation of which there is nearly none. I finally gave up and searched around on the forums and eventually asked a question myself to which there was no reply. Finally after wasting a lot of time I decided to look elsewhere, which is when i found nVidia's PhysX. I researched a little, making sure they had better documentation and ensuring that there was examples of the functionality I wanted to create, which there was. So now I am currently in the middle of switching to this new physics engine.  

Technically I am not switching the two I am just providing the functionality for the new Engine as all my code is wrapped up so that you can easily replace 3rd party libraries. It is still taking some time as I am having to learn this new API, although I have noticed that the Physics engine all tend to follow the same names such as "Actors" and "DynamicRigidBody". I will hopefully have a new demo up and running before you know it, I am still trying to juggle iOS development at the same time as this project and it is taking its toll on both projects. 

Keep it easy :)
0 Comments

Added Lighting and New Types of Shot

12/5/2013

1 Comment

 
It's been a while since I have done a blog post, mostly because I've been playing around with my MacBook and learning all the iOS jargon. I have still been taking the time out to work on the squash game and I think it has improved aesthetically quite a lot. I have added the lighting to the project, at the moment this is just a pointlight above the court. I have also some extra types of shot to the game, these are:
  • Lob Shot
  • Cross Court Shot

Now that the game has the main three shots I think it is at the point where I can really start applying the "Game Rules". This means adding in the other player and the points system and start dealing with the "Out" and "Double Bounce" logic. 
Before I get round to doing any of that I still need to adjust some things with the new features I have Implemented. Currently most of the light data is hard-coded into the shader which needs changing. Secondly I want to change the light to a large spotlight which will make shadow mapping easier. I also want to add the flexibility to my engine to specify if a model should be affected by light at all because as you can see in this video you can no longer see the sky box very clearly.

Lots of new directions to go with this one, some graphical and some related to game play. I normally tend to sway towards the core graphical stuff but I really need to get to work with the game play so I can stop being ashamed to call it a "game". 

Keep it easy :) 
1 Comment

Squash Swing Component and a Z Axis dilemma

22/4/2013

0 Comments

 
I've not really added much to my squash game for a while as I have been playing around on my MacBook. I have implemented a pretty simple swing functionality to the game though, this features the first main piece of interaction between multiple entities and their components. It was a bit of a test for my component system but it seems to have come together quite nicely. 
There is still plenty more to do, currently you can only have one type of shot, it simply chooses the wall on the side that the racquet is facing and aims for the back corner of that wall. This will eventually be split up into different shots like the drive shot which aims to hit the ball straight down the wall nearest the player. Other shots are the cross court shot which aims for the other back corner and the drop shot which plays the ball fairly soft to force the opponent to rush forward.

The Z axis dilemma I had was that I made the mistake of forgetting the difference between openGL and DirectX when it comes to the camera, i.e. the camera looks down the -Z axis rather than the +Z axis. This meant that for a long time my x axis were flipped over and that caused a bit of confusion when I was trying to implement the swing component. Luckily I sorted this out and all is well. Apart from I now have to rotate all my models 180 degrees to get them in the correct orientation.

Keep it easy :)
0 Comments

    Archives

    May 2020
    April 2020
    January 2020
    November 2019
    October 2019
    September 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    August 2018
    July 2018
    June 2018
    March 2018
    January 2018
    June 2017
    February 2017
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    February 2016
    January 2016
    December 2015
    November 2015
    September 2015
    August 2015
    July 2015
    June 2015
    March 2015
    January 2015
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014
    May 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012
    June 2012
    May 2012

    Categories

    All
    2D
    3rd Year Project
    Agile
    Android
    Angular
    Animation
    API
    Apple
    Apps
    Arden
    Async
    Awesomium
    C#
    CI/CD
    Clean Code
    CMake
    Cocos2d-x
    Colour Match
    Compilers
    Cross Compiling
    Cross-Compiling
    Databases
    Design
    Development Tools
    Docker
    Electronics
    Examples
    Flask
    Flask-Login
    Fmod
    Game Development
    Godot
    GUI
    Hackathon
    Hacktoberfest
    Hardware
    Home Life
    IBM
    Inspired Gaming
    Instancing
    Ios
    Javascript
    Jbengine
    Kata
    Level Editor
    Linux
    Microsoft
    Mobile Development
    Monogame
    Moodster
    Motivation
    Networking
    Objective C
    Opengl
    Open Source
    Organisation
    Physics
    Physx
    Pi
    Planning
    Post Mortem
    PyGame
    Python
    Quart
    Quasar
    RakNet
    React
    Road To Eldoarado
    Scripting
    Scrum Master
    Sessions
    Session Timeout
    Social
    Sound
    Space Invaders
    Squash Game
    Squash Game
    Streaming
    TDD
    Team Leading
    Test
    Test Driven Development
    Travis
    Unity
    Unity Development
    VSCode
    Vulkan
    Web Applications
    Worklife
    WSL
    XML
    XNA / C#

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout