0
\$\begingroup\$

Beyond the different coordinates systems (x/y, ...), imagine you draw the map of your world on a bitmap, png, gif or whatever image.

Then you got your world and you'd like your players/character (PC) to travel through its different parts (lands, regions, etc...).

How can I simply locate in which part (land, region, ...) of the world a PC is entering/leaving ? Detecting when a boundary is crossed ?

What is the easiest way ? What options do I have ?

\$\endgroup\$
  • 3
    \$\begingroup\$ Are you asking how to identify which coarse region (like "Stonedwarf Mountains", "The Fey Lands", etc) a player is in, instead of exact coordinates (657.88572, -229.55491) \$\endgroup\$ – Zymus Nov 21 '18 at 21:25
  • \$\begingroup\$ Yes, that's it, and as well to know when a boundary is crossed. \$\endgroup\$ – Douglas Nov 21 '18 at 22:09
  • \$\begingroup\$ Could you give an example image of what this map would look like? I'm struggling to understand. Are the regions shown with different colours or what? Is the map the same as what's being shown to the player, or is it just data, with a separate pretty "display" map that's actually shown to the player? \$\endgroup\$ – Anko Dec 3 '18 at 20:19
2
\$\begingroup\$

Define a surjective function from the game coordinate system to the world map.

Suppose we have a game world where all points are between (0, 0) and (100, 100). We can then create a world map that is 10 pixels by 10 pixels and a function f(P) = (P_x / 10, P_y / 10) to map from the game world to the world map.

Let's suppose that we want more detail on our world map so instead of a single 10x10 world map, we create 100 10x10 world maps. First we determine which world map to use, WM(P) = (P_x MOD 10, P_y MOD 10), then we determine where on that world map we are, f(P) = (P_x - 10 * (P_x MOD 10), P_y - 10 * (P_y MOD 10)).

This can be taken a step further (see World of Warcraft) where the game world is divided into larger pieces, zones, and each zone has its own world map which can be broken into pieces like the previous example.

Ultimately this is a design decision with no technical limitations imposed as part of the questions. As best method depends on your requirements, I encourage you to explore how other games have addressed this on a conceptual level and build from that.

\$\endgroup\$
  • \$\begingroup\$ This doesn't answer the question related to using an existing bitmap, png, etc image. I don't want to re-define every piece of my existing drawing-map into a new virtual polygonal representation. Everybody can use coordinate to put a point into a graphic, but what do you do with the lines within your drawn map ? \$\endgroup\$ – Douglas Nov 24 '18 at 16:39
  • \$\begingroup\$ In this case, when I refer to the world map I am referring to existing image(s) in whichever format you are using (bmp, png, etc.). An example would be the mini-map in League of Legends (see the bottom right corner). An example from World of Warcraft is the mini-map in the upper right hand corner. \$\endgroup\$ – user3730788 Nov 24 '18 at 18:08
  • \$\begingroup\$ The world map in World of Warcraft may be akin to what you are considering. \$\endgroup\$ – user3730788 Nov 24 '18 at 18:17
  • \$\begingroup\$ I'm afraid this brings nothing helpful on "How to". What you mentioned is just a "What to"... \$\endgroup\$ – Douglas Nov 26 '18 at 20:41
0
\$\begingroup\$

You are not asking about "beyond" you are asking "on top". Because what you want is these regions to be mapped onto the coordinate system an then use collision detection for the borders of said regions. Then change a variable/attribute of the player object.

If your game does not have free movement but rather a "go to Wide forest", "go to city X" mechanic, a simple attribute on some object would do

\$\endgroup\$
  • \$\begingroup\$ I'm asking about beyond the coordinate system. It depend of the point of view. My point of view it placed at character level and want to see beyond the x/y things in what region she is located. You are talking about beyond the y/y system. You point of view is simply at the top instead to be at the bottom. \$\endgroup\$ – Douglas Nov 24 '18 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.