Code covered by the BSD License  

Highlights from
Stellaria (Tech Demo) - The best MATLAB shooting game ever

5.0

5.0 | 5 ratings Rate this file 45 Downloads (last 30 days) File Size: 3.51 MB File ID: #31449
image thumbnail

Stellaria (Tech Demo) - The best MATLAB shooting game ever

by Mingjing Zhang

 

14 May 2011 (Updated 04 Nov 2011)

If you think you have played the best MATLAB game before. Think again after you try this one.

| Watch this File

File Information
Description

=============================================

Stellaria: A Figure-Based Space Shooting Game

=============================================

Stellari Studio, 2011.

Designed and Programmed by Mingjing Zhang

from

Vision and Media Lab @ Simon Fraser University

* Please note that this is a tech demo and is far from a completed game. *
* All I want to do is to demonstrate what MATLAB is capable of. *
* Stellaria features arcade-style graphics and MIDI music.*

About the Code
--------------

I wrote all code myself except for the midi synthesizer.

I apologize for the for-loop overwhelmed, global variable laden, poorly commented, ill-organized and therefore highly inefficient code.

However this is the best I can do for now.

Installation
------------

Put the folder StellariaTechDemo anywhere you like,
then Add StellariaTechDemo and all its subfolders in the search path list.

!Run stl_StellariaMain to play!

Gameplay
--------

Stellaria is just like the arcade shoot-em-up you have played before, except for the sad music.

Stellaria supports two players.

Each player has 30 lives and 3 bombs.

There are no power-ups, no boss, no score.

There is only 1 stage.

No text information will be displayed on the screen

The game can be slow when there are over 50 objects on the screen (For my i7 2.8GHz + 6 GB RAM +GTX480 computer,
this number could reach over a 100 without any significant frame dropping). Anyway, you need a better-than-average computer to play this game.

Control
-------

Player 1: WSAD - Movement, U - Fire, I - Bomb;
Player 2: DirKeys - Movement, Insert - Fire, Delete - Bomb;
You may skip the opening scene and credits screen by pressing 1 or 2
. They stands for 1 player and 2 players, respectively.

Graphics
--------

Most graphical contents used in this game are the creation of Hamukorosama.
You can find his works at this site:
http://homepage2.nifty.com/hamcorossam/stg_materials.htm
(Japanese)

Music
-----

The background music used in this game are composed by Shi Jin (Chinese: 石进)
His Weblog:
http://blog.sina.com.cn/sjhome
(Chinese)

Toolboxes
---------

The capability of playing midi music is granted by the MIDI synthesizer written by Kenneth Adams, Jr. at GaTech
This synthesizer is available for download at
http://www.prism.gatech.edu/~kadams6/matlab.shtml

The synthesizer comes as a part of Stellaria. You DO NOT need to download it separately.

The synthesizer has been slightly modified by the author of this game.

Inspirations:
---------

The keyboard processing technique used in the Mario Sim v 0.1
by Ryan Kinnett
http://www.mathworks.com/matlabcentral/fileexchange/25568-mario-sim-v0-1

The double-plot star scroll technique employed by Dave's shooter game
by David Buckingham,
http://www.mathworks.com/matlabcentral/fileexchange/31330-daves-matlab-shooter

Copyright:
----------

This game is not intended for commerical purposes and is free for everyone. However, if you decide to use the code

or any graphical or audio materials in your own project, please kindly make sure the original authors (Mingjing Zhang,

Hamukorosama, Shi Jin and Kenneth Adams) are properly accredited.

Contact Info:
-------------
If you have any questions, suggestions, comments or complaints
Please do not hesitate to send me an email:

matthiaszhang@yahoo.com

I'll write back as soon as possible.

Enjoy.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Mario Sim v0.1, Dave's MATLAB Shooter

MATLAB release MATLAB 7.11 (2010b)
Other requirements None
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (16)
16 May 2011 David Buckingham

When I run the program it displays the starfield and crashes with:

??? Error using ==> eval
Undefined function or variable 'stl_STAGE_TitleScreen'.

Error in ==> stl_StellariaMain at 118
bkgMusicPlayer = eval(stage_table{currentStage+1});

16 May 2011 Mingjing Zhang

Hi Dave,

I am afraid you have to add all the 'subfolders' (at least these three: Math, Stages, Util\midi) into your search path list.

Sorry for the inconvenience.

Mingjing

16 May 2011 Ryan

Well done! Clean, robust, stylish, and smooth. Ignore the author's own humble words regarding coding quality!

16 May 2011 Mingjing Zhang

Thanks Ryan. I have not thoroughly tested the game so it has to be buggy. Have you tried it? Is it running sluggishly on your computer?

BTW, I created this game to prove a point: It is possible to make a sprite-based arcade-style game with MATLAB. You know what my next goal is: Super Mario Bros.

16 May 2011 Dawn

This game is really fun. You should definitely make more. You may have a future in game design!

16 May 2011 David Buckingham

the game is great!

17 May 2011 David Buckingham

this is great! i must agree with Mingjing that Ryan is over-generous. this is not very polished. one bug i found is that when you pause some stuff seems to keep running because when you unpause some stuff (eg enemy bullets) has moved. judging it on what it claims to be, a demonstration of the potential for sprite-based games, this is quite successful. furthermore, a little bit more working polishing this up would produce a very nice, game.

17 May 2011 Mingjing Zhang

Thanks for the comment Dave, but I failed to reproduce the same bug on my machine. Does it happen every time you pause the game?

17 May 2011 Daniel

??? Undefined function or method 'plus' for input arguments of type 'uint64'.

Error in ==> stl_StellariaMain at 221
                stageStartTime = stageStartTime + pauseElapsedTime.*timer2sec;

Win7 64bit :(

17 May 2011 Mingjing Zhang

Hi Daniel,

Are you running an earlier version of MATLAB?
As far as I know, MATLAB doesn't support 'plus' for 'int64' until R2010b.

As a workaround, you may change Line 221 to:

stageStartTime = uint64(double(stageStartTime) + pauseElapsedTime.*timer2sec);

18 May 2011 David Buckingham

Yeah, what happens is that if I pause for any length of time, the game goes super fast for a while. This hyperspeed seems to last longer if the pause break is longer. It's as if the game is trying to 'catch up' to where it would be if I hadn't paused. I'm using MATLAB 7.11.0 (R2010b). I made a recording of my playing and having the pause bug, I'll try to email it to you.

18 May 2011 Mingjing Zhang

Okay, I know exactly what you are talking about. I designed the game in such a way that the game runs in the same speed on any machine. If an occasional lag happens, the game would try to skip some frames so that it could 'catch up'. If you pause the game and the internal clock is still ticking, the game would think it has encountered a super-long lag and after you resume playing, it would run 5 times as fast as normal until it catches up to where it should be.

The timing of the game relies solely on on tic/toc pair:
stageStartTime = tic;
...
currentTime = toc(stageStartTime);

Unfortunately, stageStartTime is just a number, not an object you can 'pause'. The only workaround I came up with is to record how much time the game has been paused, then after the game is unpaused, add the duration of the paused time to stageStartTime so that toc would behave as if the pausing has never happened.

I did have this problem at the early stage of development. I thought I have already solved it...Anyway, I'll check it out agian

19 May 2011 David Buckingham

yeah. i'm not that familiar with tic/toc. its behavior wasn't intuitive to me when i tried modifying the argument to toc. the only thing i can think of, like you said, is to store the accumulated paused time and then do something like: currentTime=toc(stageStartTime)-pausedTime

22 Jun 2011 Yu Ang Tan

Wow, I'm overwhelmed by your depressed comments. I'm feeling suicidal now.

30 Jun 2011 Mingjing Zhang

Sorry for bringing you down, man. I didn't mean it intentionally; it is just the way I felt.

07 Dec 2011 Maxim Vedenyov

cool
use addpath to add all this subfolders

Please login to add a comment or rating.
Updates
04 Nov 2011

* Removed the unpleasantly depressing messages
* Fixed a minor bug about tic/toc that may cause error before release 2010a

Tag Activity for this File
Tag Applied By Date/Time
game Mingjing Zhang 16 May 2011 15:44:39
shooting game Mingjing Zhang 16 May 2011 15:44:39
stg Mingjing Zhang 16 May 2011 15:44:39
scrolling Mingjing Zhang 16 May 2011 15:44:39
sprite Mingjing Zhang 16 May 2011 15:44:39
arcade Mingjing Zhang 16 May 2011 15:44:39
gui Mingjing Zhang 31 May 2011 01:18:50
image Mingjing Zhang 31 May 2011 01:18:50
figure Mingjing Zhang 31 May 2011 01:20:59
plot Mingjing Zhang 31 May 2011 01:20:59
text scroll Mingjing Zhang 31 May 2011 01:20:59

Contact us at files@mathworks.com