View Single Post
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 866

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jul 18, 2015, 08:18 AM
Seren is offline
Reply With Quote
Quote:
Originally Posted by Treylina View Post
Also the pipe dream script is poorly optimised, which eats my FPS. For a big hint why;

"[16:40:47] Sir Ementaler: I looked into the script of Obi's example level and found an easy way to optimize it.
[16:40:47] Sir Ementaler: Turns out he already only changed the palette once every two frames but every four frames he applied changes 5 times, lol."
What I did was change the palette cycling code in onMain to
Code:
	if (jjGameTicks % 2 == 1) {
		cycleLiquid();
		//rocksGlow();
		if (jjGameTicks % 4 == 1) {
			crystalGlow();
			liquidPoolRipple();
			crystalRipple();
			cloudsGlow();
			if (jjGameTicks % 8 == 1) {
				liquidPoolGlow();
			}
		}
		jjPalette.apply();
	}
and replace all occurrences of "newPal.apply()" with "jjPalette = newPal". Not precisely the way I'd write that code myself but that required fewest modifications.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.