Mythruna

Development => Blog => Topic started by: pspeed on March 16, 2015, 01:00:24 AM



Title: Even though I got the bullet...
Post by: pspeed on March 16, 2015, 01:00:24 AM
So, even though I did end up buying Dragon Age (Amazon had it on sale + rewards points = free game)... I've still managed to make some progress on things.

On our previous episode, I was working on the character model stuff and revamping the design.  I had it to the point of being selected in the book UI and so on.

This weekend I played with adding the parameterized parts like body type, hair color, etc... in a more general way that can apply to not just the avatar but any character model I want to use.  The models are defined in groovy scripts and so can be customized as needed (some models require fixing in order to work properly).

For example, a really simple script might look like this:
Code:
charModel( "human-male" ) {
    asset = "Models/male/human-male.j3o"

    onModelLoad {
        def hair = it.child("Hair")
        hair.transparent = true
        hair.move(0, -0.04f, 0.1f)
    }
}

charModel( "human-female" ) {
    asset = "Models/female-parts.j3o"

    onModelLoad {
        it.child("hair1").transparent = true   
    }   

}

That defines two character model types along with model to load and each of them tweaks the model a little bit to make them work properly.

But, you can also define runtime parameters that are exposed to the engine.  So if I want to give the female a hair color parameter, I can do something like this:
Code:
    parameter("HairColor") { ColorRGBA color ->
        def m = child("hair1").material       
        m.setColor( "Diffuse", color );
        m.setColor( "Ambient", color );
    }

That defines a parameter called "HairColor" that is type color.  When the HairColor is set, it looks up the right child object, grabs its material, and sets its colors.

To test all of this, I created another tester app for testing char models.

Here is a picture of that app with my test-female-model type loaded:
(http://i.imgur.com/VQPQGds.png)

She has all of the parameters... hair color, body type, etc... actually, I added height later too but I didn't take pics of that.  In that pic, she's a little thicker than normal.

Here is the male model.  He doesn't have any parameters defined yet:
(http://i.imgur.com/2Qm4Pxw.png)

For fun I also loaded a rat model that I have:
(http://i.imgur.com/ylNNLLK.png)

One neat thing about this tester app is that I can edit the scripts at runtime and reload them without closing the app.  This is great for tweaking animation parameters and stuff.  Way more flexible than my old avatar tester.

For fun, I also added a Colored Rat with a color parameter.  Here is the regular rat again:
(http://i.imgur.com/hgM9cRY.png)

Here he is green:
(http://i.imgur.com/Q0KFMKI.png)

Here I've given him a lighter color:
(http://i.imgur.com/ZAOYDxg.png)

This kind of thing is great for creating a little variation in creatures.

There is still other stuff to add to the character model support in the long run (no animation support yet for example) but it's far enough along to get avatars working and that was my original point.  Hopefully this will also allow me to get the male model working properly without his head flying off.  Creating model-specific customizations is really easy now.

As a point of reference, I spent my free time Friday and Saturday creating this tester app and adding the right parameter support.  It only took me an hour then to get these models working in it and then it was just like playing.  Should be really helpful as I go along.


Title: Re: Even though I got the bullet...
Post by: Michael on March 16, 2015, 04:06:04 AM
Lovely. I'm enjoying the progress with the script support. :)


Title: Re: Even though I got the bullet...
Post by: Rayblon on March 16, 2015, 12:59:05 PM
I'm totally gonna be a mouse when the character creation is released. Trololo