this post was submitted on 14 May 2025
377 points (99.5% liked)

PC Gaming

10989 readers
919 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
top 37 comments
sorted by: hot top controversial new old
[–] ceenote@lemmy.world 83 points 1 day ago* (last edited 1 day ago)

What a grand and intoxicating modding community

[–] sp3ctr4l@lemmy.dbzer0.com 58 points 22 hours ago* (last edited 5 hours ago) (3 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 14 hours ago (2 children)

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

[–] sp3ctr4l@lemmy.dbzer0.com 4 points 8 hours ago* (last edited 8 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 7 hours ago

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

[–] OscarRobin@lemmy.world 2 points 5 hours ago

Lua can be very fast using LuaJIT or similar

[–] everyonesconnected@lemmy.dbzer0.com 9 points 7 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.

[–] justastranger@sh.itjust.works 3 points 5 hours ago

This appears to use OpenMW, not MWSE

[–] sp3ctr4l@lemmy.dbzer0.com 2 points 5 hours ago* (last edited 5 hours 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.

[–] gamer@lemm.ee 6 points 3 hours ago (3 children)

Imma be the guy and drop an ackshually

  • Nothing about Lua would make it difficult to implement a physics engine in it compared to other languages
  • The hardest part would be integrating with Morrowind's systems. If the engine doesn't expose e.g. collision geometry to scripts in an efficient way, then you'll run into some real challenges
  • Even without LuaJIT, there's no reason to expect performance so bad you can't implement realtime rigid body physics. Interpreted Lua is fast, but even if it wasn't, a 60 fps performance target for physics is not tough to achieve at all
[–] ILikeBoobies@lemmy.ca 2 points 3 hours ago

Can confirm

[–] Zahille7@lemmy.world 2 points 3 hours ago (2 children)

Project Zombie and GMod both use Lua scripts. GMod is also one of the best physics sandboxes imo, and has like the most mods on the workshop ever.

[–] Leuthil@lemmy.world 4 points 2 hours ago* (last edited 2 hours ago) (1 children)

The physics in GMod isn't implemented in Lua though. It was already part of the Source engine.

Unless GMod isn't referring to Garry's Mod.

[–] sp3ctr4l@lemmy.dbzer0.com 1 points 46 minutes ago

Yeah, was gonna say this.

If you actually do use Lua to significantly alter the actual physics, shit gets fuckywucky really, really fast... its quite inefficient and laggy.

I know, because I've tried to implement custom physics manipulations in Gmod via Lua... the netgraph, and server side lag, becomes absolutely absymal, really fast, if you're trying to use it for more than just a few objects/interactions at a time.

Like the uh... Armored Combat Framework?

That tries to use Lua to allow you to construct your own custom tanks and what not?

That tries to do things like penetration/ricochet calls on physics and collision hulls... through Lua?

Astoundingly inefficient and laggy in pretty much any situation with more than 3 or 4 vehicles operating and engaging each other at the same time.

You have to have an unusually powerful server to be able to handle more than that, and its still gonna chug as you scale up conflict sizes.

[–] sp3ctr4l@lemmy.dbzer0.com 1 points 3 minutes ago

Project....Zombie?

Do you mean Zomboid?

If so, Zomboid isn't ... the physics aren't done in Lua.

The base of the game is written in C++, and then certain parts of that are exposed to modders via an API that works with Lua.

https://expertbeacon.com/is-project-zomboid-java/

The physics engine is written in C++.

Because Lua is waaay too slow, and even compiled Java is about 4x as slow as C++.

[–] sp3ctr4l@lemmy.dbzer0.com 1 points 31 minutes ago* (last edited 8 minutes ago)

Nothing about Lua would make it difficult to implement a physics engine in it compared to other languages.

Correct, but said implementation will be orders of magnitude slower than implementing at a lower level... meaning you cannot handle lots of objects, you can only handle a few, and only with a few players if this is all networked... otherwise you get massive physics calculation innacuracy, terrible performance spikes, crashes, and if networked, server hangs/stalls, huge desync, etc.

The hardest part would be integrating with Morrowind's systems. If the engine doesn't expose e.g. collision geometry to scripts in an efficient way, then you'll run into some real challenges.

I mean... that is true, that having to emulate collision meshes/hulls would be less efficient than just actually having direct access to them... but that would be the case with any language, and Lua is still much slower at any real time collision mesh/hull emulation than doing the same in a lower level language.

Even without LuaJIT, there's no reason to expect performance so bad you can't implement realtime rigid body physics. Interpreted Lua is fast, but even if it wasn't, a 60 fps performance target for physics is not tough to achieve at all.

You say that, but I've never seen it done well in a way that can scale for many tens or hundreds or thousands of 3D physics calls in a complex single player scenario, or a multiplayer scenario where you now also have to account for networked synchronization.

Not saying its impossible, just saying it... I've never seen anyone pull off an efficient and accurate 3D physics engine in Lua, untill now with this LuaJIT implementation.

If you can show me a high performance 3d physics engine written entirely in just straight up Lua, well please do show me, and share with the class.

My guess would be that it would be constrained to either specific physics scenarios, as in, wouldn't have as full a realistic physics feature set... wouldn't handle well a lot of simultaneous intersctions... but I'm open to being surprised.

...

Like uh, Godot's Jolt physics are written in C++...

...and while this used to basically be an addon, that was better than Godot's default physics engine...

...even Jolt isn't nearly as efficient or accurate as say, Valve's implementation of Havok in Source.

Godot has been catching up with Unity on this physics engine performance front, but Unity still has the performance edge by a bit, and neither are close to Source.

And these are all C++ physics implementations, to the best of my knowledge.

[–] redhorsejacket@lemmy.world 27 points 1 day ago (1 children)

Does anyone recall what wound up becoming of the RTX tech demo which applied Ray traced lighting to Morrowind? The old axiom holds true, any mention of Morrowind results in at least one person reinstalling it, and it appears im the guy this time.

[–] ICastFist@programming.dev 3 points 3 hours ago (1 children)

One day I'll do a exploit-free playthru of Morrowind. But it's not this day...

[–] redhorsejacket@lemmy.world 3 points 1 hour ago

Exploiting Morrowind's systems is a hobby unto itself. For years, the only copy I had access to was the Xbox release (not even the GOTY edition). Without the dev console, I had to discover other ways to bend the game to my will.

To this day, I have to resist the urge to steal the Limeware Platter from the customs office, not to mention sequence breaking by phasing through the barrel with Fargoth's ring in that building's courtyard. Since you hadn't technically completed the tutorial and been released from custody yet, you could zip around the whole island, stealing with impunity and assembling quite the nest egg for your playthrough.

[–] Kolanaki@pawb.social 26 points 23 hours ago* (last edited 23 hours ago) (1 children)

While awesome for just the technical aspect, I actually would find this to be a downgrade in the way I play, since it would mean no longer being able to make staircases out of books and pillows, as they would actually fall if they had physics. 🤣

[–] LogicalDrivel@sopuli.xyz 6 points 14 hours ago* (last edited 13 hours ago)

Cyrodillic Brandy has no physics and wont fall. Staircase away, my friend. Especially if you know how to dupe. (its ridiculously easy)

[–] Montagge@lemmy.zip 13 points 1 day ago (2 children)

I just need controllers to work in menus

[–] Quetzalcutlass@lemmy.world 13 points 23 hours ago (1 children)

I'm shocked someone hasn't grabbed the files from the Xbox release and used their implementation as a base. It wasn't great, but it worked well enough on a controller considering how complicated Morrowind's UI was.

[–] Montagge@lemmy.zip 5 points 23 hours ago

I'm hoping the lua in OpenMW 0.49 willallow for it to be implemented. If I ever get free time I might try my hand at it.

[–] gradual@lemmings.world 3 points 6 hours ago

Controllers kind of work.

They let you control the cursor. Actual support would be better, of course.

[–] gradual@lemmings.world 9 points 6 hours ago (1 children)

But useful idiots told me people won't work for free.

[–] gamer@lemm.ee 1 points 4 hours ago (1 children)
[–] YiddishMcSquidish@lemmy.today 2 points 1 hour ago (1 children)

Every Anarcho capitalist boot licker

[–] Tiger666@lemmy.ca 2 points 1 hour ago (1 children)

If someone calls themselves an anarcho-capitalist, I immediately think that person is of very low IQ trying to sound smart and educated.

At least the term libertarianism isn't a contradiction, even if it is selfish and stupid.

Sure, no kings, no masters but when you don't go the extra step to understand where the kings and masters come from, then you are just a useful idiot to the next fascist that comes along.

[–] pyre@lemmy.world 2 points 42 minutes ago (1 children)

yeah except libertarians love kings and masters, they just want it to be private and not collective. because they think they're going to be kings and masters in such a society. and it's always the most miserable looking dweeb because that's usually the motivation behind the fantasy.

[–] Pnut@lemm.ee 2 points 29 minutes ago

To translate your message: "Libertarians wrongly believe they are kings and masters." Evidenced by the famous Highlander line "There can be only one!"

I mean. You already pay for your road and the ambulance that can drive down it to save your life. Why would you pay more to utilise the same overburdened service? Unless you're going to pay to build a hospital, fire station, etc. what's the point? And then the maintenance bills. Libertarians cannot wait to spend all of their money on things we currently help them pay for. (I'm Canadian by the way, just to explain the paid ambulance part)

[–] Quetzalcutlass@lemmy.world 7 points 23 hours ago (2 children)

So now my thief can simply stack crates to get to a store's unguarded second level instead of grinding the acrobatics skill? Nice.

I know they try to remain faithful to the original design, but I can't help but wonder how hard it would be for the OpenMW devs to integrate a full modern physics engine such as Jolt or PhysX into the engine. Probably much easier than building one from scratch in Lua of all things!

[–] grue@lemmy.world 6 points 22 hours ago (1 children)

I know they try to remain faithful to the original design, but I can’t help but wonder how hard it would be for the OpenMW devs

I would love it if, after OpenMW hits 1.0, they set a new goal of feature parity with Skyrim (or Skywind).

A post 1.0 goal is to be a general engine replacement for many Bethesda titles. OpenMW would be a platform for other projects to build OpenOblivion, OpenNewVegas, etc on.

OpenMW already uses the bullet physics engine. However, it's not really exposed to the existing Lua API right now, hence Max Yari implementing physics separately in Lua.

Test footage of Oblivion assets loaded in OpenMW shows that physics like ragdolls or interactive objects is already possible.

[–] SplashJackson@lemmy.ca 5 points 1 day ago

This kinda s'wit really makes my day, my n'wah

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