🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Limbs, stats, items and saves

posted in Biotic for project Biotic
Published March 04, 2022
Advertisement

Hello and welcome (back) to the Biotic blog. I still don't have a concrete time to write this out so until it becomes a timely thing I'm just doing it when I can. Going to try and talk about some of the systems here without going too in-depth on the programming. Firstly most enemies in Biotic will have limbs in which can be destroyed independently of each other!

This is achieved by each enemy having a limb manager which can have a list of any number of limbs. Each limb in the list will point to the limbs stats, associated models, colliders, effects, damage multiplier and so on. They can even be classified as vital so when they die, the enemy outright dies too! All this communicates very effectively by having a robust Stat System that holds lists of stats which could be things like health, stamina, air and anything really. Each stat is really just a value with a minimum and maximum. Each enemy has an overall stat-manager that governs if it is alive or not while the limb manager manages all the limbs and their health. Here's what those scripts look like in Unity's inspector window with this smaller picture.

Whenever the player shoots one of those weapons and the shot hits a collider the limb manager will take that damage and identify which, if any, limb was hit based off the collider hit. When it finds the corresponding limb it'll multiply any additional damage and reduce the limbs health stat and the root health stat by the damaged amount. If a Limb reaches a value of 0 with it's health stat it will be destroyed in a bloody mess. If the limb is tagged as vital, or if the damage inflicted reduced the root health to 0, the enemy dies. This will allow for some enemies to continue the fight even with parts of them blown off!

There's a picture of a test scene using a dummy zombie model below. Remember almost anything in this blog is subject to change, before release especially the assets!

Another robust system I created for Biotic is an inventory system that the player, enemies, and contains all utilize to hold items. These items can be literally everything in the game that can be saved which is pretty much anything that moves. I've created item definitions for each item that give me access to all the associated information I need such as the items model, associated scripts. There are other types of item definitions such as weapons, pickups, enemies and keys that have their own particular attributes such as ammo change, types of crosshairs and more. Whenever anything dies that has an inventory it'll drop whatever items it's holding based on the item definitions.

One system that has taken the longest out of all of them is the save and loading. I will only briefly touch on it here as it relates to the above information. The scope of it is too much for me to write in this post at the moment and I frankly do not wish to explain it anytime soon after going through it a hundred times. Regardless of that we can save the game! Anywhere! Since everything has an associated item definition I've made a script called WorldObject that is used to identify what can be saved in a list. From that list it'll take all the world objects and save them which includes their position, rotation, stat manager stats, those values, inventories items held, all the players information, and more!

The game has many managers one of which, the Game-manager, is always active to help the game save, load, change scenes, manage enemies and things like that. One of the things it manages is a dictionary of all the items in the game. The dictionary has a name (key) and a item definition (value) which I use to load everything back in. When the world objects get saved the ones with an inventory save their held item definitions as text (strings). When the game manager creates objects from the save file and sees there are items to load it references the dictionary to find the appropriate item definition and populates the inventories during load.

I hope this was informative and or interesting. Many many hours have been poured into this project and even though I started it while still learning to program I've done nothing but continuously improve. Apologies if any of it seems confusing, its just the surface of it and it confuses me sometimes too! I'm looking forward to showing more about Biotic when the time comes! Until then thank you everyone and take care.

Previous Entry Weapon Models
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

Weapon Models

4401 views

Introduction

4686 views
Advertisement