PDA

View Full Version : My Game - (Asteroids clone made with Windows GDI)



FusionWolf
04-10-2009, 01:19 AM
Hi!

The story beguns from here (http://www.pascalgamedevelopment.com/forum/index.php?topic=5951.0) when I asked some help to sort out some problems with my Asteroids look-a-like game.

Since then 'the game' has evolved and I decided to post this new topic here under 'your projects' section because, I felt that this might be a better place to share it to the people and get feedback about it. ;D

'My Game' (I haven't been figured out a name yet ::) ) uses Windows GDI for graphics and mainly Windows own routines for the engine. SysUtils is used to convert types and etc. and Math library for mathematical routines. Audio is implemented by using BASS audio library.

There's still lots of things to do. For example:
- Animations and sound effects for explosions and so on.
- Game GUI, scoring, player lives and etc.
- Game states, animations when dying or re-born and etc.
- Game menus and scoreboard.
- Game settings.
- Full screen mode.
- Error handling (There's no anykind of it currently). ::)
- Lots of little fixing how shuttle moves, asteroids are generated and etc.
- Code optimizing.
- Better sound samples for the effects and music jukebox.
- Etc.... :)

I liked to know how it runs on different kind of computers. Especially if there is any problems to get it work correctly.

For a comparison in my oldest computer AMD Duron 1.6GHz with Radeon 9600XT it runs around 500FPS and goes nice and smooth. ;D

Here's a executable along the resources (2.5MB)
http://www.saunalahti.fi/hag/share/MyGame_20091004.zip

'My Game' is going to be shared under the GNU/GPL or Mozilla license (meaning that sources will be available) when it's reached first release version. ;)

edit: Forgot to mention that arrows moves, CTRL fires, F1 / F2 controls music volume and ESC to exit. These are also in game window caption, but just in case. ;)

KidPaddle
04-10-2009, 07:37 AM
Opening zip file brings message "TR/Dropper.Gen" trojaner found. Mhm....

Thomas

chronozphere
04-10-2009, 08:01 AM
Same here. :o

FusionWolf
04-10-2009, 08:53 AM
No shit!! :o Really!?! I have to check it out instantly... sorry guys.

Edit: Hmmm... which virus scanners you are using because Avast! says absolutely nothing about that exe? And it seems to be clean anyhow (compared with hex editor with just compliled one).

Edit2: No, there's no virus at my side of view. Hmmm.. maybe your virus scanners are too sensitive or something (or maybe mine is too insensitive ;D). Anyhow, I cannot find virus but I check later (when I have time) with different scanner.

FusionWolf
04-10-2009, 10:39 AM
Now I'm pretty sure there's no virus in the .zip file. :yes:

I checked it with Avast! Home antivirus scanner, F-Secure online scanner and F-Secure standalone scanner with two different computers and every program says that files are clean.

Here's a screenshot from F-Secures standalone scanner:

http://www.saunalahti.fi/hag/share/f-secure.jpg


So go ahead, download and test it! ;D It won't bite. ;)

chronozphere
04-10-2009, 11:04 AM
Yup.. well virus scanners are often unreliable.. Gonna run your game. :)

Edit: Nice job. Game works.

I think it would be better to make the ship turn a bit faster. It would make the game a little easier. Moreover, it crashed when I destroyed the last asteroid.

Keep it up!

FusionWolf
04-10-2009, 11:31 AM
Thank's chronozphere for your feedback. ;)

The game is designed to be a little 'hard to play'. That's why ship is rotating slowly and fire rate is slow, but I will adjust those (along everything else) when game is more complete.

Game has mainly tested my five year old son ;D who already found a one bug. When all asteroids are shot memory exception is raised. :-[ The reason is in collision checking because I do it in for-loop and if last asteroid is shot then counter of the loop goes of the limit. ::) Except if last asteroid is 'killed' by crashing with it. Then all goes fine because for-loop is interupted when ship collides with an asteroid.

Collision detection will be fixed on next 'test' release. ;)

paul_nicholls
04-10-2009, 11:54 AM
Thank's chronozphere for your feedback. ;)

The game is designed to be a little 'hard to play'. That's why ship is rotating slowly and fire rate is slow, but I will adjust those (along everything else) when game is more complete.

Game has mainly tested my five year old son ;D who already found a one bug. When all asteroids are shot memory exception is raised. :-[ The reason is in collision checking because I do it in for-loop and if last asteroid is shot then counter of the loop goes of the limit. ::) Except if last asteroid is 'killed' by crashing with it. Then all goes fine because for-loop is interupted when ship collides with an asteroid.

Collision detection will be fixed on next 'test' release. ;)



With the crash but and out of limit loop...a quick fix would be to go backwards, ie. from highest index downto 0...

cheers,
Paul

FusionWolf
04-10-2009, 01:09 PM
With the crash but and out of limit loop...a quick fix would be to go backwards, ie. from highest index downto 0...

cheers,
Paul


Thanks Paul for your advice. I tried that and it works flawlessly. :yes:

Here's the fixed version of it. Nothing else hasn't changed:

edit: [Link to the file removed]

There's again some very crazy things going on from Delphi. When Delphi IDE is open and game is ran all works perfectly, but when game is run without Delphi open it crashes again after the last asteroid is shot. ???

I can only wonder why it acts like this, but I will do more research and publish fixed version when it's done.

FusionWolf
04-10-2009, 05:01 PM
Finally I had time to fix the game. By reversing the for loop for collision test fixed one problem, but after that there was that weird thing going on from Delphi. When Delphi was open while playing the game it worked flawlessly. But if Delphi wasn't running and last asteroid was shot then memory exception was raised. :(

The problem was in inner loop of collision test loop where is tested asteroid collision with every visible bullet. I kept checking the hit with same asteroid even if it was already hit by previous bullet. ::) So exiting from the inner loop after a hit repaired problem. :)

Here's the fixed version:
http://www.saunalahti.fi/hag/share/MyGame_20091004_1944.zip

arthurprs
05-10-2009, 01:46 AM
I really liked it,
the bg music is cool, the graphics are cool, everything is cool 8)

nice work

FusionWolf
06-10-2009, 12:22 AM
Nice to hear that you like it! :yes:

Here's an updated version with explosion animations and sound effects added. Not so big visible changes but 'under the hood' has happened a lot. ;D

I re-wrote in game audio system but it's still incomplete. I have to re-write it to support multiple simultaneous channels from one sample data (you can hear the lack of it on explosions).

Also mainloop is optimized and is now ready to accept gamestates. ;D

Couple other minor changes are:
- statics are now showing count of visible explosions.
- sound effect samples (still not final versions).
- Fire rate is now more rapid.
- Shuttle rotates faster.

There's still whole lot of things to do and those explosions gave couple things more. Next I will adjust them to blast range based on the size of the destroyed asteroid. So, that bigger asteroids has bigger explosion.

After that I fix the audio to it's final version (for this release of the game) and then I begun to think those game states (lives, scoring, levels and etc.). So, we get a real game going... ;)

Hmm.. should I think some name for this... :D

Here you go:
http://www.saunalahti.fi/hag/share/MyGame_20091006_0302AM.zip

And again I'm interested how it runs on which kind of computer. And if there's any problems with it I would be pleased to know - thanks. ;)

chronozphere
06-10-2009, 07:13 AM
Game runs smooth here. Antivirus still gives warnings though.
I'd like to see some kind of "You won" message at the end. Now there is just empty space. :)

FusionWolf
06-10-2009, 07:56 AM
Game runs smooth here. Antivirus still gives warnings though.
I'd like to see some kind of "You won" message at the end. Now there is just empty space. :)



Thansks for your reply. Nice to hear that game runs smoothly. :)

There's no "won" or any other messages at the end because I'm not considering this is a 'real game' yet. ;)

But after I begin to create those game states there will be so, be patient my friend. :p (actually I'm thinking somekind 'win' animation after when the stage is clear).

Soon, soon...

FusionWolf
12-10-2009, 10:17 PM
Status update and question.

Development of 'my game' is on the right track. ;) I have implemented new font system which can be used for menus, scores, statics and etc.

Also audio system is re-written and plays now multiple channels if needed (simultaneous explosions for example).

Sound samples are now final versions for this game.

Explosion animations is now based on the size of exploding asteroid.

There's a handfull of different sound tracks picked up for in game music. ;D

And some optimizing of a source code has been done.

Currently I'm doing a selection to play in fullscreen or in windowed mode and that pops up a one question.

If computer has widescreen display should I set fullscreen resolution so, that aspect ratio is taken care of?

I mean for example if I wan't to set 1024*nnn resolution. So, if user has widescreen then it would be 1024x640 (that gives nice 1.6 ratio [European "flat" ratio], also called Super 16 format). And if user has 4:3 display then resolution would be 1024x768 (that gives 1.3333 ratio [NTSC/PAL]).

BUT isn't that so, setting the resolutions by that way, it gives advantage for the 4:3 display owner because there's more 'room' where to move and so on?

I have widescreen and I tried 1024x768 on fullscreen mode and it looks much fuzzier than 1024x640 resolution. What should I do or should I do nothing? :D

In windowed mode resolution can be 1024x768 for both display types but fullscreen is givin me a headache. :( Tell me how it should be handled? Which is the correct way to set resolution so that game objects are not streched??