ID:1312402
 
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
I was having a nice drive when I thought of finally how to handle one of the only problems hindering my project from using pixel movement. In my opinion pixel movement provides cleaner movement, and it looks better, it would also improve certain features of my game--but it would totally destroy the bulk of the combat system, which is based on using locations in relation to the player.

So I drifted this problem to the back of my brain, apparently getting some sunlight bought me an answer, a datum.

This particular datum would store info about an atoms pixel location. Or more specifically a point.


Choosing a pixel, then extending outwards a bounding box 16 pixels in each cardinal direction *N,S,E,W* would then give you a "tile", 32x32 pixels in width and height that would function as an origin for a location that you may wish to use.

I haven't exactly wrapped my brain around how to fully use or implement this, but I think I will try it out later. Anyway, my point in this post would be to see if you guys would be interested in taking this approach to setting up better handling of locations for the pixel moment, which I believe would vastly improve it's usability and solve a lot of the problems like accounting for positioning using pixel projectiles, or "get_step" issues when using pixel movement since the above method could be used to create a "tile" based on the position of a mob or object using pixel movement.

It would also potentially solve some problems with mobs/objs sharing "multiple" locations.
Pixel movement combat uses obounds, not get_step.
In response to Kaiochao
I think you misunderstood what I meant, you can use this method to fix the problem you'd normally get from using get_step.(in theory) if it works it would be a pixel-movement equivalent of get_step rather than just using obounds or bounds, you would end up with a "tile" of your size and choosing to use as an origin point.
In response to Dariuc
Can you explain this in a way that doesn't equal bounds()?
In response to Kaiochao
It differs in the way that you are thinking about it I suppose. You are thinking about using a bounding box during combat. I'm thinking about fixing the issue with locations so that you don't have to use a bounding box for everything.

Bounds tells you everything that is within a box.
A pixel location is a 32x32 location independent of the tiles, so in essence it's something that accomodates pixel movement.
In response to Dariuc
What are you asking for? A pair of variables for an atom's absolute pixel position?

If you're looking for a standard, (1, 1) is the bottom-left pixel of a z-level, and it increases with every pixel to the northeast.

If you're looking for a way to convert between pixels and tiles, they've existed since long before native pixel movement. But here's my formulas for converting a movable atom's position into absolute pixel coordinates:
px = tile_width  * (x - 1) + bound_x + step_x
py = tile_height * (y - 1) + bound_y + step_y

It's just a pair of numbers, just like every 2D coordinate or vector. Now, what do you actually want to do with it?
In response to Kaiochao
I think it's best to supply a visual.
Your idea of combat and mine are a bit different. Yours is limited to bounding boxes, mine is more reliant on the location of the player and surrounding tiles.

When i do it that way, i need to have a reliable location, not exist in 2-3 different places.

I'm saying that what I'm talking about is creating a "tile" based on a pixel point, expanding outward from that pixel point, then creating other tiles in relation to the first one.
In response to Dariuc
Why is this a feature request, then? Just make it yourself, easily enough.
-_-*
You know what? Nevermind.
A better question is, if it's so simple to set up why isn't it just made an update so everyone can use it?

Can I get a mod or somebody to delete this? I'm tired of trying to be productive and in the end getting treated like i don't know what I'm talking about or that I'm an idiot. Thanks.
In response to Dariuc
Maybe you don't understand what bounds() and obounds() do?

They're not limited to what's inside an object. They have many parameters to adjust the size and position of a bounding box relative to an object.

The bounds() proc doesn't even need to be attached to an object. It takes an absolute pixel position and a size.

They return a list of atoms, like view() or range(). The get_step() proc doesn't work well for pixel movement combat because it returns a turf, not a list. Fortunately, there are many different ways to make your own pixel-based get_step procedure, using obounds().
In response to Kaiochao
I can't really explain it any better than I already have. My purpose isn't to make a get step proc. Either way nevermind, I'll just do like you said and set it up myself.
How about we start over, then? Either you're completely overlooking how simple it is to use pixel movement, or you're still failing to get your point across.

Dariuc wrote:
In my opinion pixel movement provides cleaner movement, and it looks better, it would also improve certain features of my game--but it would totally destroy the bulk of the combat system, which is based on using locations in relation to the player.
How does pixel movement break this? Relative locations are important, but if you've been using get_step(), you'll need an alternative, because get_step() returns a turf, not a list of atoms within a bounding box; that's what bounds/obounds is for.

a datum.
This particular datum would store info about an atoms pixel location. Or more specifically a point.
You can easily get the absolute pixel coordinate of an atom with this simple snippet:
#define tile_width  32
#define tile_height 32

atom
proc/width() return tile_width
proc/height() return tile_height

proc/px(p) return loc && tile_width * (x - 1) + p * width()
proc/py(p) return loc && tile_height * (y - 1) + p * height()

movable
width() return bound_width
height() return bound_height
px(p) return loc && ..() + bound_x + step_x
py(p) return loc && ..() + bound_y + step_y

I use this in all of my projects.
(px(), py()) is the bottom-left pixel of an atom.
(px(0.5), py(0.5)) is the center pixel of an atom.
These are absolute pixel coordinates. According to the DM Reference entry on the bounds() proc, "Absolute coordinates start at 1,1 at the lower left corner of the map, by tradition."

Choosing a pixel, then extending outwards a bounding box 16 pixels in each cardinal direction *N,S,E,W* would then give you a "tile", 32x32 pixels in width and height that would function as an origin for a location that you may wish to use.
This is either unnecessary or unclear. If you want to get a list of atoms in a particular bounding box on the map, you simply use bounds().

Anyway, my point in this post would be to see if you guys would be interested in taking this approach to setting up better handling of locations for the pixel moment,
You're going to have to explain how much better location handling can get than tiles, bounding boxes, and absolute pixel coordinates.

which I believe would vastly improve it's usability and solve a lot of the problems like accounting for positioning using pixel projectiles,
What problems are you having regarding positioning pixel projectiles?

or "get_step" issues when using pixel movement since the above method could be used to create a "tile" based on the position of a mob or object using pixel movement.
What issues? The get_step() proc does what it was defined to do. It returns a turf.
The world still exists in tiles (called turfs) on the map, and there's no changing that.
If you want to get atoms in a position relative to a player (which is what you'd want if you previously used get_step for melee combat), you should now use obounds().

It would also potentially solve some problems with mobs/objs sharing "multiple" locations.
The world exists as a grid of tiles of uniform and constant size. Of course movable atoms will have multiple locations (in the locs list). However, this isn't even a problem.

mob
verb/punch()
// Tile movement:
// get_step(src, dir) returns the turf ahead of src
// loop through that turf's contents for mobs to punch
for(var/mob/m in get_step(src, dir))
m.die(src)

// Pixel movement:
// bounds_step(src, dir) returns a list of atoms ahead of src
// loop through that list for mobs to punch
for(var/mob/m in bounds_step(src, dir))
m.die(src)

// Alternate (but equivalent) forms:
// Tile movement:
var turf/ahead = get_step(src, dir) // a turf
// Pixel movement:
var ahead[] = bounds_step(src, dir) // a list
// Both:
for(var/mob/m in ahead)
m.die(src)



I think you misunderstood what I meant, you can use this method to fix the problem you'd normally get from using get_step.(in theory)
Again, you're not supposed to use get_step().

if it works it would be a pixel-movement equivalent of get_step rather than just using obounds or bounds, you would end up with a "tile" of your size and choosing to use as an origin point.
No get_step() required. If you want to get a "tile" to search inside, use obounds() or bounds().

It differs in the way that you are thinking about it I suppose. You are thinking about using a bounding box during combat.
So are you.

I'm thinking about fixing the issue with locations so that you don't have to use a bounding box for everything.
This doesn't make any sense, at all. A tile is as much a bounding box as is using bounds() with absolute pixel coordinates, not attached to any object.

Bounds tells you everything that is within a box.
A box that you define. It's limitless.

A pixel location is a 32x32 location independent of the tiles, so in essence it's something that accomodates pixel movement.
A pixel location is a 32x32... no.

I think it's best to supply a visual.
Your idea of combat and mine are a bit different.
Yours is limited to bounding boxes,
Bounding boxes have no limits.

mine is more reliant on the location of the player and surrounding tiles.
Tiles are irrelevant in pixel movement.

When i do it that way, i need to have a reliable location, not exist in 2-3 different places.
Tiles, including loc, are irrelevant when using bounds() or obounds().

I'm saying that what I'm talking about is creating a "tile" based on a pixel point, expanding outward from that pixel point, then creating other tiles in relation to the first one.
Do you even know what bounds/obounds does?

A better question is, if it's so simple to set up why isn't it just made an update so everyone can use it?
A better question is, why doesn't pixel movement natively support decimals in the coordinates?

I'm tired of trying to be productive and in the end getting treated like i don't know what I'm talking about or that I'm an idiot.
You definitely need to make your point clearer. Until then, all anyone can see is that you don't know what you're talking about, especially since it's been taking so long.
You're not an idiot, you may just be ignorant, is all.

I can't really explain it any better than I already have. My purpose isn't to make a get step proc.
That's good, since get_step has nothing to do with pixel movement.
Even though you mentioned having problems with it a few times already.

Can you maybe provide some examples of what ideal code would look like, given "better pixel movement location support?"
If you do know what you're talking about, you should at least be able to do that.

Otherwise, I wish you luck making this system without using bounds() or obounds() at all.
Not exactly what I meant when I said nevermind, what I meant was I find that oft times I fail at explaining things.
It seems I fail to explain what I need this for or why I need it, and having failed to do so- I just opted to not really press it any further.

I feel that using "just" bounds for pixel combat is a bit confining. In particular, with the way I have some of my combat set up (particularly skills). I never meant to remove the use of bounds also.

Imagine:
98765
>432
>>1
@

Where @ is the player, the numbers are the tiles that are affected by the skill.

This is an example of a skill in my game.

However using pixel movement I would have to redesign an icon or make a new one to cover the space and check to see if anything is in the bounding box of the icon.(Think spirit age fire breath skill) The downside to that is there is no real location, it's just hit or miss if the player isn't correctly lined up, and in some ways it's sort of like card board characters standing up trying to whack each other (for lack of a better visual but that's what I'm reminded of.)

What I was thinking is more of having a personal grid of coordinates based on pixel movement to by-pass the problem of existing in two tiles, which messes up example ^^.

By getting the origin pixel point of the player, you can then build tiles around it *i say tiles, but they are really just bounding boxes*.
>RRRRR
>>RRR
>>>@<---origin

In this example it's the same except anything in the "pixel locations" are affected by the skill, it won't matter whether the player is stuck between two turfs or in multiple locations, the places being targeted are dependent on the origin point *which could be anything, it doesn't have to be the player".

After setting up something like this you could then also set up a "get_step" equivalent for use so that you wouldn't need to worry about any issues. Which was ultimately the reason I posted here.


As long as I have "tiles" (-which in effect would be bounding boxes-), held in datum form to simulate pixel "tiles" or groups of 32x32(or whatever amount) of pixels, I could then do fairly the same thing that I've always been doing with a few minor changes and then convert the whole game over to pixel movement.

So if I had a skill that had a hit zone like this:
X>X>XX>X>X
>X>X>>X>X
>>XXXXX
>>>X >X
>>>>X
@


Where @ is the origin, it wouldn't be a big issue to get the proper locations I need, and check those locations without having to rely on native locations while trying to use pixel movement.

Not only that, I wouldn't have to rewrite things repeatedly for each direction.
So to summarize this, you want to create rings of objects of varying number surrounding a given origin point or object, and if that origin object is moving, make the rings follow it around wherever it goes?

To make this happen, you will probably want an engine to handle these effects for you. In the end, you will want a proc that can simply take the effect type and ring size as arguments, to make this happen. Writing all of the smaller, modular procs needed to support that one, should be your goal.

Now, since you want these effects to follow around an origin mob, if that happens to be the origin, I would suggest using overlays for these effects. Otherwise, every single tick, you would have to check the origin mob's pixel offsets, compare them to the offsets of the effect rings, and adjust the rings' offsets based on that. This would likely result in massive lag, and I don't think you want that.

According to the reference, objs can be added as overlays. Whether this means the obj will really exist with all its bounds and everything, or whether it's just purely visual, I'm not sure. If it means the obj will actually be instanced in the overlays, then you can easily set the bound and step offsets relative to the origin, and the overlays will just follow the mob around. You could then check for Cross(), or compare with the bounds of other surrounding objects to determine what to actually affect. However, if an obj added to an overlay is in fact purely visual, which I hope not, then you will have to adjust pixel_x and pixel_y, then compare those values to the bounds of surrounding objects every tick, to make up for the lack of an actual Cross().

Basically, you don't really need a grid relative to an origin mob, since overlays can handle that for you. You also wouldn't be stuck with incrementing by "tiles" of say 32 pixels. You would simply specify the width of your rings in however many pixels you want. It should be very flexible this way. Also, you can get circles or ellipses around the player if you add the right algorithm for it.

I hope this is helpful. I really don't know what happens when you add an actual obj as an overlay, so let me know if that is purely visual or not. It would be very convenient to have an actual object instance as an overlay, and would make things like this much easier.
In response to Multiverse7
Not rings. Boxes. And I don't need them to follow me around or anything-- they can exist just for the moments I need them. Ultimately I'm saying this is useful to everyone, not just me. Which is why I posted it here. I don't need advice making it persay, I could do that given enough time-- the whole point of this post seems to have been missed. lol.


Also, it's not really that hard to set up so I wouldn't really need an engine. And Overlays would not solve this problem since an overlay would become part of the object or atom they are placed over. You'd still end up running in circles I think. For your method to work you'd have to place objects on the actual map. All I need is information about coordinates.
Just a datum and a few procs
In that case, I will try to take an unbiased look at your first post, and assume that this would have potential uses that are not yet known.

Dariuc wrote:
This particular datum would store info about an atoms pixel location. Or more specifically a point.
I'm not really sure why you would want to store an atom's location within a datum. If something like this were built-in, I would think it would be stored as a var of the atom itself, or were you talking about some kind of list of locations?

Choosing a pixel, then extending outwards a bounding box 16 pixels in each cardinal direction *N,S,E,W* would then give you a "tile", 32x32 pixels in width and height that would function as an origin for a location that you may wish to use.
I will try to break this down more.

Choosing a pixel,
Where do I get this pixel to choose from? Is this the coordinates of a pixel from an actual atom's icon, or is this a pixel relative to the entire map, whether it contains anything or not?

then extending outwards a bounding box
What do you mean by "bounding box"? A bounding box is something that applies to an atom. If there is no atom, there is no bounding box.

16 pixels in each cardinal direction *N,S,E,W* would then give you a "tile", 32x32 pixels in width and height
If this is supposed to help pixel movement, why would you want to have anything to do with a "tile"? It's already bad enough that pixel movement has the real tile grid to deal with, and you are suggesting that another tile based location system be added for futher restriction? I have no idea what this is even supposed to do for pixel movement.

that would function as an origin for a location that you may wish to use.
How would this new "tile" origin even work as an origin? Does this replace the default origin of the map, or is it something completely independent? I assume this is independent, since otherwise it would require a massive overhaul to add something like a whole other kind of map_format. Since this would be an independent method of locating an atom on the map, the atom would still have to have a normal location relative to the map's grid, otherwise there would simply be no way for it to exist there.

What this tells me is that there is no way that this could be built-in as a feature. The whole system would require that the normal, map grid based locations be constantly translated into this new, pixel relative type of location, and that would add overhead to every single game that currently exists. Of course, this is assuming that this pixel relative location is saved somewhere as an actual var. If that is not the case, and this is only used to "blindly" Move() atoms and determine their locations using a proc, then it may be possible to add this feature, since the procs would not be called automatically.

Either way, this is all starting to sound like you just want to locate and move objects relative to a set of pixel coordinates on the map. If that is the case, then it should be easy enough to just define your own procs to translate locations to and from a relative location type and the built-in map grid's location type.

Honestly, the more I think about this feature, the more unnecessary it seems to be, which leads me to believe that I am simply not understanding it at all. Nobody can really argue one way or the other if they don't even know what the argument really is to begin with. Feature requests need to have ideas that are specific and mostly complete, otherwise you could risk sending everyone that reads them on pointless scavenger hunts in all sorts of different directions, until they all just give up.
If it's special collision detection you want, maybe you should look into more useful math, like vectors.

Or even suggest pixel-precise collision detection based on a mask of pixels; in your case, a triangle. This would actually be useful.

If all you need is information about coordinates, you should look at the snippets I posted about getting the absolute pixel coordinate of any atom.