R0J0hound's Forum Posts

  • Variables are used a lot for just about anything, it just depends if you need them. I don't quite understand the second part of your question. Do you have a game that needs a database?

  • You can find more info about that sort of thing by an Internet search of "software rasterizer." The aticle you linked only gives a general overview from what I see.

    You said you came up with a way to display the array as pixels so I'll leave that subject for now.

    The simplest thing to draw is points. Basically you just have a list of 3d points that project to 2d like the link in the second post and just set the nearest pixel to the color.

    Lines can be done by stepping from one projected point to another with something like "bresenham's line algorithm."

    Animation is done by clearing the array and doing something like a 3d rotation on the points before projecting them to 2d. So just clear, move points, project to 2d, and repeat. It's hard to make it fast though.

    The obj file format is a text format so it'll be easier to parse than something else. Tokenat() can be used to do this. Basically look at one line at a time and see what the line starts with. If it starts with "v" it's followed by 3 numbers seperated by spaces that is a 3D point. If it starts with "f" it's a face and it's followed by indexes of the points that make up the points. Lines can be found from pairs of points of the face. That's the basics of it. There is other info you can parse if you need it.

    Here's a tutorial that goes in depth on how to make a software rasterizer that may be useful:

    https://github.com/ssloy/tinyrenderer/w ... -Bresenham’s-Line-Drawing-Algorithm

  • Here's something similar.

    https://dl.dropboxusercontent.com/u/542 ... dproj.capx

    The rotation bit could be useful to look at.

  • Aizark

    All my plugins are free to use.

  • A lot of things are done every tick and saving an expression to a variable is negligible in my opinion.

  • It depends on the external JavaScript. If you're making a plugin you can make a condition to query the input state or make a trigger that's called from an event listener or callback. It's mainly specific to the JavaScript you use.

  • I didn't implement save/load at all for this plugin so that's where the issue comes from. I don't have any plans to support that feature.

  • I see it looks like the acceleration is instant with your test, mine was pretty fast but it wasn't instant. It can be made to have smooth acceleration I just need to fiddle with it a bit more I think. I'll see if I can look at your capx and fiddle with my examples this weekend sometime.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, the physics behavior doesn't provide the features to do it.

    One idea that would work, and that I'm interested in, is to just deal with a physics library directly with JavaScript. The only disadvantage is it would be completely seperate from the behavior's and how they nicely mesh with c2's features. So everything would have to be done with events. A plugin would be better but that takes a lot more time to make and polish. I'll probably try the idea this weekend and see what comes of it.

  • It's the change in velocity. In simple cases like hitting the wall at 60mph the car would go from 60 to 0 so the speed would be the change in speed. Still you'll need to store the velocity before colliding because after the hit the the velocity will be 0 (if it doesn't bounce).

  • Mayfly

    Opps, wrong file. I fixed the link.

  • Here's my result:

    https://dl.dropboxusercontent.com/u/542 ... mouse.capx

    But a steering behavior would look nicer:

    https://gamedevelopment.tutsplus.com/tu ... amedev-849

    https://gamedevelopment.tutsplus.com/tu ... medev-1303

    Here's my experiment with that:

    https://dl.dropboxusercontent.com/u/542 ... rival.capx

    The easing curve isn't symmetrical though.

  • Maybe what you want is the kinetic energy or maybe the impulse of the collision. Now that I think about it it can be thought of as the acceleration. Basically the change of speed. You can calculate the X acceleration like this. Y can be done similarly, and the total can be calculated with both: distance(0,0,ax,ay).

    Var lastVx=0

    Var acceleration=0

    every tick

    --- set acceleration to (car.physics.velocityX-lastVx)/dt

    --- set lastVx to car.physics.velocityX

  • tunepunk

    That js code you posted is the same as lerp.

    We should be able to eliminate the orbit by just having a speed toward the target instead of seperate xy velocities.

    Var speed=0

    Distance(sprite.x,Sprite.y,mouse.x,mouse.y) > (speed^2)/(2*100)

    --- add 100*dt to speed

    Else

    --- subtract 100*dt from speed

    Every tick

    --- Sprite: move speed*dt pixels at angle angle(self.x,self.y,mouse.x,mouse.y)

    That should be closer. A bit more work could be done on the slowing down bit. Like instead instead of just using 100 as the decceleration we could calculate the required deceleration based on the remaining distance and speed.

  • One way is to keep track of the velocity. Basically it starts at 0 and accelerates (ease in). Then you can calculate the distance it would take to decelerate to zero and use that the change the acceleration to decceleration (ease out).

    Here's a link of the idea: