MATLAB Creating a Game in MATLAB: How to Get Started

  • Thread starter Thread starter khurram usman
  • Start date Start date
  • Tags Tags
    Game Matlab
Click For Summary
To develop the online game "Air Transporter" using MATLAB, it's essential to start by understanding the basic structure of the game and the necessary functions. Begin by initializing game variables and creating a loop to handle user input, specifically keyboard commands for controlling the helicopter. For movement, consider using the 'image' command to introduce an animated helicopter graphic, assigning it a handle for manipulation.Key steps include designing an object-oriented structure to identify game elements like the helicopter and scenery. Implement routines for drawing objects on the canvas and reading keyboard inputs efficiently. It's crucial to explore MATLAB's capabilities for non-blocking keyboard input and its drawing functions, as MATLAB excels in data manipulation but may not deliver optimal performance for gaming. Additionally, reviewing existing MATLAB games can provide valuable insights and inspiration for your project.
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
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K