Hälsningar från finland!
ok, finally finished the devlog! Bit late to the party, but I'm here! Man, so close(?) to release too.
I will provide some input now whether you like it or not, and I know it probably won't matter since you've finished most things!
ok, critique:
The deer I feel is off. The legs drag too close to the ground when moving, I feel like they should retract more before extending again for each step. Also sometimes it seems as though its center of gravity is not within the area of it's feet on the ground, taking 3 dimensions into account. It looks slightly weightless.
The plants could really do with not being static
If you still have that jump sound, change it.
That's all I have to critique! The rest is fucking beautiful
. I can honestly say this is the most I've ever anticipated a game, and you've also inspired me so much.
Ax = Ax - (getToDiag-diag)*dirX*0.5
sAx = sAx - (getToDiag-diag)*dirX*0.5
Ay = Ay - (getToDiag-diag)*dirY*0.5
sAy = sAy - (getToDiag-diag)*dirY*0.5
Bx = Bx + (getToDiag-diag)*dirX*0.5
sBx = sBx + (getToDiag-diag)*dirX*0.5
By = By + (getToDiag-diag)*dirY*0.5
sBy = sBy + (getToDiag-diag)*dirY*0.5
function end
What you see is, separated by the empty rows: Adding the velocities to the positions, applying air friction and gravity to the velocities, retrieving the data necessary for the "binding" of the two points, and finally applying the bond. The points are now freely moving, but will always keep the same distance to each other, and forces applied to one point will realistically transfer into the other. As long as you draw the points after this has been done, they will always be displayed with the correct distance between them.
You see the "0.5"s after each row in the last section? Those mean that if there is a difference between the desired distance and the actual distance between the points, this point will stand for 50% of the movement made to correct the distance. If you tilt those numbers, so that for example point A stands for 85% of the movement and point B for 15% it will appear that B is significally heavier than A. If you make it so that the sum is less than 100% you will get an elastic bond, like a rubber band. You might want to tone down the movement of the actual positions in this case, and focus on the velocities. Other interesting choices you can toy with is to only affect the points if they are further away from each other than the desired distance, or only if they are closer.[/size]
What you're describing is a proportional controller! This is like THE most useful tool for making smooth graphical transitions and generally making stuff get where you want it, it's also great for smooth menugraphics.
For future reference, you might want to look into controllers in general (It's one of the best uses for video games I've gotten out of my unfinished engineering degree), there's P-controllers (proportional), I-controllers (integrating) and D-controllers (derivating). You can combine them for something called a PID-controller and oh boy stuff just moves like a charm.
The controller itself is usually one line of code which uses the error function, which is what you describe as:
difference between the desired distance and the actual distance between the point
for a proportional controller you just move the variable being controlled with the error function multiplied by a constant, but as the error function gets smaller, you're moving things less, so you may need to add:
- an integrating component, which will sum up all the error functions for each step (tick) and use that value multiplied with a constant to get closer to the reference value (if this component is too strong you will end up with some springy behavior, which might even be desirable).
OR
- a derivating component, which takes the derivative of the error function being controlled and multiplies that by a constant. Basically think of this as slowing down before coming to a red light, your speed (derivative of position, also the part of the derivative of the error function (r-position)) is high, so you add less position to your variable (position).
basically the line will look like this:
derivative=variable-oldvariable //or whatever way you want to calculate the derivative
error=reference-variable
integral+=error //integral would be (probably) an instance variable
variable+=error*constant1+integral*constant2+derivative*constant3
integral will have to be set to 0 if you reset the variable or manipulate it, otherwise it will have "charged up" with the errors from before
You might want constant3 to be negative
wow, that's a lot of text! It's all hoping it might help you! Joar, you are an incredibly talented programmer, and you've done things I'd never dream of tackling (at least before reading this devlog). Then reading through the devlog you sometimes ask questions about something that I thought must have been obvious to you. Don't take this the wrong way but that inspires me. Never stop being amazing guys.