Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 884 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Great article about lag busting #132220
05/26/07 20:52
05/26/07 20:52
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
I found this article today on gamasutra.com. I found it very insightful.

Propagation of Visual Entity Properties Under Bandwidth Constraints

Re: Great article about lag busting [Re: Excessus] #132221
05/28/07 00:05
05/28/07 00:05
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
very nice, it gives inseides
to the problems of reducing transmitted updated
for the MMORPG servers relative to the bandwith.

Especially the relavence of the distance of the to-updated entity
to the player is interesting.
Closer entities will be encorporated more often in updates.

This also nicely shows, why 3dgs can not realize a native
MMORPG, without some external dlls.
3dGS simply can not be programmed, to do such optimizations
directly onto the updatedata, without silly and ineffective workarounds.

The included "automatic" propertyupdates of entities just can not
be manipulated and optimized in such a way as required by a massive-client
service. (for example the compression of positiondata)
The only way to archive this, is to torally drop 3dgs internal multiplayer functionality,
and then do all the attribute handeling and transmission to clients with an external dll.

(A bit beoynd the scope of the amateur users here anyways)

Re: Great article about lag busting [Re: Damocles] #132222
05/28/07 10:54
05/28/07 10:54
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
Yea the 3DGS networking system is not suited for large amounts of players. You can indeed work around it (and I have), but it is really inflexible and unintuitive, error prone, etc..

So that's why I'm working on a networking plugin. It uses RakNet as the base and builds some functionality on top of it. The main functionality is done now: connecing to any number of servers/peers and inter-server connections, sending of packets which trigger event functions (events can be set per-packet type by the user), compression, encryption and client management. I have used unit-testing so it should be relatively bug free. I'm working on the plugin-interface now and it should be done pretty soon (if I don't become too busy again..).

It's good to see that the article mentions alot of things that I've come up with myself. For example the LCT, only sending updates to nearby players, and the giving higher priority to players nearby (although I haven't implemented that).

The use of a grid to calculate the distance is also an interesting optimization. To calculate the grid-square of a player, you could use a simple formula like:
square_x = (player.x + half_world_size) / square_size_x;

You could then store a pointer to that player in a 2D-array at that x and y position. To get the list of players that you are close to, you could just use the pointers in that array of all cells that are around you. No square-roots or scan()s.

Re: Great article about lag busting [Re: Excessus] #132223
05/28/07 20:22
05/28/07 20:22
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
If you can pull off the mythical Raknet/3DGS merger, you'd be a god. How LONG have we been talking about that, eh?

And so far, the only DLLs we've used are the MySQL one and a few custome built ones that allows us to manipulate data easier. I can see however how adding custom funcionality would make the network happier but like it's been said, 3DGS is an "all in one" engine so it has to do everything just well enough... MP or MMP will never be 3DGS's strength but it's a great platform to develop you network skills, ideas, to prototype your game, to get some vision of it, etc.

Personally, if I jump ship in the next year or so to expand the architecture of our MMOG platform, then I'm not doing middleware anymore, I'm going straight to The Multiverse.

I mean personally, I find networking facinating and all that, but it's only a means to the end... the end being making games of course. As such, I (much like you two I suspect) have had to become networking experts to even attempt the simplest MP or MMP application. With Multiverse, it's ready, it's done, it's MMP, it's has great backing, etc.

I'll be using the Multiverse engine in a few months for various purposes and I have to say, if C-Lite doesn't shape up 3DGS MP, this is very likely where you will find me soon!

Re: Great article about lag busting [Re: fastlane69] #132224
05/29/07 09:44
05/29/07 09:44
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
We're going offtopic, but I don't mind.

Well the mythical RakNet/3DGS merger will be there, and it's not so mythical really . Like you, I used to be convinced that everything can be done using 3DGS native MP. And indeed 90% can be done if you try hard enough. It's only 3 months ago that I got the idea of integrating RakNet, and I hardly knew any C++ then. So I started learning C++ and started work on the plugin a month ago. And I've been very busy with my exams (as a matter of fact I have my final exam chemistry in 2 hours from now). So that's to say that it really isn't difficult and I don't understand why nobody has done it before.. It's just a matter of writing dll functions that call raknet functions.

Personally, I like network programming and in general: do things on my own; I'm an engineer. So I'll stick with 3DGS. But multiverse might very well be a good choice, considering your needs. It looks pretty solid. If you do decide to leave 3dgs, ricardo, be sure to keep us posted on your progress!

Re: Great article about lag busting [Re: Excessus] #132225
05/29/07 18:42
05/29/07 18:42
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Let me get on topic for a second: great introductory article to path finding and lag busting.
Now let me blend some off with on topic: is there anything there that cannot be done with 3DGS?

In other words, what is your 10% Ex?
What are the major thing that 3DGS can't do (not just hard to do with, can't do)?

For example, everything in the article can be done with 3DGS now.
Part of my 10% is optimization of bandwidth which needs more data types than string, var, and skill... but that will come with C-Lite.
Another one of my 10% was sending data only to specific clients and I had to program my sphere of influence so I only send data to whom I want but it works prefectly now... ... and A& will include this functionality natively.

So what is missing? I really need to know the answer to this question in as much detail as possible in preparation for the next 3 years of working on this project and whether they will still be with 3DGS or not.

Re: Great article about lag busting [Re: fastlane69] #132226
05/29/07 21:11
05/29/07 21:11
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline OP
Expert
Excessus  Offline OP
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
One thing that is very important to MMP is inter-server connections. I know you try to simulate this by using clients as backend servers, but this is not true peer-to-peer. For example, if you want a login server that handles logins for all shards (a single persistant world). This login server would have to be connected to the shard server and both servers must be connected to clients. See the image of my planned network topology:

There are n shard servers connected to the database server and m service-servers (shown as 'zone server' and 'ai server', but can be anything) per shard server.

Another network topology for MMP is using serveral front-end servers (zone servers) per shard. This is the idea of the marketed '3DGS MMO' (using session_connect), but if those servers cannot comunicate with eachother, you will get in trouble. If a player is transfered from zoneA to zoneB, the data about that player cannot be passed through the client (insecure) and cannot be passed through the database-server if it is also 3DGS based (would require p2p), so you either have to run them on the same server and use files (scalable!!) or use a 3rd party solution for connecting to the database from multiple servers simultaneously. If you go 3rd party anyway, why not go the intuitive route and communicate directly between the servers.. This limitation will also make it impossible to have seamless zones, since the zoneA server can never 'see' entities located at the boundaries of zoneB.

Another problem with 3DGS MP that you cannot get around is the fact that the whole design is flawed from a security point of view. The client can arbitrarily update the servers variables! The only thing it requires to change global or playercharacter properties is sending on the right index. Instead of asking the server 'hey I've just read this input [implicit:]so you'll have to change playercharacter property X to value Y' it says 'property X of my playercharacter now has value Y'. You'll say: but we can check the legitimacy of incomming data with the network events. Wrong, the client decides on what index to send and it's impossible to check all variables periodically for illegal changes.

There is no easy way to correlate a message with its sender. Let alone a secure way. If I remember correctly, there is no way to see where a string or var came from in the network events. So the player handle or ID must be encoded in the array or string. And who encodes it? Right, the client is once again telling the server what to do.

Well you're right, that might not be 10% of all networking problems, but here are some more things that, although you can work around them, are still problematic:

-No efficient way to send multiple types of data in one message. The most flexible workaround here is to use strings and encode nummerical data aswell as lexical data in it, and use a seperator character. "237;mypassword;myuserID" for player 237 wanting to login. You don't want to see the str_*** junk that is needed to seperate a complex message into seperate variables.
-Native entity updates. Yes this is a flaw aswell. It is intended to make things easyer but I'm convinced there is no "one size fits all" algorithm for movement prediction (and IMHO movement prediction is the wrong approach anyway; see article). Thus every MP application, no matter how trivial, will turn it off (if you want to provide a lag-free game experience).
-Sending data to specific clients. You and I have got this working, but it's not that simple and once again requires tons of hacks.
-No propper way of timestamping packets.
-Network statistics (F11) are unreliable in my experience.
-No way to connect to non-3dgs applications. I agree this is not a problem for most, but it is for me.


Here is how I hope to solve these issues with my plugin. Let me know if you spot any design flaws, artificial limitations, etc.

It is possible to set the maximum number of incomming and outgoing connections, the local listening port and the networking thread priority. You can start and stop the networking engine at any moment. You can connect to any number of IP:port combinations. You can send prioritized and reliable or unreliable packets. You can also specify an ordering channel, so that packets in the same channel can be ordered chronologically.

The really great thing are the per-message type event functions. Each packet has a first byte which is used to describe the kind of packet. This char is what I call the MessageID. You can assign an event function to each MessageID, including the internal packets. So for example, if you set an event function on the MessageID:ID_NEW_INCOMING_CONNECTION (#defined as 16), your function will be called when a new client has joined. Each event function will be passed a localy unique SystemID (from who the packet originated) and the packet data. This SystemID is also used in all other functions, including send().

Creating packets can be done by simply initializing a struct and sending it away, or more sophisticatedly, by using the serialization and deserialization functions. These alow you to 'line up' arbitrary data in your packet. For example, consider this packet:
[char messageID][var someVar][string optionalString]
The serialization functions allow you to write it like this:
->write the messageID. Say we choose 123 for this kind of message.
->write the var to packet X
->write a bool (a single bit) to the packet, indicating if the next parameter is included
->write the string if you had set the bool to true or don't write the string if it is false.

This allows dynamic deserialization, allowing you to save loads of bandwith in some situations, as well as sending an arbitrarily sized list of parameters (like a list of players to send a chat message to).

The serialization functions also allow you to write compressed strings, vectors and arbitrary data.

Haven't looked at it too closely, but I think it will be easy to add voice communications and an autopatcher, which are both included in RakNet.


Pfew, that was a long post. I'm tired and don't feel like reading it all again, so excuse me if it is full of nonsense

Re: Great article about lag busting [Re: Excessus] #132227
05/30/07 01:07
05/30/07 01:07
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Topology and security. Two great points.

I've been bitching about not having intra-server comm since day one. I could never convince conitect that this was a worthwhile feature and hence our work arounds.

And I remember the Glider incident all to well and was disappointed with teh concern for security Conitec gave. It's like they KNOW that no MP application will ever be made commercial and thus don't worry about it.

These are great points Ex and I will give them lot's of thought.
I personally think the security issue is the biggest problem. The biggest problem with my 3DGS design now is the single point of failure on the true server. It goes down and that is that... there is nothing to do but reset and reboot. Having said that, any topological solution such as shards and instances and load balancing etc can be done right now.

Your zoneing issue is not a problem with us. I'll whip up a drawing to further fuel discussion

(oh and BTW, off topic? off topic? We SET the topic mo-fos! )

Re: Great article about lag busting [Re: Excessus] #132228
05/30/07 01:28
05/30/07 01:28
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
This is us:



We use the same database to handle login and gameplay. Note that we can at anytime break up the business and the game database since they can talk to each other if we want.
Once on the game side, the presentation starts receiving updates from game logic one. Let's say this logic is physical in nature like where you are in the world. And let's suppose that game logic two represents another zone. Now when the player is about to cross over, there is overlap between zones. So for a while, the presentation is getting updates from BOTH game servers. Once the player crosses this boundry overlap zone, they are fully in control of the other server. Everything in the backend can be handled synchronized by the mysql backend.

Also, if you think of the 3DGS game server as a ROUTER and not a server at all, the idea of intra-server communication becomes academic since the server-clients are in fact communicating directly but using the 3DGS server-router to work between. It will add no more than a few milliseconds to do two hops (router->server) instead of one hop (->server) but I still don't have enough of a load to see if this makes a huge difference or not.

Quote:

-No efficient way to send multiple types of data in one message. [...]
-Native entity updates. [...]
-Sending data to specific clients. You and I have got this working, but it's not that simple and once again requires tons of hacks.
-No propper way of timestamping packets.
-Network statistics (F11) are unreliable in my experience.
-No way to connect to non-3dgs applications. I agree this is not a problem for most, but it is for me.




Three and four we can do. Call it a workaround or merely what has to be done, we can send data to specific people and timestamp strings as well. We can't effectivly timestamp vars so we don't use them that way and skills sent as vectors can be timestamped. Five is completely right. I don't trust it and the server will only show the thoughput for the last client connected which makes is useless as a MP diagnostic tool. And number six is just a skills issue. If you can DLL, you can do this. If not, find someone who does.

But number one, the multiple types of data in one message, this is one of the biggest things to look forward with c-lite: the ability to create structs. So I can put as many different types (bools, ints, longs) within a struct and send that over the network.

The ability to create custom events based on the type of packet coming in is a very powerful idea, one that would be nice (and easy?) to do for 3DGS. Once C-Lite starts doing MP I'll see about suggesting this.

And I think your architecture is sound and reminicent of ours. After all, like in ours if the front server goes down, the one the clients communicate with, they are out of the game and have to do the same thing as in 3DGS: reset and reboot the servers and re-login.

I don't see much difference in your architecture and ours. By the time A7 comes along, that 10% will be cut down to 5% since a lot of the things you are doing will be done with A7/C-Lite. Security is still and issue and I'd be curious to know how secure raknet is.

I WISH WE could design the 3DGS Net engine, put those tweaks that you need, those that I need, and make it a better engine. I know we are right. I know our ideas our sound. But with only a handful of us to appreciate why and where these changes are needed, Conitec will never fully step up to the plate and make these changes native. Which means there might alway be "workarounds" and "tricks" until our 3DGS MP community reaches critical mass. Will I be here for that? Will your plugin be a motivating factor towards that? I hope so on both accounts!



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