Hours 29-33 – some bits and pieces

So Xmas & New Year have been and gone: seriously where did that time go?!?

I was fully intending on finishing this game and submitting it to IndieCity by 31st Dec by putting in a a couple of solid 6 to 8 hour sessions. How naive! I ended up having barely any free time at all to work on this, which was quite an oversight on my behalf. However, thankfully I wasn’t alone as loads of other devs were in the same boat and we now have a 1 month extension on the IndieCity challenge! Continue reading

Hours 26-28: Time for a rewrite?!?

Uh oh – it’s another “Wow how the bloomin’ time flies!” blog post opening!

Well it’s been ages since I could get to write some more code on the game. Some pesky IndieCity launch combined with family and Xmas prep has meant that I haven’t had much of a chance at all to get coding lately.

But there’s more to it than that. During the first week away I’d been mulling over the frontend and level select system and hit upon an idea that I wanted to see through. Unfortunately I was going to have to shuffle around huge chunks of the code base and I knew that this would see me needing a switched-on brain and a good run of 2-3 spare hours.

So what happened? I ended up getting up early a couple of days ago, blasting through the code-base as quickly as possible, getting it compiling and running and…..creating one bloody great mess!

Here are the more gruesome details…

Game Length and Levels

I’d initially been thinking about the kind of game I wanted this to be from a play-length / replayability point of view, and given the mechanics my preference was to make something highly replayable that only took 20-30 mins a sitting. So I went with the classic branching approach where after every completed level you can choose the next one to be easier or harder. So you end up with a branching triangle where you can try out many different paths through to the end.

So far so good. That approach should work nicely I thought…I can have high scores for each stage, and maybe a ‘bonus’ set of levels part-way through that are more points-tastic but perhaps with a smaller barrier or something.

Level Select

So next I started thinking about the menu screens for selecting the levels, and what style they should take. And that’s when I had the “Good Idea” that’s been causing the problems:

My maps are tiny .png files that load up and get parsed in milliseconds, so why don’t I load them all up at the start and connect them together with corridors with no loading times! And then the high scores and other info could be displayed on the walls in the corridors as the player walks through them deciding which way to go. THAT WOULD BE AWESOME!

Having at least a modicum of sense I knew that this would put a real strain on the time remaining, but decided that it would really make the game hang together better, and went for the ‘what the Hell’ approach.

So a massive rewrite was called for as I was going to have to change the loading, updating and rendering of levels to be under a MapManager object that did all of the stitching together of stages and corridors, deciding which ones to draw and when. I desperately hope that I get the chance to show the levels being constructed while the player is on their current stage or corridor: wall pieces flying in from the side and pickups dropping down from above while you’re in the preceding corridor etc. Fingers crossed I get time for that ;-)

Coding Time

So getting up before dawn one morning I spent just under two hours typing furiously, and stupidly it was only near the end that I realised I’d have to use a bunch of matrices to rotate, translate and rotate again all of the corridors and levels so that they stitched together correctly. With about 10 mins to go I just blatted out some almost-complete guesswork matrix calls, and made one HELL of a mess. In fact the only good thing about it was that it was so bad I thought I should render all of the maps and corridors “connected by my matrices” to show badly wrong it was!

A pretty awesome balls up even if I do say so myself! Here it is in more detail:

And then the kids got up so I had to leave it like that! Bugger!

Progress at last

Tonight I’ve finally had a chance to look at the code more carefully, and spot the STUPID mistakes such as running the matrices through a bloody gameTime parameter (man I must have been really rushing!) and I’ve actually thought through what’s needed.

And happily progress is now being made and it looks like this:

That there is one T-junction corridor in the middle and two identical maps being loaded and stitched to the corridor exits (the white boxes) – Huzzah!

Of course as soon as I started walking through the corridor I crashed into an invisible wall, since the collision hasn’t been run through the matrices – d’oh! That’s going to take a bit of head-scratching to sort out, but hey, at least things are moving forwards again :-)

More blog posts coming soon I sincerely hope!

Hours 18-20: Time for a shader!

At this stage we now have a game that is quite playable: myself and Charlie have been having a good time trying to get a high score, Charlie no longer gets trapped in the walls and blames himself if he gets trapped and killed by the barrier since the radar is nice and visible.

So I decided that it was time to play with the graphics, and interestingly things went the other way for me this time! Continue reading

Hours 17-18: Barrier warning

It was Charlie who prioritised this one for me again. Now that he could belt round the map without getting stuck in the walls his new pet peeve was not keeping an eye on how far away the barrier was, and he kept getting killed seemingly without warning (ie he was ignoring my lovely debug info showing the distance it was away from him!).

So in went a simple arrow on the screen that goes from yellow to red the closer the wall is, and sits either at the top, bottom, left, or right depending on where the shortest point currently is compared to you.

Once again I made things too complicated to start with, using atan2 to get the direction and angle between the axis-aligned barrier and the camera angle and introduced bugs. Then I realised I could simply get the camera angle, work out which 90 degree quadrant it’s in, and change the arrow position accordingly. D’oh again!

Hours 10-11: A spot of tidying

First things on the tidying front is getting things set up so that I can share images on this blog.
I’d clamped the fps camera movement to the Y plane, so adding Y movement when in debug mode is easy to do, and that allows me to look across the whole map. I’ve set debug mode up on the tab key.
And how do you take screenshots in XNA? Very easily thanks to Gang of Penguins_01 and his post in the App Hub forums on how to do it :-) Continue reading

First code written!

Cool fun! I’ve got a copy of Learning XNA 4.0 from O’Reilly that I’d started skimming through, and I’ve found their chapters on creating an fps camera and rendering your first triangles. So within my first hour I had managed to merge the tutorials together with some newly found C# glue, and had a triangle that I could move around fps style. Win! Continue reading