Applying Coordinates to player on Register

C++, C#, Java, PHP, ect...
Post Reply
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Applying Coordinates to player on Register

Post by vitinho444 »

Hey guys, i'm revamping my village wars browser game, everything is going smoothly but this.

I need some help making the coordinates system, in the previous version of village wars, the coordinate system was like this:
There was a db table with lots of X,Y and with a row saying if it was available.
When a user registered, i would try to get a random from that list, and see if it was available, this random thing was made to be in a range, like 0 to total_players + 100 so nobody gets thrown to the other corner of the map :P

Ok, so in this new version i want to make a better system to apply coordinates to people, what you guys have in mind?
Also have in consideration, that it would be better if the coordinates were padding 32,32px from each other, so in the map there are 32x32 images for each village.

Any help will be credited in the final version. It would be cool to release this as a community project.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Applying Coordinates to player on Register

Post by Jackolantern »

First and foremost, I would definitely allow people to occupy the same grid. Otherwise, this can be used to grief other players by getting a group to occupy the grid spaces the target player wants to stand in. But even if that is not an issue for your design, it still makes good sense. Player-to-player attacks, trade, etc. all make more sense when the players can easily be in close proximity.

As far as the coordinate system goes, it really depends largely on your design. Is the map dynamic, or load-per-move? Does the player physically walk around the map, or is it click-to-instant-move? Are the maps generated randomly, or all pre-made?
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Applying Coordinates to player on Register

Post by vitinho444 »

Wait, same grid? like same position? the grid IF, was that if a player is on 100x100 the next will be either in 132x100 or 68x100..

The map will be something very simple, and the players wont move, i was trying to say that the map is for villages, sorry in that part. It will be like static everything.. but then there would be a button to change the X,Y and the "camera" would move.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Applying Coordinates to player on Register

Post by Jackolantern »

Oh ok, then yeah, you would not want them on the same position if they are for towns lol
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Applying Coordinates to player on Register

Post by vitinho444 »

Can you think in a better system than the one i said? With pre-determined coordinates on a table and see which ones are taken?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Applying Coordinates to player on Register

Post by Jackolantern »

I can't really think off-hand of a better way to do it except maybe storing a copy of all the used coordinates in a separate table so you aren't querying the entire map grid table every time something is placed. Outside of that, it is hard to really offer optimization advice without having an intimate knowledge of the gameplay :)
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Applying Coordinates to player on Register

Post by vitinho444 »

Well, it wouldn't be such a problem since that system that i would apply only would query in a range from 0 to the Number of players + x, so players' villages dont go very far from the existing players you know.

I think the system is not that bad after all..

What about a successful map? In the previous version it had some bugs, and was not good... Where can i find how to make a really nice one for the villages, and so players can see what villages they can attack and not blablabla.. xD I really think this "engine" will be successful since there aren't many browser based indie games.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
Post Reply

Return to “Coding”