1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
Commit Graph

247 Commits

Author SHA1 Message Date
Andrii Danylchenko
f327c46fa3 AI pathfinding: rename and add const to functions 2018-10-07 14:51:27 +03:00
Andrii Danylchenko
7150fc9f71 AI: pathfinder api supports configuration 2018-09-23 15:26:53 +03:00
Arseniy Shestakov
ac66fc7f42 Full rework of pre-game interface and networking
New features for players:
* Loading for multiplayer. Any save could be used for multiplayer.
* Restart for multiplayer. All clients will restart together.
* Loading from single save.
* Hotseat mixed with network game. Multiple players per client.
* Now connection to server could be cancelled.
* Return to menu on disconnections instead of crashes.
* Restoring of last selected map, save or campaign on next run.

TLDR on important changes in engine code:
* UI: work with server separated from UI
* UI: all explitic blitting replaced with IntObject's
* UI: all new code use smart pointers instead of DISPOSE
* Gameplay always start through lobby controlled by server.
* Threads receiving netpacks now shared for lobby and gameplay.
* Campaigns: heroes for crossover now serialized as JsonNode.
2018-04-04 14:24:26 +07:00
AlexVinS
0b70baa95e Spells configuration version 2 (effect-based)
* Indirect spell effects loading
* Json serializer improvements
* spell->canBeCastAt do not allow useless cast for any spell
* Added proxy caster class for spell-created obstacles
* Handle damage from spell-created obstacles inside mechanics
* Experimental GameState integration/regression tests
* Ignore mod settings and load only "vcmi" mod when running tests
* fixed https://bugs.vcmi.eu/view.php?id=2765 (with tests)
* Huge improvements of BattleAI regarding spell casts
* AI can cast almost any combat spell except TELEPORT, SACRIFICE and obstacle placement spells.
* Possible fix for https://bugs.vcmi.eu/view.php?id=1811
* CStack factored out to several classes
* [Battle] Allowed RETURN_AFTER_STRIKE effect on server side to be optional
* [Battle] Allowed BattleAction have multiple destinations
* [Spells] Converted limit|immunity to target condition
* [Spells] Use partial configuration reload for backward compatibility handling
* [Tests] Started tests for CUnitState
* Partial fixes of fire shield effect
* [Battle] Do HP calculations in 64 bits
* [BattleAI] Use threading for spell cast evaluation
* [BattleAI] Made AI be able to evaluate modified turn order (on hypothetical battle state)
* Implemented https://bugs.vcmi.eu/view.php?id=2811
* plug rare freeze when hypnotized unit shots vertically
* Correctly apply ONLY_MELEE_FIGHT / ONLY_DISTANCE_FIGHT for unit damage, attack & defense
* [BattleAI] Try to not waste a cast if battle is actually won already
* Extended JsonSerializeFormat API
* fixed https://bugs.vcmi.eu/view.php?id=2847
* Any unit effect can be now chained (not only damage like Chain Lightning)
** only damage effect for now actually uses "chainFactor"
* Possible quick fix for https://bugs.vcmi.eu/view.php?id=2860
2018-02-08 11:37:21 +03:00
AlexVinS
3bbff27127 Wiped CDefEssential 2017-09-06 15:13:28 +03:00
ArseniyShestakov
9d9c026c85 Code style: serialize everything on own lines for easier debugging (#357) 2017-07-31 16:35:42 +03:00
Arseniy Shestakov
f1e5797834 Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
ArseniyShestakov
2f305cc68d Remove code related to duel mode (#312)
Remove code related to duel mode
2017-07-01 16:30:13 +03:00
AlexVinS
86f9df5f68 Made gamestate lock static 2017-06-14 07:59:41 +03:00
Alexander Shishkin
7e1b0d71c5 Added option for saving generated maps on client side (#307)
* new configuration option 'general.saveRandomMaps'
* maps being saved to 'userCachePath/RandomMaps'
* no deletion of old random maps
* map filename generated based on template name and random seed
2017-06-04 20:33:28 +03:00
Arseniy Shestakov
c8faca8f39 Refactoring: only use RNGs explicitly to avoid bug prone code in future
Now server-side code should always use CRandomGenerator::getDefault which is serialized in GH.
CGameState::getRandomGenerator should be only used from GS code and CPackForClient-based applyGs.
2016-09-11 00:10:46 +03:00
Arseniy Shestakov
70abae9b51 CGameState::battleGetBattlefieldType: use RNG by ref
For now I not sure about proper place for battleGetBattlefieldType so I left it in GS
2016-09-09 23:16:43 +03:00
Arseniy Shestakov
ea63497b19 Move CGameState::setupBattle code to CGameHandler::setupBattle
No reason to keep this code in GS.
2016-09-09 23:16:43 +03:00
Arseniy Shestakov
9fd1cff090 Refactoring: always use std prefix for shared_ptr, unique_ptr and make_shared
Long time ago it's was used without prefix to make future switch from boost to std version easier.
I discusses this with Ivan and decide to drop these using from Global.h now.

This change wouldn't break anything because there was already code with prefix for each of three cases.
2015-12-29 05:43:33 +03:00
DjWarmonger
be50d699fb Compile fixes for MSVS 2015-12-23 15:23:56 +01:00
ArseniyShestakov
e872b400b7 Comments save format backward compatability code as Ivan suggested
Also we should always handle RumorState::TYPE_NONE in getTavernRumor properly anyway.
2015-12-06 02:51:54 +03:00
ArseniyShestakov
c83f15e413 Merge branch 'develop' into feature/tavernRumors
Conflicts:
	lib/CGameState.h
2015-12-05 01:01:26 +03:00
ArseniyShestakov
d856fde73f Rumors: use enum instead of magic numbers and avoid potential crash 2015-12-04 22:58:14 +03:00
Ivan Savenko
7b5a7f43ad Removed includes of CGameState from headers 2015-12-02 21:39:53 +02:00
Ivan Savenko
c3ce4b25df Removed all #include's of CMap.h from headers.
To all - please, avoid #include's in headers as much as possible
This kills incremental build compile times
2015-12-02 21:05:10 +02:00
ArseniyShestakov
ffcc5ccdd2 Rumors: implement support for grail terrain rumor 2015-12-01 04:57:52 +03:00
ArseniyShestakov
15273ac0f7 Rumors: avoid repeating of same rumor twice in a row
Multiple rumors of same type can go in a row, but not identical rumors.
2015-12-01 02:14:11 +03:00
ArseniyShestakov
98582d628c Rumors: move code into CGameState and add backward compatability 2015-12-01 00:44:58 +03:00
ArseniyShestakov
b2e1ee5363 CGameState: move two pathfinding-related functions to CPathfinderHelper
Both getMovementCost and getNeighbours have nothing to do with gamestate.
2015-11-10 02:15:27 +03:00
ArseniyShestakov
d3c8ca7c1c Pathfinding: implement duration checking for fly and water walking
Now pathfinder take into account different bonuses for different tuns. So if you only have FLYING_MOVEMENT bonus from Fly spell for one turn then pathfinder will only let you use air layer within one turn only.

That work for cost calculations too. Let's say you have two bonuses:
 - FLYING_MOVEMENT with 20% penalty for next 2 turns
 - FLYING_MOVEMENT with 40% penalty for 5 turns
Now pathfinder using correct penalty for each turn so movements in air layer going to be more expensive on 3-5 turns.
2015-11-09 19:57:26 +03:00
ArseniyShestakov
45e4cf354e Revert "Pathfinding: do path calculation in separate thread"
This reverts commit f376b27999.
2015-11-09 09:35:56 +03:00
ArseniyShestakov
f376b27999 Pathfinding: do path calculation in separate thread 2015-11-08 19:19:48 +03:00
ArseniyShestakov
6b34eb729e Move all pathfinding-related code into new file 2015-10-27 03:34:47 +03:00
ArseniyShestakov
01257efc02 CPathfinder: get rid of curPos and pass on initializeGraph 2015-10-26 20:17:10 +03:00
ArseniyShestakov
44ca00cd16 CPathfinder: rename functions 2015-10-25 19:11:00 +03:00
ArseniyShestakov
a536691781 CPathfinder: fix typos and more code cleanups 2015-10-25 17:01:28 +03:00
ArseniyShestakov
939b3c05a1 CPathfinder: use struct instead of enum for options
Suggested by @DjWarmonger as better alternative from performance standpoint while struct still more organized than bunch of variables.
Other reason of change it's that in future we may need non-boolean options, e.g for patrol movement and some new pathfinder usages.
2015-10-24 15:34:27 +03:00
ArseniyShestakov
fc6f62e633 getMovementCost: get rid of useless flying parameter 2015-10-19 07:27:00 +03:00
ArseniyShestakov
9954dfb33a CPathfinder: move flying into options and add walk on sea 2015-10-12 19:03:08 +03:00
ArseniyShestakov
0faedde6b9 CPathfinder: store pathfinding options in set instead of variables
There is plenty of variables now and in future I'm going to add more more once pathfinder become usable for all kind of things.
2015-10-12 10:29:39 +03:00
ArseniyShestakov
213d8c2258 CPathfinder: turn checkDestinationTile into function
This code was only kept as lamba to access guard related variables that is now gone.
2015-10-12 08:22:31 +03:00
ArseniyShestakov
1beacf2260 CPathfinder: move guard checks into functions 2015-10-12 08:13:10 +03:00
ArseniyShestakov
c6f9cd1e52 CPathfinder: move passability checks into renamed goodForLandSeaTransition
There no need in dedicated function for embark / disembark and other conditions belong there perfectly.
This function is going to check what movements are plain impossible so we don't have to bother check their cost.
2015-10-12 07:10:33 +03:00
ArseniyShestakov
ee4305cd6d CPathfinder: move destTopVisObjID where it's belongs to 2015-10-10 19:02:21 +03:00
ArseniyShestakov
13c2b5e2d8 CPathfinder: separate teleporter exits and neighbour tile code
This way code that handle real neighbour tiles is more readable and teleport exits don't have to go via all checks they ignore anyway.
2015-10-10 17:17:41 +03:00
ArseniyShestakov
f15065fdc5 CPathfinder: separate neighbours code into getNeighbours
This is first step to make this code usable outside of calculatePaths.
2015-10-10 16:09:40 +03:00
ArseniyShestakov
2145be281a Merge pull request #86 from ArseniyShestakov/fixQuestSaving
Fix saving of player's quests and bump save format version
2015-03-10 18:01:38 +03:00
DjWarmonger
ec879046ca Merge pull request #93 from ArseniyShestakov/feature/pathfindingTeleports
Okay let's do this!
2015-03-10 09:04:25 +01:00
ArseniyShestakov
530b63f7c4 CPathfinder: add all new code for pathfinding via teleporters
Each kind of teleporter have own function that determine if it's should or shouldn't be used.
For now Monolith with bidirectional channels and Subterranean Gate are united.
2015-03-08 17:13:26 +03:00
AlexVinS
b6038240ab Implemented DISGUISE spell. Untested 2015-02-26 08:39:59 +03:00
ArseniyShestakov
7c5af02b78 Fix saving of player's quests
This commit break saves compatibility
2015-02-12 13:19:22 +03:00
Ivan Savenko
6c0c03d74b Refactoing of pathfinder <-> client/AI interaction to remove dependency on selected hero
- finished removal of server-side setSelection
- disabled some broken code (AI & cheats). TODO: fix
2014-09-21 16:42:08 +03:00
Ivan Savenko
78709e223b Breaking things - trying to remove server-side knowledge of selected objects 2014-09-19 00:18:49 +03:00
Ivan Savenko
32240da34e Reduced number of #include's in headers. May break compilation on Win
since some net packs now need DLL_LINKAGE
2014-06-25 17:11:07 +03:00
Ivan Savenko
b2e8c92383 Cleanup:
- removed commented-out #includ'es
- renamed some files to match name of class
2014-06-05 20:26:50 +03:00