Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Coordinate Systems  (Read 1913 times)
0 Members and 1 Guest are viewing this topic.
Offline g666

Junior Devvie

« Posted 2005-11-28 19:47:08 »

What coordinate system do u use in ur game?

so do you use a mixture of coordinate systems, or jut one, and which one and why?

desperately seeking sanity
Offline Ask_Hjorth_Larsen

Junior Devvie

Java games rock!

« Reply #1 - Posted 2005-11-28 23:00:49 »

Actually, we have made classes specifically for supporting different coordinate systems at the same time, in our current project, which is a real-time strategy game.

We have one base class, CoordinateSystem, which can manage some transformations. Then there is a subclass, TileMap<T>, which makes it possible to  store different kinds of objects at each location.

At the lowest level we use a very fine resolution - a game world of several million units on each side (which are integers, not floating point, since this among other things makes the interoperability with other maps somewhat simpler). We can "nest" other coordinate systems, such as the screen pixel coordinate system, wich is more coarse. We use a TileMap of something like 64x64 tiles to store terrain tiles, and another TileMap to manage collision detection efficiently. Last, we have a somewhat low-res coordinate system to manage a small overview map.
Offline noblemaster

« JGO Spiffy Duke »

Medals: 35
Projects: 11

Age of Conquest makes your day!

« Reply #2 - Posted 2005-12-01 19:46:54 »

Yes, you usually need more than just one type of coordinates:
-overview map
-regular map
-OpenGL coordinates

But you should only define the coordinates once though. I would suggest
you have some sort of master coordinates, from which you derive the other
coordinates. Use "meter" or something, so you know what the meaning of
your master coordinates are. E.g.

public class Coordinates {
  // master coordinates in METERS!
  private float x;    
  private float y;
  private float z;   // height (if you don't need it, just leave it at 0)

  +setter/getters for x, y and z
  +getter for overview map:
     public Point getOverviewCoordinates() {
         Point point = new Point();
         point.setX(x * "some scale factor");
         point.setY(y * "some scale factor");
         return point
  +getters for other maps

Pages: [1]
  ignore  |  Print  

EgonOlsen (79 views)
2018-06-10 19:43:48

EgonOlsen (59 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (261 views)
2018-05-13 18:23:11

nelsongames (160 views)
2018-04-24 18:15:36

nelsongames (158 views)
2018-04-24 18:14:32

ivj94 (901 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (813 views)
2018-03-24 14:43:53

Solater (177 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!