I'm designing a simple 2 player RTS with Stencyl, a program that uses blocks for coding. The current code updates lists whenever an actor moves (new X and Y), and I'd want the server to update the game state with each change to the list. However, to start off: I don't even know how to set up a socket server. Stencyl has taught me the basics of logic, but I've yet to learn any programming languages.

I've downloaded a Smartfox 2X socket server that I'm intending to use. Right now I'm only looking to make baby steps; I want to do something to this effect: "When someone connects to the server, open insert file here". How can I do this? My intention is to have this file be the game client. Is this "open file when connected" method the best way to go about this? When answering: assume that I know nothing, because really, though I have done research (I know that UDP>TCP for real time), implementation-wise I know nothing.

  • \$\begingroup\$ You might want to run the server offline right now. In which step of the process are you at this moment? \$\endgroup\$
    – AturSams
    Feb 3, 2014 at 22:51

2 Answers 2


This may not be relevant anymore but I found some useful information about this subject. The gist of it is that you need to program a server (in a programming language) in order to allow multiplayer for users of your game client (the game your users are running locally). The server allows users to to connect with one another (indirectly) and is required to store each user's state as well as send relevant information about each user's state to all users.

Writing a game server is outside the scope of one question by all means. It requires a basic understanding of Network programming which you could begin to learn by reading Beej's guide. Bassically, this is pretty advanced stuff.

  1. If you are not a programmer, the first step would be to learn programming.
  2. If you haven't done any network programming, the second step would be to learn from BeeJ's guide and write a simple file sending application (to get the hang of it).
  3. Once you understand network programming, you need learn how to use SmartFox, start by making a simple application, like one that sends the mouse position to the server, so all users can see all the mouse cursors.
  4. After this you can start building a simple game. Remember to test locally.
  5. You need to find a decent place to host your game server, latency, availability, processing power and bandwidth are all relevant issues.
  6. Do a beta phase for the game, fix errors, figure out how to prevent cheating and all that.
  7. Release your game to the public.

I'm not particularly familiar with either of the mentioned frameworks, but after a small check, here are some pointers:

  1. The client runs on your device, the server runs on the server machine, so there should be no need to open any files (i assume you mean execute) as the client is already running the game willing to play and the server merely detects the connection and transmits the data between clients. Your server should have an internal list of connected players (I assume SmartFox takes care of this).
  2. The Smartfox 2x examples show how to connect to a server and how to join a room. You could use this as a way to find games and match players against each other. You might need a view in your game where you choose your opponent and "challenge" him to a game. Or if you're just doing this to try out network code, then you can just pick the first guy in the room and start a game with.
  3. Your assessment of UDP>TCP for real time is sorta correct depending on how much data you'll be moving. TCP is more reliable though. I don't exactly know how much nastiness they have removed in the APIs, but with UDP you generally need to be worried about some packets not making it through. Then again, I would imagine that the SmartFoxServer API takes care of this.
  4. Depending on how your game is constructed, you might want to transmit the commands over the server and have the game synced up rather than updating all the positions of all the objects in the game all the time. This of course depends a great deal on a) what's easiest? and b) what's efficient? For this part of the communication and delta syncing etc. you can find a bunch of articles online.

I know nothing of Stencyl so I don't know how this integrates into it to begin with.

Hope this helped.

  • \$\begingroup\$ Thanks for the response. Very informative. It helped me realize some errors in my train of thought. \$\endgroup\$
    – Walrus
    Aug 16, 2013 at 0:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .