Commit graph

48 commits

Author SHA1 Message Date
phosit
08340ca18a
Call GetFullRepresentation only internally
`GetFullRepresentation` doesn't reset `this.changes` to `null`. So when
a message arrives the ai-interface will not be informed.
The ai-interface calls `GetFullRepresentation` and removed the dirty
flag from the ai interface.

This two behaviors lead to the error that the ai never receives messages
from entities which exist at game start.
2026-05-10 14:18:49 +02:00
phosit
f81cf7e602
Clear changedEntities on initialization
When initialized all entities get queried. But the set of entities to
query wasn't cleard. This lead to an OOS.
2026-05-10 14:18:48 +02:00
Stan
dc04f3f432
Fix autofixable eslint warnings for eqeqeq
Ref: #7812
Pull Request: #8129
2025-06-26 11:03:19 +02:00
Ralph Sennhauser
25c53cb0ac
Enable eslint style rule 'keyword-spacing'
After Stan suggesting change in a review comment just enable the rule
'keyword-spacing' [1] and fix violations so this is no longer a topic in
spirit of #7812.

[1] https://eslint.style/rules/keyword-spacing

Ref: #7245
Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-25 14:34:12 +02:00
Ralph Sennhauser
f29f0b7fd1
Enable eslint rule 'no-prototype-builtins'
Enable recommended rule 'no-prototype-builtins' [1] and manually fix violations.

[1] https://eslint.org/docs/latest/rules/no-prototype-builtins

Ref: #8068
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-17 13:47:11 +02:00
Ralph Sennhauser
4c4f787c63
Fix eslint rule 'prefer-const' in components/[A-B]*
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/simulation/components/A* \
    binaries/data/mods/public/simulation/components/B* \

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-11 10:40:23 +02:00
Freagarach
7f77cf2f3e Move PopulationBonus from cmpCost to new cmpPopulation.
Since PopBonus is not a cost.

Patch by: @lonehawk
Differential Revision: D2948
Comments by: @Angen, @Nescio, @wraitii
Closes #4081

This was SVN commit r24394.
2020-12-14 18:17:59 +00:00
wraitii
70c71bff0f Allow Modifiers to affect tokens.
This adds a new mode to modifications called "tokens" which allows
clever token parsing.
Technologies, auras and modifiers in general can use this to switch out,
add or delete tokens dynamically.

Currently implemented are production and builder queue tokens.

Reviewed By: Freagarach
Differential Revision: https://code.wildfiregames.com/D270
This was SVN commit r23843.
2020-07-17 08:23:45 +00:00
mimo
862fd197d9 some cleanups of ai and petra
This was SVN commit r20257.
2017-10-02 17:49:27 +00:00
leper
ff7511d9fc Move special_filter/ templates to special/filter/.
This should help with simplifying the (un)placeable filtering again.

Reviewed By: fatherbushido
Differential Revision: https://code.wildfiregames.com/D934
This was SVN commit r20242.
2017-09-30 07:14:35 +00:00
mimo
683e19a7ed cleaning of the list of useful templates in AIInterface
This was SVN commit r20026.
2017-08-23 17:40:51 +00:00
mimo
a2d87af95d Petra: Send diplomacy requests to other players on occasion
On occasion Petra will request to become allies or neutral with other
players (regardless if they are an AI or not).

Patch by Sandarac

Reviewed By: mimo
Differential Revision: https://code.wildfiregames.com/D544
This was SVN commit r19654.
2017-05-25 19:22:50 +00:00
fatherbushido
5f4d5cdf76 Remove a leftover argument in GetSimulationState call. Refs 00ea7763f7. Reviewed by elexis and echotangoecho.
Differential Revision: https://code.wildfiregames.com/D479
This was SVN commit r19565.
2017-05-12 16:20:56 +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
mimo
f352e2c725 AI diplomacy support for lastManStanding, patch by Sandarac, tests reviewed by elexis, fixes #4143
This was SVN commit r18945.
2016-11-15 18:48:20 +00:00
mimo
3d6c48e357 ai cleanup, mainly var -> let
This was SVN commit r18258.
2016-05-29 12:26:41 +00:00
mimo
6171f66d06 AI: fix serialization of template changes, fixes #3993, refs #3858
This was SVN commit r18219.
2016-05-22 20:25:41 +00:00
sanderd17
4ea49f374a Disable serialization of the AI when no AI players are present. Disable serialization of cached AI templates overall. Improve serialization of repetitive vectors and templatenames. Refs #3834
This was SVN commit r18121.
2016-05-02 09:26:07 +00:00
mimo
fd4d5cce64 petra: recomputes territory only when receiving some events, refs #3858
This was SVN commit r18096.
2016-04-26 18:26:18 +00:00
sanderd17
9f21806ef7 Properly round health and CP values. Patch by bb. Fixes #3855
This was SVN commit r18009.
2016-04-09 07:35:20 +00:00
mimo
a0d21e8d9e do not fill changedTemplateInfo when no AIs to prevent OOS, refs #3133
This was SVN commit r16865.
2015-07-17 17:45:15 +00:00
mimo
f74215e96c rounding needed for houses with popBonus%5 != 0, fixes #3328
This was SVN commit r16848.
2015-07-12 15:23:34 +00:00
mimo
03bc22510b fix entities deserialization in AIInterface and remove duplicates entities and templates in sharedAI, refs #3060 and fixes #1089
This was SVN commit r16626.
2015-05-05 20:38:43 +00:00
mimo
b0f7c00622 petra: continuation on capture adaptation
This was SVN commit r16598.
2015-04-29 17:59:29 +00:00
mimo
8ff8667ed0 add initialization of capturePoints in AIProxy + some cleanings
This was SVN commit r16584.
2015-04-26 18:07:55 +00:00
mimo
a0340efab8 fix an unfortunate typo affecting the AIs
This was SVN commit r16539.
2015-04-14 20:23:42 +00:00
mimo
d139a75de3 new button in diplomacy to request an attack to allies, works also for AIs, fix #3157
This was SVN commit r16533.
2015-04-11 18:46:05 +00:00
mimo
43508ce3a0 some petra code reshuffling
This was SVN commit r16496.
2015-04-04 15:38:53 +00:00
mimo
afbf6e8e40 cleanings of AIInterface
This was SVN commit r16490.
2015-04-02 20:28:02 +00:00
sanderd17
ec9a49562b Remove debug warning + fix typo
This was SVN commit r16474.
2015-03-30 18:49:54 +00:00
sanderd17
a05f146c79 Disable data gathering in AIInterface when no AI players are loaded
This was SVN commit r16473.
2015-03-30 18:44:02 +00:00
mimo
09dc9e6f1d fix rounding problem in AI health, fixes #2446
This was SVN commit r16420.
2015-03-15 09:54:48 +00:00
Itms
2ef3c0c42e Compute the actual percentage of map explored by the team in the summary screen.
Fixes #2587.

This was SVN commit r16071.
2014-12-26 19:13:40 +00:00
mimo
443158869c let the AIs know when a tribute is sent
This was SVN commit r15858.
2014-10-12 22:00:19 +00:00
mimo
1a33003538 AI should not use EntityRenamed messages coming from mirages, addresses #2724
This was SVN commit r15642.
2014-08-15 16:18:57 +00:00
mimo
5903935e4a let the AIs know when a training has started
This was SVN commit r15350.
2014-06-14 14:34:37 +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
c2d43b009c Fix asking for non-existing templates of killed units
This was SVN commit r14614.
2014-01-18 20:56:21 +00:00
wraitii
9330975d54 Fix Athens not researching civ phase. Make the AI adapt automatically to changing the max gatherers on fields.
Fix auto-researched technologies not being properly researched on init.
Fix the tests (amazing!).
GarrisonHolder sends which entities were added or removed (mostly for AI
purposes but could benefit other things).
Streamline AIInterface events.

This was SVN commit r14612.
2014-01-18 20:26:52 +00:00
wraitii
c1e86161b5 AIs now properly receive aura and technology updates. Fixes #2377, Refs #1520 . Consequently reimplement repairing for AIs.
Fix a few style issues and a bug with the gatherer count.
Still need to fix the entity.js file to handle properly some things as
this uses raw templates values.
Cache the AIinterface in AIProxy.js, please report if this works
properly.

This was SVN commit r14588.
2014-01-16 20:32:44 +00:00
wraitii
ede4f32bf2 Change the defense system used by Aegis to use more modular armies. This should be faster and easier to extend, though right now it might not be as efficient as before.
Fix a few bugs, including a few bad ones in the economy.
Change the way messages are handled, should be marginally faster in the
later game.
Makes gatherers count limit be per-player (refs #1387 and #643).

This was SVN commit r14552.
2014-01-10 01:46:27 +00:00
wraitii
189ef85538 Fix AI errors on skirmish maps.
This was SVN commit r14285.
2013-12-04 16:52:44 +00:00
wraitii
1f55280fa2 AI-related changes to the AI interface and Command.js, to facilitate debugging of upcoming new version of Aegis.
This was SVN commit r13592.
2013-07-25 08:57:07 +00:00
wraitii
e33d4a52e9 AI API V3 along with a new version of Aegis. Support for a JS shared component that can be used or not for each AI.
This was SVN commit r13225.
2013-03-05 22:52:48 +00:00
Ykkrosh
16a4eb36dd Various minor optimisations.
Enable SpiderMonkey method JIT in Release mode.
Add Engine.ProfileStart/Engine.ProfileStop functions for scripts.
Fix AI to clone initial entity data and shared metadata.

This was SVN commit r9003.
2011-03-03 00:16:14 +00:00
Ykkrosh
57e5bb878a Initial terrible AI player scripts.
This was SVN commit r8891.
2011-02-05 20:35:34 +00:00
Ykkrosh
f39f279132 Add AI script code to provide a cleaner API around the engine interface.
Handle AIProxy entirely through scripts.
Support structured clones of script values.
Improve performance.
Support multiple script contexts sharing a runtime.
Use a separate context per AI player.

This was SVN commit r8866.
2011-01-15 23:35:20 +00:00
Ykkrosh
dd501b2a5a # Add initial basic player AI framework.
Support direct access to serializer streams, so serializers can be
nested.
Make component script "this.template" read-only.
Stop globally-subscribed component scripts receiving messages posted to
local components, to reduce out-of-sync risks.
Move pathfinder data out of entity template directory.
Fix GuiInterface deserialization.

This was SVN commit r8865.
2011-01-12 12:29:00 +00:00