Page 1 of 1

Fun With Scripted Textures

Posted: Wed Feb 21, 2007 12:32 am
by NVShacker
Awhile back Jonas mentioned to me that he could use the ability to switch between multiple textures dynamically as it would be easier, more elegant and less hacky than sheet movers or whatever his alternative was. I poked around with scripted textures a bit but didn't actually attempt anything until today, and I was suprised at how easy it was to actually do.

So now I've created two classes that take control of scripted textures and allow you to swap textures on the fly with them. One class, tnmTextureSwapController, just toggles between two and the other, tnmTextureSwitchController (perhaps not my best effort on the naming schema front), allows you to swap amongst 16 textures. I'm pretty happy with how everything came out but what I could use now are two things:

1) Some testing. I'm not entirely sure how well the engine copes with textures of different resolutions for instance, and I want to make sure these are stable.

2) Let me know if we have any other uses for them. I can't directly edit pixels or palletes, but I can, for instance, draw text on them, pan them, draw tiled textures on other textures (given a pallete that has both) and of course swap palletes and such.

The beta classes can be found here.

To use them you'll need to create a ScriptedTexture (not one of the subclasses, those are are FractalTextures are a I recall and would conflict quite heavily), setting its resolution to whatever you want and applying it to the surfaces (or actors, that'd be interesting) you want. You'd then need to create one of the TextureControllers (look under info) and get them set up pointing to your scripted texture and then it's just a matter of having something trigger them.

I appreciate the help.

Posted: Wed Feb 21, 2007 12:37 am
by Trestkon
Oh, snap! That sounds unbelievably useful and awesome :D

I'll get right on the testing after my last midterm on Thursday. Great job, Sir Shacker!

Re: Fun With Scripted Textures

Posted: Wed Feb 21, 2007 6:38 pm
by Jonas
NVShacker wrote:(or actors, that'd be interesting)
Hmm... perhaps we could use this to make the animation of ShadowCode's face on the TFT monitors in the OSC switch randomly instead of cycling through a preset sequence? That would actually cut down significantly on the amount of textures in the animation (because some frames have been copied to show several times in each cycle for variation).

Posted: Wed Feb 21, 2007 7:28 pm
by Trestkon
We could do that, but why mess with something that's already working?

Posted: Wed Feb 21, 2007 10:03 pm
by Jonas
Come now Larry, if that were our attitude, this mod would've been released 3 years ago, and it would've sucked. We'll mess with it because it could work better ;)

Posted: Thu Feb 22, 2007 12:05 am
by Trestkon
Yes, but *how* is it better?

Posted: Thu Feb 22, 2007 1:12 am
by NVShacker
Well random would probably be slightly more asthetically pleasing than sequential, though it's hardly a big deal.

Posted: Thu Feb 22, 2007 1:15 am
by Trestkon
Oh yes, random. That would indeed be better:)

Posted: Fri Feb 23, 2007 10:57 pm
by Trestkon
Works like a charm!!

Just a note, you have to actually type in the path to the scripted texture manually, as the browser won't let you just click on it and press 'Use'. Also, you just need the one scripted texture, and then it can cycle through any other regular textures :D