• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Trying to make Ogame Coordinates System need help

T

tiestolord

Guest
I trying to make Ogame Coordinates similar script, need help..

"coordinates_script( galaxynumber, solarnumber, planetnumber);"
or is better "coordinates_script(X,YYY,ZZ);"

lets says that max number of X is 9, YYY is 999 and Z is 09.

i tryed with script arguments, but im noob for that... i need guidance and help.
 
A

Aura

Guest
Are you talking about this sort of positioning system? Either way, it would be really helpful if you share some information about your game, what you want to do and what you have tried. With such a vague explanation, it would be really difficult for us to help.
 
T

tiestolord

Guest
Are you talking about this sort of positioning system? Either way, it would be really helpful if you share some information about your game, what you want to do and what you have tried. With such a vague explanation, it would be really difficult for us to help.
yes i do :) im making similar game like Ogame type. strategy game with coordinates position of players planet or planets.
 
A

Aura

Guest
Not everybody (including myself) has played Ogame, so you should describe your query in such a way that people who are not familiar with the game would be able to help.
 
C

CaffeineJunky

Guest
Typically when we speak of coordinates, we need to what our coordinates are in reference to. In your normal X coordinate system and your Y coordinate system, they are in reference to a vector that starts at the origin, and have unit length, and point in the direction of the positive numbers of that coordinate. Those vectors are typically called the i-vector and the j-vector. Any set of such vectors that describe the coordinate system are called a basis.

Can you describe the basis of your coordinate system?
 
T

tiestolord

Guest
ogame coordinates system is working by value system, where is stored any given planet. lets say my main planet is on coordinates [2:131:8], first number is number of placed galaxy, second value numbers is placed in which solar system and last value number is postion of planet in that solar system.
Its all stored by numbers, it does not have anything to do with normal GM x and y coordinates.
And lets say another player wanna find my planet to send fleet, he can type my coordinates and find my planet. I hope i give you some info now :)
 
C

CaffeineJunky

Guest
Ok, then what you're describing isn't a 'coordinate system' by any means, but rather than just a list of numbers. So all you really need to do for this is to have a set of nested ds_maps to catalog your planets.

Code:
var galaxyMap1 = ds_map_create();
var solarSystem1_1 = ds_map_create();
galaxyMap[?1]=  solarSystem1_1

var planet1_1_1 = ds_map_create();
solarSystem1_1[?1] = planet1_1_1;
And so on.

It would be easier to write instead write a JSON document with all of the data here and then load it using the file functions and the json_decode functions, which will take the JSON document and convert it into ds_maps and ds_lists.

You can also use ds_lists instead of ds_maps if you really only need the number to what you are using to reference the particular coordinate.

Overall, I would recommend learning all about the data structures available to you, including arrays, and play around with solving a smaller problem first (such as just representing the galaxies using one of these structures).
 
T

tiestolord

Guest
thx i will try, but im not so good with JSON document... :/
 
C

CaffeineJunky

Guest
Well you don't become good at something until you are bad enough at it that you can learn from it. Part of programming is learning how to use different technologies and tools, without which would make your life incredibly difficult otherwise.
 
T

tiestolord

Guest
god i lost days to manage to work this and without success, i tried with ds map and ds list. but I suck... anyone wanna help with this?
 
Top