Commit Graph
147 Commits
Author SHA1 Message Date
Asdow 7b8c2d1ff9 Remove old function call 2026-01-23 23:35:59 +02:00
Asdow bd9cbd9944 Migrate +AI features
* Drink canteen
* Jump through window
* Use explosives
* Use wirecutters
2026-01-23 23:19:07 +02:00
Asdow cd054b549f Split DecideAction into several specialized DecideAction functions
* Removes the need to constantly check for fCivilian, ARMED_VEHICLE, ENEMY_ROBOT etc inside DecideAction
* Move AI decision checks into their own functions, such as DecideActionRadioRedAlert
* Add new entry to ActionType. AI_ACTION_INVALID signals that no valid action was found when a function returns, or no valid action is possible
* Do a weighted random selection for choosing target under DecideActionBlackSoldier
2026-01-19 22:50:27 +02:00
Asdow c3f4ee754a Only log during turn based AI 2026-01-19 22:32:01 +02:00
Asdow a46d2dbb96 Add global to selectively log AI status BLACK decisions 2026-01-19 22:31:34 +02:00
Asdow 2e3e4b38d9 Fix compilation 2025-12-25 20:17:02 +02:00
Asdow f075963bca Merge branch 'master' into decideaction 2025-12-25 18:58:41 +02:00
Asdow 82aca548f5 Merge branch 'master' into ExtraMercs 2025-09-24 16:14:10 +03:00
BeatAroundTheBuscherandGitHub ed00830202 Fixes Upper/Lower Casing for include paths (#487)
* Fixing upper/lower case for includes

types.h, zconf.h and zlib.h were renamed so that global includes like Types.h
are not used.
2025-08-16 22:01:12 -03:00
Asdow fd9611ae04 Remove compiler warnings 2025-08-08 18:38:53 +03:00
Asdow bfb724eab9 Use SoldierID 2024-12-01 18:23:52 +02:00
Asdow 66bd1e41c2 Correct loops 2024-11-18 18:27:14 +02:00
Asdow b74ccf3ddc Convert to SoldierID 2024-11-17 23:45:48 +02:00
Asdow b9641d4c90 Convert to SoldierID 2024-11-17 20:52:12 +02:00
Asdow 10250dc035 Merge branch 'master' into ExtraMercs 2024-11-09 13:44:53 +02:00
AsdowandGitHub 49a119e6b9 Convert INVTYPE boolean fields to flagmask (#325)
Rearranged fields from largest to smallest to remove alignment padding
2024-08-22 08:48:29 +03:00
AsdowandGitHub 5fe730b075 Merge branch 'master' into decideaction 2024-02-11 17:38:27 +02:00
Asdow 57716e1c07 Revert back to original AI deadlock breaking
For now..
2024-02-11 17:20:10 +02:00
Asdow dfc17c68c6 Cancel action if new situation arises
Lot of actions are liable to deadlock if this is not done
2024-02-11 13:32:17 +02:00
AsdowandGitHub 4338b5b909 Fix AI tactical retreat (#282)
Only perform tactical traversal if pSoldier is at the map edge
2024-02-11 12:42:21 +02:00
Asdow 1aec54f59c add another AI logging entry 2024-02-10 18:14:35 +02:00
Asdow 0240729c11 Use correct string array 2024-02-10 18:13:20 +02:00
Asdow 01327265a3 Check if action should stay inprogress state
Several actions tended to get stuck in an invalid state, where it was completed, but aiData.bActionInProgress was still TRUE resulting in an AI deadlock.

If such a situation is found, Actiondone is now called, preventing the deadlock
2024-02-04 16:10:26 +02:00
Asdow cd193c7f5e Call TurnBasedHandleNPCAI() if no action is in progress
Several actions would sometimes get stuck in a forever loop, where they would not be executed, since no proper path for executing the actions is found.

Originally TurnBasedHandleNPCAI() would only be called if aidata.bAction was AI_ACTION_NONE.
Now we'll call it if an action is not already in progress, and will be executed if the action is affordable.
2024-02-04 16:07:03 +02:00
Asdow f249406ba0 Allow specific alert status AI logging
Less clutter in the AI logs if, for example one is only interested in BLACK status decisions
2024-02-04 15:29:05 +02:00
Asdow 7ee8165e02 Prevent AI deadlocking if NEW_SITUATION is encountered 2024-02-04 15:18:43 +02:00
Asdow caf5828153 Remove deadlock breaking from TurnBasedHandleNPCAI
It's already handled before a call to this function, and TurnBasedHandleNPCAI() is only called when pSoldier's action is AI_ACTION_NONE
2024-02-04 12:39:57 +02:00
AsdowandGitHub 0910dba472 Revert "Disable AI logging by default" (#270)
This reverts commit 5a74323d1f.
2024-01-30 11:44:00 +02:00
Asdow 2697a17010 Check if pSoldier is null
Prevent nullptr dereference in AI logging function
2024-01-28 11:16:41 +02:00
Asdow 5a74323d1f Disable AI logging by default
We only want this on when specifically debugging/working on AI.
2024-01-28 11:16:41 +02:00
majcostaandGitHub ae55496e39 Move main executable source to its own directory (#248)
* Move main executable files to their own directory

* Adapt the build to the new file structure

... and fix some weird #include's that were relying on the project root
being an include directory.
2023-10-23 15:46:51 -03:00
Asdow 88af94eaaf Use Flugente's AI deadlock break & fix wstring for screenMsg 2023-10-02 22:26:30 +03:00
Asdow 6131ebc689 Comment out temp. fixes to flush out AI deadlocks 2023-10-02 22:20:43 +03:00
Asdow 138ad0656f Prevent AI deadlocks
Canceling current AI actions at the start of soldier's turn prevents a lot of ai deadlocks. The status RED & BLACK actions are supposed re-evaluate the situation every turn anyways
2023-08-19 14:37:49 +03:00
Asdow 613de1b869 Remove useless code
!AimingGun(pSoldier) would always evaluate to true and there are no hits to CrowDecideAction in the entire solution even in commented out code
2023-08-18 21:05:11 +03:00
Asdow 1c4929c3e1 Improve AI item handling log entry 2023-08-17 19:52:21 +03:00
Asdow 664142c36c Don't log AI info if pSoldier is null 2023-08-17 19:50:59 +03:00
Asdow 0e529070c4 Allow AI to shoot with lower aim if out of AP for current aim level 2023-08-17 19:42:43 +03:00
Asdow bacad9b4c0 Prevent AI deadlock when they try to shoot and player gets an interrupt 2023-08-17 19:41:41 +03:00
Asdow e502727828 Disable canceling AI actions for escorted mercs
Logging AI decisions shows that this conditional would constantly cancel AI actions during regular gameplay. A special case like this should not affect normal AI routines and I'd rather disable this for now to prevent it from masking other problems with AI decisions.
2023-08-17 19:41:08 +03:00
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +03:00
rftrdevandGitHub 119c6fe6bb Fix FindBestNearbyCover() and delete global var (#156) 2023-05-26 21:28:00 -07:00
Marco Antonio Jaguaribe CostaandAsdow 8b1c4effa0 nuke all the #if 0's
scripted commit:

find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';'

https://coan2.sourceforge.net/coan_man_1.html
2023-01-19 00:13:08 +02:00
majcostaandGitHub 24425a82b1 More unused stuff removal (#49)
* More unused stuff removal

delete:
- giant 'metaheaders' (JA2 All.h, Laptop All.h, etc), preferring to add #includes directly where needed
- unused ExceptionHandling and DbMan translation units
- unused WizShare.h, Bitmap.h, trle.h, video_private.h headers

* remove mentions from vc proj files too

* remove preprocessor conditionals for unused definitions

find . -iname '*.h' -o -iname '*.cpp' -exec unifdef.exe -m -UPRECOMPILED_HEADERS -UJA2_PRECOMPILED_HEADERS -UWIZ8_PRECOMPILED_HEADERS -UPRECOMPILEDHEADERS {} ';'

then manually fixed a couple files the tool errored out on

* yes, the comments too

as title
2023-01-03 15:51:48 +02:00
Asdow 1f0a8f46e8 Import changes from the local SVN working copy 2022-10-10 10:08:44 +03:00
Sevenfm dc8fffb471 Fix: use system time instead of game time for breaking AI deadlock as game time is affected by fast timer mode, as a result breaking AI decision before it can execute normally.
Allow to break AI deadlock manually by pressing ESC key after 10 seconds, auto break AI after DEAD_LOCK_DELAY seconds.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9383 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-05-10 18:45:19 +00:00
Sevenfm b06b9132a7 Added functions for utf8 <> wstring conversion.
Added message when AI breaks deadlock because cannot complete action.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9262 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-16 17:09:09 +00:00
Sevenfm aa767c4355 Minor code improvements for quest logging.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9178 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:43:15 +00:00
Sevenfm 0a717c2697 Removed option AI_DECISION_INFO.
Added quest debug logging to Logs\QuestInfo.txt

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9177 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:35:32 +00:00
Sevenfm 08ba4f9323 CancelAIAction: improved condition to allow cover check.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9081 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-13 17:46:21 +00:00