Driftwood2D / Driftwood

Driftwood 2D Tiling Game Engine and Development Suite
http://tileengine.org/
MIT License
24 stars 1 forks source link

The bottom-rightmost graphic of tilesheets cannot be read. #205

Closed seisatsu closed 6 years ago

seisatsu commented 6 years ago

Checkout the new branch, commit 6c5ecf8, and run with bin/driftwood --path new to run the testing world. With this simple code, the game will crash if the player walks more than a few tiles to the right on any layer.

Engine Log:

[seisatsu@voidstar Driftwood]$ bin/driftwood --path new
Driftwood 2D
Starting up...
[0] INFO: Path: appended: data/new
[0] INFO: Path: rebuilt
[0] INFO: Audio: initialized mixer output
[0] INFO: Audio: initialized mixer audio format support: ogg
[0] INFO: Script: loaded: init.py
[0] INFO: Script: loaded: Stageshow/viewport.py
[0] INFO: Script: loaded: Stageshow/lighting.py
[0] INFO: Resource: requested: area1.json
[0] INFO: Cache: uploaded: area1.json
[0] INFO: Light: reset
[0] INFO: Resource: requested: area1_background.png
[0] INFO: Cache: uploaded: area1_background.png
[0] INFO: Area: loaded: area1.json
[0] INFO: Resource: requested: player.json
[0] INFO: Cache: uploaded: player.json
[0] INFO: Resource: requested: player.png
[0] INFO: Cache: uploaded: player.png
[0] INFO: Entity: inserted: player.json on layer 0 at position 4, 8
[0] INFO: Script: loaded: player.py
New entity "player" with EID 0 at 64,128,0 
[0] INFO: Script: loaded: Folkdance/player.py
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "./__main__.py", line 117, in <module>
  File "./driftwood.py", line 171, in _run
  File "./tickmanager.py", line 196, in _tick
  File "./tickmanager.py", line 254, in __call_callback
  File "./areamanager.py", line 159, in _tick
  File "./areamanager.py", line 188, in __build_frame
  File "./layer.py", line 262, in __getitem__
  File "./layer.py", line 293, in __get
KeyError: 189
seisatsu commented 6 years ago

The crash appears to have been due to a typo in layer.py preventing a warning from being reached. Now, we have the warning.

[33] WARNING: Layer: 0: _TileReader: Orphan gid: 100: for tile: 189
[769] WARNING: Layer: 0: _TileReader: Orphan gid: 100: for tile: 389
[878] WARNING: Layer: 0: _TileReader: Orphan gid: 100: for tile: 399
[1130] WARNING: Layer: 0: _TileReader: Orphan gid: 100: for tile: 199

Is the map malformed? We need to investigate why this is happening with this new map.

seisatsu commented 6 years ago

This happens any time the graphic from the bottom right corner of the tilesheet is on screen. _TileReader may not be reading GIDs in a way that is consistent with the rest of the engine.

Edit: Since the bottom right corner of this tilesheet is black, I colored it white so I could actually tell if it was appearing on screen, and it did not. Currently it appears that the bottom right corner of this (and probably every) tilesheet is unusable.

Also _TileReader should be _TileLoader in that warning message.

seisatsu commented 6 years ago

The issue was due to a mistaken use of range() at line 288 in layer.py.