Scrolling Space Shooter Game

Development

The implementation of a java based scrolling space shooter was a project during my apprenticeship. I then developed the game with the final concept during my free time somewhere around Christmas 2005.

Detailed Description

This scrolling space shooter game started as an ordinary clone of all the top/down or side scrolling shooters everyone knows. Since it is, for programmers, hard to get decent art for games I had an idea in late 2005 on how to change the clone into something more special.

Previously the game was a Swing application using local assets stored in gif and xml files. The core idea was to push all the assets to an online server and to change the Swing application into an Applet. Then it is possible to publis the level editor as an Applet as well. Now everyone can create and publish campaigns to the game. The idea was that users may interact with the game and create better campaigns using their own art and style. Ultimately every user would be able to create his/her top/down scrolling shooter game.

The current state of the project allows the creation of new levels and campaigns using predefined arts, units and unit-behaviours. There are some important features missing, especially a dedicated content publishing system.

Technical Details

Feature List

Challenges

The first challenge of this project was to run the game on Java using only the basic Graphics API available. The project originated at a time where Java optimization started and machines were slower. So it was much more sensitive regarding performance problems than it is now. Some challenges have been:

The second challenge was to implement the service infrastructure. For security reasons Java Applets are only allowed to contact the server they have been downloaded from. So I added php scripts through which the game and the level editor can communicate with the server and download the latest campaigns and levels.

Credits

The DirectX 7.0 SDK contained a space shooter like the space shooter I developed, but written in Visual Basic. To test the editor and the game I used the assets provided there.

Screenshots

Videos

Code Sample

I will provide two code samples.

The first sample shows the main game loop implemented in Java.

/*! \todo Input so implementieren, dass P abgefangen werden kann, OHNE dass auch alle anderen Tasten bearbeitet werden... \bug Pause funktioniert nicht */ public void run() { if (!gameOver) { doGame(); } else { displayGameOver(); } } private void doGame() { //System.out.println("----------------------------------------------"); currentFrameTime = System.currentTimeMillis(); delta = currentFrameTime - lastFrameTime; delta /= 1000; //System.out.println(currentFrameTime+"/"+lastFrameTime+"/"+delta); lastFrameTime = currentFrameTime; if (delta != 0) { sceneGraph.getStats().setFPS((float)(1.0 / delta)); } //System.out.println("Reset"); sceneGraph.reset(/*(float)delta*/); //System.out.println("UseInput"); sceneGraph.useInput((float)delta); try { pauseGuard.lock(); if (!pause) { pauseGuard.unlock(); sceneGraph.moveObjects((float)float); sceneGraph.collideObjects(); sceneGraph.insertObjects((float)float); sceneGraph.removeObjects((float)float); sceneGraph.drawObjects((float)float); } // give cpu to other threads as well Thread.yield(); } catch (InterruptedException e) { e.printStackTrace(); } finally { pauseGuard.unlock(); } checkPlayerDead(); checkLevelDone(); }

The second shows the php script written to load a list of levels from the database. Note that at the time of implementation PHP was still at version 3 and procedural.

<?php include "../global/error.php"; include "../global/encoding.php"; include "../db/mysqlcon.php"; include "../tables/campaign.php"; include "../tables/user.php"; include "../tables/entity.php"; include "../tables/layer.php"; include "../tables/level.php"; include "../global/authorization.php"; $errorcode = 0; $errordescription = ""; function check_parameters() { check_input_parameter('campaign'); check_input_parameter('Login_Email'); } function create_response($data) { echo "<response>\n"; echo " <code>0</code>\n"; echo " <errordescription/>\n"; echo " <arguments>\n"; echo " <argument>\n"; echo " <data>" . encode_for_response($data) . "</data>\n"; echo " </argument>\n"; echo " </arguments>\n"; echo "</response>\n"; } function create_data() { $data = ""; $campaignid = $_POST['campaign']; $data = $data . "<campaign_list>\n"; $data = $data . Level_Xml_GetAllLevelsFromCampaign($campaignid); $data = $data . "</campaign_list>\n"; create_response($data); } check_authorization(); check_parameters(); create_data(); ?>

Additional Material / Downloads

Not available.

Related Links

Not available.