Stolfenwein 3-D - RayCast Engine for Construct2

0 favourites
From the Asset Store
Make your dream action platformer game effortlessly with this template!
  • I solved this apieriantly I set iamge points wrong and thats made it render wrong now it works

    No need to worry.

  • Hello I just gonna ask for pure optimization questions.Is it possible to render not in 640x360 resolution but something smaller like 1/4 of that because I need really long rays for some places due the fact its kinda open world kind project. I saw in your teasers that you have textures on floor and ceiling so if its plugin or something else? Will this engine transparency? Because if will then I could use just walls for roads in my project.

    Thanks.

  • Colonel Justice do you have a c3p files about this ray cast method? Can you share this for construct 3? Thanks.

    Still working on it, I'm having not that much spare time for the last couple of months, business and private-wise, so there might be a c3 example in some time, covering the basic methods.

    The C3 version also is using a different raycasting method which eliminates the distortion artifacts you see in the C2 build. Reason is that I was following the Permadi method, which is not built on vector math, which you should use.

  • Hello I just gonna ask for pure optimization questions.Is it possible to render not in 640x360 resolution but something smaller like 1/4 of that because I need really long rays for some places due the fact its kinda open world kind project. I saw in your teasers that you have textures on floor and ceiling so if its plugin or something else? Will this engine transparency? Because if will then I could use just walls for roads in my project.

    Thanks.

    You can basically lower the project resolution and tell via global variables to use fewer rays, e.g. 320 px. Therefore you could utilize longer ray distances. The key performance boost is to test against fewer instances. The C2 version uses sprites as walls, and you have to test against each instance.

    The C3 version uses a single tilemap object (as showcased in the Youtube videos), which is a single instance. With some clever math figuring out the texture and wall angles, this means a massive performance boost.

    The floor and ceiling textures are not raycasted. In fact, they are rendered through sprites with the mode7 effect applied, then more or less correctly altered through player position and angle.

  • Hello I just gonna ask for pure optimization questions.Is it possible to render not in 640x360 resolution but something smaller like 1/4 of that because I need really long rays for some places due the fact its kinda open world kind project. I saw in your teasers that you have textures on floor and ceiling so if its plugin or something else? Will this engine transparency? Because if will then I could use just walls for roads in my project.

    Thanks.

    On transparency: Unfortunately, the engine to date cannot render (semi)transparent walls effectively. That would mean, for each ray, you would have to test against walls until the ray hits a wall that has no transparent texture component, then stack each transparent wall and render it to a, for instance Paster instance, including the last hit wall which has no transparency. This is not feasible right now with C2/C3 plugins and would require a plugin to be written from scratch. Again, time is of the essence.

    The semitransparent components shown in the Youtube showcase are composed of striped sprites spawn in the correct order, e.g. the gate style textures you can see before doors, the laser fence, etc.

    Again, while this works in principle, it takes a heavy toll on the engine performance. I have yet to figure out a clever way to create and render these walls at runtime.

  • > Hello I just gonna ask for pure optimization questions.Is it possible to render not in 640x360 resolution but something smaller like 1/4 of that because I need really long rays for some places due the fact its kinda open world kind project. I saw in your teasers that you have textures on floor and ceiling so if its plugin or something else? Will this engine transparency? Because if will then I could use just walls for roads in my project.

    >

    > Thanks.

    You can basically lower the project resolution and tell via global variables to use fewer rays, e.g. 320 px. Therefore you could utilize longer ray distances. The key performance boost is to test against fewer instances. The C2 version uses sprites as walls, and you have to test against each instance.

    The C3 version uses a single tilemap object (as showcased in the Youtube videos), which is a single instance. With some clever math figuring out the texture and wall angles, this means a massive performance boost.

    The floor and ceiling textures are not raycasted. In fact, they are rendered through sprites with the mode7 effect applied, then more or less correctly altered through player position and angle.

    So using Mode 7 I could create floors. OK I have plugin and effect but in video is this repeated texture or one large? because for creating road like effect I'll need use large texture or chunks of said texture? And how proper use that effect because I kinda tried but if I set it as one its just white floor or just flys in very quick speed, anyway mode 7 for floor.

  • > > Hello I just gonna ask for pure optimization questions.Is it possible to render not in 640x360 resolution but something smaller like 1/4 of that because I need really long rays for some places due the fact its kinda open world kind project. I saw in your teasers that you have textures on floor and ceiling so if its plugin or something else? Will this engine transparency? Because if will then I could use just walls for roads in my project.

    > >

    > > Thanks.

    >

    > You can basically lower the project resolution and tell via global variables to use fewer rays, e.g. 320 px. Therefore you could utilize longer ray distances. The key performance boost is to test against fewer instances. The C2 version uses sprites as walls, and you have to test against each instance.

    > The C3 version uses a single tilemap object (as showcased in the Youtube videos), which is a single instance. With some clever math figuring out the texture and wall angles, this means a massive performance boost.

    >

    > The floor and ceiling textures are not raycasted. In fact, they are rendered through sprites with the mode7 effect applied, then more or less correctly altered through player position and angle.

    So using Mode 7 I could create floors. OK I have plugin and effect but in video is this repeated texture or one large? because for creating road like effect I'll need use large texture or chunks of said texture? And how proper use that effect because I kinda tried but if I set it as one its just white floor or just flys in very quick speed, anyway mode 7 for floor.

    The best bet is to use a single big texture. You have to flip the image / rotate it though, as the sprite gets transformed by the mode 7 effect.

    Also:

    You have to factor in the players viewport angle.

    Therefore :

    mode7 x: Player.X / scrollingfactor + cos(Player.Angle)

    mode7 y: Player.Y / scrollingfactor + sin(Player.Angle)

    scrollingfactor is related to player viewport height and screen resolution / mode7 object height and has to be tweaked.

    Also keep in mind for FPS purposes, the horizon line has to be at Y viewportheight /2.

  • OK so I decided to imply mode7 into a project but got into a problems with my knowledge level. So this is how it looks with single image set 0

    Texture size

    So what I need to do to make this texture to work properly because I can't find any way to make it possible. Car and camera are two different objects, car is rendered on screen like any other object. If you could just make example of event I would be grateful if not well I am gonna just make road black and set game at night.

  • I too use Mode 7 to do floors and ceilings, and it works pretty well after manually adjusting the numbers a lot, but it's not "rock solid" like actual floor casting.

    When turning the floor angle drifts a little.

    For a while when I got the scrollfactor right for moving forward or backward, then side to side motion is f-ed up. There's a "just right" kinda balance I found but the angle thing still happens.

    I got it to be not that noticeable, but it would be nice to get it spot-on. In fact that would open up possibilities like having more than one level.

    Also really interested in how you get a performance boost with the tilemap. I get 60 fps with not a ton of objects, but it goes down with any higher resolution than 256 lines.

  • I too use Mode 7 to do floors and ceilings, and it works pretty well after manually adjusting the numbers a lot, but it's not "rock solid" like actual floor casting.

    When turning the floor angle drifts a little.

    For a while when I got the scrollfactor right for moving forward or backward, then side to side motion is f-ed up. There's a "just right" kinda balance I found but the angle thing still happens.

    I got it to be not that noticeable, but it would be nice to get it spot-on. In fact that would open up possibilities like having more than one level.

    Also really interested in how you get a performance boost with the tilemap. I get 60 fps with not a ton of objects, but it goes down with any higher resolution than 256 lines.

    What kinda formula you used because mine is getting proper speed and angle but location on texture is way off.

  • The location on the texture is based on the scale x and scale y. I haven't done it on C2 --for that, I've only had just infinite scrolling the same texture floor so location didn't matter.

    Also For C3 I had to set the max sprite sheet size to the texture size for the floor/ ceiling or it would get other object textures mixed with it..

  • imgur.com/a/ofwBY7b

    getting this error in latest c2 version on testing.

    also shooting and axe slashing wont deal any damage to enemies. is that normal ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Update 0.5

    This ain't dead just yet!

    Features / useful additions

    • Particle system composed of billboard sprites
    • Sprite & wall world placement are now calculated from inverse transformation matrices - removes a couple of displacement issues
    • Floor & ceiling rendering
    • 3d bullets - projectiles can bounce in 3d space
    • 3d raytrace for hitscan weapons
    • Objects have height(depth) on Z-axis (collision detection)
    • Looking up/down + mouse aim
    • Texture precooking engine (set ambient, diff color, texture maps, then at level start the slicer will load the texture in the raycasting image banks)
    • Fake lighting using Tint / Tint Mask effects
    • Colored distant fog + weather effects
    • Post processing: Aiming motion blur

    Some eye candy

    Cheers!

    thanks for the update post but wheres the capx ?

  • imgur.com/a/ofwBY7b

    getting this error in latest c2 version on testing.

    also shooting and axe slashing wont deal any damage to enemies. is that normal ?

    Hi, You get error due somewhat broken mouse or look behavior I have this one too and developer maybe fix it sometime later when he is going to port engine to C2. Right now I think this example is just to make stuff render in Wolf 3D manner. Engine is still early in development. So I think you could just use it for rendering walls and objects while the rest you could make yourself like I did. I hope this answers your questions.

  • Check weltenschmid's fix on the mouselock behavior:

    Aw crap, can it be that posts randomly get deleted? Just posted the solution and a minute later the post was nowhere to see... might be that it suddenly may appear again. My post count is on two but the search just shows one?!? Schräg!

    Okay, got the quick fix. Just saw that they realized it as well in the MouseLock forum section and are working on an update. For us it's simple: Go to the the Construct 2\exporters\html5\plugins\MouseLock_Ver_0.5 Folder open runtime.js and at line 440 comment or delete the following lines:

    document.pointerLockElement =	/*document.pointerLockElement 	||
    										//commenting out the above line makes this work as intended. Don't know why.
    										document["mozPointerLockElement"]	||
    										document["webkitPointerLockElement"];[/code:u8ds4d4m]
    That does the trick! If you feel like tidying up you can set the MouseLock Object's property to single click and remove the left click event. 
    
    By the way, the RealDanyyy used the situation to his best and promoted his MouseLock plugin: [url]https://www.scirra.com/forum/new-simple-native-like-mouselocking-plugin_t199484[/url]
    Might be of interest to you?
    
    So now I feel like tinkering! Cheers! 
    
    -------
    
    Update: Didn't knew if it was me or was it just an illusion that you had hitting scenes in your screen shoots I thought. So I sought for the source of the missing hit. Don't know why you are setting the bullet's targets at the start of the layout and not at their creation time, but after changing it, the striking and shooting works again! Woot! 
    
    [img="https://3.bp.blogspot.com/-Kdg_N1ENIgg/WrAkYdj7C-I/AAAAAAAACFE/YlXo_Dj9qWEbu4bI-Nww5okTrjwPB-LzACLcBGAs/s640/bulletOnCreated.jpg"]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)