Author Topic: Map system  (Read 1028 times)

Offline Jbye

  • Level 5
  • *
  • Posts: 19
  • Reputation: +0/-0
    • View Profile
Map system
« on: July 11, 2010, 07:46:43 AM »
I've read quite a few threads on here with regards to maps and how to make them work.  None of them seem (to me anyway :)) to answer the question I have.

I have a 10X10 grid for galaxy view made simply by html picture links.  When you click on certain areas it takes you to another 10X10 grid (made the same way) for system and then again for sector area.  Think of it like looking at the Milky way then our solar system and then our planet.

I'm thinking about how to track distance to travel/travelled.  If I go from planet x to planet y I travel a distance of z.  My first thoughts are to somehow place a bit of code on each planet page saying this is x,y,z distance from a,b,c planet etc and if you are coming from one planet (or anywhere esle) it says you need to travel so far.

Any Comments and ideas would be appreciated.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,134
  • Reputation: +26/-1
    • View Profile
Re: Map system
« Reply #1 on: July 11, 2010, 08:24:26 AM »
Distances are only for planets of the same sector. If you want to go to another system planet there is just a fixed sector distance (regardless of where the planet would be located inside a sector). The same goes for galaxy distance.
This would be for neighbour sectors, if you want to go to a planet several sectors away you have 2 choices:
- multiply the fixed sector distance by how far the sector is.
- always use one fixed distance, as if all sectors were neighbours.

You basicly need to choose between realistic flat galaxy cordinate system (but I don't think it would work very well with the layers of galaxy/sector you described, flat planetary map would do better) or by layers system (you warp to higher levels of coordiante system which does not care about the distance but has fixed time costs).

Or shorter, you could make it the way they did it in Stars! or the one in Reunion :)
Alternatively, you could go for sectors linked by warp points.


Take a note that the multiple layers of galaxy view (leading to smaller units of distance) basicly rule out distance as it is, only movement cost of the higher levels counts then (distance between planets is irrelevant, becuase the cost to move on galaxy/sector level is so high that movement between planets has to be almost instant to assure playability). By using this system you remove distances from the game in exchange for clear interface. I don't recall even one game with such view system that would have relevant distances.

Maybe try to think about it from player's perspective. How long should it take for players to move from a planet to planet, from sector to sector and from galaxy to galaxy?

Offline Harkins

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: Map system
« Reply #2 on: July 11, 2010, 09:36:51 AM »
Quote
If I go from planet x to planet y I travel a distance of z.  My first thoughts are to somehow place a bit of code on each planet page saying this is x,y,z distance from a,b,c planet etc and if you are coming from one planet (or anywhere esle) it says you need to travel so far.

Then your list of distances is going to be (number of planets * number of planets - 1) long, which will quickly be huge. And you'll have to calculate it anyways.

I'd probably do something like:

distance = sqrt( (planet x + (system x * 10) + (galaxy x * 100)) ^ 2 + (planet y + (system y * 10) + (galaxy y * 100)) ^ 2 )

So it's the standard cartesian distance formula with the understanding that the system and galaxy scales are each 10x the previous scale. This is sort of nice in that systems are contiguous - if I'm on a planet at x = 10 in a system, the distance to a planet at x = 0 in the next system to the right is 1. But you could easily make travel between systems much more expensive (as it annoyingly is in our universe) by changing the scale from 10 to 20 or something. Tinker around with those constants until you find something that works for your game. But I wouldn't lower them unless your game fiction has a really compelling reason that it should be cheaper by mile to travel between galaxies than star systems.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline Jbye

  • Level 5
  • *
  • Posts: 19
  • Reputation: +0/-0
    • View Profile
Re: Map system
« Reply #3 on: July 11, 2010, 10:27:40 AM »
The player doesn't do any moving per say.  They buy or sell stuff to different locations.  If they have access to a ship then they can send there own stuff, therefore seeing though the ship runs on fuel it needs to know how far it has travelled to work out how much fuel is needed.  And if they don't have ship then planets can send them with a charge for transport.

EDIT:

What if I was to set each tile in the galaxy at say 30miles from each other, each tile in the system at 20 miles from each other and each tile in the system at 10 miles from each other.  So lets say I go from one grid to the next that's 30miles,then in the sector grid i go one grid in thats 20 miles (50 total) then I go one grid in on the planet view which is 10 then the grand total iv'e travelled to reach my destination is 60miles.
« Last Edit: July 11, 2010, 10:54:37 AM by Jbye »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,134
  • Reputation: +26/-1
    • View Profile
Re: Map system
« Reply #4 on: July 11, 2010, 12:51:24 PM »
What if I was to set each tile in the galaxy at say 30miles from each other, each tile in the system at 20 miles from each other and each tile in the system at 10 miles from each other.  So lets say I go from one grid to the next that's 30miles,then in the sector grid i go one grid in thats 20 miles (50 total) then I go one grid in on the planet view which is 10 then the grand total iv'e travelled to reach my destination is 60miles.
Sounds completely unrealistic but perfectly playable, a good choice :D

The problem is that going to the end of the galaxy (cost 30) is less expensive than traversing a sector form one end to another (cost 10x10 miles). I think the max cost of travelling across same sector should be equal to the cost of changing galaxy.

BTW, are you sure you need such big space? There is one million sectors if you make 3 layers of 10x10 grids...

Offline Jbye

  • Level 5
  • *
  • Posts: 19
  • Reputation: +0/-0
    • View Profile
Re: Map system
« Reply #5 on: July 11, 2010, 02:02:51 PM »
The problem is that going to the end of the galaxy (cost 30) is less expensive than traversing a sector form one end to another (cost 10x10 miles). I think the max cost of travelling across same sector should be equal to the cost of changing galaxy.

BTW, are you sure you need such big space? There is one million sectors if you make 3 layers of 10x10 grids...
[/quote]

Good point on the travel from one side of the galaxy to the next.  And no not all of the grids will be locations.  Any ideas on how I could do this then.
That's the only one I thought and I thought it pretty good  ??? ??? ???

Offline dsheroh

  • Level 21
  • *
  • Posts: 235
  • Reputation: +6/-0
  • Perl Vicar
    • View Profile
    • Psi Rangers
Re: Map system
« Reply #6 on: July 12, 2010, 05:52:22 AM »
Good point on the travel from one side of the galaxy to the next.  And no not all of the grids will be locations.  Any ideas on how I could do this then.
That's the only one I thought and I thought it pretty good  ??? ??? ???

Like Harkins said:  Use Pythagoras.  Establish a universal coordinate system (with tunable multipliers for system-level, sector-level, and galaxy-level grid sizes) and then the distance between any two grid cells will be sqrt(dx^2 + dy^2), where dx and dy are the difference in x coordinates and the difference in y coordinates, respectively.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal