I want to make a simple multiplayer game

Started by
22 comments, last by timothyjlaird 8 years, 8 months ago

I'm really interested in programming video games, but to be honest I've given it a try before(learning I mean) and I couldnt seem to figure anything out. From what I understand... you can do something with just some models(with animation clips) and simple scripts. I wanted to make a game similar to the "Worminator" game from the "Tornado Twins"(which you can check out on youtube(type in Worminator Tornado Twins.)

The first thing I want to do is get some models with animation clips. Then I want to create scripts for movement and animation and firing projectiles and getting hit by the projectiles and subtracting health and respawning. After that is all done I want to make it multiplayer.

If you check out the worminator game from the tornado twins you will see that the models in that video are not animated with animation clips... nor is it multiplayer. I think I can figure out how to make some simple scripts for movement and animation and the combat(which is basically just projectiles and getting hit and subtracting health and respawning.)

... but I don't think I can figure out the multiplayer. I was wonering if someone could just show me a simple way to make a game where the players can connect the host and be given their character.

Advertisement

If i were you. Which I'm not :). I would make a local multi-player game first. That is on the same computer. Some guys on console are "split screen" that is same device multiple controllers. I would try to make a game like that first before trying something higher level i.e LAN, global network games. The first games i made had to players take turns chasing each other. Another I made was similar to super smash bros with platforms. See what you can do with one computer first :)

Do you know what tools are you going to use to make the game? (what programming language/platform)

If the language/platform of choice has support for networking, youll be able to add multiplayer. Just make it work on a single machine first (eg 2 players controlled with same keyboard).

Multiplayer is then just a matter of establishing a connection between the 2 player machines either directly (one acts as host, other types host IP address to connect) or indirectly (there exists central server between the players) and synchronizing the game state between the players (A sends his position to B, B sends to A, you get the idea)

Multiplayer is however a very hard thing to do well, but you dont need to do it well if this is just for fun ;)

o3o

The basics of multiplayer are simple, it's just a matter of posting information somewhere, and retrieving it. Same as accessing a variable, except you do it with whatever your engine/systems commands are.

Some pseudo code:

variable: playerPosition

variable: enemyPosition

updatePosition( playerPosition) //sends the local player's position to a sever

enemyPosition = updateEnemyPosition() //gets the enemies position

positionObject( enemyPosition ) //places the enemy at the location retrieved.

of course, if you want it to work well, there's got to be more. lots more. Since you can't exactly retrieve the position every loop, you'll have to extrapolate where the enemy is heading, so you'll need the enemies's heading and speed and then calculate on the local machine where the player should be positioned. Of course when you get the updated position of the enemy, he might not actually be where you thought he would be. So now, do you just *blip* him over to the updated position, or average out the current predicted position with the actual position?

The second major consideration is trust. Do you trust that the players are actually sending the correct position data, or could they be using hacks? If they're using hacks, they could be reporting that they are moving super-fast or flying around. If you're doing a serious competitive game, this data is important, so the sever will need to have it's own program that can verify this data.

You mentioned projectiles. Same problems can occur with those. How do you know if the enemy player shot off a projectile if you can't update every loop? If you decide to skip on actual projectiles and make bullets instantly hit what they're targeting, who do u rely on for that data? The enemy ( who could be cheating so his program always reports hits) or do you want to write an algorithm that predicts when a player WOULD be hit, and then check if the enemy is reporting that he is firing his weapon (or had fired it between date-retrieval updates, and thus should have dealt damage)

Even with a very very simple example, multiplayer can become extremely complex, and this is just for a walking-shooting 1vs1 match.

So you're saying that when I play a match of Halo that all the player's positions are simulated? I'm sorry but I don't believe that.

So you're saying that when I play a match of Halo that all the player's positions are simulated? I'm sorry but I don't believe that.

A game is nothing but a simulation, so yes, every player position is simulated.
It sounds like your incredulity is actually about local extrapolation of player position on the clients in the absence of authoritative data from the server, though. But this is also a very true thing. Just about every multiplayer game involving real-time interaction (including Halo) will do this, because it provides a significantly improved sense of responsiveness than actually waiting for responses from the authoritative server.

Yeah I think the physics happens in real time

I think your first step would be to make the game single player first since to me it didnt seem you were that confident in doing that. Then move to making it a local multiplayer then maybe take it further
Animation part of your question...

Games typically use either skeletal animation (ie verts linked to bones and joints) or morph target animation (you store a copy of the verts for each frame of your animation and interpolate to fill the gaps). Of course there are lots of variants of the above and some games may use both.

Quake 3 arena uses morph target. Old technology yes. However its been around for a long time so the format is well documented and straightforward. And there are lots of models you can extract from the game and experiment with. I would start there.

Yeah I think the physics happens in real time

It happens in real-time, but it's also a simulation, simulations can accept real-time input. That input could be coming from a players mouse, or it could be coming from a file. There is still a simulation going on.

This topic is closed to new replies.

Advertisement