Advertisement

The hardware and server

Started by November 30, 2015 06:55 PM
8 comments, last by roblane09 9 years ago
Hi,now that we got that out of the way here's the problem:I want to make a multiplayer game,fair enough,II did my researching (documentation),now I am about to make a educated guess using the things I think I know so don't tare me into shreds for not being right,pls. So,from what I see the player needs to request a action from the server to be able to achieve that action,right?There are a lot of tutorials out there that teach you about making a single player game but can you use that code and attach the networking component to it in order to make it functional online?Or do you have to use a code that is created for multiplayer?
that strongly depends on the genre. some card game could get multiplayer at a later stage, rts should run like multiplayer internally even if it's just a singletree game ;)
Advertisement
Adding multiplayer after the fact is exceedingly difficult.

It's far, far, far easier to go the other way and add a singleplayer mode to a multiplayer game. Many games intended for both are built that way outright, in fact, and the singleplayer mode just embeds the server logic into the main game loop or runs it in parallel on another thread.

The reason for this - even with a TCG - is more about keeping your design "honest." In a purely singleplayer game you can structure your code in lots of ways that isn't amenable to multiplayer. Coding for multiplayer up front explicitly ensures that everything you write is going to work for a client-server game.

Yes, you would structure a game like a TCG with a basic request-response pattern for performing actions. Anything that affects the game must be a request to the server, esp. if your game plans to be competitive or focus on collectability. The basic flow involves clicking some card/button, sending a request to the server, letting the server calculate the result, and then getting a response indicating what happens. This is complicated by the need to play animations and keep the gaming feeling smooth and responsive even though the request/response may take a significant fraction of a second (esp. in a card game where the full response may in fact require waiting on the enemy player/AI to make a choice).

Sean Middleditch – Game Systems Engineer – Join my team!

So Ipif I make something like team fortress 2 I can't use the things that I see in a single player game?
For example selecting a weapon?

What kinds of projects have you worked on so far?

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

So Ipif I make something like team fortress 2 I can't use the things that I see in a single player game?
For example selecting a weapon?

No, that is not the case. While I won't restate the information from the other posts above me, what it summarizes to is that you can do these types of things; i.e., weapon selecting, but you need to account for it in a networked environment. In a single player game it is enough to say, 'we picked up a weapon, change out the current one, update what needs to be updated, etc.' In a multiplayer game, not only do you have to do all of that, but you also need to send information to the server so that all other clients connected to the server can update their logic as well. This way, if you are one of multiple clients connected to a server and you change out your weapon, all of the other clients can reflect your weapon change on their end.

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is objectively shit." - L. Spiro

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

"The 'friend' relationship in c++ is the tightest coupling you can give two objects. Friends can reach out and touch your privates." - frob

Advertisement

What kinds of projects have you worked on so far?

0 :(

So Ipif I make something like team fortress 2 I can't use the things that I see in a single player game?
For example selecting a weapon?


No, that is not the case. While I won't restate the information from the other posts above me, what it summarizes to is that you can do these types of things; i.e., weapon selecting, but you need to account for it in a networked environment. In a single player game it is enough to say, 'we picked up a weapon, change out the current one, update what needs to be updated, etc.' In a multiplayer game, not only do you have to do all of that, but you also need to send information to the server so that all other clients connected to the server can update their logic as well. This way, if you are one of multiple clients connected to a server and you change out your weapon, all of the other clients can reflect your weapon change on their end.

So cold I let's say look at a tutorial that shows me how to change the weapon in single player and then add the networking onto the single player code or do I need to write in code that applies only to multiplayer?(please have patience)

So Ipif I make something like team fortress 2 I can't use the things that I see in a single player game?
For example selecting a weapon?


No, that is not the case. While I won't restate the information from the other posts above me, what it summarizes to is that you can do these types of things; i.e., weapon selecting, but you need to account for it in a networked environment. In a single player game it is enough to say, 'we picked up a weapon, change out the current one, update what needs to be updated, etc.' In a multiplayer game, not only do you have to do all of that, but you also need to send information to the server so that all other clients connected to the server can update their logic as well. This way, if you are one of multiple clients connected to a server and you change out your weapon, all of the other clients can reflect your weapon change on their end.

So cold I let's say look at a tutorial that shows me how to change the weapon in single player and then add the networking onto the single player code or do I need to write in code that applies only to multiplayer?(please have patience)


Ou,OK So I can write in the code that applies to single player but now I need to build upon it by doing the networking needed.That makes sence

If you have not worked on any game projects I would recommend something very simple to start with.

Recently I created a trading card game prototype using Unity, and this prototype uses peer-to-peer networking. A card game is fairly straight forward, be able to move cards, interact with some interface elements using the mouse, nothing too complex. However had I not considered needing to send "events" and "messages" to a peer when thinking up my architecture, networking would have been a disaster.

Even for this simple card game, more complex issues needed to be considered. Issues like, how do I send complex objects over the wire so they can be "reassembled" and used by the peer? Learning how to use the underlying API, be it Unity or native Windows or whatever, is maybe half the battle here (probably less than). Creating an architecture that can use that API successfully is a challenge that really depends on "what you are doing".

If you have never written a game in your life, then consider taking that on first, something like Pong. Understand what it takes to get a game going locally before you tackle networking, at least that's how I've gone about it.

"this feature will ship in version 1.0 for sufficiently large values of 1."

This topic is closed to new replies.

Advertisement