Skip to content

Commit f56ba27

Browse files
committed
add ai with race and difficulty; more docs
1 parent 6082c63 commit f56ba27

File tree

11 files changed

+27
-13
lines changed

11 files changed

+27
-13
lines changed

c/uwapi/uwapi/modules/botsAdmin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C"
2222
UNNATURAL_API void uwAdminTerminateGame(void);
2323
UNNATURAL_API void uwAdminPauseGame(bool pause);
2424
UNNATURAL_API void uwAdminSkipCutscene(void);
25-
UNNATURAL_API void uwAdminAddAi(void);
25+
UNNATURAL_API void uwAdminAddAi(uint32 intendedRace, float difficulty);
2626
UNNATURAL_API void uwAdminKickPlayer(uint32 playerId);
2727
UNNATURAL_API void uwAdminPlayerSetAdmin(uint32 playerId, bool admin);
2828
UNNATURAL_API void uwAdminPlayerSetName(uint32 playerId, const char *name);

c/uwapi/uwapi/modules/scriptsServer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ extern "C"
3939
UNNATURAL_API void uwDestroyForce(uint32 force);
4040
UNNATURAL_API void uwSetForceColor(uint32 force, float r, float g, float b);
4141
UNNATURAL_API void uwSetForceFinish(uint32 force, bool winner, bool defeated);
42+
UNNATURAL_API void uwSetForceRace(uint32 force, uint32 race);
4243
UNNATURAL_API void uwSetForceStartingTeam(uint32 force, uint32 team);
4344
UNNATURAL_API void uwSetForceStartingPosition(uint32 force, uint32 position);
4445
UNNATURAL_API void uwSetForeignPolicy(uint32 force1, uint32 force2, UwForeignPolicyEnum policy);
4546

46-
UNNATURAL_API uint32 uwCreateAiPlayer(void);
47+
UNNATURAL_API uint32 uwCreateAiPlayer(uint32 race, float difficulty);
4748
UNNATURAL_API void uwSetPlayerAiConfig(uint32 player, const UwPlayerAiConfigComponent *config);
4849
UNNATURAL_API void uwSetPlayerForce(uint32 player, uint32 force);
4950
UNNATURAL_API void uwPlayerCamera(uint32 player, uint32 tileIndex, bool resetToDefaultZoomAndOrientation, float duration, float smooth); // use -1 to send to all players, use NaN for default values

csharp/uwapi/admin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public static void SkipCutscene()
5656
Interop.uwAdminSkipCutscene();
5757
}
5858

59-
public static void AddAi()
59+
public static void AddAi(uint intendedRace = 0, float difficulty = 0)
6060
{
61-
Interop.uwAdminAddAi();
61+
Interop.uwAdminAddAi(intendedRace, difficulty);
6262
}
6363

6464
public static void KickPlayer(uint playerId)

csharp/uwapi/interop.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static class Interop
4848
public static extern void uwAdminSkipCutscene();
4949

5050
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
51-
public static extern void uwAdminAddAi();
51+
public static extern void uwAdminAddAi(uint intendedRace, float difficulty);
5252

5353
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl)]
5454
public static extern void uwAdminKickPlayer(uint playerId);

python/uwapi/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def set_game_speed(self, speed: float) -> None:
3333
def set_weather_speed(self, speed: float, offset: float) -> None:
3434
uw_interop.uwAdminSetWeatherSpeed(speed, offset)
3535

36-
def add_ai(self) -> None:
37-
uw_interop.uwAdminAddAi()
36+
def add_ai(self, intendedRace: int = 0, difficulty: float = 0) -> None:
37+
uw_interop.uwAdminAddAi(intendedRace, difficulty)
3838

3939
def kick_player(self, player_id: int) -> None:
4040
uw_interop.uwAdminKickPlayer(player_id)

python/uwapi/bots.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void uwAdminStartGame(void);
8383
void uwAdminTerminateGame(void);
8484
void uwAdminPauseGame(bool pause);
8585
void uwAdminSkipCutscene(void);
86-
void uwAdminAddAi(void);
86+
void uwAdminAddAi(uint32 intendedRace, float difficulty);
8787
void uwAdminKickPlayer(uint32 playerId);
8888
void uwAdminPlayerSetAdmin(uint32 playerId, bool admin);
8989
void uwAdminPlayerSetName(uint32 playerId, const char *name);

python/uwapi/interop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ def uwAdminPauseGame(self, pause: bool) -> None:
543543
def uwAdminSkipCutscene(self) -> None:
544544
self._api.uwAdminSkipCutscene()
545545

546-
def uwAdminAddAi(self) -> None:
547-
self._api.uwAdminAddAi()
546+
def uwAdminAddAi(self, intendedRace: int, difficulty: float) -> None:
547+
self._api.uwAdminAddAi(intendedRace, difficulty)
548548

549549
def uwAdminKickPlayer(self, playerId: int) -> None:
550550
self._api.uwAdminKickPlayer(playerId)

sphinx/source/concepts/economy.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,21 @@ Producing units and researching upgrades works the same as recipes.
5151
5252
// todo
5353
54+
Destroyed Buildings
55+
^^^^^^^^^^^^^^^^^^^
56+
57+
When a building is destroyed, same construction is automatically placed in its place.
58+
It has ``disabled`` priority, you just change it when appropriate.
59+
Its previous recipe is also restored.
60+
5461
Logistics
5562
---------
5663

5764
Resources are automatically transported by trucks.
5865
They will fulfill tasks by their priority, and on first-come-first-serve basis.
5966

67+
Priorities apply to both constructions and recipes.
68+
6069
.. tab-set::
6170
:sync-group: language
6271

sphinx/source/concepts/entities.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Contains additional state for a unit (or building).
223223

224224
.. code-block:: python
225225
226-
# check if unit is Processing:
226+
# check if unit is processing:
227227
(x.Unit.state & UnitState.Processing) != 0
228228
229229
.. tab-item:: C#
@@ -251,8 +251,9 @@ Amount of mana of the unit (or building).
251251

252252
Move Component
253253
--------------
254-
Timestamp of when the unit finishes its current movement.
255-
Information is available for the next neighboring tile only.
254+
Movements are synchronized on tile-to-tile basis only, the whole path is stored only on the client of the owner of the unit.
255+
This component provides timestamp of when the unit finishes its current movement.
256+
The Position Component already represents the new position.
256257

257258
Aim Component
258259
-------------

sphinx/source/maps/editor.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Editor
2+
======

0 commit comments

Comments
 (0)