More progress in porting Loser Corps to the ESP32 (see all posts about the port).

The game now sends shots over the network, so players can see each other's shots:

Two players shooting
Two players shooting

(Please excuse me for not showing the two systems and screens side-by-side, it's a pain to move everything around only to take a quick picture.)

Another change: the game runs at 320x240 with WiFi enabled even when compiled under the Arduino IDE, since I found out how to decrease the number of WiFi buffers without recompiling the ESP-IDF WiFi component. It turns out that the number of rx/tx buffers used in WiFi is set in the struct returned by WIFI_INIT_CONFIG_DEFAULT(), which initializes the fields to values defined in the WiFi component configuration. Decreasing the values before passing the struct to esp_wifi_init() does the trick.

To make it work in the Arduino IDE, I just had to stop using the Arduino WiFi object and use the ESP-IDF API directly. One small snag I ran into was that the ESP-IDF version used by the Arduino Core is pretty old, and to initialize the network you had to call tcpip_adapter_init() instead of the current esp_netif_init(). Once I solved that, the network code compiles and runs with no problems. There's just an annoying error that pops out in the serial complaining that I haven't created an event loop, which I think is required for the Arduino Core WiFi object to receive WiFi events. The game seems to run fine without it, though.

As usual, the source code is here: https://github.com/moefh/esp32-loser