Online multiplayer, questions


(John Andersson) #1

Okay. So I want to take it to the next level and incorporate some multiplayer action. Now what would you advise me to do, build a basic single-player version of the game (though taking the multiplayer aspects in consideration, in reality making a ā€œmultiplayerā€ game where only you play) with the core mechanics, then try to implement multiplayer gameplay? Or implement it from the beginning?

And is there any standard code I can use to easily make a multiplayer online game? Or do I have to buy anything? Iā€™m unsure on how to incorporate this with flashpunk


(Jean) #2

Well, the most basic thing that I can think is that you need to either get a good library or understand one or both of those class:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/DatagramSocket.html (UDP)

http://help.adobe.com/pt_BR/FlashPlatform/reference/actionscript/3/flash/net/Socket.html (TCP)


(MartĆ­ Angelats i Ribera) #3

Before anything else you must understand the difference between using TCP and UDP.

The basic difference is that TCP checks that every single bit of information was sended correctly. UDP, donā€™t. This also means that TCP is slower. Usually for things like text, TCP is used; and for video (like streams) is more usual the UDP (you donā€™t care if a pixel is slightly of another color).

Knowing that you have to choose one for your game and think a way of implement and sycronize the different clients.


(John Andersson) #4

Interesting. Iā€™ll read up on UDP and TCP right now! Do you know any good libraries I can use which would reduce the hassle of making my own library? I just want to make a basic multiplayer game where you have a character and kill other people


(Justin Wolf) #5

Hate to sound a dick here, but based on previous threads on this forum posted by you, Iā€™d recommend first really getting grips with FlashPunk (and AS3/OOP in general) before delving into networking, which is a complete other beast.


(John Andersson) #6

Well, thank you for your input :stuck_out_tongue: But I really want to learn networking now. I really want to make an online game


(MartĆ­ Angelats i Ribera) #7

I feel that i have to support @justinwolf here. Making a netcode is hard (well, a decent one). I feel like you donā€™t have the bases strong enogh to make this jump. Is like trying to build a skyscraper. You need solid bases to do it.

I know. You really want to try it out and i donā€™t know how big is the project you are making. But i think that it is way harder that you are expecting.

PS: But read some information about it will actually help you in the future :stuck_out_tongue:


(John Andersson) #8

You might be right, but I still feel like the answers could help more people than me. To be honest, my current game has a very solid foundation, I just run into some minor problems here and there (very basic problems). The only real issue where I am completely lost is with net code, since that is entirely new. I thank you both for your concerns and while they are with well intentions, I still will delve into netcode, since the whole purpose of the previous 5 months working on this game was to make it an online game :stuck_out_tongue:


(MartĆ­ Angelats i Ribera) #9

So again, you need to define a few things:

  1. Which protocol you want to use? (or a combination)
  2. Will you use a server or it will be p2p (the second option is way harder and may cause problems to the clients, but the frist you need to have a server).

(the usual anwers are TCP and having a server)

PS: The code for the server is different from the client, and can be done in another lenguage.


(John Andersson) #10

Okay. Iā€™ve read some more online and now I know the difference between UDP and TCP pretty well. It seems that most flash realtime multiplayer games use TCP, and to use UDP (especially with browsers) you have to work around a few things. All in all, Iā€™ll go with TCP.

Iā€™ll go with a server. :slight_smile: p2p


(Mike Evmm) #11

Though as @Copying said, using p2p can be hard and cause a myriad of problems, take a look at RTMFP, as the flash api for it is pretty great and fairly simply to use, especially in LAN connections. If anything itā€™ll get you acquainted with some networking stuff (which, as everyone already said, is pretty complicated stuff - way over my head at least - but you seem set!)


(Mike Evmm) #12

Oh, also FoxServer or something of the sorts? I remember they provided free servers for relatively small amount of traffic and had a Flash API too


(John Andersson) #13

So in general, would you advise me to finish the core basics of the game and then add online multiplayer, or do it from the start of the game? It wonā€™t be a complex game, it will be pretty simple


(Kyle) #14

I can relate to what you feel bro.

From my experience, I would suggest you finish the core basics first, then debug it cause debugging your core mechanics on a multiplayer version is a pain. So, get the core running in single player, debug and test it thoroughly. Then you can add multiplayer.

Also, this way you can easily see which parts of your game should be taken into account in terms of network latency once multiplayer is added.

But thatā€™s just a suggestion/advice :smile:


(John Andersson) #15

Great advice :slight_smile: Thatā€™s what I planned on doing. And Iā€™m gonna make some pretty good AI to get the feel for what playing with others will be like. I just love programming good, life-like AI :stuck_out_tongue: