Lead Developer, Stardock Entertainment
Published on September 24, 2010 By CariElf In Elemental Dev Journals

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.  

 

 

 

 

 


Comments (Page 3)
on Sep 25, 2010

The AI take all the computer's processing power, so it cannot accept your commands till the AI has made all its moves.

on Sep 25, 2010

Carielf, what's the point (in terms of amount of gamestate information) at which you have to ditch something like a client-server model and implement a simultaneous simulations model?

on Sep 25, 2010

I had no intention of "trolling," and am sorry if you saw it was an attack - I had no intention of attacking anyone, especially not personally, and I apologize if it came off this way.  I was, however, very put off by the way that Nikitosina approached the comment by calling server-client "old," and asking him why they aren't doing it his way.  If you are going to respond to a journal entry posted in that person's own free time, a certain amount of respect is due.

on Sep 25, 2010

FutileEmotion
I had no intention of "trolling," and am sorry if you saw it was an attack - I had no intention of attacking anyone, especially not personally, and I apologize if it came off this way.  I was, however, very put off by the way that Nikitosina approached the comment by calling server-client "old," and asking him why they aren't doing it his way.  If you are going to respond to a journal entry posted in that person's own free time, a certain amount of respect is due.

agreed but seems respect hath died here

on Sep 25, 2010

1SuperG

You wrote:

"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."

 

I actually had this happen to me and eventually I figured out what the problem was.  I had a "scout" unit set to auto-explore but he quit exploring when he ran into an AI border and could no longer advance.  I had to give him a move order before the game would let me continue.  If you check the left side of the screen at your list of groups you will probably see one that still hasn't moved waiting for an order.

on Sep 26, 2010

I don't even know HOW to use auto-scout, but maybe the guy I was playing with did. I'll check. Thanks!

on Sep 26, 2010

I checked, and he DID have a scout on Auto-Explore. Hopefully this opens a path for investigation with Stardock!

Thanks!

on Sep 26, 2010

Vhorthex



Quoting Heavenfall,
reply 22

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.


That "Game mode" is called "Turn Based". You know, like a Turn Based Strategy game?

Simultaneous turn, in my opinion, are a poor attempt to reflect RTS mechanics. The fact that you could retreat your unit before the other person has the time to select it, rather defies the concept of turn based strategy games. I'm not too found of timers either. All those things are incorporated to avoid grief and such, again, a semi reflection of competitive play and random peer matchmaking. All things that don't necessarily jive well with turn-based strategy games.


TBS have been using sim turns for years now. It works well and is NOTHING like RTS titles. If you think they play the same or are the same, i would suggest you are not playing very many titles from both genres MP style.

on Sep 26, 2010

how about this for the multiplayer:

The turns themselves are on timer (configurable)

but, there is no 'Pass' or 'End turn' button.

The time flows normally... you decide what to do with your time... move or wait and plan....

So if you want to sit and stockpile resources, just wait... 

if you want to move, attack, conquer, cast magic, you have an allotment of time (yes, real time)... 

That way, the server counts down, and then renews all resources at once... 

That will have to change your approach (server will not be able to determine who attacked who first - and resolve that, the clients will do that - Peer to Peer, with server only marking who won [died] and who is still alive at that location [giving the new attacker quite a surprise]).

That opens a lot of new possiblities, such as sneaking on opponents (if you have an invisibility spell.... ), waiting for the last second of a turn in order to ambush a weakened opponent after a series of fights and more... 

 

I find this idea very appealing and in the spirit of Elemental:War... 

What do ya think?   

on Sep 26, 2010

I hope I am wrong but I don't believe at all that online or even LAN multiplayer in this game will work at all. It will be hard to keep players committed to a game like this when they start losing. TBS tend to last a long time and having the losing side waiting to make just a couple of moves while the winning side plays its long rich and satisfying turn just never works in my experience (I have played games like this for 30 years, starting with cardboard wargames).

The only way I have ever managed to get this kind of games going was PBEM (Play By E Mail). I have played huge maps of "Age of Wonders" and "Age of Woneders Shadow Magic" for months, one turn each day. A player plays his turn then sends it to the other player who sends it to the next...

The way we made it work was as follows:

I would usually make a map then start playing. After about a couple of weeks of rounds I start another game with the same people so that we have two going at the same time, then another couple of week and I start a third one. Three is the good number usually.

That way after about 2 months of playing certain players start realizing that they are weaker then the others, but keep playing all games for several reasons:

1 They have other two games going where they hope they will be able to win.

2 The game where they are starting to lose start to be boring for them, but since their empire is smal (they are losing) playing their turns is not that time consuming.

Before they realize that they are condened and I am also going to win the next game the first game is over and a fourth has started. I can tell out of personal experience and years of testing (!!!) that SUCH SYSTEM WORKS. On the other end if we were playing at the same time, the losing side would have to wait an hour for me to end my turn, when they just have a couple of units left. NOBODY WOULD EVER DO THAT! And it would be embarrassing to me to enjoy myself while my friends are clearly bored.

This is a very important piece of info for the developers, I should make a specific post out of this.

 

 

 

 

 

 

on Sep 26, 2010

Black-Knight
I hope I am wrong but I don't believe at all that online or even LAN multiplayer in this game will work at all. It will be hard to keep players committed to a game like this when they start losing. TBS tend to last a long time and having the losing side waiting to make just a couple of moves while the winning side plays its long rich and satisfying turn just never works in my experience (I have played games like this for 30 years, starting with cardboard wargames).

The only way I have ever managed to get this kind of games going was PBEM (Play By E Mail). I have played huge maps of "Age of Wonders" and "Age of Woneders Shadow Magic" for months, one turn each day. A player plays his turn then sends it to the other player who sends it to the next...

The way we made it work was as follows:

I would usually make a map then start playing. After about a couple of weeks of rounds I start another game with the same people so that we have two going at the same time, then another couple of week and I start a third one. Three is the good number usually.

That way after about 2 months of playing certain players start realizing that they are weaker then the others, but keep playing all games for several reasons:

1 They have other two games going where they hope they will be able to win.

2 The game where they are starting to lose start to be boring for them, but since their empire is smal (they are losing) playing their turns is not that time consuming.

Before they realize that they are condened and I am also going to win the next game the first game is over and a fourth has started. I can tell out of personal experience and years of testing (!!!) that SUCH SYSTEM WORKS. On the other end if we were playing at the same time, the losing side would have to wait an hour for me to end my turn, when they just have a couple of units left. NOBODY WOULD EVER DO THAT! And it would be embarrassing to me to enjoy myself while my friends are clearly bored.

This is a very important piece of info for the developers, I should make a specific post out of this.

 

 

 

 

 

 

 

A number of TBS players play cooperatively with friends. When I play games like these, they can take weeks, even months. Nobody really cares when you are playing with people you actually know. Competitive is a different animal which is why I think the devs keep getting mixed signals.

on Sep 26, 2010

Agree with Nesrie.  I think there will be a lot of people satisfied by duplicating single player in multiplayer but with humans filling in for some of the AI.  If this is not happening for technical reasons its a bit easier to swallow.  If however it is purely a design decision to branch the development of the game into two completely different versions with different rules, tech trees, and maps, I think it's a mistake, or at least it's a mistake to not give players the option to choose which style of multiplayer they would rather play.

on Sep 27, 2010

me and my friends just want a regual mutilplayer like single player exprince just like you get with civizliation you know you get random map and every thing on it include placement is random with defualt start up with just your guy just like you do in single player with all magic and so forth same.

 

is that going to be allowed ?

 

if not then my friends see no reason to buy game we usally play games like this soly on the mutilplayer exprince with single player abilty so we can compete or run our own kingdoms in same world its why we like civ 4 so much.

on Sep 27, 2010

how about this for the multiplayer:

The turns themselves are on timer (configurable)

but, there is no 'Pass' or 'End turn' button.

The time flows normally... you decide what to do with your time... move or wait and plan....

So if you want to sit and stockpile resources, just wait... 

if you want to move, attack, conquer, cast magic, you have an allotment of time (yes, real time)... 

That way, the server counts down, and then renews all resources at once... 

That will have to change your approach (server will not be able to determine who attacked who first - and resolve that, the clients will do that - Peer to Peer, with server only marking who won [died] and who is still alive at that location [giving the new attacker quite a surprise]).

That opens a lot of new possiblities, such as sneaking on opponents (if you have an invisibility spell.... ), waiting for the last second of a turn in order to ambush a weakened opponent after a series of fights and more... 

 

I find this idea very appealing and in the spirit of Elemental:War... 

What do ya think?   

I like this idea.

It keeps every one engaged whilst providing a consistant pace.

on Sep 27, 2010

nvm.

Meta
Views
» 32379
Comments
» 53
Sponsored Links