A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 31

Thread: [WIP] Flash doom-a-like.

  1. #1
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465

    [WIP] Flash doom-a-like.

    I worked on this some more and thought I would share the project in its current state. It has stabilized somewhat after adding the most recent round of new features:

    1. Support for sloped surfaces which are perspective correct (more or less).

    2. Faky displacement mapping for rendering liquidy surfaces, and underwater scenes.

    3. Support for sector-over-sector geometries for greater geometric freedom. I think the way this is implemented is pretty elegant. It basically takes the whole X-Y doom renderer, and makes it recursive along Z. By cutting a hole in the floor, you can expose a run of pixels which are then backfilled later with another call to the raytracer. Hard to explain, but it was literally two lines of code added that enable a whole new class of map geometries to be modeled. (Although it only changed map rendering very slightly, it greatly complicated the code for clipping moving things against the map, and hence the long delay between my last update and this one - one bugchase after another).

    There are debug lines added wherever this recursion takes place - in the doom-like regions, theres only a single pair of debug lines (one at the top, and one at the bottom) indicating that the whole scene was rendered in one-pass. But in the quake-like regions, there's debug lines all over the place, indicating the depth of recursion that was required to generate the scene. They'll be removed later, but it just looks really cool so it's in there for now.
    4. Mipmap-like behavior where textures viewed from long distances are low-pass-filtered to remove some aliasing problems (this is only a partial fix to the aliasing problem, but I found I could do this very cheaply so I threw it in).

    5. Fake "y-shearing" for limited up-down looking (changing elevation angle). I wanted this to be in there, because I want there to be tactical benefits for shooting the legs of an opponent vs. shooting their arms, or whatnot.

    There are regions of the map which test out these features individually (theres a pool of water you can jump into to test the underwater rendering, and a hole cut into a floor which you can jump from one sector down into another). And there's also an elaborate room containing catwalks, piers and vast cavities that sort of combines all the features together into a detailed scene. This room has a real quakeish feel to it - the only way you can really tell that this is not true 3D rendering is that it doesn't distort properly when you look up and down). Of course, the frame rate sort of tanks in that room - so I don't think I will do such intricate regions in the real levels.



    Here's a link to a zipped swf (200K). It requires a pretty good PC (18 FPS on my 2.4GHz box).

    http://esl.eng.ohio-state.edu/~rac/doom.zip

    And here's a link to zipped project source, if you want to muck around and see how it works. RaytracePanel is the real guts of the thing. It's heavily commented but it's still a long piece of monolithic source.

    http://esl.eng.ohio-state.edu/~rac/doomsrc.zip

    Bug reports welcome, but a lot of bugs are already known (particles don't fall through transparent floors yet, when the player moves the clipping is still a little off and sometimes you snap to walls somewhat weirdly - these are all to be addressed in the future). What I would like to hear about is any display bugs - I think they should be more or less ironed out. Like if an opponent pops up visible and you know they shouldn't be ... this is a serious problem that I would like to hear about. (screenshots welcome).

    Controls : Arrow keys move you, space shoots, shift/control looks up down.

    Enjoy Comment and critique welcome. I figured I don't want to get a reputation as someone who always badmouths 3D flash programs but never ponies up any work of their own! So... badmouth away!

  2. #2
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    I'm sorry, but I don't have any usefull information for you. I thought the water was awsome. It had this strange bug, though, when you would walk off the steep area into it and try to get to the farthest corner from there. You would teleport back onto it. Besides that I noticed no bugs in the one minute I ran through it.

  3. #3
    It's true..I brought sexy back smith1302's Avatar
    Join Date
    Sep 2005
    Location
    here
    Posts
    343
    hah thats very cool. Ive never seend anything that advanced in terms of 3d done in flash. simply amazing. And the water thing is sweet as well.

    -ggggggggreeaaaat jobb. If only i had the actionscript experience to understand any of it =]
    Hey check out my arcade sites!
    Ninja Games | WW2 Games

  4. #4
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Very, VERY good job.

    I only get your quoted 18 fps when I look directly into a wall. Looking more than a few metres ahead bogs down to an unplayable 8 fps. iMac G5, latest labs Flash Player.
    http://www.birchlabs.co.uk/
    You know you want to.

  5. #5
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Quote Originally Posted by VENGEANCE MX
    Very, VERY good job.
    Thank you It has a lot of time sunk into it... loads of love even though it's nowhere near a complete game yet. I really wanted water to be a part of the game somehow - waterfalls or pools or something - I felt like this added so much to quake over its contemporaries (and even added a lot of heretic, compared to doom).

    I only get your quoted 18 fps when I look directly into a wall. Looking more than a few metres ahead bogs down to an unplayable 8 fps. iMac G5, latest labs Flash Player
    I dunno much about Macs, although I think you've commented before that Flash is sluggish on them. That's too bad, but the engine is at least scaling the same. Looking at a wall is about 36 FPS on my machine, most of the map renders at about 20 FPS, and it slows to 15FPS for the really complex scene. So it's about a factor of 2 from simplest scene to most complex, same as yours.

  6. #6
    Junior Member
    Join Date
    Mar 2005
    Posts
    20

    Totally Amazing

    Man, I sort of thought that something like this might be possible in Flash, but until now, I haven't seen anyone whose actually done it. Kudos. The whole concept is crazy, and to see it done well (and even better - at awesome framerates: and yes, Flash runs slow on Macs - I used my friends once and it was even playing one of my low-resource games terribly) is astounding. The water effects are super crazy too - how did you do that, something in the BitmapData class I'm assuming?

    Anyways, I'm looking forward to the completed game. It's a great acheivement already.

  7. #7
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    The water effect is custom. Practically the whole engine is custom, it's a single-pixel-pusher and doesn't call graphics/bitmapData commands other than a 1-shot copy from a byteArray to a bitmapData, to get it from working ram to the screen/flash display hierarchy.

    The water ripple effect is a spinoff of the look-up down functionality. When you're out of water, every column of pixels is rendered using the same elevation angle. But when you're underwater, it perturbs the elevation angle used for each column by some slowly varying offset. (These offsets are sinusoidal in time, with the same frequency, and their phases taper linearly across the framebuffer as you walk along x). So every column of pixels sort of wanders up and down smoothly.

    This effect can be also done to a single surface, instead of the whole viewport. So that's how the floor texture is ripply when you're above the pool, looking at the water from the air. You can apply the same effect to a wall, like the teleporters in quake. They were ripply/starry backgrounds on a flat wall section. I think I will copy / imitate that effect later.

  8. #8
    Senior Member bomesar's Avatar
    Join Date
    Nov 2006
    Location
    Croatia
    Posts
    136
    Quote Originally Posted by rachil0
    I really wanted water to be a part of the game somehow - waterfalls or pools or something
    So you're making a new Crysis, right?
    I could not open it in Flash Player, I'm having some trouble with it for some time. But in IE7 I get 38 FPS while looking at a wall and from 20-28 FPS while moving around. 21 FPS in water.
    Amazing piece of work, I must say.

  9. #9
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    veery nice

  10. #10
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    sheezus, that is one insane amount of code, you must have a desk full of sticky notes

    awesome work though, been following this ever since you posted the first version.
    lather yourself up with soap - soap arcade

  11. #11
    When you know are. Son of Bryce's Avatar
    Join Date
    Aug 2002
    Location
    Los Angeles
    Posts
    838
    Awesome work man. Thanks for releasing the source as well (even though it makes my head spin).

  12. #12
    Filthy Gorgeous DancingOctopus's Avatar
    Join Date
    Sep 2003
    Location
    Sunny Australia.
    Posts
    478
    Fantastic! Seems like it's closer to the build engine (duke 3d, shadow warrior, various others) than doom or quake. Particularly the way you handle sector-over-sector feels very much like those games.

    EDIT. Oh yeah, framerates on my system averaged around 40fps. Never lower then 30, never higher then 50. I played it in firefox using the latest beta flash player. My system is an amd x2 4400. Impressive.
    Last edited by DancingOctopus; 10-16-2007 at 01:29 AM.

  13. #13
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    Stellar work, but I would see it more as bragging rights than game that I'd want to play on the flash platform. I remember seeing the beginning of this project in another thread, and I have to agree it's come a long ways. The water looks awesome but I'm kind of skeptical as to distorting the image so much underwater. The bending of images to the human eye is portrayed by a bend in the medium the eye views the scene through. A body of water, particularly the one in your demo, happens to be a solid, unfolded object, and would therefore not skew the image underwater, but merely from above the water to below. It's still awesome though. Oh and with FF I pushed 45~ across the board. I'm running a 4gb 4.3GHz system so that might be a bit overkill.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  14. #14
    Elvis...who tha f**k is Elvis? phreax's Avatar
    Join Date
    Feb 2001
    Posts
    1,836
    Rachil, after my rant about open source in another thread I have to say that you made my day

    The engine runs between 20-30 fps if I run, look into a wall or whatever (laptop 1,66gHz, 2GB ram...though I'm a bit sceptical about the ram...seems they fake it a bit and photoshop amongst others don't seem to identify 2GB)

    In contrast to IP I think this could very well become a nice game, and though I'm old school and Wolfenstein doesn't give bragging rights today, I can still play it for hours

    Very very nice job!
    Streets Of Poker - Heads-Up Texas Hold'em Poker Game

  15. #15
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Sloping tiles, wow!

    The water effect too, a little bit cracktro scroller heavy handed, but still stunning.

    Also different heights, that's so impressive.

    Good work mate, that's so much better than it should be for Flash. Wrap it up as an AIR app and I think adobe will be mailing you with proposals of marriage

    Squize.

  16. #16
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    it's cool.

    it's very cool, ultra cool, mega cool and stuff, but...

    why don't you all doom lovers finally team up instead of writing everything right from the scratch again and again, and give us at least one working game? look here. or here. I'm sure you know few more links to add. imagine all that time you spent on this thing working alone, routed instead into programming of actual gameplay elements. you could have the most visited online game by now.
    Last edited by realMakc; 10-16-2007 at 09:07 AM.
    who is this? a word of friendly advice: FFS stop using AS2

  17. #17
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    Quote Originally Posted by rachil0
    What I would like to hear about is any display bugs - I think they should be more or less ironed out. Like if an opponent pops up visible and you know they shouldn't be ... this is a serious problem that I would like to hear about. (screenshots welcome).
    Trying to be constructive:
    Last edited by realMakc; 08-21-2009 at 07:05 AM.
    who is this? a word of friendly advice: FFS stop using AS2

  18. #18
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Actually, I got into email contact with Max (author of Link#1) and picked his brains about his project when I was working on getting mine fast enough to be playable. And I even looked at the source trunk of his project, but I had a lot of trouble understanding it because it is so closely tied to the doom engine: WAD unlumping, BSP traversal, difficult to extend to sector-over-sector, lighting done as a table lookup, integer math that I didn't follow. DancinOcto is right, this is closer to the Build (duke3D) engine than the doom engine - and there are no existing conversions of the Build engine to flash that I am aware of.

    Really, I'm not much of an artist and a mediocre designer at best - it's the engine programming process that I enjoy the most. I don't really view this being a commercial project - just for my own fun. It's literally the 3rd flash app I've ever written, and the first 3D engine I've done in any language. I don't think I will ever do an online version, it's just going on my arcade standup once its fun enough to play and then I'll do something new.

    Thank you for all the feedback! I agree it is a lot of code - but every other line is a comment.

    @Squize: What does cracktro scroller mean? I sounds tongue in cheek

  19. #19
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Quote Originally Posted by realMakc
    Trying to be constructive:
    You know, I found this one too after I posted the .swf up. It initially scared the crap out of me, but I found it was incorrect map data. The polygon on which you are standing is degenerate and it confuses the ray intersection code (GIGO I guess). I corrected the map but didn't repost it.

    Thank you for the debugging vigilance. The corrected version is now linked.

    EDIT: The next big hurdle is a map generator so that I don't have to type all that crap in by hand. The map is hard coded in with about 1K lines of code, and that one room is about 800 of those. It's probably riddled with unfound bugs.
    Last edited by rachil0; 10-16-2007 at 11:01 AM.

  20. #20
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Oh sorry rachil0, showing my Amiga heritage ( And age ).

    It's a bit like a sine scroller that used to be used in every bootloader of every cracked ( crack-intro ) game for about 4 years, Klas did a sweet one in Flash,
    http://oos.moxiecode.com/flash8/demo_scroll_bmap_2.html

    And back to the thread

    Squize.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center