HellMax's Forum Posts

  • I have a pixely game, based on physics movement - its a car game. The car is pushed by Physic's force and moves around okay. I really need point sampling, as without it the pixely graphics look s**t; but there seems to be flickering lines, as if updating only happens over time, which puts quite a strain onto one's eyes.

    Please help; is there a way to minimize/remove this?

  • Greetings! I am currently using :

    int((P_hull.Physics.VelocityX^2 + P_hull.Physics.VelocityY^2)^0.5)

    to get velocity of my car every tick. What I really need is a way to get car's velocity per second, in Pixel per second, lets say. How do I pull this off?

    Thanks in advance.

  • Ah . You can actually raise the linear damping coefficient past 1. I'm not sure why they listed a maximum value - in real life it can be any quantity greater than zero.

    Well thats interesting

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well it is a 2D engine. You want it to work as a 3D engine.

    When you move a Sprite with an X and Y vector, then whats under that sprite is depth, or Z.

    Density, Friction, and Plasticity is about interaction with objects in the XY plane, not Z.

    But. You can do this. You need to detect what it is overlapping. If they are different sprites, give them an instance variable 'Friction'. How more the value in it, how more the slow down. Value should range from 1 to 5 or so.

    If they are different sprites, you need a Family to group them in 1 'is overlapping' event.

    If they are instances of a sprite, you best write the value of that instance variable 'on start up' depending on the animation frame.

    If it is a tilemap, it will be easier to use a lookup table(in the form of an array) with X-index = Tile index, and the slow down value on the Y-index (x,1).

    For sprites.

    (Tank) is overlapping (ground)

    _____ (Tank) Set linear damping ... to Sprite.Friction

    For a tilemap.

    Pick the Tank somehow

    _____ (Tank) Set linear damping ... to ... Array.at( (Tilemap.TileAt(Tank.X, Tank.y)) , 1) .. assuming that X=index = tile index, and y=1 is that slow down value. The array is a lookup table, you use it to translate a value (stored on X) to a paired up value (stored on Y).

    An excellent scheme, will definitely use when work will begin on different ground types.

  • No worries. Most of the things you need to know about the way physics simulations work aren't actually taught until you take a course in numerical physics or modeling at the university level, so you aren't alone!

    Here are the basics:

    Friction: This sounds like it should be what you are looking for, but it is not. In computer games, "friction" is a retarding force between 2 physics objects, but since this is a top-down game, the "ground" is actually not a physics object. Therefore friction will not have any effect in a top-down 2D game.

    Linear damping: This is probably what you want***. Linear damping applies a force backward that is proportional to speed. The slower the object is moving, the smaller the retarding force. Note that this technically means the speed will never reach zero, but it will quickly approach zero such that you can apply a check to see if speed < 1, set speed = 0.

    Angular damping: This works just like linear damping, but for rotation.

    ***Note that "linear damping" is actually a better simulation of air drag than of skidding along the ground. Ground friction is best modeled as a constant force, but you will need to do a number of additional checks to make it completely accurate, and I'm not sure it is worth the effort and extra events for a game. To see the difference between friction and air drag in action, go to https://www.simbucket.com/simulation/rocket-sled/.

    Okay, thats very helpful

    Now comes a trouble that even on 1 (maximum) some movement still noticeable after the force stopped being applied. How do I make it stop dead when the key W, for example, is released?

  • I am moving the object ( a tank ) with physics forces, for it to work well with Immovable walls etc.

    The only trouble it seems is no Dentisty-Force ratio provides what I need -- the tank to stop when force is not applied any longer. It always floats like its on ice.

    Please not that setting velocity to 0 when key is released does not work since I want it to collide with walls and other vehicles.

    I am very new to Physics, so excuse me If I asked something dumb. There seem to be very few tutorials on Physics.

  • I am using a rectangular car with CM used for both rotation and movement back/forth.

    To make solids work, I use When overlapping ---> push out solids to the nearest angle to make solid walls work.

    Here are the main problems :

    • When rotating, the wall pushes the car very rapidly along the side of the wall. I would very much like it not to happen and its currently ruining the game for me.
    • Also, when you collide with a wall under particular angles it gives you a speed boost, which is retarded.

    Note : Opposite angle unusable because it allows for no sliding along the walls + it sometimes throws the car miles away to a different part of the wall.

  • The picture shows the most sophisticated algorithm I came up with. It makes only one side of the wall work, but at least it does what Its supposed to do until you collide with two or more walls, when It breaks absolutely.

    I have also tried Push out solids at the opposite angle, in case of which the car always stops on collision and can never slide along the wall.

    I have tried Push out solids at the nearest angle, in case of which it oftentimes speeds up the car on collision or on rotation.

    The question is - is there a single way to make SOLID blocks actually SOLID, so that they would be unpassable under ANY circumstances. (Must work with Custom Movement though)

    Pls help.

  • Please note that plugins can malfunction badly on Android and, last time I checked, not supported by some export options. Careful, friend.

  • Updated the title so It is less naive; any help still appreciated

  • I am not exactly sure how it is done; you'd have to research that one, but the idea would be something like

    On start of the app ---> Get *hours since last play* gold

    You don't actually have to make it do anything while it is closed.

  • The picture explains it quite well. I am using Custom Movement to achieve realistic car moves, but when you press [D] to turn the car right, for example, instead of stopping upon collision, the car sprite pushes itself farther from the wall and continues to rotate.

    Is there a way to prevent this (Physics behavior's "friction" did not do it) without adding 3 transparent blocks to sense walls on every side of the car?

    Thanks in advance.

  • Omg thank you for the help.

    I'll do exactly that.

  • Ho!

    I am making a game where car collisions would occur, and to accurately make them, I need to know the angle relations between car A and car B.

    Current script takes 2 angle values and if A is within range of (B-10;B+10) then the event occurs. Works fine, just like in situation 1 on the picture. HOWEVER, there is a spot in the angle system where (1-10;1+10) will not describe the angle of car B because it is 359. (shown on the illustration as situation 2)

    How do I work around this? (or How do I test whether two objects are rotated towards approx. the same direction)

  • If I understood correctly, all you need is a single sprite which will act like a background.

    It would have 2-3 frames of animation with different color A/color B relations and would change.