How to implement configurable player character?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Dreadstew
Posts: 23
Joined: Wed Apr 01, 2015 5:18 pm

How to implement configurable player character?

Post by Dreadstew »

I want to allow the user to pick from some choices when making their character. Different hair, different nose, mouth, etc.

What is the best way to do this with a set of predefined assets? Should I have small mouth meshes I just parent to a generic head? Sounds hard to pull off. Any tips?
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to implement configurable player character?

Post by CuteAlien »

Pretty hard. Maybe just switch textures, that's probably the easiest one. The other one needs some planning and likely you will have to write your own system for that. And it means your artists will have more work as well because they have to make general assets which can be scaled in all kind of directions and still look somewhat OK. It's maybe a fun project to write such a tool to make flexible characters, but consider it nearly an own project itself in addition to your game. Unless you have manpower to burn I'd suggest to invest just more time in making 1-2 more really cool characters to chose from. If you really want to do that - maybe start by checking the sources of MakeHuman (http://www.makehumancommunity.org/), they should give you some ideas.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: How to implement configurable player character?

Post by chronologicaldot »

That really all depends on your characters and what you're going for. If you take the generic-doll approach, you can have lots of easy customization but at the expense of the characters obviously looking androgynous. Your choice.
The configurable parts would each be separate meshes or rather, mesh buffers. I'm with CuteAlien - just swap textures for color changes. (Of course, if your hair details are all part of the mesh, you could just change vertex colors.)
You could manually try to position components, perhaps in Blender or some other software, to put them where they need to go, but how much does your mesh move? Are the parts going to become unaligned? It's like giving your character a bunch of swords (hand-held items) - either you sync them with mesh animations (which are predefined - perhaps a good idea in your case) or perhaps you find some way to "glue" them to the mesh. Perhaps there's another option. Necessity is the mother of invention, after all, but I recommend continuing your search on what other people have already tried and got working.
If I were to do it, I would probably use boned meshes and have the custom parts be attached onto the bones. Irrlicht does support boned meshes, and you can make bone meshes in various software.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: How to implement configurable player character?

Post by LunaRebirth »

I did this for clothing/facial features by creating a mesh for each piece, setting each clothing item/feature a child of an animated skeleton mesh, and then each frame, setting the bones of the clothing/features to the same rotation and position as the skeleton mesh.
For colors, I just made a new texture with each color because I didn't care enough to find a better way to do it, theoretically you could loop through the pixels of a texture and change them (right?) though this would be expensive.
chronologicaldot wrote:Irrlicht does support boned meshes, and you can make bone meshes in various software.
If I remember right, the reason that I had to rotate and position the bones of my clothing/features to the skeleton mesh each time is because Irrlicht crashed when I tried setting a bone the child of a bone.
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: How to implement configurable player character?

Post by chronologicaldot »

Interesting bug. I'd like to know more about the details of that, esp. since I'd like to use the bone features. New thread, maybe?
Dreadstew
Posts: 23
Joined: Wed Apr 01, 2015 5:18 pm

Re: How to implement configurable player character?

Post by Dreadstew »

That sounds awesome Luna. I definitely want to give that kind of thing a shot later. Probably would try making a special bone in the mesh skeleton just to parent the mouth, eye, etc. Sounds like a good idea!
Post Reply