Colonel Justice's Recent Forum Activity

  • > > 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.

  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello again I fixed problem with walls they now render but wonky.

    and in middle they look like one side is further than other.

    Thanks in advance.

    This looks like either math is wrong or a pixel rounding issue (wall render stripes being not integer widths).

    Which files do I have to look at in your shared folder?

  • Consider my reply before:

    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.

  • This is because the effect code is not properly written for C3. It will consider the whole spritesheet where the texture is packed in.

    I used to work around this by using 1024x1024 textures for the mode7 effect and then setting the max spritesheet size to 1024 in the project settings. This will ensure that the mode7 texture is always the only texture on a spritesheet.

  • 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.

  • I would check conditions inside the damage function, and then launch animations subfunctions whatever accordingly.

    My experience is that if you funnel everything through a damage function, you have a single point were to debug later on.

    Best example is the classic of the player being alive with negative HP. Not saying that it happens in your game but in general. To prevent this from happening, you have to put an event somewhere in your code that checks if the player health is 0 or below. Then do stuff. Not only do you need to put it in the right place in the event order, but it will get called every tick even if not needed.

    A better way would be to check it only when needed, and that is inside the damage function, because intrinsically the function only gets called when needed (mainly collisions, overlaps).

    The "downside" is that you should let the player only lose health through the damage function then.

    I played your example a couple of minutes and didn't seem to run into any problem but again, maybe I was missing a certain constellation that makes this happen. Overall I would vouch you go with damage function generalization. E.g. also do the player damage stuff with progress bar from there.

  • Thanks, I've been looking at the code and trying to understand what you want to achieve.

    Right now you have the functon "damage" that only seems to handle damage dealt by the player to enemies.

    You got several hitbox objects that contain the damage value depending on the attack I suppose, and try to retrieve the correct damage value inside the function (for each playerhits : substract damage, etc).

    You should abstract the damage function in order to make it more universal. That means no object picking inside the function other than UIDs. The reason is, how the function is built now, it won't work in the absence of playerhits (the loop would run 0 times).

    Also, I think by Construct's picking laws, every shuriken would get destroyed. If you later decide to have more than 1 shuriken on screen at a time (power ups etc.) this would be a source for bugs.

    The basic function setup is fine, however I would extend it to a certain degree.

    Think of what can cause damage in your game (enemies, shurikens, sword strikes, etc). Create a family, put all relevant objects inside and name it "damagedealers" or something. Attach a variable damage to it and set it accordingly across all objects.

    Think of what can receive damage in your game (player, enemies, destructible objects), put all relevant objects inside and name it "damagereceivers" or similar.

    Then in your damage function, add number paramater "source" or something.

    Now you are able to build more generalized damage events.

    Handle the rest inside the function.

    For example, create a basic collision damage trigger.

    ->On collision damagedealers with damagereceivers: Call function "damage" , passing damagedealers.uid as source and damagereceivers.uid as target, damagedealers.damage as damage

    Now you got everything you need to work with inside the function.

    For example, you can let the player lose health, let the enemy lose HP, destroy the shuriken, etc.

    On function damage ->

    "damagedealers": Pick instance with UID source:Do generalized stuff valid for the whole family. E.g. play hit sound.

    "damagereceivers" Pick instance with UID target: Do generalized stuff, e.g. substract HP or play hit

    "shuriken" Pick instance with UID source: Destroy shuriken

    "playerhits" Pick instance with UID source:

    ---> "playerhits" is sword-> spawn damage on layer main etc.

    "hitbox6" Pick instance with UID source: Destroy "hitbox6"

    Etc.

    The key point is to have every sub event using UID instance picking to get the desired object.

    I hope this helps.

    P.S.: Cool prototype!

  • Please share a sample c3p that we can work with together.

Colonel Justice's avatar

Colonel Justice

Member since 16 Mar, 2011

Twitter
Colonel Justice has 10 followers

Trophy Case

  • 13-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies