Close
0%
0%

Esp little game engine

Game engine using a virtual machine with a simulator and a web compiler

Public Chat
Similar projects worth following
Game engine with web emulator and compiler. The image is displayed on the tft using the TFT_eSPI library

https://github.com/corax89/esp8266_game_engine

The game engine has a virtual screen resolution of 128x128 pixels, 16 colors, one background layer, 32 soft sprites with collision tracking and rotation, 20kb of memory for the game and variables. The virtual machine performs approximately 900,000 operations per second at a drawing rate of 20 frames per second. Control of eight buttons.

The online compiler of the C subset to the assembler, and then to the virtual machine code.

User guide: https://corax89.github.io/esp8266Game/user_guide/index.html

VM description: https://github.com/corax89/esp8266_game_engine/blob/master/esp_little_game_engine_description.pdf

Portable Network Graphics (PNG) - 283.77 kB - 03/15/2019 at 14:05

Preview
Download

  • 1 × esp8266
  • 1 × tft 240x320 ili9341
  • 1 × PCF8574 Microprocessors, Microcontrollers, DSPs / Microprocessors (MPUs)
  • 1 × gameboy case

View all 16 project logs

Enjoy this project?

Share

Discussions

RomanS wrote 06/05/2019 at 14:18 point

Hello Igor. Could i port your engine for my ESPboy project? 

  Are you sure? yes | no

Igor wrote 06/05/2019 at 18:21 point

Yes. I will be happy.

  Are you sure? yes | no

shando69 wrote 05/25/2019 at 23:57 point

Sorry, ignore the last bit of my previous comment. I've just found the examples in the online editor :)

  Are you sure? yes | no

shando69 wrote 05/25/2019 at 23:52 point

Looks like an excellent project. I am about to buy an ODROID-GO and was wondering if there were any plans to expand the screen size from 128x128? The ODROID has a 320x240 screen. Also, is there any way to see the code behind some of the bin files?

  Are you sure? yes | no

Igor wrote 05/26/2019 at 14:40 point

I ran this firmware on esp32. However, this requires a small alteration of the code.

  Are you sure? yes | no

mystboy666 wrote 05/10/2019 at 09:54 point

Hi there!

Is there any plan supporting these small monochrome oled displays?

Thanks!

  Are you sure? yes | no

Igor wrote 05/20/2019 at 14:38 point

I did not plan this, but it is possible.

  Are you sure? yes | no

Hendra Kusumah wrote 04/23/2019 at 06:26 point

hi there, just try out your firmware and it work. But I use a different kind of ili9341 board and the screen got flipped upside down, is there anyway to change/flipped the screen orientation?

  Are you sure? yes | no

Hendra Kusumah wrote 04/23/2019 at 06:29 point

I am using this board:

https://www.tindie.com/products/thirtytwoteeth/game-boy-zero-handheld-edition/

since it is basically an ili9341 breakout without the pi zero I manage to get it running but there is the problem I mention above

  Are you sure? yes | no

Igor wrote 04/23/2019 at 18:13 point

In the setup () function, find tft.setRotation (1); and change to tft.setRotation (3); Or try to substitute other values from 0 to 3

  Are you sure? yes | no

Hendra Kusumah wrote 04/24/2019 at 06:12 point

Ok, it works. Thanks for the follow up

  Are you sure? yes | no

l3pr3ch4un wrote 04/04/2019 at 07:34 point

Anyone is interested in Wii nunchuck support (I didn't have any pcf8574 laying around..)? 

  Are you sure? yes | no

Igor wrote 04/04/2019 at 16:59 point

Here I found the instructions for connecting. This is i2c so the scheme does not change. Need to rewrite the button processing code. https://www.instructables.com/id/ESP8266-and-Visuino-WiFi-Remote-Control-Smart-Car-/

  Are you sure? yes | no

l3pr3ch4un wrote 04/04/2019 at 18:40 point

Yup, already done it, code can be found in:

https://github.com/mali1741/esp8266_game_engine/tree/nunchuck

  Are you sure? yes | no

l3pr3ch4un wrote 04/03/2019 at 15:18 point

Nice project! I've had some problems running some of the games (mars and breakout) on the esp, and found that setinterrupt in cpu.ino didn't use the stack as in cpu.js .  When I changed it to behave like in cpu.js it works fine though.

  Are you sure? yes | no

dan wrote 04/03/2019 at 22:52 point

Im have issues with running games on my ESP hardware also. Can you explain more in detail what you did to fix this problem.

  Are you sure? yes | no

l3pr3ch4un wrote 04/04/2019 at 07:17 point

I can get a github pull request out tomorrow, but until then:
in cpu.ino:setinterrupt

shadow_reg[0] = flagsToByte();
for(int8_t j = 1; j <= 15; j++){
shadow_reg[j] = reg[j];
}

should be changed to:

reg[0] -= 2;
writeInt(reg[0], flagsToByte());
for(int8_t j = 1; j <= 15; j++){
reg[0] -= 2;
writeInt(reg[0], reg[j]);
}

and the op return code 0x9A:

for(int8_t j = 15; j >= 1; j--){
reg[j] = shadow_reg[j];
}
byteToFlags(shadow_reg[0]);

should be changed accordingly:

for(int8_t j = 15; j >= 1; j--){
reg[j] = readInt(reg[0]);
reg[0] += 2;
}
byteToFlags(readInt(reg[0]));
reg[0] += 2;

Besides that there are a few cpu-instructions that handles sprites that need a limiter of the spite index ( & 31  as most of them already has).

  Are you sure? yes | no

l3pr3ch4un wrote 04/04/2019 at 18:39 point

  Are you sure? yes | no

Igor wrote 04/04/2019 at 17:02 point

Strange. This should not be a problem. Interrupt handling through additional registers faster.

  Are you sure? yes | no

l3pr3ch4un wrote 04/04/2019 at 17:44 point

Yes, I agree. Somehow I got a full interrupt queue with the shadow reg code.

  Are you sure? yes | no

l3pr3ch4un wrote 04/04/2019 at 21:22 point

So I found the error, the reg and shadow_reg arrays are one element short!
int16_t reg[16];
int16_t shadow_reg[16];

should do the trick!

  Are you sure? yes | no

Igor wrote 04/08/2019 at 06:09 point

Thanks!

  Are you sure? yes | no

Mr Rockgovsky wrote 04/01/2019 at 09:07 point

I'm not sure how I'm supposed to run this thing - I uploaded the game.bin file to the esp8266,
but don't know what else should I do/how to proceed.
I've also struggled to hook everything up properly, and I'm not sure if I've done everything correctly. Could you provide a more detalied schematic? Thanks in advance, very nice work!

  Are you sure? yes | no

amera64 wrote 03/19/2019 at 06:04 point

I have everything hooked up and firmware loaded but can't figure out how to load the .bin file into the Esp8266.  Can anyone point me in the right direction? Thanks

  Are you sure? yes | no

Igor wrote 03/21/2019 at 19:42 point

https://github.com/esp8266/arduino-esp8266fs-plugin

All uploaded files must be in the data folder.

  Are you sure? yes | no

tormozedison wrote 03/12/2019 at 20:17 point

Cool! A project with open source firmware, but top secret circuit diagram. Why?

  Are you sure? yes | no

Igor wrote 03/15/2019 at 13:00 point

Nothing secret. Just a screen on spi and a keyboard on i2c

  Are you sure? yes | no

tormozedison wrote 03/15/2019 at 21:04 point

Thanks. Take a look at this review:

https://habr.com/ru/post/443918

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates