Commit Graph

117 Commits

Author SHA1 Message Date
Pavel Penev
b16ebd480b Rename MapGridType.Diamond to MapGridType.RectangularIsometric 2015-10-26 00:42:30 +02:00
Pavel Penev
0e417a3cf3 Rename MapGridType.Rectangle to MapGridType.Rectangular 2015-10-26 00:41:26 +02:00
Pavel Penev
bb3aea338a Rename enum TileShape to MapGridType 2015-10-26 00:41:21 +02:00
Paul Chote
347eb6410c Add a lint pass for map metadata. 2015-10-24 20:36:38 +01:00
abcdefg30
674b1672f5 Merge pull request #9488 from atlimit8/MapMusic
Map Music
2015-10-18 17:47:26 +02:00
Paul Chote
cf875c3db6 Update the UID stored in the map file after saving. 2015-10-17 23:25:52 +01:00
atlimit8
f6180d7fa4 Include add/replace playlist entries support using map.yaml 2015-09-30 10:31:49 -05:00
Pavel Penev
642468ce0c Add MapGrid class
MapGrid is a mod Manifest field which includes (and thus makes redundant) TileSize, TileShape, SubCells info and MaximumTerrainHeight.
2015-09-27 04:14:43 +03:00
RoosterDragon
d9dd96ca35 Speed up Map.ContainsAllProjectedCellsCovering on flat maps.
This method gets called often via Contains calls. We can significantly speed up the method for flat maps since we know the projection and it is trivial to perform. This avoids an expensive projection lookup.
2015-08-31 20:45:32 +01:00
RoosterDragon
4eacb6e5c9 Transparently cache results of GetTerrainIndex in Map.
This method performs an expensive calculation and is called often during pathfinding. We create a cache of the terrain indicies for the map to vastly reduce the cost.
2015-08-31 20:43:17 +01:00
RoosterDragon
fa87befeff Add missing CellEntryChanged checks. 2015-08-31 20:43:16 +01:00
RoosterDragon
d415d3ba4e Reduce allocations in the main game loop.
- Cache the shroud projection even for flat maps to avoid allocating single element arrays.
- Avoid LINQ in shroud and map projection queries to avoid enumerator allocations.
- Avoid LINQ in calculation of sync values.
- Cache enumerables in ProductionQueue.
- Cache delegate in HackyAI.
2015-08-18 21:17:28 +01:00
Paul Chote
3d65ba39f6 Lazily initialize cell projection mapping. 2015-08-02 17:15:39 +01:00
Taryn Hill
6fa1f757b0 Add Map.DistanceAboveTerrain(WPos) and Actor.IsAtGroundLevel() extension method 2015-08-01 11:48:47 -05:00
Paul Chote
a0e92093a1 Fix the WPos <-> CPos conversion.
Fixes #8463.
2015-08-01 11:09:07 +01:00
Paul Chote
d29519fca1 Implement height-aware map.ChooseClosestEdgeCell(). 2015-07-31 08:38:07 +01:00
Paul Chote
05f41a0182 Implement height-aware map.DistanceToEdge(). 2015-07-31 08:38:07 +01:00
Paul Chote
318d6aaa73 Implement height-aware map.ChooseRandomEdgeCell(). 2015-07-31 08:38:07 +01:00
Paul Chote
e337710221 Implement height-aware map.ChooseRandomCell(). 2015-07-31 08:38:06 +01:00
Paul Chote
13e0527f7c Implement height-aware map.Clamp(MPos). 2015-07-30 08:18:45 +01:00
Paul Chote
2c00019715 Revert "Temporarily work around RadarWidget corruption."
This reverts commit 4bc75f1ed6.
2015-07-30 08:18:45 +01:00
Paul Chote
4bc75f1ed6 Temporarily work around RadarWidget corruption. 2015-07-27 20:20:01 +01:00
Paul Chote
e8794032e0 Introduce initial PPos plumbing.
PPos is best thought of as a cell grid applied in
screen space.  Multiple cells with different
terrain heights may be projected to the same PPos,
or to multiple PPos if they do not align with the
screen grid.

PPos coordinates are used primarily for map edge
checks and shroud / visibility queries.
2015-07-27 19:34:49 +01:00
Matthias Mailänder
7447e0bf93 rename WRange to WDist 2015-07-09 10:55:38 +02:00
Paul Chote
19c777a922 Move maximum terrain height definition to mod.yaml. 2015-07-05 17:49:56 +01:00
Paul Chote
7d62ac2b12 Merge RulesetCache.LoadDefaultRules and LoadMapRules. 2015-07-05 14:58:00 +01:00
Paul Chote
e10cb5cd9c Fix an incorrect coordinate check. 2015-07-05 14:57:59 +01:00
Paul Chote
b8b27f11af Remove stub map constructor. 2015-07-05 14:57:58 +01:00
Paul Chote
0dbbc00d0a Simplify editor/importer map creation. 2015-07-05 14:57:58 +01:00
Paul Chote
41fa77d12a Fix projected world coordinate calculation for Lua API. 2015-07-05 14:57:58 +01:00
Oliver Brakmann
fc7df415d7 Merge pull request #8394 from Mailaender/map-container-nre
Fixed a null reference exception in Map.Save
2015-06-20 21:06:00 +02:00
Matthias Mailänder
330982310c avoid a null reference exception 2015-06-20 15:56:26 +02:00
Paul Chote
da3abb4e2e Tweak shroud revealing logic
The per-actor visibility now tracks all cells
inside the map area (including those outside the
currently visible bounds), but the shroud/fog is
only cleared if the cell is inside the currently
visible bounds.
2015-06-15 18:06:42 +01:00
Paul Chote
ba2d499e5d Fix a bug in Map/CellLayer.Contains. 2015-06-11 21:27:35 +01:00
Paul Chote
d21b63ca04 Add some more coordinate utility functions. 2015-06-11 20:59:35 +01:00
Paul Chote
bf4722fb9f Distinguish between all map cells and cells inside map bounds. 2015-06-02 21:53:25 +01:00
David Jiménez
044b51742f Remove plumbing for trait unit tests. 2015-05-01 16:24:14 +12:00
Paul Chote
4b1f541f34 Reorganize actor and smudge loading.
The actor and smudge definitions are now stored
as raw MiniYamlNodes in the map.  It is now the
responsibility of the consumers to parse these
into real objects.
2015-04-30 07:06:14 +12:00
abcdefg30
c4a63eee30 Merge pull request #7875 from penev92/bleed_exposePlayerReferences
Add upgrade rules support for map PlayerReferences
2015-04-26 22:53:42 +02:00
penev92
2402b56da7 Reorganize PlayerReference loading to enable upgrade rules for them.
The PlayerReference definitions are now stored
as raw MiniYamlNodes in the map.
2015-04-26 23:16:20 +03:00
Paul Chote
ab7706073b Don’t crash when asking for the offset of an invalid subcell. 2015-04-19 15:20:45 +12:00
RoosterDragon
9c93001c84 Convert to 32bbp internally in FastCopyIntoSprite.
This avoids the need for callers to ensure the pixel format is correct, but ensures that the copying succeeds when the format is different.
2015-04-17 18:50:49 +01:00
RoosterDragon
84dffce7c1 Added an extension method to clone bitmaps with a 32bbpArgb pixel format. 2015-04-11 21:05:46 +01:00
RoosterDragon
5dfcc3e9d0 Convert custom map previews that are not using PixelFormat.Format32bppArgb. 2015-04-10 19:54:02 +01:00
Paul Chote
c68cb995f4 Move cell corner state into Map. 2015-03-31 20:59:52 +01:00
Paul Chote
2630537daf Fix a mistake in Map.CellContaining.
Fixes #6247.
2015-03-31 20:59:52 +01:00
penev92
5927e1080a Add ChooseClosestEdgeCell() method to the Map class 2015-03-22 16:58:11 +02:00
David Jiménez
54ae572303 - Introduced Unit Testing capabilities to the PathFinder trait and algorithm.
Introduced also a small Unit test project to prove it.

- Separated caching capabilities from PathFinder class to increase cohesion and maintainability.
Refactored the pathfinding algorithm by extracting methods based on responsibilities like
calculating costs and reordering functions. These changes should provide a in average a small increase in
pathfinding performance and maintainability.

- Optimized the pathfinder algorithm to reuse calculations like the
MovementCost and heuristics.

- Introduced base classes, IPathSearch and IPriorityQueue interfaces,
and restructured code to ease readability and testability

- Renamed the PathFinder related classes to more appropriate names. Made the
traits rely on the interface IPathfinder instead of concrete PathFinder
implementation.

- Massive performance improvements

- Solved error with harvesters' Heuristic

- Updated the heuristic to ease redability and adjustability. D can be
adjusted to offer best paths by decreasing and more performance by
increasing it

- Refactored the CellLayer<CellInfo> creation in its own Singleton class

- Extracted the graph abstraction onto an IGraph interface, making the
Pathfinder agnostic to the definition of world and terrain. This
abstraction can help in the future to be able to cache graphs for similar
classes and their costs, speeding up the pathfinder and being able to feed
the A* algorithm with different types of graphs like Hierarchical graphs
2015-03-03 20:11:11 +01:00
David Jiménez
8659a3e71e Introduced the interfaces IActor, ICacheStorage, ILog, IMap, IWorld a
nd IMobileInfo to separate concrete implementations and abstractions
2015-02-22 23:14:12 +01:00
Oliver Brakmann
7267a3afdb Merge pull request #6984 from DeadlySurprise/yamlFix
Fixed yaml bug with leading spaces
2015-01-20 21:42:22 +01:00