Code covered by the BSD License  

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

4.77778

4.8 | 19 ratings Rate this file 115 Downloads (last 30 days) File Size: 1.4 MB File ID: #31449
image thumbnail

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

by

 

14 May 2011 (Updated )

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

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| 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.

-----------------------

Update Log:

Sep 24, 2012 (V 1.3):
* An App installer is added
* Now the user can gracefully quit the game simply by closing the figure window without causing any error

Acknowledgements

Mario Sim V0.1 and Dave's Matlab Shooter inspired this file.

MATLAB release MATLAB 7.11 (R2010b)
Other requirements None
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (37)
21 May 2014 Leaf

11 May 2014 Ashan Peiris

This is really cool.. :)

29 Jan 2014 Brian

Awesome!

16 Nov 2013 Irfan Turk

Thank you for the game. It is really nice...
As a Matlab Fun, Congradulations....

08 May 2013 Bharath Lohray

Amazing !!!

03 May 2013 Kang Qin Pung

I am stunned!!!

10 Jan 2013 Mingjing Zhang

@Zheng 随便写着玩的,见笑了

09 Jan 2013 Zheng

兄弟,你真是个人才!!!!

02 Nov 2012 Ryan G  
25 Oct 2012 Ham Sadeh  
19 Oct 2012 jacky chen

cool ,man , so classical

18 Oct 2012 Davide Ferraro  
16 Oct 2012 Suraj Kamya

Awesome buddy !
Nice fun

16 Oct 2012 Mingjing Zhang

@Kozlov
Thank you for bringing this problem to my attention. I'll add the said feature as soon as possible.

15 Oct 2012 Kozlov Sacha

It works only for QWERTY keyboards. Think about poor frechies with AZERTY, add customise keys option, please :-)

15 Oct 2012 Kozlov Sacha

It works only for QWERTY keyboards. Think about poor frechies with AZERTY, add customise keys option, please :-)

29 Sep 2012 Mingjing Zhang

Type

opengl software

before you run the game. If that solves the problem, then the most possible explanation of the upside-down text is that your OpenGL driver does not work properly with MATLAB. You must either upgrade your driver/card, or stick to the software renderer.

Alternatively, you can run

opengl hardware
f = figure(1); title('Rightside up'); set(f,'Renderer','OpenGL');

and see if the problem could be reproduced.

The following link may help
http://www.mathworks.com/support/solutions/en/data/1-91JU4U/?solution=1-91JU4U
------------

Anyway, I do believe that a submission should be judged based on its overall quality instead of minor bugs that are not even caused by the program itself. So I would never rate until I truly understand what the program does, how to use the program and what causes the problems (if any). If you do find a bug in the program, a more constructive idea would be to report the bug with details so that the author could correct it, rather than leaving a bad remark that doesn't give much info.

Then again, I was just speaking from a developer's point of view; not even trying to change your style of criticism. do what you believe is correct.

29 Sep 2012 steve

Ok, I see the readme.txt now. But the rating was for thew upside down text. I am using windows 7 with Matlab 2012a. I changed the rating to 3 stars.

29 Sep 2012 Mingjing Zhang

steve:
I'm really sorry for the inconvenience but there IS a file named README.txt in the package, in which I explicitly stated
"!Run stl_StellariaMain to play!"

And may I ask you, please, read the manual before recklessly giving a low rating.

As for the upside-down text, I have never produced the same problem on all (10+) computers with different versions of MATLAB. I won't put too much hope on you but if you are still interested, please provide more details (your MATLAB/Win version, which text is upside-down, and so on) so I can fix the bug.

28 Sep 2012 steve

text is upside down. No read me file, no idea which file to run.

09 Aug 2012 Dmitry  
07 Dec 2011 Maxim Vedenyov

cool
use addpath to add all this subfolders

30 Jun 2011 Mingjing Zhang

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

22 Jun 2011 Yu Ang Tan

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

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

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

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.

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);

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

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 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.

16 May 2011 David Buckingham

the game is great!

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 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 Ryan

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

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 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});

Updates
04 Nov 2011

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

24 Sep 2012

An App installer is added
Now user is allowed to close the window to quit the game without causing any error.

25 Sep 2012

Drastically reduced the size of the program by removing redundant music files

Contact us