This page talks about the so-called "endless" scene. Stencyl-nator has developed several versions to optimize this feature.
How it works
It starts with scene with finite dimensions. 3 to 10x screen size. it shifts all actors when camera reach the edge. off-screen or off-margin tiles are killed. created when approaching the tiles.
Precautions:
All of these versions involves in many actors on screeen. The tiles are actually actors. In order to reduce lag, please disable some collision relationships and possibly reduce its functions.
Collosion relationship: https://stencyl--nator.blogspot.com/p/reducing-lag-actor-groups.html
Pre-requisites:
arrays with 2 or more dimensions since the screen is 2D and topdown gameplay view (see SAS Zombie Assault and Bloons series by Ninja Kiwi) The tile system has 2 dimensions
for example: gdat_rot_nxny[0-x][0-y]; that means each elements of the array is an array which needs to be initialised before use for example: this.gdat_rot_nxny[0-x] = [];
Validifying data, the initialisation only occurs when the data is null or undefined. Unwanted initialisation will result in generated data loss.
for example if(this.gdat_rot_nxny[0-x]==null || ""+this.gdat_rot_nxny[0-x]=="undefined")
Versions
There are 3 versions in done in Stencyl-nator in attempt to optimize the feature so that it can be played in some entry-level laptops such as Avita Essential 14 with Intel Celeron N4020.
single tile
Version1. Design mode.
Version1. Design mode.
initial production
Version2. Code mode
Less resource demanding than version 1. Code mode is used because the arbitrary code snippet cannot be extended.
http://stencyl-nator.blogspot.com/p/infinite-scene-rendering-code-mode.html
http://stencyl-nator.blogspot.com/p/infinite-scene-rendering-code-mode.html
Version3. Code mode remake.
Cut off some import form version 1. Not dependent on com.stencyl.graphics.G.
Other stuffs added in the logic (optional)
All 3 versions of the logics have rotation and scaling which can be used to flip actors.
multi-tile
version 1
No comments:
Post a Comment