Commit graph

33 commits

Author SHA1 Message Date
Vantha
5741f77c6e Add a 'team population' gamesetting
Remove the world population setting from the game setup.
Add a dropdown for choosing the "Population Cap Type".
(-> containing Player Population, World Population, Team Population)

Use a single "Population Cap" dropdown adapting to the pop cap types.
Move all population data into a single .json file.

New system component "PopulationCapManager" for distributing pop caps.

Resolves: #6918
2025-03-06 13:25:43 +01:00
Freagarach
c917c39a0d Pull Diplomacy out of cmpPlayer.
Who says only players should be able to conduct diplomacy?
Also separation of concerns, more maintainable files.

Differential revision: https://code.wildfiregames.com/D4921
Comments by: @elexis, @Stan
Refs. #5894

This was SVN commit r27722.
2023-06-19 06:33:33 +00:00
Freagarach
9373e7044e Clean PlayerManager.js.
Remove obseleted function RemoveAllPlayers in 354bd8b088.
Linter stuff.
Don't initialise undefined world population value.

Differential revision: https://code.wildfiregames.com/D4494
This was SVN commit r26477.
2022-02-24 07:04:46 +00:00
Freagarach
6a2a297c0e Clean LoadPlayerSettings in Player-helper.
- Removed obsolete C++-side `addPlayer`, introduced in 4fed9b8242, moved
out of Atlas in 1c0536bf08, unused after 9ee44bd9b8.
- Get the player settings from a local function (avoids passing
arguments).
- Removed setting the standard diplomacy (done in cmpPlayerManager since
132020f88e).
- Create entity when adding a player instead of creating it and
instructing the playermanager to add it.
- Changed/Removed some comments.

Differential revision: https://code.wildfiregames.com/D4482
Comments by: @Stan
This was SVN commit r26404.
2022-02-18 08:10:13 +00:00
Freagarach
840cc18277 Do not process commands sent by observers.
Differential Revision: D2810
Reviewed by: @bb.
Refs #5140.

This was SVN commit r24063.
2020-09-22 18:28:21 +00:00
Freagarach
edb956424e Allow world population capacity.
This allows to specify a world population capacity that is divided
evenly amongst living players.

Differential Revision: D2426
Reviewed by: @Angen
This was SVN commit r23873.
2020-07-23 09:00:34 +00:00
wraitii
e16c4c4800 Add a system component to handle stat modifiers, make technologies and auras use this common interface.
The ModifiersManager system component provides an interface to add and
remove modifiers, and get modified stats.
The goal is to merge all the different stat-modifying systems 0 A.D. has
implemented over the years.
This commit makes technologies and auras use ModifiersManager. Some
cheats and AI bonuses also have a similar stat-modifying effect that
have not yet been updated.

Further, this system component makes it possible for e.g. triggers to
easily add modifiers, enabling the writing of Castle Blood Automatic,
RPG or Tower Defense maps without the need for mods or hacks.

The 'Modifier' name was preferred over 'Modification' as it is shorter
and more readable, along with the logic that 'modifiers' store
'modifications' and this stores modifiers. Renaming of other functions
and classes has been left for future work for now.

Internally, this uses a JS data structure. If performance issues arise
with it in the future, this data structure or the whole component could
be moved to C++.
The performance has been tested to be about as fast as the current
implementations (and specifically much faster for global auras with no
icons). Testing showed that sending value modification messages was by
far the slowest part.

Comments by: leper, Stan, elexis
Differential Revision: https://code.wildfiregames.com/D274
This was SVN commit r22767.
2019-08-24 07:37:07 +00:00
elexis
76d648349d Fix gaia units ignoring players without CCs.
As demonstrated by Dizaka, it allowed players to win a game by deleting
all buildings, sending one unit across the map and having the enemy get
defeated by the double gaia count.
It also means that players that still have buildings but no CCs/Wonders
are targetted by elephants.

This was SVN commit r21777.
2018-04-24 12:46:59 +00:00
elexis
a74352b100 Spawn proportionately less gaia attackers when players become defeated.
This also reduces the attackercount slightly, because gaia is now
excluded when counting players.
PlayerManager.GetActivePlayers helper function.

This was SVN commit r21730.
2018-04-15 16:47:51 +00:00
bb
d86148defc Create winning teams for relic and wonder victory instead of letting all allies of a player win.
Create a getNonGaia function
Reset counters on playerDefeat
MarkPlayersAsWon function
Rename MarkPlayerAsWon to MarkPlayerAndAlliesAsWon
Stop letting winningplayers in relic depend on PlayerID

Comments By and Discussion With: elexis
Reviewed By: temple
Differential Revision: https://code.wildfiregames.com/D972
fixes #4648

This was SVN commit r21441.
2018-03-05 18:02:27 +00:00
elexis
d5af005a00 Expose INVALID_PLAYER to the JS simulation and use it instead of -1 for consistency with the C++ counterpart.
This was SVN commit r20953.
2018-01-22 01:02:29 +00:00
elexis
83d3e4f7a4 Fix undefined player color errorspam in Atlas after placing an entity, changing the civ and starting the simulation following 343ec21e75 / D623, refs #4643.
The commit had removed the fallback color as there is no traceable use
case.
Copy the Player color from the old to the new player entity in
ReplacePlayer before the ownership changes occur, so that it is always
initialized before read.

Refs 9329506e0d
Reported By: temple
This was SVN commit r20951.
2018-01-21 23:30:38 +00:00
elexis
3b3f0eb2d6 PlayerManager GetAllPlayers helper function to remove some duplication.
Differential Revision: https://code.wildfiregames.com/D1050
Patch By: temple
This was SVN commit r20613.
2017-12-08 20:39:40 +00:00
Itms
83a2e810da Remove all occurrences of for each in JS scripts.
This will allow us to use some linters that would otherwise crash on
this non-standard SpiderMonkey feature. Refs #4419.

Special thanks to elexis for thoroughly checking and testing all the
changes!
Reviewed By: leper, elexis
Differential Revision: https://code.wildfiregames.com/D40
This was SVN commit r19191.
2017-01-30 12:47:08 +00:00
elexis
6149dd3841 Actually remove trailing whitespace for non-header files as well.
This was SVN commit r18989.
2016-11-23 13:02:58 +00:00
leper
c4c315f6a0 Remove cmpPlayerManager.GetAllPlayerEntities() which leaked internal data.
And all uses thereof could easily be replaced.
This changes the data structure of cmpTrigger.conquestEntitiesByPlayer
to
not store the player entity at all, and since that is now gone replaces
the
object by the array that was its sole property.

Refs #4161.
Reviewed by: fatherbushido
This was SVN commit r18645.
2016-08-27 15:26:23 +00:00
elexis
9f796068f8 Win and defeat cleanup, fixes #4013.
Add a new simulation message and chat notification for players who won.
Avoid duplicate playerstate messages in the sim and GUI by triggering
changes with a function instead of a message.
Reveal the map on defeat/win exclusively in the player component
(instead of having a silly GUI proxy and doing it also in the
EndGameManager sometimes).
Remove the skipAlliedVictory argument from the player component, since
that shouldn't contain references to the EndGameManager, refs #3970.

Show a proper message box on win/loss and add the hint for hosts
disconnecting other players.
Do defeat/win procedure in the GUI when such a message arrives, instead
of checking onTick for playerstate changes.
Thus don't show that confirmation again on every rejoin.
Don't show a pointless message box if IsAtlasRunning.

Explain that the session.js variable is needed to avoid an
order-of-execution bug.
Select "observer" item when rejoining as a defeated player.
Remove an unneeded call to updateTopPanel.

This was SVN commit r18441.
2016-06-26 04:40:50 +00:00
elexis
cd3c52c53f Last Man Standing mode. Based on patch by Sandarac, fixes #3970.
Also fix a simulation bug (check for allied victory on game start).
The mode is not a victory condition as it applies to all victoriy
conditions.

This was SVN commit r18342.
2016-06-08 11:03:16 +00:00
Itms
5cf2086a33 Fix the initial exploration of territories, which shouldn't be performed in Atlas.
Also clean up the code a bit.

Fixes #2969

This was SVN commit r16129.
2015-01-08 22:36:13 +00:00
leper
a472944689 Clean up LoadPlayerSettings.
Include gaia to make iteration easier.
Add TemplateExists() to the TemplateLoader. Refs #2877.

This was SVN commit r16099.
2015-01-01 23:10:24 +00:00
mimo
9329506e0d add support for civ specific player template, see #2877
This was SVN commit r16092.
2014-12-31 09:31:41 +00:00
leper
354bd8b088 Only delete/create players until the needed number is reached. Patch by trompetin17. Fixes #1953.
Previously we removed all players and created them anew. This caused
issues in Atlas,
as some components were recreated, but did not get informed about
already existing
entities (eg cmpTechnologyManager). By only creating/deleting players
until we obtain
the new number of players we do not have this issue.

This was SVN commit r16080.
2014-12-29 17:33:39 +00:00
sanderd17
7ff5fbda2b Allow system components to be registered on the scripting side (so mods can make their own system components).
This was SVN commit r15157.
2014-05-18 13:44:08 +00:00
sanderd17
132020f88e Fix some of the undefined warnings reported by the new SpiderMonkey. Initialize the player diplomacy arrays earlier in PlayerManager.
This was SVN commit r14882.
2014-03-29 11:03:00 +00:00
JoshuaJB
883f307b40 Implement a basic observer mode. Any player which joins a multiplayer game but is not assigned a player slot automatically becomes an observer. Refs #69
This was SVN commit r14849.
2014-03-16 23:29:27 +00:00
JoshuaJB
4b7ab63172 Fix #1496 with a revised version of my patch. Also moves damage-related functions from Attack.js to a seperate file in the global namespace.
This was SVN commit r14231.
2013-11-26 18:33:42 +00:00
leper
de5d4491ab var-fare
This was SVN commit r13404.
2013-05-12 22:28:02 +00:00
historic_bruno
27e5581d27 Fixes Atlas player panel getting out of sync with simulation. Fixes #927.
Fixes object panel not being notified of map loading.
Fixes bug where opening a new map before using the player panel
prevented default player data being displayed for new players.
Fixes wxGTK 2.8 bug: wxChoicebook control doesn't update the choice
control when adding/removing pages.
Notifies player that deleting player in Atlas will delete all their
objects (and gives them the option).
Changes DeleteObject to DeleteObjects to support multiple selections.
Implements undo for map resize (experimental).
Removes annoying debug message from attempted undo of map settings.
Tweaks a few Atlas UI controls.

This was SVN commit r10064.
2011-08-22 21:45:39 +00:00
historic_bruno
ff85950cb7 Disables build restrictions and limits for AIs (until they can be fixed).
Simplifies player diplomacy/team setup.

This was SVN commit r10008.
2011-08-15 00:25:22 +00:00
Ykkrosh
e509887341 Complain better about invalid player IDs.
This was SVN commit r8749.
2010-11-30 12:27:38 +00:00
historic_bruno
9ee44bd9b8 Game setup changes, including showing name, civ, team, and some options loaded from the scenarios. Civ data added. Civ info window to preview civs. Icon tooltips. Support for random map implementation. Fixes #590.
This was SVN commit r8494.
2010-10-30 04:02:42 +00:00
Ykkrosh
dd809f83e8 # Add documentation of the entity template XML file format.
Simplify the format a bit.
Use less <interleave> in the RNG so that error reports become
understandable.
Fixes #491.

This was SVN commit r7478.
2010-04-23 16:09:03 +00:00
Ykkrosh
4fed9b8242 # Added initial support for players and population counters in new simulation system, plus various infrastructure improvements.
Merge from 22b478ffed8d.
Pure scripted interface definitions.
Entity creation from scripts.
Improved messaging system.
Messages on entity deletion.
Basic player entities.
Player ownership.
Bug fixes.

This was SVN commit r7281.
2010-01-22 20:03:14 +00:00