this post was submitted on 14 May 2025
328 points (99.4% liked)

PC Gaming

10989 readers
793 users here now

For PC gaming news and discussion. PCGamingWiki

Rules:

  1. Be Respectful.
  2. No Spam or Porn.
  3. No Advertising.
  4. No Memes.
  5. No Tech Support.
  6. No questions about buying/building computers.
  7. No game suggestions, friend requests, surveys, or begging.
  8. No Let's Plays, streams, highlight reels/montages, random videos or shorts.
  9. No off-topic posts/comments, within reason.
  10. Use the original source, no clickbait titles, no duplicates. (Submissions should be from the original source if possible, unless from paywalled or non-english sources. If the title is clickbait or lacks context you may lightly edit the title.)

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] sp3ctr4l@lemmy.dbzer0.com 44 points 17 hours ago* (last edited 34 minutes ago) (2 children)

... Ok, that is legitimately impressive, from a technical standpoint.

Lua is a high level, not exactly very 'fast', very performant language. It is designed to be very, very human readable, and coding noob friendly.

Getting a 3D physics engine to work ... in lua... is not something I would have thought possible.

Usually you need to use a much lower level language to ... actually do that.

EDIT:

A few other commenters have now pointed out that this is actually using LuaJIT... which passes Lua code to a C compiler, quickly translates and then compiles in C, and then runs in C.

So, that makes much more sense, its functionally running in C, a lower level, compiled code language.

Still impressive nonetheless!

[–] PlexSheep@infosec.pub 16 points 9 hours ago (2 children)

Lua is pretty fast actually, though I don't know how it compares to compiled speed.

[–] sp3ctr4l@lemmy.dbzer0.com 3 points 3 hours ago* (last edited 3 hours ago) (1 children)

I haven't benchmarked anything in a while, so it is possible Lua is more performant now than it once was... but in my (out of date) experience, python is faster than Lua, and nearly every language that is actually compiled is... one or two or three orders of magnitude faster.

Though it is also worth mentioning that Lua is fairly simple to plug in to some kind of database language, which can result in reasonably good performance in situations involving say... dynamically spawning or unspawning tons of inventory style minor items, or containers with them.

Lua has been fast enough to handle a simple 2D physics engine... but this is the first time I am hearing of it handling 3D.

[–] DeathsEmbrace@lemm.ee 4 points 2 hours ago

At the dawn of mankind's perversion Lua was used for 3D

[–] OscarRobin@lemmy.world 2 points 1 hour ago

Lua can be very fast using LuaJIT or similar

[–] everyonesconnected@lemmy.dbzer0.com 7 points 2 hours ago (2 children)

So from what I can read, the Morrowind Script Extender uses LuaJIT instead of regular lua, which does tracing just-in-time compilation. Meaning, and I'm just paraphrasing wikipeda here, it compiles frequently executed sequeneces of operations into machine code.

[–] sp3ctr4l@lemmy.dbzer0.com 2 points 46 minutes ago* (last edited 44 minutes ago)

Now, that is a very relevant detail!

I did not know LuaJIT was even a thing.

Still probably not as performant as ... C++ or Rust or something, that is totally precompiled... but that would explain how this is even possible, a 3D Lua based physics engine.

Yeah, looks like LuaJIT passes a bunch of the Lua code into C, just good ole C, and then dynamically compiles it, then runs the 'translated' C code.

That makes a lot more sense lol.

[–] justastranger@sh.itjust.works 1 points 32 minutes ago

This appears to use OpenMW, not MWSE