imagination XD

realizing dream


Leave a comment

[Unity] Save Game with ArrayPrefs2

I already use this script since Catapult. This is the best saving script I ever use, but this is not really easy to use. I also developing my own format but it’s not really better than this. My own format will going to be use in Personified Fear or above game. Works with indie don’t worry.

You can see the script here.

It can save any types, but the most i liked is the Array function. It’s easier and much more safe.

For example, if you want to save sound volumes setting information (Javascript for example)

  1. In your Menu GUI Script, put var volumes = new float[5];
  2. Also set the awake / default value of volumes if Player haven’t set the volumes. like if(!PlayerPrefs.HasKey(“KeyName”)){ awakeVolumes[0] = Camera.main.audio.volume; awakeVolumes[1] = AudioListener.volume; volumes = awakeVolumes; PlayerPrefsX.SetFloatArray(“KeyName”, volumes);}
  3. Then set on start / awake function, if(PlayerPrefs.HasKey(“KeyName”)){ volumes = PlayerPrefsX.GetFloatArray(“KeyName”, awakeVolumes); }
  4. On your Scroll bar GUI of main volume (volumes[1]) or music volume (volumes[0]), the scrollbar value must be volumes[0] for music volume scrollbar. Whatever you set it, when player press Save, just put PlayerPrefsX.SetFloatArray(“KeyName”,volumes);
  5. To delete user data, just simply put PlayerPrefs.DeleteKey(“KeyName”)

Okay, this is the script example of Menu GUI

var volumes = new float[5]; // volumes has 5 array of float with 0 value...
private var awakeVolumes = new float[5]; //must be same array with volumes above

function Awake(){

awakeVolumes[0] = Camera.main.audio.volume; //music volume
awakeVolumes[1] = AudioListener.volume;

if(HasKey("Game Volumes")){
volumes = PlayerPrefsX.GetFloatArray("Game Volumes", awakeVolumes);
Camera.main.audio.volume = volumes[0];
AudioListener.volume = volumes[1];
}else{
PlayerPrefsX.SetFloatArray("Game Volumes", awakeVolumes);
volumes = awakeVolumes;
}

function OnGUI(){

// let's skip making window process
GUILayout.Label("Music Volume");
volumes[0] = GUILayout.HorizontalScrollbar(volumes[0],0.0,1.0);
GUILayout.Label(volumes[0].ToString());

GUILayout.Label("Main Volume");
volumes[1] = GUILayout.HorizontalScrollbar(volumes[1],0.0,1.0);
GUILayout.Label(volumes[1].ToString());

if(GUILayout.Button("Save")){
PlayerPrefsX.SetFloatArray("Game Volumes", volumes);
}
if(GUILayout.Button("Delete")){
PlayerPrefs.DeleteKey("Game Volumes");
}

}

}

My New 2013 saver use something like XML but i’ll make own format to keep player to change every value on XML.


4 Comments

[Personal] An Unusual Update

Hello everyone, I know I’ve been gone for so long, but I really don’t know what to do to make this site still active since I haven’t post for a long while.. I’ll probably broaden up this site. This site actually focus on Unity game research, but I’ll widen it up with animation research…

So today, I haven’t sleep yet, I see that Unreal Engine is finally free to download but such a misfortune that it didn’t support my computer. Unreal Engine needs 64 bit Windows and 8GB RAM, meanwhile i use good ol’ 32 bit Windows with 3GB RAM. That’s pathetic… You can download Unreal Engine here.

But, Unity 5 finally released, now I can back making games. :D
I hope Unity 5 will support my old 32Bit PC…

I recently had lost some ideas on making everything (games and animation). I wonder where my Inspiration lost. I can’t think such something to post here, Animation Plot, and Game designing…

It is true I’ve been improved a lot on my modelling skills in 1 year, but I’m still not pleased with it. I’m suck at texturing, and rigging.

Also I was making my first light animation, but before jumps to far, I need to make some render researches. It makes me such heartbroken looking at the render result of 3 hours of Global Illumination and Toon. Indeed I really suck at texturing, and rigging. Just look at that horrible faces. I’m not sure this will be good.

AH1_0113

What do you think ? What should I do ? I need critiques please…

I should be using Unity to render my animation because it’s easier and faster but my model can’t export the blend shape that I’ve done hard…

You know what’s more painful than stepping on a lego ? Re-skinning every different outfit on same character. I always got 3D Tumors everytime I tried to fix it. But in future, I’ll probably just use cloth physics not skinned cloth. But, I think graphics doesn’t matter. Yeah but if the plot was poor ?

I have 728 days to accomplish this, everything must be perfect. I still have time to remodel every character.

  • Animate Cosmos – Kirin PV
  • Animate Colorshift PV
  • Animate A Certain Musical Vocaloid
  • Animate Project Imaginechan ONA
  • Develop Moe Unite MMOFPS Game
  • Develop Nitro Racer XD 2 MMORacing game


2 Comments

[Unity Editor Tool] Set Tag Recursively

This tool will set all object children tag to parent’s tag. Without this, you would have to set every children tag one by one, with this, you’ll only need to drag one parent object to Object to change and every child object’s tag will be same with parent’s. But remember! The tag you want to change must add to Unity Tags (Unity > Edit > Project Settings > Layers and Tags).

Change Tags Recursively

This can be really useful you know since Unity wont let to change tags recursively.

Save it as javascript and put it on Editor folder… Ah yes, I put it on SKiPPER > Set Tag to launch this tool


class SetTagRecursively extends ScriptableWizard
{
	var objToChange : GameObject;
	var tag : String;
	
	function OnWizardUpdate () {
		//objToChange = Selection.gameObject;
	}
	
	function OnWizardCreate () {
		//for(x in objToChange){
			var x = objToChange.GetComponentsInChildren(Transform);
			for(var z in x) z.tag = tag;
		//}
	}
	
	@MenuItem("SKiPPER/Set Tag")
	static function TagRecursively () {
		ScriptableWizard.DisplayWizard("Change Tags Recursively", SetTagRecursively, "Touch to Henshin...");
	}
}


2 Comments

[Unity] Keyed Lipsync using Blendshape + Tagarela

edfedfe

I still research on how to make automated keyless lipsync. So, I found this plug in, it’s free, and it’s easy to use so I got that goin’ for me, which is nice.

Recipe (What you’ll need) :

  • PC with Unity 4.3 or above
  • Tagarela
  • Mesh that has blendshape (If you don’t know how to make blendshape, read this)
  • Blendshape that has at least A,I,U,E,O keys. (if you are too lazy to make E key, you can use I for every E)

Alright let’s start! I’ll use Kagamine Len by Animasa model as example.

  1. After finished download, open it in Unity.
  2. Select an object that has blendshape / skinned mesh renderer on it. Open Component > Tagarela. After that insert Audio Clip and then press Add.lt1
  3. Click Open Editor then press Create New Animation, choose Audio Sync, name it whatever you want, press save.lt2
  4. First, slide the tiny slider near audio’s start, then press + to add new keyframe, locate the new keyframe at the middle of audio, and adjust the blendshape below.
    lt3
  5. I use Unity chan’s konnichiwa (こんにちは私ユニティちゃん). 1 is all Zero, 2 is 100% 001 (O (I forgot to change name), 3 is also zero because it’s closing its mouth when saying kon’, and 4 is 100% i, when it says ni.
    lt4
  6. Set it till near perfection. Also remember to set keyframe to zero on all flat audio which is mute (does your mouth open when you say nothing ? unless you breathing with mouth, like me). For example, your voice was “Hello World”, 1 all zero keyframe was located before Hello, 2 keyframe was located in ‘He’ has 100% ‘E’, and 3 keyframe was located in the ‘llo” has 100% ‘O’ and 0% ‘E’, at the end of ‘Hello’ add 4 keyframe that is zero keyframe, and 5 keyframe was located at the beginning of ‘World’ which also zero. 6 keyframe repat like 2 keyframe but with different value.
    lt5
  7. After you done naturalising the lipsync, always remember to put zero keyframe at the start of audio not voice. and then save it. You may ask how to use it on gameplay, well, you’ll only need to put this GetComponent<Tagarela>().Play( <Your animation number (mine is 0 because it’s the first animation)> ); on a C# script. Also attach this script on the same place where your blendshape mesh.
    lt6
  8. Ta-da… Not bad I see. I also forgot to add some Mecanim animator, so it looks like stupid people says “Hello, I’m Unity-chan” but actually you are Len Kagamine.

Next, I’ll research much easier to use lipsync or Anime-like lipsync. Most anime I watch, they only use 1 key. Even they say “What the hell are you doing”, their mouth will be always open and close only, no wide or narrow. Also remember to make it jagged, so it’ll look like Anime. I also researching on how to combine cloth shader with Toon shader like cloth crumple shadow in usual anime.

Ah and Imagine-chan’s model has finished, and it’ll release probably this november. I think I’ll need to remodel, because her head looks ridiculous. However, morphless FBX and PMX download will be available. I’m kinda busy working. My supervisor wont let me to do this, so that’s why I wont upload this model soon.


Leave a comment

[Unity] Taking In-Game Screenshot

Hello, everyone, Sorry I didn’t post something here in long time. I’m very busy, leveling up my CG skills. I also post some random unity things.

So, basically, taking screenshot in Unity is very easy. Copy this script below, and attach it in Main Camera

var folderName : String = "DCIM";
var captureSound : AudioClip;
var quality : float; //Set screenshot resolutions, default is 1. 1 equals your monitor size.
private var screenshotFader : GameObject;

function LateUpdate(){
 if(screenshotFader){ //Flashing effect
 screenshotFader.guiTexture.color.a -= Time.deltaTime;
 if(screenshotFader.guiTexture.color.a < 0){
 Destroy(screenshotFader);
 screenshotFader = null;
 }
 }
 
 if(Input.GetKeyDown("C") && !screenshotFader){
 if (!System.IO.Directory.Exists(folderName)) System.IO.Directory.CreateDirectory(folderName);
 
 screenshotFilename = folderName+"/DSC_"+System.DateTime.Now.Day.ToString()+"_"+System.DateTime.Now.Hour.ToString()+System.DateTime.Now.Minute.ToString()+System.DateTime.Now.Second.ToString()+".png";
 if(!System.IO.File.Exists(screenshotFilename)){
 Application.CaptureScreenshot(screenshotFilename,quality);
 AudioSource.PlayClipAtPoint(captureSound,transform.position);
 DrawWhiteItem();
 }
 }
}

function DrawWhiteItem(){
 yield new WaitForSeconds(0.5); //wait for a few frames so the application can capture before the white flash comes out.
 screenshotFader = DrawFader();
}

static function DrawFader() : GameObject{
 var fdt = new Texture2D(1,1);
 fdt.SetPixel(0,0,Color.white);
 fdt.Apply();
 
 var fadex = new GameObject("CSader");
 fadex.AddComponent(GUITexture);
 fadex.transform.position = Vector3(.5,.5,1000);
 fadex.guiTexture.texture = fdt;
 
 return fadex;
}

now it’ll save the screenshot on your game root folder / DCIM (you can change the folder name).


4 Comments

Joint-based Hair / Cloth Physics for Unity

I was doing the MMD4Unity research. I do this because, on Google, if you want a Hair Physics, you have to wrote a script, or key frame it naturally in your model. Ain’t nobody got time for that keyframing! So, this might be very useful for easy Joint-based hair / cloth physics, even wrote a script was useful too.

Okay, so it’ll be like this. It could be very awesomely epic if you are not lazy to set the character joint setting.

“It’s long and complicated, i better use keyframe method.” Yeah true, but what to do when the hair colliding object because of your keyframing method ?

Let’s get Neru Akita as example (Model from MMD, some motion from Unity-chan).

Unity 2014-07-27 14-07-06-60_2

1. Now Select cloth / hair bones and then add Capsule Collider like the picture below.
1(bones)

2. After that, adjust the size of the colliders and then add Character Joint.
2(bones)

3. If your character has a Character Controller on it / Playable, Open Tags & Layer, add 2 layers. Set ‘Player’ layer to object that has Character Controller on it. Else, set the object that you want to have a hair / cloth physics like Hair Bones1, Hair Bones2, and so on, or Hair/Cloth physics collider like MidSpine (That has Collider, so hair / cloth wont clip like hell). Basically, Just set Cloth Layer to Skinned Mesh Renderer, and set it to all children.
3b (Bones)

4. Go to your character controller script. Whatever script is OK as long as its located on Object that has Character Controller on it. Don’t make a new script. Just add this line to function Start() or void Start(). Works on both C# and JS. 8 is Cloth layer, 9 is Player layer. it’s all up to you on what layer you set the Cloth or Player layer. If you set cloth layer to 10, then write 10.

Physics.IgnoreLayerCollision(8,9);

3c (bones)
5. Alright now let’s add Rigidbody on cloth’s / hair’s root bone. For the root of the cloth (like this below), turn on isKinematic and turn off useGravity. Root doesn’t need a Character Joint, Collider is optional.

4 (bones)
6. Now set the Character Joint’s connected body. For instance, 1 (Cloth Root), 2 (1’s child), 3 (2’s child). 3’s connected body is 2, 2’s connected body is 1, and 1 doesn’t have a Character Joint. Like the picture below.
5 (bones)
7. Set bone’s swing limit, spring, high twist limit, low twist limit that suits to your model.
6 (bones)
8. Now add some collider to body that Hair or cloth will collide. Remember to set the body layer to CLOTH, so your character controller wont collide it. I add the colliders on Body, Hands, and Head.
7 (bones)

Because if you don’t add colliders, it’ll look like this:
Unity 2014-07-27 14-07-06-60

Now look! A cloths dynamic! It much better than the method I use on Wild West Showdown (Skinned Cloth). Look at her front hair and tie.
Unity 2014-07-27 14-07-06-60_1

 

As I said, I leave making games because I need to level up my CG level. I said I was give up right ? No, and never. I just need to learn to make a better CG Artwork. I’m currently making a mascot model for Imagination, named Imajine-chan. but, I don’t have an inspiration for her character design.

If you have something to ask, don’t hesitate to comment, I’ll reply it fast.

EDIT : “My Character raycast’s script is broken because of this.” Well, you could replace Cloth to IgnoreRaycast layer.


Leave a comment

Random Rant About Copyright

NOTE : I’m kinda off for a while. You maybe wont see any research for a while. I’ll be back on August or September, I’m kinda busy on upgrading my CG Level. Sorry about that.

I already had this problem since 2009, and real hate with all those copyrights. The creator of copyright is just like they want an infinite money. I seriously don’t care about copyright.

Remember that day, October 31 2013, my game Nitro Racer XD Full Version was shared freely in the universe by VACE ? Do I really care about it ? I don’t even got a penny from making this game, and my game was shared in the universe, but I ain’t even mad. If you were the creator of Nitro Racer XD, you would kill all of them. I just like “Meh, if they pirated my game, that means my game was nice.” Okay, let’s return to the topic.

So, how can I say that if Copyright is a Creativity Killer. Look, if you are a famous singer, you made a song, and then someone cover your song and said “I do not own this song, all copyright goes to <your name>”, but you still insist to kill / block them, then you’re a total a****le for blocking them.

I feel sad for my client that already made more than 10 fan videos for famous singer as tribute on YouTube. They made it really nice and good, they even always bought original CD and souvenirs. And you know what ? Sorry this video has been copyrighted by “Copyright-thirsty company”. That’s such a waste of time, energy, and internet (it’s a struggle to upload 300MB with slow internet).

Back then, when I was dumb, I made a remix of Canon song and it was blocked by SoundCloud or YouTube. Does that mean Johann Pachelbel going to sue me ? After that incident, I started to compose my own song, even it’s bad as hell.

Because of this, I’m concerned to make A Certain Musical Vocaloid 3D Animation Experiment. Will it be banned by YouTube because I make a crossover video of Vocaloid and To aru Universe ? It such a waste of time if it was banned.

I heard that if you craft a costume of your favorite character, you’ll be executed (copyright) so you have to buy official licensed costume. Licensed costume be like $30,000 and handmade costume only $10 comes with creativity.

If copyright gone crazy, this world’ll be like :

  • You are NOT allowed to craft an action figure from Pencil, Wood, or anything craftable.
  • You are NOT allowed to make a fan art, fan video, tributes to the artist, music cover, or something like that even you wrote their name as big as hell.
  • You are NOT allowed to share anything to your friend. ex: if you want your friend to listen to some music, they have to buy it first.
  • You are NOT allowed to print your favorite poster that you got from internet.
  • You are NOT allowed to tell a news that you read on the internet to your friend. Because your friend have to read it from original source.
  • You are NOT allowed to watch TV together. ONE TV FOR ONE PEOPLE!
  • You are NOT allowed to give a newspaper that you already read to other person. One newspaper only for one people (just like One Antivirus only for one PC).
  • You are NOT allowed to give a charity things, because Poor people have to buy Licensed one.
  • You are NOT allowed to copy someone’s quote / lyrics as your status or anything even you write their name.
  • All drawings be like, “ORIGINAL CHARACTER DO NOT COPY”. There’ll be no fan arts anymore, or “Character X in my style”
  • Every images on the internet will be blank because they afraid you’ll copy it and share it.
  • There’ll be no “Tweet” or “Share” button.
  • “1,000 years of dungeon!” Why ? “Because he shared a file!”
  • Every people in Earth will be dumb as hell because they are not allowed to use their creativity (I’ve seen so many fan crafts on 9GAG, such as Pencil Craft Adventure Time, or famous artist statue made from glass. That thing will probably blocked if Copyrights gone wild) , and they also depends on copyright makers.
  • If it become more crazier, One Software License only for ONE PERSON. That’s mean you are NOT allowed to let your friend use it.
  • Ah so many, it makes me puke copyrights.

 

Conclusion

Copyright can be accepted as long as it respects other’s creativity too. Fans just want to give you an appreciation, that’s why they made a Fan art, Fan video, or Fan music cover. Don’t be such a d***, Fan arts wont kill you. I’d be very thankful if only I have a fan art, remixed song, or even my works posted on other website.

Some people aren’t just rich as you, so don’t insist poor people to buy $10,000 item just because you don’t want they use a replicated one / handmade. I much like creative commons than all rights reserved s***.

Note : My game or artwork doesn’t have any copyright (I guess mine is Creative Commons), so you may spread it to the universe if you want. As long as people doesn’t misunderstood me (people wont believe if I’m the creator of that thing).

Follow

Get every new post delivered to your Inbox.

Join 717 other followers