Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

ANIMS ARE CRAZY

Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Oct 16, 2010, 03:16 AM
Violet CLM is offline
Reply With Quote
ANIMS ARE CRAZY

EVERYONE
THIS IS AMAZING!!!


I was playing around with my python implementation of .j2l files and surreptitiously adding what I thought were new features, and then it occurred to me to check if JJ2 actually had them already... and it DOES. JJ2 (but not JCS, of course) lets you use flipped tiles and other animations for animated tile frames.

MIND: BLOWN.
(my earlier attempt to change the order of the layers through the .j2l file was, unfortunately, unsuccessful.)
(also it doesn't work in TSF; you'd need different values)


ETA: I am trying to get it to work in TSF but I think j2ff doesn't support it, so I need to roll my own; be patient.
ETA2: Here's another 1.23-style example for cooba, showing that, in combination with belts and Reworder, working electric barriers can indeed be made. Uses Newspaz's Tubelectric conversion.
__________________

Last edited by Violet CLM; Oct 16, 2010 at 05:06 AM.
EvilMike EvilMike's Avatar

JCF Member

Joined: Jun 2001

Posts: 3,478

EvilMike is OFF DA CHARTEvilMike is OFF DA CHARTEvilMike is OFF DA CHARTEvilMike is OFF DA CHART

Oct 16, 2010, 03:30 AM
EvilMike is offline
Reply With Quote
It's too bad it doesn't work in TSF (and outright crashes it). This limits what you can really do with this, since your level is basically 1.23-only.

It would be nice to see an implementation of this using the 1.24 level format, because those at least can't be opened in 1.23, and thus can't crash it. Also, anyone using this feature won't have to tell people that their level is "1.23-only", which as far as I know, has never been necessary in the past.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Oct 16, 2010, 04:37 AM
Violet CLM is offline
Reply With Quote
TSF implementation. It looks like 1.24 only can handle animated tiles as frames, not flipped tiles (signage issue, no doubt), but those are the more exciting cases anyway.
__________________
Nerd

JCF Member

Joined: Sep 2008

Posts: 61

Nerd is doing well so far

Oct 16, 2010, 05:00 AM
Nerd is offline
Reply With Quote
I had something like this in mind, but never bothered to check if it would actually work (as I was quite sceptical about it, and am not a JCSer anyway). Nice find, and will come in handy for making animated scenery blocks.
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,314

Slaz is OFF DA CHARTSlaz is OFF DA CHARTSlaz is OFF DA CHART

Oct 16, 2010, 05:55 AM
Slaz is offline
Reply With Quote
I'd say this has even more value in TSF since tileset size will come in handy for big complex animations and puzzles!
__________________
Add SlazRabbit on Xbox Live if you want to play some GoW1/2/3/J or Destiny1/2.
Jazz Jackrabbit 2 Forever!!
Civilian Defence Force - Jazz2 Visual Fantasers
minmay

JCF Member

Joined: Aug 2002

Posts: 1,184

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Oct 16, 2010, 07:12 AM
minmay is offline
Reply With Quote
Could you elaborate on how exactly animated tiles as frames in other animations behave? The examples only show a little bit.

(And could someone hurry up with JCS+ already? I really want to incorporate this into Episodic Ground Force Pack Episode 2.)
Dermo Dermo's Avatar

JCF Member

Joined: Jun 2005

Posts: 1,743

Dermo should make better posts

Oct 16, 2010, 09:33 AM
Dermo is offline
Reply With Quote
I'm assuming opening this in JCS will break the levels. What's the exact name of the tileset for the second one?

Also your levels would have been winners if they were submitted into the contest.
__________________
Yes, I am, in fact, ALWAYS the one to blame for everything. And none of your are full of yourself. Good job.

Do you like Stijn? Take my poll!




Windows is not a virus. A virus is small and efficient...

Note to Stijn: how am i even getting away with this
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Oct 16, 2010, 12:42 PM
Violet CLM is offline
Reply With Quote
minmay: sure!
In a level's dictionary, tiles are referred to through shorts. Using 1.23 numbers for reference, values 0-1023 for those shorts refer to unflipped tiles, and 1024-2047 to flipped tiles. Within each of those ranges, up to 1020 of those tiles are actual 32x32 images from the tileset, whereas the rest are potentially animated tiles, starting from 1023 (and 2047) and working back down. So a level with a 10 tile tileset and two animated tiles would, assuming everything appears flipped, have values 0,1,2,3,4,5,6,7,8,9; 1022,1023; 1024,1025,1026,1027,1028,1029,1030,1031, 1032, 1033; 2046, 2047. What's important is that a single value, with no parameters elsewhere, tells JCS/JJ2 whether to load a flipped or unflipped and animated or unanimated tile for display and other interaction.

Now, animated tiles are themselves stored in the .j2l as a series of frames, and each of those frames is described by a short. As it turns out, that short uses the same function as does the rest of the game for figuring out which tile, flipped tile, animated tile, or flipped animated tile to display as a frame. Consequently, hex-editing values higher than the tile count into the frame of an animation can give crazy results.

Once you get to the actual display of this ingame, just speaking theoretically, there are at least two possible ways JJ2 could handle animated tiles. Minimally, the frame displayed at any given time for an animated tile, ignoring the cases of destruct scenery and other such events freezing animations regardless of speed, depends on how much time has elapsed since the beginning of the level (call it the gametick), the speed of the animation, and the sequence of frames within it.

So, one way JJ2 could handle this would be every gametick to see which animations should advance a frame and update all dictionary words containing that animation accordingly. The words, as stored in memory, would not actually contain animated tiles; instead, a separate list of where animated tiles appear in words would know which tiles to update and how often. However, this is not what JJ2 appears to do, perhaps because it would interact poorly with destruct scenery, perhaps for optimization reasons, perhaps arbitrarily.

Instead, based on this, it looks like every time JJ2 draws a tile to the screen, it uses a figure-out-which-tile-this-really-is function on the short value originally stored in the .j2l. If it's a simple tile, it just grabs that 32x32 image. If it's an animation, it asks the animation what its current frame is, and then uses the same figuring out function on the number the animation gives it, which can in turn refer to another animation, causing JJ2 to ask again what the current frame to display should be. I haven't tried, but I see no reason why you could not continue down this line, embedding animations into other embedded animations, until you hit the limit, although I assume any recursion would crash the game.

Functionally: suppose you have an animation A of a dancing flower. You also have a two-tile animation B, with speed 1, whose first frame is a blank tile and whose second frame is animation A. Whenever animation B is displaying its first frame, it will appear blank. But when it's displaying its second frame, the player will see whichever frame of animation A is the current one as determined by combining A's own speed and frame sequence with the gametick.

Dermo: I think it's the tileset in this upload.

ETA: Here, have a visual example. Given two normal animations, and one animation half the speed of the other two which switches back and forth between them, you should get a sequence like on the bottom. Of course, if the first two animations had different speeds and/or lengths, then that would make for a less regular pattern; alternatively, you might want to do something like put a trigger scenery event on the two-frame animation, to switch the level back and forth between all dancing mushrooms and all dancing flowers.
__________________

Last edited by Violet CLM; Oct 16, 2010 at 01:01 PM.
minmay

JCF Member

Joined: Aug 2002

Posts: 1,184

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Oct 16, 2010, 01:14 PM
minmay is offline
Reply With Quote
Quote:
Originally Posted by Unknown Rabbit View Post
ETA: Here, have a visual example. Given two normal animations, and one animation half the speed of the other two which switches back and forth between them, you should get a sequence like on the bottom. Of course, if the first two animations had different speeds and/or lengths, then that would make for a less regular pattern; alternatively, you might want to do something like put a trigger scenery event on the two-frame animation, to switch the level back and forth between all dancing mushrooms and all dancing flowers.
This is the interaction I was most curious about. Thanks.

By the way, JCS does not like trying to display these. And, in response to Dermo's question, you get some nice access violations.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Oct 16, 2010, 01:51 PM
Violet CLM is offline
Reply With Quote
Yeah, JCS just doesn't know what to do with them. I have no answer at all for why it grabs zoomed out versions of other tiles from the tileset.
__________________
Obi1mcd Obi1mcd's Avatar

JCF Member

Joined: Feb 2010

Posts: 692

Obi1mcd is OFF DA CHARTObi1mcd is OFF DA CHARTObi1mcd is OFF DA CHART

Oct 16, 2010, 04:22 PM
Obi1mcd is offline
Reply With Quote
Wow, this is awesome. I sort of wondered if something like this could be done, but I have zero technical skills, and wouldn't know how anyway. Great job, this could be really useful in levels. Would it then be possible to use trigger scenery to swap from one animating tile to another?
__________________
Define 'normal'.
n0

JCF Member

Joined: Mar 2001

Posts: 2,291

n0 is a forum legendn0 is a forum legendn0 is a forum legend

Oct 16, 2010, 09:26 PM
n0 is offline
Reply With Quote
Freaking. Awesome. Between this and Reworder, you can do... anything!
__________________
<.<
>.>
-.-
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Oct 17, 2010, 03:47 PM
Violet CLM is offline
Reply With Quote
Speaking of Reworder, I'm just leaving this here because I'm not totally sure myself why it does what it does. Minimally, the crates on the right turn the trigger on, and the crates on the left turn the trigger off. If you turn it on, then off, it will be off forever; if you turn it off, then on, it will be on forever; if you die, things go wonky, so this is best restricted to multiplayer levels.

(Normally, if you try to link two words with Reworder and have destruct/etc. events on the same animation in each, they'll go blank. I realized that this is because the first event restricts display to the first frame of the animation, and then the second event tries to read that frame as an animation and fails. So I gave it an animation as a first frame, and this is what happened.)
__________________
GoldRabbit

JCF Member

Joined: Jul 2006

Posts: 219

GoldRabbit is an asset to this forumGoldRabbit is an asset to this forum

Oct 18, 2010, 05:12 AM
GoldRabbit is offline
Reply With Quote
Would it be possible to create an infinite loop?
Say, in an online game, you want an area to be occupied by only one person at a time. Person enters area, automatically destroys trigger crate, thus locking himself in that area. Same person exits area by destroying another crate, leaving the area empty. Can the cycle continue? As in, another person comes, destroys first crate, locks himself etc. or same person comes and does the same thing again.

I'm really interested as this could help IMMENSELY with my level and with many interesting concepts, for that matter.
__________________
so we will shut our mouth when
we are trying to be bastards
and speak loudly when we see injustice
because everybody plays the game this way

saints especially
Jgke Jgke's Avatar

JCF Member

Joined: Sep 2006

Posts: 974

Jgke is an asset to this forumJgke is an asset to this forum

Oct 18, 2010, 06:55 AM
Jgke is offline
Reply With Quote
It could be done with MCE crates, but they don't work properly in multiplayer. I can send you a level with an example of this room, but it works properly only in singleplayer.
Stijn Stijn's Avatar

Administrator

Joined: Mar 2001

Posts: 6,964

Stijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to beholdStijn is a splendid one to behold

Oct 18, 2010, 11:02 AM
Stijn is offline
Reply With Quote
What happens when you use an animation as a frame in itself?

Probably the game crashes, but who knows! It could be awesome!
Foly Foly's Avatar

JCF Member

Joined: Jan 2009

Posts: 202

Foly has disabled reputation

Oct 18, 2010, 11:10 AM
Foly is offline
Reply With Quote
I've been learning pascal in delphi lately, I still only know the basics but I'm wondering: Is there something specific I need to know to start modifying j2l files/jcs or do I just need to continue and wait till I learn required functions (like readfile functions or something like that).
__________________
[13:07:13] *** Foly is on a KILLING SPREE!
[13:07:14] *** you killed yourself
[13:07:14] *** Foly was looking good but died instead...
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Oct 18, 2010, 01:37 PM
Violet CLM is offline
Reply With Quote
TBD (am I abbreviating that right?): I don't think so, While I don't want to say that for sure yet until I've made one or two more tests, it seems unlikely, since trigger crates can only turn triggers on, and if the trigger is already on, they don't turn it on again, they just have no effect. (Yes, the difference is observable.)

Stijn: I'd been holding off on that because I assumed it would just crash, but I tried it just for you, and JJ2 crashed as quickly as it possibly could.

Foly: To the extent that you need anything specific, it would definitely be the required functions. But I guess that's not really a helpful reply. For any more systematic editing of .j2l et. al files, you'll want to be able to read and write files (including ascii values, not just plain text), use zlib compression and decompression, and calculate CRC32 checksums. Occasionally you'll need to understand bitwise operations, but only rarely. Everything else is just basic programming. What I'm doing here, though, just changing individual values in data1, requires no more than a hex editor and j2ff, which hopefully Overlord doesn't mind me sharing the link to. (Only seems to work for 1.23 levels.) Animated tiles aren't documented anywhere, but they have a pretty simple storage format and begin at offset 15988 in data1.
__________________
djazz djazz's Avatar

JCF Member

Joined: Feb 2009

Posts: 257

djazz is OFF DA CHARTdjazz is OFF DA CHARTdjazz is OFF DA CHART

May 23, 2011, 01:21 PM
djazz is offline
Reply With Quote
I'm happy to announce that WebJCS now supports "crazy animations", both flipped tiles and other animations can be used as frames. You can't save yet in WebJCS, and only do simple drawing, but viewing works great!
Crazy Anims in WebJCS


Edit:
Above WebJCS link is outdated, use the link to the WebJCS thread instead.
With this new version, you can save your Crazy Animations!
__________________
WebJCS 2 (new and in progress)
WebJCS 1 (old but complete)
SGIP Simple Games in Progress list
Level Packer v2 - With a GUI!
PHP Tileset Compiler

Last edited by djazz; Nov 18, 2011 at 01:35 PM.
Ktos.

JCF Member

Joined: Oct 2010

Posts: 78

Ktos. is doing well so far

May 25, 2011, 11:42 AM
Ktos. is offline
Reply With Quote
I have got a question, would that be possibile to create a standard tile without animation at the beggining, but after shooting it, could it be possibile for those four pieces of tile to display animation after destroying it?
Nerd

JCF Member

Joined: Sep 2008

Posts: 61

Nerd is doing well so far

May 25, 2011, 12:47 PM
Nerd is offline
Reply With Quote
It's perfectly possible, done in the same fashion as the other examples. I tested it and JJ2 didn't crash.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

May 25, 2011, 02:29 PM
Violet CLM is offline
Reply With Quote
However, if you're looking for a way to have the four pieces slowly fade away or something, that probably won't happen. The animation of the four pieces is in sync with any other instances of that animation in the level, it doesn't begin when the tile is destroyed.
__________________
djazz djazz's Avatar

JCF Member

Joined: Feb 2009

Posts: 257

djazz is OFF DA CHARTdjazz is OFF DA CHARTdjazz is OFF DA CHART

Nov 20, 2011, 10:35 AM
djazz is offline
Reply With Quote
I asked the JCS creator Michiel if he knew this while making JCS, here is his answer:
Quote:
I didn't know about the recursive animation. Is that different between hardware accelerated (DirectDraw) and software modes? I think it may have been a side-effect of caching tiles to DDraw surfaces in 4x1 chunks, and I vaguely remember resolving tile pointers in a cached list once per frame as all of the rendering was hand-coded in assembly and the extra indirection would hurt. It's been a while though. Still cool that you guys found this out. Keep on hacking guys!
He's very impressed with WebJCS and he also said:
Quote:
You know I expect a fully-working web version of JJ2 at some point (feel free to use the binary source assets). Somebody's got to do it...
While he was there I also asked about the source code of JCS:
Quote:
I think I may have the old source code JJ2 and JCS at work somewhere, but I similarly remember that I lost it somewhere in a crash/move/whatever.
Google+ ftw!
__________________
WebJCS 2 (new and in progress)
WebJCS 1 (old but complete)
SGIP Simple Games in Progress list
Level Packer v2 - With a GUI!
PHP Tileset Compiler
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Nov 20, 2011, 10:43 AM
Violet CLM is offline
Reply With Quote
Quote:
Originally Posted by DJazz View Post
I vaguely remember resolving tile pointers in a cached list once per frame
Well, that would do it! Nice. Anything you can do to, uh, encourage him to determine whether the source codes (mostly JJ2, since pretty much all we could really get from JCS at this point would potentially be the names of some seemingly useless bytes) were indeed lost would of course be tremendously appreciated. :P
__________________
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 06:23 AM.