Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [WIP] Space Invaders: Global Invasion  (Read 6063 times)

0 Members and 1 Guest are viewing this topic.

gregerolsson

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • http://www.redstone.eu
[WIP] Space Invaders: Global Invasion
« on: July 30, 2009, 03:29:49 pm »
Howdy!

Just started my first game, a Space Invaders inspired thing with a twist. Written in C++ with XCode (no Visual Studio project file available yet). It's a bit different from the original Space Invaders, to say the least; the invaders circulate the whole "globe" which can be rotated 360 degrees as the invaders  make their way down to the earth surface.

Using SFML, this was much easier than I first thought (SFML is truly one of the best written frameworks I've used, any category -- Thanks a million for sharing it!). The sprites actually never change their positions. Ever. Instead, all sprites have their rotation or center-Y updated when they move, so that they all rotate around the same point, which is the earth center (located half a screen outside the visible screen).

So, all sprites have a large center-Y, which when decreased, moves the sprite closer to earth. Some objects like clouds, stars, the moon and the sun only rotate to simulate day/night-cycles.



This works exceptionally well with SFML which maintains the rotational state of the sprites so it is as easy to call Rotate() on the objects as it is to say Move(). And the rotation operation appears to be very fast.

Culling is also very simple; if the rotation is between 305..55 degrees, the sprites are drawn, otherwise they are discarded. So less than half of the sprites in the scene are actually drawn.

I use a simple shader for simulating the poor TV quality. Every now and then the screen goes (intentionally) really bad and the player needs to give it a good smack (with the Enter key) to "fix it". Sometimes the TV gets so bad its just showing static. I'm thinking of requiring a key-combo to resolve that to get an almost free game feature which stresses the player some more.

The source code is available for browsing at: https://mobilead.versionshelf.com/login using login:anonymous and password:anonymous. Using those credentials you can also check it out from the SVN repository with:

Code: [Select]
svn co --username anonymous --password anonymous https://www.versionshelf.com/svn/mobilead/space-invaders/trunk space-invaders

I set a budget of 40 hours on this and I have about 12 hours left to spend. It's not complete yet; missing features are: collision detection on hostile missiles and the player, tracking score, more intelligent movement of the invaders, sound and music. I'll probably be able to squeeze that in the next 12 hours.

But.. I'm thinking of adding another twist. Every other level, the player steals one of the invader ships and get to be the invader on the invaders' home planet or mother ship. It's just the game in reverse -- The player is in the sky and the invaders are on the ground. Almost all the code can be reused and we get a bomber-game instead (the invaders simply aren't moving/rotating). I think I'll expand my budget another 15 hours for that.

Any comments on the idea would be great! I'll be adding a VS project file as well and put up some pre-built binaries for OS X, Linux, and Windows as soon as the basic feature set is fully implemented.

Many thanks to the SFML team!

Edit: A pre-built version for OS X can be downloaded from http://www.redstone.eu/SpaceInvaders.tgz (3.5Mb). I have no idea if it will work on any machine since it's the first OS X App I've created. I usually program in Java and Ruby. Again, it's incomplete but the overall feel should be appearent. Movement: A, S -- moves the player on the earth surface; L -- fires the tank; Enter -- fixes the TV if it is acting up.

thoniel

  • Newbie
  • *
  • Posts: 21
    • ICQ Messenger - 157157736
    • View Profile
[WIP] Space Invaders: Global Invasion
« Reply #1 on: July 30, 2009, 03:46:39 pm »
interesting idea, im looking forward to play it ;)

 

anything