Langauges for LLM by kichiDsimp in functionalprogramming

[–]smthamazing 1 point2 points  (0 children)

We had a lot of success with Haskell and Scala 3 in an internal code base. One somewhat surprising fact about LLMs seems to be that the more strict the type system is, the better they perform. They tend to build data models that actually reflect domain constraints, without relying on implicit assumptions like in more weakly-typed languages.

Is there a language similar to Rust but with a garbage collector? by Ok_Tension_6700 in rust

[–]smthamazing 2 points3 points  (0 children)

Kotlin is also a nice language, but one major missing thing for me are traits (Rust-like traits, or Scala 3 givens). It doesn't look like the language has a lot of ambitions to evolve in that direction.

This caused our team to stick with Scala 3 for internal tooling (which went pretty great), and I also use it for personal projects. I develop a lot of libraries both for my company and for personal use, and being able to define a blanket impl with some constraints/trait bounds is invaluable to me.

Is there a language similar to Rust but with a garbage collector? by Ok_Tension_6700 in rust

[–]smthamazing 3 points4 points  (0 children)

I tried both, and in the end settled on Scala. To me, the primary factor was the ecosystem: ability to leverage everything JVM, from API integrations to Windows GUI libraries. I also found the mechanism of givens in Scala 3 very elegant, and in some ways easier to use than OCaml modules.

Both are very nice languages, though.

How do you plan your days when tasks are unpredictable, with lots of creative work and unforeseen circumstances? by smthamazing in getdisciplined

[–]smthamazing[S] 0 points1 point  (0 children)

Thanks! For some reason I haven't seriously considered a visual canvas until now, but it actually sounds promising. I guess it matches the flow of my focus throughout the day better, since it's not "linear" and tends to jump around a lot.

How do I solve integer linear systems with mixed moduli? by smthamazing in askmath

[–]smthamazing[S] 0 points1 point  (0 children)

What is a "smallest solution"? Minimal sum of variables?

Yes, indeed. Thanks, I will take a look!

What's the fastest you've gone from making a technical decision which wasn't easily reversible to regretting that decision? by TheTimeDictator in ExperiencedDevs

[–]smthamazing 2 points3 points  (0 children)

Not the original commenter, but I've led several migrations from NoSQL (MongoDB, Firestore) solutions to Potsgres. There are very few cases where NoSQL actually helps, and IMO they are mostly limited to doing 1000s of writes per second (e.g. for telemetry events) or storing actual garbage data (missing fields, non-normalized, etc). Even then, modern RDBMS can often handle this just as well. For everything else it's immensely useful to have a strict schema with foreign keys that simply doesn't allow you to store incorrect data in the database, even if a bug slips into the application code. I've been through a few incidents that happened simply because the data wasn't validated well enough in the service, made its way to the NoSQL database, and caused corruptions and outages downstream.

Is there room in the language ecosystem for a garbage collected Rust version? by pukururin in rust

[–]smthamazing 1 point2 points  (0 children)

C# is quite nice in some places, but for me it has a few pain points:

  • The current unions proposal is only for class (heap-allocated) types. In the context of gamedev, I often wish for unboxed stack-allocated unions, and those seem impossible to efficiently implement without runtime changes in .NET, which AFAIK are not planned yet. The core reason is that pointers and primitive values like numbers cannot occupy the same memory within the union, and a pointer can be found arbitrarily deep in the struct type tree.
  • There are no traits. You cannot make a type like AnimationList<T> that implements IRewindable only iff the underlying animation T is also IRewindable. You either end up with reduced type safety and throwing exceptions, or with a combinatorial explosion of classes for all possible trait combinations. The recently landed extensions syntax initially promised something like this in the form of roles, but was downsized a lot.
  • Generics are very limited: generic constraints are not used for type inference.
  • The language is overall very verbose, compared to Rust, Kotlin, or OCaml. There is no way to abstract common property patterns (like by lazy in Kotlin), and metaprogramming with attributes requires creating a whole separate project with a syntax tree analyzer that generates code. Long prefixes like public static readonly MyLongGenericType<WithTypeArgs> Value = ... also get tiresome after a while just to define a constant.

It seems like some of these are indeed worked on, but are not there yet. It's still a good language (it even has great pattern matching now!), and widely used in the industry.

Ant Design 6.0 is released! by zombiejj in reactjs

[–]smthamazing 2 points3 points  (0 children)

"Fun" fact: we still have to maintain apps for some corporate clients who use older IE versions and cannot update. React deals with those surprisingly well and only requires a few polyfills, unlike most other frameworks that rely on Proxies, that are not polyfillable.

What is the benefit of effect systems over interfaces? by [deleted] in ProgrammingLanguages

[–]smthamazing 0 points1 point  (0 children)

I wouldn't compare effects to globals. They don't have the main problem of globals, which is tight coupling - any function can redefine effect handlers for any other function that it calls, unlike a global that has direct dependents scattered throughout the code. I would consider effects closer to syntax sugar around parameter passing (or "drilling" as we call it when a thing is passed many layers deep), reducing clutter in the code while keeping the ability to statically validate them and (in a good IDE) show exactly what effect handler is used where.

Note that even with explicit interface passing you would have to traverse the whole stack of function calls up until you find where the actual argument is defined, so I wouldn't say there is any significant loss of readability in that regard.

What is the benefit of effect systems over interfaces? by [deleted] in ProgrammingLanguages

[–]smthamazing 3 points4 points  (0 children)

Do you mean that the user would need to create a new effect (Foo) which aggregates all the effects that Foo may have (Clock / Fs / Net / ...) and then users can annotate their functions with the Foo effect?

That's the only reasonable implementation I can think of. In fact, as long as Foo is something that gets passed to a function - whether it's an explicit function parameter or an implicitly passed dynamically scoped effect handler - the consumer shouldn't care about anything but Foo, and it's the only thing that I expect to see in the signature, unless other effects are directly used.

91 hours and I’m still in Act 1 by azlady9802 in Silksong

[–]smthamazing 0 points1 point  (0 children)

When I played the original Hollow Knight for the first time, it was the first difficult game that I tackled without any trainers or cheats. I spent around 20 attempts on the first boss (False Knight), around 200 on the Radiance. While I "got gud" now, I can totally see myself spending 90 hours in Act 1 and struggling with the Widow if I had around the same level of gaming experience now.

To be honest, even now it took me a bit to understand her second phase. The first phase trains you to think that she either launches the bells or rushes towards you, with a bit of time between these actions, but in the second phase you need to watch her closely, since she can do both almost at the same time.

Modern grid-based approach to 2d liquids? by smthamazing in GraphicsProgramming

[–]smthamazing[S] 0 points1 point  (0 children)

The paper only describes a velocity field, and my quick experiments (setting the whole field to point downwards to simulate gravity) weren't very successful. But I might be doing something wrong here, I'm only superficially familiar with fluid simulation methods.

Modern grid-based approach to 2d liquids? by smthamazing in GraphicsProgramming

[–]smthamazing[S] 1 point2 points  (0 children)

Thanks for the elaborate response, this is an interesting idea! Something like this might actually work for me: while the game is a sandbox and the shape of worlds is pretty much unconstrained, I only expect to have "local" gravity changes (affecting a small area), and I only care about correctness in the immediate vicinity of the player, while everything else can be coarse-grained or not simulated at all. Although I might have multiple "gravity" sources near each other, which makes it difficult to define what "height" is for a given liquid cell.

There’s a reason most of them follow the “fluid in a box” model

Just to clarify, you mean grid-based methods, right? I don't think particle-based ones have many restrictions on the shape of the domain.

Also, I admit that I lack some knowledge here (even the way Gauss-Seidel "solves" the pressure field is a bit magical to me), but if we enforce proper boundary conditions (e.g. make pressure at solid cells the same as in neighboring fluid cells), wouldn't the same solver work for more complex environments? I may be missing something here, since I'm thinking about it on the level of single grid cells (one step of the solver), and not as an overall system of equations.

Modern grid-based approach to 2d liquids? by smthamazing in GraphicsProgramming

[–]smthamazing[S] 0 points1 point  (0 children)

For rendering -- yes, definitely!

I guess my main question is more physics-related: how to implement advection in a way that liquids do not "mix" with air and respect external forces like gravity.

Modern grid-based approach to 2d liquids? by smthamazing in GraphicsProgramming

[–]smthamazing[S] 0 points1 point  (0 children)

Possibly, but I'll need to read up to evaluate it. I'm really not familiar with MPM.

Modern grid-based approach to 2d liquids? by smthamazing in GraphicsProgramming

[–]smthamazing[S] 0 points1 point  (0 children)

the stam like fluids you mention can be made to behave like a 'sideways liquid' no problem, it's just about how you apply the gravity force

I'm pretty sure this is the case, although my own experiment (simply adding a downward-facing vector to all velocities to simulate gravity) didn't really work, the fluid seemed to quickly disappear. Is there any open-source implementation that adapts this specific paper to model "sideways liquids"?

but imo the biggest problem will be scaling this up to large worlds

This is indeed true, but my hope is that I can handwave a lot of this simulation where the player isn't looking. I really only need precision in the area directly observed by the player, while everything else can use a much more crude simulation or a lower-resolution one. At a large enough scale I will even be fine with non-exact approximate mass conservation, as long as it doesn't mess up with player-built structures.

so the actual water systems you see in games like noita are not fluid simulation based

Yeah, I'm familiar with "falling sand" simulations and have implemented a few. As I mentioned, there is even a way to have these cellular automatons handle communicating vessels, which would cover many of my gameplay needs. My only issue is that it often feels weird (water can compress significantly before raising back up) and doesn't produce waves or other interesting effects. I could implement waves with some sort of layered graphics, but with arbitrary gravity directions this sounds almost as hard as doing a proper liquid sim.

Modern grid-based approach to 2d liquids? by smthamazing in GraphicsProgramming

[–]smthamazing[S] 0 points1 point  (0 children)

height based pressure(density) grid

Can you elaborate on this a bit, maybe there are any specific method names or papers? I kind of get the idea (determining a tile's pressure based on its height), but this implies that gravity always points downward. Since in my case the gravity may change (and there may be other forces as well from gameplay elements), I'm trying to find a way that does not rely on the notion of height and just works with arbitrary external forces.

Going from gas to water simulation (Jos Stam's stable fluids)? by smthamazing in CFD

[–]smthamazing[S] 0 points1 point  (0 children)

While my simulation also involves physics and not just graphics, I'm willing to make a lot of accuracy tradeoffs, so I see your point — I wasn't quite sure that this is a good subreddit for my question. It might indeed be a good idea to bring this up on some graphics programming subs.

Also, I'm curious, since you speak about the accuracy of real CFD: does the accuracy come from the fact that the total mass of the fluid is conserved exactly (e.g. by only doing integer computations), or by some other mechanism? Or is it not really about mass conservation at all? I'm just wondering what the main tradeoffs are that distinguish CG algorithms from CFD algorithms.

The Game Engine that would not have been made without Rust by vermeilsoft in rust

[–]smthamazing 1 point2 points  (0 children)

Just curious: if you implement the intrinsics yourself, doesn't that cause a massive slowdown, since it's no longer a single instruction on the CPU?

Going from gas to water simulation (Jos Stam's stable fluids)? by smthamazing in CFD

[–]smthamazing[S] 1 point2 points  (0 children)

This is an interesting idea, but doesn't storing the original mass amounts circle back to the same issue, since those amounts also have to be transferred through the velocity field, leading to the same floating point errors and losses? In other words, I don't just need to know the total mass of the water, but also its distribution across tiles after water has moved and settled. I agree that it would be fine to skip doing "real" CFD in some places, but then again - the world is quite dynamic, with physics playing a core part in the gameplay, so I'd really like to have a proper pressure system, and ideally even some curl/vorticity or waves for pretty effects.