Flashing Disco Floor

Discussion in 'Mapping Questions & Discussion' started by TehStoneMan, May 29, 2013.

  1. TehStoneMan

    TehStoneMan L1: Registered

    Messages:
    46
    Positive Ratings:
    3
    Hello. Can somebody help me with this?

    I am trying to crate a set of tiles (each tile is a prop_dynamic with a custom model) that change colour randomly at a set interval, say once every 2 seconds.

    I would like to have it like an animated texture where each frame is selected at random instead of in sequence (if possible), with each tile colour independent from each other.
     
  2. Seba

    aa Seba DR. BIG FUCKER, PHD

    Messages:
    2,363
    Positive Ratings:
    2,365
    This could probably be pulled off with texture proxies like UniformNoise and AnimatedTexture, TextureTransform, or TextureScroll. I'll give this a shot tomorrow maybe, it sounds interesting.
     
  3. henke37

    aa henke37

    Messages:
    1,836
    Positive Ratings:
    420
    If nothing else, you can let I/O do the changing and build fancy patterns.
     
  4. Fish 2.0

    Fish 2.0 L6: Sharp Member

    Messages:
    324
    Positive Ratings:
    116
    You could create an animated texture.
     
  5. henke37

    aa henke37

    Messages:
    1,836
    Positive Ratings:
    420
    Or just use different skins and let I/O do the animations.
     
  6. Seba

    aa Seba DR. BIG FUCKER, PHD

    Messages:
    2,363
    Positive Ratings:
    2,365
    Oh right, I was supposed to do this. Whoops.

    Doing this with entities would also work, but considering the number of tiles you'd be working with that'd probably be more trouble than it'd be worth. Although I suppose you could make a few sets of tiles that would switch together, that'd save some work.
     
  7. henke37

    aa henke37

    Messages:
    1,836
    Positive Ratings:
    420
    I could throw together a simple pattern editor in Flash that exports an instance for you to include if you want me to. I/O is really easy to generate.

    EDIT: I was bored so I wrote it up. Got bored just before the exporter. Give me a shout if you want me to finish it up.
     
    Last edited: Jun 1, 2013
  8. TehStoneMan

    TehStoneMan L1: Registered

    Messages:
    46
    Positive Ratings:
    3
    What I am hoping to do, is have one skin as the flashing pattern, one skin as blue, and one skin as red.

    With this, I also would like to be able to use trigger delays to change the skin in a pattern.

    If there is a way to start an animated texture on a random frame, I guess one possible solution could be to just use a "pseudo random" animation sequence.

    Is this even possible?
     
    Last edited: Jun 1, 2013
  9. TehStoneMan

    TehStoneMan L1: Registered

    Messages:
    46
    Positive Ratings:
    3
    After a bit of thought, I have a basic concept on how it could be done using an animated sequence:

    Code:
    UnlitGeneric
    {
    	$model	1
    	$basetexture models/props_disco/dance_floor_tile
    
    	$offset 0
    
    	Proxies
    	{
    		// Set the initial frame of this tile
    		EntityRandom
    		{
    			scale 5
    			resultVar $offset
    		}
    		
    		// Get the integer of offset
    		
    		// Get timer value
    		
    		// Add offset to timer
    		
    		// Calculate frame number from timer + offset
    
    		// Update current frame
    		Equals
    		{
                srcVar1 $offset
                resultVar $frame
    		}
    	}
    }
    
    This example assumes a five frame animation, but the final version would be much longer. I doubt anybody would be studying the pattern long enough to notice that it's not truly "random". :)

    Any suggestions to fill in the missing code?
     
  10. henke37

    aa henke37

    Messages:
    1,836
    Positive Ratings:
    420
    Bah, I/O is better for randomization.
     
  11. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,516
    I/O isn't as easily scalable, though, and for any significantly sized floor you would end up with a crapton of stuff. I also don't know if one can really say that the logic_case RNG is any better than the material proxy RNG. They may even be the same thing.

    Have you tried UniformNoise? My first guess is you could point that straight into $frame and be done with it. I'm not sure how fast it would change, though.
     
  12. TehStoneMan

    TehStoneMan L1: Registered

    Messages:
    46
    Positive Ratings:
    3
    UniformNoise was one of the first things I tried, but it proved difficult to control the rate of change and have the tiles different colours.
     
  13. henke37

    aa henke37

    Messages:
    1,836
    Positive Ratings:
    420
    I/O scales marvelously if you use a program to generate it for you. There is literally no limit to how much I/O you can stuff in a single logic_relay, as long as you don't poke at it using hammer.
     
  14. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,516
    It's not about putting a lot of IO in one place. For a randomized floor you would end up needing increasing amounts of entities linked together as the number of tiles increases, unless you are going to limit yourself to 16 predefined patterns that are randomly selected using a logic_case. If you can put the randomization code in the material, then it doesn't matter how many tiles you have, there will be zero alteration or complexity increase.


    I haven't messed with proxies in a long time and don't remember how they all work, I might have to poke around myself to look for an answer.