Repository: google-deepmind/meltingpot
Issue: Sprite size 1 no longer works
Root cause: External Dependency Breakage

Following the advice in https://github.com/deepmind/meltingpot/issues/67, I have been training with sprite size 1. However now I get an error when I do so:

```
ValueError: 
ERROR: [tile.set.setSprite] - Error occured when setting sprite 'AppleWait.N' to Shape: [1, 1, 0] Empty

stack trace-back:
ERROR: [C]: in function 'setSprite'
ERROR: dmlab2d/lib/game_scripts/common/tile_set.lua:47:
ERROR: (tail call): in function ''
ERROR: @./meltingpot/lua/modules/component_library.lua:593: in function '_addShapesToTileSet'
ERROR: @./meltingpot/lua/modules/component_library.lua:600: in function 'addSprites'
ERROR: @./meltingpot/lua/modules/game_object.lua:237: in function 'func'
ERROR: @./meltingpot/lua/modules/game_object.lua:160: in function '_doOnAllComponents'
ERROR: @./meltingpot/lua/modules/game_object.lua:234: in function 'addSprites'
ERROR: @./meltingpot/lua/modules/base_simulation.lua:327: in function 'addSprites'
ERROR: @./meltingpot/lua/modules/api_factory.lua:49: in function '_createSprites'
ERROR: @./meltingpot/lua/modules/api_factory.lua:65:
```

Steps to reproduce:
1. Checkout main
2. Set spriteSize to 1 in meltingpot/python/configs/substrates/commons_harvest__open.py
3. Run `python3 meltingpot/python/human_players/play_commons_harvest.py --level_name commons_harvest__open`

I previously branched from commit ed637f183a9b4404ac53c05d8aba7442c74ac613, so it has broken somewhere between there and now (perhaps version 2?)

I've just verified this. I'll try and fix it as soon as I get a chance.

I have a fix for this now, I'm still thinking about the nicest way to submit it though since looking at this forced us to think about spriteSize == 1 more globally, and some other questions arose there. If you need this urgently then I can create a local branch with a temporary fix for whichever substrates you are currently looking at.

Thank you for taking a look. This is not urgent, so I'm happy to wait.


On Sun, 5 Mar 2023, 12:18 Joel Z Leibo, ***@***.***> wrote:

> I have a fix for this now, I'm still thinking about the nicest way to
> submit it though since looking at this forced us to think about spriteSize
> == 1 more globally, and some other questions arose there. If you need this
> urgently then I can create a local branch with a temporary fix for
> whichever substrates you are currently looking at.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/deepmind/meltingpot/issues/112#issuecomment-1455075547>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AF3SLRQ4DRPKNZQHGIHV6ETW2SABZANCNFSM6AAAAAAVK4NEWQ>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>


This should be fixed now. The change was upstream in dmlab2d: https://github.com/deepmind/lab2d/commit/00aa07869b78cd5df92de4293dad640014bb1ee6


I believe* that I have build the latest lab2d commit and installed it, but it did not resolve the error.

*I may have done something wrong, because building lab2d was ... challenging

Interesting, an issue with building the latest version of dmlab2d sounds like a question where @jagapiou would know best how to advise.

Ok, FYI my approximate approach was
```
cd lab2d
git pull
bazel build --compilation_mode=opt --dynamic_mode=off --verbose_failures --config=luajit --experimental_ui_max_stdouterr_bytes=-1 --sandbox_debug //dmlab2d:dmlab2d_wheel
pip install lab2d/bazel-bin/dmlab2d/dmlab2d-1.0-cp39-cp39-manylinux_2_35_x86_64.whl
```

Our `install-dmlab2d.sh` has a few extra details, dunno if they help:

```
  C=clang CXX=clang++ bazel build \
      --compilation_mode=opt \
      --dynamic_mode=off \
      --config="${LUA_VERSION}" \
      --subcommands \
      --verbose_failures \
      --experimental_ui_max_stdouterr_bytes=-1 \
      --sandbox_debug \
      //dmlab2d:dmlab2d_wheel
```

Ah, I had not noticed that script. However, using that script to install dmlab2d has not resolved the pixel size issue.

Maybe just doublecheck you have that commit in your repo and check your pip install? `pip uninstall dmlab2d` and then reinstall maybe? Otherwise I don't know I'm afraid.

I am now confident that I have the latest lab2d installed. Can I just confirm that this new lab2d resolves the issue for you please?

The fix didn't solve the issue, we are working on it

On Thu, Mar 16, 2023 at 4:09 PM Richard Willis ***@***.***>
wrote:

> I am now confident that I have the latest lab2d installed. Can I just
> confirm that this new lab2d resolves the issue for you please?
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/deepmind/meltingpot/issues/112#issuecomment-1472267672>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAY7XEM3RKUXZK2YD2HWFULW4M3LDANCNFSM6AAAAAAVK4NEWQ>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>


OK, now it should be fixed, for real this time. ;).

The following commit, which just landed in dmlab2d, should fix it: https://github.com/deepmind/lab2d/commit/94e37d189aee8d309bc1dfae7227676c77636e88

Yes, this fix works for me thanks.