Showing posts with label Testing. Show all posts
Showing posts with label Testing. Show all posts

Sunday, 9 December 2012

One Line Of Code

I am sure that everyone has these days when coding.  This is just a quick note to remind people to keep on going no matter how bleak things appear!

I had been working away on the new weapons and effects and got round to testing everything on the Xbox.  I do this from time to time because the Xbox does not perform in the same way as the PC does.  Much to my surprise the performance was a disaster on the Xbox!

That was late yesterday and I was going out in the evening so I left it wondering how long it would take to find whatever it was I had done to cause a frame rate of just 9 frames per second!  It was perfect on the PC but the Xbox was unplayable!

I had thoughts of the level being too complicated and having to come up with some clever code to cull more efficiently, or that the texture files were too large, so I would have to reduce the quality.  I had quickly ruled out the particle effects because although they were pretty the code, quantity and textures sizes were unchanged to effects I had been using for years and the performance graphs did not change when they were on the screen.



I've been working in I.T. long enough to know that whatever you last changed is the most likely cause for whatever problem you are now investigating.  This morning I therefore thought through all the changes since the last time I had successfully tested on the Xbox...

I thought it was a fairly easy non-performance affecting change but I have completely re-written the Audio Manager to change from using XACT to using the SoundEffect classes.

Some quick commenting out and I very rapidly confirmed that somewhere in my conversion I had made a mistake.  To cut an hours searching down I found it.

Just one very short line of code:
nextSong = "";

I had an endless loop that would start playing the next waiting piece of background music every frame because I had not cleared the variable once it started playing!

I am a lot happier now and I can go back to creating assets and effects for the game.

Thursday, 30 August 2012

Consequences

I made what I thought was a tiny change to the code to fix a problem and now when I test on the Xbox the steady 60 frames per second (FPS) sometimes drops momentarily to 58 FPS.  This is not noticeable in game but I know it is there.

It demonstrates how close to the limit my current code is.



The change was required to fix a problem where a small model in some positions viewed from some angles would disappear from view.  It was either a bug in the frustum to sphere intersection testing code or I was just being over zealous with what I culled from the view.  Whatever the problem was, it was solved by increasing  the area used for testing what was potentially in the view.  The consequence is that more models are likely to be drawn each frame.

Those few extra models being drawn was enough in some places on my first level to tip the balance between drawing everything in 16.6 milliseconds (one frame) to not being able to draw everything in that time.

I'll tinker with the code to try to fix both problems.

Sunday, 20 May 2012

Game Testing

My wife's mum and brother came round for breakfast this morning and I could not resist showing Matthew, my brother-in-law, progress on the game. 

I should point out that Diabolical is designed to be the type of game Matt and I like to play.  We have been playing coop shooters together for many years.  When we lived next door to each other and prior to Internet gaming being popular, we had a network cable strung between our houses to play anything we could that had some form of network game.

Back to today.  I was very pleased that not only was my code in a fit state to test on the Xbox 360 but we had great fun shooting at each other.  As my current test level only has one alien Bot at the moment the coop bit only lasted a few seconds.  After that we just kept shooting each other, dying and selecting to respawn.



Split screen play meant that hiding was not possible but the rather sparse test map has more than one path to everywhere so while one was distracted with chatting the other one of us would take advantage.

It was fun and everything worked without a crash or a glitch.  It was a shame I haven't got further with the maps but next time I hope to have a finished or near finish level.

For some time now I have been creating models, buying models and starting to put them in to a form I can use in a game level.

It's taken me a bit longer because when I changed the game to run the update in a separate thread it broke the level editor!



I've now fixed the editor and slightly improved it so I can get back on with building the maps.