Libove Blog

Personal Blog about anything - mostly programming, cooking and random thoughts

Tag: gamedev

#

UV coordinates on pillars and floor working. I've tinkered with UVs for the ceiling surfaces but have not found a solution yet. There are always discontinuities. The ceiling is created with quadratic Bezier triangles.

Any tips would be appreciated.

#3d #graphics #gamedev #geometry #uv

3D rendering of a room with UV debug texture. The ceiling surfaces are still gray.


#

#gamedev progress:

  • materials are loaded from a configuration file
  • Adventurers return from quests and spawn a treasure chest
  • reworked text element to automatically adjust height of element

#

#gamedev

refactored hero logic into state pattern. So much better!

Code screenshot showing state pattern (left) and previous version.


#

#gamedev progress:

  • Trader implementation: appear regularly at the tavern selling materials for crafting.
  • Adventurers implementation: Have a quest and can be booked into rooms. When the embark on a quest after their stay.
  • Reworked items: previously I had an enum to distinguish between different items. This would become infeasible once I start adding more items. Rework to have a generic item struct.
  • Reworked recipes: similar to items, each recipe is now a struct. The recipe defines the ingredient requirements and a function to generate the resulting item.

#

#gamedev progress:

  • sorting sprites by layers for drawing
  • first item crafting


#

#gamedev progress:

  • added first items. Items are always placed in slots.
  • items can be dragged between slots.

recording of a yet unnamed game


#

#gamedev progress:

  • built a UI system using "immediate mode" style.

Code for one button:

if (d.add_inter(.{ .BUTTON = .{} }, .{ .owner = i, .item = 0, .index = 0 })) {
    std.debug.print("BUTTON KITCHEN\n", .{});
}
d.down();
{
    d.add(.{ .V_LIST = .{} });
    d.down();
    {
        d.add(.{ .TEXT = .{ .text = "Kitchen", .box = rl.Vector2.init(200, 20) } });
        d.add(.{ .TEXT = .{ .text = "100 G", .box = rl.Vector2.init(200, 20) } });
    }
    d.up();
}
d.up();

gif showing UI dialogs popping up and highlighting buttons under the mouse

#zig


#

#gamedev progress on hotel game:

  • did some further refactoring to rendering function
  • added room highlighting when building new rooms and selecting bed rooms for new guests

Not sure if I should be proud or embarrassed about this #rust code :D

// mark building tile
if let Some(mut r) = match game.mouse_action {
    MouseAction::BuildGrill => Some(Room::new_grill()),
    MouseAction::BuildStairs => Some(Room::new_stairs()),
    MouseAction::BuildBedroom => Some(Room::new_bed_room()),
    MouseAction::BuildCorridor => Some(Room::new_corridor()),
    MouseAction::BuildRestaurant => Some(Room::new_restaurant()),
    MouseAction::BuildWineCellar => Some(Room::new_wine_cellar()),
    _ => None,
} {
    // rendering code
}

Screen Recording of my hotel game. It shows the highlighting of available bed rooms and placing new rooms


#

#gamedev progress:

  • generalized character rendering to share code between guests and employees.
  • Added support for different animations. Animations are determined by the current action executed by the character.
  • Employees are now rendered with new character system.

Animation in hotel game


#

#gamedev progress on hotel game:

  • further work on sprites in new format
    • 32x32 for characters
    • 48x48 for rooms
  • added roof to the hotel
  • shirt and pants color of each guest is now randomized

Screenshot of a hotel game showing the new roofs