Page 1 of 2

The black holes that make the player jump...

Posted: Sun Dec 28, 2003 10:20 pm
by 110
are all over my boards. I don't really notice them, but in my latest game attempt, i have an object using if not contact #go seek and when he walks over them, he changes his char. This is good since it's a trippy board, but it's annoying other times. WHAT HAVE I DONE WRONG TO MERIT THIS PUNISHMENT?!

Posted: Sun Dec 28, 2003 10:32 pm
by Zephyr
That's just what the terrain does. if you don't like it, don't use them.

Posted: Sun Dec 28, 2003 10:54 pm
by My Liver Hurtz
Zephyr is right. Black holes are not natural to ZZT, they are artificial. Contextually speaking of course. There is no way to control what side effects result from using black holes.

Posted: Mon Dec 29, 2003 12:42 am
by 110
>_>

I didn't add them! They flocked to me! So odd...

Posted: Mon Dec 29, 2003 1:40 am
by 536
Most likely, you did a flood fill over a group of something with stats. Black holes (or, empties with stats) DO have predictable effects, along with everything else in ZZT, and they can be quite fun to mess with.

Basically, here's what's happening with your object: the object steps over a black hole, so now there are two groups of stat information pointing to the same coordinates. Because of the order in which that information is stored on the board, the object "accidentally" uses the black hole's stats instead of the original object stats. However, the original set of stats is still the one with the code, so when the object steps away, the char should return to normal.

Using an external editor, you can view what the parameters of the black holes are. You can produce some cool effects by taking advantage of the stat switching. One example of this is creating a black hole with altered X/Y Steps and having a bullet go over it. The bullet will change directions, based on those Step values, and the bullet's original stats will be left behind on the black hole.

Posted: Mon Dec 29, 2003 3:40 pm
by 536
Here's the scoop on why the player skips over black holes:

Let's say you press left and move your player onto a black hole. As anyone who has dealt with this technical side of ZZT undoubtedly knows, the "ACE" player is the first group of stats on the board, so the black hole's stats are always after the player's. ZZT runs through the groups of stats until it finally reaches the stats for the black hole that the player just stepped onto. Those stats' coordinates now point toward a player instead of an empty/black hole, so ZZT thinks that the stats belong to the player. For the same reason that a single direction press triggers responses from all player clones on the board, the black hole's stats think that left was just pressed. So it does to the player what it normally does when the direction was just pressed: it moves it left. That's two movements in a single cycle.

If there are multiple black holes in a row, two things could happen:

1) If the next black hole's stats are past the current one's, it will be a continued chain reaction and the player will move an additional space in the same cycle.

2) If the next black hole's stats are before the current one's, those stats have already been passed on that cycle and therefore don't do anything further in that cycle. Therefore, the player stays put and you have to press the direction again in another cycle in order to move past it.

That about wraps that up.

Posted: Mon Dec 29, 2003 7:39 pm
by 136
If 2 things with stats in the same place, thay will start useing ech uthers stats (becuse uve the cycle) and mes up. The stats secsen is seprit from the bord secsen, so the X and Y number in both places can be set same. So the loop uv things hapening will go thrue the stats list in order, increse the curent cycles numbers, if it matches it go back to normal and do wat that pece dus (bi checking on the bord in that X,Y place). If is object, it will do program and will show char uv object. If is monster, make it move. If it is player to wat keys you press and move ACE player that direction uv that X and Y place. If it is pasige, do nuthing, the only resin pasige with stats is so that it can store wat bord to go to bi the pasige.

Posted: Mon Dec 29, 2003 9:17 pm
by 519
Nanobot wrote:One example of this is creating a black hole with altered X/Y Steps and having a bullet go over it. The bullet will change directions, based on those Step values, and the bullet's original stats will be left behind on the black hole.
Can you elaborate on this more? Will the bullet go off in another direction?

Posted: Mon Dec 29, 2003 9:18 pm
by 83
Nanobot wrote:That's two movements in a single cycle.
Not exactly. Every time the player moves, a cycle passes. Now, the player moves 2 steps, which results in 2 cycles passed in once. Lit a torch (or touch an energizer) right before you touch a row of holes to see this!

Posted: Tue Dec 30, 2003 12:04 am
by 536
zzo38: Yes.

theorangehamster: Basically, the bullet's X/Y Step values will switch with the black hole's X/Y Step values. If the bullet's is (0,1) (down) and the black hole's is (1,0) (right), then the bullet will head downward until it lands on top of the black hole, when it will suddenly start moving right and will continue right until something else messes with it.

Smallhacker: Actually, the torch is handled completely by the player. It's the player that responds to the T key, removes the darkness "overlay" around it, and reduces the torch cycles counter. Multiple players on the board will cause the torch to run out more quickly.

A cycle, in the way that I commonly use it, is one loop through all of the groups of stat information on the board. Basically, every time the first set of stat information does something by itself marks the beginning of the next cycle. A cycle is always the same length of time, which is the length of a #play note of length "s".

Now, when I said that the player moves the second time, I meant in the same way that a player moves by a player clone. The player element doesn't take the black hole's stats as you might think. Player movement is special and only alters the X/Y coordinates in the ACE's stats, so the player remains the ACE. In other words, the player element moves, the first set of stats (ACE stats) moves in the same direction, and the black hole's stats (the stats that are currently doing stuff) don't change.

The result is basically identical to the player simply moving twice in one cycle. However, there is a catch: any element whose stats reside between the ACE stats and the black hole's will act as though the player moved once, and the elements whose stats reside after the black hole's will act as though it moved more than once, because the player actually has moved more than once by the time ZZT ran through the later stats.

Posted: Tue Dec 30, 2003 12:09 am
by 519
Hmm... interesting. This can make for neat bullet tricks.

What's the procedure for getting a black hole with a useable 'stat'?

Posted: Tue Dec 30, 2003 12:28 am
by 536
Using an external editor that allows you to manually modify the X and Y steps is the easiest way. In the default editor, you could use pushers facing in the desired directions and flood fill them with empties to get the black holes. I haven't tested this, but I assume it would work.

Posted: Tue Dec 30, 2003 4:17 am
by 110
Ah. It must have been the flood fills. Thanks.

Posted: Wed Dec 31, 2003 7:35 pm
by 136

Code: Select all

if(bord[stat[n].x,stat[n].y].kind==K_PLAYER) {
  if(keypress==KEY_DIR_N) {
    if(bord[stat[n].x,stat[n].y-1].kind==K_SPACE || bord[stat[n].x,stat[n].y-1].kind==K_FAKE ) {
      bord[stat[n].x,stat[n].y].kind=bord[stat[n].x,stat[n].y].under;
      bord[stat[n].x,stat[n].y-1].under=bord[stat[n].x,stat[n].y-1].kind;
      stat[0].x=stat[n].x;
      stat[0].y=stat[n].y-1;
      bord[stat[0].x,stat[0].y].kind=K_PLAYER;
    }
  }
}
Uve corse, this is not completed at all, how it rely is programed is use subrutines, variables, code in between that codes, and a lot more stuf, this is just example.

Code: Select all

0: Player -- check move direction.
1: Player (used to be space, but now same x,y as player 0) -- check move direction and move player agen
2: etc....

Posted: Wed Dec 31, 2003 9:03 pm
by 519
Flood filling pushers works. Thanks.