Maybe a 3D stencyl game instead?

ceosol

• Posts: 2271
New version is up. For now, I just have the walls (and ceiling/floor) stop rendering when they are partially behind you.

If you turn around completely, the controls start getting a little wonky, but I think I can fix that.

Right now you are in a little box room. I need to come up with some new calculations for having turns and corridors. But that also means figuring out the rendering order.

ceosol

• Posts: 2271
Still having problems with clip plane and render order. So I decided to take a break from the walls and work a little bit on fps mechanics. My bullets are working nicely. I have the graphic shrink to 0 really quick instead of having all of the bullet scaling calculations. The Z-axis calculations are still performed and it keeps your original firing angle, so the bullet travels in the same direction even if you are turning.

I started on enemy calculations. I don't have enemy distance scaling yet. And they only come at you in the Z-direction right now - chasing you from behind or coming at you from the front. If you strafe left of right, they sit there not knowing what to do. Tomorrow I'll get X-direction chase.  I'm going to forgo Y-direction for now until I can figure out the yaw calculations. So unfortunately, there are no vampire bats or whatever.

After the X direction tomorrow, I'm going to figure out what I can do for a hit box. Since the bullets have straight vectors, it might be easiest to calculate hitbox off of them. I could say "if z of bullet = z of enemy" and then say x +/- 2. Although a 5 pixel hitbox might be too small. I'll have to test it. Hopefully I'll be able to upload a new version tomorrow so everyone can take some target practice.

CmdrWhitey13

• Posts: 503
If someone can figure out how I can write this to find the intersect of the line with the field of vision, I'll go back to the room.   I am neither a mathematician nor a computer scientist, so I don't have a clue.

typedef Point =
{
var x:Float;
var y:Float;
}

public static inline function cross(p0:Point, p1:Point) : Float
{
return p0.x*p1.y - p0.y*p1.x;
}

Hey man. Might have found something for this. Might be hard to implement in stencil, but seen as we both past boundries, you might be able to get it to work.

ceosol

• Posts: 2271
I just opened it and it seems to follow with an idea I had last night right before going to sleep. At a 90 degree angle I could have the wall containing a sliding point equal to player x or z coordinates - overriding the original x,y,z calculations. All I need now is to figure out mathematically what how that fits into a formula and it should work even when turning. The .pdf has a bunch of perspective calculations in it that might just fit the bill. Thanks!

ceosol

• Posts: 2271
Totally thought I would have more time to work on this today

In the past 2 hours, I tried my best to get the promised update together. The target chases you in the x and z planes, although the x movement seems to mess up a tiny bit when you are turning.

I also added the hitbox to the target. I thought it would be an easy thing to implement, but forgot that the target would get bigger and smaller so the hit box would also need to scale. After much trial and error, I am happy with the hitbox. Further away, the box is a little bit larger than it should be, but that isn't a big deal. At least you can't hit it when you are facing the wrong direction.