How to handle items
This game being so inspired by Lethal Company, items are a focal point of the games functionality. The player being able to go out and get items and sell them when they want to is a pretty major focus of a good chunk of the game loop. Because of this, item persistence is probably one of the most vital thing that needs to happen. There are a lot of ways that the items need to cheat the purge of memory clearing. Items need to persist through restarts, items must persist through scene loads, and when an item gets let on the players base it should be expected that the item will be there when the player comes back, and that is all before we get into the players inventory which means that all systems need to account for the fact that at least 10 items might exist on the scene, but be in some wild spot because they're in the players inventory and disabled, and for the best experience the game needs to be able to account for all these and properly handle it throughout the different scenarios.
The item transfer were covered earlier, but now there's a few other things to talk about as new features were added to the game. First and foremost the player now parents objects to itself which the system did not like not notably in the case of attempting to move the item back to the scene to be deleted later. The best solution I figured out was to just let the objects be brought with the player object since that is also persistent, and once the player drops the item if it should still exist the items hitbox being turned on should allow the game to detect if it got put into a trigger box, as well as a second security check to ensure that the collection area hasn't already found that object and added it to prevent duplicate entrees, and a null reference. It's definitely not a great solution, but it works for the time being. Another patch was the transferal zone being persistent too, which caused issues with the game loosing track of collected items if they weren't refreshed, so to solve that that area is refreshed every time pending reworking.
Then there is how items survive through their deletion. Such as being outside the ship in the base, or the game being closed and reopened. Whilst theoretically items in the base could just be disabled and saved in memory too, that is only a solution to one of the things. The solution that I created was a system that would store only the necessary information of the item and then use that to reconstruct the original item when moving from scene to scene and relaunching the game. So for right now the game will store the items "Spawn ID" position, rotation, and price and keep that in memory, or save it to the file. Then once the game comes back to the base it will either check the corresponding save file, or the Game Managers memory in order to create all of the items that need to exist in the base. Obviously the save will store more items, including the items that are deemed "Collected" but to avoid situations where the player leaves to a planet and comes back to find that all the items in their ship were duplicated for any temporary save all Collected Items are exempt from the list. And in the case that the player is leaving any other planet, nothing happens to the items and they're left to their fate.
Hopeless Forager
Can you survive the next ejection?
Status | In development |
Authors | arcane-ground games, TheOwl724, Lusenio Incidium |
Genre | Survival |
Tags | Action-Adventure, Horror, Singleplayer, Space |
More posts
- How do you make a computer within a computer game?Mar 01, 2024
- Issues when moving the ship between scenesMar 01, 2024
- Press and Hold interactions for playerFeb 24, 2024
- The Audio SystemFeb 17, 2024
- AI perception system reworkFeb 17, 2024
- Item system revamp and the struggles that came with itFeb 02, 2024
- Item Transfer Update and ExpansionFeb 02, 2024
- Issues with interaction raycast and player model offsetJan 27, 2024
- Problems with carrying items from scene to sceneJan 27, 2024
Leave a comment
Log in with itch.io to leave a comment.