Skip to content

Commit

Permalink
feat: tiled support (#39)
Browse files Browse the repository at this point in the history
* feat:  add jpg support to asset loader

Signed-off-by: Sam Biggins <[email protected]>

* refactor: move assets to named folder for future re-skinning feature

* feat(assets): add sample tileset

Signed-off-by: Sam Biggins <[email protected]>

* feat(assets): support tilemaps, resource replacement, tiles as sprites

Signed-off-by: Sam Biggins <[email protected]>

* feat(assets): support 2-tile wide sprites

Signed-off-by: Sam Biggins <[email protected]>

* refactor(assets): break bootScene loader down in to simpler functions

Signed-off-by: Sam Biggins <[email protected]>

* feat(assets): support n by n sized tiles for sprites

Signed-off-by: Sam Biggins <[email protected]>

* fix(assets): support single tile texture replacement

Signed-off-by: Sam Biggins <[email protected]>

* feat(assets): handle multiple tilesets

Signed-off-by: Sam Biggins <[email protected]>

* refactor(assets): create types for assets and tilesets

Signed-off-by: Sam Biggins <[email protected]>

* refactor(assets): create tileProcessor and assetLoader classes to simplify bootScene

Signed-off-by: Sam Biggins <[email protected]>

* refactor(assets): use logger instead of console for logging

Signed-off-by: Sam Biggins <[email protected]>

---------

Signed-off-by: Sam Biggins <[email protected]>
  • Loading branch information
smileynet authored Jul 4, 2023
1 parent 33b9d57 commit 6375629
Show file tree
Hide file tree
Showing 63 changed files with 4,745 additions and 215 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_VERBOSE=false
VITE_GRAPHICS_SET=kennynl
31 changes: 18 additions & 13 deletions COMMITLOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
## 0.0.1 (2023-06-18)
## 0.0.1 (2023-07-04)


### Features

* add jpg support to asset loader ([0a7df34](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/0a7df34f5e5cc760820a7bcbf4d74352d2ccd1de))
* add attack action ([31fa593](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/31fa59399e97e3ecea040562db98fd1b61fe23af))
* add collision system ([ea1294b](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/ea1294b51721cae8f8199d78d7bed16ccb28c2dc))
* add config with debug toggle, ability to skip intro ([1e660ac](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/1e660acd7a4f75403a02ba2cb0bc88ff5846235c))
* add config with debug toggle, ability to skip intro ([020d3e6](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/020d3e69bc2e5116246079cb37b04d47c5bd92d1))
* add placeholder image for missing assets ([c5db639](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/c5db639252d44bccd2b6f419fccd76ab5aae2d81))
* add title screen ([4bc4a62](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/4bc4a6217db44bb4f2156251dbd882c0322b9c41))
* **biome:** add logging ([fa0c3e6](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/fa0c3e6fa6dcc4e0b60df8ee88f32969dd2ed3bd))
* **biome:** implement collision detection to avoid object overlap ([6d68a86](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/6d68a8688844d61f77980a07358ef21b94a086a7))
* **biome:** implement overmap generation ([68b7fb1](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/68b7fb1c4e3d2177dbdba133de0b79e74c8048b1))
* **biome:** initial biome implementation ([4f44578](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/4f445785b7a56a05656519f0cc392edad70958af))
* **biome:** use weights for generating items and objects ([0453bb8](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/0453bb8bc9f08f0d3f67cf9b8295f033ea14d69d))
* **assets:** add sample tileset ([5e45668](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/5e45668d1a9fe77684d9de7ca9f1adc611ac4db5))
* **assets:** handle multiple tilesets ([c81e98d](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/c81e98da4e8351f559d66ca96c82373128520e5a))
* **assets:** support 2-tile wide sprites ([fe3ccf2](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/fe3ccf240e29f8db6041ef36a622f75e3eebb7b7))
* **assets:** support n by n sized tiles for sprites ([d8f10f0](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/d8f10f0d9e49938f2dc11302aade514318eb1952))
* **assets:** support tilemaps, resource replacement, tiles as sprites ([63c1aa2](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/63c1aa25101514c34843e90002036a038ffd981e))
* **biome:** biome and overworld generation ([#37](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/37)) ([33b9d57](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/33b9d57c6bd419f03dc216772f06d6d89f026cec))
* collider ([57609dc](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/57609dccc238981e0f2f2b79efa9fd128a2c3e1e))
* collider ([59f99e3](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/59f99e3245e458d61d063af0db947cdc5ac49afe))
* **crafting:** implement recipes ([#31](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/31)) ([324d07b](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/324d07ba94ae02ff77633452ee112a8b0e165bf8))
Expand All @@ -23,7 +25,6 @@
* **debug:** add player debug pane ([7967c6c](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/7967c6c53a464f5850354bb4d0024f75de34e556))
* **entity:** implement crafting ui, make windows draggable ([#32](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/32)) ([63644a9](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/63644a91f37b935d9c31e148cfeeea94e648347c))
* **entity:** implement switch focus functionality ([#35](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/35)) ([ba32400](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/ba32400fc5198a945c61de1825028baa69652f37))
* **entity:** set scene camera to follow player, migrate console logging to logger ([8cb7490](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/8cb7490c4539758fa3f1432eeb9b0e5aa6b65fb4))
* health system ([d9da38f](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/d9da38f090ab54b97283b22728ba113980cc270c))
* help screen ([#29](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/29)) ([1035d98](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/1035d987085ff1355a2f09e3c306b377af7abe92))
* help screen ([#29](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/29)) ([57aafc1](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/57aafc19cd0a110dbfb7acfe668244ea5981798d))
Expand All @@ -43,6 +44,7 @@

### Bug Fixes

* **assets:** support single tile texture replacement ([2165adc](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/2165adc6a06e68ff99cda461528b575793e2424a))
* collision no longer causes sync issues between sprite and movement, remove arcade physics ([26fc59d](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/26fc59dead327c274daee7515703557d2b2f69a8))
* duplicate player and control initialization ([a43feb6](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/a43feb6dfacbd75c973b10023ec928c26e6bbabb))
* duplicate player and control initialization ([6ff6fd0](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/6ff6fd040142a226f274c83c01188aac567017a0))
Expand All @@ -60,6 +62,11 @@
* playwright snapshot compatibility with CI ([e18ff7f](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/e18ff7f28de1c8647a956d62910f773f5188c12c))


### Documentation

* add comments to file headers ([c471206](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/c471206fe504c68bfa89f8f5fd62b35afc4e2593))


### Styles

* add assets ([8814c65](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/8814c65832eb24e7a0b564b96dc6f75b431b01fa))
Expand Down Expand Up @@ -129,13 +136,17 @@
### Code Refactoring

* arrange files to appropriate folders ([f3e7248](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/f3e72484db44cd118fda3e30cd01a2a037148267))
* **assets:** break bootScene loader down in to simpler functions ([8a443e6](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/8a443e646661782db4b7044f2acea763ba10f6f0))
* **assets:** create tileProcessor and assetLoader classes to simplify bootScene ([6ae5743](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/6ae57435844a298ee86382574d1ad051371277e4))
* **assets:** create types for assets and tilesets ([49b650e](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/49b650ea9518e2019688cac2f3f14a38f7265222))
* **assets:** remove tiled ([26c1d73](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/26c1d73bfe15952bf8910f1a8f9ea86fad8a78ba))
* boot, title screens separated ([7d04e6d](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/7d04e6d5352cd13ab8b24e5fb5202d0c5bdeb463))
* deinitialize object instead of destroying it ([8d39288](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/8d39288859cae40c3420da00f308252c979ab05b))
* fix collision logging to only announce hard collisions, increase player speed ([4a23586](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/4a23586df19b66afe3f246a395dd15dc9102a942))
* focus system clean-up ([#30](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/30)) ([aac8970](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/aac89708b240d37a164dfc9eef5b3dd9b029e68f))
* focus system clean-up ([#30](https://github.com/Unnamed-GameDev-Studio/postapoc/issues/30)) ([b0e34af](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/b0e34afb22a077b948e1898cd8639f2303caacc4))
* init conig ([46997fa](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/46997fa39d94c2acf0e3a0e9b7df33f89dc5c9f2))
* move assets to named folder for future re-skinning feature ([9b54506](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/9b54506cd8076a3f400ef8df37c1eb8524b5b201))
* move conventional-changelog config to file ([2ff3b4e](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/2ff3b4eff8e226060b3a81d22c56e7c0f69f6a1b))
* move files to correct subfolders ([d811f65](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/d811f6515feb9fbc695a9792c6c27b953ba2f2ac))
* move files to correct subfolders ([23a3e45](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/23a3e45e615c469b278e0c6ddba502839bb1c3ff))
Expand All @@ -160,9 +171,3 @@
* time system ([53f7ab2](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/53f7ab27c2795824b7fa8de56475d742fac5bad3))
* time system ([31ea1fc](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/31ea1fc988b11e398ca9eb1cdfc6469609829f71))


### Documentation

* add additional project inspirations to prompt file ([030ed98](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/030ed981feb01afda29bf77fbbcc3e64a7f01834))
* add comments to file headers ([c471206](https://github.com/Unnamed-GameDev-Studio/postapoc/commit/c471206fe504c68bfa89f8f5fd62b35afc4e2593))

89 changes: 54 additions & 35 deletions FILETREE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,43 @@
|-- PROMPT.md
|-- README.md
|-- assets
| |-- items
| | `-- hammer.svg
| |-- objects
| | |-- bench.svg
| | |-- board.svg
| | |-- door.svg
| | |-- log.svg
| | |-- pipe.svg
| | |-- player.svg
| | |-- rock.svg
| | |-- stick.svg
| | `-- tree.svg
| |-- tiles
| | |-- concrete_wall.svg
| | |-- dirt.svg
| | |-- dirt2.svg
| | |-- dirt3.svg
| | |-- grass.svg
| | |-- grass2.svg
| | |-- grass3.svg
| | |-- grass4.svg
| | `-- white_tile.svg
| `-- ui
| |-- forest_silhouette.svg
| |-- grey_arrow.svg
| |-- mushroom_cloud.svg
| |-- postapoc_title.svg
| |-- red_arrow.svg
| `-- starry_night.svg
| |-- kennynl
| | |-- License.txt
| | |-- Tilesheet.txt
| | |-- roguelike-city.json
| | |-- roguelike-city.png
| | |-- roguelike-city.tmx
| | `-- survival-items.png
| `-- prototype
| |-- items
| | `-- hammer.svg
| |-- objects
| | |-- bench.svg
| | |-- board.svg
| | |-- door.svg
| | |-- log.svg
| | |-- pipe.svg
| | |-- player.svg
| | |-- rock.svg
| | |-- stick.svg
| | `-- tree.svg
| |-- tiles
| | |-- concrete_wall.svg
| | |-- dirt.svg
| | |-- dirt2.svg
| | |-- dirt3.svg
| | |-- grass.svg
| | |-- grass2.svg
| | |-- grass3.svg
| | |-- grass4.svg
| | `-- white_tile.svg
| `-- ui
| |-- forest_silhouette.svg
| |-- grey_arrow.svg
| |-- mushroom_cloud.svg
| |-- postapoc_title.svg
| |-- red_arrow.svg
| `-- starry_night.svg
|-- conventional-changelog.config.js
|-- index.html
|-- jest.config.ts
Expand Down Expand Up @@ -78,28 +86,32 @@
| | `-- overworldManager.ts
| |-- core
| | |-- assets
| | | |-- itemAssets.json
| | | |-- menuAssets.json
| | | |-- objectAssets.json
| | | |-- terrainAssets.json
| | | `-- uiAssets.json
| | | |-- kennynl
| | | | `-- tilesetAssets.json
| | | `-- prototype
| | | |-- itemAssets.json
| | | |-- menuAssets.json
| | | |-- objectAssets.json
| | | |-- terrainAssets.json
| | | `-- uiAssets.json
| | |-- config
| | | |-- constants.ts
| | | `-- controlMapping.json
| | |-- data
| | | |-- events.ts
| | | |-- interfaces.ts
| | | `-- types.ts
| | |-- scenes
| | | |-- bootScene.ts
| | | |-- mainScene.ts
| | | `-- titleScene.ts
| | |-- systems
| | | |-- assetLoader.ts
| | | |-- controlSystem.ts
| | | |-- eventBus.ts
| | | |-- eventHandler.ts
| | | |-- inversify.config.ts
| | | |-- keyBindings.ts
| | | |-- tileProcessor.ts
| | | `-- universe.ts
| | `-- utils
| | `-- svgUtils.ts
Expand Down Expand Up @@ -182,6 +194,13 @@
| |-- objectPool.test.ts
| `-- timeSystem.test.ts
|-- tsconfig.json
|-- utils
| |-- cdda_to_tiled.js
| |-- converted.json
| |-- original.json
| |-- tilemap_packed.png
| |-- tileset.json
| `-- tileset.png
|-- vite.config.ts
`-- yarn.lock
Expand Down
23 changes: 23 additions & 0 deletions assets/kennynl/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


Roguelike Modern City (2.0)

Created/distributed by Kenney (www.kenney.nl)
Creation date: 29-10-2022

------------------------------

License: (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/

This content is free to use in personal, educational and commercial projects.

Support us by crediting Kenney or www.kenney.nl (this is not mandatory)

------------------------------

Donate: http://support.kenney.nl
Patreon: http://patreon.com/kenney/

Follow on Twitter for updates:
http://twitter.com/KenneyNL
9 changes: 9 additions & 0 deletions assets/kennynl/Tilesheet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Tilesheet information:

Tile size • 16px × 16px
Space between tiles • 1px × 1px
---
Total tiles (horizontal) • 37 tiles
Total tiles (vertical) • 28 tiles
---
Total tiles in sheet • 1036 tiles
147 changes: 147 additions & 0 deletions assets/kennynl/roguelike-city.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{ "compressionlevel":-1,
"editorsettings":
{
"chunksize":
{
"height":32,
"width":32
}
},
"height":20,
"infinite":true,
"layers":[
{
"chunks":[],
"height":0,
"id":1,
"name":"Tile Layer 1",
"opacity":1,
"startx":0,
"starty":0,
"type":"tilelayer",
"visible":true,
"width":0,
"x":0,
"y":0
}],
"nextlayerid":2,
"nextobjectid":1,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.10.1",
"tileheight":32,
"tilesets":[
{
"columns":37,
"firstgid":1,
"image":"roguelike-city.png",
"imageheight":896,
"imagewidth":1184,
"margin":0,
"name":"roguelike-city",
"spacing":0,
"tilecount":1036,
"tileheight":32,
"tiles":[
{
"id":401,
"properties":[
{
"name":"type",
"type":"string",
"value":"tree-1x1"
}]
},
{
"id":438,
"properties":[
{
"name":"type",
"type":"string",
"value":"tree-2x1"
}]
},
{
"id":572,
"properties":[
{
"name":"type",
"type":"string",
"value":"bench-1x1"
}]
},
{
"id":573,
"properties":[
{
"name":"type",
"type":"string",
"value":"bench-1x2"
}]
},
{
"id":888,
"properties":[
{
"name":"type",
"type":"string",
"value":"grass"
}]
},
{
"id":889,
"properties":[
{
"name":"type",
"type":"string",
"value":"grass2"
}]
},
{
"id":892,
"properties":[
{
"name":"type",
"type":"string",
"value":"dirt"
}]
},
{
"id":893,
"properties":[
{
"name":"type",
"type":"string",
"value":"dirt2"
}]
}],
"tilewidth":32
},
{
"columns":16,
"firstgid":1037,
"image":"survival-items.png",
"imageheight":256,
"imagewidth":512,
"margin":0,
"name":"survival-items",
"spacing":0,
"tilecount":128,
"tileheight":32,
"tiles":[
{
"id":16,
"properties":[
{
"name":"type",
"type":"string",
"value":"hammer"
}]
}],
"tilewidth":32
}],
"tilewidth":32,
"type":"map",
"version":"1.10",
"width":30
}
Binary file added assets/kennynl/roguelike-city.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6375629

Please sign in to comment.