suspicious sight

High resolution / performance time for Java (win32)

|HighResolutionTime.7z|


Java's System.nanoTime() is cool but has a heavy overhead... so I decided to code this simple library.

Adds win32's QueryPerformanceCounter(), QueryPerformanceFrequency() and x86's RDTSC (read time stamp counter) to Java. Uses (obviously) JNI to make these calls from a native DLL, so if you want to run this on non windows OS, you must convert the native library.

 

Some warnings:

- Remember that the TSC is read as an signed long, so watch out for it's sign and wrapping (Java doesn't have an unsigned long).

- As you know, on some processors the TSC stores the number of cycles executed since the cpu's reset, so if it changes speed, the TSC no more reflects a constant unit of time. Actual solution? Pause for some time and compute it's new speed... You have been warned.

- Because <currently> a Java's thread can't be assigned to a single processor (affinity) two consecutive calls to getRDTSC() may be executed in different processors, so the returned values may be incorrect. This may be corrected by forcing the execution of the native call to be always done in the same CPU (using window's SetThreadAffinityMask() for instance). I may implement this in the near future, when I get the time...

- A last detail... If you check both QueryPerformanceCounter() and QueryPerformanceFrequency() calls you'll conclude they always take a minimum of 1.6 micro seconds (us) to execute, exactly the same taken by Java's System.nanoTime() function (this on windows), as well as it's finest time resolution. Coincidence?

 

Source code included.

last update: 17 February 2009

Goal Game Simulation

|IA_Project.7z|

|report|

 

AI project done for the same chair as the Omni-Bot presentation. Has a kind of dumb name, but does exactly what it says.

Comprises of an virtual environment where two teams of bots try to steal gifts from each other and take them to capture points. The purpose of the project was to implement a multi agent system where different and autonomous agents try to complete common goals, while at the same time they negotiate between them who gets which goals. Also, the communication between all system agents are done with messages based on a common ontology.

Has a very nice 3D graphics engine, courtesy of the jPCT library. The application runs on two threads, one for the graphics and the other for the 'AI' engine.

Sorry about the extremely well designed report, I had more to worry about...

 

Source code included.

last update: 18 February 2009

Omni-Bot - AI bot for First Person Shooters

|omni-bot.ppt|


Short (20 minutes) presentation I did for the chair 'Artificial Intelligence' about Omni-bot. If you don't know what it is, click this link and see what's it all about.

last update: 13 February 2009

(C) C3R14L.K1L4

Valid XHTML 1.0 Transitional