R0J0hound's Recent Forum Activity

  • If you ran your game logic at a fixed rate you could do that.

    One way to do that is to accumulate dt and once it’s big enough do the logic for a frame. So say try to run at 30fps:

    var t=0
    Every tick
    — add dt to t
    While 
    t>=1/30
    — subtract 1/30 from t
    — do all game logic for a frame here

    We are still limited by the screen’s refresh rate so even though the game is running at a fixed rate the frames will have to snap to the closest actual frame. The above is a simple example but may need some tweaking to ensure the frames are evenly spaced otherwise it looks janky. As a side effect of that, the jank can be much worse depending on the refresh rate.

    One possible tweak could be to compare t<1/30-0.1 or something to smooth out the variances of frame times. But that magic number kinda relates to what the actual refresh rate is. Another idea could be to skip frames evenly and just allow the game to run slower or faster, but results may vary. Part of the issue with improved tweaking you’d need to know the actual screen refresh rate, but that can only be found experimentally and approximately.

    To avoid the jank you could also keep track of the all the state of the objects on the current and previous frames and interpolate between them to give smooth motion. But realistically you’d need to simulate a frame in advance so you’d have a one frame of input delay. And I’m talking a frame at the fixed timestep. Plus doing this is rather laborious to do with a lot of objects.

    Anyways, the main drawback to this is having to implement all logic under that event. You wouldn’t be able to utilize behaviors, and likely not be able to use input triggers. Basically you’d not be able to use all construct features when doing this.

    However, that would allow you to save replays just as inputs that you could playback.

  • Just to be clear, what’s failing is the array load action fails to load your json since it’s wrong somehow?

    Have you looked at the browser console to see if the reason for not loading was logged?

    I hate guessing why something silently fails as much as the next guy. So assuming it’s the json generated from your excel file that’s not a proper array json you can make a checker to narrow it down.

  • The sdk docs about effects mention most of the builtin uniforms. But

    Uniform mediump float opacity;

    Used to be a thing in c2. But it might be gone now

  • Well there’s nothing amiss with that json data as you typed it.

    I pasted them into a text file. Called it example.json, imported it into the files folder in the project, then used Ajax to load the file, loaded it into an array, then set some text from the asJson to see if it all worked. Which it did with my test with r458.2.

    + System: On start of layout
    -> AJAX: Request example.json (tag "")
    -> System: Wait for previous actions to complete
    -> Array: Load from JSON string AJAX.LastData
    -> TextInput: Set text to Array.AsJSON
  • An object type per card vs one object with a bunch of frames is more about being able to do things in less events. It’s personal preference really, if you already have 100 objects and you’re fine with writing logic with that then carry on.

    Storage wise what do you mean? The overhead of one object vs many is likely negligible. Memory wise you still end up with the same amount of images and vram usage either way.

  • Looking cool!

    If you approximate the rounded window with a polygon you can do polygon clipping with an algorithm like:

    en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm

    But I’m certain you could do something simpler than that by utilizing the sdf equation of a rounded rectangle so you don’t have to loop over so many edges.

    Or maybe you could try clipping by a rectangle like you already do and then use a blend mode to draw that within the rounded window. Or maybe drawing to a texture and then drawing that within the rounded window shape. But those kinda depend on what you have access to with construct’s renderer.

  • UIs are interesting with all the different ways to go about it.

    So instead of using say a 9patch you draw things directly so you can change the border width on the fly?

    Do you have a mockup of the kinds of ui that you are after that this will ultimately help you make? I ask because currently there are other ways to do what you have without a plugin, but I also know there’s often a lot of simpler things that have to be implemented first before getting to the useful parts. Like you mentioned that doing it with events had limits and was cumbersome. In what way do you hope to reduce the friction and limits? I guess the general goal would be enough to see what you’re working towards.

    Anyways, keep it up. More options are always nice and especially as things get more complex I can see a plug-in being more useful and faster than rolling it another way.

  • Here's a test of the idea. I used a higher resolution tilemap to make the water motion jump in smaller steps. I also made it so cells can have higher priority so it fills falling the shape of the corridor more or less.

    dropbox.com/scl/fi/g9pu4fcr9qdkmo7weqjbw/flooding_idea.capx

    Again you probably could make the motion smoother by gradually moving the flood sprites from one spot to another and running the flood function once they stop at the destination.

    One thing I'm not super happy with is we have to call the function from separate events instead of under a repeat condition. That's do to a quirk with picking and newly created objects.

    A smoother and more complex idea still could be to trace the polyline that makes up the corridor and then starting with the point where the water starts from move two points to the left and right along the polyline. That would basically give us a fill line. Probably could come up with some kind of logic to decide how far each edge point should move to add a certain amount of water per frame. I'd imagine you could borrow some ideas from a triangulation algorithm like "ear clipping." Anyways, that's just a general idea, I'd imagine it may end up being simpler to do than you think but I'm not sure.

  • Your example seems to flicker badly after a while. I guess c3 updates are obsoleting my hardware.

    Anyways, you could possibly use a floodfill algorithm to fill the empty cells. Basically mark the start cell, then fill it and mark the empty neighboring cells, and repeat. To make it smoother you could use a sprite animation instead of filling a cell right away. Or if you keep track of the edge cells you could position some sprites around there.

    Just an idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley is male and reporting bugs has always been unrewarded.

  • If you’re using the move to behavior to move the object then you need to use the moving angle of that. I only used 8dir as an example as I had no idea what behavior you used to move.

    On a slightly unrelated note I see you used pi/180 in your expressions. That isn’t needed. Construct uses degrees for everything so you practically never have to convert to radians.

  • Maybe:

    Player: 8dir: is moving ?

    — player: play animation sin(self.8dir.movingAngle)<0?”walkNorth”:”walkSouth”

    —player: set width to abs(self.width)*(cos(self.8dir.movingAngle)<0?-1:1)