Commit Graph

34 Commits

Author SHA1 Message Date
APuddle210 882a39ee70 Added thumbnail generation to the TerrainMapGenerator script. (#292)
Added functions to TerrainMapGenerator to create a bitmap from the
Minimap Terrain array with the colors being identical to those rendered
in game, with the additional change of setting the Alpha of all water to
0.

Calls added to generateTerrainMaps to actually generate the thumbnail
PNGs,

Revision to src\client\utilities\maps.ts to reflect that the images
pulled into the UI should be those ending in 'Thumb.png,'

I've tested by launching the game and starting a few matches.

hile I'd hoped that using the minimaps as the basis for the thumbnails
would speed things up I think the actual bottleneck is the writing to
the file system.

Below is a screenshot showing these thumbnails in the UI.

![Thumbnails
Transparent](https://github.com/user-attachments/assets/764f7857-b333-47b6-9a0d-b0d4f4eb88cd)


![Capture](https://github.com/user-attachments/assets/4df17927-0ad0-45c6-bcc5-7ddc490d9ce7)

![Capture
1PNG](https://github.com/user-attachments/assets/3bd78d61-644a-4b4d-9646-df260a0e7c0f)

![Capture
3](https://github.com/user-attachments/assets/e7693a8b-1daf-4bd7-96d4-3a350564f31b)


Finally I will say that while the code additions work, given my novice
status with typescript and asynch calls these changes may benefit more
from review and a little critical feedback before they're ready to
merge.
2025-03-19 10:55:33 -07:00
Ilan Schemoul 40b7fe9833 feat: add warship tests (#291) 2025-03-18 20:35:31 -07:00
APuddle210 48d111bf0d Add new map, iberia, france, north africa (#285)
Addition of new map, 'Gateway to the Atlantic' covering Iberia, France,
and North Africa.

Tested via loading to local build, ensuring the game launched
succesfully, and ran a full game through to completion. Confirmed
thumbnail is displayed in the UI.

Discovered possibly undocumented bug: minimap binary generation fails if
either the width or height of the provided map image is an odd number.

Not sure what proper tests for a new map would look like, hope this is
sufficient testing.

![Thumbnail in
UI](https://github.com/user-attachments/assets/d78e51b8-8571-4244-bb55-8b4f95748108)

![Game
Starts](https://github.com/user-attachments/assets/124beaa3-8f57-4015-bdc6-7bde19a4a5ba)

![Game
Proceeds](https://github.com/user-attachments/assets/e8bb9a59-9bfb-4882-88c8-bf11d709244b)

![Game Proceeds
More](https://github.com/user-attachments/assets/7ec899eb-0338-4ec9-995f-20717e7f80b3)

![Game Proceeds
x2](https://github.com/user-attachments/assets/6c286cd6-4e13-4766-845e-393faebac116)

![Game
Completed](https://github.com/user-attachments/assets/20653b5e-0592-4a44-b3b3-58ea612a42b3)
2025-03-18 12:05:11 -07:00
evanpelle cd1f8b9586 add testing infrastructure and example test (#276) 2025-03-17 12:20:23 -07:00
APuddle210 67af4b06ab TerrainMapGenerator General Cleanup (#234)
> There were 4 separate implementations of getting neighboring
coordinates for a given x,y pair, 3 completely unique implementations.
These were found in neighbors(), processOcean(), processDistToLand(),
and getArea(), with processOcean() and processDistToLand() having
essentially identical implementations. Created new function
getNeighborCoords() with implementation closely resembling that found in
neighbors().

Revised aforementioned functions to utilize the new getNeighborCoords()
instead, with revised implementations being much more consistent across
the impacted functions.

> Revised getArea() to correctly assess the area, was previously likely
to overestimate the area as it included all coordinates it check
regardless of their terrainType. getArea() now also explicitely
implements the Coord[] interface, allowing for standardized
implementation syntax in all functions which call getArea().

Also removed the parameter targetType as all calls to getArea()
targetted the same TerrainType as was present at the passed x, y
position. getArea() will now assess targetType based on the passed x, y
values.

Reordered the parameters of getArea() so that it conformed with the
ordering used elsewhere in the script (x, y, map, visited). Updated all
calling locations accordingly.

> Revised processOcean() to make use of getArea() instead of using its
own reimplementation of area checking. This coupled with the use of the
new getNeighborCoords() significantly reduced the size of processOcean
and improved comprehensibility.

Also removed unnecessary check of waterBody.size that would always
return TRUE in that context.

> Removed checks against and setting of Terrain.ocean values in the
removeSmallIslands() and removeSmallLakes() functions as these functions
are called prior to processOcean() making the checking
redundant/unncessary, and the setting potentially problematic.

Revised Terrain class to default ocean to false, to address compiler
warning, and since processOcean() handles setting this property to true
explicitly.

Reduced total lines from 417 to 372.
2025-03-13 06:02:30 -07:00
evanpelle 4281095666 update maps: remove small lakes as it breaks encirclement. More money… (#188)
… more frequent trade ships, lakes prevent encirclement, warships start
at full health
2025-03-08 16:45:23 -08:00
evanpelle c99cec8f0b add South America map (#184) 2025-03-08 12:11:34 -08:00
BeGj 619891741f linting 2025-03-07 16:53:10 +00:00
Evan 84f067d66b remove small lakes, use largest body of water as ocean 2025-03-03 20:00:12 -08:00
ilan schemoul 373a1aacf7 feat: remove small islands when loading a map
Also updated the map loader to now run on every single map (in the
`maps` array).
Also now maps are loaded concurrently (run every promise at the same
time and wait that they are all finished). As the functions are CPU
bound and not IO bound running concurrently doesn't change much right
now but it can if we use more promise in the function loadTerrainMap
then things will get faster.
2025-03-02 22:47:09 +01:00
Evan db4e520886 fix africa map: add straight of gibraltar 2025-03-02 09:29:10 -08:00
Evan 4ccd6071c6 connect ocean on asia map to allow boats 2025-02-23 20:37:39 -08:00
Evan 4ee37323f9 format codebase with prettier 2025-02-01 12:05:11 -08:00
Evan f0f5bae79f thread_split: convert all tile to tileref 2025-02-01 12:05:11 -08:00
Evan eed90dece5 update europ and world maps 2025-01-05 12:56:04 -08:00
Evan f7fda4fb48 remove single pixel lakes 2025-01-05 12:38:06 -08:00
Evan 903a630953 added Black Sea 2025-01-02 11:16:43 -08:00
Evan 2ceeda051d added suez canal 2024-12-27 10:21:09 -08:00
evanpelle 111775a3f4 generate mini map offline and load it from binary. this reduces loading time by 30-40% 2024-12-25 11:27:36 -08:00
Evan 951585a8ed NorthAmerica has panama canal, fixed ocean calculation for Oceania 2024-12-12 21:00:10 -08:00
Evan da7637477c add Oceania and North America maps 2024-12-08 20:56:19 -08:00
Evan 30f72a3365 NPCs create battleships, destroyers. start work on miniastar 2024-11-30 12:41:22 -08:00
Evan 3e4f4e42cf created path finding web worker 2024-11-29 11:34:03 -08:00
Evan 8b76717ef0 added Mena 2024-10-30 20:45:08 -07:00
evanpelle 0904125b69 fix terrain map generator 2024-10-11 14:26:37 -07:00
evanpelle bb8827c8ad use europe map 2024-10-09 10:51:56 -07:00
evanpelle 7235b73b6c * deleted old maps
* fixed bug where NPC and Bots had same id
* NPCs spawn near IRL location
* NPCs have different strength (starting troops)
* game has more NPCs than before
* Needs more balancing
2024-10-08 20:42:35 -07:00
evanpelle 9c58f99968 improve map terrain color 2024-08-31 14:43:33 -07:00
evanpelle 8b2c2a13c0 add terrain to map 2024-08-30 22:01:08 -07:00
evanpelle 41d7c77d2d tiles now have lake or ocean method 2024-08-23 17:53:55 -07:00
evanpelle 98cf1b6beb create binary repr of map 2024-08-23 12:08:57 -07:00
evanpelle ac556ee073 preprocess map into binary data 2024-08-22 21:01:40 -07:00
evanpelle d0f4f4d129 create script to pack and upack map data 2024-08-21 08:06:36 -07:00
evanpelle 8bd86d0384 trying to build protos 2024-08-20 08:11:41 -07:00