As the name implies, the entire set is sharpened for the quick creation of 2d retro games. More than 20 games are ready, several in development.
To play online, follow the game link below, select “compile” and then “run”.
TankCity , 1916 , FourInaRow , BlackJack , ZombieDefence , MicroRace , DwarfClicker , Galaxies, Memories, NinjaEscape , Mines, Breakout, TowerDefence , FlappyBird, WormBlast , ESProgue , Snake, FishLife , Columns , MarsAttack , CityRunner, Astero , Astero Basster
A separate plus is that the LGE virtual machine emulator, in addition to the online version, is written for the ESPboy gadget , which has a similar periphery embodied in LGE VM in hardware and about which I already wrote .
- 128x128 color screen,
- 8 buttons
- single bit sound
- RGB LED
- ESP8266 microcontroller suitable for emulation speed
- built-in flash memory with the SPIFFS file system
In this way, you can download games compiled into the online LGE SDK into a portable ESPboy, take it with you and spend free minutes with interest.
You can download games both by wire (see downloading files on spiffs ) and via WiFi. Holding down the “B” button when starting ESPboy, we turn the gadget into an access point, and connecting to its WiFi network with the name “ESPboy” through a browser, we get to the file system’s web interface, where you can delete files or upload new ones.
It remains only to assemble the gadget, for which there are diagrams , instructions and a kit kit for assembly, which will soon be available on tindie.com.
Having played enough in existing games - you can pretty quickly start writing your own.
Brief specification of LGE virtual machine:
- A set of 108 instructions is inspired by CHIP8 / SCHIP and the MOS6502 microprocessor.
- 16 registers of 16 bits, zero register is a pointer to the stack.
- Each instruction is double-byte, some instructions contain two bytes of data
- Addressable memory 20Kb.
- In addition to the usual arithmetic instructions and instructions for moving data, there are separate instructions for working with sprites, screen and sound.
- The screen size is 128x128 pixels, 16 colors per dot, which takes 8Kb of memory, the same amount of buffer for drawing sprites and particles.
- Screen refresh at about 20 frames per second.
- You can draw tiles and 32 sprites up to 128x128 pixels in size with the possibility of rotation and mirroring.
- Work with particles is supported.
- To save memory, you can use single-bit images or RLE compression.
- There is simplified physics: detection of collisions of sprites with sprites and tiles, collision resolution, gravity.
- The screen is updated line by line only if a row has changed pixels.
- VM speed, depending on how many lines are drawn in the frame, varies from 100 thousand to 900 thousand operations per second.
- You can use different color screens, there is software image stretching.
In order not to write directly in the opcodes, the self-written compiler “LGE C” is included in the SDK, which is a “C” figurative high-level language. At the moment, this compiler is far from full support for C language standards, and when compiling, you can easily encounter an incomprehensible error in an incomprehensible place. But it is fast, because it takes less than 2000 lines of source code, and is also constantly evolving.
LGE online development environment with compiler and emulator
Description of the LGE virtual machine
Guide to LGE Compiler “C” Figurative Language
Source code for LGE games on LGE C
Quite a few games have already been made on the LGE SDK, and you can continue to create new ones right now, but you are far from perfect. If someone wants to take part in creating new toys on the LGE or improving the LGE SDK itself, as well as if someone is interested in building ESPboy, welcome to the forum www.espboy.com .
We will try to answer all questions and help in the implementation of ideas.
For those who are persistent and interested, below is a short example of a game on the LGE SDK. It takes up less than a hundred lines and no more than 1Kb in compiled form. To run it, you need to go to the online LGE SDK, copy the code into the “source” box, select “compile” and then “run”.
An example of a simple game on LGE C
int stickCount; char key,previouseKey,takenSticks; void redraw(){ int i; // setcolor(2); // for(i = 0; i < stickCount; i++) line(22 + i * 6, 74, 22 + i * 6, 84); // setcolor(11); // for(i = stickCount; i < 15; i++) line(22 + i * 6, 74, 22 + i * 6, 84); // setcolor(1); // delayredraw(); } void playersMove(){ // , . while(key == previouseKey){ key = getkey(); } while(key != KEY_LEFT && key != KEY_DOWN && key != KEY_RIGHT){ key = getkey(); } if(key & KEY_LEFT){ takenSticks = 1; }else if(key & KEY_DOWN){ takenSticks = 2; }else{ takenSticks = 3; } printf("%d, ", takenSticks); stickCount -= takenSticks; previouseKey = key; } void computersMove(){ if(stickCount % 4){ // , takenSticks = stickCount % 4; }else{ // takenSticks = 1 + random(1); } stickCount -= takenSticks; printf("%d, ", takenSticks); } void game(){ // stickCount = 15; clearscreen(); // gotoxy(8,0); puts(""); gotoxy(2,1); puts(" 1,2 3 . , . :\n"); // 27,25 26 printf(" %c 1 %c 2 %c 3", 27, 25, 26); gotoxy(0,12); redraw(); while(1){ playersMove(); if(stickCount <= 0){ gotoxy(3,8); puts(" "); return; } redraw(); computersMove(); redraw(); if(stickCount <= 0){ gotoxy(3,8); puts(" "); return; } } } void main(){ while(1){ game(); // settimer(1,1000); while(gettimer(1)){} while(getkey() == 0){} previouseKey = key; } }
All good and success in creativity.
Respectfully,
Novel