Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Chaotic Terrain Animation
Chaotic Terrain Animation
Dec 26 2011, 12:21 am
By: Cinolt  

Jan 1 2012, 5:55 am TiKels Post #21



Quote from name:yoonkwun
In any case this will probably be the last major contribution you will see from me in a while. I still check back on here occasionally so I'll respond to any questions.
Falcon pawnch, good friend. Falcon pawnch.

But serious, you are a cool cat.



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Jan 2 2012, 5:48 pm Heinermann Post #22

SDE, BWAPI owner, hacker.

Quote from name:yoonkwun
There is indeed a lot more than just setting resources, which is what I meant by decreasing the noise ratio.

However unit resources is the only data manipulable through CTA that is 1) can be set to any arbitrary value 2) requires only one action, and one location and 3) isolated in memory (setting resources only affects that part of memory, as compared to something like Move Unit).

I may write about it in greater detail some other time.

However, I recently got a MacBook that currently can't play StarCraft, so development from me is going to be currently stalled, until I decide to get a proper Mac-Windows dual-booting package (wine from MacPorts doesn't work :().

I decided to fully open source my programs I used to make this for anybody (Heinermann) to work on further if they (Heinermann) want to, and for learning(/stealing) purposes.

This is a straight raw upload from my old comp, so feel free to ask any questions about it.

cta.cpp: .cta + map.scx + *.png + wav -> out.scx
ctac.c: tileset files -> .cta
ts2tga.c: tileset files -> .tga image file (irrelevant to CTA)
notes

In any case this will probably be the last major contribution you will see from me in a while. I still check back on here occasionally so I'll respond to any questions.
While I'm converting it into something readable, can you go over the input/output and explain how to reproduce the map you posted?

EDIT: Also, what non-standard compiler could you possibly use to compile "png_bytep row_pointers[h];" where h is non-constant?

Post has been edited 1 time(s), last time on Jan 2 2012, 7:34 pm by Heinermann.




Jan 2 2012, 8:03 pm Cinolt Post #23



Quote from Heinermann
While I'm converting it into something readable, can you go over the input/output and explain how to reproduce the map you posted?

EDIT: Also, what non-standard compiler could you possibly use to compile "png_bytep row_pointers[h];" where h is non-constant?

I used GCC. -Wall didn't complain, so it's fine by me :P I don't see why it would be non-standard either from an assembly perspective; I would think that it just enlarges the stack in the middle of the block just like it would at the start of the block, except that the size is not constant.

Anyway, you have to compile cta.cpp and ctac.c as separate programs. After that, I don't recall exactly what I did but it went something like this:

Place a tileset's files (jungle.cv5, jungle.vr4, etc.) in one location and execute ctac with the filename base (jungle) as a command-line parameter and it will output (filename base).cta.

Next you need to convert the frames of a video as PNG files. For this, I used the powerful command-line FFmpeg tool (it converted all thousand-some frames, with FPS conversion as well by typing one line...). If you want a WAV file to be played, then place a file named "wav" in the same directory as the cta executable. Then execute the cta executable as so:

cta jungle.cta in.scx out.scx *.png

Then you're done. Note that it is hardcoded for a 512x384 resolution video, and only supports 2 colors (all 256 .WPE color support is possible, perhaps something you can implement?;))

EDIT: I remember getting lazy with the cta program, and it might be hardcoded for twilight.cta only, since it has the most manipulable pixels.

Post has been edited 1 time(s), last time on Jan 2 2012, 8:10 pm by yoonkwun.



None.

Jan 3 2012, 6:41 pm Dizzy Post #24



May I ask. Wtf is Chaotic Terrain Animation... is it like moving terrain or terrain in motion.



None.

Jan 3 2012, 7:54 pm Cinolt Post #25



Quote from Dizzy
May I ask. Wtf is Chaotic Terrain Animation... is it like moving terrain or terrain in motion.

Not sure. But there MIGHT be a link to a map in OP that shows what it is. There just MIGHT be.



None.

Jan 4 2012, 7:32 pm Heinermann Post #26

SDE, BWAPI owner, hacker.

Can you explain the looped code in ctac.c, as well as the members of the mega struct? (single-letter variables are meaningless)
Code
...      if ( vs >= 309 && vs < 8925 )
     {
       u16 r = vs%21;
       if( r == 3 || r == 8 || r == 13 || r == 19 ) ...


I've been converting the code to cpp and making it more understandable. I've got the files' data read into vectors (with vx4 and cv5 structures) for easy reference, but I'm not sure what this code is doing in order to implement it.




Jan 4 2012, 8:47 pm Cinolt Post #27



Code
struct mega{
    uint16_t v; //at the END, it will be the scenario.chk MTXM/TILE value
    uint16_t i; //number of valid "struct d's"
    struct{
        uint8_t x; //x coordinate of the first pixel relative to the megatile
        uint8_t y; //y "
        uint8_t b; //b==1 if the minitile is to be drawn horizontally flipped
        uint16_t i; //unit index of the mineral patch to be manipulated
        uint16_t s; //minitile value that the pixel pair resides in
    }d[16]; //one struct d for each 2-pixel pair (unit resources is 2 bytes)
}mega[16*12];
/*
* 16/12==512/384==video resolution
* one _mega_ struct for each _mega_tile being animated
*/

VR4 entry size: 64
CUNIT entry size: 336
336/64=5.25
|       CUNIT        |       CUNIT        |       CUNIT        |       CUNIT        |
|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|
CUNIT resource offset: +0xD0 (208)

---- Unit Index 0: ----
((336*0)+208)/64==3
((336*0)+208)%64==16
|       CUNIT        |       CUNIT        |       CUNIT        |       CUNIT        |
|VR4|VR4|VR4|vr4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|
By modifying resources of Unit Index 0, we modify VR4 Index 3, at offset 16.
16/8=2
16%8=0
Converted into coordinates of the MiniTile, it would modify 2 pixels (0,2),(1,2)
-or- if it is drawn backwards horizontally, "                        (15,2),(14,2)

---- Unit Index 1: ----
((336*1)+208)/64==8
((336*1)+208)%64==32
|       CUNIT        |       CUNIT        |       CUNIT        |       CUNIT        |
|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|vr4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|VR4|
By modifying resources of Unit Index 1, we modify VR4 Index 8, at offset 32.
32/8=4
32%8=0
Converted into coordinates of the MiniTile, it would modify 2 pixels (0,4),(1,4)
-or- if it is drawn backwards horizontally, "                        (15,4),(14,4)

rinse'n'repeat

Unit Index 4 would have the same behavior as Unit Index 0 due to periodicity.

Enumerate all VX4's, modulo each VR4 by 21 (5.25*4) and see if it can be manipulated (3, 8, 13, 19)


The sources themselves were horribly written, the product of an all-3-nighter hacking session. :P



None.

Mar 19 2012, 7:29 pm matefkr Post #28



it dowsnt work, hard to get much out of it, just a few pixels changing.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[06:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[04:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
Please log in to shout.


Members Online: Roy, Excalibur