Archive for the ‘Programming’ Category

Dev Diary 6: IPCC 2010

Friday, July 30th, 2010

Finally the presentation is over. It was organized at a beautiful holiday villa located in Cyber Jaya:

Quite a lot of people went there, not only for Casual Games but also Animation, Comic, and Mobile Games categories.

That’s how it looked like in the ballroom:

That’s exactly the place that I stood and presented my idea. :-)

This year, the competition was quite tough and different from previous years. There are many 3D games and facebook games ideas that popped into the competition, and like what I’d expected, people started to throw in UDK and Unity engine into the competition. I don’t mean it but not every game is suitable to use those 2 engines especially the first one because it require a high-end gaming PC to run it. I’ve tested UDK on my intel laptop and it wouldn’t even launch.

Panel of judges, very experienced people from the industry:

In my opinion our team has strong technical background, what we lack is actually a strong mind to come out with very interesting, innovative new ideas to generate game values for our game. We will definitely look into that. Got to read more on game design stuff than the technical ones.

These are screenshots taken from our demo that had been shown during the presentation:

With our own level editor, it’s quite easy to create the whole playable level in rapid speed. I did 70% of the demo level in 1 night!

The screenshots that you see here is around 25% of the whole level.

I’d rushed for this demo reel so it has several problems (and of course I have avoided some the problems during demonstration):

  • no lightmap is applied
  • no real-time shadow on characters
  • broken collision system on protagonist
  • no particle system
  • far-from-perfect AI

however it has:

  • animated textures (by scrolling texture coordinate in real-time)
  • octree optimization
  • simple path finding system
  • triangle-based collision detection
  • simple game logic and event system
  • simple XML scripting system

I’ll have to concentrate on my college projects for a moment because I have missed some of it so I have to keep it back to track. The results will be announced 2 weeks later. Good luck to everyone!

Been there, did that, and met the people. Great experience indeed!

Below are some team mates who went for the presentation with me.

Kong CC aka JayZEE who helped me to navigate slides, and also did several 3D models for the demo:

Left: Chong CH who did a lot of concept art, 3d models and he also did animation for the protagonist; Right: Goh YS who is an insanely patient person in rigging characters and animating them:

GREAT JOB PEOPLE!!!

Dev Diary 3: Sky Box!

Thursday, July 15th, 2010

I have been thinking what are missing from our level editor. I suddenly realized that we do not have sky box!! Empty space is boring!

Thus I decided to add in yet another feature into our editor (used 6 hours!!):

What we get:

Cool right?

And of course, this is the default sky box came with Irrlicht Engine, so it doesn’t look very special.

We will make our own sky box very soon. :-)

Dev Diary 2: XML Frenzy

Monday, July 12th, 2010

Been doing programming again lately. I continue with the shooting demo that I did last time and I have improved a lot of things from there.

One of the most notable upgrade is the integration of XML file reading system that allows me to change settings for my entities without recompiling the whole app. An example of an entity setting file:

<entity
mesh = “terry.b3d”/>

<material
texture = “terry.png”
type = “alpha”
lighting = “true”
fog = “false”
backFaceCulling = “true”
frontFaceCulling = “false”/>

<animation
name = “idle”
start = “1″
end = “120″/>

Very farmilar syntax right? HTML is xml-based too. :-)

The debug window shows successful loading of the resource files saved in the entity xml:

XML can be very useful, for instance, saving NPC messages or even ingame events without having to hard-code it into the app and recompile everytime some changes have been done.

Ingame scene remains secret for now. :-)

Some Updates

Friday, May 7th, 2010

I forgot what I did, but I get this funny looking thing:

Nevermind about this yet it doesn’t bring any problem so far, I’ll fix it much later.

Today I will talk about another awesomeness of Qt’s signal-slot system. I used it extensively in the whole app.

For example the material window in my app

How do I pass all the information from this window to the main window and apply all the settings to the selected object?

Easy.

First, when you create a new file for this sub window, don’t use “Qt Designer Form“, but “Qt Designer Form Class” instead. It will create class files for you and you can go adding codes there for any custom functionality. Then, when you’re done with those, declare a pointer for your sub window class in your main window class, example:

Material* material;

That’s mine.

Before connecting both classes, you must declare a signal in the sub-window (in this example, material window):

public slots:
void on_matApply_clicked();

After that, connect both QObject classes (must be a QObject, ordinary classes wouldn’t work), example:

connect(material, SIGNAL(applyMaterial()), this, SLOT(applyMeshMaterial()));

applyMeshMaterial() is just an ordinary function in main window class that will be triggered once applyMaterial() signal is emitted by calling:

emit applyMaterial();

in any part of your sub-window class. It will trigger applyMeshMaterial() function and carry out whatever thing that you want the main window to do; in the example, passing all the settings from material window to main window and then to the rendering engine (which I didn’t explain here).

Happy coding!! Awesome Qt.

Upgrade & Debug

Saturday, April 24th, 2010

The first thing I’ve done for my own project is updating all libraries to the latest versions.

My LightGrid Editor is now running Qt4 instead of Qt3, and also the latest nightly-build version of Irrlicht engine. I realize so much have changed during my idle: it’s cool, for improvements; it’s bad, for that I have to update my code base. T_T Debug debug debug…

debug

The next thing that I have been doing was… study my own code = = because I have forgotten the uses of all those thousands line of codes that I wrote previously LOL. But luckily I have commented all of it so that I can refer back some time later. (I knew my memory sucks) ;-)

Anyway, how come Intel hasn’t release driver for OpenGL 3 yet T_T they have DirectX 11 but not OpenGL 3.2? Hmm… bias bias.

Other than that, anyone who’s using Windows 7 ever realize the web statistic at the right hand side showing something very funny?

Windows NT4 LOL!!!

Youtube BBCode

Thursday, March 25th, 2010

This is my own version of BBCode (Bulletin Board Code) for embeding Youtube videos.

BBCode usage:

[youtube]{SIMPLETEXT}[/youtube]

HTML replacement:

<object width=”560″ height=”340″><param name=”movie” value=”http://www.youtube.com/v/{SIMPLETEXT}&hl=en&fs=1″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/{SIMPLETEXT}&hl=en&fs=1″ type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”560″ height=”340″></embed></object>

Example of usage of this BBCode:

Let’s say the video link is http://www.youtube.com/watch?v=VmcvdRPlBTg

Just copy the video ID, which is located behind ?v=

Therefore the BBCode will be [youtube]VmcvdRPlBTg[/youtube]

But then of course, this is not the best way to embed a Youtube video. If you have a better way, yes please, share it.

Outliner

Thursday, March 18th, 2010

Outliner is finally working like charm. Not only it will add every newly-added object to the nicely-categorized (with icons!!) list, you can now select multiple objects by just selecting it from the outliner. Shift+click to select more than 1 object.

Recently I submitted a bug report to Irrlicht engine developers, well, not very serious one, just an inaccuracy during conversion of RGB values from int to float (Irrlicht doesn’t round off the decimals). The result color might not be obvious to the eyes, but since I’m making a level editor therefore the converted value has to be precise because eventually the values will be displayed. Developers’ responses were fast, which is good. :-) I’ll just wait for the fix.

Another thing is I realize that in Irrlicht 1.7 saveScene() function does saving fog values into the file, which it did not in previous versions. I can now happily remove some of my code which does that manually. Good job devs!!

Currently the editor looks like this:

Tabs

Sunday, March 14th, 2010

Nothing new, still in the process of porting the old stuff to new system. However it’s close to completion, though. :-)

Current updates are:

  • Automatically add relevant tab to the tab window
  • Update all informations (see pic below) in real-time when you’re adjusting the selected object in the 3d space
  • Remove tab when an object is deselected

And this one is still under construction ;-) :

Again I have to stress this: Qt’s signal-slot system is very very powerful!!! It avoids a lot of fuss and makes things easier to accomplish.

connect(this->editor->getIrrWidget(), SIGNAL(aMeshSelected(IAnimatedMeshSceneNode*)), this, SLOT(updateAMeshTab(IAnimatedMeshSceneNode*)));

Epic win.

————————————————————————————————–

By the way congratulation to Tommy Ling for quitting the bloody business courses (no offense) and joined design major.

*evil laugh* >:D

Qt Focus Events

Friday, March 12th, 2010

I realized my Irrlicht custom widget for Qt has grabbed away the keyboard input to itself and not letting it to work on other input widgets (Line Edit, Text Edit and so on). I found out the problem was caused by my legendary

this->grabKeyboard();

function that I did previously. Anyone that follows my previous post should also do the following steps to prevent the same problem from happening.

I’ve found the solution which is by adding 2 functions that were inherited from the widget class

virtual void focusInEvent( QFocusEvent* event );
virtual void focusOutEvent( QFocusEvent* event );

and check whether it is in focus or not, then grab/release the keyboard manually. It’s pretty easy

void QIrrlichtWidget::focusInEvent( QFocusEvent* event )
{ this->grabKeyboard(); }

void QIrrlichtWidget::focusOutEvent( QFocusEvent* event )
{ this->releaseKeyboard(); }

Oh and before that, when you initializing your widget, call this function as well

this->setFocusPolicy(Qt::WheelFocus);

so that the 2 inherited functions will work properly. Not necessarily Qt::WheelFocus, anything would work except Qt::NoFocus, it depends on your own preference. Check out the API document if you are unsure which one to use. (p/s. Qt::WheelFocus is the strongest focus policy among all)

Adios!

intersectsWithLine()

Thursday, March 4th, 2010

Previously I mentioned about the manipulators being successfully rendered in-front of everything else but then the problem came: visually it looks like it is in-front of the house, but technically it is still actually hidden inside the house model.

There are quite a lot of people helped me out with this issue, one of which telling me to set bitmask parameter in getSceneNodeFromRayBB() function but I’ve tried that and I don’t know why it doesn’t work, maybe I did something wrong with that method.

Then I tried the second option which is using

intersectsWithLine  ( const vector3d< T > &  linemiddle, const vector3d< T > &  linevect, T  halflength)   const [inline]

and that works out pretty well!

What I did was I manually cast a ray 2 times from the camera, which the first one detects the existence of the manipulators, and if it doesn’t, cast the second ray to detect existence of a 3d object which exists and is under the cursor.

This is surely mad, but you get the satisfaction when you have reached the goal.