Ruskul's Forum Posts

  • - Layers do affect performance. They affect it a lot.

    Create a new project and run in debug mode. Don't add anything to the scene: no events, sprites, or anything. Note FPS and general CPU usage.

    Now add 15 layers with no effects or anything: 15 simple default layers. Now run the debugger. For a real performance "Kick in the groin" try adding an event to rotate the layout every tick.

    TLDR - Blank layers, without any FX, special blend modes, or objects, decrease performance markedly. Start doing things with those layers and the performance decline is sharp. The tests are easily created and I have made many of them.

    Regardless of what you do with a layer, there is a performance overhead. I don't know why the engine works like this, but something is being done to those layers or calculated every tick that slows things down.

  • From the manual

    Physics Actions

    Set stepping mode

    Choose whether the Physics time step uses dt (delta time, for Framerate independent) or a fixed value. By default it uses a fixed time step to eliminate any randomness or instability coming from dt, ensuring simulations are exactly reproducible every time. Set to Framerate independent to adjust the time step according to the framerate, which can cause the same simulation to have different results if run twice. Note even when in this mode, the behavior clamps the maximum time step to 1/30 (about 33ms, equivalent to 30 FPS) to prevent the instability that can result from large time steps. For more information see Delta-time and framerate independence.

    Thanks, but if you read my post you would know I had read the manual. dt does not work as expected when used in a time-frame independent way. This means the manual is either right and I found a bug, or the manual is wrong and does not reflect how things are actually working. Either way it probably needs Ashley's attention. I cannot actually conduct a meaningful scientific experiment without being able to control max framerate and nobody has been able to tell me if that is possible.

  • Ashley ? could you help me out with this one? Do I use dt with physics? And... can I force a max frame rate. Why would my computer cap the fps to 40 most of the time but cap at 60 the other times. Can I set that cap manually?

  • - I forgot to mention my test levels only had 6 layers and 1 effect. It was still running at 30-35 fps. I may be able to say whatever and fly with it, but I am afraid I am already at the lowest I want the game to be running at.

  • How big a game are you talking about here? I find on PC/MAC, performance is really good and you have to really try (or just use way too much WebGL effects) to get it to run slow.

    Well, I am testing my game on what I would call " an average laptop" (i5, 4 gigs oh ram, integrated graphics); Basically, nothing special.

    My game *needs* 16 layers at least. I would like 24, but I managed to get it down to 16. Adding layers to a game chews at performance... I don't know why though? I thought layers were more of a organization tool. Anyway, I do have multipple render to texture layers with effects, and yes, I do *need* them. Without them, my game would lose what makes it "original". Without my layers, my game is essentially another mario jumping on stuff...

    Once you have that many layers, and you do anything to a layout, performance tanks.

    So I am at a crossroads... compromise (which we all have to do when making games anyway) or try a different approach... that being working in 3d space on an engine not built around javascript.

    I have been trying to see if it is worth the switch in the last week or so, but idk. Life is tough. Then you die. In the meantime I'm stressing over this.

  • Hey everyone,

    I have noticed a few things about construct 2. I have a feeling you all have too- if you have tried to make any large projects... (large being a relative term, obviously SC2 is large but for the sake of construct lets say large is MetroidFusion/Yoshis island)

    Construct2 is really fast to work with. I was sold on it a day after I bought it and I still haven't changed my mind about how awesome it is. That having been said, there is a number of things that start to get in the way/ decrease potential productivity. These are....

    1. Events are tied to a singular project. It is next to impossible or practically a nightmare to try and re-use functionality from one game to another. As it is, event sheets can get increasingly long as a project goes on. Sure you can split them up and call them, but that isn't very handy. It's like construct was made for smaller games and hasn't realized its potential.

    Event files should be able to be prototyped and plugged in to any project. If you want flexibility like that currently, then you need to be able to javascript your own plugins. Cool and all, but honestly there is very little documentation or help doing so. And at that point... you may as well be working in unity- as it has a much better system for that sort of workflow (meaning construct isn't as fast anymore).

    2. Functions need to be able to be called in the same manner as referencing an object- that is, they need to be included in some sort of conclusive, auto-completed menu system. As it currently works, you have to remember all your function names and spell them correctly... not to be high and mighty, but as a programmer that is computer work. having function names not being able to be in a hierarchy of calls is also silly. Having to type in "player_somefunction()" every time you need to call it can get old. Especially when you end up typing "plyaer_somefucntion()", or something similar. Instead of the event editor telling you you have made a bad call, you spend precious time trying to figure out a logic error that doesn't even exist.

    All in all, construct is amazing at what it does, which in my mind is creating smaller scale games quickly. But it starts to lose its edge when trying to create much larger scale games. I actually had to switch to unity for my current project after half a year with construct2. In the end, the scope of my game was too great for javascript/html5 and I was getting serious framerate problems. (I was using too many layers, but hey, I need them to organize and create levels efficiently.) Also being able to quickly create scripts and attach them to various objects is wonderful and efficient.

    I will still use Construct2 for small projects and prototyping, but I can't see trying to undertake a mammoth project again.

    Any Thoughts - agreements/disagreements ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Physics is Box2D and is not part of the C2 internal systems. Box2D has it's own timestep system.

    jayderyu - So, Does this mean I shouldn't use dt when applying forces, torques etc?

  • Hey everyone,

    I have a game where I set physics to framerate independent. I apply impulses without dt (as they are a one shot and dt doesn't matter). When I apply forces, I use dt (ex. Apply Force (Gravity*self.mass*dt at angle). I thought this is correct. According to the article written by Ashley on dt every behavior with the exception of physics has dt built in.

    But, as it turns out, after running some tests, it seems to me dt is built in- contradicting the manual. If you use dt on forces, everything is messed up if you adjust timescale or have a drop or increase in frame rate.

    Does anyone know if this is a bug of some kind or are you not supposed to use dt when applying forces?

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

    CONCLUSION:

    Do not use dt when applying forces. (using dt on an impulse basically turns it into a force)

    dt is applied internally during the physics update when using stepping mode: frame rate independent.

    If you are using the default stepping mode then the physics updates once per frame and assumes 60 frames per second. If you are running only 40 FPS then your game will appear to be in slower motion than on a 60fps machine.

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

  • newt - I set physics world stepping mode to framerate independent (physics global options)

    -and then of course, everyforce that is applied is multiplied by dt ("one shot" impulses are not as time is irrelevant)

  • Hey everyone,

    I was curious how to manually set a max frame rate. I don't think you can but I thought I would ask. I am having a bunch of trouble with frame rate affecting the game. I am using frame rate independent physics. Setting time step to 0 pauses the game so I am pretty sure at this point I have done everything right, but it seems like I am going to have to re write portions of the project to find the problem. In order to test as I go I need to be able to change frame rate! which I can't seem to be able to do...

    Thanks,

    *edit* ---- I also am curious, but for some reason my computer runs construct projects at 40 fps max. For a while that jumped up to 60 while my plugged in and on high performance settings, but now its always stuck at 40 fps... anyone have experience with this and why it may change?

    -----------------------------RESOLUTIONS--------------------------------------------------------------

    You can't manually set a target framerate from within construct 2. The max FPS of any game is limited by the monitor refresh rate. You can change the refresh rate in properties under the graphics card or control panel.

  • JohnnySheffield - thats a good idea. As for details:

    I basically have a new property declared in edittime.js I added it to the list of properties at the end. In Runtime I declare that this.myproperty = property_list[number of property in the list].

    The problem is that my property is never set. I Essentially mirrored other code I saw, and changed appropriate values (such as the property in the list. If I hard code this.myproperty = x then it works. This is both my first time working in java and working on construct so it may take me a bit to get up to speed. I am sure I am missing something about what type I set the object and so on (my language knowledge is C++,VB,C#,Pascal)

    Katala - To my knowledge, you can't create a joint to an arbitrary vector. Box2d requires joints to be connected to two different bodies (box2d bodies, that is) so no matter how you put the joints together you will need a second body. I think I might know why you want to be able to hinge something without another body... it would be very useful...

  • Hey all,

    I am currently working to expose more of box2d's features to construct 2. I started with expanding the body types to include kinematic bodies and it is working.

    However I have one problem. I can't seem to be able to read the new properties from the edit time or something like that. When I run the game and go into debug mode it says my property is "undefined". Any help or suggestions would be appreciated.

    Also, if anyone is interested in this extended box2d functionality, let me know.

  • Aphrodite - I don't think exposing box2d functionality for just box2d is a bad thing or unfair, even if it can't be done in cacoon js. Making games for phones is a compromise in the first place and you can't always have it all. I actually didn't realize cacoon js a different physics engine... That makes things a lot more understandable. If cacoonjs can't do something box2d can, adding one would throw exceptions for the other.

    GeometriX - nobody said anything about nerfing cacoonjs, just exposing box2d functionality to construct 2.

  • Ashley, Actually it doesn't make sense... I know nothing about box2d other than alot of assumptions on how it works but decided to add kinematics myself because I need them. I changed the Immovable property to body type in edit time and provided 3 options (static, kinematic, dynamic). Then, in run time, I declared the body definition to be whatever it was declared as in the property and presto: I have kinematic bodies. This took 30 minutes, most of which was finding the things I thought needed to be done and learning a bit about box2d. Obviously I need to create some expressions/modify some older ones for full functionality... but ultimately I don't see the complications everyone was saying would exist? Grant it, I only changed asm and not the other two. Is it really more difficult than simply exposing box2d functionality to construct? It seems really strange to me to have all the code in the behaviour to do these things but not be able to access it in construct.

  • This makes sense. Diversity of platform over robustness of a single platform. I just think those two things (kinematic and prismatic) would go really far to help whats there. You can't really do a whole lot without kinematic bodies in terms of dynamic levels using physics and prismatic joints go along the same lines.

    At any any rate, thanks for all the hard work Ashley