Long running RTS game multiplayer considerations - language-agnostic

I'm working on a real-time space strategy game clone which at its time did not have any multiplayer option. I want to add multiplayer to it.
The gameplay itself is relatively long: about 10-15 hours of gameplay needed for complete a playthrough. This is very long and I don't want to force the players to play it uninterrupted or lose the game state due crash/power outage.
How do similar games solve this kind of problem? Save multiplayer game just like a singleplayer game?
In singleplayer mode, the player can pause and accelerate the simulation time (In pause mode, the player is still able to issue orders, build on planets, etc.).
How can this feature be translated into the multiplayer mode?
Let's assume there are more than 2 players (additional AI or human players) and one player attacks the other which switches the game into space/ground battle. These battles can be paused as well to issue orders.
What should happen with the other non-involved players? Should they wait? Should they be forced to operate only in their own kingdom?
Update: Just some details about the game.
I'm cloning this game. The clone is released as open source, therefore, its likely someone will create a cheating version. This is an issue but not that important now. I think I solve it by moving the game state and control between the players: first it runs on the first player's machine, then moves to the second etc.
I would like to put more emphasis to the third question above:
What should the other players do when two are engaged in a battle?
Battles are fought on different screen as the kingdom management screens. In single player mode, the battles automatically stop the game world and neither the player, nor the AI is able to manage its kingdom during the battle.

History shows that any feature that allows players to interact on the meta level will be abused beyond what possible good it might serve.
Perhaps it is possible to have the players agree beforehand on a "game plan", like "4x 4 hours on consecutive days" or "3x 5 hours on wednesdays".
The problem seems to be largely identical with WoW Raids: Get X players together to do something realtime-ish, which is longer than typical game time on one day, with multiple sessions within one week. This of course involves a leader role, hot seats, saving to a spot etc. This is hard enough to do, and all these people are working together!
If someone sees they´re off to a bad start on the first 3 hours, how can you expect them to come back to suffer 12 more hours? Well, have the quitter lose? This means collusion, you win one for me, I win one for you. (2 players win one each in 6 hours - much better than playing it through)
All of this has been thoroughly tried. If there is a way to break the game by cheating, people will do that. Especially when it is PvP.
Successful multiplayer games either have engagements that are short enough (less than one evening), or that are clearly interruptible (stages reached), or arent realtime. Sadly, I see no way around this malady.
Long story short: I dont think a 15hr PvP RTS even makes sense. For a single player, it means being better than a fixed quality computer opponent. You try, you learn, you beat it eventually. PvP, it means if you are 1% less efficient in the first 5 mins, against an equally skilled opponent, you will definitely lose in the end.
A Games value is measured in pleasure per hour.

Work pausing into the gameplay. Give each player a pause at the beginning of the game, and then force them to buy pauses with in game currency.
Limit the number of consecutive pauses, a pause by one player would prevent pausing by another player for 10 minutes unless that other player pays for it at a penalized price.
Also limit the length of each pause, and allow other players to pay money to undo the pause.

I dont think you can do it that way.
You cant have a multiplayer rts that allows pausing that allows issuing orders.
Players would pause, issue orders, wait to see what the other players do, instantly pause again as soon as it wants to change anything and issue new orders.
This would not be a RTS it would be a CST (Chaotic Turnbased Stategy) game.

I've never seen a game solve this problem. You might allow players to vote to postpone the game and resume it at a later time (i.e., a save feature), which could make the long game sessions bearable, but I don't think pausing will work in multiplayer.

Civ VI is turn based although in multiplayer it plays out in real time (you get a certain number of minutes/seconds per turn). So it faces the same challenge--4+ players doing a game that lasts forever. It solves the problem by allowing players to save the game and then come back to it later. When you go to create a server you have the option of starting a new game or starting off with one of your saves. If you start with a save, then each player chooses whatever civilization they had before and things pick up where they left off

You may want to consider a 'phase-based' system. Each phase may be considered as a single pause. Players are allowed to issue instructions during each phase and then have the instructions carried out. Instructions that are issued in the first phase will only be executed in the second phase by the units.

You might consider giving players that aren't at the keyboard the ability to create reactions to certain situations. Since these are preset reactions, they won't be as good as an actual player on standby, but it also allows the game to continue without players being available.
I'm working on a game right now which allows you to program reactions for your characters, so that if you engage another player in the game, without you being available, then your characters still respond.
I'm using simple macros to help players map out their characters reactions. I'm making some very generic and others very complex... for example
If [player1]
Is [attacked]
And Health [<30%]
Action [DefensiveStance]
That way - even though not all players are available the game can continue to run. Conversely, depending on how much effort a player puts into his "AFK" scripting, then the better his team will perform.
Of course, it's still in progress - we will see later on just how well it turns out :)

Related

Flash AI - Can enemies learn "zones" or "areas"

Playing around with artificial intelligence. Was wondering if enemies can learn what areas to randomly wander around in, based off of certain variables.
For example, can an enemy learn what areas are "safe" and "dangerous" based off of how many other enemies have died in certain areas? And then can the enemy learn to only wander around in the "safe" zone?
Yes. Stats like favorite attacks, power-ups, and the like need to kept against the player. Setting a halo around the player (usually line of site) can trigger collisions with objects and rank them as favorite destinations for the player to head. Training a bot to chase the destination as to the player when the destination is closer makes it more difficult for the player to steal the prize. Having each attack combinations ranked so that the bot can study them against the player. When he learns what works, he can be trained to always approach that attack first. There are several methos for AI in all gaming environments that support collision detection.

Which AS3 physics engine can replay a simulation consistently?

I'm currently using the Nape physics engine for a "Peggle" style game in ActionScript 3.0.
It is very easy to use, and runs smoothly. However, The only difficulty I'm running into with Nape is replaying the exact same simulation.
Even if I supply it the same timestep value throughout the entire gameplay, it seems to have enough "error" in the calculations that the ball hits different pegs every once in a while (starting the round from scratch), sometimes even resulting more or less lit pegs.
So my question is:
Is there any other physics engines for Flash that can reproduce a given simulation EXACTLY the same each time it is relaunched?
EDIT:
The idea of "recording" the data on every-frames and playing it back was tossed around other forums I've asked this question. But unfortunately, the "replay" feature is not so much for the same user to view his/her own ball-drop scenario. It would be used for sharing between players on different machines (ex: client reports a bug with ball drop seeded a value 1234, we punch in 1234 and should be able to see the same issue).
So if we pre-record a bunch of scenarios (and by that, I mean ENOUGH to give the player the illusion they are actually running a physics simulation), randomly pick one, and use that random ID as our way to identify a particular scenario, that means we'll need to embed tons of data in the game - that could be otherwise saved if the physics engine was deterministic.
And just to check-off anything I've already tried in Nape:
The ball is reset to the same position & rotation at the beginning of the game.
The ball's initial velocity is set on user click, therefore this should override any velocity that carried-over from the last round.
The pegs don't move (they are static), so no point of resetting those.
The part that catches the ball consists of only static boxes and sensors, so no point in resetting those either.
The Citrus Engine provide a similar functionality with the TimeShifter you can check it running the demo Braid (pressing [SHIFT] to back in time), the TimeShifter API

Why there isn’t any open source alternative to big commercial games out there? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
I’m thinking of all type of game categories. My experience is that there aren’t any open source games that really challenge the commercial ones, considered game value, graphics, sounds etc.
Apart from the obvious answer of law-suits (remember the Aliens mod that received cease-and-desist letters), the other answer is cost. It takes hundreds of people to create a game like Civ 5 (artists, managers, programmers) and the cost is immense. These people are working on it for 5 days a week, 7.4 hours per day (more towards milestones) and open source alternatives are done in spare time around real jobs (not that game coding isn't a real job).
For a good open source game take a look at FreeCiv.
Several reasons come to mind:
It takes dozens if not hundreds of contributors over several years to create a major game title. An open source project of this magnitude would need lots of followers who are prepared to stick with it for a very long time. It would also require some people who are willing to coordinate the other developers (producers).
The replay value of a game is limited. Most people just play it through once and then move on to the next title. This differs it from an open source application or library which is always useful as long as you depend on it. This probably makes it much more difficult to find long-term commited developers.
I can't think of any business model related to open source games. Nobody would pay for support or much needed changes in the source code. Nor is there any agenda that bigger companies might be able to fulfill by funding an open source game project.
Contrary to popular belief, making games is not per se more fun than making applications (At least not for me, I've tried both).
It takes about eighty people working more than full time for two years to make a major game. (Some take more -- Assassin's Creed 2 was about 130, I think -- some take less.) These people must be real experts at what they do, and you need a lot of diverse skills: programmers, artists, writers, actors, sound designers, level designers, producers, QA.
Let's say you want to make a world-class game that competes with the chart-toppers on graphics, art, sound, design, the whole deal. You need world-class people doing this work: for example, animators who would otherwise be working full-time at Pixar or Weta. To get someone to work for you full-time instead of going to Pixar, you're going to need to pay them, a lot.
A game isn't the sort of thing where you can take what would be 40 hours of work for one person and spread it across one hour of work for forty people. It takes a lot of arduous, unfun work. It's not just programming the graphics engine -- it's testing the same broken thing over and over and over again, fixing a bug that appears only on a Windows Vista machine running a particular ATI card, painting bumpmaps onto fifty slightly different kinds of crate. Volunteer hobbyists tend to "scratch their own itch", do the thing that's interesting to them and leave it to someone else to polish.
It takes a lot of capital to make a game. You need a high-end workstation for each dev, sometimes two. Big screens. Fancy tablets for the artists. Maya licenses (there's no open source tool even remotely comparable). Are you making a console game? The development kits are $10k apiece. Doing motion capture? $500 an hour to rent the studio. Hiring voice actors? SAG scale starts at $800 per day. Having Some Guy From The Forums perform the roles just won't get a professional result. Plus electricity for all this, a building to put it in.
It's expensive, and it takes a lot of very specialized expertise, working for a long time even when they're tired and stressed and don't really agree with the Creative Vision, but need to finish the job anyway. You're going to have a hard time convincing really talented people to do that for free.
In addition to the other answers, a vital factor might be the requirement of expertise. Open source contains people mostly from developer/programmer/sysadmin realm. But only developer is not sufficient to build a game. You also need artist, sound engineer etc. For example, as a developer you can spend your free time to code game, but you can not create 3D models, as that is not your part of expertise.
Some possible reasons
The market is to fast. Graphics which is now good is in 2 years old and boring. So you have to finish a game very fast.
Its easier to make a mod to a game and there is already a community, so people do that more often (and its way easier to do).
The costs are huge. Its hard to find qualified people. Good game engines license costs a lot.
The organization is very hard.
There are a lot of project which are from people who don't know how to do it. So its hard to find a good project which could have success.
There are some, but they are rare: OpenTTD and early ID games come to mind.
But, seeing as the biggest investment is in the content and tools there's no reason the code couldn't be open source without affecting revenue. In fact, as OpenTTD has shown, it can extend the life of product with patches and improvements created by the community. Of course, you need a good game to start with.
While I generally agree with the sentiment, which is basically until you see open source movies, you are unlikely to see open source games with that production quality comparable to some of the major ones.
However, that said, there are some beautiful open source games. OpenTTD and Simutrans are mentioned - which are quite retro. For some more modern gameplay, check out stuff like Tremulous and Nexiuz.
Now that EA are cannibalizing and dumbing down the Simcity franchise, I'd love an open source offering to mop up and dominate the genre. SC4 was brilliant and unique, but needs some modernization in graphics, stability fixes, and easier community interaction for updating/extending the building types or city ordinances. LinCity does not yet have anything on SC4, and sadly SC5 plays more like the bad bits of LinCity than SC4.

Modeling an RTS or how Blizzard was able to put together Starcraft 1 & 2?

Not sure if this question is related to software development, but I hope someone can at least point me in the right direction(no, not that direction..)
I am very curious as to how Blizzard achieve such a balance of strategic/tactic forces in their games? If you look at Starcraft 1 or now 2, each race have unique features that sort of counterpart other unique features of other races and all together create a pretty beautiful(to my mind at least) balance.
Is there some sort of area of mathematics that could help model these things? How do they do it basically?
I don't have full answer but here is what I know. Initially, when game is technically ready the balance is not ideal. When they started first public beta there were holes in balance that they patched very fast. They let players (testers) play as is and captured statistics of % of wins per race and tuned the parameters according to it. When the beta was at the end ratio was almost ideal: 33%/33%/33%.
I've no idea how Blizzard specifically did it - it might have just been through a lot of user testing.
However, the entire field of CS and statistics dedicated to these kinds of problems is simulation. Generally the idea is to construct a model of your system and then generate inputs according to some statistical distribution to try to understand the behaviour of that model. In the case of finding game balance, you would want to show that most sequences of game events led to some kind of equilibrium. This would probably involve some kind of stochastic modeling.
Linear algebra, maybe a little calculus, and a lot of testing.
There's no real mystery to this sort of thing, but people often just don't think about it in the rigorous terms you need to get a system that is fairly well-balanced.
Basically the designers know how quickly you can gather resources (both the best case and the average case), and they know how long it takes to build a unit, and they know roughly how powerful a unit is (eg. by reference to approximations such as damage per second). With this, you can ensure a unit's cost in resources makes sense. And from that, it's possible to compare resource gathering with unit cost to model the strength of a force growing over time. Similarly you can measure a force's capacity for damage over time, and compare the two. If there's a big disparity then they can tweak one or more of the variables to reduce it. Obviously there are many permutations of units but the interesting thing is that you only really need to understand the most powerful permutations - if a player picks a poor combination then it's ok if they lose. You don't want every approach to be equally good, as that would imply a boring game where your decisions are meaningless.
This is, of course, a simplification, but it helps get everything in roughly the right place and ensure that there are no units that are useless. Then testing can hammer down the rough edges and find most of the exploits that remain.
If you've tried SCII you've noticed that Blizzard records the relevant data for each game played on B.Net. They did the same in WC3, and presumably in SC1. With enough games stored, it is possible to get accurate results from statistical analysis. For example, the Protoss should win a third of all match-ups with similarly skilled opponents. If this is not the case, Blizzard can analyze the games where the Protoss won vs the games where they lost, and see what units made the difference. Then they can nerf those units (with a bit of in-house testing), and introduce the change at the next patch. Balancing is a difficult problem - a change that fixes problems in top-level games may break the balance in mid-level games.
Proper testing in a closed beta is impossible - you just can't accumulate enough data. This is why Blizzard do open betas. Even so the real test is the release of the game.

How to build a solvable level of Same Game (aka. Chain-Shot, aka. Clickomania)

I'm building a game such as Same Game, when I have to create a new level I've just run an algorithm to fill the board with N colors, this algorithm fills the board at random, but obviously the levels generated this way are not all has a solution.
I have to make a function to resolve this problem, so the game can be played by a perfect player for ever.
I have a maximum of 6 color and a minimum of 2 and the board has a reasonable size (14x12) but can be modified.
The language is irrelevant.
EDIT: I don't need to solve the puzzle, I need to create levels that has at least one solution.
I've just check out about five different versions of the game on Ubuntu and I've found an answer you can pillage from!
Simon Tatham's Portable Puzzle Collection
I play about five of his games incessantly but preferred Same GNOME. I just loaded up his Same Game and it has the option to ensure solubility when creating custom games. Even has a customisable scoring system. It's all awfully advanced.
An exe and source code is available from the above link.
And the license is MIT (meaning you can use it freely in commercial games - but please donate something to him if you can afford it)
One method, which, I'll add, is rarely the most efficient, is to build the level in reverse.
It's fairly simple to do in this case though. You just start with nothing and add clickable groups with some randomness... I say some randomness, as you may need to add extra blocks to make sure all columns are filled.
But thinking about it, even then there's a possibility two clickable groups you add will touch each other and cause an unforeseen collapse, resulting in an unfinishable game. So this method wouldn't guarantee a solvable game.
You could have a look at the source for an open source version like Same GNOME and see how they do it (if they do it at all!)
create a "solved" board, and then change it using N valid but random backwards moves. After adding each backward move, you could run the moves forward (on a temp board) to verify a solvable puzzle.
If you can't run a verification algorithm, because of time constraints, perhaps what you need to work with is a library of puzzles. You can have a background thread generating new random puzzles all the time, and running a verification algorithm on them to check if they are valid. When a valid puzzle is found, it is added to your library of puzzles (assuming the same puzzle doesn't already exist).
Then your game just loads randomly from the library. This allows you to ensure you always have valid puzzles, but still allows you to randomly generate them and verify them without slowing down the puzzle-loading.
I think the best way is, if you generate a level randomly, I mean add 1 or more blocks at the same time to the same column, so you're gonna have some connecting blocks. Then you write a simple solving algorithm, which just solves the board till there is no more possible moves. Then you just simply try to complete the remaining part, just pushing some blocks from the top so that you have some more blocks to vanish. You continue till you finish the board.
You store the pieces you added in another matrix.
After that you just have to add the 2nd matrix to the 1st from the top. If the board is not full, you simply complete the board with blocks to start with(connecting blocks).