logoalt Hacker News

Castle Game Engine: Web target – big progress, first 3 demos to try

105 pointsby zfg01/19/202523 commentsview on HN

Comments

flohofwoe01/22/2025

Interesting that it is written in Pascal:

https://github.com/castle-engine/castle-engine

The minimal demos are still surprisingly big though (same ballpark as Unity web builds for similar simple demos).

For a language without runtime I would expect a couple hundred kilobytes at most for those simple demos (but the download is 6.4 MB compressed and decompresses to 43 MByte, and takes significant time after the download is finished to start). Would be interesting to figure out why dead code doesn't seem to be removed by the compiler (e.g. is it because of the engine design, or because the Pascal-to-WASM compiler doesn't support dead code elimination). Also why is the compressed to uncompressed ratio so big, there seems to be a lot of duplicate code or data in those WASM files.

show 1 reply
azakai01/22/2025

Very cool!

The wasm file here could be optimized more. It looks like a 43 MB wasm is downloaded, and wasm-opt -O3 shrinks that to just 14 MB. It might also be faster that way (due to inlining and other optimizations). Startup will definitely be faster.

thih901/22/2025

Protip: in the "2d invaders game" - press a movement key ("w" or "d"), hold it and then press fire ("w"), holding it too. After the initial shot the key repetition will start and you'll spam a series of bullets across the screen.

This is how I won on hard mode and it still took me a couple of attempts.

tomovo01/21/2025

Nice 90s vibe. Web target is cool. The invaders demo though... I have to say AD+W is not a good set of key bindings for that game.

show 2 replies
andsoitis01/22/2025

Author articulates why he programs in Pascal: https://castle-engine.io/why_pascal

nicholasmoser01/22/2025

It's kind of crazy to see this project posted here on hackernews just now. I've been trying to compile an open source Delphi 7 project and have been having issues sourcing a dependency called OpenGLLib. Through my searches I actually bumped into the Castle Game Engine a bunch! Unfortunately it looks like the usage of opengl doesn't exactly line up.

jbverschoor01/22/2025

Never understood why cocos doesn't get more love.

show 1 reply
99990000099901/22/2025

Love it, I'd prefer a more popular language, but this is really cool.

Docs aren't great yet, but that's probably not a priority yet.

mathgladiator01/21/2025

Cool. I love to see progress for any new engine.

show 1 reply
wizzwizz401/21/2025

If you press Ctrl+Alt+Delete, it thinks you're still holding Ctrl+Alt afterwards, even if you're not. The same for Alt+Tab. The web exposes whether modifiers are pressed in the keydown event, but the game engine is trying to keep track of this information separately for some reason. (I'm not sure whether this is a Castle Game Engine, pas2js, or fpc library bug.)