smart real time api

Post here your suggestions for new possible features in SmartFoxServer.

Moderators: Lapo, Bax

Post Reply
gringo
Posts: 16
Joined: 11 May 2007, 18:17

smart real time api

Post by gringo »

It would be great to have a direct way to transmit data in stream mode as it is now, but without implementing any extensions.. I'm writing a forwarder extension so that one client can send a string to another object through the string protocol and not the xml protocol so that it saves xml overhead but I guess it would be better if I don't implement an extension for such a task and there is already something implemented as there is 'sendobject'

Also it would be great if these strings are transmitted compressed to save bandwidth.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

without an extension?
I don't get it, can you better explain?
Maybe you mean that you would like something like sendObject but with a more compressed format?
Lapo
--
gotoAndPlay()
...addicted to flash games
gringo
Posts: 16
Joined: 11 May 2007, 18:17

Post by gringo »

I'm sorry, I know I didn't write it very clear.. I will try to explain it better.


If I try to develop a turn based game, it is enough for me to use the sendobject function that converts the object in xml and transmits it, because I don't need any efficient way to transmit data. However, once I start getting into realtime multiplayer game development, I do need the fastest way to transmit my data which, in an ideal scenario, would be compressed data through UDP and to send as little data as possible. As UDP is not possible because of a limitation of Flash itself, there's nothing to do with this, but anyway the best approach would be to send the data compressed to save as much bandwidth as possible.

Now, this is an implementation issue which should be transparent for the developer. About the way we have to use the library, in order to develop realtime games, we are supposed to use the 'string' format in stead of 'xml' to save bandwidth. The problem here is that there is no way (and correct me if I am wrong, but I couldn't find it) to directly send the data to the other users as we did with the sendObject in xml. The only way to do this is to create an extension that receives the str object and send it to the users, and this is a completely different approach than the simple sendobject I was using, just because I want to use raw string in stead of xml.

In conclusion, what I am asking for, is a sendObject function that handles string in stead of xml.
louissi
Posts: 48
Joined: 03 Mar 2006, 20:55

Post by louissi »

I totally agree, that would be really usefull
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

However, once I start getting into realtime multiplayer game development, I do need the fastest way to transmit my data which, in an ideal scenario, would be compressed data through UDP and to send as little data as possible.
This is clear, but it seems you're concentrating too much on the size of the message, while another really important thing is the actual lag of the client.

The raw/string protocol is already very compressed as it just uses 1 byte to determine the end of the message. If you use a binary compressed message you would probably save a few bytes on one side but waste some others in order to create an header for such message (it's needed to state the length of the message)

It doesn't make so much difference if you're sending 10 or 15 bytes each time, if the client has a lag of 100ms you will only be able to send / received 10 messages/s.
The only way to do this is to create an extension that receives the str object and send it to the users, and this is a completely different approach than the simple sendobject I was using, just because I want to use raw string in stead of xml.
Yes that's right. I wouldn't really recommend to develop a real time game where the logic is handled on the client side, it's totally insecure and would produce a sloppy gaming experience.

The server must act as the "brain" of the game, taking user input, applying the necessary logic and validation and sending updates to the clients.

Additionally one very important aspect of RTGs is synchronization: usually all clients stay in synch with the time of the server, so it's really necessary to use an extension.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

In conclusion, what I am asking for, is a sendObject function that handles string in stead of xml.
I see, this could be done, no problem. It would probably be helpful for sending smaller custom data, but again... this would be of no help for realtime games. That's a completely different story. :(

Extensions are done for that task :)
Lapo
--
gotoAndPlay()
...addicted to flash games
gringo
Posts: 16
Joined: 11 May 2007, 18:17

Post by gringo »

I wrote a pool game, where when one player is aiming at the ball, the other player is looking at how the player is aiming.

Each player sends the strike when it is done and both clients reproduce the strike, it was a pain to make the sync to work all right because of rounding errors, and sometimes it still moves a little. If I had chosen to use the logic in the server I would have to update every frame of each ball thus perhaps giving a 'not so well' visualization of the balls because of the lag, it is very similar to a turn game.

The problem is that as I need to make my user to see the other player's cue, I need to transfer the position to the server, and I wrote an extension to forward it to the other player, it would be easier to program if I could just send the position to the other player as it is visualization data and it doesn't affect the gameplay.
Post Reply