[HN Gopher] Bitty Engine: An itty bitty game engine
       ___________________________________________________________________
        
       Bitty Engine: An itty bitty game engine
        
       Author : user8501
       Score  : 152 points
       Date   : 2023-09-13 15:20 UTC (7 hours ago)
        
 (HTM) web link (paladin-t.github.io)
 (TXT) w3m dump (paladin-t.github.io)
        
       | otachack wrote:
       | I love these projects so much. It must be exhilarating to work on
       | them and I'm very tempted to work on one myself as a side
       | project/self learning experience.
        
         | Waterluvian wrote:
         | There's hundreds or thousands of these indie game engines
         | because, yes!, it is a lot of fun to write them. You'd learn a
         | lot. The #1 tip though is that you're writing a game, or an
         | engine, not both. So commit to doing one of those tasks.
         | Usually you end up with a bunch of toy games and no steam left
         | to want to really polish them into something complete.
        
           | JKCalhoun wrote:
           | > The #1 tip though is that you're writing a game, or an
           | engine, not both.
           | 
           | Not sure I agree. I have always done both.
           | 
           | Ostensibly I am writing a _game_ but not using someone 's
           | engine. And then my own "engine" comes out of the effort.
           | 
           | Then I write a second game and pull over the rendering-sound-
           | etc-code from the first game. This "engine" gets further
           | refined as a result of being pressed into service for the new
           | game.
           | 
           | Often it improves with each iteration and I move the newer
           | version back to older games and refactor them as required.
        
           | phero_cnstrcts wrote:
           | Do you know of any that use JavaScript/typescript?
        
             | josemwarrior wrote:
             | Phaser, as game engine, Pixi.js as a powerful render
             | library (FRVR.com games were made formerly with Pixi.js).
             | You can use Cocos Creator (not Cocos2D-x)
        
             | beepbooptheory wrote:
             | https://github.com/photonstorm/phaser
        
             | Waterluvian wrote:
             | Here's the more popular dozen or so:
             | https://github.com/collections/javascript-game-engines
             | 
             | If you want to know about the really small indie ones that
             | are less for actual use and more for just "I want to make a
             | game engine" I would check out the various gamedev Discord
             | and Reddit channels. There's always people showing off
             | their work.
        
             | impatient_bacon wrote:
             | https://bitmelo.com/
        
             | gmerc wrote:
             | 2d phaser (photonstorm) 3d babylonjs (microsoft)
        
           | Buttons840 wrote:
           | > The #1 tip though is that you're writing a game, or an
           | engine, not both.
           | 
           | Most of the people who follow this advice will never ship
           | anything. Stop worrying and do what you want. It's okay to
           | reinvent the wheel if you want to learn how to make a wheel,
           | or if you just find it fun.
        
             | hutzlibu wrote:
             | Or if you need a special wheel adopted to your needs.
             | Because you were annoyed, that the common generic wheels
             | blasted the way you drove them ... but also could not use a
             | expensive high performance wheel, because they come in
             | different sizes.
             | 
             | (But remember, if you want to ship fast, or at all, usually
             | better stay with the common wheels and sizes)
        
         | jesse__ wrote:
         | Can confirm; they're real fun. I've got a 7-year side-project I
         | still grind on in the form of a voxel engine. The trick is to
         | start small and have realistic expectations. Your progress will
         | be glacially slow at first, and that's okay. Eventually, if you
         | keep grinding, you'll have something awesome that you love
         | working on.
         | 
         | If you want to check out my project there's a link in my bio.
        
           | JKCalhoun wrote:
           | I checked out your side-project.
           | 
           | > [ ] Do sound :'D
           | 
           | Why bother with sound? Likely a dev would just pull in
           | SDL_Mixer for game sound. Get on with the transparency. ;-)
        
             | jesse__ wrote:
             | Mostly for the learning experience of writing an MP3
             | decoder and WAV mixer
        
           | PcChip wrote:
           | that's really cool!
           | 
           | I'm doing an engine as side project too that I've just
           | accepted will never be finished and it's only for fun :)
           | 
           | /r/TranceEngine
        
           | gabereiser wrote:
           | Can confirm the first two years will suck if you're starting
           | from scratch. Keep with it. By the 4th year you'll be able to
           | use all your abstractions to whip up prototypes over the
           | weekend.
        
       | tfrutuoso wrote:
       | I was looking for this to surprise the missus with her own JRPG
       | for her birthday. Thanks!
        
         | [deleted]
        
       | glonq wrote:
       | I played around with Construct2 a lot once upon a time, but never
       | followed them to 3 because the product got a bit too expensive
       | for me has a hobbyist.
       | 
       | How does this compare to that, besides the obviously nicer cost?
        
       | 3seashells wrote:
       | The world learns lua one game at a time. All it needs is decent
       | standardization comitee and a better packages/module system. Lua
       | rocks
        
       | 40four wrote:
       | Silly question from a web dev who has never written a line of Lua
       | before (or delved into game development). What is it about the
       | language that make it such a good fit for game development? Seems
       | like every time I come across these engines, or read stuff about
       | game development in general, Lua is always the language of
       | choice. Can anyone explain it in a nutshell for me? Thanks
        
         | [deleted]
        
         | setr wrote:
         | I think it's less that it's particularly good for gamedev and
         | more that it's particularly easy to embed in an engine, and
         | it's faster than it has any right to be
        
           | 40four wrote:
           | Appreciate it!
        
           | ansible wrote:
           | > _... and it's faster than it has any right to be_
           | 
           | The main Lua interpreter by PUC-Rio is among the fastest
           | bytecode interpreters for a popular scripting language. Very
           | efficient C code.
           | 
           | Wizard programmer Mike Pall then came along and wrote an even
           | faster Lua bytecode interpreter in assembly language. And
           | added JIT for even faster performance of hot functions.
        
         | Conscat wrote:
         | My understanding is that it's simply historically fallen into
         | the niche. Lua early on was relatively easy to embed in C
         | codebases, making it a natural fit for scripting C (or C++)
         | game engines and their editors. So many hugely popular game
         | development tools are scripted with Lua at this point that it's
         | somewhat breaking the mold to use anything that _isn't_ Lua in
         | this domain.
        
           | 40four wrote:
           | Thanks that makes sense
        
         | aewens wrote:
         | Probably since you can embed it in other languages quite
         | trivially. For instance, in C after about a dozen lines of code
         | you can now pass around data into Lua and back to C and thus
         | give you access to a scripting language with little fuss. It's
         | also a fairly small and simple language, so adding it in won't
         | add much more to the overall footprint of the project.
        
           | 40four wrote:
           | Interesting, thanks!
        
         | fullstop wrote:
         | As others have mentioned, it's got a few things going for it.
         | 1. It's super easy to embed in an existing code base         2.
         | The language itself is simple and easy to learn         3. It
         | has native coroutines, which allows game devs to write code
         | without a spider web of callbacks         4. For what it does,
         | it is fast
        
         | binary132 wrote:
         | I think it's because Lua's C API is very very closely coupled
         | to its native keywords and standard library, so it's not only
         | built for trivial embedding but also for trivial / mechanical
         | integration. Using the Lua API from within C or C++ is almost
         | like the syntactic language isn't even there and it's just a
         | convenient library.
         | 
         | For example:
         | 
         | https://www.lua.org/manual/5.4/manual.html#lua_pushfstring
         | 
         | and:
         | 
         | https://www.lua.org/manual/5.4/manual.html#lua_next
         | 
         | It's also amazingly semantically simple and dynamic, almost
         | like a Lisp; even though it doesn't have classes, typelevel
         | programming is pretty straightforward.
         | 
         | It also allows you to easily write and distribute native
         | modules (as shared objects) without needing integration code.
         | 
         | It is also insanely portable.
        
       | jokoon wrote:
       | I know I'm going to bring down the mood, but that kind of engine
       | should support android as a priority.
       | 
       | Godot does it, and it's an awesome alternative to Android Studio.
       | 
       | EDIT: although it supports WASM, and I'm curious how well does
       | WASM works on mobile...
        
         | [deleted]
        
         | hutzlibu wrote:
         | Well, the dev thinks different and this is what matters.
         | 
         | And WASM by itself works quite well by now, even on older
         | devices, but not really on stock browsers. The question is
         | more, how will be the whole experience of an autocompiled wasm
         | project with UI? This is hard to get right and debug, if not
         | right.
        
       | _gabe_ wrote:
       | That Lua debugger/editor with ImGui looks awesome! I've been
       | wanting to do a similar project since Lua makes the API for
       | creating breakpoints and stuff pretty easy. Styling ImGui to look
       | like a normal code editor must have been no easy task though.
        
         | gsuuon wrote:
         | Wonder if they've got support for Debug Adapter Protocol?
         | https://microsoft.github.io/debug-adapter-protocol/
        
       | hinkley wrote:
       | I have been contemplating lately if we need something like either
       | the early days of computer games or the heyday of the Demo Scene,
       | where people make amusements that are meant to run on embedded
       | computers.
       | 
       | I'm not quite sure what that should look like, but in particular
       | making physical puzzles driven by say an STM32 chip could be
       | cool. Especially if you can have it change the rules of the game
       | once you've solved one puzzle.
       | 
       | Anyway, teeny tiny game engines brings that whole line of
       | thinking back up for me.
        
         | MenhirMike wrote:
         | > where people make amusements that are meant to run on
         | embedded computers.
         | 
         | I'm glad that PICO-8 exists, which is kinda exactly that.
         | Except that it's not targeting any actual hardware (it's an
         | imaginary retro-system), but it ticks all the other boxes.
         | 
         | Would be interesting to see what you can do in a physical space
         | - your STM32 example still needs some kind of output attached
         | to it, but with a 3D Printer and some other cheap components,
         | you can add whatever I/O you want.
        
           | hinkley wrote:
           | When I was a child, there was a hot second where someone
           | implemented PacMan on an LCD screen.
           | 
           | And I really do mean a hot second, because one boy showed up
           | with one, another couple had one within days, and by the end
           | of the week the school had banned them. As, I'm sure, did
           | most every other school in the country. Now I can play
           | audiobooks on my watch, but no games to speak of.
        
       ___________________________________________________________________
       (page generated 2023-09-13 23:00 UTC)