4 ms·
Show HN: Tiny – A 2D Game Engine in Kotlin Working with Lua
I created a small 2D game engine named Tiny.
The engine was created using Kotlin Multiplatform and can run on a JVM and JS.
Funny things: Games can be created using the programming language Lua.
Tiny is designed to help you create and test your ideas quickly and effectively. Not only can you run your games on your desktop computer, but you can also export them for the web, making it easy to share your creations with others.
You can create games easily with the hot reload, small API and Lua, which is very easy to learn.
If you want to test a game idea, to try to create your first game or just have fun, give it a try to Tiny.
- xigency 3y agoLooks pretty cool. I’m curious how Lua scripting support is handled for the web platform. There have been one or two different projects for Lua support on the web in the past.
- mometsi 3y agoLooks like it uses luaj to run scripts from kotlin, and the whole kotlin project can use the Kotlin/JS compiler to target the browser.
- dwursteisen 3y agoActually, it's using Luak (https://github.com/korlibs/korge-luak https://github.com/korlibs/korge-luak). It's a port of LuaJ for Kotlin Multiplatform.
- bullen 3y agoWhy not just use Java and hot deploy on the JVM?
- gavinray 3y agoIt's in the first like 20 words of the post: > The engine was created using Kotlin *Multiplatform* and can run on a JVM and JS. Kotlin allows you to have a single codebase that compiles and runs on: - JVM - WASM - JS - Native Windows/Linux/Mac (LLVM) - Android, iOS/tvOS/watchOS This is disregarding any notions about the language benefits of Kotlin vs Java.
- bullen 3y agoOh, ok I thought the demo was a picture because nothing happended when you clicked the thing... The JS version has very high latency. How does it work under the hood? Can the same pipeline port Java Applets to WASM/JS?
- gavinray 3y agoIt literally is the first thing you see. The docs at https://minigdx.github.io/tiny/ https://minigdx.github.io/tiny/ have a demo "BREAKOUT" game embedded in the page under the first paragraph with a link to the source code lol Screenshot for reference: https://i.imgur.com/TVzQwiu.png https://i.imgur.com/TVzQwiu.png
- bullen 3y agoI think it would be more interesting to expose how the bytecode becomes JS. But I guess I'll dig through at some point... nm, that breakout (that you could run on a 6502) maxxes a 15W modern CPU core. That's 10.000x less efficient.
- gavinray 3y ago> I think it would be more interesting to expose how the bytecode becomes JS. There's no bytecode emitted -- Kotlin is unique among JVM languages in that it acts more like a frontend, similar to LLVM or GCC. The Kotlin code is translated from an IR/AST into JS directly. The JS is one of many target languages for the Kotlin compiler. Kotlin Source Code | Kotlin Compiler | IR / / \ \ JVM WASM Native JS
- lmm 3y ago> Kotlin is unique among JVM languages in that it acts more like a frontend, similar to LLVM or GCC. "Unique among JVM languages" lol. Like most of the good parts of Kotlin, this was actually copied from Scala.
- cies 3y agoKotlin is pretty nice as a language: quite strong type system, good tooling (like JetBrain's IDEA Community), terse, supports functional programming quite well, etc. Lua OTOH is not so much a favorite of mine. Could I use this without Lua, just using Kotlin throughout?
- allgood4 3y ago[flagged]
- dwursteisen 3y agoNot a the time. If you want to try Kotlin for creating games, I advise to check other game engine: - https://littlekt.com/ https://littlekt.com/ (LittleKt (Little Kotlin) is a multiplatform 2D game framework written in Kotlin) - https://korge.org/ https://korge.org/ (Korge - Modern Multiplatform Game Engine for Kotlin.) - https://github.com/minigdx/minigdx https://github.com/minigdx/minigdx (Minigdx - Minimalist Game Framework using Kotlin Multiplatform / I created it before creating Tiny) - https://libgdx.com/ https://libgdx.com/ (LibGDX, it's for Java but you can use Kotlin, if you don't want to target the web platform)
- cies 3y agoI used LibGDX with a Kotlin wrapper that's available. Worked well!
- codazoda 3y agoNice work. I was just looking at that other Lua game engine outlined in that post about simple coding. The first thing I wondered was how to handle resolution. It wasn’t clear to me in the docs for that older game engine. It’s one of the early things you mention in your docs. I think I’ll give this a try. I have never created a game but I built a hobby slot machine cabinet and I need to build the game. The attached TV is 1080P turned in portrait mode. I’ve hidden a raspberry pi in the cabinet but I could use anything.
- dwursteisen 3y agoI didn't build Tiny for performance, I'm afraid that you might get poor performance. But you can give it a try!
- bodge5000 3y agoFeels like we've been getting a lot more fantasy-console-style frameworks/engines lately and I've gotta say I'm all for it. Not sure this one is for me, but love to see it regardless!
- pablo1 3y agoWhich one would you prefer? Any favourites? Looking to create simple games/animations that I can embed into a web page without too much hassle.
- otikik 3y agoI like PICO-8. The limitations it has (e.g. 16 colors, 128x128 screen) seem to "offend" some folk though. I have learned to like the limitations.
- bodge5000 3y agoThe fact it has a fixed colour palette as well is fantastic, takes a lot of the guess work out of choosing the perfect colour, also means PICO-8 games have a shared look which is nice. I'm working on a game at the moment which is inspired by old ZX Spectrum games, so sadly that rules PICO-8 out (different colour palettes), but otherwise those limitations make the whole thing really nice
- bodge5000 3y agoRight out, the most interesting ones to me are WASM-4, because it seems to be one of the strictest and most minimal, and Pyxel, because it uses Python. Though to be fair I haven't actually tried either of them yet. If you just want the "best" one (obviously very subjective, but its the easiest answer), try Pico8
- remon 3y agoAs opposed to a 2D Game Engine in Kotlin Working with Kotlin? Why?!?
- dwursteisen 3y agoLua is easy to learn, dynamically typed and doesn't need to be compiled: it's perfect to get instant reload and it's perfect for small projects. If you want to create games using Kotlin, you can try my 3D Game Engine: minigdx (https://github.com/minigdx/minigdx https://github.com/minigdx/minigdx). Or other game engine: - https://littlekt.com/ https://littlekt.com/ (LittleKt (Little Kotlin) is a multiplatform 2D game framework written in Kotlin) - https://korge.org/ https://korge.org/ (Korge - Modern Multiplatform Game Engine for Kotlin.) - https://libgdx.com/ https://libgdx.com/ (LibGDX, it's for Java but you can use Kotlin, if you don't want to target the web platform)
- cornfutes 3y agoBecause Lua is popular among game development enthusiasts? It is THE scripting language of game development. It's the language of choice by Roblox Studio.
- bodge5000 3y agoI'd say its the language of choice for game modding (which roblox pretty much is) specifically, but not game dev as a whole. In fact I'd go so far as to say its not used in game-dev enough, it seems to be greatly under-appreciated. The only engines I can think that use it are PICO-8 and Love2D.