Tuesday, November 13, 2007

Today...

Been recording the new song EverGreen but it's proving to be tricky because as I approach the bridge, it gets less intense. Then it should be most intense during the chorus. Anyway, the game is going well, sort of. Done a chase camera. There was an object to do the job so had to learn how to use that. The problem is the camera is sort of for driving. So the mouse is used for camera movements. I thought the mouse could be used for controls. Well ... we'll see how it goes. I also did a SkyBox to surround the player so it doesnt look all black.


Still listening to Missy Higgins...

Labels:

Sunday, November 11, 2007

Current Status

Haven't updated my blog in ages. Just finished one of the hardest subjects I have taken. 3rd year degree Math, Algorithms and Complexities. Calculus was indeed challenging, until now. Number Theory has made Calculus somewhat trivial. Just sat for the finals for that subject. Quite tough. I hate the questions, that take some inspiration to answer. Questions that say, "Come up with an Algorithm" .. well .. ok ... then "Prove it yields an optimal solution" ..
What the **** ... Coming up with an algorithm(especially one in O(nlgn) time) in 10 minutes is hard enough. But proving it yields an optimal solution, means we have to prove that there is no other way we can get another better answer than the one the algorithm gets.

Anyway ... put that behind me ... whats done is done.

NEW PROJECT !!!
Game in JAVA. Just to test and push the limits of JAVA performance. Concept is a GUNDAM shoot em up kind of games. There aren't many people working on this one so it will take time to finish. Baru ajak Topek and Marwan. Spe2 yg rasa nak join cuba2 ... boleh je. After 1 Day I have obtained this :
Nothing much. Just a still model and we can 'fly around' and view it in wireframe, etc. The FramesPerSecond drops from about 150 to 28 when rendering the entire model. I think it has too many polygons. Got to remodel it. I used the JMonkeyEngine library to build this game.
The JAVA engine is of coarse multiplatform but requires specific libraries available for each platform, so it SHOULD run on all platforms.

Been listening to Missy Higgins lately. Its not Japanese and not rock either. But it is good, beautiful music. I first saw her live and loved it. The lives were more jazzy. Been looking for the live versions but I can't find them.

I'm still composing a new song called EverGreen. Almost done but recording it will take some time. Also I have almost finished rerecording the vocals for Dark Matter, but my voice didn't turn out to be as good as I thought it was. Still looking for a vocalist !! I'll finish it hopefully tomorrow.

Labels:

Monday, June 11, 2007

COD

Quote :

Java is entering into its inefficient phase. C# is in the middle of its acceptance phase.When the .NET architect, Hejlsberg, says, "Yeah, and I just think that we're a generation ahead when it comes to the thinking in this space," he is probably right. In the scheme of things the .NET language extensions are particularly small. However .NET now offers Component-Oriented support in the form of properties and events as first class language constructs.

There is a lot of talk amongst senior figures about where Java is heading. JavaLobby, The Server Side and Java Developer Journal have all carried articles in recent months about the way ahead for Java. Looking at the readers' responses to these articles I'd say the vast majority of Java developers don't even appreciate what Hejlsberg is saying.

It's time for Javasoft to start getting aggressive in their vision of what Java is. It's easy to get self-congratulatory and lazy when you're in a dominant market position. I believe that Javasoft can deliver the next big thing but it's going to involve swallowing a lot of pride, and I'm not sure they can do that.

Labels:

Monday, April 09, 2007

Organic Graph Layout

Took me 4 days of work, but finally it's done. 4 hari hidup kelawar. It was a nightmare just to get it working correctly, and a lot of tweaking to get it just right. It solves the very thing we take for granted. Aesthetic values ... that make things look 'nice'. Ratios, determine how beautiful something really is. Who said the world isn't all math. Well, it isn't ... but most of it is anyway.

As to graphs, we look at a graph which the nodes have been randomly spread across a canvas, and rearrange it. But sub consciously we place nodes at a roughly same distance from every other node. We cluster them so that the connected nodes are closer together.and we try to get rid of crossing edges.

This is found in nature. But natural approach is a bit different but the result is more or less the same. You have 2 forces. Attracting and repelling ...
This model is what keeps molecules together. Keeps the moon in orbit. Keeps the earth in orbit. For all we know, keeps life itself going.

So organic graph layouts simulate how molecules keep intact. Each node has a repelling force, but to the nodes it is connected to, it attracts to some extent.

This is the pseudocode ...
set up initial node velocities to (0,0)
set up initial node positions randomly // no 2 nodes are in exactly the same position
loop
total_kinetic_energy := 0 // total kinetic energy of all particles
for each node

net_force := (0, 0) // running sum of node's total force

for each other node
net_force := net_force + Coulomb_repulsion( this_node, other_node )
next node

for each spring connected to this node
net_force := net_force + Hooke_attraction( this_node, spring )
next spring

// without damping, it moves forever

this_node.velocity := (this_node.velocity + timestep * net_force) * damping
this_node.position := this_node.position + timestep * this_node.velocity
total_kinetic_energy := total_kinetic_energy + (this_node.velocity)^2
next node

until total_kinetic_energy is less than some small number //the simulation has stopped moving
The result :


The code doesn't really deal with crossing edges but naturally most of the crossings will resolve itself.

Labels:

Wednesday, March 28, 2007

AlgoAnalysis UI

huuuu ... Siap a functional UI for AlgoAnalysis. Hasil kje 3 hari non stop ... ada la stop2 skit. The problem is, kalau display, semak lak rupanya ... positioning nodes nye random. So kdg2 overlap. Kalau tak overlap ngan node lain ... die overlap ngan edge. Skrg tgh pikir Algo utk organize display. Tgh consider triangulation. Kalau sesiapa ada pendapat ... bg tau aku ...

Labels:

Sunday, March 25, 2007

Python Power

A friend once had a problem with this code ... didn't know what was going on. Took ages to debug a simple problem and gave up ...

f = open('test.txt','r')
for line in f.read().split(','):
if i == 0:
z = line
print 'X1 = '+z
elif i == 1:
a = line
print 'a! = '+a
elif i == 2:
b = line
print 'b! = '+b
elif i == 3:
c = line
print 'c! = '+c
i = 0
i = i + 1
#training(x1, a, b, c)

Its 18 lines long, a pain in the @$$ to debug, and frankly ... too much bull$#!t ...
1st step, bring your logic up a level and stop thinking like stupid one dimensional programmers, start thinking like a errrr.... a 'person'. 2nd step, keep it simple...

If you do these 2 steps right, you might get something like this ...

f = open('test.txt','r')
linelist = f.readlines()
for line in linelist[1:]:
var=line.split(',')
print linelist[0].strip(),var[0],var[1],var[2]


Its 5 lines long ... took 2 minutes to think of and write and it does exactly the same stuff that the previous one was supposed to do.

May his experience be a lesson to all ...

Labels:

Thursday, March 15, 2007

MROAD beta version 0.0.2 revision 15

Bangun tidur, bkn gosok gigi, bkn mandi, terus gi kat PC and sambung debug. Ini la hidup programmer. Br mlm smlm tgk member training, sedih je but nevermind. So far da isolate the problem. Dekat db ada data salah. So betulkan la ... tambah 1 line je kat gpsExtractNodes.py and da siap.









Da dapat path yg tak bercabang, so far so good...



Kalau guna the same path, walaupun takde cabang2, still bkn optimum.
As suspected before this, algo ada salah. Salah sikit la. End node die jumpa tapi for some reason die naik atas amik detour jauh gile ... patut ikut jalan hijau tu (ditambah using photoshop and is not a part of the programme). This bug is still to be fixed. Ada banyak lagi bug ... tp one at a time. Special thanks to Mohd Marwan that helped during debugging. And I forgot to mention before, he is also involved in the building of the core engine.



Siapa yg nak bende ni leh email aku ...
Requirements:
-Python 2.3++
-pysqlite2 module

I am considering making this a stand alone to eliminate these requirements...

Labels:

M road beta

This is my new project, a path finding system for roads in KL, ingat nk release. Skali tgk byk lak bug. Errors in the core engine that are hard to isolate and fix. This bug is a result of inadequate testing during AGILE development. Imagine what it would have been if I used the Waterfall technique.
























Test 1 :

Path yg terhasil betul. This is exactly macam yg berlaku masa first test of the engine.





Test 2 :
test jauh sikit so far OK. Walaupun node yg die pilih jauh sikit dr end node, its doing what it's supposed to do ...




Test 3 :

Obviously somethings wrong ... mana salahnye exactly ... sumpah aku tatau. Mana boleh shortest path bercabang kan ?? and ... ada kalanya edges nye tak ikut jalan... hmmm ..

Possible faults :
Data ...the source should be right, dah check .. so maybe process masuk data dlm DB ada error.

Graph ... mentafsir data from the DB ada error somewhere ... and debugging this part paling payah.



Sesiapa nk join, help a bit or leave some comments for suggestions, YM aku sentiasa ada...
ps : life really sucks when you're injured ...

Labels:

Tuesday, March 13, 2007

The Amazing Ant



This AlgoAnalysis project is doing quite well, unlike my other projects. Stuff like J2ME, etc. Took a while to get that running. Sbb aku mmg tak nak install IDE.

Anyway, ni sebahagian drpd build file ant...


The beauty about this part is that it auto generates the API for the classes that you build according to the JAVA standard API.


All you have to do is add comments above each function as shown in the image below and build the project.

Labels:

Monday, March 12, 2007

AlgoAnalysis prototype version 0.0.1

Projek ni nak generate statistics for algorithm performance testing. Hence, the name 'AlgoAnalysis'. This is just a prototype but the random graph generator has been completed using python. This prototype tests if those classes can be called from a JAVA program which I have successfully demonstrated in the screenshot above as I use ANT to build my project.

Interaction antara JAVA ngan Python menggunakan JYTHON. Drawback nye is that JYTHON guna Python2.2 je. Tatau lak bile nak release one for 2.4 / 2.5. As a result, certain functions takde. Tapi there are ways around that.

Python leh interact ngan JAVA. Nak panggil JAVA class senang aje, tapi nak panggil Python nye class payah sikit. Kene buat an intermediary class and embed Python scripts in the JAVA program as if sending commands to the interpreter.
Python :

import random
class Graph:
def __init__(self):
self.nodeIDList = []
self.nodeEdgelistDict = {}
self.nodeEdgelistWeightDict = {}

self.allowLoops = 0
self.allowMultipleEdges = 0
self.directedGraphType = 1

self.edgeWeightUpperLimit = 10
self.edgeWeightLowerLimit = -10

def generateGraph(self,nodeTotal,edgeTotal):
# add nodes first and define edge list
for currNodeCount in range(nodeTotal):
nodeID = self.getNextUniqueID()
self.nodeIDList.append(nodeID)
self.nodeEdgelistDict[nodeID] = []
.
.
.

JAVA :

package AlgoAnalysis;

import org.python.util.PythonInterpreter;
import org.python.core.*;

public class Graph {
private String variableName = "";
private PythonInterpreter interp = new PythonInterpreter();

public Graph(String newVariableName) throws PyException {
this.variableName=newVariableName;
interp.exec("import graphGenerator, graphAnalysis");
interp.exec(variableName+" = graphGenerator.Graph()");
}
public void generateGraph(int nodeTotal,int edgeTotal){
interp.exec(variableName+".generateGraph("+nodeTotal+","+edgeTotal+")");
}
public void toFile(String filename){
interp.exec(variableName+".toFile(\""+filename+"\")");
}
.
.
.



As a result the python scripts are translated and compiled into
JAVA classes like so:

Labels:

Friday, December 22, 2006

MS4W alpha

Hmm ... seminggu buat ni je ... AIS data lum sentuh lagi ... hahahah ...
takpe ... UI-nye amik dr ka-Map and server .... MS4W laaa ... oh ... lupa .. built on Apache(PHP).

Nak decode data AIS dan display ... tapi akibat hasutan Mohd Marwan, terus setup server ni jadi WMS client. ( WMS == Web Map Server ). So setelah reformat ENC nye data cantik2 nye .. tarok la data WMS kat blakang ... the end result :

Data blakang tu image mosaic yg diambil dr server NASA (http://onearth.jpl.nasa.gov/)

Labels:

Monday, December 18, 2006

MS4W

Ok ... 3d viewer dah siap ... done and dusted. No real use for it YET ! ... tp takpe .. ada proj baru.
-MapServerForWindows.-
Linux pn ada tp memandangkan PC kerajaan manjang pakai windows je ... so pakai la ni ... lg pn config die sng skit .. hehehe. Map atas tu display data ENC. Data AIS bakal di-display-kan. Sehari suntuk buat ngan member aku Marwan.
For more info, jenguk la blog die ....

Next ... AIS ...( Automatic Identification System )..

Labels:

Thursday, December 14, 2006

GeoViewer 3D


Tgh sambung program smalam tu. Dah bagi nama dah... GeoViewer 3D ...tp ... sangkut lak kat UI die ... tak tau nak buat pe. Tak de idea setakat ni. Prog ni pon lum tentu hala tujunye ... hahahah ... ini la namanya R&D. Well, hari ni tukar color scheme ngan tarok legend blah kanan. The scale factor still kene tukar nanti once I get the correct measurements.

Labels:

Wednesday, December 13, 2006

3D Data Display

OK ... dah start keje ... ok la takat ni. Boss aku takde, so takde org monitor aku. Bukannya aku tak buat keje tp kalau die ada ... pressure gak la.
So aku dah abandon cita2 aku tuk buat terrain viewer pakai 3d game engine tu. Limit game engine tu 65000 triangles. Banyak tu sebenarnya tp menurut demand data accuracy, kene go back to the basics...
Topology of Malaysia
OpenGL.

Senang gak la sbb lagi sempoi dr game kereta aku tu. So aku amik a stipped down version of the code and modified it. The tricky thing is to manage 500,000 vertices so I had to store the all in an Array. Sesiapa ada cara yg lg baik ... sila bg tau kat aku sbb byk data ni ....

500,000 kali 3 (for x,y,z) ... = 1,500,000.
That is 1 million float variables ... byk siotttt ....
Color nye aku compute at runtime. Tp skali dah load model ni ... run nye leh terima la .. tak la lembab. Nasib baik pakai C++, bkn JAVA.

Sorry tp takleh kasi korg dload yg ni ... hehehe ... screenshot je leh la ... still in development ...

Labels:

Tuesday, December 05, 2006

Terrain Viewer Test


This is my new project I have developed independantly using C++ and Irrlicht libraries. The camera controls are the mouse and you can switch between orthographic and perspective viewing using keys "O" and "P". I could use a few testers but later on I'll be working so this will be owned by the company. But while its free and MINE ... you can download it here

Labels:

Wednesday, November 01, 2006

Game edited

OK. Aku kata tak edit byk. Tp tah, went with the flow. Last2 da ngarut2 dah. Drive atas kaca, drift kluar api. 2 bende tu je yg aku tambah. Jalan tu aku buat itam sikit, pastu buat reflection pakai stencil buffering. Takyah pakai stencil pon tp tu cara betul nak buat. Panjang ceritanya. Buat reflection tu kejap je. Tapi yg makan satu malam tu buat particle, tp tak nyesal aku buat. Ok je ada spawn rate everytime drift. Tapi tak lawa sangat sebab itam je. So aku pon tukar kat blend function. Skali cam api la pulak. Mengarut tapi lawa ... hahahhaa. First2 tak nampak cam api sgt tp bila dah grow lawa gak. Lawa tapi lawak, takpe, janji puas. Download Sini

Labels:

Tuesday, October 31, 2006

Game release Beta


Last tweaks. Supposed to submit it on Thursday. Dah nak siap pon so nah laaa ... lebih kurang siap la. Nanti mungkin ada modification lg kalau aku terasa cam perlu la tp kalau ada pon sikit je. Sila tekan 'F1' tuk Help screen. Leh tau semua controls. Ni ada GUI, collision detection added lights and functionality. Have fun. Download FREE HERE

Labels:

Friday, September 15, 2006

Projek Baru ...

Ok ... the game is going fine and all, however I have been persuaded to join my friend, Marwan in exploring this Algorithm called A star. To be honest, it's exactly the same as Dijkstra. The only difference is dijkstra uses a queue. A star uses a Priority Queue based on the cost, therefore reducing the total number of nodes that have to be explored. Hence, improved performance. The path obtained depends on the heuristics, sometimes the result will be optimal, sometimes not.

In all algorithms that find a shortest path, it simplifies a complex data structure and turns it into the simplest, a list. The goal is creating the shortest list possible by eliminating all the possible nodes that could be used to get to the destination.

This A star algorithm calculates cost using heuristics, unlike Dijkstra which uses actual path values. It is actually a combination of both Best First and Dijkstra. It will behave like Best First until it reaches an obstacle. Then it will show behavior similar to Dijkstra path finding. In other words it will start to explore. The red path shows the shortest path. The faint red/pink pixels are those that are explored once the 'explorer' hit head first into the dark grey obstacle.

To get this optimum path I came up with this Heuristic function:

H(n) = distanceFromStart + accumulatedCost + selfCost + distanceToDestination

Each has its 'weights' to adjust its effect on the output. I set them all to 1. The larger the value of the 'weight', the larger it's effect on the heuristic function calculation.
These are 2 identical maps. As you can see, changing the 'weights effect how many nodes are explored. In this example there is not much difference in path selection.
The diagram on the left uses the following weight values, the one on the right uses all 1's.

distanceFromStartWeight = 0.21
accumulatedCostWeight = 0.5
selfCostWeight = 0.5

distanceToDestWeight = 1



The python program I wrote is about 200 lines long written in maybe 12 hours. It's still pretty basic. I'll include features later on. I actually plan to do map navigating using this algorithm. Still thinking it through. I'll post the code up after I test it and maybe add further features.

Labels:

Wednesday, September 13, 2006

Game phase 3


Da phase 3 da ni, pe beza phase2 sblm ni aku pon tatau ... hahahha .... development yg tak terancang ...
Tp version ni da tarok plane yg besar so leh la navigate senang sikit. Ada functionality tambah sikit. Files can be downloaded here
The controls:

Up Arrow key

Accelerate

Down Arrow key

Reverse

Left Arrow key

Turn left

Right Arrow key

Turn right

Space bar

Brake

w

Move camera up

s

Move camera down

a

Move camera right

d

Move camera left

q

Adjust lens (zoom in)

e

Adjust lens (zoom out)

c

Cycle through cameras

1 default cam

2 rear cam

3 top(ortho) cam

4 static cam

Labels:

Friday, August 25, 2006

Game : phase 2

Improved version of the game. I made a car using blender. Marwan kata ada rupa cam kereta Tamiya sikit. hmm . Maybe he's right ...

The mesh kelam kabut sikit. Kadang2 nampak cam transparent. It's because the normal is pointing in the opposite direction. I have to find a way to render both sides then ...

available for dload HERE
Controls cam dulu gak ...

[esc] - quit
[up arrow] - accelerate
[down arrow] - reverse
[left arrow] - turn left
[right arrow] - turn right
[space bar] - brake

Labels: