Creating a Game in MATLAB: How to Get Started

  • MATLAB
  • Thread starter khurram usman
  • Start date
  • Tags
    Game Matlab
In summary: Are you using the image function to load an image file into memory and display it? If not, you might want to consider doing that.
  • #1
khurram usman
87
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
  • #3
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:

Related to Creating a Game in MATLAB: How to Get Started

1. How can I use MATLAB to make a game?

MATLAB can be used to create games by utilizing its graphics and animation capabilities. You can use MATLAB's built-in functions and libraries to design and code your game. There are also many tutorials and resources available online to guide you through the process of creating a game using MATLAB.

2. Is MATLAB a suitable platform for game development?

While MATLAB is primarily used for scientific and engineering purposes, it can also be used for game development. However, it may not be the most optimal or efficient platform compared to other game development software. It ultimately depends on the complexity and type of game you want to create.

3. Can I create 2D and 3D games in MATLAB?

Yes, MATLAB has the capability to create both 2D and 3D games. You can use the built-in functions and libraries for graphics and animation to design and code your game in either 2D or 3D. However, creating 3D games may require more advanced coding skills and may not be as efficient as using other game development software.

4. Can I use MATLAB to create games for mobile devices?

While MATLAB can be used to create games, it may not be the best option for mobile game development. MATLAB is primarily used for desktop applications and may not have the necessary tools and resources for mobile game development. It would be more efficient to use other game development software specifically designed for mobile devices.

5. Do I need to have a strong coding background to make a game in MATLAB?

Having a basic understanding of coding and MATLAB syntax is necessary to create a game in MATLAB. However, there are many tutorials and resources available online to guide you through the process, so even beginners can learn how to make a game using MATLAB. It may take some time and practice, but it is achievable for those without a strong coding background.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
916
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top