Forum Feedback A Server Based Flash Client for PlayerIO

Problem with the website? Confused about something? Or maybe you just have something you'd like to suggest. This is the place to do it.

A Server Based Flash Client for PlayerIO

Postby ASH1138 » December 3rd, 2012, 12:00 pm

Hi,
I have a really cool suggestion to make, If its possible that is.

Ryan Brady from the playerIO tutorial says that it is impossible to run AS3 directly on the server, right? So as a result, Multiplayer Game developers using playerIO tools are forced to learn a completely new language, C#, just to make their game multiplayer. Ryan said that not many people have the time nor want to take the effort to learn a completely new language, and as a result, many multiplayer games dont get published successfully, or they would base their multiplayer games on a simple P2P framework, using C# only as a bounce server, which isnt very efficient nor secure.

But I have an idea. What if developers could somehow develop an SWF representing the game as it would work on the server (server-client model) in Flash, upload it to your servers, and have an instance of the swf started using C# on the serverSide code. I've already found an example where you can do this:

Code: Select all
using System;
using System.Diagnostics;

namespace startProgram
{
    /// <summary>
    /// Demonstrates how to start another program from C#
    /// </summary>
    class ProcessStart
    {
        static void Main(string[] args)
        {
            Process swf = new Process();

           swf.StartInfo.FileName = "D:/Game.swf";
     

            swf.Start();
        }
    }
}

Using this code in C#, I successfully launched my own flash game from the command prompt.
If playerIO could somehow nest this block of code inside a gameStarted() function, whenever a room is created, the swf could be opened, and act as the "Host" from within the server.

From the on, the "Host" swf would act as a client, except that the client is persistent as long as the room remains open, and remains on the server, so it is totally secure. Messages can be handled or sent by using the AS3 PlayerIO.connection or client API. The C# code would continue to accept messages coming from the player Clients, and send them into the "Host" client, and vice versa. Nothing more complex than a simple bounce server shall suffice.
And when the room is closed, process.Kill() can be used to terminate the Host Client.

There are a lot of benefits to developers should you guys adopt this idea over the current method. For once, the generateDebugView on the development server isnt very productive. The C# drawings API is far less user friendly and less flexible than the flash display list; and it would be very difficult for developers to see what is going on inside their game without seeing any graphics.With this method, the development server would be very much redundant, developers can simply test their Host SWF on their computer.
Secondly, flash is tailor made for games, whereas C# is more for applications. It is alot more verbose to create a game in C# than in AS3.

And thirdly, developers who already have a single player version of their game and wish to turn their game into a multiplayer version would have to rewrite their entire game in C#, which is prohibitively daunting. If the Host client runs on AS3, it would be far simpler, the mechanics of the game can be left intact, all that needs to be done should be change the Mouse input listeners into Message input listeners, and display rendering functions into Display update message functions.

And finally, for new developers, they wont have to do double work, i.e write the client side code using AS3 and then write the serverside code using C#.

I am sure that should playerIO take up this idea, it would eliminate most of the obstacles towards making a multiplayer flash game, and playerIO will be used by a whole lot more developers.

Cheers!
:D
ASH1138
 
Posts: 285
Joined: November 17th, 2012, 2:29 pm

Re: A Server Based Flash Client for PlayerIO

Postby dreamora » December 4th, 2012, 9:56 am

If you are able to write AS3, C# is not that much of a new language, as AS3 is ActionScripts adoption of Java / C# capabilities to replace AS2. This especially holds true in case of the PlayerIO server which removes large parts of the .NET framework and even the concept of statics, so its largely the same thing you already knew if you wrote correct, proper AS3 code.

Also I think that the point of 'not being able to publish a game' due to this is very overexagerated.
Anyone who is able to fail to publish a success game due to this pretty simple hurdle will definitely never publish a successful game at all, cause his team lacks any realistic expertise in the field out of my view and years of experience.
A a programmer can pick up a new language with ease when its as close as modern, highlevel OO languages (proper AS3, Java, C#) especially if you only need to pick up a tiny minority of it as in the case of C# for PlayerIO server. The stuff you need to learn, due to the limitation and the server side aspect, barely extend beyond what you know on the AS side already too :)
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: A Server Based Flash Client for PlayerIO

Postby ASH1138 » December 4th, 2012, 12:49 pm

dreamora wrote:If you are able to write AS3, C# is not that much of a new language, as AS3 is ActionScripts adoption of Java / C# capabilities to replace AS2. This especially holds true in case of the PlayerIO server which removes large parts of the .NET framework and even the concept of statics, so its largely the same thing you already knew if you wrote correct, proper AS3 code.

Also I think that the point of 'not being able to publish a game' due to this is very overexagerated.
Anyone who is able to fail to publish a success game due to this pretty simple hurdle will definitely never publish a successful game at all, cause his team lacks any realistic expertise in the field out of my view and years of experience.
A a programmer can pick up a new language with ease when its as close as modern, highlevel OO languages (proper AS3, Java, C#) especially if you only need to pick up a tiny minority of it as in the case of C# for PlayerIO server. The stuff you need to learn, due to the limitation and the server side aspect, barely extend beyond what you know on the AS side already too :)

Well, you are entitled to your own opinion, but Ryan Brady said himself that the inability or refusal to learn C# on top of AS3 as a major limitation over why people dont want to create serverside flash games. Essentially, serverside flash games arent flash games anymore, they're C# games!

Besides, learning is just half the point. Lets says someone who publishes a great singleplayer flash game gets feedback about porting it to multiplayer. He assumes that it is something as simple as hooking it to playerIO, but then discovers a P2P system is not secure and then faces the hurdle of rewriting it all in C#! Thats enough to kill all ambition, no?
ASH1138
 
Posts: 285
Joined: November 17th, 2012, 2:29 pm

Re: A Server Based Flash Client for PlayerIO

Postby dreamora » December 4th, 2012, 5:04 pm

That part is true if you only use message relay.
But if that was all you did, I would not use PlayerIO at all but Photon which offers exactly that out of the box and focuses on low latency message relay in Photon Cloud for players around the world.
There are other similar, yet not as strong and widely used services that offer similar 'simple message relay' capabilities.

In either case you would require a trustable 'authorative master client', not needfully one thats controlled by a player.


I don't see why anyone would want to use Player.IO only for message relay due to its data cap based subscription that would be a horribly bad decision right from the start. If you use Player.IO you want to make use of everything it offers and that will require a skilled programmer to be done in a remotely secure way (secure in the form of your client not being a hacker paradise, not other even more cricial aspects) and I am sure that such a programmer either can easily learn C# or actually already knows it anyway due to Silverlight and similar past 'know your field' efforts.


Also, I don't see how it would be insecure if someone hosted his own Air based 'master clients' for others to join and keeps using player.io as a relay service. The problem obviously only exists if you allow players to be the authorative player, but that will always remain a problem, because you can not simulate the game on the server (you have limited time, if you use flash, you get even less compute time than with C#) so you always have to solve the problem of authority in your MP games and you need to do it in a professional not a 'best hope' way, which requires a programmer with knowledge in the field.

Though in the end it does not matter.
If it would happen then I would assume it would happen as air servers and not as flash anyway (for performance sake and cause they need to run on a machine, not in a browser).
But even then Air lacks a fair amount of crucial capabilities required to offer a scaleable, secure, performant backend to ensure that nobody can kill or lock whole cluster nodes and alike.

Other server technologies that used to support Flash have kicked it out in their recent year updates due to performance problems which says a lot if technologies that build upon Java 5 drop Flash due to beeing too slow, given that already Java 5 gets stomped by a factor of 5-30 on the performance side through .NET 4.
You can do your math on what performance you would have to expect for using flash, but I would guess that you can be happy if you get 7-10ms of the C# 100ms timeslice of work done in the same 100ms, which makes it kinda useless at least if you ask me.

But yes thats a personal though professional opinion.
I just don't think that it suites a promising technology like Player.IO to degrade its cluster performance to abysmall levels just cause a handfull developers that don't have or want to have the staff or knowledge required to create a MP think that hacking together something in the language they know is in any way better than using message relay with no authorative client and to be honest I have no interest seeing the cluster performance being killed by this kind of approaches.
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: A Server Based Flash Client for PlayerIO

Postby ASH1138 » December 6th, 2012, 7:12 am

Your english isnt very good, some points do not catch.
SO you mean that in summary , 2 things?
1) If you want to use PlayerIO as a simple bounce server, dont use playerIO at all.
2) to make a swf run on a server is extremely slow, so slow that performance will be unreliable.

1). People won't merely want to use playerIO solely for a message relay service. Theres stuff like BigBD and payvault that CAN be accessed from the client AS3 without using any C# code. So if the client is running in a secure environment , I dont see any issue of accessing such items via the swf.
Correct me if im wrong, but Ryan Brady seems to hint that as long as whatever code you are running is on the (playerIO) server, it is secure no matter what base it is (C# or AS3) , and other factors do not matter as much.

2) Flash is flash, a simple softcore flash game like most flash games out there wont take ages to run, even if AS3 is a comparitively slow language. (IF) you kick out all the rendering functions (i.e remove all the addChild) and let the game run in the background, a normal platformer should take under 1ms to run every refresh.
I've profiled my own RTS game, which is a processor intensive game in flash, running 1000 units, and to refresh them every frame only takes 6ms. Of course, a platformer or a shooter kind of game wont have anywhere near that number of objects to refresh. Even this pales in comparison to playerIO's server timeout-script limit of 100ms. If playerIO allows developers to have their code take 100ms to run, 6ms should be no problem.
The only reason why flash seems to be slow is that its rendering takes up the majority of the processing time. But according to adobe, if you omit all the addChild() functions, no rendering is done , and the game speeds up many fold. Developers can easily convert a "development" version of their game with graphics, to a server ready process-only version simply by commenting out the addChild()s.

And lastly, not all game developers are professionals like you, they dont have money, they dont have companies and they dont have staff. The vast majority of flash developers are those who create flash games as a hobby. And as you know, hobbyists dont have much time or money on their hands. So dont expect people to learn rocket science just so because they can create a multiplayer game. All the more, multiplayer game development should be made simpler for them.
ASH1138
 
Posts: 285
Joined: November 17th, 2012, 2:29 pm

Re: A Server Based Flash Client for PlayerIO

Postby cog » December 11th, 2012, 2:26 pm

Well, just my 2 cents but I think emulating a server with flash would just be plain weird. I'm against it.
If you can write a server in AS3, you can also do it in C#. Porting it would be the easiest part anyway.
cog
 
Posts: 74
Joined: November 17th, 2012, 1:40 pm

Re: A Server Based Flash Client for PlayerIO

Postby ASH1138 » December 13th, 2012, 9:56 am

cog wrote:Well, just my 2 cents but I think emulating a server with flash would just be plain weird. I'm against it.
If you can write a server in AS3, you can also do it in C#.


You're partly right, but here's the deal: Writing a game is waay easier in AS3 than in C#, and the sheer number of flash game developers vs C# game developers attests to that. AS3 and flash are primary designed for web based games which are easy to create, while C# is more for hardware based, hardcore games and applications.

:)

Porting it would be the easiest part anyway.


Porting a single player flash game from AS3 to C# wont be easy at all... if you have to rewrite all your 1000 lines of code for your game into C#.
However, if your server game was in flash, you wont have to rewite your game code at all, just add multiplayer code.
ASH1138
 
Posts: 285
Joined: November 17th, 2012, 2:29 pm

Re: A Server Based Flash Client for PlayerIO

Postby cog » December 13th, 2012, 12:40 pm

ASH1138 wrote:Porting a single player flash game from AS3 to C# wont be easy at all... if you have to rewrite all your 1000 lines of code for your game into C#.


Well, the flash client and all its code stays intact. You only port the server-side stuff (and only the logic actually) from AS3 to C#, which are "somewhat" similar.
cog
 
Posts: 74
Joined: November 17th, 2012, 1:40 pm

Re: A Server Based Flash Client for PlayerIO

Postby AndyKerrison » December 14th, 2012, 10:47 am

Just to throw in my opinion, as a C# programmer with no knowledge of flash/as3 until starting a project here myself a few weeks ago, I quite like the setup of C# server side and as3 client side. It's fairly trivial for a decent programmer to pick up a new language (I spent an hour or two watching flash/as3 turotials to get the syntax & general gist of things and have hardly had to look anything up since), and the separation encourages the segregation of logical code onto the server & presentational code to the client.

As you would expect from my background, my as3 code largely resembles the sort of object based implementation you could expect to see in C#. A such, if my server code had been done in as3 I'm fairly confident that porting it to C# would not be a daunting job. However... I can see that this wouldn't be the case for every developer, in that if your as3 code hasn't been written in the right style, it's definitely not going to be trivial to turn it into C#, even if you know the language.
AndyKerrison
 
Posts: 14
Joined: November 29th, 2012, 9:24 am

Re: A Server Based Flash Client for PlayerIO

Postby ASH1138 » December 17th, 2012, 1:18 pm

cog wrote:
ASH1138 wrote:Porting a single player flash game from AS3 to C# wont be easy at all... if you have to rewrite all your 1000 lines of code for your game into C#.


Well, the flash client and all its code stays intact. You only port the server-side stuff (and only the logic actually) from AS3 to C#, which are "somewhat" similar.


Correct. But, if you want to make your game a Server-Client model, the game world must ultimately run on the server, and that means you have to convert all your code into C#! :|
Otherwise, like Ryan Brady said, you can use P2P, and have the game world on each of the clients, BUT then you have like a dozen separate game worlds which need to be synced all the time. A LOT of bandwidth and a big headache! :?
ASH1138
 
Posts: 285
Joined: November 17th, 2012, 2:29 pm

Re: A Server Based Flash Client for PlayerIO

Postby Benjaminsen » December 18th, 2012, 12:34 pm

We don't allow AS3 code to run on the servers due to performance issues. From a technical perspective it's not to hard to wrap the serverside such that it passes events to a tamarin instance. However it would lower the amount of people that can be online on one server 5-10x.

When that is said, we have all kinds of crazy setups for clients running our Enterprise setup. A good example is a client which spawns a Unity3D process that joins each room and act as a authoritarian master client. This nifty little trick allows the developer to be super lazy on the server-side development side of things, but add's quite a lot to his monthly bill.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: A Server Based Flash Client for PlayerIO

Postby ASH1138 » December 20th, 2012, 2:11 pm

AndyKerrison wrote:Just to throw in my opinion, as a C# programmer with no knowledge of flash/as3 until starting a project here myself a few weeks ago, I quite like the setup of C# server side and as3 client side. It's fairly trivial for a decent programmer to pick up a new language (I spent an hour or two watching flash/as3 turotials to get the syntax & general gist of things and have hardly had to look anything up since), and the separation encourages the segregation of logical code onto the server & presentational code to the client.

As you would expect from my background, my as3 code largely resembles the sort of object based implementation you could expect to see in C#. A such, if my server code had been done in as3 I'm fairly confident that porting it to C# would not be a daunting job. However... I can see that this wouldn't be the case for every developer, in that if your as3 code hasn't been written in the right style, it's definitely not going to be trivial to turn it into C#, even if you know the language.



Yeah, since C# is a lot more complex language and contains all the functionality of AS3, moving from C# to AS3 wont be a problem at all.
However, the other way round is worse... When you have only one Object class now you have Dictionaries<Type, Value>,enums etc etc, arrays now corrospond to collections,lists, and []s which dont allow you to add stuff dynamically.... and such..... its quite overwhelming. With one simple function class in AS3 you now have delegates, functions .And if you want to write stuff to a byte array you must first create the byte[], then create a memoryStream, then a binaryReader on top of the memoryStream..., instead of just one byteArray.

And i dont think there is a C# substitute to addChild and the AS3 display list. rendering stuff can be quite a horror. :|

And even worse, with playerIO, no static variables are allowed. That means all the const have to be stored on your game class or the associated class instance themselves, and if you want to instantiate stuff based on fixed values, you' must write a "registry class" or cant instantiate them at all.
ASH1138
 
Posts: 285
Joined: November 17th, 2012, 2:29 pm


Return to Feedback