Electrotank Multiplayer Kit (Note: Discontinued)

ChunkyMonkey

  • Posts: 430
Amazing, This could change stencyl forever!

niccosw

  • Posts: 91
@docskull

The movement system works by sending two messages to the server:
Start) Actor begins moving in a direction
Stop) Player has released the movement button

The first message sends the actor in a specific direction. They will continue walking that way until they hit a barrier (Anything that would normally stop them). The second message creates a temporary barrier that only that actor will respond to. The barrier is placed ahead of the actor and disappears after the actor makes contact with it.

One thing to note is that the client only sees the movement that the server responds with. That means if you are using a remote server that is slow, the actor will only start moving a second or so after they use the arrow keys. This will come across as lag. Also, the actor can only move in one direction at a time and the keys for other directions will not move until the actor has come to a complete halt.

I used this system for my grid movement because low-bandwidth, accurate results were a priority for me. There are other ways to make multiplayer movement work though. You could change it to free movement so the actor can move any direction and change direction quickly. You could have the client move the actor without waiting for server confirmation, but then the server and client will never be quite in synch. You could sync client/server at 200ms or lower but then your bandwidth usage goes up proportionality.

One of the best movement systems is mouse-based with pathfinding (like Zynga games use). It is very efficient and doesn't require server confirmation, but you can't use it for PVP or anything with true collision.

In the future, I hope to offer multiple movement options so people can use the one that works best for their game. Still, anyone who uses this kit is going to have to learn network programming on their own since this isn't even a skeleton yet, just a taste of what is possible.

« Last Edit: December 10, 2011, 07:49:28 pm by niccosw »

docskull

  • Posts: 65
Hello @niccosw

Thanks for explaining the movement system. I have figured out parts of it while trying to adapt it.

So i was trying more loose systems cause I plan on an action oriented game someday. So I found the lack of synch problem you mentioned. I will search more deeper in the code to try working it out. Maybe I will try to set up to my game aimed at not so low bandwidth (I am targeting at least 1 mb cable/ADSL users as my future players)

Your explanation was handy to understand how the movement is halted in this logic, many thanks for the detailed answer, really.

I am studying the subject hard and just ordered an "Actionscript for multiplayer games and virtual worlds" book to see if I can improve a bit on building this.

Hopefully I can add a bone or two to the future skeleton of multiplayer games.


djip123

  • Posts: 982
How fast will the updates come ? :)
Go check out my website: http://gamecow.net

niccosw

  • Posts: 91
Don't hold your breath.  ::)

djip123

  • Posts: 982
Don't hold your breath.  ::)
Okay :P So not that fast :)
I just have to figurate out how you have dont it and then i will make a game ^^
Go check out my website: http://gamecow.net

docskull

  • Posts: 65
Just got the book on multiplayer socket servers, reading it right now. Hope I can get to help soon.

hassanayoub85

  • Posts: 4
very good job man, and to the truth, this ks the only reason for me to switch from flash development to stencyl development, just the electrotank kit, after viewing your video.
However, from where to get? and when the next version is going to be released? and dooes it requires extra cost for your job? how much? and where to pay?
Waiting your answer...

niccosw

  • Posts: 91
Thank you for the compliments.

You can get the kit from the Zip file in the first post of this thread and it is free to use. Expect a few months before there is a new version.

ChunkyMonkey

  • Posts: 430
Can you please share it on stencylforge?

hassanayoub85

  • Posts: 4
Thx found it, and hope to see it on stencylforge too.
Why dont you open a website for it? and for upgrading it?
I think u will get alot of money from it.

« Last Edit: December 25, 2011, 11:18:20 am by hassanayoub85 »

Darkhog

  • Posts: 1243
Brilliant work, niccosw (didn't expected any less from You)!

Anyway just a thought - could you make generic multiplayer kit after finishing this apparently MMORPG kit?
Just basic stuff like logging in and behaviors with custom blocks (or global custom blocks) for sending/receiving data of any type to/from server?

Also you should consider making this work for Nonoba as they provide free server hosting and bandwidth and only requires you to put their logo before game. This will be better for people "who just want to make damn multiplayer game".

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

djip123

  • Posts: 982
Then i wanna try to install the kit and then run it after i have installed all things, then i get this error:


SecurityError: Error #2010: Local-with-filesystem SWF files are not permitted to use sockets.
   at flash.net::Socket/internalConnect()
   at flash.net::Socket/connect()
   at com.electrotank.electroserver5.connection::SocketConnection/connect()[/Users/jason/Projects/Electrotank/ES/client/as3/src/core/com/electrotank/electroserver5/connection/SocketConnection.as:62]
   at com.electrotank.electroserver5.connection::ESEngine/attemptNextConnection()[/Users/jason/Projects/Electrotank/ES/client/as3/src/core/com/electrotank/electroserver5/connection/ESEngine.as:735]
   at com.electrotank.electroserver5.connection::ESEngine/handleFailedConnection()[/Users/jason/Projects/Electrotank/ES/client/as3/src/core/com/electrotank/electroserver5/connection/ESEngine.as:860]
   at com.electrotank.electroserver5.connection::ESEngine/onConnectionFailed()[/Users/jason/Projects/Electrotank/ES/client/as3/src/core/com/electrotank/electroserver5/connection/ESEngine.as:841]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at com.electrotank.electroserver5.connection::SocketConnection/connectionFailed()[/Users/jason/Projects/Electrotank/ES/client/as3/src/core/com/electrotank/electroserver5/connection/SocketConnection.as:72]
   at com.electrotank.electroserver5.connection::SocketConnection/onSecurityError()[/Users/jason/Projects/Electrotank/ES/client/as3/src/core/com/electrotank/electroserver5/connection/SocketConnection.as:82]
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at flash.net::Socket/onTimeout()
   at flash.utils::Timer/_timerDispatch()
   at flash.utils::Timer/tick()
Go check out my website: http://gamecow.net

damijin

  • *
  • Posts: 71
I got that too, djip123. I resolved it by testing in browser instead of locally (use ctrl + shift + enter instead of just ctrl + enter to run your game).

Now I have a new issue though:

when I run the game, I get this output in console (I had to disable the chatspam of "disabled" from the InputTextUI behavior first).

Error in when created for behavior: Electrotank Login
ERROR: null object

After using some tracing to find the exact culprit, it occurs on this line:


_es.engine.connect();

My traces before this line work, but everything after this line is just dead. Any idea what the issue might be, Nicco?

niccosw

  • Posts: 91
Sounds like you can't connect to the server. Is it running?

Have you included the Electotank5 SWC?