SoW - Character Customization
by Gareth Fouche · 01/15/2008 (10:18 pm) · 16 comments
(Before I start, please note : I know the body textures are a bit screwy, especially around the neck. Before I get 5 posts pointing that out ;))
The holidays were, as always, pretty hectic, but I finally got a chance to sit down and get some dev done. Specifically, I finally got round to tearing out my old character customization code and implementing a new system.
Now, I've shown my customizable game characters before on this blog but the key thing is that they were screens from 3DS max. The code didn't support those options, so neither the player nor the designer (in both cases me) could use them. So I got down into the code with an axe and started hacking things out.
First I created DB structures. The DB links character races with "skinsets", which are conceptual groupings of customization options. So as a Designer you can link different skin colours, eye colours, hairstyles etc together under a skin set, and then link a race to any number of skinsets. Then, when the player chooses a race, it automatically looks up all the options you can choose from. And it is simple for a modder to go into the DB and add or change these. :) Additionally, you can specify any customization option as "Playable". If you set that value to false, only NPCs can use it. So, for example, you can limit the PaleSkin set and RedEyes to the NPC vampire race, or whatever.
Previously, I was using a series of menu guis with the GuiObjectView resource to show a model and allow the player to select a race etc. Well, I decided I wanted something nicer. Something like you see in modern RPGs.
So instead I modified my startup code to load up a Character Creation Mission. I added code to lock the players position so pressing the arrow keys doesn't move him or the camera. Then I dropped 2 spawn points, 1 near the head and one further back, looking at the body, and added buttons which let you set your view to those 2 points. A slider to rotate your char on his pedestal, some drop down lists to select your customization options, a hastily-whipped up ruined building to set the player on, and viola, character customization screen :







Still a WIP, but coming along nicely. Best of all, I created it in such a way that this time you can edit either the player or NPCs, depending on where you load this screen from. So Modders will use exactly the same thing to make NPCs, just with all options available to them. :)
The holidays were, as always, pretty hectic, but I finally got a chance to sit down and get some dev done. Specifically, I finally got round to tearing out my old character customization code and implementing a new system.
Now, I've shown my customizable game characters before on this blog but the key thing is that they were screens from 3DS max. The code didn't support those options, so neither the player nor the designer (in both cases me) could use them. So I got down into the code with an axe and started hacking things out.
First I created DB structures. The DB links character races with "skinsets", which are conceptual groupings of customization options. So as a Designer you can link different skin colours, eye colours, hairstyles etc together under a skin set, and then link a race to any number of skinsets. Then, when the player chooses a race, it automatically looks up all the options you can choose from. And it is simple for a modder to go into the DB and add or change these. :) Additionally, you can specify any customization option as "Playable". If you set that value to false, only NPCs can use it. So, for example, you can limit the PaleSkin set and RedEyes to the NPC vampire race, or whatever.
Previously, I was using a series of menu guis with the GuiObjectView resource to show a model and allow the player to select a race etc. Well, I decided I wanted something nicer. Something like you see in modern RPGs.
So instead I modified my startup code to load up a Character Creation Mission. I added code to lock the players position so pressing the arrow keys doesn't move him or the camera. Then I dropped 2 spawn points, 1 near the head and one further back, looking at the body, and added buttons which let you set your view to those 2 points. A slider to rotate your char on his pedestal, some drop down lists to select your customization options, a hastily-whipped up ruined building to set the player on, and viola, character customization screen :







Still a WIP, but coming along nicely. Best of all, I created it in such a way that this time you can edit either the player or NPCs, depending on where you load this screen from. So Modders will use exactly the same thing to make NPCs, just with all options available to them. :)
About the author
Recent Blogs
• SoW Weekly Update 10• SoW Weekly Update 9
• SoW Weekly Update 8
• SoW Weekly Update 7
• SoW Weekly Update 6
#2
01/16/2008 (4:15 am)
Good job! I also like the GUI frames to the right of the shots.
#3
01/16/2008 (6:55 am)
Very nice! Is this going to be making it's way into a resource or code pack of some sort?
#4
01/16/2008 (7:47 am)
Is this the Hidemesh code??
#5
01/16/2008 (8:10 am)
Good stuff Gareth and good progress for one person. I know how hectic it can get to work on a game alone and manage a day job and social life.
#6
@ Brian : Yep.
@ Ted : Unfortunately this is heavily tied into how I have my DB setup, and my startup scripts...so it would need to be a codepack, and I won't have time to do it until I've finished my game. Sorry mate :( But I'd really recommend looking into the mesh hiding and blended skin resources, they are the core of what I'm doing here. Ther rest of the work is just grunt coding to get it working in my framework generically etc.
Thanks everyone else :)
01/16/2008 (8:16 am)
Thanks Leslie. And thanks for your texture swapping resource, made it that much easier. ;)@ Brian : Yep.
@ Ted : Unfortunately this is heavily tied into how I have my DB setup, and my startup scripts...so it would need to be a codepack, and I won't have time to do it until I've finished my game. Sorry mate :( But I'd really recommend looking into the mesh hiding and blended skin resources, they are the core of what I'm doing here. Ther rest of the work is just grunt coding to get it working in my framework generically etc.
Thanks everyone else :)
#7
;-)
Nice work.
I like a lot this solution:
01/16/2008 (12:06 pm)
@Gareth : body textures are a bit screwy, especially around the neck;-)
Nice work.
I like a lot this solution:
Quote:I modified my startup code to load up a Character Creation Mission. I added code to lock the players position so pressing the arrow keys doesn't move him or the camera. Then I dropped 2 spawn points, 1 near the head and one further back, looking at the body, and added buttons which let you set your view to those 2 points. A slider to rotate your char on his pedestal, some drop down lists to select your customization options, a hastily-whipped up ruined building to set the player on, and viola, character customization screen
#8
Hehe, thanks. Yeah, using a 3D scene as a gui backdrop is pretty rocking. I'm going to add in plumes of smoke, more rubble and better ruined buildings, make it look more like a devastated battlefield. "The Scars of War" and all that. :)
01/16/2008 (1:28 pm)
*Adds Stephan to The List*Hehe, thanks. Yeah, using a 3D scene as a gui backdrop is pretty rocking. I'm going to add in plumes of smoke, more rubble and better ruined buildings, make it look more like a devastated battlefield. "The Scars of War" and all that. :)
#9
My brother and I wanted to use something like this for our game BATTLE!!!
I always thought you could do this by
I have no idea if this works but I think its a place to start, mind you I am not a very experienced scripter. But I was thinking since our game was going to be free the majority of the stuff we learned was going to be submitted as resources. Now the only problem is I don't know how to switch the base player while in the menu like you have.
sorry if this little thinking outloud bothers someone im copying it to a forum so that hopefully some collaborative efforts can be made. Thanks
01/17/2008 (6:06 am)
Im still new at the hidemesh code but can you give me a basic idea of the grun coding you used, i realize its in a database.My brother and I wanted to use something like this for our game BATTLE!!!
I always thought you could do this by
Switch$(Head);
{
case "1":
%client.head="HeadSwitch1";
case "2":
%client.head="HeadSwitch2";
}
function HeadSwitch1()
{
%player.skinoff(H002)
%player.skinoff(H003)
}I have no idea if this works but I think its a place to start, mind you I am not a very experienced scripter. But I was thinking since our game was going to be free the majority of the stuff we learned was going to be submitted as resources. Now the only problem is I don't know how to switch the base player while in the menu like you have.
sorry if this little thinking outloud bothers someone im copying it to a forum so that hopefully some collaborative efforts can be made. Thanks
#10
I really need to look into the mesh hiding and blended skin resources.
This is almost exactly what I need to implement in my pro-wrestling game in the create-a-wrestler feature.
I'd like to combine this with the xml console so that I can have the user save the wrestler and then have him be automatically be available within the character select screen.
this may be answered within my research of the resources, but for the hair styles... is each hair style "embedded" within the character dts and then shown and hidden? or is each style its own dts and then loaded/properly placed on to the character from within torque?
01/17/2008 (9:28 am)
This is great...I really need to look into the mesh hiding and blended skin resources.
This is almost exactly what I need to implement in my pro-wrestling game in the create-a-wrestler feature.
I'd like to combine this with the xml console so that I can have the user save the wrestler and then have him be automatically be available within the character select screen.
this may be answered within my research of the resources, but for the hair styles... is each hair style "embedded" within the character dts and then shown and hidden? or is each style its own dts and then loaded/properly placed on to the character from within torque?
#11
01/17/2008 (11:42 pm)
@ David : yep, each hair is modelled on the dts mesh then hidden or shown via code. You could do it as the hair being a seperate mesh but then it is harder to judge it's proportions properly I find.
#12
Then let me ask you 1 follow-up question if I may...
Do the meshes that are hidden have any impact on performance/frames-per-second even though they are hidden?
Reason I ask is that I'll have several body types for my wrestlers (i.e. skinny, fat, tall, etc.). Would it make sense to put all of those meshes in the same dts?
01/18/2008 (8:15 am)
got it. So I'd put all of the hair styles/hats/glasses /etc. in that file and use the hide mesh resource.Then let me ask you 1 follow-up question if I may...
Do the meshes that are hidden have any impact on performance/frames-per-second even though they are hidden?
Reason I ask is that I'll have several body types for my wrestlers (i.e. skinny, fat, tall, etc.). Would it make sense to put all of those meshes in the same dts?
#13
01/18/2008 (8:33 am)
Not really, the hidden meshes aren't being rendered. The textures are probably loaded onto the gfx card , ie they take up texture memory, but that shouldn't be a problem unless you go mad with it I think. I'd probably do it all as one model.
#14
Thanks for your help
01/18/2008 (9:02 am)
Well actually, the meshes would have the exact same texture. The different meshes would only determine how fat/tall/etc. that wrestler wasThanks for your help
#15
Sorry i just love it. and for one guy. awesome. Need to find out more about this. Its just great.
01/22/2008 (1:24 pm)
This is FREAKING AWESOME!Sorry i just love it. and for one guy. awesome. Need to find out more about this. Its just great.
#16
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5421
however it crashes when loading objects in 1.52
did you happen to run into this? any pointing in the right direction would be really appreciated.
01/24/2008 (5:48 am)
I have implemented the Hide mesh resource with a clean build of torque...http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5421
however it crashes when loading objects in 1.52
did you happen to run into this? any pointing in the right direction would be really appreciated.
Torque 3D Owner Matt Huston
Atomic Banzai Games