PDA

View Full Version : Raycasting?



Pattt
January 28th, 2007, 11:00 AM
I have a few questions about raycasting in Flash.

How advanced raycasting can you get? Like Doom?

http://www.dosgamesarchive.com/download/doom.gif

It got stairs, different walls and stuff.
Think that's to advanced for Flash to handle?

Cheers. :beer:

SacrificialLamb
January 28th, 2007, 02:38 PM
looking at G |_ 3 /\/ /\/ post (http://www.kirupa.com/forum/showthread.php?t=248415) i would say yes it's possible but hard

G |_ 3 /\/ /\/
January 29th, 2007, 05:49 AM
Just get Andre Michelle's Flash raycasting source code at his website . It's a casual raycaster though.

From the code, i've added texture templates, sprites, multiple building heights which you can walk on, transparent textures like pasted doors and signboards. There's even sloped roofs and tunnels but i commented out the code (performance too choppy with all the sprites and transparent textures.). It's a strategy game though (it actually runs off a 2D overhead map), so performance isn't that important and a bit of choppiness is fine.

Theoritically, it's possible to render more complicated geometry like steps, angled walls,battlements, etc. per tile. Ie. YOu designate tiles with special geometry than when the ray enters such a tile, it must do custom raycasting for those tiles to find the key points like the apex, edges, etc. etc. and interpolate between the points accordingly. But yea, it adds to the calculations and lag.

THere's an article about doing raycasting "unconventionally" sector-based rather than tile-based. It allows you to create walls of any angle like in Duke Nukem 3D. But i haven't tried it and from a development standpoint it's very troublesome because level design requires the mapper to create designate sectors (and for my open simcity tile-based game format...it just doesn't fit my game). Doom uses BSP which requires coding to generate portals and all the complicated stuff. You are better off getting another engine if performance and effeciency is your concern. But if your game (RPG, strategy, or action) is primarily a 2d tile-based game and adding a 3d raycasting component is done primarily for "looks"..then why not? As long as it doesn't affect performance, it can be a fun gimmick. For action games, maybe you can try a Quarantine (by Gametek) or Rise of the Triad. Old-school tile-based rpgs also possible. All these are quite doable. But watch the performance. It will be major hurdle for you to fight...especially with the pixel-based nature of Andre's engine. (Maybe you can try using fillRect() instead of setPixel(), but not sure if that would improive performance. When you start rendering the transparent sprites per pixel, that's when things start to lag heavily. Maybe you have to think up another method, and yet still allow those walls to cover the sprites. And yes..you need a pretty high end system as well.

Pattt
February 1st, 2007, 05:26 AM
Wow, that looks really nice! Do you have a swf?