Libove Blog

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

#

https://mastodon.social/@drmorrisj/117531502063403982

The problem is that the server does not notify the client about changes to a room yet. So Player 1 and 2 can be in the same room, both pick up book A and place it in another room. This would lead to two "book A" entities in two different rooms.


#

#yt-dlp #youtube #media

Download 720p video and best audio in MP4 format.

--format "bv*[ext=mp4][height<=720]+ba[ext=m4a]/b[ext=mp4][height<=720]"


#

#gamedev progress:

After the persistence refactor I've added a networked implementation. In principal this already allows for a multiplayer server. However changes to the world state are only synced on entering a new room. This would most likely lead to inconsistent state, e.g. a book being placed in two rooms.


#

#gamedev

I've refactored the persistence system of my game entirely. Before the refactor I saved an intermediate representation, which was created by the level generation. When a room was loaded the representation was transformed into entities to be added to the world state. As I also had to track the positions of books and scrolls, I had to pollute the structure further and further. This made adding new mechanics difficult as I had to somehow fit it into this awkward structure.

My new approach is to simply save all entities (I use fat structs to represent everything) belonging to a room in a single file. Whenever something changes in a room, I can just serialize all entities and be done.


#

#gamedev progress:

Can now place pictures in frame.

A framed picture of a house in a 3D game


#

#gamedev progress:

  • Added signs to each corridor showing to which room it leads.
  • The frame is build with a "9 patch" geometry.
  • Added alignment options to my text rendering function to allow centering the text inside the frame.

A sign showing "Room 8"


#

#gamedev progress:

  • Implemented a loader for OpenRaster files. This allows me to bundle all textures needed by an object in one project file. (inspiration by tsoding)
  • Reworked rendering to use a tint texture instead of a global tint intensity. This allow to have parts of objects untinted.

Game screenshot showing 3 flasks tinted in different colors. The label is not tinted

#rust #wgpu


#

#gamedev progress:

  • added a simple debug UI, as it got unfeasible keeping these options on function kes.
  • reworked lectern. It now has 3 places where flasks are placed. Flasks will be used to change drawing color on scrolls.

New lectern design with 3 flasks of different colors


#

I've implemented a simple rectangle packing algorithm, which I want to use for the font texture.

The algorithm is only 40 lines long. It keeps track how far each row is already filled and greedily inserts rectangle at the place where they are "most to the left", starting with the tallest rectangles.

Debug rendering showing 1600 random rectangles packed into a canvas

#rust #gamedev