[HN Gopher] Castle Game Engine: Web target - big progress, first...
       ___________________________________________________________________
        
       Castle Game Engine: Web target - big progress, first 3 demos to try
        
       Author : zfg
       Score  : 106 points
       Date   : 2025-01-19 20:50 UTC (3 days ago)
        
 (HTM) web link (castle-engine.io)
 (TXT) w3m dump (castle-engine.io)
        
       | tomovo wrote:
       | 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.
        
         | spartanatreyu wrote:
         | WASD are the normal commands for movement in games.
         | 
         | Pressing forwards to shoot feels wrong though.
         | 
         | This feels like it would be better with double keybinds. Arrows
         | + Space for non-gamers, WASD + space for gamers.
         | 
         | Don't just change it to arrows though, that's going to be
         | painful for laptop users who don't have those crappy half sized
         | arrow keys (see macbook, framework, etc...).
        
           | lazycog512 wrote:
           | WASD is more of a mouse+keyboard thing since in a standard
           | desk layout you can't extend your arms nicely
           | 
           | ZXCV(ASDF)+arrows I would say is more standard for non-mouse
           | games with keyboard bindings, cave story and touhou both go
           | this route.
        
             | technion wrote:
             | It's always been interesting as a left handed person using
             | mouse on the left side then pushing the keyboard over to
             | use wasd.
        
               | ordu wrote:
               | I wonder, hand't any left-handed nerd tried to make a
               | left-handed keyboard? I'd definitely try that, if for
               | some magical reason my handedness was changed.
               | 
               | I searched and found some left-handed keyboards, but they
               | are missing important things. Like they use qwerty-layout
               | instead of ][poiu. The worse, they keep Enter on the
               | right side and CAPS on the left. So you cannot remap
               | Control key onto CAPS and use it with your pinky without
               | twisting your right hand uncomfortably, when your left
               | hand is on the mouse.
        
           | vunderba wrote:
           | > WASD are the normal commands for movement in games
           | 
           | Maybe for first-person shooters, but not for shmups, and
           | definitely not for classic arcade style games.
           | 
           | To your second point the reason it feels unnatural is because
           | mapping movement + actions to a single hand is usually not a
           | good idea if you have the opportunity to distribute them.
        
             | justmedep wrote:
             | It's also the default in Factorio
        
         | OccamsMirror wrote:
         | Even the language is a 90s vibe.
        
       | mathgladiator wrote:
       | Cool. I love to see progress for any new engine.
        
         | 2mlWQbCK wrote:
         | How new is this engine? It was renamed to "Castle Game Engine"
         | (from "Kambi VRML Game Engine") in 2011. Version 1.0.0 was
         | released in 2007. Not sure if there were even older releases?
         | 
         | https://castle-engine.io/old_news.php?id=2011-8-22-engine_re...
         | 
         | https://sourceforge.net/projects/vrmlengine/files/kambi_vrml...
        
       | wizzwizz4 wrote:
       | 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.)
        
       | azakai wrote:
       | 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.
        
       | nicholasmoser wrote:
       | 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.
        
       | 999900000999 wrote:
       | 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.
        
       | flohofwoe wrote:
       | 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.
        
         | wffurr wrote:
         | Object Pascal has a substantial runtime library called RTL:
         | https://en.m.wikipedia.org/wiki/Free_Pascal_Runtime_Library
         | 
         | Also per azakai in another thread, wasm-opt shrinks this binary
         | to 14 MB. Still a lot.
        
           | pjmlp wrote:
           | Similar to this unofficial C runtime called POSIX, that most
           | C applications rely on.
        
       | jbverschoor wrote:
       | Never understood why cocos doesn't get more love.
        
         | flohofwoe wrote:
         | We evaluated Cocos about 2 years ago and frankly when comparing
         | it to Unity on one side and small and specialized web engines
         | like PixiJS, Three.js, PlayCanvas or Babylon.js on the other
         | side, it's just not all that great, starting from tooling and
         | ending with the engine architecture.
        
           | orkasi wrote:
           | What did you end up using for the web?
        
             | flohofwoe wrote:
             | PixiJS
        
       | andsoitis wrote:
       | Author articulates why he programs in Pascal: https://castle-
       | engine.io/why_pascal
        
       | thih9 wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2025-01-22 23:03 UTC)