News for hackers. Stuff that matters.
Re:Using C++ as a scripting language, part 8 by hgs3 on Saturday July 29, 2023 @01:11PM (#36922312)
Worth mentioning that Quake 3 used C as a scripting language back in 1999. The engine used a modified LCC compiler [1] to generate byte code for execution in its own virtual machine. The same could be achieved today by embedding a WASM VM and compiling your C/Zig/Rust whatever to web assembly.

As an aside, I find the idea of writing game code in unmanaged C++ perplexing. Even the original Quake, which targeted DOS-era hardware, relied on a scripting language running in a plain vanilla interpreter (no JIT here). In the [current year] I would think advances in computing power, parallelism, and JIT technology would be more than adequate to accommodate an interpreted scripting language.

[1] https://en.wikipedia.org/wiki/LCC_(compiler)#Projects_incorp...

Re:Using C++ as a scripting language, part 8 by __s on Saturday July 29, 2023 @01:33PM (#36922532)
Using an interpreter on old hardware was often to save memory

https://lwn.net/Articles/412024

Re:Using C++ as a scripting language, part 8 by ramesh31 on Saturday July 29, 2023 @03:28PM (#36923641)
>As an aside, I find the idea of writing game code in unmanaged C++ perplexing.

https://github.com/id-Software/DOOM-3

Re:Using C++ as a scripting language, part 8 by kevingadd on Saturday July 29, 2023 @03:34PM (#36923706)
"advances in computing power, parallelism, and JIT technology would be more than adequate to accommodate an interpreted scripting language."

While this is true, game consoles + iOS/iPadOS prohibit JIT and in some cases prohibit script interpreters, so people resort to stuff like 'we wrote a compiler for C# that turns it all into C++ source files' in order to pass review and collect Fortnite Money*.

* I'm using Fortnite Money here to represent 'the kind of money you can make if you're willing to sell lootboxes to teens on the App Store'

Re:Using C++ as a scripting language, part 8 by Tozen on Sunday July 30, 2023 @02:11AM (#36928363)
Add Vlang to that list, as another that can compile to web assembly. In addition to having a C2V translator (and some other languages have similar). A number of safer and easier/convenient options are out there for those that care to look.