Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add furniture to game #35

Merged
merged 82 commits into from
Mar 5, 2024
Merged

Conversation

snipercup
Copy link
Collaborator

This requires #34 to work. I will publish this PR as a draft to make sure #34 gets merged first.

This pr adds furniture to the game

  • Loads sprites from the furniture definition
  • Can be moved by the player, even up and down slopes
  • Can be moved by mobs too
  • Can be shot and destroyed
  • Is saved and loaded when you restart the game
  • This pr is only for physics enabled furniture like tables and chairs. There should be a separate PR for static furniture like trees and fences.

image

There are some problems with the furniture:

  • They are lit when behind a wall even though you should not be able to see them (at least not that brightly)
  • Weight and friction does not affect movement so a chair and a filled bookcase are equally easy to move
  • Furniture jumps around when pushed against the wall
  • Collision shapes are all the same. It's a sphere so you are really pushing a ball around when you push furniture
  • The furniture has dampening 59 which prevents them from floating away. The downside is that they may fall very slowly, haven't tested this much

I experimented with the physics for a bit. We can change the sphere collision shape to a box and then lock the x and y rotation so it can only rotate on the y axis. The problem with this is that it introduces weird behaviour where you can push furniture in one direction but not the other even though there is nothing blocking it. Pushing up slopes is very difficult with only a little weight applied. The benefit is that we can introduce weight and friction and it won't clip into the wall as much as the current implementation. My guess is that if we want this there will be some custom code and it will take time to get rid of all the bugs

An alternative is that we switch to Jolt physics, something that has been advised when I looked up help on the rigidbody3d. It shouldn't be too hard to implement and it works with Godot 4.2. Jolt physics is not entirely bug free either but it has been recommended as an alternative to Godot native physics.

When the materials are generated, set the proper uv scaling so they are correctly visualized in-game.
This fixes the situation where if two map editors are opened, only the last one receives input from the scroll wheel
Improved saving loading, added duplicate and delete buttons, icons
Add name and description labels to show info on a tile
Overmap chunks will stay consistent even after changing scenes.
@snipercup snipercup marked this pull request as ready for review March 5, 2024 15:45
@snipercup snipercup merged commit 3b3485e into Khaligufzel:main Mar 5, 2024
@snipercup snipercup deleted the add-furniture branch March 5, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant