Stolfenwein 3-D - RayCast Engine for Construct2

0 favourites
From the Asset Store
75 vehicle sound effects, from real looping car engines to jet aircraft and sci-fi engines.
  • hoobydoobydoo i hope we don't get sued

    Original Post below.

    Instructions and download links follows after the screenshots.

    This is the first release (0.48) of the engine. Please leave your comments, suggestions, death threats whatever as a reply to this thread.

    Features

    • 3D raycast framework for Construct 2
    • 360° first person raycast rendering 320x180
    • Pixel perfect wall rendering without classic raycasters 90 degree wall constraints (Wolf3d)
    • Uses Chipmunk physics for movement of game objects
    • Billboard sprites in 3D translation
    • Effect sprites, static sprites
    • Correct Z-Buffering of walls of sprites
    • Uses Tint shader to for directional wall shading
    • Basic enemy AI
    • HUD functionality, FPS weapon display
    • Basic weapon & health pickup routines
    • Commented code (right now partly, will be completed in the next release)

    Credits & prerequisites

    Cudos to the authors of the following plugins and effects. Without them, this thing would not have been made possible.

    Note: You have to install these before you can work with the CAPX.

    Get it at https://drive.google.com/open?id=0B5HnHqVYzkImck1uSmlkUGJ5VHM. Thanks to adcornaglia for the reupload.

    All other used plugins, behaviors *should* be onboard. If not, please contact me so I can add them to the list.

    Uses various sprites from realm667.com, a Doom resource site. Thanks to the authors, whoever, wherever and when ever they may be.

    General instructions

    The rendering logic utilizes the seamless shader. Altering one of the following will break the rendering.

    -Changing the project's full screen scaling to High quality

    -Changing the window size to something else (1280x720 for example).

    You *can* do that, but probably have to change the global variable ResX accordingly. This is a bad idea because it will blow up the perfomance. So don't do that.

    Download the CAPX

    Current version 0.49 - https://drive.google.com/file/d/1e98t3LA-LmKZJBSuiVTIXttxCYefXdIC/view?usp=sharing

    Changes:

    Replaced castline objects with trigonometric calculations for performance gains

    Disabled tint shaders for even more performance gains

    Removed MagiCam object from the project (was deprecated)

    Removed Quad Shader FXs from project (was deprecated)

    Past releases

    Version 0.48. - Initial release http://www.fightingspace.com/wp-content/uploads/2018/02/stolf3d_048.zip

    Stuff to do next

    • Tie map objects to chipmunk behavior
    • Make breakable map objects
    • Make the player die at 0 health
    • Implement trigger areas
    • Implement switches, keycards, etc.
    • Improve performance

    + your suggestions

    Thanks for your interest in this project.

    Cheers!

    -------------------------------------------------------------------------------------------------------------------------------

    Original post:

    -------------------------------------------------------------------------------------------------------------------------------

    After tinkering for two days or so I came up with a first draft of a raycaster engine.

    It's nowhere near completed but here you have it, what has been made possible with plugins in GameMaker and Multimedia Fusion can as well be accomplished in Construct 2 (or 3 for that matter). So it's more like a proof of concept right now, but it has some capabilities that already exceed Wolfenstein 3D's raycaster (well, after 25 years... )

    Current features

    • Can render any angle on the z axis with correct perspective
    • Renders different textures
    • Walls can be of any size (x/y) and angle
    • Colored / Tinted textures
    • Animated textures
    • Raycaster renders pixel-perfect overlaps (the cross on the screen is composed of 2 wall blocks)
    • Fog depth rendering of any RGB color and range

    Current limitations

    • Framerate locked to 30 fps
    • 320x180 viewport
    • FOV of 60°
    • Can't z-buffer transparency... yet
    • Fixed wall height to 64px

    Planned features (phase 1)

    • Rendering floors and ceiling
    • Rendering sprites (need to tackle z-buffer rendering, back-to-front)

    Planned features (phase 2)

    • Enemies
    • Decoration Sprites
    • Weapons
    • Pickups
    • If there's enough interest, I'll turn it into a template

    Planned features (the far future)

    • Z-movements
    • different wall, floor & ceiling heights

    Bombs away!

  • looks interesting

  • Cool. Are you working on a plugin or are you doing this with events only?

  • Currently it's events only, and therefore the performance is quite sluggish. I must admit that my plugin development skills are limited.

    I do this mainly as an excercise and to understand the concept of raycasting.

    The main routine uses the following plugins:

    LoopIterator

    EventBalancer

    Paster

    Trace

    So what it basically does is it does a loop times the horizontal width (in this case 320px = 320 iterations). Within the loop the trace object retrieves angle, distance, texture of the wall etc. for each vertical pixel slice respective to the player's angle, then uses a first 1px wide Paster object to paste the object texture on, then move the Paster to the calculated position on another paster (the viewport), and then finally y-scale the 1px paster accordingly and paste that onto the viewport paster object.

    Although I think the math is fast enough, clearly the bottleneck is the pasting on the viewport. So in order to maintain 60fps game logic, I use LoopIterator & EventBalancer to slice the mainloop in to digestable chunks and set it to be completed every 2nd frame (that's why it's 30 fps at the moment).

    There's probably a better way to do this, but I still have to figure out on how.

    If you want I can clean the capx and post it for you to try.

    Best would be maybe to have some sort of interface plugin for the pasting (not doing it in events)

    Also there's no floor ceiling pasting as of yet.

    What would also have an impact on performance is that it doesn't check z-buffers yet. So in order to render sprites, I would first have to test if the cast ray hit a non-transparent object (wall). If so, render. If not, write the information in a z buffer, then continue until a non transparent object is hit. Then render from back to front according to the z-buffer.

  • Consider me hyped

    Would love to have this as a plugin to make some dungeon crawling happen.

  • Just a quick heads up,

    I improved the performance 200-400%, so it runs at 60 fps with 40% single core CPU workload.

    Right now, sprites and z-sorting are getting implemented. As the engine is set up, I'll be scrapping translucent walls.

    Also I need to find a way to efficiently implement floor and ceiling casting. As this is doneper-pixel (vs. per stripe as for the walls), it's much more expensive.

    I'm planning on releasing a first capx when the sprites are done though.

  • Just a quick heads up,

    I improved the performance 200-400%, so it runs at 60 fps with 40% single core CPU workload.

    Right now, sprites and z-sorting are getting implemented. As the engine is set up, I'll be scrapping translucent walls.

    Also I need to find a way to efficiently implement floor and ceiling casting. As this is doneper-pixel (vs. per stripe as for the walls), it's much more expensive.

    I'm planning on releasing a first capx when the sprites are done though.

    Sounds amazing, I'm looking forward to seeing more of this. Keep up the great work!

  • Next update

    -Sprites are working, sprites have also correct Z height display and depth buffering

    -Got depth buffering with walls to work

    -Initial HUD layer with weapon display (ripped from zdoom's forums, credit goes to the author)

    -Furthermore I designed the initial rendering method from scratch. The drawing now doesn't use paster anymore which alone is a performance boost. The engine now only relies on raycasts and Nobody's seamless effect - and of course some math

    -Engineered a "primitive" routine to generalize map wall objects. For now we only have rectangles, which still has some overhead, e.g. invisible sides of the rectangle still have to be considered in finding the render candidates. Next roadmap goal is to use multipoint polygons instead. In a later editor, we might be able to draw the map in some Doom / Build engine fashion.

    The scene in layout editor:

    Stay tuned!

    Edit: Fixed broken image links

  • Great work! I can't wait for test

  • Due to some demand, I'm still working on it, but with rather little time on my hands right now.

    So I'll clean stuff up a bit and upload a capx end of this week or beginning of next.

    Cheers, and thanks for your support!

  • Due to some demand, I'm still working on it, but with rather little time on my hands right now.

    So I'll clean stuff up a bit and upload a capx end of this week or beginning of next.

    Cheers, and thanks for your support!

    Looking forward to it!

  • Gonna follow this for educational purposes! I tried this myself once.... wen't horribly wrong. So I'm excited to see how you did it!

  • Updated the original post with recent information, screenshots and initial download capx.

    Inception style link https://www.scirra.com/forum/viewtopic.php?f=180&t=197735

    Cheers!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This is great work! anyone know where I can find the Effect 'Fog' by Pawel Brzozowski ? (It's the only one missing though I can still play the game)

    EDIT: found it here

  • Updated the original post with recent information, screenshots and initial download capx.

    Inception style link https://www.scirra.com/forum/viewtopic.php?f=180&t=197735

    Cheers!

    Really cool stuff! Will you be continuing this experiment? I'd love to see how you'd handle floors and ceilings! Hmm, I wonder how you would go about improving performance to make this engine a bit more viable for a fully fledged game.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)