The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

About multiplayer

By on September 24, 2010 1:45:02 AM from Elemental Forums Elemental Forums

It's been awhile since I've written a dev journal and we've got some new faces around here, so I'll take the opportunity to introduce myself. I'm Cari Begle, and I'm Stardock's Senior Game Designer and the programming lead on Elemental.  I've been working here at Stardock for 10 years.  

Today I'm going to talk about Multiplayer.  I'll start with a quick rundown of the features for the people who haven't tried the beta,  and then get into some techie talk for those of you who like to peek under the hood.

Elemental is true client-server where we host the servers, rather than the host player's machine acting as the server (which is a modified version of peer to peer) or true peer to peer where all the clients are connected to each other.  This means that shouldn't need to open ports, and if the host player drops, the server picks a new host and the game can continue.  

There are two multiplayer modes: quick match and custom games.  In quick matches, you choose either 1 v 1 or 1 v AI, pick your sovereign and faction, and you will be matched with another player on a randomly chosen map. In custom games, the host picks the world settings and how many players and then waits in a lobby for other players to join by clicking on the game entry in the available games list.  

With 1.09, we're enabling multiplayer save games for custom and 1 v AI games.  Only the host can save, and the game also auto saves periodically. The save games overwrite, so there is only ever one save per game, and if a host player quits or disconnects before the end of a game and the new host saves the game, the original host's save game is removed so that the new host is the only one with a save for that game.  Save games are also automatically removed when the end game results are posted.  Save games are saved to the cloud, so they can be loaded from any computer as long as you're logged in as the player who saved it.  

In order to help you out at the beginning of a multiplayer game, you start with a spouse.  Also, all the multiplayer maps have gold and fertile land placed around the starting locations of the players.  If you let the game pick the map randomly, it will attempt to pick one that has enough starting location for all the players, but if you open up additional slots you may need to return to the world setup screen to pick a new map.

All battles are instant battles like in Civ5. We won't be enabling tactical battles in multiplayer until after they've been revamped.

To chat, hit the quote/single quote key.  Currently, it only supports chat to all because I need a better dialog for it with tabs or something. 

Multiplayer is interesting to code because you can't simply do something, you have to send a message and wait for the response so that all the clients stay in synch.  This means that you can't code linearly, and you have to handle not receiving a response.  It's much like programming a multi-threaded application, except slightly more complicated because you're sending and receiving data from other computers, not just other threads.  It requires you to think a different way when writing your code, and unfortunately most schools don't really do a good job of teaching this, even the game development schools like Digipen and FullSail.  At least the graduates from game dev schools generally have more practical programming experience than schools with a traditional computer science degrees.   

Say you want to move a unit to a notable location.  If you were only concerned with single player, you'd simply translate the coordinates of the right mouse click to world coordinates, set the destination so that the unit can calculate a path, and boom, it starts moving as soon as the path is calculated.  In multiplayer, there are more concerns.  

To start with, every object in the game that is not purely cosmetic has to have the same ID as the corresponding object on the server and other clients so that it can be identified.  This allows us to send events which can originate either on a client or the server with the data needed to perform the desired action, and an identifier in the event to indicate what the action is.  When the event is received by the server, it processes it and either marks the event as failed or succeeded and in most cases forwards it to the clients to be processed. In some cases, like when the player requests a new turn, we just want to notify the server and not forward the message to the other clients.  Then when all the players have requested a new turn, the server sends out an event notifying the clients.  When the server or clients receive an event, they use the data stored in the event to access the objects that sent the event and perform the action that was requested.

For example, if Unit A attacks Unit B, I create an Attack event and store Unit A's ID as the attacker and Unit B's ID as the defender.  The event is converted to a block of bytes and sent out to the server.  The server restores the event from the block of bytes and gets pointers to Unit A and Unit B.  If unit B isn't already dead from a previous attack, the server performs the attack and stores the results in the event, which it forwards to the clients.  The clients receive the event, get pointers to A and B, and process the battle results (brings up the results screen, levelupwnd, etc). Now, since turns are simultaneous, it's possible that Unit C may have also tried to attack Unit B but was a little slower and so its event arrives on the server second.  If Unit B is already killed, the server simply marks the event as failed and forwards it on to the clients so that they can handle the failure.  Otherwise, the event is processed normally.  

Well, I've stayed up working on this journal later than I intended, so I'm going to call it a night.  

 

 

 

 

 

+52 Karma | 53 Replies
September 24, 2010 2:30:27 AM from Elemental Forums Elemental Forums

Thanks for the lection of old client-server technology. Why don't you run dedicated multiplayer server like battle.net but smaller? Give me your thoughts about this.

September 24, 2010 2:48:36 AM from Elemental Forums Elemental Forums

Nikitosina, even battle.net uses a client/server relationship, and I know WC3 (not sure about SC2) uses one of the clients as a host.    Even if Stardock hosted the actual game (and not just as a cloud/connection service), they would still have to code the gameplay the same way.  Theres just no avoiding sending and receiving data.


I'm really looking forward to playing some big games with friends online, and I'm glad it will be possible to save and load.  Cheers on the hard work, and keep us posted!

September 24, 2010 2:58:06 AM from Elemental Forums Elemental Forums

Now, since turns are simultaneous, it's possible that Unit C may have also tried to attack Unit B but was a little slower and so its event arrives on the server second.

Correct me, if I taken something wrong: so we speak now about simultaneous multiplayer? Not true turn-based, as offline game is?

September 24, 2010 3:23:25 AM from Elemental Forums Elemental Forums

Nikitosina, even battle.net uses a client/server relationship, and I know WC3 (not sure about SC2) uses one of the clients as a host. Even if Stardock hosted the actual game (and not just as a cloud/connection service), they would still have to code the gameplay the same way. Theres just no avoiding sending and receiving data.

Hi Troll,

Thanks for another lection of client server tech Read my question once again please and think about what you have answered. You cannot avoid client-server and i'm not asking to do that. I'm asking for Dedicated server solution and the reason why it is discarded.

September 24, 2010 5:08:22 AM from Elemental Forums Elemental Forums

I have a question about how multiplayer, licences and Impulse interact.

I have Impulse on two machines at home on a network, I switch between them a bit depending on who in the house is using the other, so I have Elemental on both under the one Impulse account which is OK as per the licence agreement (yes, I actually read the thing, legalese and all ).

 

Anyway, the question is, can I play against one of the kids with the one copy of the game? This works fine for Sins, and is part of the licence agreement for that game.

September 24, 2010 5:15:23 AM from Elemental Forums Elemental Forums

Quoting Nikitosina,

Nikitosina, even battle.net uses a client/server relationship, and I know WC3 (not sure about SC2) uses one of the clients as a host. Even if Stardock hosted the actual game (and not just as a cloud/connection service), they would still have to code the gameplay the same way. Theres just no avoiding sending and receiving data.
Hi Troll,

Thanks for another lection of client server tech Read my question once again please and think about what you have answered. You cannot avoid client-server and i'm not asking to do that. I'm asking for Dedicated server solution and the reason why it is discarded.

 

wow. relax.

Do you even know what a troll is?

September 24, 2010 5:21:45 AM from Elemental Forums Elemental Forums

Quoting Nikitosina,
Thanks for the lection of old client-server technology. Why don't you run dedicated multiplayer server like battle.net but smaller? Give me your thoughts about this.

I think that's what they just said they do. The servers are in the cloud, we only connect to them.

Personally I'm looking forward to custom games with more AIs in them!

September 24, 2010 5:32:26 AM from Elemental Forums Elemental Forums

Thanks for the update.

I hope multiplayer won't suck up too much of your resources.

The main thrust of the game is single player and their are still bug fixes (out of memory crashes), ui improvements, ai improvements and balancing issues + magic system improvements + combat system improvements that need to be done. I hope those areas get the most focus going forward.

September 24, 2010 8:10:51 AM from Elemental Forums Elemental Forums

Quoting SmilingSpectre,

quoting postNow, since turns are simultaneous, it's possible that Unit C may have also tried to attack Unit B but was a little slower and so its event arrives on the server second.

Correct me, if I taken something wrong: so we speak now about simultaneous multiplayer? Not true turn-based, as offline game is?

Your example was battle.net which has always been a peer to peer matching service more than any sort of dedicated server.  )I don' tknow how the newest incarnation works)

September 24, 2010 8:11:09 AM from Elemental Forums Elemental Forums

Any plans for supporting PlayByEmail?

September 24, 2010 10:21:45 AM from Elemental Forums Elemental Forums

sounds like excellent work is being done.

September 24, 2010 11:32:58 AM from Elemental Forums Elemental Forums

Quoting Nikitosina,
Thanks for the lection of old client-server technology. Why don't you run dedicated multiplayer server like battle.net but smaller? Give me your thoughts about this.

We are using dedicated servers. All players connect to one of our servers, and the first one to connect to the server is designated the host. 

Quoting SmilingSpectre,

quoting postNow, since turns are simultaneous, it's possible that Unit C may have also tried to attack Unit B but was a little slower and so its event arrives on the server second.

Correct me, if I taken something wrong: so we speak now about simultaneous multiplayer? Not true turn-based, as offline game is?

No, it's the same method as the SP. All the players move their units at the same time, but to get additional moves the players have to request a new turn.

Quoting trcanberra,
I have a question about how multiplayer, licences and Impulse interact.

I have Impulse on two machines at home on a network, I switch between them a bit depending on who in the house is using the other, so I have Elemental on both under the one Impulse account which is OK as per the licence agreement (yes, I actually read the thing, legalese and all ). 

Anyway, the question is, can I play against one of the kids with the one copy of the game? This works fine for Sins, and is part of the licence agreement for that game.

Not currently, because each player has to have an Impulse account that is tied to an Elemental serial.   However, I believe that we are still planning on adding the ability to create multiple characters per Impulse account so that people can do things like play with their kids or use an alternate character to test a new mod, etc.

Quoting UltimateElemental,
Thanks for the update.

I hope multiplayer won't suck up too much of your resources.

The main thrust of the game is single player and their are still bug fixes (out of memory crashes), ui improvements, ai improvements and balancing issues + magic system improvements + combat system improvements that need to be done. I hope those areas get the most focus going forward.

Yes, even now most of the team is working on these areas.

Quoting riadsala,
Any plans for supporting PlayByEmail?

No, we will not be supporting PBEM or hotseat as they're not compatible with simultaneous turns.

September 24, 2010 12:12:22 PM from Elemental Forums Elemental Forums

I'm confused. Why play an online match 1 vs AI? I consider multi-player to be when more than one human is playing the game. It just seems like a weird option. Is the AI going to be different?

 

September 24, 2010 12:36:49 PM from Elemental Forums Elemental Forums

Quoting CariElf,
No, we will not be supporting PBEM or hotseat as they're not compatible with simultaneous turns.

Out of curiousity, how much trouble would it be to add non-simultaneous turns for non-online games? (As a note it does not matter right now that turns are simultaneous right now ast the AI makes all its moves at once, leaving only the player to move things)

September 24, 2010 1:10:28 PM from Elemental Forums Elemental Forums

Quoting impinc,
I'm confused. Why play an online match 1 vs AI? I consider multi-player to be when more than one human is playing the game. It just seems like a weird option. Is the AI going to be different?

Currently, multiplayer games are the only ranked games, so 1 v AI allows players to try out multiplayer and gain ranking without having to jump into an all human game immediately, much like League of Legends has you play test games before you can play against/with other humans. 

Quoting Gwenio1,
Out of curiousity, how much trouble would it be to add non-simultaneous turns for non-online games? (As a note it does not matter right now that turns are simultaneous right now ast the AI makes all its moves at once, leaving only the player to move things)

It'd be a pain.  The code to allow simultaneous turns is actually simpler than keeping other players waiting while one player moves. 

 

September 24, 2010 1:33:16 PM from Elemental Forums Elemental Forums

Since you brought up pain...

 

This 10 second timer thing either needs to be per game adjustable or needs to go all together. If another player simply wants to hit "Next Turn" and I'm trying to stage several events, I'm hosed if I can't make everything happen in 9 seconds.

 

Also, I got locked up in my game where I couldn't end a turn at all. I could click on all sorts of things, but I could NOT progress the turn. 20 minutes later, I just quit. I don't know if somebody clicked "next turn" while somebody was moving or what, but it was pretty frustrating.

Any ideas?

September 24, 2010 2:27:45 PM from Elemental Forums Elemental Forums

[quote who=
Quoting riadsala, reply 10Any plans for supporting PlayByEmail?
No, we will not be supporting PBEM or hotseat as they're not compatible with simultaneous turns.[/quote]

 

that's a real shame, as that's the one type of multi-player I'd be interested in for a game like this.

 

 

September 24, 2010 2:35:08 PM from Elemental Forums Elemental Forums

Simultaneous turns are way too important to sacrifice for something like hotseat, in my opinion. I used to HATE trying to play heroes of might and magic and ragequitting after 20 minutes because 10 of those were spent waiting.

September 24, 2010 2:44:13 PM from Elemental Forums Elemental Forums

That's like getting up and kicking over the chess board because it's taking to long for the opponent to strategize....

I understand some people want a fast game, sometimes I do too, but I'd rather see people given enough time to think out their moves a bit more.

September 24, 2010 2:54:37 PM from Elemental Forums Elemental Forums

Quoting Heavenfall,
Simultaneous turns are way too important to sacrifice for something like hotseat, in my opinion. I used to HATE trying to play heroes of might and magic and ragequitting after 20 minutes because 10 of those were spent waiting.

Which is the great thing about PBEM, you can go play another game while waiting for them to take their turn.

September 24, 2010 3:28:09 PM from Elemental Forums Elemental Forums

Quoting 1SuperG,
Since you brought up pain...

 This 10 second timer thing either needs to be per game adjustable or needs to go all together. If another player simply wants to hit "Next Turn" and I'm trying to stage several events, I'm hosed if I can't make everything happen in 9 seconds.

Also, I got locked up in my game where I couldn't end a turn at all. I could click on all sorts of things, but I could NOT progress the turn. 20 minutes later, I just quit. I don't know if somebody clicked "next turn" while somebody was moving or what, but it was pretty frustrating.

Any ideas?

We are planning on making the timer adjustable.

I'm trying to track down the turn button won't won't work thing. Usually it can be 'fixed' by putting one of your units on guard or hitting pass.

September 24, 2010 3:37:25 PM from Elemental Forums Elemental Forums

Quoting 1SuperG,
That's like getting up and kicking over the chess board because it's taking to long for the opponent to strategize....

I understand some people want a fast game, sometimes I do too, but I'd rather see people given enough time to think out their moves a bit more.

The two are not mutually exclusive. The turns should be simultaneous, but the time should be generously adjusted so that if you want time to think, you can.

It's not about taking something away from the individual, it's about saving time for everyone. If you've got a multiplayer game with 5 people that each use 10 minutes for their turn, one turn can either take 10 minutes or 50 minutes. There it is, the best reason in the world never to ditch simultaneous turns. How many players does Elemental theoretically max out at? 16?

As far as I am concerned, I wouldn't even call a computer game without simultaneous turns multiplayer. Only one person is playing at a time. That's how terrible I think that "game" mode is.

September 24, 2010 3:59:17 PM from Elemental Forums Elemental Forums

Ok, then we're on the same page. I'm all for everyone being able to plan out at the same time, I just don't want to be tied to another players decision to pass.

September 24, 2010 4:16:14 PM from Elemental Forums Elemental Forums

I haven't tried out the multiplayer yet CariElf. I admire the balance you applied to the game,but once I saw I can't use my Gandalf character I was saddened. Glad I read you balanced out the maps that was one of my concerns. The Battle of getting out MP is over,mastering it for everyone's enjoyment has just begun(from what I read).

One thing I admire about your staff is you guys do these journals almost everyday to tell people whats going on. I don't see that everywhere. And I think if you guys keep this up,pour out updates stay alive from the criticism from "some" harsh forum crowds who always want more;this game Singleplayer and Multiplayer will be a great gaming experience.

I am being a little optimistic,but you guys did a great job in Sins gl hf

September 24, 2010 4:45:35 PM from Elemental Forums Elemental Forums

Turns should have a minimum amount of time before the timer can activate unless everyone has hit end turn.

Stardock Forums v1.0.0.0    #108435  walnut2   Server Load Time: 00:00:00.0000437   Page Render Time:

Stardock Magazine | Register | Online Privacy Policy | Terms of Use

Copyright ?? 2012 Stardock Entertainment and Gas Powered Games. Demigod is a trademark of Gas Powered Games. All rights reserved. All other trademarks and copyrights are the properties of their respective owners. Windows, the Windows Vista Start button and Xbox 360 are trademarks of the Microsoft group of companies, and 'Games for Windows' and the Windows Vista Start button logo are used under license from Microsoft. ?? 2012 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo and combinations thereof are trademarks of Advanced Micro Devices, Inc.