Map Database  •  FAQ  •  RSS  •  Login

KaM Remake -> Multiplayer Demo out!

<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 13 Apr 2011, 18:12

If you see me online and have time then please chat to me, hopefully I'll be available too. If I'm not online send me an email and we can arrange a time. I'd really love to work out a new and improved AI system for KaM, mainly around how they use troops.
Okay I will. :)

@Ben: I think it should be like the alliances: if both players click the 'allied' option, they are allies. If both players click the speed option, the game will go faster. If only one of the players has put it on, nothing will happen.
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

Location: California - Pacific Time (UTC -8/-7 Summer Time)

Post 13 Apr 2011, 20:47

Good idea! So in a way, there would be a lock for speed, only making everyone happy :D

This should, for sure, be in the remake.
I used to spam this forum so much...
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 16 Apr 2011, 16:01

Hi guys,
I just wanted to let you know that we've been working on mutliplayer, and today I gave it a really good test. With my brother and two friends (and their computers) we tested multiplayer in the Remake with 4 players!! The game ran perfectly for 10 minutes (we compared screens to make sure everything matched exactly) we had battles and built a few buildings, it all worked really well. After 10 minutes an error occurred and the game locked up. We played a few more games and each time it eventually had an error of some sort that meant we couldn't keep playing. But these bugs will be hunted down and fixed, mark my word. Part of the problem I think is that we are using raw UDP with no packet loss or error detection. There are far fewer bugs when playing with two copies of the game on one PC than with multiple PCs because there are no errors over the loopback interface. I am going to implement these features hopefully soon, because at the moment losing a single packet means the game stops. We decided not to use TCP because I have heard there is a lot of overhead and it is slower/less efficient. UDP with custom error/loss checking will be much more efficient.
The main point is that the high level multiplayer code to transfer commands and execute them at exactly the same time works almost perfectly. On each PC everything appears identical.

It felt really amazing to see our work running so well on so many computers. I've never been able to say to my friends "Lets play the game that *I* helped make today!" On Tuesday I'm going to a LAN party so I'll see if I can get an 8 player game working! (8 is currently our maximum although we plan to extend it) I'll try to get some of the bugs fixed before then...

In other news, we have a new guy helping us write code! He's still learning but has done well so far. He is interested in Linux and so is trying to make the Remake compile on Linux in Lazarus. He's also writing a new unit.dat editor to edit unit statistics (similar to Merchator's)

I hope that in a month or two we will be able to release a multiplayer demo :D We'll also allow for AI in multiplayer which means you could design interesting co-op missions, for example 3 players could siege a well fortified AI in a castle. The possibilities are endless.
At the moment there is no speedup in multiplayer. The Dark Lord's idea sounds okay, we'll discuss it further when the time comes.
Lewin.
P.S. Just in case you don't believe me, :wink: here are some screenshots of a multiplayer game running on one computer: (I meant to take photos with the 4 computer setup but I forgot)
http://lewin.namsys.com.au/kam/Temp/MP1.jpg
http://lewin.namsys.com.au/kam/Temp/MP2.jpg
http://lewin.namsys.com.au/kam/Temp/MP3.jpg
http://lewin.namsys.com.au/kam/Temp/MP4.jpg
http://lewin.namsys.com.au/kam/Temp/MP5.jpg
http://lewin.namsys.com.au/kam/Temp/MP6.jpg
http://lewin.namsys.com.au/kam/Temp/MP7.jpg
<<

xzaz

Barbarian

Posts: 105

Joined: 28 Jul 2009, 22:00

Post 16 Apr 2011, 16:54

Awesome work guys realy nice!! Props here!
Maby here is something you didn't think of. If the host selects a map that is not available on the other clients will the map automaticly be downloaded from the server to the clients?
Just my 2 cents!
Again guys, very very good work :)
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 16 Apr 2011, 20:52

That's really amazing! It's stunning how fast everything progresses. I expected it to take years, but if you keep it up like this it will be much less. :)
I'm looking forward to see the AI implemented!

(Oh and about that: monday I'll try to talk to you on msn)
<<

Siegfried

User avatar

Knight

Posts: 494

Joined: 24 Jul 2009, 22:00

Post 17 Apr 2011, 20:13

We decided not to use TCP because I have heard there is a lot of overhead and it is slower/less efficient. UDP with custom error/loss checking will be much more efficient.
The main point is that the high level multiplayer code to transfer commands and execute them at exactly the same time works almost perfectly. On each PC everything appears identical.
Hmm, per se this is not always correct. The "large" overhead comes into play on establishing a connection between two computers. For that case, some packets have to be sent and received. But if you use keepalive, this has to be done only once - when entering the game. The connection can be kept open, so practically no more overhead is needed except the keepalive packets which should not interfere with your network load.

When the connection is established, the difference in header length is only 12 bytes (TCP/IP over Ethernet: 54 bytes minimum, UDP/IP over Ethernet: 42 bytes minimum; each depending on network configuration, not counting gaps).

The payload for each packet is slightly lower than 1460 bytes. But if you need the correct order of incoming packets (if you transfer the commands), then you will need to send at least two int numbers (probably 4 bytes each), thus reducing the overhead size advantage of UDP once more.

On the backside, you have to implement an error correction algorithm for catching the arriving problem, which may be very buggy. So why not use the well-tested TCP-stack of your OS in the first place?

The reason why most (Ego-Shooter) games use UDP is, because they send the current status update of the player rather than the commands. The whole status usually cannot be sent each time because this probably is too large, so only the updates are sent and the whole status is synchronized only once a while. If one packet is not acknowledged to have arrived, the next UDP-packet sends the current status update plus the not-arrived status update, which means larger packets. With TCP you don't have to write this kind of algorithms.

In the real world, TCP with high-latency and/or bad connetions could cause anything from slight to heavy lags because TCP will try to resend each lost packet until the arrival is acknowleged.
With UDP you won't see this as an effect of packet loss, but it's completely up to your skill of writing error catching algorithms. If you have a good idea on this, UDP may be the best choice. If a command packet is lost and the client has to wait until the synchronizing packets arrived, a huge lag could appear and completely alter the game status.

If you really send the commands only, I would consider picking TCP.
If you have fun in the challenge of developing a good error catching, then go with UDP :)
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 21 Apr 2011, 08:30

Maby here is something you didn't think of. If the host selects a map that is not available on the other clients will the map automaticly be downloaded from the server to the clients?
Eventually yes. But that's low priority and a long way off at the moment.
If you really send the commands only, I would consider picking TCP.
If you have fun in the challenge of developing a good error catching, then go with UDP
Thank you very much for your informative post Siegfried! I have discussed it with other people and decided that you are right. We need all packets to be delivered and to arrive in the right order. I was planning to write something in UDP to do that but you are right, it will be hard and possibly buggy. TCP makes more sense. I've also realised that if we want this to work over the internet then we need to have a central host that every player connects to. At the moment each player sends packets to every other player using UDP. But over the internet that would require everyone to have ports forwarded in their firewall. (i.e. an open connection to the internet on that port) My idea is that the host should have ports forwarded, but no one else needs to. Players will join the game by connecting to the host, and all data will be transferred through them. This also means we can run a dedicated server on the internet. I'm sure there are people who would be happy to offer that as a service. However, for this to be possible we MUST use TCP. UDP does not have a return route to receive data unless the firewall is opened. A TCP connection only requires the host to have an open connection and it provides a "pipe" for us to transfer data both ways.

The main thing I have realised is that whichever system we choose, it won't make it any better on a LAN. On a LAN almost all packets are delivered and the almost always arrive in the right order. Overhead doesn't matter because we can use 100 mb/s and no will care. The delays will be <1ms so efficiency doesn't matter either.
We need to plan and make decisions for the slow and unreliable internet, because the LAN will work either way. TCP makes more sense on the internet.

Once again thanks for your great help, I really appreciate it.
Lewin.
<<

Danjb

Sword Fighter

Posts: 288

Joined: 14 May 2007, 22:00

Post 10 May 2011, 18:19

This sounds great! Amazing job :D
<<

Krom

User avatar

Knights Province Developer

Posts: 3282

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 11 May 2011, 16:28

Thanks, we keep on working :)
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Danjb

Sword Fighter

Posts: 288

Joined: 14 May 2007, 22:00

Post 11 May 2011, 23:53

Hehe, and I keep on checking back :wink:

I really do support you guys, I know this forum doesn't see a lot of action but to be honest, without you guys it would be totally dead. Thanks for keeping KaM on the radar!

On another note, if there's ever anything I can do practically to help, I'd be happy to give it a shot. I've never used Delphi or done any network programming or anything as complicated as that, but I'm a budding first year computer scientist and I've been programming in my spare time for years. Just if you can think of any suitable jobs, I'm here if you need me!
<<

Krom

User avatar

Knights Province Developer

Posts: 3282

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 14 May 2011, 20:00

Thanks for support! Take a look at our source code, perhaps it interests you. Or tell us what you would like to do?

Today I finished rewriting core network code to TCP and we had a test session over Hamachi between 4 players from different cities of Russia. Everything went nice, we had a small fight, found couple of bugs and desync/freeze after several minutes of gameplay :)

Work goes on!
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

Danjb

Sword Fighter

Posts: 288

Joined: 14 May 2007, 22:00

Post 15 May 2011, 16:56

No problem :)

I have exams at the moment but in the summer I'll try and have a good look at the code.

Had another go at the fighting demo today - really amazing progress!
<<

battleshooter

Post 09 Jun 2011, 09:39

Awesome!

Just found this place today, I didn't know there was a KaM remake in process, I loved this game! It was the bomb :D

Still reading up on what you guys are doing, but what I've read so far sounds awesome, so glad this game is having work done on it...woohoo!

Battleshooter
<<

Kridge

User avatar

Crossbowman

Posts: 201

Joined: 25 Dec 2010, 23:00

KaM Skill Level: Fair

Location: Netherlands (GMT+1)

Post 09 Jun 2011, 12:56

And this isnt the only Remake...

:D
´Kridge`
<<

battleshooter

Post 10 Jun 2011, 11:57

And this isnt the only Remake...

:D
Really? I'll have to Google them :)

Battleshooter

Return to “Feedback / Discussion”

Who is online

Users browsing this forum: Amazon [Bot] and 2 guests