Page 1 of 2

Help with objects

Posted: Sat Apr 24, 2004 9:19 pm
by 570
Ok, here is the low-down:

Im making a new side-scrolling game that I hope will be done before the end of May. Now, in this game the main element is stealth. Stealth will be your best bet to getting through this game alive. Now, since this is a side-scroller naturally Im using a engine, that means you'll be playing a char 2 out in the battle besides the 'real player'. Now, I want enemies in this game to have two modes; Routine Mode
Action Mode (action lol)

Now, in routine mode the enimes will not see you and follow their normal schedual and routines. Now I should explain what makes this game diffrent than any other side-scroller in ZZT ever made. In this game you can hide behinde objects, (and if there is a shadow), your suit, (which is a military fiction suit that can absorb shadows/darkness), making you temporarily invisible to the enimes. Now there is a maker at the side of the screen that tells you how invisible you are. Now, if they can see you clearly they will start to shoot, if they can sort of see you but can realy see what your doing they will run for the nearest alarm. Now here is the problem, how can I make it so the gaurds will do this when aligned with the 'fake player'. Can anyone help me?

Posted: Sat Apr 24, 2004 11:37 pm
by Dr. Dos
Alignment with an object that's not the player?

That's an easy one Dexter. You can't. Seriously.

Posted: Sat Apr 24, 2004 11:40 pm
by 570
Darn it. Is there ANY way to do what I just described? (with or without aligment) Any ideas on ANOTHER way that I could do something similar to this?

Posted: Sat Apr 24, 2004 11:41 pm
by Dr. Dos
uh, you can just use the player and not have it a sidescroller.

Or you could be weird and use MZX, otherwise you're fucked.

Posted: Sun Apr 25, 2004 2:08 am
by nps
Or you could make a hugely large and complex engine that would require all of the available objects on the board, which would match the player's co-ordinates to the range that the enemy can currently see.

Posted: Sun Apr 25, 2004 4:36 am
by Ryan Ferneau
I LIKE YOUR THINKIN, LINCOLN.

Posted: Sun Apr 25, 2004 4:52 am
by 570
Dr. Dos wrote:uh, you can just use the player and not have it a sidescroller.
I HAVE to use a sidescroller, or some of the gameplay elements will be lost....Well, I guess I can put this up to vote, (since I am going to put the game on this site anyway right?), would you like the game to have heavy stealth and some puzzle solving elements, and no, not box puzzels (not side scroller), or a little stealth action with a little more puzzle solving (side scroller)?

I should put this on a poll thing but I dont want to put up two threads in one day.

=(

Posted: Sun Apr 25, 2004 4:59 am
by Ryan Ferneau
One time I imagined a ZZT <strike>sidescroller</strike>platform-jumper-action-dealybob-with-no-scrolling-edges that had the actual player in it. I think it involved the ceiling "pushing down" on the player once the player had jumped high enough. But I never tried to make it. And it probably wouldn't work.

oh and make it metal gear solid

that has stealth

Would you like green eggs and ham? WOULD YOU?

Posted: Sun Apr 25, 2004 7:06 am
by Quantum P.
mr.bob wrote:Now here is the problem, how can I make it so the gaurds will do this when aligned with the 'fake player'.
I can think of two ways to do this off the top of my head. They both require some coding, but nothing impossible.

<b>1.</b> Keep track of the fake player's position using counters. For example, Gems would represent your horizontal (X) position and Torches would do the same for vertical (Y). Whenever the object moved, it would increment or decrement one of the counters, depending on the direction it moved.

The numbers stored in the counters would be measured every cycle (or as close as you can get) by an external object using #take and #give commands. This object would then send all objects messages corresponding to the X and Y positions (For example, if the fake player is at coordinates 35, 7, the object might #send all:x35 and #send all:y7)

You said that the enemies would follow predetermined routes. The enemies should know where they are at all times as long as they have not strayed off their routes. Each enemy would have a series of labels corresponding to the coordinate messages being sent out. Each enemy would #zap all of its labels except for those that represented its position (For example, if an enemy was at 17, 7, it would keep :x17 and :y7 unzapped). These labels would trigger whatever is supposed to happen on being aligned.

To recap: The fake player's position is stored using counters. An object frequently checks for the fake player's X and Y positions and sends them to the enemies. The enemies know their own coordinates. Each has a series of labels representing X and Y coordinates, all zapped except for the labels that represent the enemy's own X and Y coordinates. If an enemy receives a coordinate message, this means that it shares either a X or a Y coordinate with the fake player, and is therefore aligned with it.



<b>2.</b> Keep track of the fake player with object positions. This would involve having two objects separate from the fake player, one representing a horizontal position, the other a vertical position. These objects would be programmed so that whenever the fake player moved horizontally, the object representing the horizontal would also move; vertical movements would be handled in a similar manner.

A series of objects would be located adjacent to the paths along which the horizontal and vertical objects could move. These objects would act as sensors; by using #if blocked, they would be able to determine if one of the two objects was in a certain place, and therefore, if the fake player had a certain horizontal or vertical position.

As explained in the first solution, each enemy would know its position. To determine if it was aligned, it would send its coordinates to the sensors near the horizontal and vertical objects (For example, to look along Row 3, the enemy might #send y3:detect). If the horizontal or vertical indicator was detected by that sensor, it would once again mean that the enemy shared either an X or Y coordinate with the fake player and was alligned. The sensor would alert the enemy by sending a message.



Method #1:
Pros: Completely in code, requires few extra objects
Cons: A bit tricky to code, requires two counters

Method #2:
Pros: Does not occupy counters, a bit simpler
Cons: Takes more objects, requires much more space to implement (although this problem can be minimized by turning one of the indicators on its side and disguising them as part of the sidebar)

Another idea might be to use the actual player in the sidescroller instead of an object, but I don't know how you could handle stuff like jumping (maybe what Ryan Ferneau said?). There might be other ways to do this, but they escape me at the moment. Good luck!

Posted: Sun Apr 25, 2004 7:12 am
by Ryan Ferneau
Yeah, yeah, do whatever Quantum just said. It'll probably work better than all those dumb engines that involve surrounding the player by invisible objects so he can hardly move at all. I think.

Posted: Sun Apr 25, 2004 2:08 pm
by Dr. Dos
stop proving me wrong :(

Posted: Sun Apr 25, 2004 5:35 pm
by Commodore
Something I think would go horribly awry if you were to use XY coodinates. For example, what if an object was #taking from a counter while the player was trying to move? Also you would have a lot of code in the enemies to determine where they were, a lot of zap and restore commands. Then when the enemy saw you and acted, it would become even harder to trace its movements.

Posted: Sun Apr 25, 2004 7:07 pm
by superbowl shuffle
Coordinates are a bitch.

I would just have the objects which the character must stand on to be concealed check if they are blocked above. I didn't read all of Quantum's post because it is too long, but he may have said that too.

Another long post (turn back now)

Posted: Sun Apr 25, 2004 8:13 pm
by Quantum P.
Another way (probably simpler):

<b>3.</b> If you only care about detecting horizontal or vertical alignment (but not both), you could have the player on one of the edges of the board; whenever the fake player moved, the player would be pushed by objects/sliders so that it would stay in the same row/column as the fake player. As long as the enemy stayed out of the row/column that the player was in, #if alligned should work for horizontal/vertical alignment.
Commodore wrote:Something I think would go horribly awry if you were to use XY coodinates. For example, what if an object was #taking from a counter while the player was trying to move? Also you would have a lot of code in the enemies to determine where they were, a lot of zap and restore commands. Then when the enemy saw you and acted, it would become even harder to trace its movements.
You could probably avoid the #take problem with careful timing and/or a system that would keep the counters in stock. You could use Nanobot's binary copying algorithm to quickly copy each counter to a <i>third</i> counter and work with it there. Meanwhile, the X and Y counters would have probably changed, but you might be able to compensate for that by having enemies "look ahead." Even easier would be solution #2, which doesn't use counters at all.

As for the "lot of code" problem, you could have most of that handled by an external object(s). When the fake player wandered into a certain area, the external object(s) would detect this and alert the guard in that area. This object(s) could be copied to each board and modified to fit each enemy's route. Also, from what I understand (I might not be correct), when an enemy "sees" the fake player, it automatically switches out of patrol mode; it does not need to track coordinates any longer.
superbowl shuffle wrote:Coordinates are a female dog.

I would just have the objects which the character must stand on to be concealed check if they are blocked above.
Why do things the easy way when you can do them the computer crashin', memory smashin', code convolutin', 32K board way? Actually, I'd probably get lazy halfway through coordinates and do it your way. :)
Dr. Dos wrote:stop proving me wrong :(
Sorry. Technically, though, you're still right. #if objectAlligned <i>is</i> impossible to our knowledge; these are just workarounds.

Posted: Sun Apr 25, 2004 9:19 pm
by Ryan Ferneau
That's why we should all switch to ZZT 4.0. ZZT 3.25 is OLD, man.