Improbable Icon

Abstract Locations & Distances

v9-0-0

#1

Hi,

After going through the tutorials, I been furiously designing my first prototype. I now have a question about coordinate of entities, chucks and what not.

It seem to me like SpatialOS assume a traditional 3D world in which the player will “run around” freely BUT what if I want to use abstract locations and distances. Can I instead use a simple enum to keep track of entities locations OR should I still use coordinates?

Workers “visibility” and chucks make me feel like I can’t avoid dealing with distances as numbers at least in the back-end.
If coordinate is a must, what can I do to make sure I design a system that won’t bite me later?

Imagine that the player will travel FROM house X in a town Y in a region Z TO house A in Town B in the C region.


#2

Hi @SionoiS!

Seems to me like you are indeed smashing it! Good stuff :smile:

Regarding your “coordinates” question the first assumption, if I understand it right, is kind-of the idea to go with. My thoughts:

  1. Do everything in coordinates. Those are necessary anyway to keep track of things like speed, location & co related to the physics engine.
  2. If you want to use abstract locations then you need to use that as an “abstraction” over the coordinates. Use a map (not an enum I would say) to maintain the correspondence between Location A and (A.x, A.y, A.z).

This would allow you to handle all combinations of abstract locations and real coordinates in a transparent fashion without too much overhead.

Furthermore most computations and game-logic algorithms (A.I, path-finding, etc) need to deal with coordinates anyway, be it directly on indirectly, for their computations.

If my interpretation of what you want to do is off then sorry. Maybe with an example that is a little bit more concrete we might come up with something yet even more efficient / well-fitting.

Feel free to continue to bounce of ideas in here as it might attract people with other insights or give inspiration to yet other developers! I am happy to continue the discussion if you have further questions / thoughts!

Duco :robot: :computer:


#3

By the way… if you really want to have notions of “regions” as specific sub-domains of your world on which you want to be able to operate and compute independently you can also make a secondary layer of coordinates between which you can translate via dedicated functions.

For example region X is the main (whole) world with the absolute coordinates (x, y, z).
Now you can have regions A and B which take their respective origins at (10, -8, 50) and (-20, -120, 10) in X coordinates.
This means that you can have objects belonging to region A have secondary coordinates (i.e the ones you are using for your application) with a simple translation function that casts the A-based coordinates to the required X-based coordinates for SpatialOS.

This example is of course simplified as you could have other kinds of coordinate systems for different regions (polar, eulerian) that could still be translated to the X coordinates by a function.


#4

Thanks for the insight it is very helpful. Your idea of using map is good, it’s probably what I’ll try first.


#5

No worries. @SionoiS. Happy to help!