# zenaple

Member

5

108 Neutral

• Rank
Newbie

• Website
1. ## Ray Casting for Points _Behind The Camera_

In a nutshell, I have a ray casting engine that uses rotation and some trigonometry, not matrices (vector math). I'd like to add something that draws a line from any two points, but when one of those points is beyond the viewing plane, it goes bat-attack crazy (skyrocketing in terrible directions). Imagine shooting an arrow, but if one end of the arrow is outside the screen, it stretches the arrow obscenely, obviously not accurately representing the point anymore. This is a fake 3d world after all, such as wolfenstein. The calculation that's taking place for the verticle "z" axis is mearly scaling an arbitrary value. I haven't found any information that addresses this, but after looking around I'm suspicious that using matrices might be the solution. I'd like to avoid having to learn that or adapt the engine I've already made, especially if that isn't the solution, or the only solution. Here's some of the code I'm using: pLoc is the x,y of the camera. mLoc is the x,y of the point. pRot is the rotation of the camera. pHgh is the height (z) of the camera. mHgh is the height (z) of the point. On the grid, x increases to the right, and y down. The grid scheme of the world is 128 pixels, and that's also the max height for the camera. The screen is 320 by 200 pixels. And this is being coded for shockwave, although what I'm trying to understand would be the math of it.   xxx = pLoc.x-mLoc.x yyy = pLoc.y-mLoc.y   moo = atan(xxx,-yyy)*(180/pi) if moo < 0 then moo = moo+360   tmp = pRot+120-moo if moo < 180 and pRot > 90 then     tmp = tmp-360 else if moo > 180 and pRot > 270 then     tmp = tmp-360 end if   m = sqrt(power(pLoc.x-mLoc.x,2)+power(pLoc.y-mLoc.y,2)) m = m*cos(pRot-moo)*(pi/180)      -- eliminates "fisheye" from distance   boo = (tmp*-320/60)-160           -- this is x spot on screen (x,y in world) poo = (64-pHgh+mHgh)*(300/(m))    -- this is the y spot (vertical z in world) goo = 128/m*2                     -- this is a converted distance for sizing.   Again, if the point goes off-screen, its position goes crazy: it's not being represented correctly. If the answer really is that this would work with vector math, that's fine, but if there's any chance to even fake it in this approach, I'd very much like to discover it. I would cherish any ideas or information that lead to the capture of a strategy (hopefully something extremely simple). Thanks. Hugs.
2. ## Maia - Revenge of the End of the Line

Oops, update version 2 - A few more minor changes.   Live on the site, but here's the new zip file attachment.
3. ## Maia - Revenge of the End of the Line

New website:  http://heartofeternal.org New update:  http://heartofeternal.org/ark/maia.zip   2014 release notes: Fixed:  -- Spider web properties.  -- Ring properties.  -- Bug preventing light checks.  -- Bug preventing boink spell.  -- Some spelling errors.  -- Rare infinite loop bug.  -- Time constraint lengthened.  -- Misc changes. Added:  -- Mageslayer class.  -- Nymphomaniac class.  -- Magic Valley area.  -- City of Midgar area.  -- Misc areas and items.  -- 2 additional races.  -- Additional key codes.

5. ## Maia - Revenge of the End of the Line

Needing some beta testing if you're adventurous. Sourcecode for shockwave if interested in developing. Explore, and hopefully stop the end of the world, which will destroy your game after a few hours (although you can play over again and continue the same character). This is a text based, single or multiplayer game with a graphical element. There is an executable version to download, or you can play on the web by going through an animated loader program in shockwave. My apology that the site is free hosting, so please don't mind the advertising. Download: http://jerniwerks.an...re.com/maia.rar Browser: http://jerniwerks.an...com/arcade.html Sourcecode: http://jerniwerks.an...ire.com/mia.rar I've tested it to death recently and fixed several bugs. I'm trying to find more people to play it and report some feedback. I'm very interested to know the game balance for someone who's never played it, or any possible way to cheat in leveling up. Let me know what you think. Thanks for sharing, enjoy the day, and cheers.