This week-end I started playing around with RLP, this is some seriously nice technology. I hope Microsoft picks up on this and adds native support for a similar interop story, I do not say this because I think the there is anything wrong with GHI’s offering, on the contrary, it is great and I think everyone should have this as a standard solution with native integration into the .NET solution.
Anyway, here is a short video of what I have done today. This is truly version 0.1 code, it was written to work, I will now start optimizing the code and if I am able to achieve sufficient level of optimization I will add texture-mapped walls for that real Wolfenstein look :).
What optimization will I do
Change all floating point calculation to fixed point
Point 1 will introduce look-up for all the trig functions which I believe will make huge difference
Optimize the rendering to use inline asm.
For point 3, Can anyone suggest any good sources for learning ARM assembly? I am not a complete newbie to asm, I am familiar with x86, Z80, can read 6502 (Yes, ZX Spectrums and C64 are from my era :))
I know, I need to get my camera situation sorted out…
Here is a quick update, I got a few hours in today to do a few performance optimizations and added the texture mapping support. I got a little ahead of myself, since there are still a few obvious opitmizations to do, but that will need to wait for another week-end.
Thanks Gus, I was pleasantly surprised with the performance I could get with RLP.
Currently each frame is rendered by a RLP call, I read the joystick in managed code calculate the new co-ordinates and send that through to the RLP function to render the screen.
So far most of the performance gain has been by implementing cos/sin approximations and an integer sqrt, I did not have much time so I am sure these can still be optimized even further. I strongly suspect that moving the rendering of each column to assembly will make significant additional improvements, but the big thing to do is to switch to fixed point math.
I saw your question sometime ago about 3d math, it got me thinking it would be nice to build a decent 3d library for .NETMF. Might be a nice community project if there is not already something.
Of course what I am doing here is “fake 3d” or 2.5D as it is sometimes called so the 3d math is much simpler. The maze is 2d maze and based on the players position and direction in the maze a ray is cast in the 2d maze to see what it intersects with and how far away from the player that intersection takes place. Using this info a single sliver is rendered and the ray rotated to the next display column and repeat for the next 319 columns. The net effect is that a pseudo 3d scene is rendered based on what the player sees.
I think with the appropriate optimizations I believe that it might be possible to perform a polygon rendered scene with a decent frame rate, but I have some concerns about the memory access performance, it seems to be a little slow but I have not looked in detail at this yet.
@ Gus, I take your point. For me it is an opportunity to learn a new assembly language, I rarely get to write much code these days in my day job, so this is a nice back to roots type of device for me.
As for the info, I grew-up in the days of Wolfenstein and Doom. To be honest, I am not much of a gamer, I do not have a single game other than those that come with Windows, but I love to understand how these things work, so I learned what I could, where I could to understand how those different engines worked. And now with these devices it is a nice opportunity to get back to those basics from 20 years ago.
Btw. you guys are doing an amazing job both on the hardware side and the community!
@ Graylin, I have seen some video of the stuff @ skewworks is doing, my stuff is more in the category of weekend warrior toy software, skewworks looks like he/they are building some serious software with all the trimmings. No contest, but I hope to help in my way.
@ jasuk, That is quite cool. This style of maze game was popular in the 80s, check out Wizadry. I did a quick search and found this
XNA is very cool, I have played a fair amount with it as well and really enjoy the ease of entry, but what I like about the .NETMF stuff is I get to play with the direct writes to the screen, implementing all the 3d primitives myself just takes me back to the days that we had to work for the tiniest results. I am not knocking the stuff today, now we get to focus more on the real problem and not the fiddly stuff, but damn that fiddly stuff is fun and gives you a real sense of achievement.
@ EriSan, Where are those days??? Long gone along with my hair
@ taylorza - I’ve played wizardry, and Wizardry 8 is still one of my favourite games. But this was based on an old Oric game called Tyrann (Hence adding the T at the end ) The Oric Site . Doing it the way I have been via line drawing based on maze in memory is probably harder work than your ray-casting as you have do be able to draw every combination.