Game console and do-it-yourself games to it. Little Game Engine + ESPboy

Little Game Engine (LGE) is a virtual game console of a fictitious configuration, with a fictional processor and an online web-SDK , consisting of a C-like code compiler into assembler and further recompilation into machine code with the possibility of executing this code in the same place, online in emulator.







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 .







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:





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



All Articles