-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ri): fix aStar bug, add BFS, add indexers to localPosition and P… #89
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
davidkol
commented
Jul 14, 2022
- fixed a bug in aStar that made it stop looking all the way to the edge of travel distance
- added BFS for potential path
- added indexing to Position and LocalPosition components to speed up path finds
ludns
reviewed
Jul 14, 2022
ludns
reviewed
Jul 14, 2022
alvrs
force-pushed
the
david/pathfinding-fixes
branch
from
July 14, 2022 17:53
8270d50
to
9a21eab
Compare
davidkol
force-pushed
the
david/pathfinding-fixes
branch
from
July 14, 2022 18:48
9a21eab
to
035df3b
Compare
updated:
|
Kooshaba
approved these changes
Jul 14, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tried it out, feels awesome, thank you!
alvrs
reviewed
Jul 14, 2022
packages/ri/client/src/layers/Local/systems/PositionSystem/createPositionSystem.ts
Outdated
Show resolved
Hide resolved
alvrs
reviewed
Jul 14, 2022
packages/ri/client/src/layers/Local/systems/PotentialPathSystem/createPotentialPathSystem.ts
Outdated
Show resolved
Hide resolved
alvrs
reviewed
Jul 14, 2022
alvrs
reviewed
Jul 14, 2022
alvrs
approved these changes
Jul 14, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clean! 👍
alvrs
added a commit
that referenced
this pull request
Jul 25, 2022
* refactor(ri): use int32 instead of uint32 in all components feat(ri): combat MVP (#58) fix: use int32 everywhere fix(ri): do not heal defenders when attacking with negative hp (lol) fix(ri): fail stamina reduction if not enough is present feat(ri): death MVP (#61) Blueprints (#64) * feat(ri): prototype MVP * fix(ri): set current stamina to 0 when spawning a soldier * refactor(ri): prototype -> blueprint feat(ri): adding path movement, moveSpeed and aStar pathfinding, remo… (#62) * feat(ri): adding path movement, moveSpeed and aStar pathfinding, removed keyboard movement * fix(ri): delete destination system, use position system for local path logic * feat(ri): change MoveSpeed from uint32 to int32 * fix(ri): delete old TODO commend * refactor(ri): remove timestamps from right click stream * fix(ri): filter right click stream correctly, remove unecessary checks in path viz * refactor(ri): clean up rightclick stream BlueprintComponents (#66) * feat(ri/contracts): add BlueprintComponentsComponent to allow dynamic construction of blueprints * fix(ri): fix BlueprintComponents getEntitiesWithValue feat: merge main to get new systems pattern (#69) * feat: merge main to get new systems pattern * refactor: move PrototypeSystem back to LibPrototype * feat: new forge test infrastructure * fix(ri/contracts): fix stamina update to allow stamina to go to 0 * fix(ri/contracts): allow combat between attackers with no health or defenders with no attack * fix(ri-contracts): fix dev dependencies and increase local gas limit * feat: use dev mode to disable cache in sync worker * fix(ri/client): pass devMode param to createSystemExecutors * fix(ri-contracts): use existing variable Co-authored-by: Andy Cernera <kooshaba@gmail.com> Co-authored-by: Andy Cernera <kooshaba@gmail.com> Co-authored-by: Big Nuge <davidkolop@gmail.com> * feat: add FactorySystem for constructing units (#72) * Capture entities (#73) * fix: remove LocalPosition when Position is wiped * fix: give all component write access to CombatSystem * feat: capturable units transfer ownership to attacker instead of dying in combat * fix: properly restrict CombatSystem component write access * feat: spawn points (#74) * feat: spawn points * refactor: spawnable -> spawnpoint * fix: comment * fix: various fixes (hot reload, getComponentValue) (#76) * chore: remove constant fallbacks for network config * fix(recs): do not early return for partial undefined values * fix: hot reload issues * fix(recs): return undefined if non-optional type is undefined * fix: typo Co-authored-by: Big Nuge <davidkolop@gmail.com> Co-authored-by: Big Nuge <davidkolop@gmail.com> * feat: inventory (#75) * feat(ri): adding inventory, gold, and prototypes from prototypes * fix(ri-contracts): fix write access to position and stam comps and add owner check * refactor(ri-contracts): remove debugging lines * fix(ri-contracts): fix gold not appearing as an imp and leaving plain tile * refactor(ri/contracts): generate entity IDs inside of copyPrototype function * fix(ri-contracts): add client distance check for takeItem, fix prototype calls in init * feat(ri/client): simple inventory ui * feat(ri): add inventory library, transfer, burn and spawn item, and drop item on death * fix(ri-contracts): fix combatsystem deploy write access for new inventory drop Co-authored-by: Andy Cernera <kooshaba@gmail.com> * fix(network): tx queue nonce management (#77) * feat(ri-client): wang tiles (#78) * feat: wang works * fix: changes to work with nyc-sprint-2 * fix: remove autogenerated art files * fix: remove blueprint reference * feat(art): adding art from git@github.com:latticexyz/ember-art.git * fix(ri/contracts): remove unused types * chore(phaserx): removed unused getTileAt * fix: review * fix: scripting with systems Co-authored-by: alvrs <alvarius@lattice.xyz> * feat(ri/contracts): factory system properly spends resources (#79) * feat(ri/contracts): factory system properly spends gold during construction * refactor(ri/contracts): use getEntitiesWithValue in LibInventory.getItems helper * fix(ri/contracts): spend the proper amount of resources when building in factory * fix(ri/contracts): fix reverts in getInventory helper * fix(ri/client): type change * feat(ri/client): render inventories on the ground as chests (#80) * feat(ri/client): render inventories on the ground as chests * fix(ri/client): remove redundant sprite despawn call * refactor(ri/client): use ProxyExpand to find Inventory component in Selection UI * feat(ri): gold shrines (#82) * feat(ri): adding end game (#86) * feat(ri): add emberCrown, escapePortal, and winner components and system * fix(ri-contracts): change escape system to loop over items for crown instead of check crown owner * fix(ri-contracts): fix turn length back from dev value * fix(ri-client): move outcome text out of the way * feat: map upload, new entity types, and new prototypes (#83) * feat(ri): add prototype dev system * feat(ri): bulk upload, map, new entities * feat(ri): terrain types for map generation Fixed combat properly deleting. Split EntityType and TerrainType into two different values. * fix(ri): remove hack that was needed when Terrain was part of EntityType * fix: remove unsed imports Co-authored-by: Andy Cernera <kooshaba@gmail.com> Co-authored-by: alvrs <alvarius@lattice.xyz> * feat: optimistic updates (#81) * feat: expose withOptimisticUpdates from action system * feat: optimistic updates * fix: remove type module from ri-contracts because it makes hardhat cry * feat(recs): allow partial overrides * feat(recs): change withOptimisitcUpdates api * docs(recs): rewrite comment for clarity * feat: add proxy fragments to dynamic queries (#85) * feat: add proxy fragments to queries * test(recs): add tests for proxy fragments in dymanic queries * feat(ri): more settlements on map * fix(ri/contracts): fix imports in Settlement prototype * feat: add indexers to recs (#84) * chore: add initialBlockNumber and funded deployer key * fix(ri): prevent entities from attacking themselves * fix(ri/contracts): disallow copying non-prototype entities * fix(ri/client): add LocalPosition for the first time on Position update * feat(ri): donkeys! (#87) * feat: make systems run on init by default (fix phaser hot reload) (#91) * chore: add sync worker config log * feat: make systems run on init by default (fix phaser hot reload) * feat(ri): optimistic stamina during movement (#88) * feat(ri): use optimistic stamina calculation for movement * refactor(ri): using partial updates to update optimistic Stamina in moveEntity * refactor(ri): split EntityType into Item, Structure, and Unit 💠 (#90) * refactor(ri): split EntityType into Item, Structure, and Unit * fix(ri): 0 being falsey fucks me at least once a day 🤮 * fix(recs): clone set with indexed entities with values before returning (#92) * refactor(ri): refactor all Type components to use solidity enums (#93) * refactor(ri): remove specific Item components (Gold, EmberCrown) * refactor(ri/contracts): use enum in contracts for ItemType * refactor(ri/contracts): use solidity enums for all *Types * feat(ri): fix aStar bug, add BFS, add indexers to localPosition and P… (#89) * feat(ri): fix aStar bug, add BFS, add indexers to localPosition and Position * refactor(ri-client): refactor pathing to use CoordMap instead of n^2 grid * refactor: move CoordMap out of phaserx package into utils package * fix(ri-client): remove unecessary undefined check in aStar * feat(cli): suggest available lattice chains in interactive deployer (#94) * fix(ri-contracts): breakout init systems into 2 as workaround for forge script gas estimation issue (#95) * feat(ri): adding Player unit and Death component, moving LibECS from … (#98) * feat(ri): adding Player unit and Death component, moving LibECS from std to ri * feat(ri): refactor Player unit as Hero, not directly linked to Player entity * fix(ri-client): fix errant player entity check in moveEntity * refactor(ri): changing inventory ownership model, inventories are no longer entities (#100) * refactor(ri): changing inventory ownership model, inventories are no longer entities * fix(ri-contracts): fix empty settlement cost type and map crown prototype name * fix: optimistic updates, initialBlockNumber, faster initial loading, and more (#97) * feat: make initialBlockNumber part of the deploy script * chore: tweak bulk uploading * feat: speed up component schema loading for encoders * fix: optimistic updates * feat(client): action queue UI for more observability * feat: ability to upgrade systems without losing component state * fix: build client * fix: add manual gas estimate for moving * fix: zero pad entity ids if used as eth addresses * fix(cli): fetch from updated registry * refactor(ri/client): current local stamina is LocalStamina + Stamina.current * fix(ri/contracts): fix TransferInventory system to use new System constructor * fix(ri/scripting): change local constants to point to default world address Co-authored-by: Andy Cernera <kooshaba@gmail.com> * fix(ri/contracts): remove old Blueprint components * fix(ri/contracts): only remove containers when their inv is empty on transfer * refactor(ri/client): fix up attackEntity function * refactor(ri/client): split out huge Position system into 4 systems * fix(ri): remove old comment * fix(ri/client): remove early return in Position pathfinding system * refactor(ri): standardize hash IDs, add getItems util (#101) * refactor(ri): unify hash ID format and case * refactor(ri-client): add util function for getItems * fix(ri/client): fix typos * refactor(ri): nit Co-authored-by: Andy Cernera <kooshaba@gmail.com> * fix(ri/client): properly despawn sprites when LocalPosition is removed * refactor(ri-client): remove unnecessary utils folder * refactor(ri/client): clean up createInputSystem to share more logic and reduce nesting (#105) * refactor(ri/client): clean up createInputSystem to share more logic and reduce nesting * fix(ri/client): fix right click moving * refactor(ri): remove hero and death components (#106) deleting hero and death components from contract and client removing checks to hero and death component in combat and ownership systems removing hero and death from configs and types * chore: review Co-authored-by: Big Nuge <davidkolop@gmail.com> Co-authored-by: alvarius <89248902+alvrs@users.noreply.github.com> Co-authored-by: alvrs <alvarius@lattice.xyz> Co-authored-by: ludens <ludens@lattice.xyz>
LPSCRYPT
pushed a commit
to LPSCRYPT/esp
that referenced
this pull request
Jan 23, 2023
* refactor(ri): use int32 instead of uint32 in all components feat(ri): combat MVP (latticexyz#58) fix: use int32 everywhere fix(ri): do not heal defenders when attacking with negative hp (lol) fix(ri): fail stamina reduction if not enough is present feat(ri): death MVP (latticexyz#61) Blueprints (latticexyz#64) * feat(ri): prototype MVP * fix(ri): set current stamina to 0 when spawning a soldier * refactor(ri): prototype -> blueprint feat(ri): adding path movement, moveSpeed and aStar pathfinding, remo… (latticexyz#62) * feat(ri): adding path movement, moveSpeed and aStar pathfinding, removed keyboard movement * fix(ri): delete destination system, use position system for local path logic * feat(ri): change MoveSpeed from uint32 to int32 * fix(ri): delete old TODO commend * refactor(ri): remove timestamps from right click stream * fix(ri): filter right click stream correctly, remove unecessary checks in path viz * refactor(ri): clean up rightclick stream BlueprintComponents (latticexyz#66) * feat(ri/contracts): add BlueprintComponentsComponent to allow dynamic construction of blueprints * fix(ri): fix BlueprintComponents getEntitiesWithValue feat: merge main to get new systems pattern (latticexyz#69) * feat: merge main to get new systems pattern * refactor: move PrototypeSystem back to LibPrototype * feat: new forge test infrastructure * fix(ri/contracts): fix stamina update to allow stamina to go to 0 * fix(ri/contracts): allow combat between attackers with no health or defenders with no attack * fix(ri-contracts): fix dev dependencies and increase local gas limit * feat: use dev mode to disable cache in sync worker * fix(ri/client): pass devMode param to createSystemExecutors * fix(ri-contracts): use existing variable Co-authored-by: Andy Cernera <kooshaba@gmail.com> Co-authored-by: Andy Cernera <kooshaba@gmail.com> Co-authored-by: Big Nuge <davidkolop@gmail.com> * feat: add FactorySystem for constructing units (latticexyz#72) * Capture entities (latticexyz#73) * fix: remove LocalPosition when Position is wiped * fix: give all component write access to CombatSystem * feat: capturable units transfer ownership to attacker instead of dying in combat * fix: properly restrict CombatSystem component write access * feat: spawn points (latticexyz#74) * feat: spawn points * refactor: spawnable -> spawnpoint * fix: comment * fix: various fixes (hot reload, getComponentValue) (latticexyz#76) * chore: remove constant fallbacks for network config * fix(recs): do not early return for partial undefined values * fix: hot reload issues * fix(recs): return undefined if non-optional type is undefined * fix: typo Co-authored-by: Big Nuge <davidkolop@gmail.com> Co-authored-by: Big Nuge <davidkolop@gmail.com> * feat: inventory (latticexyz#75) * feat(ri): adding inventory, gold, and prototypes from prototypes * fix(ri-contracts): fix write access to position and stam comps and add owner check * refactor(ri-contracts): remove debugging lines * fix(ri-contracts): fix gold not appearing as an imp and leaving plain tile * refactor(ri/contracts): generate entity IDs inside of copyPrototype function * fix(ri-contracts): add client distance check for takeItem, fix prototype calls in init * feat(ri/client): simple inventory ui * feat(ri): add inventory library, transfer, burn and spawn item, and drop item on death * fix(ri-contracts): fix combatsystem deploy write access for new inventory drop Co-authored-by: Andy Cernera <kooshaba@gmail.com> * fix(network): tx queue nonce management (latticexyz#77) * feat(ri-client): wang tiles (latticexyz#78) * feat: wang works * fix: changes to work with nyc-sprint-2 * fix: remove autogenerated art files * fix: remove blueprint reference * feat(art): adding art from git@github.com:latticexyz/ember-art.git * fix(ri/contracts): remove unused types * chore(phaserx): removed unused getTileAt * fix: review * fix: scripting with systems Co-authored-by: alvrs <alvarius@lattice.xyz> * feat(ri/contracts): factory system properly spends resources (latticexyz#79) * feat(ri/contracts): factory system properly spends gold during construction * refactor(ri/contracts): use getEntitiesWithValue in LibInventory.getItems helper * fix(ri/contracts): spend the proper amount of resources when building in factory * fix(ri/contracts): fix reverts in getInventory helper * fix(ri/client): type change * feat(ri/client): render inventories on the ground as chests (latticexyz#80) * feat(ri/client): render inventories on the ground as chests * fix(ri/client): remove redundant sprite despawn call * refactor(ri/client): use ProxyExpand to find Inventory component in Selection UI * feat(ri): gold shrines (latticexyz#82) * feat(ri): adding end game (latticexyz#86) * feat(ri): add emberCrown, escapePortal, and winner components and system * fix(ri-contracts): change escape system to loop over items for crown instead of check crown owner * fix(ri-contracts): fix turn length back from dev value * fix(ri-client): move outcome text out of the way * feat: map upload, new entity types, and new prototypes (latticexyz#83) * feat(ri): add prototype dev system * feat(ri): bulk upload, map, new entities * feat(ri): terrain types for map generation Fixed combat properly deleting. Split EntityType and TerrainType into two different values. * fix(ri): remove hack that was needed when Terrain was part of EntityType * fix: remove unsed imports Co-authored-by: Andy Cernera <kooshaba@gmail.com> Co-authored-by: alvrs <alvarius@lattice.xyz> * feat: optimistic updates (latticexyz#81) * feat: expose withOptimisticUpdates from action system * feat: optimistic updates * fix: remove type module from ri-contracts because it makes hardhat cry * feat(recs): allow partial overrides * feat(recs): change withOptimisitcUpdates api * docs(recs): rewrite comment for clarity * feat: add proxy fragments to dynamic queries (latticexyz#85) * feat: add proxy fragments to queries * test(recs): add tests for proxy fragments in dymanic queries * feat(ri): more settlements on map * fix(ri/contracts): fix imports in Settlement prototype * feat: add indexers to recs (latticexyz#84) * chore: add initialBlockNumber and funded deployer key * fix(ri): prevent entities from attacking themselves * fix(ri/contracts): disallow copying non-prototype entities * fix(ri/client): add LocalPosition for the first time on Position update * feat(ri): donkeys! (latticexyz#87) * feat: make systems run on init by default (fix phaser hot reload) (latticexyz#91) * chore: add sync worker config log * feat: make systems run on init by default (fix phaser hot reload) * feat(ri): optimistic stamina during movement (latticexyz#88) * feat(ri): use optimistic stamina calculation for movement * refactor(ri): using partial updates to update optimistic Stamina in moveEntity * refactor(ri): split EntityType into Item, Structure, and Unit 💠 (latticexyz#90) * refactor(ri): split EntityType into Item, Structure, and Unit * fix(ri): 0 being falsey fucks me at least once a day 🤮 * fix(recs): clone set with indexed entities with values before returning (latticexyz#92) * refactor(ri): refactor all Type components to use solidity enums (latticexyz#93) * refactor(ri): remove specific Item components (Gold, EmberCrown) * refactor(ri/contracts): use enum in contracts for ItemType * refactor(ri/contracts): use solidity enums for all *Types * feat(ri): fix aStar bug, add BFS, add indexers to localPosition and P… (latticexyz#89) * feat(ri): fix aStar bug, add BFS, add indexers to localPosition and Position * refactor(ri-client): refactor pathing to use CoordMap instead of n^2 grid * refactor: move CoordMap out of phaserx package into utils package * fix(ri-client): remove unecessary undefined check in aStar * feat(cli): suggest available lattice chains in interactive deployer (latticexyz#94) * fix(ri-contracts): breakout init systems into 2 as workaround for forge script gas estimation issue (latticexyz#95) * feat(ri): adding Player unit and Death component, moving LibECS from … (latticexyz#98) * feat(ri): adding Player unit and Death component, moving LibECS from std to ri * feat(ri): refactor Player unit as Hero, not directly linked to Player entity * fix(ri-client): fix errant player entity check in moveEntity * refactor(ri): changing inventory ownership model, inventories are no longer entities (latticexyz#100) * refactor(ri): changing inventory ownership model, inventories are no longer entities * fix(ri-contracts): fix empty settlement cost type and map crown prototype name * fix: optimistic updates, initialBlockNumber, faster initial loading, and more (latticexyz#97) * feat: make initialBlockNumber part of the deploy script * chore: tweak bulk uploading * feat: speed up component schema loading for encoders * fix: optimistic updates * feat(client): action queue UI for more observability * feat: ability to upgrade systems without losing component state * fix: build client * fix: add manual gas estimate for moving * fix: zero pad entity ids if used as eth addresses * fix(cli): fetch from updated registry * refactor(ri/client): current local stamina is LocalStamina + Stamina.current * fix(ri/contracts): fix TransferInventory system to use new System constructor * fix(ri/scripting): change local constants to point to default world address Co-authored-by: Andy Cernera <kooshaba@gmail.com> * fix(ri/contracts): remove old Blueprint components * fix(ri/contracts): only remove containers when their inv is empty on transfer * refactor(ri/client): fix up attackEntity function * refactor(ri/client): split out huge Position system into 4 systems * fix(ri): remove old comment * fix(ri/client): remove early return in Position pathfinding system * refactor(ri): standardize hash IDs, add getItems util (latticexyz#101) * refactor(ri): unify hash ID format and case * refactor(ri-client): add util function for getItems * fix(ri/client): fix typos * refactor(ri): nit Co-authored-by: Andy Cernera <kooshaba@gmail.com> * fix(ri/client): properly despawn sprites when LocalPosition is removed * refactor(ri-client): remove unnecessary utils folder * refactor(ri/client): clean up createInputSystem to share more logic and reduce nesting (latticexyz#105) * refactor(ri/client): clean up createInputSystem to share more logic and reduce nesting * fix(ri/client): fix right click moving * refactor(ri): remove hero and death components (latticexyz#106) deleting hero and death components from contract and client removing checks to hero and death component in combat and ownership systems removing hero and death from configs and types * chore: review Co-authored-by: Big Nuge <davidkolop@gmail.com> Co-authored-by: alvarius <89248902+alvrs@users.noreply.github.com> Co-authored-by: alvrs <alvarius@lattice.xyz> Co-authored-by: ludens <ludens@lattice.xyz>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.