Ruskul's Recent Forum Activity

  • Been messing around with RTS stuff, and I realized there is a massive gap between where the windows pointer is, and where mouse.x / mouse.y suggest that it is.

    I understood there to be usually only a few frames lag, but it seems to be the same gap, regardless of fps (vsync on or off).

    As it stands, it is basically intolerable from the stand point of RTS games (like starcraft). Can anyone tell me the variables the input lag depends on? Is it just the mouse, or does the keyboard have an equal delay? Is it possible to hack around this or does it reside in ther black box of either the construct engine or the web browser?

  • I've run a few more tests, since last on the forums. It seems we are on the same page.

    To handle velocity pointing the wrong direction, I just calculated sign(sign(targetDirection) + sign(velocity)). You can set up the maths to use it to cancel out a portion of the equation by multiplying with it like in shaders, or you can just use it as a condition. If 0, apply acceleration in the direction of the target, no matter what. Although if the velocity is near 0, as you mentioned you can still create a overshoot situation if not handled.

  • I would just do as you say in the OP - tween a value and reference it. Unless the tween behavior has a built in hook for it, that is pretty much your option afaik.

  • Using the following code, the object often overshoots its target. I believe variable time steps are to blame. The higher the max speed, the larger the overshoot in absolute terms, though it seems to stay relatively consistent . Often the overshoot is only a pixel or two, but its obvious. I also tried snapping to target when close enough and slow enough, but to work, the within range needs to be high, and is obvious.

    Is there an established way to deal with this problem in variable time step games? Ideally, I don't want to stop early, or begin decelerating any sooner than needed, but I wish to respect maximum acceleration/deceleration rates.

    //Acceleration and deceleration are equal. 
    DistanceToStop = (Velocity/Acceleration) * velocity * 0.5;
    DirectionToTarget = sign(Target - CurrentPosition);
    AccelerationThisTick = Acceleration * dt * DirectionToTarget;
    
    //reverse acceleration direction for brakes
    if (distanceToStop >= distancetoTarget) 
    	AccelerationThisTick *= -1;
    
    //Integration (doesn't make a difference between this and Euler - the overshooting //still occurs)
    CurrentPosition += (Velocity * dt) + (AccelerationThisTick * dt * 0.5);
    Velocity += AccelerationThisTick;
    
    

    Tagged:

  • Perfecto. Thanks, that works nicely.

  • Hey,

    I notice when defining aces that you can specify a parameter type to be a boolean. This is what I want, but in the editor, I want to be able to enter an expression when calling the action.

    ActionDoThing( Someotherthing.IsFlagSet ).

    Is there a way to to protect the parameter and force it to be a bool on the editor side without giving up flexibility and forces a checkbox?

  • Howdy partners,

    I was curious if it was intended for LOS behavior to only scan for image points rather than collision shapes.

    drive.google.com/file/d/1_M6Ti-S8A_pE9qQzDJLVTh-KkJH1h_-7/view

    I modified the example los project to demonstrate what I mean. The green line shows where a raycast is hitting a piggy, while the highlighted piggy is intersecting with los cone (set to 1 degree atm).

    You can see that while the ray intersects with the collision shape, the los cone seems to only scan for image points. I assume this is intended, but it does allow rather large objects to "hide" simply by keeping the image point hidden.

  • Hi all,

    I was wanting to replace a lengthy property list on a behavior with some sort of data injection.

    Ideally, I wanted to clear off as many instance variables as possible and just reference a single source of data (for example: Instead of having maxHealth property, I would just reference entity type, and lookup the maxhealth in a single source, instead of duplicating it on every instance.

    I'm looking to have minimal properties for the behavior and be able to simply have one property that lings to the relevant data (array, dictionary, Json, I don't really care).

    Is there an official way to do this?

  • I should also add that I'm not looking for a full on "found in the wild" example either.

    Literally just one line, as WackyToaster mentioned.

    So in this example, the code would literally just be the ace declaration with the parameter in use that makes it static.

    The only code snippet is for the most basic declaration:

    {
    	"id": "every-tick",
    	"scriptName": "EveryTick"
    }

    I would assume I just do this to add the static property:

    {
    	"id": "every-tick",
    	"scriptName": "EveryTick"
    	"isStatic": "True"
    }

    But should the script name reference a function on the typeclass or the instance class? Idk. Does it even actually matter?

  • If it comes to it, I would much much much rather "supported engine internals", even if that means documentation isnʻt extensive or robust.

    Lol, A bigger issue I have is that there isnʻt enough internals listed :D

    So I def prefer a larger listed api over a smaller, but very well documented api.

    I mean... I do make api calls that arenʻt officially supported, because I donʻt feel like I have a choice. I need them, and figure since I am using them the same as some built in behaviors use them... should be okay... hopefully.

  • Try Construct 3

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

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

    If it helps to know, construct is a great product. I was/am salty about the rent model, so I have most of my work still in c2, but Iʻve been doing more and more in c3 and the number of improvements is great. I know I complain alot.

    But c3 is a great product and I do recommend it to people. and I am rather astounded by how insanely productive you are. It takes me forever to get something out the door and I never have to make my tools stupid proof for the masses (Iʻm included in the masses too lol).

    Iʻm not being sycophantic - just trying to add context to all my complaining and poo pooing.

  • No no, I think you misunderstand me, the description is fine. I understand what it does and what it is for; But having a code example of it in use goes miles to help avoid making dumb mistakes and show it in propper context. and JS never tells you until you get the thing exported, plugged in, and it doesnʻt work. An example with the description makes it easy to see how it is implemented. I only brought up that particular item to show, like most entries, there is no example code.

    Iʻm not saying "why donʻt you make this like unity". That feels a little like a straw-man. Pretty much any api documentation I have ever seen includes at least a single code snippet of the item in use, which is fair. Iʻm using unity as an example because it perfectly illustrates "...what more there is to add." (namely code examples with comments). But if that still feels unfair, these other examples will do just fine and are made by solo devs.

    Here is documentation for a tool made by one person: ludiq.io/chronos/api/timekeeper.

    Documentation for another package made, originally by one person.

    corgi-engine-docs.moremountains.com/API/class_more_mountains_1_1_corgi_engine_1_1_a_i_action_jump.html

    Constructʻs api isnʻt insanely huge, so comparing the effort needed to maintain or build documentation in contrast to unity isnʻt fair either.

    On a favorable point, constructʻs documentation is well written, much better than gamemaker. And honestly, when it comes to the eventsheets, it is pretty much perfect, plenty of examples too. It just is missing examples for the api.

Ruskul's avatar

Ruskul

Member since 23 Nov, 2013

Twitter
Ruskul has 2 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x6
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies