Author Topic: White Control Line Only Applies When Coming from One Direction  (Read 428 times)

0 Members and 1 Guest are viewing this topic.

Offline NilG

Hi again,

This may not quite be a syntax question, but I'm encountering a problem with the white control line in one of my rooms.  Previously, I'd had just a very rough mock up of the rooms, and all control lines seemed to work fine.

The past couple of weeks, I've buckled down and started working on actual backgrounds.  All's been great here until working on one outside scene today.  After coming up with an improved-but-still-rough start where I could place the entries (player can go west, south, or in a building on the screen), I went ahead and created control lines to cage the ego in and open passage where desired.

Testing it out, I've found that the south white control line only seems to apply when the player is coming from the south room; that is, if I come from the east or out of the building, the user can skip right over the white line and end up in the south room through any point on the lower end of the screen.  If, on the other hand, the player has just come from the south room, the white line applies and properly keeps the user confined to the room unless the entry area is used.  All of the other lines in this room seem to work as expected regardless of the entry point; it's just this one wall that fails anytime the user comes from one of the other two rooms.

The entry code is identical for all entry points other than positions and loops:

Code: [Select]
(switch gPreviousRoomNumber
            (north
  (gEgo posn: 230 142 loop: 2)
  )
            (west
  (gEgo posn: 25 148 loop: 0)
  )
            (south
  (gEgo posn: 198 185 loop: 3)
 
(else
(gEgo posn: 150 130 loop: 1)
)
)

and the exit code is similarly plain:

Code: [Select]
(method (doit)
(super doit:)
(if (& ctlCYAN (gEgo onControl:))
(gRoom newRoom: 7)
)
(if (& ctlFUCHSIA (gEgo onControl:))
(gRoom newRoom: 5)
)
(if (& ctlYELLOW (gEgo onControl:))
(gRoom newRoom: 6)
)
)


I'm pretty puzzled what the issue could be.  I've redrawn the control lines a few times in a few different positions, but I'm finding the same behavior regardless.  Any ideas what I could be doing wrong here?



Offline NilG

Re: White Control Line Only Applies When Coming from One Direction
« Reply #1 on: March 12, 2019, 07:27:15 PM »
Just to note, ran all through my other rooms and found there is another room with similar behavior on the south wall only; however, with this room, it happens regardless of which entry I use.  The south wall/control is just ignored, even if I do come in from the south.

The only other two rooms I currently have with south entries work as expected, though both of those only have the south entrance (and the first is the opening room).

Still haven't figured out the reason for this yet, though.

Offline lskovlun

Re: White Control Line Only Applies When Coming from One Direction
« Reply #2 on: March 13, 2019, 02:06:47 AM »
It sounds (and looks) like you're taking the term 'control line' a bit too literally. Actors have an xStep and yStep property which decides how far an actor moves per game loop. If you use control areas smaller than xStep times yStep, then the actor can step right over them. So either make your control lines thicker, or jiggle your actor positioning until the math works out (you can of course also adjust the step counts with the setStep method, but the right step values really depend on your actor's animation, so you may need to redraw him too if you choose to do that).

Offline NilG

Re: White Control Line Only Applies When Coming from One Direction
« Reply #3 on: March 13, 2019, 07:18:15 AM »
Thanks lskovlun, it looks like that's true; reinforcing the lines a couple thicker did the trick for both rooms.  Do you know if it might have anything to do with being at the edge of the screen?  I've seen my guy never crosses the north line in this room despite it being only a pixel thick.  The south walls for both rooms are now 5 and it works, but maybe there's something about the way the ego interacts with the edges of the pics/rooms?  The southern edges are the only ones right up against the edge of the window, so that's my best guess.

Anyway, everything seems happy now, so thank you again.

Offline Kawa

Re: White Control Line Only Applies When Coming from One Direction
« Reply #4 on: March 13, 2019, 08:54:05 AM »
Instead of thickening the lines, why not flood-fill the exterior?

Offline troflip

Re: White Control Line Only Applies When Coming from One Direction
« Reply #5 on: March 13, 2019, 11:23:10 PM »
Hmm, I thought onControl: worked with the base rect of the actor, whose height is sized based on the yStep? So a single line should definitely trigger. Unless somehow they've gotten out of sync? (You can also pass TRUE to onControl: so that it works on a point and not a rect, but you're not doing that here).
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline NilG

Re: White Control Line Only Applies When Coming from One Direction
« Reply #6 on: March 15, 2019, 08:32:51 AM »
True, a fill's more efficient, I was just going nuts with lines trying to figure out where they'd need to be in order to function.  It doesn't seem coincidental to me that both cases of lines being ignored were on the south-side, but really, if it works, I'm happy with it.

Offline lskovlun

Re: White Control Line Only Applies When Coming from One Direction
« Reply #7 on: March 26, 2019, 04:16:30 AM »
Hmm, I thought onControl: worked with the base rect of the actor, whose height is sized based on the yStep?
Call it a hunch. We had a bunch of bugs like this in the FreeSCI days.

Offline troflip

Re: White Control Line Only Applies When Coming from One Direction
« Reply #8 on: March 26, 2019, 02:51:29 PM »
Hmm, I thought onControl: worked with the base rect of the actor, whose height is sized based on the yStep?
Call it a hunch. We had a bunch of bugs like this in the FreeSCI days.

I don't understand. That's exactly what should happen. The base rect (brLeft, etc...) is calculated based on the yStep. And OnControl uses the base rect and returns bitflags containing all the colors in that base rect. So a single control line should be sufficient.

If it's not, then there's a bug somewhere else in their code that should be fixed. Somehow the base rect is getting out of sync.

Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: White Control Line Only Applies When Coming from One Direction
« Reply #9 on: March 26, 2019, 08:04:00 PM »
Ok, assuming this is the SCI0 template, it's probably due to this code:

Code: [Select]
(method (doit)
(super doit:)
(cond
((<= x 3) (= edgeHit EDGE_LEFT))
((<= y (gRoom horizon?)) (= edgeHit EDGE_TOP))
((>= x 316) (= edgeHit EDGE_RIGHT))
((>= y 186) (= edgeHit EDGE_BOTTOM))
(else (= edgeHit EDGE_NONE))
)
)

Basically, when the ego is at y 186 or higher, they go to the room to the south. So they never even reach your single white control line. The solution would be to place the control line at 186 or less...
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline NilG

Re: White Control Line Only Applies When Coming from One Direction
« Reply #10 on: March 28, 2019, 06:35:55 PM »
Aah, nice.  Yep, it's SCI0, and that looks about right. Any ideas off the top of your head why it did work only when I entered the screen from that direction for the one room?  Doesn't really matter, I guess, just curious.

Offline troflip

Re: White Control Line Only Applies When Coming from One Direction
« Reply #11 on: March 28, 2019, 07:00:46 PM »
Aah, nice.  Yep, it's SCI0, and that looks about right. Any ideas off the top of your head why it did work only when I entered the screen from that direction for the one room?  Doesn't really matter, I guess, just curious.

Yes, I think because of this:

  • The default yStep is 2
  • Its base rect will therefore be 2 pixels high, at the ego's y-1 and y (per the kernel BaseSetter function)
  • In your pic image, the white control lines at the bottom are at y=187 and y=188.
  • So the ego can't be at y=187 or higher - it will be blocked
  • Per the SCI0 code, the ego leaves the room to the south at y=186 or higher
  • Since yStep is 2 your ego moves in 2 pixel increments in the y axis.
  • If the ego is positioned at an odd y coordinate (as when entering from the south) and walks south, it will go to 181, 183, 185, and no further since it can't be at 187
  • If the ego is positioned at an even y coordinate (as in all other directions but south), it will go to 182, 184, 186, and then be kicked into the next room

Check out my website: http://icefallgames.com
Groundhog Day Competition


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.096 seconds with 24 queries.