Monday, 11 August 2014

I'm Back in the Game!

So now that I've pretty much given the SpaceEditor as nearly finished and very usable, I went back to the game code (C++ yey!) and have been trying to make it support all the objects and features that you can create on the editor. That means parsing the SpaceEditor files and implementing the objects and behaviours. So far I've got Rocket, Astronaut and Alien, Planets, Suns, SunFlares, Zoom Spots and image layers. Most of these can be triggered on a scripted condition like "add a new spaceman two seconds after the player delivers the previous spaceman" or "fire up some sun flares every 60 seconds". This lets me script the level quite nicely from the editor, load it up and watch it happen in the game.

I also added basic scripted movement: go from here to there at a given speed. This way I can make an object (Asteroid, Planet, UFO, PowerUp, anything...) run across the level under certain conditions.

The Sun objects are nicely rendered using a couple of particle emitters. I'm really pleased with the results of this, if a little processing intensive. Same goes for SunFlares. And the layered transparent star fields giving us a nice parallax effect.




Then I got bored of creating game objects (still missing the Comet, Flying Saucer, generic Sprite, Black Hole, Coin, Star and PowerUp) and went on to detect the collision impact of the rocket onto a planet. That triggers a small dust cloud particle emitter, but a very small collision will in fact lose the player a life so I need to make it into a full blown explosion.

But losing lives... this made me think I needed to get the full game flow together: main menu, options, level selection, pause!... The looks are far from final, but at least now I start to get the game vibe.




Monday, 16 June 2014

Save the World!

I can now save the worlds and load them back, mostly in the format that the game reads. However the editor has grown much more powerful than the game and many things the editor has aren't supported yet.

Objects can rotate and move from one place to another; most can be scripted on some events, and I've also added the ability to read keyframe animations from the texture and the editor will animate those as well.

These images show a couple of test levels that were just read back from file. I also moved the add-object palette up to the toolbar.



Tuesday, 3 June 2014

Rockets, 1-Ups and Blackholes!

I've added a number of objects to the palette! These were all in my plans, but now I've sort of committed to letting the editor set the scene AND the game level script - when each object shows up, where the little space guys want to go, where the objects move to and at what speed; that sort of thing. The drawings on the world editor are vector drawn in code using NSBezierPath; that was a fun - if time consuming - exercise involving pen and square paper. 

Here's the object palette and what the objects look like on the map if we don't assign any textures to them:

    

The inspectors have also grown quite a bit. There's a ScriptableSpaceObject base class now which holds the common stuff in most of these objects, then particular implementations on top of that. There's also a view controller for each of these inspectors. Here's "Planet":

    

On this screenshot, two objects - a power-up and a blackhole - are showing some planned scripted movement. And there's an image layer on the back, which is being tinted blue. Any object can be tinted with a colour; I'm not sure what I'll use this for, but it seemed cool. Maybe there will be teams, or different races one day.

    

     


Thursday, 22 May 2014

Inspecting objects

I have wired up the inspector panels for the objects, meaning I can now edit their dimensions precisely, tint them, pick textures and whatever other properties are needed! It almost-almost only needs saving and loading now, in fact, that's the next step! Before that, though, I'll need to break up the level loading in the game from two separate files: the static scene composition, and the character scripting, because I think this editor will only be able to create the static scenes.

I've also done away with the green wireframes!



Thursday, 8 May 2014

Playing God

I can now create 3 types of objects: Planets, Coins and Stars. I'm not sure what the coins and stars will be used for, but the general pattern is there are 3 stars per level which are difficult to get to but don't stop you from finishing any level; and you collect coins to buy stuff like power-ups or rockets.

Objects can be dragged or resized using the handles on them, but they don't yet snap to the grid.

I added an object management table in the Objects side bar, but the objects don't yet belong to any layer nor can they be turned ON/OFF.

NSBezierPath is cool to work with to programmatically draw vector graphics. I drew the stars and the coins in Excel art and picked the coordinates visually - that reminded me of how I used square paper to draw graphics for the ZX Spectrum.



The Level inspector also has working World dimensions:


Friday, 2 May 2014

Building up a Game Editor

Starting to get the hang of Cocoa. The grid options window works great and I've added tabs on the sidebar for different purposes. Objects is where you instantiate game objects from; Layers is for creating and selecting Sprite and Image layers; Inspector is where you go to change the game object's properties; and Level has some general level properties. Doesn't do much yet, though!...



Tuesday, 29 April 2014

Cocoa is tough

I'm finding it hard to understand what all the Ctrl+links and delegates are for, which windows need controllers, how they talk to each other, notifications, bindings...
I have a grid and a zoomable canvas now. Next: worlds!


Friday, 25 April 2014

Game on hold for a while

Bad news: I started learning OS X app development and kicked off a level editor project for SpaceTaxi. This will take a while. 

Editing game level text files was fine until I thought of dropping hundreds of power-ups and coins in space. I need a visual editor and a grid to snap to.

I'm taking some code from Apple's Sketch sample project. This is how it looks after a few hours:


Sunday, 20 April 2014

Mo' Buttons!

I can now place working buttons on the HUD layer - the HUD layer is the same resolution as the screen, so things will look more spaced out on a tablet than on a phone, that's why I had to allow anchoring the buttons to any corner or centre of the screen.

Also, the countdown timer down at the bottom gives more a sense of a game, but so far nothing happens when it reaches 0:00.


Monday, 14 April 2014

Parallax background images

Got parallax background layers working. Everything set up from the game level script. In this image there's one "space" 1000x1000 distance units (light-seconds?) backdrop image with a parallax factor of 0.9, meaning it pans at x0.9 the speed of the foreground.

Also there's fire, smoke and sparks coming out of that engine... :-)

I'll soon have to stop adding more stuff in and look at optimising the rendering performance as it's all very raw at the moment and I know there's lots to optimise away.


Friday, 11 April 2014

Now with 100% more text!

Ported text rendering in! This uses bitmap fonts generated by BMFont and applies a colour and alpha to it and any transformation. The text below is being rendered to the HUD layer - a top layer that's always there to have UI controls like the joystick, buttons, text.


Thursday, 10 April 2014

Fire!!

I ported the Objective C particle emitter sample code by 71 Squared onto C++, used libxml2 to read .pex files and let ParticleEmitter objects be Sprites. So now the Rocket game object has one of those and it works beautifully!

The grey circles that look like lens flares are actually the virtual joystick.



Monday, 7 April 2014

Scale, Translate, Rotate...

I fixed all the scaling and translating issues I had in the old GL ES1.1 SpaceCab. Everything works perfectly now according to whatever is in the game level script. Also, I'm detecting and working with the retina x2 displays.

In this image:
- the small planets forming a square are 200 distance units apart.
- the square (1000x1000) is the defined game level area.
- zoom level is set to a fixed 1.0 everywhere.
- the viewport is set at 800 distance units wide.


Playing...


Sunday, 6 April 2014

Aiming for the Moon...


Fixed the alpha, textures and some of the scaling issues. Rocket is still not centred on the screen and I have to do whatever I did to sprites to image layers and the text renderer.