Search Unity

Dynamic Prefabs

Discussion in 'Scripting' started by gazwi86, Feb 28, 2008.

  1. gazwi86

    gazwi86

    Joined:
    Jan 25, 2008
    Posts:
    21
    Hey there guys.

    Trying to create a game where you can create an avatar and your own room. just wondering if its possible and where to start.

    It a small asspect of a larger project so my head is buzzing around with other bits so im struggling on getting my head around on where to start.

    Its going tobe coded in JS so any sample code/tutorials would be greatly appreciated.

    Cheers guys
     
  2. podperson

    podperson

    Joined:
    Jun 6, 2006
    Posts:
    1,371
    Yes it's possible, and where to start is a highly open question...

    The two approaches used to custom avatars are (a) parametric components (e.g. setting how "fat" or "long" a body segment is) and (b) swapping textures and pieces (e.g. different heads, hairdos, clothing accessories). A lot of engine use only the latter option because it's technically simpler and also the models tend to look better. But extremely impressive results (e.g. Second Life) are possible using a hybrid approach (approach (a) on its own doesn't work very well ... you can't continuously morph a boy into an old lady or a dreadlock hairdo into a ponytail without having a ridiculously complex model).

    A classic example of the hybrid approach done very simply is the Mii system on the Wii.

    A classic example of the swapping approach is World of Warcraft.

    Which approach you take depends on your artists and programmers and the result you're trying to take. It's probably best to decide on a technical approach before doing much content work.

    Buildings are pretty much the same kind of issue, only simpler (in the sense that buildings are simpler to assemble from pieces).
     
  3. gazwi86

    gazwi86

    Joined:
    Jan 25, 2008
    Posts:
    21
    I think the best way would be to have a load of body parts in set folders and corresponding texures in another then swap them using the instatiate and destroy game object method.

    still not sure how to save the avatar though and have it used as a thrid person character with a walk cycle??

    Any suggestions?
     
  4. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    I plan on saving a lot of settings in an SQL database online. This of course requires an internet connection, but I imagine that assumed.

    also prevents cheating, or storing invalid values. You could even let people submit textures and soforth, through the site and make them available thru www.LoadImageIntoTexture() when they are designing things (presuming its been approved to public use).

    release a UV map of the customizable stuff and people will do most of the work for you.
     
  5. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    You can write and read text files and use the PlayerPrefs class to store data. In a web player it might make sense to have the user make an "account" on a server that stores the information in a mysql database.