Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, SBGuy), 987 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
client update ranges #302575
12/20/09 16:03
12/20/09 16:03
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline OP
User
SchokoKeks  Offline OP
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
Whats the best concept to implement client update ranges?

The problem is: some values like the "health" or movement state need to be send as soon as an npc enters the players update range. After that, the values only need to be send if they have changed. I can only think of two ways, both have a large impact on memory usage for games with many players/npcs.

1. Every npc function stores an array that holds a boolean for every player which determains if this entity has been in his update range in the last frame (or last update).

Problem is: If the server could possibly support 500 players max at the same time, every npc (lets say there are 1000 of them) needs to have a really big array. Also, a lot of memory goes to waste because there will hardly always be 500 players online at the same time.

2. Every player function stores an array of all npcs that contains if they have been in the players range in the last frame.

Problem: You'd have to set a maximum of npcs per level, and you'd have some ugly code for setting and reading the array from the npcs functions.

Are there other ways which I haven't thought off? how is the anet template doing it?

Re: client update ranges [Re: SchokoKeks] #316431
03/24/10 03:58
03/24/10 03:58
Joined: Jul 2004
Posts: 74
Inside Maya
S
Sichlid Offline
Junior Member
Sichlid  Offline
Junior Member
S

Joined: Jul 2004
Posts: 74
Inside Maya
my suggestion would be to store the value of old health in a var like old_health
and check on the client machine every frame if health has changed. if yes then only send the new health value to all machines.


Best Regards, Sichlid
Re: client update ranges [Re: Sichlid] #316435
03/24/10 04:17
03/24/10 04:17
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
agreeing with sichlid, you dont need to send health unless its changed, even if within 'range'

Re: client update ranges [Re: darkinferno] #316972
03/28/10 11:11
03/28/10 11:11
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
@ Sichlid: This doenst solve the problem at all ^^

@ Schokokeks: Why not using zones? That way you have something like a range system without a lot of huge arrays.
If a player enters a zone all the neccessary information will be sent and while he is in it he'll receive updates.
So all you gotta know is who is in which zone.


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: client update ranges [Re: Puppeteer] #316984
03/28/10 13:27
03/28/10 13:27
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline OP
User
SchokoKeks  Offline OP
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
thank you all for your answers.

@ Sichlid + darkinferno: that doesn't solve the problem. using "old"-variables is something thats needed independent of client update ranges.

@Puppeteer: Thats a good idea, and it keeps the code simple. However, you'd have to keep the zones quite small, and you'd have to take care of smooth transitions between the zones, or entities will just pop up in front of the player when he gets near the zone border.

I'll be using zones with "hard transitions", meaning that the player will see a loading screen when switching between those zones (through doors or small gateways). They are supposed to be quite big, so I still need an update ranges system.

I've solved the problem this way:
Every entity that wants to send updates has an array that has as many slots as there can be players (about 100).
Every frame, the entity checks whether it is within the range of the players.
When the array entry for the player x is 0 (means "not in range before") it sends all its information (health, position, level etc) to x. The entry is then set to 1 (means "has been in range last frame"). When the array entry is 1 in the first place, only changed values are send.

This code has to run on the server only. I've yet to see if I'll get performance problem.

Re: client update ranges [Re: SchokoKeks] #316997
03/28/10 14:58
03/28/10 14:58
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Ok this is a nice concept. But if you use seperate zones I would advice you to use a seperate server for each zone. (look at HowTo 2 in the ANet manual)

Why? Because if a lot of people are playing your game let's say about 200 at the same time, it will be impossible that one server handles all these players. So you split your whole game into 10 zones. Now you have 20 players on 10 servers and that should be possible.

Of course this is unimportant if you are creating a small game. But then I would advice you to create it with vec_dist():
Every client sends its position updates to the server. The server then forwards it to the clients depending on the distance of the clients to the entity that sends the new position. Entities that are out of range should turn their invisible flag on. The Dead Reckoning Template of ANet does it this way.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1