Tuesday, June 25, 2013

Networking

Well. After finishing the primitives and with that Path-Following Sprites, I thought it's time for the first networking code. The plan was to do a smal echo Server in whatever that just connects the clients to each other. This would add the first 'multiplayer'-Feeling to the game and this is, by far, the best thing to do right now.

After havin' a short look thought the Adobe Homepage I noticed that using binary Sockets is rlly just the same as usual. But even thought I became unsure about how and were to include it into the game. I mean. At the Moment the whole AxGL Engine is based on it's invinitive-loop and maybe a dozend of events happening. But is that the right way? On a multiplayer game with maybe 50-100 network objects, shouldn't it be based on the Networking Stack? Questions, Questions, Questions... I decided to google bout that.

To behave there not rlly AS3 coders out there that seems to be talkable about networking code. Or they are not well listed by google. Who knows. But I can understand that. I belive for the most reasons its okay with HTTP-Connecting to php/asp/whatever scripts in order to get updated info's. Or you have just a few real time acteurs just in fancy games such as Curve Fever.

I ended up on PlayerIO.

Ryan Brady - current location unknown! - did a broad Tutorial about how to handle networking in Flashgames. Of course by using the PlayerIO, that is not just a AS3 and C# driven Client/Server Lib but a complete Bussines-Model. Yeah. It's true. You can host your entire server there for free, expensive, rlly expensive and billionaire. Depends on what kind of payment models, database and traffic you need. 
In fact. It dont looks like the worst thing on earth. Too bad there is nothing on that Page that gives you the feeling they are still alive. Besides the Forum.

But about the tutorial. Its good and awfull at the same time. He covers many important points. But he does it for dummys. Whats the meaning of doing a network, tasks handling, and PROGRAMMING tutorial, without ANY src samples and then make it for an audience with the coding skill of wet bread? I mean. Give you that:
From here on out, you will see very little code. We will instead be focusing on the theory behind how to make real-time games. Again, it is hard to overstate how difficult and complex a real-time game can be. Simply making a character move around properly using proper lag-defeating techniques may take you days to properly understand and implement.
... assumed your an starbucks-apple-flash-hipster script kiddie: Isn't that motivating or what?

Anyway. It's still a nice Tutorial and made me sort all my thoughts and experiences from other multiplayer games. At one point Ryan said: It's not about real-time. Its about giving a good Ilusion of real-time. And thats just true. I remember tousands of times in WoW or RO2 having heavy desyncs. But still enjoyed the game. It's not about beeing perfect. Thats technical impossible. It's about handling things well. And now I became sure I could do that :D

Another thing about PlayerIO: The network Traffic.

The API sends any command packet just like this. Where type is an identifyer String and datan

is a binary package. 
Well. Again. The type is a string? What the hell?! Thats soo safh like. Why use something that you can compare in fast switch statements? Naa. Lets use strings. It's easy... I would understand that if they would send the whole package in XML. But that? It makes me nuts.

But even more important. Im currious how they actualy implemented that. On shuttered network action ... how do they know for sure when a new string starts and when not? Are they just trusting that the socket will take care about it, and every time he got "some Data" of course it will start with a new package? The hell?!? Do flash acts like this? Again I got the feeling I have to learn more about flash :|

Why do I care? Well. In fact I played with the thought to copy PlayerIO's Networking Protocol. As least the basics excluded with all the database direct access and hell ton of things that are possible. I have to implement something anyway and. As least... In case that needed I could try out one of this PlayerIO-Free packages for the first playable multiplayer demos of my engine. 

One thing they got right: I rlly dont feel like having fun on playing security admin for a server. By doing this I just waste even more time that I could use for doing the game ...


No comments:

Post a Comment