MMORPG Advice

Just starting out? Need help? Post your questions and find answers here.
CadeX
Enthusiast
Enthusiast
Posts: 124
Joined: Mon Oct 02, 2006 2:56 pm
Location: Australia
Contact:

MMORPG Advice

Post by CadeX »

I've bumped into a sudden problem which could be a great issue later on if i don't get it fixed now. As a few people should know i've been working on a MMORPG for the last month.

I've made it up to the stage where people are able to see each other... However i've noticed a huge security flaw where anyone with smarts could easyily determine where anyone is on the map. I've came to a conclusion that if i was to send a packet to a player with the locations of others within a radius that this would fix it. However, The way i was planning on doing it may not be so great (speed wise).

The player information is simply stored in an array of the players position. What i was planning on doing it was for EACH player every run was to have it search through the array, grab the X and determine if it was in that player radius... However that would not be a very good idea if i was to have 100 people online. (100x100 = 10,000 checks per loop).

I was wondering if anyone could suggest a much quicker way to do what i am looking for.

Thanks for reading.
Pro-Gamer, Programmer, Pro-Grammer
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Not sure if this is anywhere close but here goes,

Array=1000 * 1000 for example
players are at 100,100 200,300 etc
just send a packet like below to each player

Code: Select all

for y=playery(..)-5 to playery(..)+5
for x=playerx(..)-5 to playerx(..)+5
addtopacket(array(x,y))
next
next
sendpacket
I know it 's a block instead of a radius but if won't be noticed.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

are you planning to work with a server program?

this needn't be a dedicated server PC, but an extra server prog on one of the players PCs.

the server could check the distances of all players within one task/thread,
and notify another thread about changes, i.e. player enter/leave range.

this notification will affect a player-in-range-list of the concerned players.
each player-object would carry a p-i-r-list.

only the coordinates of the units on the PIRL (nice word) will be sent to the client.

this will have some advantages:

- you can check the distances in one loop for all on the server.
this check needn't be done each and every frame, twice or fourth in a second will be sufficent.

- the PIRL only needs to be changed when affected,
so it's also not a task to run every frame but only on demand.

- the packages to be sent will be set up according to the PIRL,
you will have a very consistent loop to create and send packages.

...anyways, just an idea...
oh... and have a nice day.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Most MMORPG's use the zone instance technique....

The world is divided into Zone's and each zone has a player limit to avoid lag...

Every time a zone reaches it's limit a new instance of that zone is spawned, and players are pulled into it, until it get's filled and a new one is created if there aren't free slot's in previous ones.

It's a fairly complex system, but avoids lag, and the problem you're now facing, because in each zone there can only be X players at a time, so you don't need to check every single player in the game to see if he is in your view radius.

Teams are usually pulled together to the same zone, to avoid player being in the same place but in a diferent instance.
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

For the massive multiplayer overhead shooter i've been working on, I store the structure pointer of each player in a linked list, I then cycle through the list and check if the player is on the same screen + offset before sending things such as player movements. On the client side, I destroy the dummy object if it is off the screen. Since the distance checking is just simple substration, this should be able to easily handle quite a few players without any slowdown from the iteration.
I love Purebasic.
Post Reply