Mincus's picture

Space game.

Been looking over OpenTK for a couple of weeks, following stuff, making the odd post and thought I'd port a game I wrote for my university course to it.

Originally the game was written in C++ using an API developed by the university specifically for teaching the basic mechanics of gameplay and 2D rendering. It's like a significantly stripped down SDL really.

The original game concept goes back to the early 80s when a game was released in the UK for the BBC Micro computer called Starship Command. About a decade later a freeware version of a similar game called Foray turned up on Acorn RISC OS computers (sorry if you haven't heard of these, they were a little UK specific).
I was a big fan of the freeware game, but unfortunately I lost it sometime around 2000 and I've never been able to find it again. So, with my new found experience at university, I decided to write it myself. Hoshi was the result. However it was buggy and not really pleasant to play.

Enough of the history. The basic idea of the game is pretty basic, the basic layout is very asteroidsy, but instead of flying around the screen, you stay centred and fly around a large map instead.
Instead of asteroids you have waves of ships, these consist of many small "fighters" and a single "mothership". You can only attack the mothership after killing all the fighters. You can only attack the mothership with set "flash" bullets. These are gained through killing waves of fighters, if you run out of flash bullets (you can only store 6) you have to re-do the wave. Each wave increases the number of fighters and the number of flash bullets required to kill the mothership. You have 4 energy bars and a single life to get as high a score as possible.
That's it. :o)

Moving the game to OpenTK has proved relatively simple. Jazzed up some bits and added an extra layer of stars over my original version.

For the screen shots, the first two are in 800x600 mode, showing full energy. The logo in the top-right and the score have a slowly changing colour scheme, which is why they look different in each shot. The second shot is showing the edge of the map, eventually this will wrap over from one side to the other, but currently I've just dropped in a square around each of the 4 star layers for clarity.
The third and fourth screenshots show the game running in 1280x800, the idea being that the game will easily move between standard 4:3 and 16:10 modes. The energy bars are in the bottom right, when you're down to your final bar, it will flash red/green whereas it will stay green otherwise.

The last screenshot is just an example of my original version, which is what the final version will hopefully look like.

Free Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.usFree Image Hosting at www.ImageShack.us

Minor update just to show I'm still working on it. :o)

Enemy ships are now implemented. They've no AI as yet, but the basic state machine that will manage the AI is implemented.
Top radar is working.
Wrapping around the borders is almost finished.
Ship has been centred.

Free Image Hosting at www.ImageShack.us

What needs doing:
Collision detection (works with ships, not with bullets).
AI finishing.
Boss ships.
Levels etc.

Further update:
Chucked together a short video of the game as it stands, unfortunately a lot of the detail has been lost, but you get the idea:
Youtube vid.

Starting this up again.
I hit an issue where bad planning broke some collision detection. Anyway, two more example vids:
Lots of ships
Ship crashage
Second one was supposed to demonstrate shooting as well, but youtube mangled the vid too much unfortunately.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
objarni's picture

Cool! Are you using GLControl or GameWindow?

Mincus's picture

GameWindow.

Just as an interest point: Starship Command at Wikipedia.
Starship Command worked slightly differently, but as I said, that's where this sort of game started AFAIK.

Inertia's picture

Great! I really love those games where you don't need at least 2 Ph.D in order to get into the game, memorize the controls and have fun :) looking forward to the modifications you're planning to the original game, please post binaries (or source) once you are there!

Edit: Actually I might have some 2D space backgrounds for you in 1024^2 resolution and a couple of planet sprites. Not sure how far you intend to pimp the graphics though, you can pm me in this forum with your e-mail address and I'll pack it for you to evaluate whether it's of any use. (was made for a horizontal scrolling game)

Mincus's picture

Inertia: Idea is to keep more of a retro look for now. Thanks for the offer though. :o)

Was just testing it under Linux (ran beautifully straight off, dead pleased about this :o)) however, the "thrust" key for the ship is currently set as shift. I was intending this to be right-shift but when writing under Windows I accidentally used Keyboard[Key.ShiftLeft], but I didn't notice this error since it seems Windows picks up both shift keys as ShiftLeft. I only noticed when I moved it to Linux just now and wondered why thrust wasn't working, found the typo in the code and wondered why it worked under Windows.

Is this a limitation in Windows or a bug in OpenTK?

the Fiddler's picture

It's a feature! :p

Actually, I just took a shortcut to get the code up and running. If you can tell me how to detect left/right shift on Windows, I'll fix it asap. :)