Game Development Community

Colorizing Materials Over A Network

by Scott Doerrfeld · in Torque Game Engine · 04/24/2007 (1:08 pm) · 8 replies

I am attempting to give users a fine level of customizability by allowing them to select the color of skin for their avatars. I've written a console function for ShapeBase called SetSkinColor which takes a texture name and RGB values. Basically the function applies the specified color to the specified texture on their avatar model, using this resource: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8005

So far I've got this working over a network using packUpdate/unpackUpdate. When I change the avatar's t-shirt color using the function, it works and the color is changed accordingly. Then when I change another avatar's t-shirt to a different color, the previous avatar's t-shirt changes with it. This doesn't happen with all other avatars, only the ones that I have made changes to. Anyone have any ideas?

#1
04/24/2007 (3:13 pm)
Hmm.. strange, but I never seen the resource you mention. It looks like you changing params on datablock - and all players who share the same datablock will be affected.

After a brief look at it I found it to be very similar to what I've done - see my .blog - posted few hours ago. It's network-safe.

I'll try to make a resource within a few days.
#2
04/25/2007 (9:29 am)
Thanks for the reply. I read the blog and it looks great. I think the problem I'm having has to do with the way the colorizeMaterial function works. But anyway, looking at that resource would really help me out. Good luck with finishing the resource, I can't wait until it comes out. ^_^
#3
04/25/2007 (12:30 pm)
Scott, are you changing the material through a variable contained in a datablock? If so, then you need to make a variable inside the Player class instead, since datablock changes affect all objects that use that datablock (ie, players).
#4
05/10/2007 (9:26 am)
Does it make sense that I'll have to create a copy in memory of the skin texture for each different player? This concerns me...Say I have 100 players logged in with 100 unique colors --- will this have to be 100 unique textures stored in memory on each client's machine?
#5
05/10/2007 (9:50 am)
Actually, yes. If all 100 players are using unique textures (colors) then you will have "at least" 100 textures stored in memory. Of course and in case you have all 100 player in "range" (scoping).
Why "at least"? One player can have more than one modified "texture".
#6
05/10/2007 (11:01 am)
Textures load dynamically, only when a avatar is visible should the texture load into memory. Colors should be done with rgb values which makes for small amounts of data to store and a minimal mem footprint. If you have 100 skins (clothing armor etc.) only if all 100 variations are standing in front of you will you be loading and unloading all those skins at once.
#7
05/10/2007 (10:24 pm)
I can't picture this, but...could there a way to colorize the materials without having a new texture created in memory for each unique color?
#8
05/11/2007 (8:34 am)
Yes, Here