This week i have resurrected my old Real time Ray Tracer for the 4k competition and have spent time bringing it to an inital working state.

This is the first version which is real-time and allows for user interaction.

As it is a first version is has some flaws:

-It is obviously larger than 4096 bytes at the moment -not a game yet (I plan to make a poor clone of Decsent by Parallax Software )-only primitive are spheres (will only consist of Cylinders, Spheres and Triangles )-not heavily optimised (there is a large slow down when large portions of the screen are covered with spheres)-makes use of many short lived objects which makes it slow ( I will be converting it to procedual)-no textures (will be procedual eventually and if i can fit it in 4k)-only one directional light + ambient (will have localised lighting)

Looks very cool and sort of fun to play around with already. FPS was close to 33 on low res version unless I drove into a sphere. Then it would drop to ~15. Hi res 10-20fps. Still felt very smooth and responsive. Only complaint: seems like left arrow really rolled right and vice versa (it probably rolls the world left, but I would imagine it should roll the ship left?)

Don't you want to make this a full game instead? It would still be an impressive feat and I don´t think there are many java games around with realtime raytracing, so it would sort of be groundbreaking anyway, maybe even more so than a 4K version of it.

re: rolling, eventually the view will be a third person perspective behind and above your craft, similar to Freelancer (from which i have stolen the mouse control from )

Well I would love to make a "proper" game, but with work commitments and organising a wedding i doubt i will have enough time do so. I am aiming for the 4k as I have proven to myself i can create a game ( I have entered the last two years) as i would hate for it to languish like oh so many other of my project due to lack of time

well i had put the development of this project on hold but have recently got back into it.

I have decided to scrap the original version of the render in favour of a new clean build from scratch but with all the knowledge from the first version.

In doing so i have found two very interesting facts which are related:

1. Upgrading to java 6 has doubled the performance of the current version of the engine i am amazed and pleased!2. Upgrading to java 6 had meant that my embedded pack200 in a jar trick does not currently work so instead of the new engine being 2.24k it is 2.43k. (this is due to java 6 being more strict on the binary class structure, i have some ideas to fix this however)

I would like to know if this performance boost is universal and just not a quirk of my system, please download the jar and test it on different versions of java if you have two or more installed on your system. Also i would love to know how long it takes to render the image on different hardware. Currently on a core T5500 1.66Ghz it renders in 2.344 seconds on java 6 compared to 4.391 on java 5.

The current version is a naive raytracer in that it does not currently have the optimisations of the old version. It renders a scene with 256 spheres, and displays the image. I am attempting to optimise (in both speed and size) this naive raytracer using algorithmic, flow and java language optimisations first before adding in the optimisations and tricks i learnt in the first version.

It will be tricky, but i hope to fit the final optimisations such that the engine is 3k or less allowing 1k for game code... probably too ambitious i think.

Note: the jar is bigger than 2.43k as it is a executable jar for convenience.

I am very pleased and a little surprised with the performance of the latest version

The same scene rendered with the earlier "new" version now is not measured in seconds, rather 100ths of seconds! I have now put a frames per second counter on the frame tile replacing the time taken to render.

I have brought across most of the optimisations from the original version. This has brought about the significant increase in speed seen. There are another two more optimisation code blocks i can bring across from the original version, but I may not need to do so as I am already achieving the desired fps.

At the moment the rtrt engine is coming in at 3.45k which is very good considering i have directly ported the optimisation code from the original version and have not sought yet to optimise these code blocks for space yet.

It is looking quite positive at the moment i am getting ~30 fps on an athlonXP2100 so newer machines should get marked improvements. I would love to know what fps you get.

My actual CPU speed is 1.8GHz. The 3000 is the equivalent to speed(I'm sure you know that). Not sure if that makes a difference. Is your Athlon rated the same way? I can't remember when they started rating it that way. Also I am not using a 64bit OS.

My actual CPU speed is 1.8GHz. The 3000 is the equivalent to speed(I'm sure you know that). Not sure if that makes a difference. Is your Athlon rated the same way? I can't remember when they started rating it that way. Also I am not using a 64bit OS.

AthlonXP CPUs are also rated that way, if a little bit more modestly (IIRC my Athlon XP 2200+ is actually clocked at 1.8GHz)

irreversible_kev: what version of java are you using? v1.5 and earlier seem to be quite a bit slower. Did you have any other processes running in the background?

CaptainJester: i believe my athlon is running at ~1.6 Ghz... perhaps my optimisation has been "optimal" for my cpu only?

I just tried it on a Core T5500 @1.66ghz and it seems like the java VM does not fully utilise more than one core... i am seeing max 50% utilisation... Bugger... i did not want to have to put in threading as it will be a large byte code cost. on the Core T5500 i am getting 33 fps.

@ Morre: sorry not really. I have noticed that the JOGA optimiser/obfuscator does not want to work well with java 1.6 You may want to restrict the optimisers it uses to only Proguard, Jarg and Jode. Also, the pack200 embedding tool does not work for 1.6 due to more strict compliance checking. I do plan to re-vist and provide an updated tool closer to the launch of the 4k competition.

If there is any error logs please do send it to me as well as the settings used. (you might need to increase the level of verbosity). If at all possible the JAR with causes the error too so i can attempt to replicate the problem.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org