XNA network multiplayer

Started by
0 comments, last by lwm 9 years, 7 months ago

Hello!

I'm working on a platformer game atm and the idea of it is a focus on multiplayer. It's just a simple test project to understand the basics of game-dev. I have everything done for my game except multiplayer. As long as I know multiplayer in XNA is an issue and it is not that simple to make it work as I want it to. I did a brief search on the net and on the forum and found something called lindgren.

I have never worked with networking before and I have no idea what any of that means. Though I know how the networking works itself. Just can't code it yet. So I have searched about lindgren and didn't find any tutorials about connecting it with XNA or how it works at all. I would really appretiate if anyone could give me a hint on how it all works.

How to handle the camera and matrixes? How to handle controles and how to send messages through the network?

I am almost sure that there are some issues I need to know about programming the network connection. And I would really love to hear from someone that has already done it before with XNA. Thank you for your attention.

Advertisement

I have used Lidgren.Network for multiple projects (the earlier ones with XNA) and it handles the sending/receiving messages part of networking very well. The tutorials on the google code page should be enough to get that part working.

What data you put into those messages is completely up to you however and depends heavily on the type of game you're creating. A good first step is to simply make the clients send their current input state to the server, let the server run the simulation and send the new state back to the clients. Since you probably can't do this every single frame, the clients will have to do some inter-/extrapolating to keep the graphics smooth.

One thing I found very helpful is to cleanly separate the client into to parts: A networked simulation that is always as up-to-date as possible but may exhibit all sorts of weird effects such as jittery or teleporting objects. The other simulation is used for rendering and simply tries to smoothly converge towards the networked state so that none of the weird effects are visible to the player.

Networking is all about faking it.

current project: Roa

This topic is closed to new replies.

Advertisement