Tile coordinate system?

Well as some people know, I'm working on a small scale MMORPG as a test project to turn it into a larger scale MMORPG, I was thinking earlier about how RuneScape using a tile system for keeping track of where players are when they log off and many other purposes. How could I do the same? I need a way to create an (x,y,z) coordinate system over my terrain so that when the player logs off and logs back on, they'll be in the same location. Any ideas? Thanks

It all depends on the scaling you want to use, but it essentially comes back to an identifier for the tile in the X axis, and identifier for the tile in the Z, and one for the Y (if there's so much height that you need to tile the Y axis.  From there, each tile (like X2,Y6) will have its own local coordinate system…



In order to persist the locations, just shoot the players coordinate (xTile, yTile, xPos, yPos, zPos: X2,Y6,500,12, 639) up to a server and save it to a database.

But how do I lay out a coordinate grid?

Maybe with a big array?

You could start with just making a 2 Dimensional array:



Tile[][] tiles = new Tile[512][512];



or sth like this.

tim8dev said:

Maybe with a big array?
You could start with just making a 2 Dimensional array:

Tile[][] tiles = new Tile[512][512];

or sth like this.

No, you dont need a real array for that. The grid does not have to exist, its just an abstract thing you need to know about. If nothing is on one "tile" there is no need to save it. Like a flight tower does not have a huge list of all air quadrants and then add/remove planes from it but simply track the coordinates of each plane..
normen said:

tim8dev said:

Maybe with a big array?
You could start with just making a 2 Dimensional array:

Tile[][] tiles = new Tile[512][512];

or sth like this.

No, you dont need a real array for that. The grid does not have to exist, its just an abstract thing you need to know about. If nothing is on one "tile" there is no need to save it. Like a flight tower does not have a huge list of all air quadrants and then add/remove planes from it but simply track the coordinates of each plane..


Not quite sure I understand. So if I don't have to use a array then is there any jme api for it?

What I'm trying to do with my MMORPG is say the person is on the second floor of a building in some city and they want to logout, I need a way to get the current coordinates so that I can send them to the MySql. That way when they log back in, they'll appear in the same location.

For that, all you should have to do is log the (x,y,z) + rotation. What they are suggesting (I believe) is a way to keep track of tiles, and presumably, load tiles the player encounters.

Fiarr said:

For that, all you should have to do is log the (x,y,z) + rotation. What they are suggesting (I believe) is a way to keep track of tiles, and presumably, load tiles the player encounters.


But how do I log the (x,y,z) + rotation?

I'd save them all in a database.

durenir said:

But how do I log the (x,y,z) + rotation?

Well you would have an object for each entity in your game. It stores the location and rotation of the entity. Now when that entity is selected your terrain engine would load the appropriate meshes for that location and place them correctly when the entity is selected. This is what I mean by you dont need an array containing all world data all the time. But still you cannot save 100.000 entitys at once in the RAM of a normal computer (given that they contain some substantial amount of info), let alone sync them all with each other all the time just like that via a dsl network connection. If that would work with the computers we currently have what do you think the guys working on AAA titles get all the money for? The seemingly endless terrain of WOW in a mmo was a revelation when it came out!

Computer games are a very well-balanced mix of raw computing power and really well made faking of visual appearance. You can fake moving leafs with a glsl shader instead of really moving the (trimesh) leafs etc etc etc.. Jme just gives you the tools to do that, to make a game out of it (and especially a MMO) will require you to have some really smart ideas on how to go about this.

Hope this helps,
Normen

Sorry I worded my last post wrong. I ment to say how do I get the current (x,y,z) + rotation? Is there any api such as entity.getLocation()? Lol.

durenir said:

Sorry I worded my last post wrong. I ment to say how do I get the current (x,y,z) + rotation? Is there any api such as entity.getLocation()? Lol.

getLocalTransLation() and getLocalRotation(), yes :)
normen said:

durenir said:

Sorry I worded my last post wrong. I ment to say how do I get the current (x,y,z) + rotation? Is there any api such as entity.getLocation()? Lol.

getLocalTransLation() and getLocalRotation(), yes :)


Awesome! Thank you, that's exactly what I was looking for. :)