Monthly Archives: January 2013

Hud and gui overhaul

Lots of stuff happening – mainly hud and gui overhaul – so 2d art.

Working with an artist and every day the old 2d art is getting chipped away. Interesting ideas tend to lead to new code to support the new art. A total 180 from working on story/cutscenes, no biggie, making good progress nonetheless. Very excited because a 2d overhaul was a big thing on my list – and because I can’t reasonably do it alone it is one of those things that was a mystery, in terms how – how, when, etc, now very much clearer.

Triggers and cutscenes

The weekdays went by well – I each day I addeda nother little tid bit in the forms of what I call “triggers” which are ways of communicating with the game engine – outside of the game engine. So via XML (if this sounds too fancy for you – think of them as regular text files).

Here is an example of trigger:

trigger
__triggerType attr1="ship_command"
__shipName attr1="playerRaider"
__commandType attr1="goto_position"
__position x="0" y="0" z="-200"
__reletiveObject attr1="playerRaider"
/trigger

This trigger causes the ship named “playerRaider” to be issued a command to go to a position. Because a reletive object is specified (the same ship that’s being given the command” the position is calculated in front of the reltive object. Meaning that this ship will fly forward about 200 units in space. Using these sorts of triggers I can give orders to ships, I can create ships, I can destroy ships, basically do anything I want in a scripted fashion. Meaning that I can write a story line :) and that they are easily moddable – though time consuming.

This weekend I wanted to add something more substancial than the little daily triggers of the days past, so I started working on a cut scene system. To do this first I re-factored a lot of old code and put in better “state” logic in the main game loop. It was a combination of flags (booleans) and states on top of states, fairly messy. I re-factored it to be much better so adding the cutscene state would be easy. On Saturday I had a rudimentary cutscene manager working – only swapping to another camera outside of the ship’s camera. And tonight I have a bits of “cutscene fragments.”

Here’s a sample of a cutscene file (again in XML/text):


sceneFragment
__reletiveObject attr1="playerRaider"
__lookAtObject attr1="playerRaider"
__cameraPosition x="50" y="50" z="-100"
__duration attr1="4"
__headingText attr1=" "
__headingText attr1="Raider class light frigate prototype test"
/sceneFragment

sceneFragment
__attachment attr1="playerRaider"
__cameraPosition x="30" y="20" z="-50"
__duration attr1="10"/
/sceneFragment

This excerpt will have the cutscene camera look at the player ship at a certain position for a certain duration, display some text and then change to another position. Combining this with triggers the game will support a healthy dose of cutscenes :)

I’m very excited – I was bit worried on the cutscene aspect and now it is shaping up well, but it also is becoming more and more apparent how much work it will be to create a good visual/story experience – in scripting terms.

This upcoming week I plan on adding more triggers, more cutscene code – mobile cameras, zooming in/out, fade in/out, meanwhile adding in the beginings of the storyline.

Suns and Stories

During the week I worked on a “sun shader” – basically getting rid of the old “static yellow ball” sun and putting in an animated replacement. What currently exists is leagues better, but still (hopefully) not the finished product. A huge improvement and I’m happy to say goodbye to the yellow ball.

Here is a WIP video:



Few things to tweak – add rotation, potentially add “sun glare”, add “god” rays.

In other news I started working on the story elements. It was a bit of a tough start, because I didn’t quite know where to begin, so I decided to create the starting “map” and go from there. Because of the beginings of the story as I currently see it, the player needs to be friends with the faction that attacks the player in the current game in iter 14. This meant that I had to make factions – how they relate to eachother, more complex and dynamic. So I spent the weekend coding ways that this can change in game, and ways to keep the state of the faction as it changes in the game, before this factions were static. If they were enemies or friends they always were. This took a bit of re-work, but overall the coding so far is simple as it doesn’t involve 3d math :) I also tweaked some game art to prepare the starting ship of the player. I think its going to have a few unique characteristics that will be pretty cool :) I actually didn’t even code the first “objective” – which is a sort of a mini tutorial – a go here objective – since I had to first ensure that the nearby asteroid base and defensive platforms wouldnt’ blast the player into rubble.

I had a thought while doing this – that if I change the “story” to be just a series of very rigid missions, then I could hard code a lot of these values and that would make things so simple as to not need a lot of these past few days and future days coding. Anyway it crossed my mind and I continued coding – hopefully it will end up as I envision it, or at least close enough to resemble my goals.

Ship radar and markers

I overcame the major hurdle to make ship radar a neat feature – transparency. The way the the radar works is by creating a seperate scene, camera and window. The camera shows the scene which is simply 2d radar “blips” – which represent the reletive positions of objects in the radar. Anyway it took a bit of doing, but I got rid of the background of this window and thus it doesn’t obscure the hud as much – yay.

I wanted to add a “cone of sight” to the radar screen – and did so in the form of a 3d pyramid shape to represent the view from the ship. But it turns out that this pyramid is a bit tricky – it obscures other objects, changes their color, etc. There are tweaks to do, but for now I’ll let it go.

I also worked a bit on marking system for objectives in the HUD and tactical modes. For example if the objective is to capture a base then a yellow arrow will appear on the HUD pointing out the base that needs to be captured.

I’m running out of things to add before I focus on working on the story and its related elements. This isn’t to say that there isn’t plenty of polish, tweaks and even features to add, but the time is getting near to start on the story elements. It is a bit of a scary thought – since this will begin to test many things.