Wednesday, December 31, 2014

Unity3D Kongregate API step by step javascript

Okay, I manage to get the highscore appear in kongregate , you can see it yourself at

http://www.kongregate.com/games/fundurian/idle-zombie-spitter


Okay, because the unity is very confusing with tons of object and tons of script, I put all the below code inside my main engine java script

lets start

Step1: Open your main engine java script (my case is shoot.js)

Step2: create 4 variable
var KONGREGATE_LOADEDboolean = false;
var USER_IDint =0;
var USER_NAMEString="Guest";
var GAME_AUTH_TOKENString = "";


Step3: under the function start(), call the kongregate webserver for the kongregate unity support

function Start()
{

Application.ExternalEval("if(typeof(kongregateUnitySupport) != 'undefined'){" +" kongregateUnitySupport.initAPI('" + gameObject.name + "','OnKongregateAPILoaded');" + "};");
    

}

Step4: create this 3 function


function OnKongregateAPILoadeduserInfo:String)
{

    KONGREGATE_LOADEDtrue;


    var userStats  = userInfo.Split("|"[0]);
    
    
    
    USER_ID = int.Parse(userStats[0]);
    USER_NAME = userStats[1];
    GAME_AUTH_TOKEN = userStats[2];

}


function APILoaded() : boolean
{

    if((USER_NAME != "Guest") && (KONGREGATE_LOADED==true))
    {
        return true;
    }
    else
    {
        return false;
    }

}

function SubmitData(datanameString , datavalueint)
{
    if(APILoaded()==true)
    {
        Application.ExternalCall("kongregate.stats.submit",dataname,datavalue);
        
        

    }
    

}


Step5: submit the score, you can put it anywhere, example when you win the game or lose the game,
do note konscore is a variable you can use anyname, when your user score 1000 example you just store it into konscore and call this function to submit to kongregate


SubmitData("HighScore",konscore);


Step6: Open kongregate, under my games -> edit games -> upload new version
- Under statistic API -> click add statistic
- statistic name : HighScore  (SUPER SUPER IMPORTANT, MUST MATCH the dataname on top)
- choose max type
- display on leaderboard (tick)

Step7: Now try to play your games, and submit score, wait maybe 5 or 10 minute for it to appear, please be patient


there you go, enjoy, any question feel free to ask

3 stuff I wanna put into my games "idle zombie spitter" but haven figured out how

1. first is the kongregate API where you can submit highscore and stuff, it look really difficult to understand, I need to go through it, then I will write the step by step guide here

2. second is the iphone in app purchase, I haven figured out this one also, will have to go through it slowly

3. third is the chartboost i heard that you can put into your game, I will have to try that


also I cannot spend too much time on this because I need to start working on my 4th game as soon as possible

Happy new year 2015

may your wish come true, happy new year

Tuesday, December 30, 2014

I finished my third game "idle zombie spitter", launch it on kongregate and newgrounds

Okay, so i finish my third game "idle zombie splitter"

Description: Spit zombie virus to infect the target and the world, buy business and upgrade to make more money, reset game to gain soul for extra bonus, game will auto generate money base on the cash per second(CPS) generated from the business even if offline


you can play it free under kongregate
http://www.kongregate.com/games/fundurian/idle-zombie-spitter

or newgrounds
http://www.newgrounds.com/portal/view/651104

Monday, December 29, 2014

7 days no update

this is because i went to visit some relative and got trapped by a sudden flood, so i stay there for a whole week before going home

will rush the zombie game and publish within a few days, stay tuned

Sunday, December 21, 2014

Trying to submit my games to the window phone store

Ok, so today I will try to submit my 2 games to the window phone store

1. first step is to login to the microsoft app developer center
https://appdev.microsoft.com

2. then pay the money $19 to enroll as the app developer

3. then I have to submit my bank account and tax information
- tax information need approval

4. then you can write description for your games

5. Need to upload game rating certificate?????
- this is the first time i encounter this because in apple appstore dont have this kind of stuff
- okay, let see
http://msdn.microsoft.com/en-us/library/windows/apps/jj206734(v=vs.105).aspx

i will need to fill in 11 type of certificate file , wow, I wonder why

a) PEGI - no account creation needed, easy and fast
b) ESRB - need to open account by writing email to them and wait 5 days for approval

Okay I guess I have to skip this part at the moment and see what happen

6. wait, now it say you need window version 8.1 but I only have window version 7.0 meaning I have to pay another $111 to purchase the software before I can publish my game

sigh, Ok, I give up, I am not going to pay another hundred dollar to buy window version 8.1 because my hardware is very old and it is already very lag running version 7.0, i read from the review 8.1 is running even slower

Maybe one day I might change my mind, just not today

day 82 testing the game

Okay, so i am now doing some testing for my 3rd game

and also will try to publish my first and second game on window phone store see how it goes

Friday, December 19, 2014

day 80 , creating level

Okay, for my third game, the game engine is done(just not tested yet)

now I am creating level

so far already created 17 level

might need another 13 or 23 level make it to 30 level or 40 level

then after finish the level, will test the game to fix all the bug then release and see the respond, if the respond is bad, i will not update it, if the respond is good, i will put more level into it


monster leveling: 17    (need 30 or 40)
power upgrading: 3  
business upgrading: 5 (maybe need 50 or 60)
achivement: 72


Tuesday, December 16, 2014

Unity3D manually code the color

So you can set the Color as below

newanimal.renderer.material.color = Color.white;

but if you want more accurate color you can go to below website to get the red, green, blue 

http://www.rapidtables.com/web/color/RGB_Color.htm

let say you want the chocolate, you get (184,134,11)
but in unity the color is between 0 and 1, so you need to divide the color you found by 256.0, as below


newanimal.renderer.material.color = Color(184/256.0134/256.011/256.0);

Unity3D how to instantiate an object position, rotation, scale and color

Okay, so below is how i instantiate a prefab transform position, rotation, scale and color


//so the position x,y,z we set at (6,0.3,-1.5)
//the rotation x,y,z we set at (0,-90,0)

newanimal=Instantiate(cat,Vector3(6,0.3,-1.5),Quaternion.Euler(0, -900));   
        
     
        
        //we scale the cat manually 
        newanimal.transform.localScale = Vector3(2,2,2);



//we set the colour of the cat manually 
        newanimal.renderer.material.color = Color(0.777080.604);

Sunday, December 14, 2014

Programmer vs Inventor vs Trader

I like this 3 stuff, i like to code games, invent stuff and trade forex

but, in order to succeed in any of this 3 you can only choose 1, as they need 100% focus and concentration

of coz in the perfect world, if you can succeed in any of this 3 you will be billionaire

but in reality that is not the case

let start with inventor

Inventor
=======
Cons: -need high capital cost(unless you invent crap you need at least hundred thousand)
          -need a lot of time (take years and years)
         -very hard to create something out of this world (without budget you can only invent crap)
          -once product is out very hard to find investor or buyer
         -expensive intellectual property license fee or patent fee

Pro: billionaire

traders
========
Cons: -hardest skill to acquire (you might spend 30 years and cannot find a way to profit)
          -you might only end up with a bunch of trading log or trading history

Pro: billionaire

programmer
==========
Cons: have the most competitor (as everyone and their dog know how to code)

Pro: -with your skill you can apply for jobs
        -and even the worst games can make some money ( a few buck from here and there)
        -if you failed after 30 years, at least you got tons and tons of product on the shelf, i guess you can still make a few buck from here and there
- and of coz, if you can create something like minecraft you are billionaire

guess i have to choose programmer


Unity3D Create Transform and Destroy Transform using script

Okay, let say you have a button to switch from level 1 to level 2 to level 3

each time you press the button, different enemy appear,

below is how i do it

var newenemyTransform;

var enemy_level1Transform;
var enemy_level2Transform;
var enemy_level3Transform;

//HERE YOU DRAG YOUR LEVEL 1 ENEMY PREFAB INTO enemy_level1
//DO THE SAME FOR LEVEL 2 AND LEVEL 3 ON THE OUTSIDE

IF(PRESS BUTTON)

if(mylevel==1)
{

    //IF NEW ENEMY ALREAY EXIST, YOU DESTROY IT FIRST    
if(newenemy)
    {
           Destroy(newenemy.gameObject);
    }
        

//THEN YOU CREATE ENEMY LEVEL 1 ON THE FLY
newenemy=Instantiate(enemy_level1,target.transform.position,Quaternion.identity);
}
     

else if(mylevel==2)
{
    if(newanimal)
    {
        Destroy(newenemy.gameObject);
    }
newenemy=Instantiate(enemy_level2,target.transform.position,Quaternion.identity);
     
}

Saturday, December 13, 2014

75 days - huge procrastination

Its coming, huge procrastination incoming

I just dont know why it just coming, holy shit, I need to focus

the gameplay is 50% done (just tested some part not full part)
graphics is 0%

so i need to start doing the graphics, need at least 10 monster and 1 main character

74 days

My planning as below


it is all about the gameplay and graphics

1. focus on gameplay
2. once gameplay is done, do the graphics
3. once graphics is done, do the sound and music
4. once that is done, add in chartboost, in app purchase, port into android and iTunes

man, times really fly, i slack a bit but i am controlling hard


Thursday, December 11, 2014

72 days

nothing special, i am rushing my zombie game, i am doing the mechanic at the moment so there are no screenshot to be shown

it is a hell lots of work to do and I am trying my best to finish it


Microsoft is buying minecraft for 2.5 billion dollar?

So i read the news about microsoft buying minecraft for 2.5 billion dollar? wow, that is just so amazing, the first indie developer who make a billion dollar out of 1 game, and what is the odd of that happening?

yup, 1 in 7 billion chance


Tuesday, December 9, 2014

Unity3D access other object script variable and function

Okay, let say you have 2 object, cube1 and plane1

then let say cube1 have cube1script.js and plane 1 have plane1script.js

let say plane1script.js have variable lala:int and function lolo()

let say your cube1 script want to access plane1 script variable or function

below is how you do it

inside your cube1script.js
==================
var haha : Transform; (you drag your plane1 object into here on outside)

haha.GetComponent(plane1script).lala =1;      //here you can modify the variable in plane1

haha.GetComponent(plane1script).lolo();   //here you can call the function of plane1








Monday, December 8, 2014

day 70, thinking of new zombie game

Ok, so it is now day 70, the first two games is a flop, the second game is worst than the first game, so for the third game will try to think of better game,

So now thinking how to build a zombie game

target to finish before december

Sunday, December 7, 2014

My second Paid iphone games "billionaire curse" is live on appstore

Billionaire Curse:
Gameplay: You are a billionaire curse by a witch, you must spend all your 1 billion dollar in 10 days or you will die
there are 10 place for you to spend money






Saturday, December 6, 2014

Unity3D particle emitter "one shot" tick but still not working?

Okay, So I am playing with the unity particle emitter, and some of the emitter even if you tick "one shot" it still boom over and over again

below is how i fix this

in your shooting script, by default is as below
================================

Instantiate(explosionPrefabposrot);


Change it to as below
=================

var haha : Transform;
hahaInstantiate(explosionPrefabposrot);
haha.particleEmitter.Emit();


 Now it should only emit once

67 days what should i build?

Okay, so I was trying to study how to build a FPS games, but i discover it is a bit way too hard, so I am thinking to build some simpler games, such as zombie games, maybe

still not decided yet, i am still researching

Thursday, December 4, 2014

65 days - learning how to do FPS games using unity

Okay, so today I will learn how to make a FPS(first person shooting) games using unity

So the first thing is to find tutorial, I searched youtube but figure out the video is too long, 25 minute one episode and up to 10 episode, so it is around 250 minute or 5 hours of content

So I search for the shorter version of the tutorial and I found a tutorial on below link

http://noobtuts.com/unity/first-person-shooter-game

the tutorial gave the C# code, but I only want javascript, so i modify the code in javascript as below

rocket.js
var explosionPrefab : Transform;

function OnCollisionEnter(collision : Collision
{
    // Rotate the object so that the y-axis faces along the normal of the surface
    var contact : ContactPoint = collision.contacts[0];
    var rot : Quaternion = Quaternion.FromToRotation(Vector3.upcontact.normal);
    var pos : Vector3 = contact.point;
    
    Instantiate(explosionPrefabposrot);
    // Destroy the projectile
    Destroy (gameObject);
}



shoot.js
var Bullet : Transform;
 
 function Update ()
 {
     if(Input.GetButtonDown("Fire1"))
     {
         var newBullet=Instantiate(Bullet,transform.position,Quaternion.identity);
 
         newBullet.rigidbody.AddForce(transform.forward * 1000); 
     } 


}

List of youtuber that do game review

it can be found on the below link

http://gameyoutubers.com/

Wednesday, December 3, 2014

Why 2D games beat the hell out of 3D games

Well, I do not make conclusion on my self, I am based on the conclusion make by kongregate

see the link below

http://www.slideshare.net/DavidPChiu/kongregate-maximizing-player-retention-and-monetization-in-freetoplay-games-comparative-stats-for-2d-3d-games-and-asian-western-games-migs-2013-presentation

according to them , this is because


Developers of 3D games tend to:
- Be console developers with limited Free 2 play experience
- Focus on graphics, instead of improving retention and monetisation funnels
- not accept pay for convenience and pay to win
- make games in low monetisation genre (FPS, MOBA)
- make shippable product instead of long term retention, games as a service


Well, I can only make 3D games for now, because I do not have a 2D artist, I dont have a drawpad to draw 2D art and if i try to draw using GIMP, it will look extremely awful, so the focus here is to design some long term retention, games as a service

among the idea is
1. Give daily bonus
2. Add element of chance
3. keep them busy
4. must have progress, leveling up and upgrade

Formula of successful games?

Everyone want the formula of a successful games, but how do we get the formula?

after googling a while i found the below link

http://gamerefinery.com/

base on the various kind of variable, they seem to work out a game power score to predict the outcome of your game

as you all know, my first 2 game is not doing very well, most people play it only been entertained like 5 minutes before they get bored, so I have to find a formula for a games that people like and have a lot of replay value and they keep coming back

Most Search Keyword in the appstore

Below is the link I found showing the top 100 keyword searched in the appstore, so my new games will definitely take one of these on the list

http://searchengineland.com/the-most-popular-app-store-keywords-from-chomp-google-play-135744

Wantrepreneur Comic

So I come across this comic in reddit, just wanna share it on my blog

http://i.imgur.com/xWzjHUQ.jpg


xcode 6.1 validation error: 64-bit and iOS 8 Requirements for New Apps

So I want to validate my game via Xcode 6.1 and i got the following error

64-bit and iOS 8 Requirements for New Apps October 20, 2014
Starting February 1, 2015, new iOS apps uploaded to the App Store must include 64-bit support and be built with the iOS 8 SDK, included in Xcode 6 or later. To enable 64-bit in your project, we recommend using the default Xcode build setting of “Standard architectures” to build a single binary with both 32-bit and 64-bit code.

Now I am stuck, I dont know what to do, just googling around

Ok, later I found that it is just a warning, so you can still submit your app to the appstore like normal, so cheers

Tuesday, December 2, 2014

Launch my second game Billionaire Curse

Okay, so i change the name of my game from "life of billionaire" to "billionaire curse" because i need a good storyline

you can play it at kongregate for free


http://www.kongregate.com/games/fundurian/billionaire-curse

Unity how to bring music to another scene

Here is how i do it

1. Let say you start at Scene1,  Create an empty object, name it "empty"
2. attach a new component "audio source" to your empty object, drag a music into your "audio source", tick the "play at awake"
2. attach a script to your empty object, name it "music.js"
3. open your music.js and put in below code

 function Awake()
 {
   
    DontDestroyOnLoad(gameObject);
    
 }


Now when you start your game at scene1, your music is playing, go to the next scene, your music is still playing

how to mute the song
==============
1. let say you now in scene 3, you wanna mute the song
2. so you do it in the scene 3 script as below

var gameMusicGameObject;
var hahaaudioAudioSource;


function Start () 
{

    gameMusic = GameObject.Find("empty");
    hahaaudio = gameMusic.GetComponent(AudioSource);


}

//THE PLACE WHEN YOU CLICK BUTTON, MUTE IT


    hahaaudio.mute=true;
          


Monday, December 1, 2014

63 days

Okay I am on my final rush for my second game

now need to test play 10 times

then need to add some sound and music