Archive

Archive for the ‘Game and CG’ Category

インドネシアにあるオンラインゲーム出版社

March 31, 2012 Leave a comment

メモしておこう。

  1. LYTO
    • URL:http://www.lyto.net/about/
    • ゲーム:Soul of Heroes, Ragnarok Online, RF Online, Luna Online, Rohan Online, Cross Fire etc.
  2. Megaxus
    • URL:http://int.megaxus.com/
    • ゲーム:Audition AyoDance, Lineage II, War Rock, Grand Chase, Counter-Strike Online, etc.
  3. IAHgames Indonesia
    • URL:http://www.iahgames.com/#onlinegame
    • ゲーム:EA Sport FIFA Online 2, Dragonica, Granado Espada, Emil Chronicle Online, etc.
  4. Wavegame (PT. Wave Wahana Wisesa)
    • URL:http://www.wavegame.net/
    • ゲーム:Angle Love Online, 3 Kingdoms, Heroes Kingdoms online, Gods War Online, Red Cliff Online, etc.
Categories: Game and CG

A Simple script to show or hide children object in Unity 3D

July 1, 2011 Leave a comment

This is a simple script to show or hide children object in Unity 3D.
For example, you can create empty Object, then add Sphere and Box as the children of it.
Just attach this script to that empty object, then you can show or hide the sphere and the box.

using UnityEngine;
using System.Collections;

public class UnrenderObjScript : MonoBehaviour
{

Renderer[] listOfChildren;

void OnGUI()
{

if(GUILayout.Button(“Hide”))
{
listOfChildren = GetComponentsInChildren<Renderer>();
foreach(Renderer child in listOfChildren)
{
child.enabled = false;

}

}

if(GUILayout.Button(“Show”))
{

listOfChildren = GetComponentsInChildren<Renderer>();
foreach(Renderer child in listOfChildren)
{
child.enabled = true;

}

}

}

}

Categories: Game and CG

Unity 3D and RakNet 4

May 29, 2011 7 comments

Several days ago I tried to Connect Unity 3 (Client)  and RakNet 3.731  (Server) for my research project. When I read the server log, there is some message ID that was send by Client,  that was not recognized by Server.  ID “131″, I couldn’t find it in the RakNet Library Code. Maybe something has change in the Unity’s RakNet (that’s what I thought). then I tried to find a way how to make the server and the client can use the same RakNet Library. There is away to do that, but I need Unity Pro in order to load RakNet Library that is coded in C++.

I didn’t satisfy with that way, so i tried to find other solution. yeah with unity regular I still can load C# dll. With “Swig”, I can generate C# dll from c++ project. that’s amazing ^^. So this is the way :

For Client Side (Windows):

  1. Download Unity 3, RakNet 4, Swig
  2. Generate the Swig files
    1. Open the windows terminal
    2. Go to RakNet Swig directory
      cd C:\RakNetDirectory\DependentExtensions\Swig
    3. execute swig command (I followed this turorial)
      C:\Swig\swig.exe -c++ -csharp -namespace RakNet -I”PATH_TO_RAKNETSOURCE” -I”SwigInterfaceFiles” -outdir SwigOutput\SwigCSharpOutput -o SwigOutput\CplusDLLIncludes\RakNet_wrap.cxx SwigInterfaceFiles\RakNet.i

      • “PATH_TO_RAKNETSOURCE” is the source code directory of raknet (c++ code)
      • That command will generate c# code and RakNet_wrap.cxx that will be needed in the next step
  3. Create the C# DLL. I used Microsoft Visual Studio 2008 Express Edition with Service Pack 1, CodeBlock user maybe will have little problem with “integer data type”.
    1. Create CLR empty project
    2. Import RakNet source files with “Add Existing Items”
    3. Import RakNet_wrap.cxx with “Add Existing Items”
    4. Setting the Project Properties
      • Common Properties
        Target Framework : .NET Framework 2.0
      • Configuration Properties
        • General
          Configuration Type : Dynamic Library (.dll)
          Character Set : Not Set
        • C/C++
          • General
            Additional Directory : C:\PathToRakNetSource
          • Preprocessor
            Preprocessor Definitions : WIN32;_DEBUG;_RAKNET_DLL
          • Code Generation : Multi-threaded Debug DLL (/MDd)
        • Linker
          • ws2_32.lib $(NOINHERIT)
    5. Build C# DLL
  4. Create Unity Project
  5. Copy DLL and C# files to Unity Project directory
  6. Maybe RakNetListRakNetSmartPtrRakNetSocket.cs need to be remove from project
  7. Load DLL with Unity C# Script
    This is Example how to perform connection :
    using UnityEngine;
    using System;
    using System.Collections;
    using RakNet;
    public class ConnectGUI : MonoBehaviour {
    public static string remoteIP = “127.0.0.1″;
    RakPeerInterface myClient;
    SocketDescriptor scktDist;

    void Awake() {
    myClient = RakPeerInterface.GetInstance();
    scktDist = new SocketDescriptor();
    myClient.Startup(1,scktDist,1);
    }
    void OnGUI(){

    // if not yet connected
    myClient.Connect(remoteIP, 25000, “”,0);

    }
    }
Categories: Game and CG, Research

Multiplayer/Online Game (1)

December 19, 2010 Leave a comment

Berikut ini beberapa hal yang saya rangkum dari beberapa sumber terkait dengan Multiplayer/Online Game, mudah-mudahan bermanfaat.

Multiplayer game telah berkembang dari game yang dimainkan hanya oleh dua pemain seperti Doom hingga ke banyak pemain seperti Quake 2, Unreal, dan Ultima Online.

Pada awalnya terdapat game peer-to-peer seperti Doom. Pada game ini setiap mesin mensinkronkran input dan waktu dengan mesin yang lainnya. Setiap mesin juga mempunyai game logic yang sama. Dengan demikian semua pemain mempunyai gambaran yang sama tentang kejadian yang ada dalam game. Pendekatan peer-to-peer ini cukup sederhana namun ada beberapa kelemahan, antara lain: game harus dimulai bersamaan, dan pemain  baru tidak bisa masuk dan keluar game semaunya. Selain itu  karena pada pendekatan ini setiap mesin harus menjalankan game dengan frame rate yang sama sedangkan kecepatan tiap-tiap mesin berbeda, cukup sulit untuk mensupport berbagai macam mesin yang mempunyai kecepatan yang berbeda-beda.

Kemudian muncullah arsitektur client-server yang pada awalnya diimplementasikan pada Quake. Pada pendekatan ini terdapat dua jenis mesin yang mempunyai fungsi yang berbeda. Pertama, Server yang mempunyai tugas untuk memberi keputusan terkait dengan event-event yang terjadi dalam game. Kedua, Client yang pada awalnya hanya bertugas sebagai dumb terminal yang mengirim input dari pemain ke server serta  menerima daftar objek dari server dan kemudian merendernya. Pada era selanjutnya client juga melakukan beberapa logika simulasi dan prediksi. Di sini client tidak hanya menerima daftar objek-objek yang akan dirender, namun juga trajectory dari objek-objek tersebut.

Terdapat juga arsitektur Hybrid yang diusulkan dalam sebuah paper. Arsitektur ini mengkombinasikan  sisi positif peer-to-peer dan client-server. Kebaikan dari sisi server, pemain tidak begitu mudah untuk melakukan cheating (bukan berarti tidak bisa) seperti halnya pada peer-to-peer karena serverlah yang memberi keputusan terhadap perubahan state dalam game. Sedangkan dalam peer-to-peer tidak terjadi bottleneck seperti pada client-server. Selain client, dalam arsitektur ini terdapat regional server dan sentral server. Regional server sebenarnya adalah beberapa client yang ditunjuk oleh sentral server untuk menghandle pergerakan posisi pemain, sedangkan sentral server sendiri hanya bertugas untuk menghandle perubahan state seperti: penyerangan terhadap lawan dan pengambilan item. Dengan arsitektur hybrid ini cheating pada peer-to-peer dan bottleneck pada client-server dapat dikurangi.

Untuk mengatasi masalah bottleneck pada server selain menggunakan arsitektur hybrid, juga dapat menggunakan arsitektur multi-server. Pada arsitektur ini load didistribusikan pada beberapa server.   Teknik pendistribusian loadnya ada beberapa macam, antara lain : zoning, replication dan instancing. Teknik zoning banyak diterapkan pada MMORPG. Pada metode ini, area dalam game dibagi kedalam beberapa zona dimana tiap zona dihandle oleh sebuah server. Di dalam sebuah paper luas zona ini dapat dibuat dinamis untuk mendapatkan load balance yang baik antar server. Pada teknik replication setiap server memiliki semua entitas (avatar,item,dsb) yang ada dalam game, tidak seperti teknik zoning dimana sebuah server hanya mempunyai entitas yang terbatas dalam wilayah otoritasnya. Pada teknik replication, Entitas terdiri atas entitas aktif dan entitas bayangan. Entitas aktif adalah entitas yang diciptakan oleh sebuah server, dan hanya server yang menciptakannyalah yang mempunyai otoritas terhadap entitas tersebut. Entitas bayangan merupakan salinan (copy) dari entitas aktif. Teknik ketiga adalah instancing, dimana pada teknik ini suatu area yang mempunyai densitas tinggi (padat penduduk) dapat dihandle oleh beberapa server. Dalam penerapannya ketiga teknik tersebut dapat saling dikombinasikan.

Referensi:

  1. http://unreal.epicgames.com
  2. Ng, B. and Lau, R. W. H. and Si, A. and Li, F, “Multi-server support for large scale distributed virtual environments”, IEEE transactions on multimedia., 7 (6). pp. 1054-1065, 2005.
  3. Roman Chertov , Sonia Fahmy, “Optimistic load balancing in a distributed virtual environment”, Proceedings of the 2006 international workshop on Network and operating systems support for digital audio and video, November 22-23, 2006, Newport, Rhode Island  [doi>10.1145/1378191.1378208]
  4. Jared Jardine , Daniel Zappala, “A hybrid architecture for massively multiplayer online games”, Proceedings of the 7th ACM SIGCOMM Workshop on Network and System Support for Games, October 21-22, 2008, Worcester, Massachusetts. doi>10.1145/1517494.1517507].
  5. Frank Glinka, Alexander Ploss, Sergei Gorlatch, and Jens Müller-Iden, “High-Level Development of Multiserver Online Games,” International Journal of Computer Games Technology, vol. 2008, Article ID 327387, 16 pages, 2008. doi:10.1155/2008/327387
Categories: Game and CG

Setting Environment JME2 in Netbeans 6.7.1

January 28, 2010 Leave a comment

This tutorial will try to guide in setting Netbeans Project to develop Java game using JMonkey Engine.  Follow the step bellow :

  1. Create Netbeans Project
  2. Add JME library with Library Manager
    1. From menu Tools, select Libraries
    2. Click “New Library” button
    3. Click “Add JAR/Folder” button and select folder where you put your JME2 libraries
  3. Add Library to Project
    1. From the project tree, Right click  on the folder “Libraries”.
    2. Select “Property”
    3. Click “Add Library” button
    4. Select JME Library
  4. Setting VM
    1. Right Click on Project name, then select Properties.
    2. Select Run Categories.
    3. In VM Options insert path of lwjgl folder.
      For example -Djava.library.path=”../JME_201/lib/lib/lwjgl/native/win-linux/”
  5. After that you can begin in writing code.
Categories: Game and CG