The Daily Click ::. Downloads ::. Engine ::. ShadowCaster Engine V2.0
 

ShadowCaster Engine V2.0
Author: Pixelthief Submitted: 30th December, 2006 Favourites:0
Genre: Engine Downloads: 722
Rated:


Edited By Pixelthief on 12/30/2006

This is the V2.0 of my previous ShadowCaster Engine.

Basically, where the other engine drew the shadows as quadrilaterals from an obstactle to the edge of the frame, this draws the line of sight from the origin to an obstactle as a triangle.

This has many notable changes:
*Much faster FPS
*More Precise Shadows
*No Glitchy Overlaps
*Extremely Clean Code



This is much more ideal for Horror-esque games, as it can be used with moderate detail in a confined sort of level, without any slowdown to the FPS at all.

DL includes both .exe and .cca file. Requires Overlay 1.5 (redux), as well as Advanced Math Object (1.0)

Review This Download



 


http://filexoom.com/files/2006/12/28/50609/Lighting4.zip (277 kkb )



Posted by Ganymede Graphics 30th December, 2006

Jeeze, and i thought i knew how to code 'sigh'

Don't you think the low detail looks better than high?
 
Posted by Pixelthief 30th December, 2006

Actually yeah, kinda.

The detail thingy just changes the # of degrees it checks, so the Very High setting makes it check 360x1 degrees, whereas low checks 45x8. But that makes it all fuzzy, where low details got some nice smooth edges

You can really tell the difference if you circle close to an object though; low detail will be really choppy where high detail will be smooth.


I'm planning on making a survival game using the "Flashlight" style, which runs pretty fast on Mid. I'm thinking 90x4 works best.
 
Posted by Fanotherpg 31st December, 2006

It's got max 10-20 FPS on one of my PC and on second 1-10 FPS.. And it's only this engine and game probably wouldn't start..
 
Posted by Pixelthief 31st December, 2006

O_o

try low detail, it runs at a constant 45 on mine
 
Posted by Werbad 31st December, 2006

I don't think this engine will be usable in any game in it's current state...
My computer isn't good in any way, but most click games still run fine, but this engine runs in about 2-3 FPS...
The funny part is that the old engine ran in 7-8 FPS... Weird
 
Posted by DaVince 31st December, 2006

It isn't very fast, runs around 20 FPS in all modes here. The idea is nice, but the engine kinda dodgy too. I couldn't do it better than you though, at least not in MMF, so good job.
 
Posted by Pixelthief 31st December, 2006

I'm wondering if you guys are using the same Overlay Redux object; I've heard tales of programs opened with a different version that causes it to run much slower. You could try running the .exe file and see if it also runs at 8 FPS.

The thing is, at ultra low detail, its only drawing 45 triangles per loop. Thats really not that much, and the game is set on MMF's speed, not machine only speed, so there shouldnt be that much of a variance.

Id say try the .exe file once, since it runs at 45 FPS on every single one of my computers...
 
Posted by Pixelthief 31st December, 2006

I should also note, this is made in MMF, not MMF2, so trying to compile it in MMF2 might make some... inconsistencies
 
Posted by Silveraura 31st December, 2006

Looks nice, I get around 45 to 50fps on your compile, and when I opened it in MMF2, I got around 55 to 60fps. not bad, but just slow enough. Still nice though.
 
Posted by Pixelthief 31st December, 2006

55-60 fps? Har, I thought it only went up to 50. You have your MMF2 set to run more then 50 loops/second?
 
Posted by AndyUK 31st December, 2006

pretty good stuff,

it ran at about 35fps on low and about 12 on v-high for me.
 
Posted by Pixelthief 31st December, 2006

Hrmm, well I was planning to have a game centered around the "Flashlight" effect, which technically should run 4x as fast as the lamp effect, since its drawing 1/4 the triangles.

So I think I could pull that off on medium without lowering the FPS on anyones computer. Doesnt even flick below 50 on mine...
 
Posted by Jonny 1st January, 2007

If you want to make your engine even more powerful, take a look at the techniques used in this shadow engine: http://andos.stiaxies.net/examples/files/ShadowEngine.cca
 
Posted by Pixelthief 1st January, 2007

Yeah Ive seen Ando's work, but its actually extremely limited in comparison; his has no way of drawing a flashlight effect, no way of drawing a limited line of sight, no way of letting backdrops be obstactacles, ect ect. It just draws a shadow for each active object. I wanted to create a horror type of game, but realized nobody had created a practical shadow engine yet, so I had to do it myself.
 
Posted by Werbad 1st January, 2007

These things can be done with the engine... Save the backdrop data into an array and create shadows based on the array data (I made this so it is possible)
And for the flashlight effect, you can just Remove some parts of the overlay leaving just the flashlight cone (You should limit the shadow drawing to walls/objects inside the cone though)

 
Posted by Pixelthief 1st January, 2007

Still doesn't let it draw non-rectangular objects, though. Same problem with line of sighting active objects for visiblity; you'd pretty much need to have a raycasting system in place, anyway. I tried a whole bunch of modifications but basically its easier to make my own.

 
Posted by axel 1st January, 2007

Quite impressive. It ran at ~30 FPS on low detail and ~12 FPS on high on my comp. Would be nice to see this in a game...
 
Posted by Pixelthief 1st January, 2007

Well from the feedback im getting, im thinking I'll make my games screen 320x320, with flashlight effect and no lamp as an item; makes it creepier anyway. Hopefully then I can give low and mid as main options on a menu, and have them run at ~50 fps on most peoples computers
 
Posted by ben mercer 3rd January, 2007

"Yeah Ive seen Ando's work, but its actually extremely limited in comparison"

The opposite in fact. Andos's lighting engine was inspired by a lighting engine I posted that was almost exactly the same and I've done quite a lot of work with lighting effects since. My method used trigonometry to project the vertices on to a plane (the ground) which means that projecting shaped shadows is actually possible with a 3d shadow model.

Oh and a flashlight can be achieved without too much hassle. But beleive me, if you are looking for realism or versatility, the trig method is the way forward.
 
Posted by Pixelthief 3rd January, 2007

Yeah, I'm well aware of how it works, but the lighting effect doesn't work anywhere easily for the uses I wanted it; it requires the vertices of each shape it projects, which means any complex, non-square objects, such as people or active backgrounds, would be alot of a hassle to render; it also doesn't have any way to detect which objects are closer and therefore obstructing the line of sight of the character, so it also has no way of functioning as the accurate line of sight. This is pretty much more vital to my project then the shadows themselves, since I use it for enemy AI, such as enemies that can notice the light from your flashlight.

Anyway, both methods have pretty different applications. I personally liked the trig method, but I wanted to include curved surfaces and other things that just wouldn't work, so I decided to try out a raycasting approach to see what would happen. And it certainly worked in its own right. Just slower.
 
Posted by Dr. James MD 5th January, 2007

47 on low, 35 on high. Looks very nice indeed.
 
Posted by Pixelthief 6th January, 2007

So um, anyone know how to let the Overlay object in a scrolling frame? :/

I can't get the damn'd thing to update when the screen is scrolling. Sad cat.
 
Posted by ben mercer 8th January, 2007

Use the active overlay object.

Rendering shadows for AI is a bit overkill I think. It will be much faster and easier if you use hitscan detectors that shoot from each AI unit to the player character as long as you keep it optimised.

Besides, it is good practice to keep AI separate from rendering, because it generally gives you more flexibility for optimisation. Also it means you can make intensive rendering techniques optional to players with lower end computers.


 
Posted by Pixelthief 8th January, 2007

Ah, but I dont want AI that sees YOU, I want AI that only sees your flashlight. We're talking survival horror game here, where you can hide from the AI by turning your flashlight off.


Anyway, I'm planning on a game with only a single opponent; ie you are stalked through a mansion by a guy with a chainsaw. Hence he can hear see and feel you.
 
Posted by Pixelthief 8th January, 2007

Btw, thanks for the tip.
Active overlay works like a CHARM. Might even make detection easier, since I won't need to custom scroll.
 
Posted by Andos 12th January, 2007

Yes, my version was inspired by the StuckEngine tech demo. I figured out the math for my own version myself though.

Pixelthief:
I don't think my version is limited though, you can easily add other shapes if you want (check the isometric version) and not using active objects if you just keep a list of all the surfaces that should cast shadows. If you want a flashlight effect you just have to make the circular gradient get the shape of a flashlight cone and then rotate it accordingly.

Since that MMF1.5 version I also made a few improvements to the engine. It only draws stuff within sight (the first version you linked to didn't do that) and I optimized it to only draw the necessary shadows.
 
Posted by Andos 12th January, 2007

Sorry for double post:

Pixelthief: Interesting idea of only having one polygon bout your implementation has some problems. Instead you should try to detect all shadow casting objects within your light radius and then use it's edges for more accurate shadow casting.
 
Posted by Tharky 30th November, 2009

Can you upload it again? I really need this..
 
Posted by Pixelthief 30th November, 2009

Sure:
http://sites.google.com/site/claniraq02/ChainSaw4.zip?attredirects=0&d=1
 

 



Author

Favourite



Advertisement

Worth A Click