I am rebuilding an RTS mod as a standalone game in Panda3d, but I got a question.
I am quite new to this engine and greenfield projects in general, but I would like to know if it is possible to create RTS units which are statistically similar, but have different textures and even animations - like the examples below:
These warriors all have different shield designs.
Ditto these dudes too.
Having various Textures and Animations for one model base is definitely possible with Panda3D.
Using the Actor class, you can load as many animations as you like for a model and later on play one or more of them at the same time dependent on what you want to be played on the model.
This Manual page should have useful information about it:
panda3d.org/manual/index.php … Animations
As for setting a random texture, that’s also a rather easy task. Simply load all the textures you want and collect them in a list. To load a texture you can do the following:
shieldTex1 = loader.loadTexture("path/to/your/texture.png")
and then apply it to the shield model. This depends a little on your model structure, but usually it could work like:
Where shield is the part of the model that should be re-textured.
Further information about texture replacement can be found on the respective manual page:
panda3d.org/manual/index.php … eplacement
I just wanted to add that if you need to have many actors on the screen at once, then you should have each actor as a single mesh and replace the texture for the whole object.
You can have 100 one-mesh warriors and still run at 60fps, but if each warrior has a shield and a weapon as a independent object you triple the amount of batches / draw calls and thaft MAY impact the game performance really bad.
Another approach is to use hardware instancing, and per instance uniform shader inputs (whatever the proper name id), but that ain’t trivial and gets messy if you want each instance to play a different animation.