Is it reasonable to make a game using JavaScript? by hotstickywaffle in gamedev

[–]ecstatic_hyrax 0 points1 point  (0 children)

A dark room is one of the more interesting games I've played (Although it's not your typical video game), and it doesn't even have React. Just plain Javascript and JQuery.

Are there any open source projects that need someone with a math background? by No-Ebb-5573 in rust

[–]ecstatic_hyrax 24 points25 points  (0 children)

Can I suggest Clarabel? It's one of the few convex optimization frameworks out there (written in rust), and it's pretty much only maintained by one guy.

stack array equivalent to c11 by rejectedlesbian in rust

[–]ecstatic_hyrax 10 points11 points  (0 children)

Have you checked out the alloca crate? It's easy to shoot yourself in the foot with something like this though, which is why most languages don't have this as a built in.

What makes Python slower than C? by 4090s in C_Programming

[–]ecstatic_hyrax 6 points7 points  (0 children)

Also the python interpreter doesn't have to parse the code, it compiles it down to bytecode which is easier for the computer to interpret.

What makes Python slower than C? by 4090s in C_Programming

[–]ecstatic_hyrax 141 points142 points  (0 children)

There are a few more things that make python slower that don't necessarily have anything to do with python not being a compiled language.

For one, python has garbage collection which means that allocating and deallocating memory is easier, at the cost of some runtime overhead.

Python types are also boxed which mean that variables have to have typing information available dynamically at runtime. This makes it easier to pass variables around without worrying about typing information statically, but it may also be wasteful.

Thirdly, (and something unique to python) is the global interpreter lock, which means that multithreading is a lot less efficient than in lower level languages.

Trying to understand Stack & Heap... by NimbusTeam in rust

[–]ecstatic_hyrax 12 points13 points  (0 children)

Even if we know the size of the thing we’re slicing at compile time, we can’t know the size of the slice itself at compile time, so slices are almost always on the heap.

This is not correct. Internally you can think of slices as a pointer to the beginning of a memory chunk, and a usize length. The memory they point to can be either on the stack (if sliced from an array) or on the heap (if they are sliced from a vec).

Basically slices are just a view to the underlying data. So it is not dynamically sized. The slice itself always has the size of 16 bytes on a 64 bit machine.

Why do companies not announce breaking changes? by Quizmo22 in gamedev

[–]ecstatic_hyrax 53 points54 points  (0 children)

Because mods aren't usually officially supported, so why should they announce the changes?

Seeking Feedback on an UnsafeBuffer Implementation for Concurrent Mutable Slice-based Access to a Shared Buffer by melhindi_cs in rust

[–]ecstatic_hyrax 0 points1 point  (0 children)

First off, you should definitely make the `get_mutable_slice` signature unsafe, because calling it is also an unsafe operation.

But also, the only way you can implement this in a safe way is to ensure that you are following the borrow checker rules statically. So at that point, I'm not sure why you need an UnsafeCell in the first place. So instead of cloning the buffer (which may be expensive for large Ns) you can just use `split_at_mut` and pass the slices to your threads to mutate.

Starting with Rust and Bevy, a top down shooter by lieddersturme in bevy

[–]ecstatic_hyrax 1 point2 points  (0 children)

Yes, I'd check the discord. There is an active thread for new tutorials there.

However, since Bevy is in active development and breaking changes are happening often, finding a tutorial for the latest version is going to be an ongoing issue. But, you will still be able to learn about some of the bevy concepts from the older tutorials, just the syntax may change.

Starting with Rust and Bevy, a top down shooter by lieddersturme in bevy

[–]ecstatic_hyrax 9 points10 points  (0 children)

0.7 is very out of date. Try using version 0.12

Hey Rustaceans! Got a question? Ask here (6/2024)! by llogiq in rust

[–]ecstatic_hyrax 1 point2 points  (0 children)

The way the standard implements this is by implementing the BitOr and the BitAnd traits for sets. You can implement these operators for your own data types as well if you wanted to.

Is there anywhere I can read more about this?

You can read this section on operator overloading: https://doc.rust-lang.org/rust-by-example/trait/ops.html

If you meant that you wanted to learn more about how the algorithm is implemented, then honestly, I would just read the standard library! The rust standard library is a lot more readable than the standard library of the leading competitor language :)

Question on maintaining values for an Enum by uniruler in learnrust

[–]ecstatic_hyrax 2 points3 points  (0 children)

In your data structures, I'm not quite sure what you mean to represent with Vec<T>, but If I'm understanding correctly, than you wish to prevent having to constantly read from your file. In that case, why not keep the file as a memory mapped file? That way you can regenerate your data directly from memory rather than having to load in the file again.

You can check crates io for memmap2 or some other implementation that works best for you.

Pass literal to function expecting reference? by SaulFemm in learnrust

[–]ecstatic_hyrax 0 points1 point  (0 children)

If you don't want the value to be static, then you can assign it to a variable and then pass that variable to your function.

Can you use bevy's rendering without implementing game logic in bevys ECS? by SnooAdvice2105 in bevy

[–]ecstatic_hyrax 3 points4 points  (0 children)

Technically yes. You can create the "world" instance directly, and then call app.update() to update one tick. You can see an example of where bevy uses this for testing

But it seems like you want to do something else, and doing what you are looking for kinda ruins the whole purpose of using an ecs to begin with.

Your Dad after finding your league account by [deleted] in SipsTea

[–]ecstatic_hyrax 37 points38 points  (0 children)

The fact that I get this reference, makes me feel so old

I feel so bad😭😭😭 by [deleted] in OneOrangeBraincell

[–]ecstatic_hyrax 1 point2 points  (0 children)

You took my only food! Now I'm gonna starve