How to make games go faster
Author: | NeoMonkey
|
Submitted: | 3rd September, 2008
|
Views: | 6825
| Rated: |
|
|
How to make games go faster!
-----------------------------------------------------
- - - - - - - - - - -
Introduction
- - - - - - - - - - -
I have played many klik games in past few days, which have scrolling problems. They are platformer, which run nicely until the map starts scrolling. Well I'm keeping that pretty annoying and I don't think none wants to play games like that. Also waiting for HWA is not an excuse.
I made a video of this, but it was 900 mb, so I made an article of this. In this article I'm showing ways to do games, which are lag free. Also if you want example of lagging game. Download Martin Bodger's and Xrat's Tourey round 1 game, Spirit gazer. (No offence to martin bodger or xrat, but your game is good teaching material!)
http://www.yourfilehost.com/media.php?cat=other&file=Spirit_Gazer.rar
Look the source and see how slow the game is. There is always 350-600 objects and scrolling is slow.
- - - - - - -
Basics
- - - - - - -
1.Object = Bad
-Backdrop is not object
-Big>Small
-100 Small > 1 Big
-Clone>Duplicate
-Object>Event
2.Resize = Bad
3.Fastloop = Medium Bad
4.Always/every = Small Bad
5.Event =Tiny Bad
- - - - - - - - - - - - - - - -
Basics explained
- - - - - - - - - - - - - - - -
1.More objects, more slower game
-You can have millions of backdrops, because they don't use much memory.
-Bigger needs more memory than small.
-More objects take much more memory than 1 big.
-Cloning makes new object, but duplicate doesn't.
-This is hard to explain so I give an example of this. You make Custom platform movement with 4 collision boxes. But you can do the same with PMO without collison boxes! (Hope you understood)
2.Resizing is always bad! Bigger objects more memory. Resized objects even more memory.
3.Fastloop isn't so bad if you just for example place tiles with it, but if you make player/enemies movement with it (and more things), it can slow game a lot.
4/5.Always/Every/events: These I took, because the can slow game a bit (really small but slowing). So I added this only because you can generate code which won't be like this.
Always:
-Set xPos [Player] to YPos [Player]
Always:
-Set xPos [Enemy] to YPos [Enemy]
So you have to unite them:
Always:
-Set xPos [Player] to YPos [Player]
-Set xPos [Enemy] to YPos [Enemy]
- - - - - - - - - - - - - -
MMF2 Settings
- - - - - - - - - - - - - -
I'll tell you guys about setting (MMF2) which are good to get focused. After the option I write these marks:
[!]=Helps a lot
[*]=Medium help
[.]=Small help
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
First we start with application settings:
Graphics mode[!]: Using 256 mode, it frees much of memory usage and game game gets lot more speed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Then we go into application window options:
Never use Resize display to fill window size [!] in bigger apps.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Then it's application runtime menu's turn:
If you are using vsync[*], then put framerate 90-100, but in slow big games, tick it off.
Displey mode[!]:
If you are using fade in/out or ink effects use standard.
If not use DirectX+Vram!!!
Never use DirectX only!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Then lets go into frame runtime settings:
Always:
-Tick Handle backround collision even out of window[.]
-Force Load on call option for all objects[.]
And also keep the number of objects near 300. Because then the game doesn't lag much.[!]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Then we go into active object runtime options:
If possible untick create object at start[*]. Add triggers and stuff to create the needed objects, so it eases the beginning of the game and reduses lots of lag.
- - - - - - - - - - - - -
Tips n' trick
- - - - - - - - - - - - -
1. Do not create any active objects at start, exept player, and all near the screen, also triggers. Now code so, that when player collides trigger, then second set of active objects are created (remember to destroy trigger ). This reduces lag a lot in bigger maps.
2. If you are running on 400-500 objects, then it would be good to have some particle restriction system like.
[Bullet] collides with backround
+FrameRate >= 45
-Create [spark] (0,0) from [Bullet]
-Create [spark] (0,0) from [Bullet]
-Destroy bullet
[Bullet] collides with backround
+FrameRate < 45
+FrameRate >= 25
-Create [spark] (0,0) from [Bullet]
-Destroy bullet
[Bullet] collides with backround
+FrameRate < 25
-Destroy bullet
- - - - - - - -
Ending
- - - - - - - -
I hope this article helps you someway, and I hope I don't see any laggy games much more anymore . And if you need training try to make the example lag free by the stuff of this tutorial.
-NeoMonkey
|
|
|