Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 730 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 6 1 2 3 4 5 6
RakGS 0.1 Beta - RakNet for A7 / Lite-C! #135705
06/11/07 19:59
06/11/07 19:59
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
RakGS is a networking plugin for 3D Gamestudio A7 / Lite-C. RakGS uses the RakNet library version 3.0 and adds a network event system, remote systems management and a C-style interface specifically tailored for 3D Gamestudio A7 / Lite-C.

RakGS was built with flexibility, extensibility, efficiency and security in mind. For this reason, the RakGS functions do not resemble the native 3DGS multiplayer functions as closely as other networking plugins. RakGS can be used to create anything from a small casual multiplayer game to a full-blown massively multiplayer game.

Major features:
- Based on the high-performance, proven and stable network library RakNet.
- Supports every thinkable network topology: traditional client-server, inter-client connections, inter-server connections and true peer-to-peer.
- Easy compression and decompression.
- Event callback system. Supply your own event functions that will be called when a certain type of packet is received.
- Send any type of data, including your own structs. Combine any number of data types in a single packet with the fast & easy serialization / deserialization functions.
- Send packets reliable or unreliable, ordered per-channel.
- Unlimited number of connections.

Planned features:
- Voice chat
- Autopatcher
- Remote procedure calls
- Secure connections and encryption with a single function call.
- Network simulator
- Statistics

>> Download << (make sure you check the whole thread for newer versions)

RakGS comes with a manual describing every function in detail and a simple demo project. To run the demo, open both server.c and client.c in your A7 / Lite-C SED and run them (server first). Enter a local port for the client (don't use a port that is being used by another program, the server uses 50000). Then you can send text messages to the server. This is just a small demo showing how to use the plugin. You can look at the source of the demo project to get an idea of how to use RakGS, and look up specific functions in the manual.

The manual contains further information on every function in the plugin and how to include RakGS in your project.

Even though this version is called 0.1, it already contains all basic features needed to write a simple multiplayer game. In the current version, the number of connections is limited to 4.

Please report any bugs you find in this thread.

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: Excessus] #135706
06/11/07 20:15
06/11/07 20:15
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Wow!

It finally happened!

Great job, Ex!

Tell me:

1) How hard do you suppose it would be to mitigate existing 3DGS MP code to Raknet?
2) As we both know, one of the more annoying things we've had to do is implement our own routines so that only relevant entities (ie within a certain radius) send information to a client (my Sphere Of Influence if you remember). Does RakNet have an inbuit solution to this or would we still have to program this in?

Honestly Ex, if this pans out, I would be the first to ask Conitec to make this their native network engine... seems to make more sense to use Rak than to use the Sunset DirectPlay as it does now.

Oh, and if I may, I would develop in this order... merely my opinion of course:

- Remote procedure calls
- Secure connections and encryption with a single function call.
- Statistics
- Autopatcher
- Voice chat
- Network simulator

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: fastlane69] #135707
06/11/07 21:32
06/11/07 21:32
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
Quote:

1) How hard do you suppose it would be to mitigate existing 3DGS MP code to Raknet?



It depends very much on your code. If you have a modular design, where you have an abstraction layer over the 3DGS functions, this will be very easy. The best case scenario is a codebase with clearly seperate pieces of code for creating and handling every seperate type of message. For example, a clearly seperated function that creates a movement update (as a string or series of skills for example) and a corresponding packet for handling such incoming messages could easily be converted to a function that creates a BitStream and a network event function that reads the BitStream and acts upon the contents. Your code should not use the native entity updates.

if your code is a mess with send_*()s everywhere, it is still possible to convert to RakGS, for example by using a single MessageID for every kind of variable (kind of like inventing your own network indices as used by 3DGS).

In any case, the problem for you will most likely not be that it is too hard to convert your code (after learning Lite-C it's a breeze) but that it most likely is a large amount of code.

How much your existing codebase would benefit from RakGS is dependent on how much you where thinking "The RakNet way" while designing your code. For me, I have wanted to write code the way you can with RakGS since the beginning, so my code uses concepts that easily map to RakGS functions. Those concepts where internally implemented as "workarounds" in my 3DGS code, but when converting to RakGS they should work gracefully.

Quote:

2) As we both know, one of the more annoying things we've had to do is implement our own routines so that only relevant entities (ie within a certain radius) send information to a client (my Sphere Of Influence if you remember). Does RakNet have an inbuit solution to this or would we still have to program this in?



RakNet does not have an inbuilt solution for determining which entities are near which ones, since it doesn't deal with entities. (When using RakGS, you must break the thought-link between entities and clients, they are not the same.). However, I have implemented a system that automatically assigns SystemIDs to connected systems. SystemIDs are useful for several purposes. You can conveniently relate SystemIDs with client data on the server (by an array of Client structs, indexed by their SystemID). You can store a pointer to the player character entity inside your Client struct, and store the SystemID in a skill of the entity. You could then use your old scan code to detect nearby entities and write their SystemIDs to a list in the Client struct. This list can be used to send to those clients:
RAKGS_send(chatMessage, client.SOI[ i ]); in a loop that increments i.
instead of an ugly lookup system.

Quote:

Honestly Ex, if this pans out, I would be the first to ask Conitec to make this their native network engine... seems to make more sense to use Rak than to use the Sunset DirectPlay as it does now.



I have spoken to jcl and he will consider RakNet when the need to change network libraries arives. He says "DirectPlay is depreciated, but still a
reliable workhorse. The engine network functions are implemented on a higher
layer and not dependent on the underlying network library.". This is an understandable point of view, since it is quite a lot of work to convert I think (in hindsight). Also, he most likely wants to maintain backward compatibility so he cannot change the design of the 3DGS network engine significantly.

Quote:

Oh, and if I may, I would develop in this order... merely my opinion of course:

- Remote procedure calls
- Secure connections and encryption with a single function call.
- Statistics
- Autopatcher
- Voice chat
- Network simulator




Yes I'll implement RPCs and secure connections first..

If you promise to write a little more sophisticated test app and let me know what you think

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: Excessus] #135708
06/11/07 23:31
06/11/07 23:31
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quote:

If you promise to write a little more sophisticated test app and let me know what you think




I can't.

I have a prototype to deliver by the end of this month to one of the grants. All of our code is in A6 and I haven't touched A7 nor C-Lite since neither fully support MP (A7's C-script might but I have a standing rule not to work with software right after it's released). As such, I cannot at this moment try or work with new software no matter how tempting it is. After our prototype delivery, I will be spending LOTS of time with business and gaming consultants to see what our next step is. Honestly, up until now the leading contender was to raise capital for full-blown production under the Multiverse platform... it's just too tempting and professional to pass up. I was going to then keep our developed work as a way to quickly prototype game ideas for ourselves or potential clients. However, if RakNet is "all that and a bag of chips", it could lead to the my original plan to stick with A6/7... not without it's risks since 3DGS' priority is not networking and Multiverses is, but I have to consider all possibilities.

In any case, regarding some earlier comments, I obviously was not thinking the "raknet" and we have lot's of code. How much of it is "workarounds" that can be avoided with RakNet I don't know but it sounds that, just like any other solution, you trade one workaround for another. We try to abstract as much as possible with our code so that we don't use send_xx() all over the place but have a other functions that do that for us (like send_to_client(), or send_to_everyone(), that sort of thing). My architecture is platform independent but that doesn't mean that I won't have to spend tons of time implementing it (or rather re-implementing it) As such, I think that it might not be hard to get our network traffic modified to work with RakNet but the event handlers we would have to program ourselves as well as any type diffences, and just understanding how RakNet works makes this a daunting task. I guess without you seeing my code nor I seeing yours that was a pretty silly question to ask but it was worth a shot anyways.

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: Excessus] #135709
06/12/07 07:05
06/12/07 07:05
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
LOL why 4 connections!? Thanks for this release you've made my day

After quick test: server.c use 100% CPU. I'll have to try again with client, but if I type a string for the chat it is supposed to show error malfunction?


smile
Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: D3D] #135710
06/12/07 14:52
06/12/07 14: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
Got compressed serialization/deserialization done, and am working on RPCs now. What do you think, should RPCs be able to receive input parameters? Parameters for RPCs seem to make things much harder to implement efficiently and with a simple interface. Right now, gamestudio's RPCs (proc_client/proc_local) don't use parameters I think.. Not using parameters seems to offer very little improvement, though, since the event functions are pretty much Remote Procedures invoked by sending a certain MessageID.

Quote:

LOL why 4 connections!?



I might want to sell a full featured version, not sure yet.

Quote:

After quick test: server.c use 100% CPU.



You can set a higher ThreadSleepTime when initializing the network engine. This should decrease the CPU usage.

Quote:

I'll have to try again with client, but if I type a string for the chat it is supposed to show error malfunction?



Yes I use the error() instruction for quick & dirty output. This is in the Lite-C code, so you could obviously process the incoming chat message differently in a real application.

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: Excessus] #135711
06/12/07 15:15
06/12/07 15:15
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Forgot about that. Last year i've seen the solution on the raknet forums. Anyways thanks for the hint, it solved my problem with high cpu.


smile
Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: D3D] #135712
06/12/07 18:53
06/12/07 18:53
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've spent today thinking up a elegant way to implement RPCs, and I've come up with a really nice solution. It requires one call on the receiver to register the function. Calling the function is a single function call:
RAKGS_RPC(SystemID, RPC_ID, argumentCount, [arguments]);
The SystemID is the system to invoke the function on, ID is a number that is used to register the function on on the server (they must match on caller and callee). ArgumentCount is the number of arguments the function takes. [arguments] is an optional list of arguments. The number of arguments is up to you, and can be any built in type.

Got a party tonight and I'm going skydiving tomorow so I'll implement this thursday I think.

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: Excessus] #135713
06/12/07 19:18
06/12/07 19:18
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Seems like a good solution to the RPC issue: let the user decide if they want to send parameters or not. Talking with my programmers they confirm that most RPCs are parameterless (like our proc_xx) but they could come up with no reason for that except just easier code programming.

So is ID like our old fashion index or more like the handle?

Re: RakGS 0.1 Beta - RakNet for A7 / Lite-C! [Re: fastlane69] #135714
06/12/07 19:30
06/12/07 19:30
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
The ID is just an integer number that you use on the receiver to register a function as RPC. Then you use the same ID on the caller which will result in a call to the function linked to that ID on the receiver.

It's probably best to use a shared header for client and server that contain defines for the IDs:

#define RPC_function1 0
#define RPC_function2 1 // and so on.

You can then register your functions:
RAKGS_registerRPC(function1Ptr, RPC_function1, function1ArgumentCount);

And call the function from another system:
RAKGS_callRemote(RPC_function1, function1ArgumentCount, arg1, arg2, arg3, arg4);


I've built my own RPC functionality, instead of using RakNet. Rationale for this is that RakNet requires you to initialize a struct containing a char* to a list of serialized arguments. This is pretty much the same as serializing your "arguments" with a BitStream, send them with a certain MessageID, and deserialize them in the network event. The way I've implemented RPCs it takes very little setup, and once that's done, all serializing and deserializing is done for you and you just have to call a function.

Page 1 of 6 1 2 3 4 5 6

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