Creating a Game in MATLAB: How to Get Started

  • Context: MATLAB 
  • Thread starter Thread starter khurram usman
  • Start date Start date
  • Tags Tags
    Game Matlab
Click For Summary
SUMMARY

The discussion focuses on creating a game in MATLAB, specifically a project titled "Air Transporter." Key recommendations include using the 'image' command to animate a helicopter and implementing an object-oriented design to identify game elements. Participants suggest initializing game variables, utilizing a while loop for keyboard input, and creating routines for drawing objects and handling commands. Additionally, it is emphasized that MATLAB excels in data manipulation but may not provide optimal performance for game development.

PREREQUISITES
  • Familiarity with MATLAB programming language and environment
  • Understanding of object-oriented design principles
  • Knowledge of keyboard input handling in MATLAB
  • Experience with graphical functions in MATLAB, such as the 'image' command
NEXT STEPS
  • Research MATLAB's 'image' command for animated graphics
  • Learn about object-oriented programming in MATLAB for game design
  • Explore keyboard input functions in MATLAB for real-time command processing
  • Investigate MATLAB's graphical capabilities for creating a game canvas
USEFUL FOR

This discussion is beneficial for beginner to intermediate MATLAB developers, game designers, and computer science students looking to create interactive games using MATLAB.

khurram usman
Messages
86
Reaction score
0
i am doing a project from my introductory CS course. i am to make game available online by the name of air transporter. (if possible do check it out online before giving me any ideasa. http://www.physicsgames.net/game/Air_Transporter.html) frankly speaking i do not know all the ropes of matlab. i just want to ask that how should i get started. what functions should i make first? and an important one: i used to move a rectangle using the mouse user input during my labs. but how am i supposed to move a helicopter. i mean should i first introduce an animated image using the 'image' command, assign it a handle and then set it the same way or is there any other suitable method.
thanks for any help.
 
Physics news on Phys.org
id do an OO design where I identify the objects of the game. In this case you have a helicopter and some objects on the ground and some scenery.

then do a top-down outline:
1) initialize game variables (read previous state if any)
2) while loop to:
2.1) read keyboard characters
2.2) dispatch based on keyboard char to routine
3) end of game closeout (save state...)

then make a routine to handle each keyboard command

then make lower level routines to:
- draw an object anywhere you want it. The object could be an image that you place on your graphical canvas.
- read the keyboard and return a command code
- ...MATLAB is really good at data manipulation and data analysis but not so good as a general purpose language
and so ou have not get the performance you want in your game.

Also, you do need to look at a couple of things in MATLAB before proceeding:
1) is there a function to return a single character from the keyboard that doesn't block until the RETURN key is typed.
2) Can you get a canvas and draw on it (ie does it have drawing functions )
 
Last edited:

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K