File Exchange

image thumbnail

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

version 1.5 (1.4 MB) by

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

4.78261
24 Ratings

130 Downloads

Updated

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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

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

Comments and Ratings (42)

Excellent work. wonderful.敬佩牛人。

zhang bing

so great

mikeferrari

太厉害啦!

sheetansh

Sir! you rock!

Lu chao

great!

Leaf

Leaf (view profile)

Ashan Peiris

This is really cool.. :)

Brian

Brian (view profile)

Awesome!

Irfan Turk

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

Amazing !!!

I am stunned!!!

Mingjing Zhang

Mingjing Zhang (view profile)

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

Zheng

Zheng (view profile)

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

Ryan G

Ryan G (view profile)

Ham Sadeh

jacky chen

cool ,man , so classical

Davide Ferraro

Suraj Kamya

Suraj Kamya (view profile)

Awesome buddy !
Nice fun

Mingjing Zhang

Mingjing Zhang (view profile)

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

Kozlov Sacha

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

Kozlov Sacha

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

Mingjing Zhang

Mingjing Zhang (view profile)

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.

steve

steve (view profile)

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.

Mingjing Zhang

Mingjing Zhang (view profile)

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.

steve

steve (view profile)

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

Dmitry

Dmitry (view profile)

Maxim Vedenyov

Maxim Vedenyov (view profile)

cool
use addpath to add all this subfolders

Mingjing Zhang

Mingjing Zhang (view profile)

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

Yu Ang Tan

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

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

Mingjing Zhang

Mingjing Zhang (view profile)

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

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.

Mingjing Zhang

Mingjing Zhang (view profile)

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

Daniel

Daniel (view profile)

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

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

Win7 64bit :(

Mingjing Zhang

Mingjing Zhang (view profile)

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?

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.

David Buckingham

the game is great!

Dawn

Dawn (view profile)

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

Mingjing Zhang

Mingjing Zhang (view profile)

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.

Ryan

Ryan (view profile)

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

Mingjing Zhang

Mingjing Zhang (view profile)

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

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

1.5

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

1.3

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

1.1

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

MATLAB Release
MATLAB 7.11 (R2010b)
Acknowledgements

Inspired by: Mario Sim v0.1, Dave's MATLAB Shooter

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video