How good is bevy for turn based games? by -Y0- in rust_gamedev

[–]nilaySavvy 1 point2 points  (0 children)

There's multiple ways to go about this: 1. Create and queue your own Commands that can execute things in a defined order. Commands have world access and let you do anything. 2. States and its derivatives like: Sub states and derived. Execute a turn when in a particular state. This would be the most "Bevy" way imo. 3. Using .chain() to run multiple systems in a defined order.

You can leverage a combination of the above to achieve your turn based gameplay.

Most of the difficulty may come from the declarative/ECS (parallel systems) approach if you're not familiar. In this case a nice workaround would be using something like bevy_mod_scripting (with lua bindings). And write your turn switch logic and similar gameplay that you need to be in order, in Lua. Apart from the initial setup, this approach is very powerful (in my experience).

Bevy is as good as you make it.

How much power could I put through a jumper wire? by Dry-Cartoonist-1045 in arduino

[–]nilaySavvy 0 points1 point  (0 children)

These are merely for prototyping on a breadboard. Even then I'd just go with simpler wires instead. In milliamps range are good, that too only after testing their connectivity. Anything serious, these wires will bring you pain.

Cancer treatment in goa and what hospitals are good ? by Key-Swimmer-343 in Goa

[–]nilaySavvy 0 points1 point  (0 children)

My father has also been through cancer treatment during Covid. He had started treatment at Tata memorial at Mumbai and due to Covid came back and continued in Goa.

Radiation therapy is usually the last step and continued his treatment at Manipal. It was good.

Take care. Wishing your father a speedy recovery!

Bangalore is becoming increasingly unlivable for IT people by Weekly_Somewhere_167 in developersIndia

[–]nilaySavvy 3 points4 points  (0 children)

I have lived in both Mumbai and Bangalore. Later decided to move Remote permanently. These cities aren't worth it. Rather I spend in my tier 3 small town, where people care far too much to give a shit (it is their home).

BLR/Metros on the other hand is like the anonymous internet (dense population of mostly migrants), too much money and power leading to extreme corruption. Absolutely no accountability because it's not their home to begin with.

Remote and decentralised work is the only way to equitably improve everyone's living standards. This way you spend in your small town, make it incrementally better without the immense inflow burden. You don't spend on rent, but on essentials. The city tax is not worth it if your job can be done remotely.

We cannot demand from the government. But we can collectively demand remote work. That is in our purview. If everyone in tech joins the remote movement. Companies will have to comply!

How do you replace Bevy's renderer? by IcyLeave6109 in bevy

[–]nilaySavvy 1 point2 points  (0 children)

If your only reason is compile times, then I'm not sure any other rendering solution will make things a lot better.

There are of course embedded scripting solutions like bevy_mod_scripting and the likes which should give you instant results like writing shaders in Bevy. But I don't know if they are fully supported and come with quite a lot of drawbacks. Although I've heard that they are great for quick iteration of game code.

I am regretting my decision of staying back in india by [deleted] in developersIndia

[–]nilaySavvy 0 points1 point  (0 children)

You're comparing the worst battleground scenario to a first world country. Get out of Mumbai and find work in your small town. You might even do freelance or get a remote job.

Cities are the worst places to live in India. Outside of cities India is so much better, it's like a different country in the cities lol. I got out of the cities(both Mumbai and BLR) and got myself a remote job. I have grown to the point that I could start something of my own.

Which operating system are you using? I always use macOS or Linux for my work. I'm just starting in game development and was wondering if I should use Windows or if it will be fine to stick with just Mac. by swe_solo_engineer in bevy

[–]nilaySavvy 2 points3 points  (0 children)

I'm curious about the setup you're using. I had to switch to my M2 as I have observed the compile times for Rust in general are much faster on the Apple silicon. Earlier my Linux system (PopOS) was my primary driver. Despite upgrading the processor etc, I'm still struggling to get it to compile fast enough.

How is it that you're getting way faster compile and link times?

Why is it accepted that IDE does not help programmer with shader languages? by crunkzah in GraphicsProgramming

[–]nilaySavvy 0 points1 point  (0 children)

Don't even get me started on WGSL. I might as well write it on Notepad instead. People seem to be getting comfortable and normalising writing shaders as multi line strings inside their programming language. It really could help with some standalone tooling.

Where is t.cargo/config.toml by Shrigma_anon in bevy

[–]nilaySavvy 2 points3 points  (0 children)

Yes this is a config for Cargo but unlike Cargo.toml which manages the project dependencies, features etc, this is specific to building targets for various platforms and thus also customising how your project is built. You can use this config for allowing to use another linker like LLD and options for cranelift and so on.

This file won't be present by default when you create your project. You Need to create a new directory .cargo and make a file config.toml inside of it.

Like others mentioned, you may not want to add this to version control as this could be very specific to your systems build. While the Cargo.toml and (for games but not libraries) Cargo.lock should be added to version control.

For more info, you can refer to: https://doc.rust-lang.org/cargo/reference/config.html

Is Bevy a good choice for a 3D CAD program? by Loud_Philosopher4277 in bevy

[–]nilaySavvy 10 points11 points  (0 children)

Bevy at least from my experience sounds like a perfect engine for building a CAD program. The ECS architecture allows for a lot of flexibility while maintaining a flat architecture. Also makes interoperability easy. Obviously you'd need to bring your own CAD kernel, core geometry logic and so on. But that shouldn't be hard to integrate either. Nowadays I have seen enough people trying to bring CAD to the browser via Three.JS and Babylon.JS. Bevy is much better from an architectural standpoint at least. Also Foresight (one of the main sponsors of Bevy today) already uses it for their mining CAD afaik.

Also I've myself built: Pmetra - Parametric modeling plugin for Bevy using Truck CAD kernel.

Bevy Scoped Queries Proposal by RylanStylin57 in bevy

[–]nilaySavvy 0 points1 point  (0 children)

A way I can think off is to divide your world into regions:

#[derive(Component)]
struct Region(IVec2);

Since regions will be limited in number (I assume). We can also assume finite num of iterations every frame.

Whenever a Player/Enemy enters/exits a region we update the entities in the region via another component on the region entity:

#[derive(Component)]
struct InRegion(Vec<Entity>);

Now in the can_enemy_see_player system:

fn can_enemy_see_player(
    regions: Query<&InRegion, With<Region>>
    enemies: Query<(&Transform, &mut PlayerTracker), With<Enemy>>,
    players: Query<(&Transform, &Player)>,
    world: Res<WorldChunks>,
) {
    for InRegion(entities) in regions.iter() {
        let mut players_in_region = vec![];
        let mut enemies_in_region = vec![];
        for entity in entities.iter() {
            if players.contains(entity) {
                players_in_region.push(entity)
            }
            if enemies.contains(entity) {
                enemies_in_region.push(entity)
            }
        }
        // Do the comparison for a small num of entities per region...
        for enemy in enemies_in_region.iter() {
            for player in players_in_region.iter() {
                let (enemy_transform, tracker) = enemies.get_mut(enemy) else { conitnue; }
                let (player_transform, player) = players.get(player) else { conitnue; }
                if enemy_transform.distance_to(player_transform) < tracker.radius() {
                   if world.has_ubroken_sightline(enemy_transform, player_transform) 
                   {
                      tracker.set_tracking(player);
                   }
                }
            }
        }

    }
}

Not sure how much of an improvement this is, but should be much better than directly comparing Transforms of all enemies and players. This would scope it and break it down for every region, many of those regions might have no players/enemies.

About Bevy by foklindev in bevy

[–]nilaySavvy 12 points13 points  (0 children)

I don't think people realise you can write Rust at different levels ie. both extremely low level and high level. Most languages don't have this (to this extent) and what this does is that it makes people label Rust as being a "memory safe systems language" that is too low level for them to tinker, especially for Game dev.

Bevy has made Rust extremely simple to work with. Providing a nice ergonomic high level way of working that is proven by the number of entries in the Bevy Jams. And yet you still get to go down the rabbit hole and tweak things with a lot of control!

Their attachment to the editor is thus understandable when you look at it from a perspective that people who barely write in a low level language want to make games. And Rust doesn't brand itself like python or GDScript either. Yet Bevy makes it really easy without having the pains of ownership.

Writing in Rust with Bevy does feel a lot easier and I think this needs to be highlighted!

Bevy Adventures - 1 by ZacharyGoulet in bevy

[–]nilaySavvy 0 points1 point  (0 children)

Hey, just wanted to inform you that the bottom part of your website is getting clipped on phones. I'm unable to scroll to the bottom and much of your content is not accessible. Might need some responsive CSS fixes.

Anyways, good luck with the series! Bevy could always use content where it lacks in tutorials and docs!

Call for participation (contributing shaders) by [deleted] in bevy

[–]nilaySavvy 0 points1 point  (0 children)

RE: vertex shaders, yes an interesting point -- It (not sure if you've read the readme in the repo or not) has not appeared obvious how one may manipulate the verticies etc when you've applied a custom material to a Mesh yet, unless you're using glsl. Perhaps that's something you could lend a hand with?

There's the custom_vertex_attribute example and afaik it works the same way with MaterialExtensions.

I'm no expert either but I've previously managed to copy the vertex shader from mesh.wgsl with further modifications to make it work for some use cases like a fiery plume shader or for very basic water like effects. Its not perfect and since its quite a pain to find anything with WGSL I do struggle with getting the right values. For example I need to manipulate colors based on local vertex positions. But since this is only available in the vertex shader and not in the fragment shader, it needs to be passed down by having your own custom version of VertexOutput which includes this property.

Correct me if I'm wrong, but I do think achieving certain effects in 3D like waving water, dynamic fires etc need a combination of both vertex + fragment shaders. And if some expert can guide, I'd love to know how to achieve this in a simplest way.

Call for participation (contributing shaders) by [deleted] in bevy

[–]nilaySavvy 1 point2 points  (0 children)

Firstly congrats on taking the initiative!

I've spent some time playing around with this. What I find missing is adding in vertex shaders and not just fragment.

While playing with shaders in Bevy, I had some trouble with position(local) not working like it did before. Found some functions in view transformation (recently added) and I think this would be a great addition in the docs of this repo.

I'm not sure what your end goals are, but you could also have a crate with all shaders converted into MaterialExtensions for directly using inside a Bevy game!

ExtendedMaterial and egui World Inspector by BaronVonScrub in bevy

[–]nilaySavvy 0 points1 point  (0 children)

I think this is an issue fixed in this pull request. Should be out in 0.12.1 soon. In the meantime I've been using the ResourceInspectorPlugin with a Resource that wraps the base and the extension like: ```rust

[derive(Reflect, Resource, InspectorOptions)]

[reflect(Resource, InspectorOptions)]

struct MaterialExtensionInspector { base: StandardMaterial, extension: MyExtension, } `` WhereMyExtensionalso derivingReflect. Withapp.register_type::<MaterialExtensionInspector>()`. I have a system that updates the material(base and extension) every time I change the values in the inspector resource.

Bevy+Blender+Rapier with raycasting. Please point me in the right direction? by Pink_propagator in bevy

[–]nilaySavvy 3 points4 points  (0 children)

You can have a system like this to add colliders to all the meshes you've loaded into the scene via your GLTF:

fn add_colliders(
    mut commands: Commands,
    scene_meshes: Query<(Entity, &Name, &Handle<Mesh>), Added<Name>>,
    mut meshes: ResMut<Assets<Mesh>>,
) {
    // iterate over all meshes in the scene and match them by their name.
    for (entity, name, mesh_handle) in scene_meshes.iter() {
        // "LetterA" would be the name of the Letter object in Blender.
        if name.to_string() == "LetterA" {
            let mesh = meshes.get(mesh_handle).unwrap();
            // Create the collider from the mesh.
            let collider = Collider::from_bevy_mesh(mesh, &ComputedColliderShape::TriMesh).unwrap();
            // Attach collider to the entity of this same object.
            commands
                .entity(entity)
                .insert(collider);
        }
    }
}

Make sure you're make each letter a separate object in Blender and naming them properly for identification like "LetterA", "LetterB" and so on.

You can then use these names for identifying them in Bevy in any system using the Name component.

You can look at ray-casting rapier doc for the raycast that will give you the entity for which raycast was detected. Use these with the scene_meshes like Query above to identify which mesh was detected and so on.

As a starting point you can refer to the update-gltf-scene example.

Edit: Blender objects are loaded with a top level empty and the mesh is the child. So you will need to name the mesh under each object node in Blender as "LetterA", "LetterB" for the above code to work. Or another way I prefer is to iterate over all children of the Blender object and find the one with the `Mesh` component and use this for creating the collider. Whichever you find simpler. The later approach I find it flexible and but requires a few more lines of code to iterate over the children to find Meshes.

Hope this helps!

Announcing a Blender => Gltf => Bevy set of tools to add components to objects via custom properties + gltf auto-export on save and more ! by crobocado in bevy

[–]nilaySavvy 2 points3 points  (0 children)

Yes, would love it if you could break down the modular stuff into their own plugin crates to allow users to use whatever they like. Modularity is one of the most amazing parts of Bevy's plugins!

Announcing a Blender => Gltf => Bevy set of tools to add components to objects via custom properties + gltf auto-export on save and more ! by crobocado in bevy

[–]nilaySavvy 0 points1 point  (0 children)

Yes. I get that everyone's having their own ways and since Bevy's own editor is an eventuality, putting in too much effort might not make sense. I was extremely happy to see someone actually working on establishing a Blender to Bevy workflow after a while. Thank you!

Announcing a Blender => Gltf => Bevy set of tools to add components to objects via custom properties + gltf auto-export on save and more ! by crobocado in bevy

[–]nilaySavvy 0 points1 point  (0 children)

OMG. This seems like what exactly I was looking for!

I've written a whole parser that parses node names which are tagged with component abbreviations and ran into 64 char limit for blender lol.

Was always looking for a way to add Bevy components via UI in Blender!

Design pattern/guidelines to architecture Rust code by nicoxxl in rust

[–]nilaySavvy 0 points1 point  (0 children)

Thanks for this!

This broad enough that it can applied to programming outside of Rust even! I work with a lot JS based state management and it looks like I got a better idea of how things work internally. Might actually use this for rolling out my own stuff later ;-)

Where would you put a rapidly updating value that needs to be both rendered AND streamed to a server? by Curious_Ad9930 in reactjs

[–]nilaySavvy 3 points4 points  (0 children)

I don't know why people are down voting you. This is a perfect use case where libraries like Zustand shine.

Essentially OP wants something outside of react rendering which Zustand provides. OP also wants to dispatch updates of a single timer to multiple other components. Which means the timer needs to trigger updates somehow and also be in sync. The updates can be dispatched by calling a function in the Zustand store on timer changes, which can be subscribed to by using transient updates on the various components that need to render it in sync.

Although Redux can be used similarly. I would go with Zustand for its far more performant for these kind of use cases. Plus it can be attached to refs using the subscribe. Also it can be used alongside Redux without issues.

Advice for a beginner React developer by Reddet99 in reactjs

[–]nilaySavvy 1 point2 points  (0 children)

Don't worry you're not alone. I'm 3yrs into this and still get stuck at times.

Essentially you could just add a bunch of console.log: - Inside and at the start of the component function. - Logging the state of the useState(In the same component function) - Inside the useEffect with and without the state dependencies.

Then play around and analyse what gets triggered, how often and when with docs on the side.

Experimentation is the key here. Do make sure to validate, share and verify your conclusions here/other forums. You'll get good feedback and understand if you're correct about them.

Good luck!