Storing unique creatures for a creature capturing game

Godot Version

4.3

Question

I am creating a Pokemon style creature catching game and have a bit of coding experience with Godot. I have been losing my mind trying to think of a plausible way to store creatures that you caught and how to load those creatures efficiently. My first idea was to just use an id system, but I can’t think of a good way to load them. My second idea was to just number every creature you caught in order, but I want to add multiplayer so how would you store the creatures for them. Any help is greatly appreciated, thanks!

Design really depends on your requirements. If this is going to be pokemon style the id system is easy.

0 none default catchall placeholder
1 creature x
2 creature w
3 … Etc.

I would create a Resource class that has all the base stats and assets defaults for each creature. You can have a base class and extend it with the name of the creature

extends Resource

class_name Creature

@export var creature_name = "PLACEHOLDER"
@export var type = TYPE.NONE
@export var sprite = PlaceHolderImage.new()

enum TYPE {
 NONE,
 GRASS,
 ... 
}
... Etc.
extends Creature

class_name GrassMonsterCreature

func _init():
  creature_name = "GrassMonster"
  type = TYPE.GRASS
  sprite = load("res//: path to sprite")

Or!

set the type and assets in the inspector and save a stand alone .res without making a new script.


This Resource is added to an exported array. And can be filtered and sorted based on your needs. This system will be in charge of spawning creatures in the wild.

Then when the player collects the creature the resource is saved with the player inventory, the resource can be used to display UI elements repurposing the sprite property creature_name and type.

Then for the creature character assign the resource to the character

extends characterbody2d

class_name CreatureBody

# set this when creating a creature body
@export var creature_res:Creature = Creature.new()

func _ready():
  $Sprite.texture = creature_res.sprite
  $NameLabel.text = creature_res.creatue_name
  $TypeIcon.set_creature_type(creature_res.type)

...Etc.

This can be extended for custom animations, attacks and so on.

The id part can be a function of the master list that has all the base resources. Or it can be a tool that looks at the list and sets a creature id based on the order in the list and resaves the resources.

Idk this is just an idea there are many ways to go about this. All that matters is how you want to manipulate the objects.

So design the attributes of the creature that need to exist. Design the systems that will need various resources to represent a creature. The systems wil dictate what is needed in the data and the data will dictate the interactions with the systems.

I’m not sure how well this works for what I need, 1.) It’s 3D (My bad I didn’t specify) 2.) I need a way to make a creature unique from the others when you catch it. What I mean by that is when you have your own, it has it’s own level, stats, and ability, but I need that not to be shared with every single one of that species. But I don’t know how to save that separately and keep it organized and easy to load in something like the PC Box and party.

The 2d/3d aspects doesnt really matter, its just the idea im trying to convey.

For things that make a creature unique you can repeat this abstraction and add a stats class that, is linked to the creature resource in some way, and can have level, attacks, custom creature name etc. you can break the creature class into a container like class.

Everything should have a defualt, but creatures can be customized based on players level, or area.

Creature resource can have a stats class (level, attack, health etc., skills ) and an asset class (meshes, animations), override class(name, color)

The creature resource becomes more of a container to mix and match things to allow you to get at the things you need to visually represent and logically dictate in other systems, and can be saved to preserve its uniqueness for the player save. This container can easily be passed around to other systems if needed.

I would avoid duplicating some larger resources though. Static things that should not change would be assets and base features. The things that can be duplicated should be small, like stats and overrides.

Ultimately where you draw the lines is how you will make your data structures. I would spend a minute or two thinking about these things and limit yourself on scope. Then start implementing and see how it goes.

You could also look into common design patterns or find if there has been a pokemon game reverse engineered to analyze.

I loke the idea of ECS design, and i think this is related to it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.