Showing posts with label Project Iris. Show all posts
Showing posts with label Project Iris. Show all posts

Saturday, July 24, 2010

Ogre SDK on Mac

Ogre SDK在Mac XCode下的安裝



首先,我們當然要有SDK

Download

選擇Mac OS X, 這個版本應該就可以了 (iPhone又是另外一個故事,下一篇再介紹)



接下來把他解壓縮到本機,我個人是直接丟到Documents



然後各位應該就會碰到第一個障礙:XCode Project打開後build出一堆錯(多半是CMake找不到甚麼檔案有的沒有的)這是一個已知bug,請升級CMake到2.8.2以上

Download



再度執行看看,如果再不行的話就需要重建.xcodeproj

Screen shot 2010-07-24 at 4.00.47 AM.png

重建也沒那麼恐怖,按照下面一步一步來

首先先在Application裡面找出CMake按下去

將Source指到你的sdk跟目錄,build binaries也指到同樣的地方

按下Configure會出現選擇編譯器跟目的檔的畫面

Screen shot 2010-07-24 at 4.05.36 AM.png

選好後再按Configure一次,Generate就亮了,按下Generate,收工。夠簡單了吧



接下來.xcodeproj似乎就可以正常運作了,記得把左上角調整成Release或者RelWithDebInfo

Screen shot 2010-07-24 at 4.08.23 AM.png



ok 接下來就是build and run! 大多數的人會在這裡碰到第二道難題:奇怪,為什麼build and run跑不出執行檔?這時候應該要打開console看一下了!

Screen shot 2010-07-24 at 3.56.33 AM.png



歐賣尬,要是一輩子沒想到開console不就被它栽到了。這個問題的成因是,nVidia顯卡下它需要CG Toolkit來執行demo(ATi要不要我不知道,有人能給個答案嗎 =P) 來吧,我們拿個最新版本來玩玩

Download



安裝好以後,再度執行他的執行檔,成功!

Screen shot 2010-07-24 at 4.13.48 AM.png





希望這對用Mac OSX開發Ogre3D遊戲的人有點幫助 :3



Tuesday, February 02, 2010

Game loop in C#

Game update loop is a problem in C#. Of course, first thought of us must be attach the Idle event of Application, like this.


Application.Idle += new EventHandler(OnAppIdle);
Application.Run(mMainFrame);

........
........

static void OnAppIdle(object sender, EventArgs e)
{
//Do some game loop update here
mMainFrame.DoUpdate();

}



It seems reasonable, we register a listener to Idle event, so it must be run OnAppIdle while application idle, right?

Partially right.

When the application keep going, it will only get message while "When application need to be updated". It means, therefore, if you leave mouse out of this application form(so no MouseMove event sent), it will totally stop, so it will be updated only when getting some message : such like OnMouseMove....etc.

Solution is from Rich, and he found it in sample of MDX applications. Don't ask me how to do it, just need to know use this way to keep the game loop.

We might discuss this in later post =3


static class Program
{
///
/// The main entry point for the application.
///

///
static SceneEditorMain mMainFrame;
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

mMainFrame = new SceneEditorMain();
Application.Idle += new EventHandler(OnAppIdle);
Application.Run(mMainFrame);
}

static void OnAppIdle(object sender, EventArgs e)
{
while (AppStillIdle)
{
mMainFrame.DoUpdate();
}
}


private static bool AppStillIdle
{
get
{
NativeMethods.Message msg;
return !NativeMethods.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
}
}


}

public class NativeMethods
{
/**/
/// Windows Message
[StructLayout(LayoutKind.Sequential)]
public struct Message
{
public IntPtr hWnd;
public uint msg;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public System.Drawing.Point p;
}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool PeekMessage(out Message msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
}

Monday, November 23, 2009

最近在忙的另外一個Project

另外一個在忙的是比較偏企劃面的Project Infinity,與Iris不同,這個完全是以企劃導向的一個方案。Iris設定上是一個Ogre Wrapper,基本功能已經完備,但是沒有東西給她玩(疑)的情況下,目前沒有需求就沒有任何動作跟推力。

Infinity則是相反面的東西,她主要提供的是一組世界跟一組接口,負責產生以及運算整個世界,然後告訴Iris怎麼把它畫出來以及怎麼控制。這基本上還只是一個概念的產物(以及一堆UML Code),慢慢的會把這東西完備起來。

不過同樣的問題依然存在,恩,美術面... Iris仍然缺乏一組工具來做美術方面的東西,不過由於沒有美術人員,我想應該暫時一樣是陷入需求跟推力的迴圈。不管怎麼樣,先把相對技術門檻比較低的Project Infinity開始動工會好一點(望著一堆UML文件...)

另外,這個可能會當作自己對於Design Pattern的期中考,看看自己到底對Design Pattern了解多少的一種測試。Project Infinity暫時還不會開放給小組人員下載,等把雛形弄出來再說。

Sunday, April 05, 2009

LibIris

剛剛看一下上個更新, 03:41....
在LibIris終於有雛形了,具有基本的輸入功能,以及基本的場景匯入,貼地功能...


好累阿.... -o-||(看看時間)

Iris目前工作進度

其實進度比想像快很多,現在只差resource management的問題要解決,就可以著手開始撰寫LibIris了。

感謝某兩個一天到晚跟我拌嘴的傢伙 - -+ 辛苦你們了

目前來講碰到的問題有幾個 :

  1. OIS輸出入系統非常方便,不過loading實在有點慢,要不要考慮直接自己寫呢?可是OIS又很簡單易用(參照ExampleFrameListener.h)
  2. Resource managing事實上並不是只有parse resources.cfg那麼簡單,尤其是他很多rendering相關的東西全部會塞在script裡面用resource parse,這個要搞懂似乎要花很久。Ogre的material等等資料都是寫成script去parse,這點跟D3D比是方便,可是也令人頭大,因為等於要多學一個語言...我不覺得以後script全部都是由我來寫...
  3. 目前來講如果要把整個example的resource.cfg搬過去用的話(當然,裡面我偷偷做了很多修改),他會parse太多用不到的東西。parse用不到的東西其實問題不大,問題是他parse會去試圖load裡面指向的檔案(比方說.jpg..),一個個砍好像有點累...不過這也提供了不少能用的素材就是...那台機器人不錯 XD

Thursday, April 02, 2009

Ogre又卡關了…

這次卡在load資源的地方,居然跟我找不到目錄,不管是相對路徑還是絕對路徑,全部跟我說找 不 到 =口= 明明我工作目錄也設定確定正確了(不然會有一堆.dll找不到,所以這個不可能設錯")。

smgr->setAmbientLight(ColourValue(0.2f, 0.2f, 0.2f, 1.0f));
Light* pPointLight = smgr->createLight("TestPointLight");
pPointLight->setPosition(0, 0, 0);
pPointLight->setDiffuseColour(ColourValue(0.0f, 1.0f, 0.0f, 1.0f));
Entity* pEntity = smgr->createEntity("TestEntity", "./media/meshes/prototype.mesh");


你馬幫幫忙,昨天還好好的,怎麼一過了愚人節馬上開始愚起我來啦 囧

[Edit]找到該死的方法了...

// Load resource paths from config file
ConfigFile cf;
cf.load("resources.cfg");

// Go through all sections & settings in the file
ConfigFile::SectionIterator seci = cf.getSectionIterator();

String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
ConfigFile::SettingsMultiMap *settings = seci.getNext();
ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}

真是有夠....冏...之前之所以沒事情,完全是因為之前是使用它的ExampleApplication介面,介面裡面會自動偷偷的幫你讀取resources.cfg並且把它設定好,可是我們自己做的話並沒有小精靈會偷偷在晚上幫你把這堆code加上去,於是就....

Monday, March 30, 2009

Flexible script based module : Mimic

Yes, Mimic, I named it (:

This flexible script runner & modifier is for character design used in Project Iris. The main object of this module is to create a generic, flexible and easy use AI modifier, and even Behavior can be did so.

This module is separated into 4 parts :

1. Mimic Basic Behavior Define :
This part includes "element" of each action or behavior. For example, we can discompose WALKING into "Move" and "Change animation from standing still to walking", and "Slap" can be discomposed into "Walk to someone" "play slap animation" "Do damage to someone" and "Deliver expression to someone". Of course, "Walk to someone" can again dissolve into "Track for someone and get position" "play walking animation" and "Move to position".

For more advanced, any NPC will have to against gravity in every frame, so every NPC will have "Gravity Effect Recalculate" element and will be run every frame.

2. Mimic Basic Object Define :
This part offers basic framework of every object. For example, NPC object will always have such ability : walking, running, talking and basic attack. This part is still in development.

3. Mimic Script Translator :
This part translate script into .chr file. Literally, .chr indeed is .dll structure with numerous symbol callback.

4. Mimic Behavior Manager
This part is literally a wrapper of DllLoader, and do some resource handle for main frame.

Of course everyone can see, the main and the most is MBBD. The most challenging is splitting every action into element. In limited count of element we can compose a large number of actions, and can be managed in run-time. This is Mimic's main propose.

Sunday, March 29, 2009

Iris底層引擎變更 / 開發延期計畫

Iris改用Ogre來開發。

促成這項改變的主要原因是,我跟Dolice討論評估了一下,我們似乎沒辦法負擔由我一個人負責Irrlicht<==>Ogre Fx的開發成本,這個成本太大。況且最重要的是,我個人實在沒辦法負擔在沒支援的情況下一個人負責維護Irrlicht的底層。

One man is all(囧) 當初評估用Irrlicht而不是Ogre的主要原因是,Irrlicht使用上感覺比較方便,而且有很多現成的素材可以使用。不過做到現在才慢慢發現,一個人維護Irrlicht底層是沒辦法很有效率的把我手上現有的東西無痛轉換成Irr要用的格式跟方法。

雖然很想說"當初講好的支援呢",不過現在講這八個字好像沒啥意義 :/ 不過也不是所有都失去了,至少認清了一些開發上會碰到的困難跟現實,對我來講也算是頗有收穫啦。平台切換到Ogre以後,至少可以多一個人協助維護。

Ogre的話需要開發的時間就長很多了,不過至少時程安排可以掌握在我自己手裡的。至少我不用再相信什麼"等你等級練起來再一起KO這個大魔王"這種鬼話,已經有一個現成的勇者可以利用了(奸笑)。

而且,目前能用的工具突然變很多了,連地形產生器都弄好了XD

其實反而有種海闊天空的感覺呢,放手去做吧。其他組員的話那真是抱歉了,main frame要延後了 :~ 我也要再加點油,這次真的是no execuse了 :/

Friday, March 27, 2009

Iris目前工作進度

Dolice最近正在忙Ogre的Partical部分,不過我還滿懷疑能做到什麼地步 :3

我自己則是把Irrlicht慢慢的包成一個能用的東西,包含了自己定義的event跟wrapper。我最近在看code的時候很驚訝的發現,有很多non-SVN的部份我居然不知道要怎麼把它implement進SVN版本,該說Irrlicht在這方面本來就不適合re-boxing嗎...

Iris應該沒辦法趕在愚人節前把in-wrap prototype搞定了,最近事情比想像中的多很多。很多事情不是單靠我跟Dolice就能搞定的阿 :/ 況且這傢伙在美國好像最近也很忙 XD

原來今年日光節約時間提早了,難怪我丟Dolice MSN水球都在睡覺 -_-

目前預定進度應該暫時還是以Trac Ticket為準,反正很多東西還要在思考一下怎麼處理。最近似乎我自己心情也比較亂一點,在公車上也沒心情去看技術文件了,這幾天我發現我在公車上幾乎都在看小說The Devil wears Prada XD.

--

1. Event部分暫時用C#的標準EventArgs做法,不過這個沒有編譯器支援一些原生功能的話還滿...難寫的.

2. Irr用的Event重新Review了一下,似乎可以直接跟EventArgs做interchange.

3. Sound部分的FreeSL最近就會把wrap好的版本加入SVN Iris. 不過要先解決幾個...莫名其妙的Resource ID leak問題,這到底是OpenAL的問題還是FreeSL的問題?

4. 有一個很致命的問題還沒上ticket,就是Irrlicht拿出來的底層device有問題,似乎是因為render state cache機制的關係?這個問題沒解決,這部分就沒辦法上Iris SVN

-
我一定是瘋了才在凌晨四五點還在搞這個....