Game Optimization

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 18:38, 4 January 2015 by AFRLme (talk)

What is optimization? Optimization, or optimizing is a term used to describe the betterment or efficiency of how something works, runs, operates. A quick example of this would be in how fast a game, or application loads &/or runs. Also it could be a reduction in the amount of processing power, RAM or VRAM required to run your application. It could even be a reduction in the amount of hard disk space required for your application.

2D games often require more memory to run, because animation file-sizes in 2D games are usually larger than their 3D animation counterparts; depending on the resolution of your game & the size of your animations. In Visionaire Studio there are various methods you could use to reduce the file-size of each of your animations frames, thus speeding up the loading time of your game, which is great for mobile devices & low to mid range gaming machines.

Scaling Up

The basic idea behind scaling up is that for animations that don't need to be sharp (in focus) & don't matter too much about looking a little blurry/pixelated, such as environmental animations like: rain, snow, fog, clouds, water etc, or animations in the background. You could create the images at say: 25 to 50% of the intended (actual) scale & then use a simple line of Lua script to scale them up to regular size. This is a great way for cutting down the final file-size of your images & animations.

Object Sprite

Scale up an image sprite linked to a scene object. You could use this for an overlay image, or maybe for a solid color image that you might want to use to obscure the screen during loading or scene transitions, etc. Visionaire Studio 4.1 + is required to scale object sprites.

Objects["rock"].Scale = 4.0 -- scale "rock" object sprite up to 400% (shorthand method)
getObject("Objects[rock]"):setValue(VObjectScale, 4.0) -- same as above, but longhand

Animation

Scale up an animation. This can be an animation linked to anything from: a scene object, a character, an interface, or even a mouse cursor. The best place to add this code is inside of the initial frame of an animation via an execute a script action part. The animation has be active (playing or preloaded) for this code to work. Visionaire Studio 4.1 + is only required for the shorthand method.

ActiveAnimations["water_ripple"].AnimationSize = 400 -- scale "water_ripple" animation up to 400% (shorthand method)
getObject("ActiveAnimations[water_ripple]"):setValue(VAnimationSize, 400) -- same as above, but longhand