AnD4D's Forum Posts

  • It’s 30*30*1/50 = 18. Notice the /50 is needed. That’s what I mean by the units of the physics behavior being off. That second capx figures out the conversions between units in the behavior and what it should be. 50 comes up a lot. I think it was mainly due to an oversight when the behavior was made. Position and speed are spot on but most other values are off by some factor. This really only becomes an issue when trying to apply physics based calculations.

    50??? 60 I'd understand, but 50? I don't get it.

    Do you know how velocity is calculated? I imagine it has that 50 in there again. If I apply an impulse of 1 again on an object with 0 density, I end up with 50. Strangely, I thought that force was essentially a constant impulse being applied, so if I apply a single frame of force, I'd get the same result.

    If I could figure out how much velocity the force would generate on a stationary object based on it's current position toward a certain angle, I could add those numbers to the predicted velocities in the loop, and get a more accurate line.

    I note that force actually appears to be based on time, so if I apply a single force of 60, I end up with 49.79... so let's say 50.

    However, that all becomes a lot harder when you have mass and damping included.

    Additionally, while if I give the sprite a density of 0, I get 49.79 after that burst of force, if I instead give it a density of 1 I get 139.16. No idea why an object with more mass would move faster. However, saying that, a density of 2 gives me 69.58.

    So that makes no sense. I think you're right. It just seems like someone made a mistake in coding the physics engine...

    Update - Just realised, with a density of 0, we get a mass of 50, rather than 0: 30*30*0/50 = 50, which is wrong.

  • Ah gotcha. I get what you’re after now I think. The examples at this point are predicting the path as of the acceleration remains constant. But with what you’re after the force will vary based on the objects position.

    Glancing at your file the force you apply with physics is different that the force variables. But that’s as far as I got.

    If the fps is 60 and the physics is set to fixed timestep (which is 60 i think no matter what) then it’s just the process of simulating a frame at a time to get the path. Unfortunately the predicted path will vary if the the frame times vary. It’s trickier to make it frame rate independent since the force varies by position.

    Anyways, just some thoughts. I’ll be away for the computer for a while so there won’t be any soon solutions from me.

    I use the free version of c3 sparingly. I typically am not connected to the internet so I prefer c2. Someone gifted me c3, hence the icon I guess. It was nice of them, but I really don’t use use c3 to need it. I’m not even logged in. The free version is fine for my purposes.

    Not to worry. I'm struggling to understand how mass, etc play into things. The manual says mass is determined by multiplying the Density by the area of the object's collision polygon. So if my sprite is 30x30, and my density is 1, then why does my mass show as 18 in debug???

    Very frustrating :)

  • I think I read what you wanted wrong. It sounds like its mostly a matter of calculating the force so that the object lands on the target after a duration.

    https://www.dropbox.com/scl/fi/bikvo6eg66yyzf4p18o2v/physics_force_calc_and-trajectory_plot.capx?rlkey=f9iz261uogmqcn12d1x5xc8ra&dl=1

    I skipped the physics behavior entirely so I wouldn't have to deal with the units.

    What you've produced is pretty amazing, but sadly, although 'cool' looking, I don't want it to land on the target.

    I want the ship to always have a physics force applied toward the target, allowing the player to only shape the ship's path.

    I have provided an example, but I'm working in Construct 3, and seem to recall you only working with Construct 2, which seems likely as you're sending me CAPX solutions. However, I note you have a C3 badge on your profile, so I may be wrong.

    In any case, here's the example:

    https://1drv.ms/u/s!AlZkRk7KfdFFjdpKzutJyXpnXPE8ow?e=t782T4

    This is as close as I'm able to get. I basically want the dots to always show where the ship will go.

  • This old one still works, although it could be cleaned up more.

    https://www.construct.net/en/forum/construct-2/how-do-i-18/parabolatracjectory-tracing-55313#forumPost493367

    Here's a cleaned up version. The y acceleration is the gravity*50. Why? because the units with the physics behavior are wonky aka scaled. It will still be off slightly from the physics behavior's path and I figure the only way to make match perfectly would be to use js to load box2d, set it up identical to how the physics behavior uses box2d, run n amount of simulation steps.

    https://www.dropbox.com/scl/fi/htkostz6pa29v65ytxzh6/perdicted_path.capx?rlkey=abgmmli99t6y2izahqwt47fkd&dl=1

    Here's a test to figure out the differences of the physics behavior units.

    https://www.dropbox.com/scl/fi/f8pecd2r8hrltfh2z3zhn/physics_units_compare.capx?rlkey=qx9mgkfesim7w6zufvecgi13m&dl=1

    Finally if you want to set the acceleration from a force you'd do it like this:

    mass = density*area /50

    acceleration = force*50*50/mass

    The density is the mass property in the editor.

    The first example is closest to what I'm looking for, but none of the examples are quite right. The second just seems to be based on a rotating 'cannon' with no change to strength.

    The first is great, but I can't quite figure out why the angle is clamped, and applying any additional force breaks everything entirely. However, I love the fact that it pretty much always collides with the mouse. That's smart.

    The closest I've come is an Angry Birds clone "tutorial" I found... but I feel like the creator simply brute forced things into working, rather than coming up a good method.

    No idea why it's listed as a tutorial, let alone a beginner tutorial, seeing as I've been unable to figure out a lot of things, there are no steps and no comments. I mean, that 7.1 scale just appears to be a random number that luckily fixes things.

    https://www.construct.net/en/tutorials/angry-birds-clone-2615?highlight=62670#comments

    In the game I'm working on, the Ship has momentum, and is turn based. So rather than gravity, it's 'flying' toward a marker. When you end your turn after repositioning the marker, the ship restores its velocity, but if you've moved the marker, it will start applying a force toward that. Essentially, gravity is a point in space, rather than a constant direction.

  • I'm making a turn based game. I have a physics object which is moving. When the game is essentially paused, I want the player to be able to move a sprite which acts as a target for the physics object.

    I want to be able to display a predicted line, or series of dots that will show where the object will move to based on its current velocity, force and angle.

    I've found many threads on the forum with people talking about this, but every link is broken, and half the pages are gone.

    Here's what I have so far:

    At the moment, this just creates the dots in a straight line, and doesn't follow the physics path at all.

    I have the physics Linear Damping set to 1, and gravity set to 0.

    If someone has a simple example, I'm sure I can use it to get what I'm aiming for.

  • Unfortunately the example project from NormalMapExtended doesn't account for scrolling. However that doesn't meant that the effect isn't working, it just means that you will have to adapt your code to keep light position at bay.

    I would recommend using my improved version of the NormalMapExtended addon called "NormalMap32". It is in every aspect a little better than NormalMapExtended, is also better documented, and the example project accounts for your mentioned issue.

    Already switched, and it works immediately. Spent around 6 hours trying to get the Extended version to work, and it always seemed off, so I'm guessing it's just buggy.

  • > Just have it shoot a bullet. Then when it makes contact with a wall, have Construct pick the wall closest to the impact point. Then have the moving block or whatever it is tween to that location. That would allow you to include cool tweens like bounce, to really improve the look of the impact.

    thanks for the answer but i don't quite understand what you want to say, give the tween effect to the character so that it looks like it is not instantaneous, but as if it has crashed and returned?

    Send me the code and I'll show you what I mean :)

    Just realised this forum has no DM stuff... are you able to invite me to a discord or join mine? discord.com/invite/KaWdcYx

  • Just have it shoot a bullet. Then when it makes contact with a wall, have Construct pick the wall closest to the impact point. Then have the moving block or whatever it is tween to that location. That would allow you to include cool tweens like bounce, to really improve the look of the impact.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyone know how to get this to work?

    If you turn on bounded scrolling, the Normal Maps plugin stops working properly.

    The light is meant to follow the mouse, and it does normally, but stops when the screen moves.

    https://1drv.ms/u/s!AlZkRk7KfdFFjdh8EJRgNdj2ac00Ug?e=1Wktxf

  • I've been working on a game perfectly fine for several months, but today when I loaded it up, the preview displays a black screen. I can still hear the music and the cursor, but the game itself doesn't appear.

    I then loaded an old save from a week or 2 ago, and that is also failing to load.

    I updated my graphics drivers in the hope that might fix it, but it didn't.

    I then redownloaded Chrome in the hope that might fix it, but it didn't.

    Finally, I went through all the Construct 3 settings, and eventually found that turning Worker mode off allowed me to see the game again.

    Is anyone else getting something like this happen to them? Has Chrome had an update that might cause this problem?

    Do I have to work with Worker mode off for the foreseeable future?

  • A simple example of how I can parse a string via tokenat and compare the right part as a number or as a string.

    Using this method you can pull out the right parts of the string.

    But I would rather do everything through arrays, it's better than parsing files.

    Unfortunately that won't work, as you're only checking if it's equal to 5. What if I need to check if it's less than, or greater than, or a different number entirely?

    Also, you're only checking that the numbers match. I need to check the number against a particular variable which could change at any time.

    I could brute force it and account for every combination, but that wouldn't be remotely efficient.

    In the end, I decided to do it in javascript and convert everything to a string for the comparison.

    let tokens = runtime.globalVars.Example.split(' ');
    let variableName = tokens[0];
    let comparison = tokens[1];
    let comparisonValue = '"' + tokens[2] + '"';
    let value = '"' + runtime.globalVars[variableName].toString() + '"';
    runtime.globalVars.PassFail = eval(`${value} ${comparison} ${comparisonValue}`) ? 'PASS' : 'FAIL';
    

    I can then check the PassFail var to see if it was a match or not.

  • Hi.

    Can you tell me what problem you are trying to solve.

    If I gave you a text file with "varName == 5" in it, how would you code Construct 3 so that it checked if varName is equal to 5.

    Additionally, how would you code it if "varName <=2"

    Additionally, what if "varName == XYZ". How would you code it so you can check if the variable varName is XYZ?

  • Say I have a string called strVar that contains the text "Example == 5"

    How would I be able to run a check that a variable called "Example" is equal to 5?

    Additionally, if the string was changed to "Example <= 5" how would I be able to check that it is equal or less than 5?

    I've been unable to figure out how to reference a variable by a string.

    I tried putting strVar in an evaluate expression, and hoping that would just work, but sadly it doesn't.

  • What other Steam games are there that were made with Construct 3? I imagine all of them are suddenly getting this issue.

  • If you save your prject in a higher version you cannot open the project in a lower version later. The version number is saved as a string within the file.

    The reason for this is that some new features (or breaking changes) might be introduced in newer versions.

    If you for sure know that you have not used any new functionality you can alter your files to switch back to the old version.

    As mentioned, I reverted to 344.2 then tried to open a version saved with that version. That's the error message. If I try to open something newer, it won't let me. It says "This was saved with 350."

    It won't let me open these files in 344.2. That's the issue. I can open files saved earlier than 344.2, but not those saved with it.

    this is not due to r350 but the nwjs version being falsely marked as a trojan (https://github.com/nwjs/nw.js/issues/8090). You should be able to keep using 350, but be sure to export with an older nwjs version

    I'm exporting with v71 in the nw.js as that's the only one that works with Steam. It's the same version I've been exporting with for 4 months without issue.