Join the forum, it's quick and easy

Would you like to react to this message? Create an account in a few clicks or log in to continue.

Cheap trick to speed up your games.

Go down

Cheap trick to speed up your games. Empty Cheap trick to speed up your games.

Post by Admin Sun Jul 31, 2016 11:55 pm

Target Platforms: Unknown, but probably all of them.
Download and Links: N/A

Summation: A cheap trick to give you a 20-50% performance optimization in your game.

Go in the Room Editor and disable "Clear Display Buffer With Window Color".

Create a new object called "ortho".
Set it's depth to -1000.
Put in it's Create Event:
Put in it's Step Event:

// toggle inc between true and false each step

if (inc) draw_enable_drawevent(1);
Put in it's Draw Gui Event:
draw_surface(application_surface, 0, 0)
Also remember to disable fog and lighting before the draw, and reenable it afterwards if you are in 3D. Also remember that game critical code, if it is in the Draw Event, is skipped for one frame.

This code works by only rendering half of the frames. The application surface is the default surface that GM renders the scene to. Normally it is enabled by default but in this code we want to control when we draw it ourselves. This is analogous to the old function in GM8 called set_automatic_draw.
Clear Display Buffer must be disabled, because if you enable it, it fills the screen with a solid color eliminating the afterimage effect.

This is a neat trick that skips the rendering of a frame but tricks the human eye into thinking it's smooth, because there is a transparent afterimage left over from the last frame allowing the eye to interpolate the frames like in movies.
Even without the frame boost, the afterimage looks kind of neat, and professional.

This is not the end of the tutorial. The tutorial continues onward, with you.
This topic is dedicated to posting optimization tips to the new GM Studio.
Last edited: Jul 14, 2016

Posts : 56
Points : 171
Reputation : 0
Join date : 2016-07-20
Age : 23

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum