Hello everyone~ The megathread is very eepy this week so I am being very quiet and not posting a whole essay as that might disturb their rest. The megathread does a lot of work for us after all, so they deserve to rest a little. Our regularly scheduled effortposts will continue next week.

Nonetheless, I hope that you (yes you!) are doing well, whenever it may be that you happen to be dropping in. I wish you all the best~


Join our public Matrix server!

https://rentry.co/tracha#tracha-rooms


As a reminder, please do not discuss current struggle sessions in the mega. We want this to be a little oasis for all of us and the best way to do that is not to feed into existing conflict on the site.

Also, be sure to properly give content warnings and put sensitive subjects behind proper spoiler tags. It’s for the mental health of not just your comrades, but yourself as well.

Here is a screenshot of where to find the spoiler button.

  • rtstragedy2 [fae/faer, she/her]@hexbear.net
    link
    fedilink
    English
    arrow-up
    9
    ·
    1 month ago
    gamedev rambling

    The fun thing about working with Rust (or maybe Bevy?) is that every silly little thing feels like such a huge accomplishment. It’s like studying the arcane arts, I’m deep into Bevy source code or sparse documentation and when 0.17 comes out some of my code will probably need to change (for the better, of course), and occasionally if you cancel compilation at the wrong time it corrupts your build directory.

    Anyway, I present to you, loading .ron files from a folder to populate item stats! This is probably a one-liner in Unity, lol, but that just ain’t me.

    The file structure:

    InventoryItem(
      id: "sword_test",
      friendly_name: "Test Sword",
      scene_path: "sword_test.glb",
      item_type: Weapon(
        slot: PrimaryHand,
        two_handed: false,
        damage: ({
          Slash: 2
        })
      )
    )
    

    And partial code to actually deal with async loading:

    #[derive(Resource, Default)]
    pub struct ItemRegistry(Handle<LoadedFolder>, HashMap<String, InventoryItem>);
    
    fn load_items(asset_server: Res<AssetServer>, mut item_registry: ResMut<ItemRegistry>) {
        // Preload everything in the folder.
        item_registry.0 = asset_server.load_folder("items");
    }
    
    fn folder_loaded(
        mut er_loaded_folder: EventReader<AssetEvent<LoadedFolder>>,
        folders: Res<Assets<LoadedFolder>>,
        items: Res<Assets<InventoryItem>>,
        mut item_registry: ResMut<ItemRegistry>,
    ) {
        for event in er_loaded_folder.read() {
            let AssetEvent::LoadedWithDependencies { id } = *event else {
                continue;
            };
    
            if id != item_registry.0.id() {
                continue;
            }
    
            let folder = folders.get(&item_registry.0).unwrap();
    
            for file in &folder.handles {
                let item = items.get(&file.clone().typed()).unwrap().clone();
                info!("discovered item {}", &item.id);
    
                item_registry.1.insert(item.id.clone(), item);
            }
        }
    }
    

    I am not sure at this point whether I’ll keep the “stripping the InventoryItem out of the Handle,” it doesn’t seem necessary but it might be handy to not have the items cloned into player inventories - to ensure all instances of an item are the same, but if I want to do item XP or anything like that that kind of precludes it.

    Of course, all this is to say nothing of the actual design of the game which uh looks like this.

    And once again, I am very proud of the view model, which is apparently a somewhat standard term for the view of the player’s hands and weapons in first-person (although I just resized the window and its no longer visible, so that’s a problem lol oh no). Several confused rounds in Blender as the co-ordinate systems are weird and I basically had to set up the camera view to roughly match the game by eyesight in Blender. Oh, and I guess the 5-hour donut tutorial paid off because look at that HIGH-DEF ART.

    • rtstragedy2 [fae/faer, she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 month ago
      more lol

      also this one time i accidentally right clicked in blender and accidentally selected a menu item that made the entire view the outliner:

      and I didn’t know how to get it back and I nearly cried, even saving and loading didn’t fix it. anyway turns out I had clicked this: