Converting an application from Unity3d to Flash - json

I am attempting to convert my Unity3d game to flash but am experiencing trouble with comments. Because of the socket trouble, I am trying to use Json and Post, but I don't know where to start. I saw this
Java server- client socket communication
but it incorporates sockets.
This is for the user client, but I also need to redo the server side. I believe I need a web server to get the Json strings and return the appropriate response.
Am I doing this right, or is there something I am overlooking?

This may lessen the amount of work quite a bit if you are interested in using an API. Smartfox is an awesome Client API / Multiplayer server tool that can increase output time as well as allow you to implement efficiency code to improve server stability.
It works for both Unity3D and flash.
http://www.smartfoxserver.com/
Addressing your main question I believe you would need a server to effectively use Json and be able to communicate to the clients however this is where smartfoxserver can come in handy. I have not had much experience in the flash multiplayer programming however smartfox is a great tool and I used it to make multiplayer programs in unity3d.
Hope this helps!
Mitch

Related

Faye Client for ActionScript3

I'm looking for a pub/sub messaging system to connect various applications I'm building, some of them will be iOS, other ones AIR/AS3 and maybe some openFrameworks.
I found out Faye and it looks like really interesting. I've found libraries to integrate it in all my apps/languages, so I'm trying it out.
Now, the problems are with the AS3 implementation. I've found this great library and it's kind of working, BUT I've some issues I can't understand. My main problem is that I can build clients, connect them to a node.js server and exchange information between them, but after a while they stop receiving information.
So I was wondering:
do anyone of you have experience with Faye and this library, and knows if this behaviour it's normal and if there's a way to prevent it? I've done some tests using some html browser clients and everything was ok, so it's definitely a flash library problem
do you know any other library to implement Faye in AS3/AIR? I was browsing a lot but I couldn't find anyone
Do you know any alternative pub/sub messaging system I could implement (easily) in as3?
Thank you
We've open sourced our implementation of AS3 Faye client recently. You can find it here.
It's been in prod for more than a year and was tested by millions of users, without issues so far. It's used in Flash Player Web and AIR Mobile applications.
Interfaces mimic JS client interfaces, so its setup is as easy as JS client setup. Plus one additional feature: multiple urls for reconnection fallbacks.
Give it a try!

application design: Scala + HTML5

I'd like to implement an application with Scala and HTML5. My idea was to create a "local" client-server architecture: Scala handles the calculations and generates HTML5 as a GUI.
To my mind there are two possibilities
Use a Java/Scala framework that allows embedded HTML5. SWT for example has a browser widget. JavaFX seems good, too.
Distribute the program with a server and run it in a browser on localhost.
It would probably be most convenient to require an internet connection and forget about the localhost. Unfortunately an offline mode is necessary.
Now I would like to know how to get this right:
The first option seems easier to implement but I wonder: How can I communicate with Javascript without the HTTP protocol ?
The second approach was just an idea. Have you ever done something like this ?
If you've got advice or know a good framework please go ahead.
UPDATE :
I've just had an interesting idea: Could I use nodejs to create something like a server-server architecture ?
Right now the communication between Scala and Coffescript seems like the most problematic part. I still wonder how I could initiate an update from the Scala side of the application. A HTTP Request is a nice way to exchange data. Sadly to my knowledge in "standard" Coffeescript there would be no event hook to listen to server-side HTTP messages.
I've thought about using nodejs to listen to the server-sent data. Is this a good idea ?
With regards to the second option, you may wish to investigate the Play! Framework or Lift. They automate a lot of the work required to make a web application in Scala, including handling AJAX requests.
Although I haven't tried packaging either for local use, there was an earlier Stack Exchange question about packaging Lift which might be relevant. It should be possible with Play! as well.

Best portable method to implement an algorithm on Website

I came across this problem,I have got an algorithm that I need to implement on websites.
The server side scripts may differ and it can be PHP,ASP.NET etc.
All I need to do to is to deliver the binary(I need it as I dont want this security algorithm to be open and viewable) that can comply by every type.As per me solution can be (Please correct me if I am wrong):-
Implementing binary according to OS.
Implementing Algo as per every type of script.(Tough and less portable)
Please suggest if there is other way round or please close this question and redirect me to any earlier question asked for this situation.I am new for this.
Thanks
I would suggest you to use Java Server-side technologies to implement your algorithm. You can write your algorithm as a java class, which can be called from a Servlet or a JSP or even any other technologies over http protocol. The main reason why I suggest using java is:
1) it is platform independent, so your 1st point:
Implementing binary according to OS.
You dont have to worry which OS the client would use.and it can be ported to other OS very easily.
and
2) it will be very secure, once you compile, a class file will be generated, which can be delivered. it cant be opened and viewable.

What is a good choice for a free Flash Socket Server

I see Red5 which looks nice but it really lacks documentation and since I'm new to using sockets it would be a hassle.
I'm wanting to make a flash chat with audio/video (though just text will work at first) and I enjoy ES but the cheapeast license is $700! I'm a solo developer so the cost is too high.
The main factor is just having good enough documentation for a new comer.
(I use the flash CS4 IDE if that matters)
SmartFoxServer is a good choice. I played around with it a few years ago with AS2, so might be work a look.
They offer a free lite version, but it does not support AS3. I think you need to get the basic plan for that. The pricing plans do look well priced though.
They have some nice documentation and plenty of example.
SmartFoxServer seems to be targeted at multi-player games, but it could be used for your needs.
EDIT*
Just found these Beta AS3 classes for SmartFoxServer. I haven't tried it out for my self though.
EDIT 2*
Another option would be to make your own. It's probably easier than you think if you have a few programming languages under your belt. Of course, this is the kinda thing that can suck your time away.
There are a bunch of tutorials out there for building your own socket server, and some are even specifically for flash. Here are some of the best:
Building a Flash socket server with
Java in five minutes
Python socket server for Flash
XML Sockets / Flash / PHP Based Chat App
Writing Socket Servers in PHP
Asynchronous Socket Programming in C#
I would definitely suggest using C# .net if you have Windows hosting. It would definitely be the simplest to build and would have the best performance. I would stay away from PHP for anything bigger than a chat app, but if that's all you have then go for it.
Try Union. IT's written by one of the best actionscript programmers out there, Colin Moock. The options seem affordable and it's well documented as well.
You can get a free flash socket policy server from https://fsps.rpath.org. I built this appliance for internal use at rPath where I work, but I also maintain it on our free rBuilder Online service. Just click on the Home tab, and download the type of appliance you want (ISO, vmware image, etc.). The Appliance is a full system image including the OS (in this case rPath Linux 2) plus the fsps application.
The policy service resides in the fsps package and runs on the standard Adobe port of 843. By default, it only opens up access to port 443 on the system (https). The policy file served up lives in /usr/share/fsps if you want to change it.

What is a good Flash Socket Server for a Newbie?

I have been debating which Flash Socket Server to use for a virtual world (multiplayer game).
I want something that has a very abstract api and requires little to no server side programming.
From what I see only Smartfox and ES sort of cater to game development.
I'm open to any suggestions and if anyone knows which API is easier to learn (Smartfox or ES) don't be afraid to chime in :)
I'm currently developing a flex+smartfox mmo project.
my experience with smartfox is not so "easy", if you need some custom behaviours or some bandwidth saving protocols you just have to choose another way.
the great lack of smartfox is amf support, the data is not sent and received via a binary socket, everything is transfered as a string, so you can only imagine how bandwidth sucker the transfer is...
however the plus of smartfox is you can cluster it quite easily via terracotta and can you can implement your extensions in java, python and as3. further it supplies some ready to use functionalities such as chat rooms, friendlists, etc..
I have some experience with red5 too, it's a completely different approach, the main plus of working with it would be streaming assets such as mp3 or video to the clients, so if you need ambient sounds or something similar red5 or fms could be your choice.
however I don't have experience with electroserver nor union, so i can't say much on them.
Well, the easiest to program for would probably be Flash Media Server since you program the server in a variant of ActionScript.
I have experience with a bunch of them - FMS, ElectroServer, Union(used to be Unity), Red5, etc and I have to say that I really liked Union. Union's website has a bunch of good beginner tutorials as well.