ID:2010533
 
turf
proc
TurfBoundsOkay(mob/a,X=0,Y=0)

if(!X && !Y) return 1 //allow the move as it is not actually moving anywhere so it can't actually hit anything

var
turf/t = src
edge_x = a.step_x //edge_x and edge_y will represent an outside edge of the bounding box to check against
edge_y = a.step_y

edge_x += a.bound_x
if(X>0) edge_x += a.bound_width
edge_y += a.bound_y
if(Y>0) edge_y += a.bound_height

if(edge_x + X > world.icon_size) t = get_step(t,EAST)
else if(t && edge_x + X < 0) t = get_step(t,WEST)

if(t && edge_y + Y > world.icon_size) t = get_step(t,NORTH)
else if(t && edge_y + Y < 0) t = get_step(t,SOUTH)

if(!t) return
if(!t.turf_bound_width || !t.turf_bound_height) return 1 //custom bounding boxes aren't even on this turf so you can try to move there

edge_x+=X
edge_y+=Y

while(edge_x > world.icon_size) edge_x-=world.icon_size
while(edge_x < 0) edge_x+=world.icon_size

while(edge_y > world.icon_size) edge_y-=world.icon_size
while(edge_y < 0) edge_y+=world.icon_size

//HERE: i'm pretty sure this part is not made correctly
if(num_between(edge_x, t.turf_bound_x, t.turf_bound_x + t.turf_bound_width))
if(num_between(edge_y, t.turf_bound_y, t.turf_bound_y + t.turf_bound_height)) return //do not allow this move because the player's bounding box would be touching or intersecting the turf's bounding box if it is allowed to move

return 1 //nothing appears to be stopping this movement from happening so go for it


I have this proc I made called TurfBoundsOkay() which checks if a mob would be allowed to enter a turf based on the turf and the mob's bounding boxes and the direction the mob is trying to move. The proc's X and Y arguments are the pixel direction the mob is trying to move. This code is part of a system I'm making to allow turfs to have bounding boxes because BYOND does not support that normally. I commented the lines that I suspect are the problem area.

I copied BYOND's system with the bound_x/y bound_height/width vars by giving turfs the turf_bound_x/y and turf_bound_height/width vars. Thanks.
What needs "fixed" about it is that when I'm running around in the game testing turfs with different boundings, it often times acts really wonky like the turf has jagged rather than square bounds or something. And sometimes I'll just go right thru the bounds if I just rapidly press random directions on the keyboard spazzing the character back and forth til he just goes right into the bounding box.
Turfs don't have bounding boxes. A quick check in the f1 help type in turf, click vars and you'll notice what I mean.
Edit: Ah, sorry misread your original post, pardon me. :o
I think it has something to do with me treating edges of bounding boxes as points instead of line segments, but my mind is too clouded to figure it out right now
I'm actually not sure why you even need to do this, since you could use objects.

Like.. I sort of get it but then..I don't.
With a map my size (500x500x10) I think I would end up with over 10,000 objects just from map "border objects" laying around. Seems like a performance hit compared to checking some vars on the turf itself to see if it can be entered.

But I might have to. I'm already noticing a performance hit anyway from calling TurfBoundsOkay() each time the player moves, due to fps being 60 and step size being 4.3
Why is your fps set to 60?
Also how large is your view? if it's wide then you may want to consider shrinking the view as well as decreasing the FPS.

Having a high fps is cool and all, but sometimes it's good to sacrifice 1 aspect so that the game has more playability. I'm almost sure that decreasing your FPS to 30 would make it less intensive in all areas of your game.

Aside from that, what I meant was-I get "why" you're doing it. But do you really need that level of realism? Realism for the sake of realism isn't often needed in your game. I'd forget it and just use dense turfs unless your game play absolutely involves that level of pinpoint calculations (most games do not).

Once again, I have no clue about your project, but in all likelihood this is an minor issue that can be solved with some creative coding/ mapping. The time that you spend trying to put together something like this is time you can spend on 2-3 other features in your project most likely.
View is 13. I can cut the FPS back as needed during the game's development but I'd like to end up keeping it as high as I can. The main reason I'm doing turf bounding boxes is for "turf borders", like seen on this path,

http://puu.sh/mh9Ew/22cfff873e.png

so that the player can step on the borders, the borders only take up half a tile, so they should be able to step half way onto the tile. Your right I could have done multiple other features by now if I would have just used objects for this. Using objects would greatly increase startup time for the game due to all those obj/New() calls though.
How come none of your games are ever up? The screenshots of them look great
In response to Tens of DU
I work on 2 and one's in the process of greenlight on steam. all of them are in development and refinement though.

Ideally it would be great if turfs had that functionality but it's as you've seen. Which is why I suggested simply ignoring it or working around. Basically you just have to decide if it's worth it or not.
I've decided I'll have to go with objects because of reasons mentioned but also because my custom turf bounds system doesn't account for giant mobs with bounds exceeding 1 tile, and that is starting to get beyond my comprehension. So time to take the easy path. Thanks Avid for the tips.

I'm a Steam member, that means I can vote for your game to be greenlighted right? If you want to link me that is. Are there any other BYOND games on Steam other than NEStalgia?
And could you clue me in on how you made your game into an EXE file? Since Steam only allowed EXE files I assume you somehow made yours into one.
Hi Tens.

I looked at the code. I'm not familiar with bound boxes, but what you stated that if you hit random arrow keys and your mob goes through.

In the code I noticed that you don't have NORTHEAST, NORTHWEST, etc etc.

Do you think that could be a problem to it, or am I wrong?