Showing posts with label Ray casting. Show all posts
Showing posts with label Ray casting. Show all posts
Thursday, September 13, 2007
CQR Pre-Alpha Build 6
The new episode of One of those Weeks is up. For those of you following the development of Coffee Quest Revenge, the renderer used in the episode of One of those Weeks is the one being developed for CQR. In fact, pre-alpha build 6 is now up at the coming soon page which uses alpha blending to render a view on top of the automap. I think it kind of looks neat. I forgot to fix the keyboard bug. For those who are curious, the keyboard bug is caused because I am attaching the keyboard listener to the main movie clip instead of the stage. When you click on something, focus is given to that and the result is no more keyboard events being broadcast. By attaching the listener to the lowest level stage, all keyboard events get passed through to the program.
Tuesday, September 11, 2007
What is ray casting?
I am sure some of you are wondering what this ray casting thing I am talking about is. Essentially it is like ray tracing except with only one ray per column of pixels instead of one ray per pixel. So the next questions would have to be what is ray tracing and what are the advantages of ray casting over ray tracing.
Ray Tracing is one of the oldest forms of 3D graphics generation. The concept is simple. What we see is made up of light. This light comes from one or more light sources and bounces off objects that absorb some of the lights energy causing it to change color. Eventually the light reaches our eyes where we see the results. Some brilliant person came up with the idea of doing this process in reverse. If you start from the eyeball, you can mathematically work out the path of the light as it travels through the world and trace the route the ray of light took back to it's original light source. By doing this, you can generate incredibly realistic looking images. The down side to this is that there are an awful lot of calculations, and the more complex the objects in the scene the more calculations have to be performed.
The advantage ray casting has is that it is done in a much simpler environment. In fact, it is often done on two dimensional maps that get projected into three dimensions. Because the geometry being calculated is so much more predictable, the amount of calculations that have to be performed are drastically reduced. In fact, ray casting can be done fast enough that it can be used for a game without requiring any 3D hardware support. When you are using Flash, at least as of Flash 9, you don't have 3D hardware support or for that matter any type of standard 3D library. The popularity of open source Flash 3D libraries is growing so eventually Adobe may finally add 3D support. I know for a fact this is a feature that a lot of developers have asked for. Until there is proper 3D support in Flash, all 3D will have to be done in software which means that the speed will be significantly slower meaning that the experience won't be anything like you could achieve if you had hardware 3D support.
Ray Tracing is one of the oldest forms of 3D graphics generation. The concept is simple. What we see is made up of light. This light comes from one or more light sources and bounces off objects that absorb some of the lights energy causing it to change color. Eventually the light reaches our eyes where we see the results. Some brilliant person came up with the idea of doing this process in reverse. If you start from the eyeball, you can mathematically work out the path of the light as it travels through the world and trace the route the ray of light took back to it's original light source. By doing this, you can generate incredibly realistic looking images. The down side to this is that there are an awful lot of calculations, and the more complex the objects in the scene the more calculations have to be performed.
The advantage ray casting has is that it is done in a much simpler environment. In fact, it is often done on two dimensional maps that get projected into three dimensions. Because the geometry being calculated is so much more predictable, the amount of calculations that have to be performed are drastically reduced. In fact, ray casting can be done fast enough that it can be used for a game without requiring any 3D hardware support. When you are using Flash, at least as of Flash 9, you don't have 3D hardware support or for that matter any type of standard 3D library. The popularity of open source Flash 3D libraries is growing so eventually Adobe may finally add 3D support. I know for a fact this is a feature that a lot of developers have asked for. Until there is proper 3D support in Flash, all 3D will have to be done in software which means that the speed will be significantly slower meaning that the experience won't be anything like you could achieve if you had hardware 3D support.
Monday, September 10, 2007
Cruel Weekend
The weekend was a failure for my work on Dozen Days of Dice. While I easily finished the original game I conceived, it just wasn't fun enough. Meanwhile, my plans for Coffee Quest Revenge have changed and progress is finally being made.
I really need to write a proper explanation about what I am doing with Dozen Days of dice. The detailed explanation can wait for another day, but the short summary is that I am doing a series of Game in a Day challenges. I am doing one challenge on every weekend I don't have other plans for. While ideally all twelve games in a series should be done over a block of 12 days, right now that isn't practical, so weekends will have to do. While I could release the game I did finish, I instead am going to cheat and declare it a bonus game. It will be used as filler for when I don't have a game ready to release.
The story behind Coffee Quest Revenge is quite interesting. While I was going to do the 3D stuff using Papervision 3D, I was having too much problems getting what I needed to do working. It is certainly possible that what I wanted to do could be done, I don't know the library well enough yet. I keep running into culling issues for which I suspect the solution would be to write a new camera that automatically subdivides partially culled triangles instead of removing them. Of course I would have to familiarize myself with the source code before undertaking such a task, so instead I opted to port my existing ray casting code over to flash.
The existing ray casting code is designed for a step based game not for 360 degrees of freedom. Still, I had started making a 360 degree ray caster for the ultimate retro project so I figured if I could fix the issues I was having with that version it would be simple to port that code over to flash. When I started looking at the code, my mind lead me to a potentially better way of doing the casting. As this was a new algorithm I figured I would do the initial tests of this algorithm as part of the Coffee Quest Revenge. It has been a while since I released a build of CQR so if you go to http://blazinggames.com/games/coming/ you will see the 5th build which features a test over top of the auto map of the casting. I should point out that this is pre-alpha software and it is kind of fragile. The cursor key movement seems to work fine on Windows but the Mac doesn't seem to automatically repeat keys. Likewise, clicking on the auto map captures the keyboard causing the keyboard keys to stop working.
I really need to write a proper explanation about what I am doing with Dozen Days of dice. The detailed explanation can wait for another day, but the short summary is that I am doing a series of Game in a Day challenges. I am doing one challenge on every weekend I don't have other plans for. While ideally all twelve games in a series should be done over a block of 12 days, right now that isn't practical, so weekends will have to do. While I could release the game I did finish, I instead am going to cheat and declare it a bonus game. It will be used as filler for when I don't have a game ready to release.
The story behind Coffee Quest Revenge is quite interesting. While I was going to do the 3D stuff using Papervision 3D, I was having too much problems getting what I needed to do working. It is certainly possible that what I wanted to do could be done, I don't know the library well enough yet. I keep running into culling issues for which I suspect the solution would be to write a new camera that automatically subdivides partially culled triangles instead of removing them. Of course I would have to familiarize myself with the source code before undertaking such a task, so instead I opted to port my existing ray casting code over to flash.
The existing ray casting code is designed for a step based game not for 360 degrees of freedom. Still, I had started making a 360 degree ray caster for the ultimate retro project so I figured if I could fix the issues I was having with that version it would be simple to port that code over to flash. When I started looking at the code, my mind lead me to a potentially better way of doing the casting. As this was a new algorithm I figured I would do the initial tests of this algorithm as part of the Coffee Quest Revenge. It has been a while since I released a build of CQR so if you go to http://blazinggames.com/games/coming/ you will see the 5th build which features a test over top of the auto map of the casting. I should point out that this is pre-alpha software and it is kind of fragile. The cursor key movement seems to work fine on Windows but the Mac doesn't seem to automatically repeat keys. Likewise, clicking on the auto map captures the keyboard causing the keyboard keys to stop working.
Subscribe to:
Posts (Atom)