This is very much a lady.
This is very much a car.
This is very much a story of a story.
He is very much a grind
He is very much of a grind.
Is there any major difference in these usages? Should I use too much or very much?
Monday, April 30, 2018
grammaticality - Is "very much" correct in these sentences?
unity - Volume preserving procedural mesh deformation
I'm having difficulties trying to create a procedural mesh that deforms on impact. The deformation is meant to look and feel like metal when it is being forged. Since this is less of an aesthetic feature and more of something that would affect gameplay directly, it needs to be somewhat accurate. This means that volume of the mesh should be preserved (at least visually) such that the mesh does not gradually get too much smaller.
What I have tried:
1) Applying force on every vertex, based on the force and distance from impact point
foreach (Vector3 vertexPos in vertexList)
{
vertexPos += (force / distanceToImpactPoint.sqrMagnitude) * impactDir;
}
This led to the entire mesh gradually becoming smaller (as mentioned earlier)
2) Take into account the dot product between the impact direction and vertex normal for each vertex, as well as lerp between impact direction and normal (to simulate sides of objects bulging out when compressed
foreach (Vector3 vertexPos in vertexList)
{
float attenuatedForce = (force / distanceToImpactPoint.sqrMagnitude);
float nDotD = Vector3.Dot(impactDir, currVertexNormal);
vertexPos = attenuatedForce * nDotD * Vector3.Lerp(impactDir, currVertexNormal, nDotD);
}
This led to mesh completely splitting apart for anything that has hard shading (as there are duplicate vertices where the edges are, and also artifacts on smooth shaded objects.
Soft Shading (sort of works, but lots of artefacts and not volume preserving)
Also, both methods break completely if force is applied to an edge.
Does anyone know of a more elegant solution to do this?
meaning in context - "Watch the step" without stairs
When travelling on trains in the USA, I have noticed a sign saying "watch the step" close to the exit. I thought it was referring to stairs, but nowhere close to the exit I have seen stairs. I also thought it would be referring to stairs I could find right outside the train, but outside the train I always walked on a pavement.
What does step in "watch the step" mean, in that sign?
Answer
It means to be careful of the step between the platform and the train itself. It’s like the ubiquitous “mind the gap” of the London tube.
The platform and the train are seldom on exactly the same level, so you almost always have to step up or step down; think of it as a one-step staircase, perhaps. But even if they are exactly level, there’s likely to be a plunging hole between them, which suffices to make it prudent to tell people to watch their step. “Watch your step” doesn’t refer to a literal step, but rather tells you to watch where you are stepping.
Sunday, April 29, 2018
prepositions - The Ball From A Pass
The context is soccer (association football) and the sentence in question is:
The forward received the ball from the midfielder's pass.
I have already ask about this here and received alot of good answers, and I tried to leave it at that. But then the World Cup 2014 is upon us, and I am starting to have doubts about this football usage of "from", to the point that I have semi-nightmares about it.
The use of "from" in the football example continues to bother me. I seem to disagree (subconsciously) about how a ball (physical object) could be "from" a pass (action) unless that action creates that object.
Some people were hit by debris from the explosion.
The use of "from" in "debris from the explosion" makes excellent sense to me, because the explosion does create the debris. But in soccer/football, the ball cannot possibly be "created" by a pass.
Is there any non-football usage of "from" similar to my football example sentence?
Saturday, April 28, 2018
game loop - What are "frame rate" and "fps?"
Can someone give me a detailed explanation about frame rate and fps concepts?
Answer
"Frame rate" and "FPS" (frames per second) are usually the same thing. A "frame" is usually a single image in the series of images presented to your screen rapidly so as to give the illusion of motion in your game, and so the terms generally refer to how many of those images your game can simulate and produce within one second.
FPS is often used as a crude measurement of performance, but it's important to remember that it's a non-linear measurement: the difference between 30 and 60 FPS is much larger than 60 and 90 FPS.
Occasionally you will see the term applied in a context where "frame" doesn't refer directly to a unit of graphics/simulation processing overall, but to something narrower in scope. The idea is the same, though: how many of these steps does the program produce within one second.
java - Change in force on objects after collision
i am implementing a billiard simulation game and i have a question about collision response.
As integrator, i am using Semi-Implicit Euler,
ball.setVelocity(ball.getVelocity().add(ball.getAcceleration().multiply(dt)));
ball.setPosition(ball.getPosition().add(ball.getVelocity().multiply(dt)));
Before integrating, i am calculating acceleration :
this.setAcceleration(this.getForce().multiply(1 / this.getMass()));
dt is time frame here, and acceleration, velocity, force and position are Vector class. (operations as add, multiply... are standard vector operations).
My question is - when i initially hit ball with cue, i am giving force -k*x (Hooke's law) to ball. But when it collides with other ball, i can only find formulas that calculate new position and new velocity, but my force will stay same. But how to change force here in both balls (it will change velocity and position later in SE Euler).
I appreciate any answer!
game loop - Implement an upper FPS limit in the gameloop
I implemented my game-loop as described in deWiTTER's article, using the last approach with an unlimited FPS and a constant game-speed.
My problem is, that the unlimited FPS cranks up my CPU usage to nearly 100%. I understand that this is desired (as the hardware does as much as it can), but for my game, it's not really necessary (it's pretty simple). So I'd like to limit the FPS to some upper bound.
Consider my game-loop:
private static final int UPDATES_PER_SECOND = 25;
private static final int WAIT_TICKS = 1000 / UPDATES_PER_SECOND;
private static final int MAX_FRAMESKIP = 5;
long next_update = System.currentTimeMillis();
int frames_skipped;
float interpolation;
// Start the loop:
while (isRunning){
// Update game:
frames_skipped = 0;
while (System.currentTimeMillis() > next_update
&& frames_skipped < MAX_FRAMESKIP){
// Update input, move objects, do collision detection...
// Schedule next update:
next_update += WAIT_TICKS;
frames_skipped++;
}
// Calculate interpolation for smooth animation between states:
interpolation = ((float)(System.currentTimeMillis() + WAIT_TICKS - next_update)) / ((float)WAIT_TICKS);
// Render-events:
repaint(interpolation);
}
How would I implement a maximum FPS?
If i implement the repaint the way I implemented the update (or use a sleep instead of "do-nothing-cycles"), then the FPS is locked, right? That is not what I want. I want the game to be able to work with lower FPS (just as it does now), but limit the FPS to a maximum of, say 250.
Answer
Store the last time you rendered a frame, and if it hasn't been enough time, Sleep().
Note that Sleep() can sometimes result in your program not waking up when it should, giving you a framerate stutter - test it pretty carefully. In my experience most modern OSes will timeslice frequently enough that this won't be an issue except in fast-paced first-person-shooters.
private static final int UPDATES_PER_SECOND = 25;
private static final int WAIT_TICKS = 1000 / UPDATES_PER_SECOND;
private static final int MAX_FRAMESKIP = 5;
long next_update = System.currentTimeMillis();
/////// NEW CODE BEGIN
private static final int MAX_UPDATES_PER_SECOND = 60;
private static final int MIN_WAIT_TICKS = 1000 / MAX_UPDATES_PER_SECOND;
long last_update = System.currentTimeMillis();
/////// NEW CODE END
int frames_skipped;
float interpolation;
// Start the loop:
while (isRunning){
/////// NEW CODE BEGIN
// Delay if needed
while (System.currentTimeMillis() < last_update + MIN_WAIT_TICKS){
System.Sleep(0); // I don't know C# so this is a guess, but there will be some equivalent function somewhere
}
last_update = System.currentTimeMillis();
/////// NEW CODE END
// Update game:
frames_skipped = 0;
while (System.currentTimeMillis() > next_update
&& frames_skipped < MAX_FRAMESKIP){
// Update input, move objects, do collision detection...
// Schedule next update:
next_update += WAIT_TICKS;
frames_skipped++;
}
// Calculate interpolation for smooth animation between states:
interpolation = ((float)(System.currentTimeMillis() + WAIT_TICKS - next_update)) / ((float)WAIT_TICKS);
// Render-events:
repaint(interpolation);
}
Friday, April 27, 2018
The usage of the articles 'a' and 'the' for describing natural things
Putting the proper article before a noun is really complex. To be frank, I'm still learning this! I don't remember the source, but I had read somewhere that even students of English Literature make mistakes in placing proper articles in their sentences.
Even more confusing is the usage of these articles while describing natural things. I am taught to put the article the for natural things (the sun, the moon, the earth etc.), as they are the only ones.
Now why does Harvard describes it as The Himalaya here whereas Britannica calls it Himalaya here? Smart Wiki calls it both here in its main article and about Ecology of The Himalaya here!
My question is:
Do we have to place the while describing the natural things like mountains and rivers? And if the answer is no, why? When I talk about Mount Everest, it's the Mount Everest, the only one. It's definite and so the is needed.
Does it have something to do with being 'plural' (as in the range of Himalayas so it's The Himalayas)? But then I watched The Nile on Discovery!
A request: Please point out mistakes in placing articles in this question as well. This'll be the bonus for me! :)
Answer
You are right that it gets a little confusing with things like mountains, rivers, etc.
I was going to type up some examples, but this site does it just fine. To summarize it (including only ones relevant to this question):
without "the"
- names of countries in the singular; summits of mountains; continents; towns
- single islands
- parks; lakes
With "the"
- names of countries in the plural; mountain ranges; regions
- groups of islands
- name with of-phrase (ex: The Statue of Liberty); oceans; seas; rivers
I wish I could give you an easy rule to follow with this... but I cant. Some things just work one way, and others a different way. Maybe an expert could explain why the distinction was made. I guess, eventually, you just develop an ear for it. Until then, you may have to just memorize the common examples, and try to use that to "guess" for the other ones.
c# - Adding air drag to a golf ball trajectory equation
I'm developing a 2D golf game in VB.NET 2005, but I am stuck on how to implement air or wind drag that should affect the ball.
Already I have these equations for projectile:
- \$v_0\$ for the initial velocity of a golfball when hit or fired
Vertical and horizontal components the velocity of the golfball: $$ \begin{align} v_x &= v_0 cos(\theta) \\ v_y &= v_0 sin(\theta) - gt* \end{align} $$
Vertical and horizontal distance of golfball: $$ \begin{align} x &= v_0cos(\theta)t \\ y &= v_0sin(\theta) t - (0.5)gt^2 \end{align} $$
How do I add air drag to this equation to properly affect the velocity of the golf ball? I don't have any idea how to do it, has anyone worked with similar equations?
Answer
I'm not sure if there even exists a closed form for drag or wind, but it is quite easy to simulate in a step-wise fashion (like all the physics libraries do):
set your initial condition:
$$ x, y, v_x, v_y \; (\text{for }t=0) $$
update position:
$$ x = x + (v_x \times dt) \\ y = x + (v_y \times dt) $$
(where dt is the time elapsed since the last update, aka delta time)
calculate these velocity helpers:
$$ \begin{align} v^2 &= (v_x)^2 + (v_y)^2 \\ \lvert v \rvert &= \sqrt{v^2} \end{align} $$
(where \$\lvert v \rvert\$ represents the length of \$v\$)
calculate drag force:
$$ f_{drag} = c \times v^2 $$
(where c is the coefficient of friction small!)
accumulate forces:
$$ \begin{align} f_x &= \left(-f_{drag} \times {v_x \over \lvert v \rvert}\right) \\ f_y &= \left(-f_{drag} \times {v_y \over \lvert v \rvert}\right) + (-g \times mass) \end{align} $$
(where \$mass\$ is the mass of your golf ball)
update velocity:
$$ v_x = v_x + f_x \times \frac{dt}{mass} \\ v_y = v_y + f_y \times \frac{dt}{mass} $$
That's basically Euler's Method for approximating those physics.
A bit more on how the simulation as requested in the comments:
- The initial condition \$(t = 0)\$ in your case is
$$ \begin{align} x &= 0 \\ y &= 0 \\ v_x &= v_0 \times cos(\theta) \\ v_y &= v_0 \times sin(\theta) \end{align} $$
It's basically the same as in your basic trajectory formula where every occurrence of t is replaced by 0.
The kinetic energy \$KE = 0.5m(V^2) \$ is valid for every \$t\$. See \$v^2\$ as in (3) above.
The potential energy \$ PE = m \times g \times y \$ is also always valid.
If you want to get the current \$(x,y)\$ for a given \$t_1\$, what you need to do is initialize the simulation for \$t = 0\$ and do small dt updates until \$t = t_1\$
If you already calculated \$(x,y)\$ for a \$t_1\$ and you want to know their values for a \$t_2\$ where \$t_1 \lt t_2\$, all you need to do is calculating those small dt update steps from \$t_1\$ to \$t_2\$
Pseudo-Code:
simulate(v0, theta, t1)
dt = 0.1
x = 0
y = 0
vx = v0 * cos(theta)
vy = v0 * sin(theta)
for (t = 0; t < t1; t += dt)
x += vx * dt
y += vy * dt
v_squared = vx * vx + vy * vy
v_length = sqrt(v_squared)
f_drag = c * v_squared
f_grav = g * mass
f_x = (-f_drag * vx / v_length)
f_y = (-f_drag * vy / v_length) + (-f_grav)
v_x += f_x * dt / mass
v_y += f_y * dt / mass
end for
return x, y
end simulate
meaning - In simple words, what is the difference between 'possible' and 'probable'?
Would anyone kindly explain the difference between these?
Possible
Probable
I have searched dictionaries and on all over the Internet, but I have not been able to understand yet what the difference is!
Answer
The specific percentage probabilities depend on context but in short;
- Possible means it can happen, (be it unlikely or likely - however it is more often used for things which are unlikely)
- Probably means it is likely to happen
Related terms;
- Definite means it will happen.
- Improbably means it could happen but it is unlikely
- Impossible means it cannot happen
Use of probable or possible for things which are definite
It would feel very unnatural (and give the wrong meaning) to say that something definite was probable or possible and should be avoided. For example I would say "it is definite that I am using a computer to type this" not "it is probable I am using a computer to type this". This is because the strongest term should be used to describe the likelihood
However; when used as a condition it becomes acceptable. For example "If it is possible that it will be sunny tomorrow we will go to the park" or "If it is probable that it will be sunny tomorrow we will go to the park", if the weather reporter gives a forecast of 100% chance of sun then you still go to the park.
mathematics - Can someone explain the (reasons for the) implications of colum vs row major in multiplication/concatenation?
I am trying to learn how to construct view and projection matrices, and keep reaching difficulties in my implementation owing to my confusion about the two standards for matrices.
I know how to multiply a matrix, and I can see that transposing before multiplication would completely change the result, hence the need to multiply in a different order.
What I don't understand though is whats meant by only 'notational convention' - from the articles here and here the authors appear to assert that it makes no difference to how the matrix is stored, or transferred to the GPU, but on the second page that matrix is clearly not equivalent to how it would be laid out in memory for row-major; and if I look at a populated matrix in my program I see the translation components occupying the 4th, 8th and 12th elements.
Given that:
"post-multiplying with column-major matrices produces the same result as pre-multiplying with row-major matrices. "
Why in the following snippet of code:
Matrix4 r = t3 * t2 * t1;
Matrix4 r2 = t1.Transpose() * t2.Transpose() * t3.Transpose();
Does r != r2 and why does pos3 != pos for:
Vector4 pos = wvpM * new Vector4(0f, 15f, 15f, 1);
Vector4 pos3 = wvpM.Transpose() * new Vector4(0f, 15f, 15f, 1);
Does the multiplication process change depending on whether the matrices are row or column major, or is it just the order (for an equivalent effect?)
One thing that isn't helping this become any clearer, is that when provided to DirectX, my column major WVP matrix is used successfully to transform vertices with the HLSL call: mul(vector,matrix) which should result in the vector being treated as row-major, so how can the column major matrix provided by my math library work?
Answer
if I look at a populated matrix in my program I see the translation components occupying the 4th, 8th and 12th elements.
Before I begin, it's important to understand: this means your matrices are row major. Therefore, you answer to this question:
my column major WVP matrix is used successfully to transform vertices with the HLSL call: mul(vector,matrix) which should result in the vector being treated as row-major, so how can the column major matrix provided by my math library work?
is quite simple: your matrices are row-major.
So many people use row-major or transposed matrices, that they forget that matrices are not naturally oriented that way. So they see a translation matrix as this:
1 0 0 0
0 1 0 0
0 0 1 0
x y z 1
This is a transposed translation matrix. That is not what a normal translation matrix looks like. The translation goes in the 4th column, not the fourth row. Sometimes, you even see this in textbooks, which is utter garbage.
It's easy to know whether a matrix in an array is row or column-major. If it's row-major, then the translation is stored in the 3, 7, and 11th indices. If it's column-major, then the translation is stored in the 12, 13, and 14th indices. Zero-base indices of course.
Your confusion stems from believing that you're using column-major matrices when you're in fact using row-major ones.
The statement that row vs. column major is a notational convention only is entirely true. The mechanics of matrix multiplication and matrix/vector multiplication are the same regardless of the convention.
What changes is the meaning of the results.
A 4x4 matrix after all is just a 4x4 grid of numbers. It doesn't have to refer to a change of coordinate system. However, once you assign meaning to a particular matrix, you now need to know what is stored in it and how to use it.
Take the translation matrix I showed you above. That's a valid matrix. You could store that matrix in a float[16]
in one of two ways:
float row_major_t[16] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1};
float column_major_t[16] = {1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1};
However, I said that this translation matrix is wrong, because the translation is in the wrong place. I specifically said that it is transposed relative to the standard convention for how to build translation matrices, which ought to look like this:
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
Let's look at how these are stored:
float row_major[16] = {1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1};
float column_major[16] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1};
Notice that column_major
is exactly the same as row_major_t
. So, if we take a proper translation matrix, and store it as column-major, it is the same as transposing that matrix and storing it as row-major.
That is what is meant by being only a notational convention. There are really two sets of conventions: memory storage and transposition. Memory storage is column vs row major, while transposition is normal vs. transposed.
If you have a matrix that was generated in row-major order, you can get the same effect by transposing the column-major equivalent of that matrix. And vice-versa.
Matrix multiplication can only be done one way: given two matrices, in a specific order, you multiply certain values together and store the results. Now, A*B != B*A
, but the actual source code for A*B
is the same as the code for B*A
. They both run the same code to compute the output.
The matrix multiplication code does not care whether the matrices happen to be stored in column-major or row-major order.
The same cannot be said for vector/matrix multiplication. And here's why.
Vector/matrix multiplication is a falsehood; it cannot be done. However, you can multiply a matrix by another matrix. So if you pretend a vector is a matrix, then you can effectively do vector/matrix multiplication, simply by doing matrix/matrix multiplication.
A 4D vector can be considered a column-vector or a row-vector. That is, a 4D vector can be thought of as a 4x1 matrix (remember: in matrix notation, the row count comes first) or a 1x4 matrix.
But here's the thing: Given two matrices A and B, A*B
is only defined if the number of columns of A is the same as the number of rows of B. Therefore, if A is our 4x4 matrix, B must be a matrix with 4 rows in it. Therefore, you cannot perform A*x
, where x is a row-vector. Similarly, you cannot perform x*A
where x is a column-vector.
Because of this, most matrix math libraries make this assumption: if you multiply a vector times a matrix, you really mean to do the multiplication that actually works, not the one that makes no sense.
Let us define, for any 4D vector x, the following. C
shall be the column-vector matrix form of x
, and R
shall be the row-vector matrix form of x
. Given this, for any 4x4 matrix A, A*C
represents matrix multiplying A by the column-vector x
. And R*A
represents matrix multiplying the row-vector x
by A.
But if we look at this using strict matrix math, we see that these are not equivalent. R*A
cannot be the same as A*C
. This is because a row-vector is not the same thing as a column-vector. They're not the same matrix, so they do not produce the same results.
However, they are related in one way. It is true that R != C
. However, it is also true that R = CT
, where T is the transpose operation. The two matrices are transposes of each other.
Here's a funny fact. Since vectors are treated as matrices, they too have a column vs. row-major storage question. The problem is that they both look the same. The array of floats is the same, so you can't tell the difference between R and C just by looking at the data. The only way to tell the difference is by how they are used.
If you have any two matrices A and B, and A is stored as row-major and B as column-major, multiplying them is completely meaningless. You get nonsense as a result. Well, not really. Mathematically, what you get is the equivalent of doing AT*B
. Or A*BT
; they're mathematically identical.
Therefore, matrix multiplication only makes sense if the two matrices (and remember: vector/matrix multiplication is just matrix multiplication) are stored in the same major ordering.
So, is a vector column-major or row-major? It is both and neither, as stated before. It is column major only when it is used as a column matrix, and it is row major when it is used as a row matrix.
Therefore, if you have a matrix A which is column major, x*A
means... nothing. Well, again, it means x*AT
, but that's not what you really wanted. Similarly, A*x
does transposed multiplication if A
is row-major.
Therefore, the order of vector/matrix multiplication does change, depending on your major ordering of the data (and whether you're using transposed matrices).
Why in the following snippet of code does r != r2
Because your code is broken and buggy. Mathematically, A * (B * C) == (CT * BT) * AT
. If you do not get this result, then either your equality test is wrong (floating-point precision issues) or your matrix multiplication code is broken.
why does pos3 != pos for
Because that doesn't make sense. The only way for A * t == AT * t
to be true would be if A == AT
. And that is only true of symmetric matrices.
Thursday, April 26, 2018
ai - Find shortest path to gather items
I have a rectangular grid with obstacles and food items on certain tiles. There are also a few storage bins. Each food item gives 10 food. How can I find the shortest path that will allow me to collect 30 food and bring it back to any storage bin ?
I don't think I can use Dijksra class of algorithms because it does not account for a state (food carried) during the pathfinding.
Answer
There is an approximation for the traveling salesman that will fit your needs very good. It is Cristofides algorithm. Here is how it works:
From your current position calculate a minimum spanning tree to the food items. Stop the calculation when the tree will contain 30 food. Calculate a hamiltonian path from the tree by appending non-visited elements when walking the tree in preorder.
The results created by this approximation are at most 2 times the optimum path. Further details can be found here for example
The runtime complexity is lower than with using floyd warshall, since constructing the minimum spanning tree is of lower complexity. This is especially true for your case as your a using a grid where the triangle inequality applies and no obstacles are on the gird. When there are obstacles, it path-finding needs to be applied. But again, floyd warshal is not necessary. For the minimum spanning tree construction, you only need the nearest neighbor for the tree, which is still of much lower cost.
Just one restriction is that using this method is bound to symmetric path distances between positions, because each branch of the tree may be walked in both directions and therefore they should have the same distance.
word usage - What is the other name of a triangular prism? (sound like "retch")
As an ELL, I heard my boss said "retch" a few times. (Note: "retch" is just what I think how the word is spelled). My boss was talking about a triangular prism. What is the correct word? Thanks
Understanding pixel art in Unity 2d
I am struggling to understand the basics behind pixel art in Unity.
I understand what a unit is, and that if I draw my sprite with 16x16 pixels, I should set PPU to 16.
Take stardew valley for example, in the image below you can clearly see that the player is not square. The creator of the game said he made everything in 16x16, but then how is there so much detail in the characters? Surely you do not patch several 16x16 squares together to make a character (as you would with a tilemap)?
What is the "common" way of dealing with things that are not square, like the characters in the image. Do you just make 16x32 sprite and set PPU to 16? Wont that make it look a bit weird next to 16x16 sprites? Do you generally pick one size (i.e 16, 32, 64) And then stick to that for everything in the game?
The visual Issue I've seen is this, where a 32x32 sprite looks very out of place (too sharp) next to a 16x16 sprite.
So I am wondering, how do you mix sizes wihout getting this effect where one image looks much sharper than the other. If I for example wanted a character to be 16x32, or any non-square value, when my tiles are 16x16
Answer
Summarizing the points above, what matters for two pieces of pixel art to match is that their pixel density (texels per screen area / world unit) is the same.
Using some sprites from Stardew Valley as an example, we can see that even though the sprites have different texture dimensions, they match up on a consistent grid because each pixel is drawn the same size.
If we think of the size of the plant as one tile / one unit of world space, we can see this unit spans 16 pixels horizontally and vertically. The character, having twice the height of the plant, also covers twice the number of tiles / world units, so the density of pixels stays the same at 16 pixels per world unit.
For Unity specifically, it exposes this for you as a Pixels Per Unit setting in the Sprite import settings inspector. As long as you use one consistent number here for all of your sprites, Unity will automatically handle drawing them at the right size in your world to keep this pixel density — even if they're odd sizes and not power-of-two or exact multiples of your tile size. So in this example, both the shrub and the character, and everything else in the game would use a PPU OF 16.
The exact number you choose isn't a big deal, it's consistency that matters most. If we wanted each tile to span 2 world units, so that when level editing we can easily snap to tile corners (odd numbers) and tile centers (even numbers), then we'd use a PPU of 8 instead for all our sprites.
Just don't turn it down too low. You'll see some articles out there recommending a PPU setting of 1, meaning a 256-pixel sprite will span 256 world units. While this might not sound alarming, systems like physics are tuned assuming most of your gameplay will be happening on scales of tenths to tens of units, and making your scale too large can cause them to behave poorly. Try to choose a number of pixels that's meaningful in your gameplay, like the width of your character or your tile. This will also make your math easier for programming & level design (eg. "I want this character to dash 3 tiles right, so that's x + 3.0f
")
Note that scaling a sprite, UI image, or its parents using transform properties will distort them away from this consistent pixel density, so be very careful with scale properties, and keep most or all of your scene at a scale of 1.0 for simplicity.
One last caution is that none of this determines how big your sprites actually end up on your screen - that's determined by the size of your game window / screen, and the size/FoV/angle of your camera. For pixel perfect 2D, you'll also need to ensure that the height of your window is a whole-number multiple of the number of sprite pixels your camera sees (orthographic height of camera x 2 x PPU)
Wednesday, April 25, 2018
word request - What is the right term to indicate the opposite of the math operation distribution?
I am studying math, and there's a term I don't know how to express, I just know that is the opposite of the operation of distribution of terms in an algebraic expression. For example, from the basic math operations we all learnt at primary school:
(a + b) * 3
... and if I distribute (distribution) the 3, I get:
3*a + 3*b
Now, what is the technical English name and verb for the reverse operation:
3(a + b)
?
Answer
The word for this is "factoring". "Factor" can be used as a verb, just like "distribute". When you do this:
3*a + 3*b
3(a + b)
you are factoring out the 3. (Present tense: "factor out the three".) When you do this:
x^2 + 5x + 6 = (x + 2)(x + 3)
you are factoring the polynomial.
"Factor" is also a noun. When you do this
100 = 2 * 2 * 5 * 5
you are finding the prime factors of 100.
"Distribute" is mainly used as a verb. When you do this:
5(a + b) = 5*a + 5*b
You are distributing the 5. But you can't call the 5s "distributors" or anything like that.
The property of multiplication and addition that allows you to do all this is called the distributive property.
Tuesday, April 24, 2018
word usage - Is this a clear expression, "on a rainy day, Bob is grumpy with a 60 % chance, happy with 40 %"?
This question comes from this post, where I am trying to express the following meaning clearly and concisely.
this is clear but not concise
on a rainy day, Bob is grumpy with a 60 % chance, Bob is happy with a 40 % chance.
is this clear and concise?
on a rainy day, Bob is grumpy with a 60 % chance, happy with 40 %
Answer
Thank you for linking to the post where the statement originated. It explains the very odd, and perfectly correct, syntax of (thing occurs) with a (percent) chance.
The most concise you should make the sentence, and still have it readable for humans, is something like :
On a rainy day, Bob is grumpy with a 60 % chance and happy with a 40 % chance.
idioms - Can "It is a shame that ~." and "It is a pity that ~." be used to describe the feeling when in a soccer game our ball misses the target by an inch?
I wonder whether I can use the expressions, "It is a shame that ~." and "It is a pity that ~." when during a soccer match our ball misses the target by a tiny distance.
For example, can I say "It is a shame that our ball missed the target by a tiny distance! We almost scored!" or "It is a pity that our ball missed the target by a tiny distance! We almost scored!"?
Thank you.
Answer
Both of these expressions are fine but a little bit dispassionate, as if you don't feel a lot of emotion about the game. I can't help but imagine a couple of very well-mannered British aristocrats watching the game:
"Oh that's a shame. What a pity he missed that shot."
"Indeed."
(both sip their tea)
As StoneyB mentions, most people would use much stronger language. Some nicer examples of this:
Oh my god! He missed the shot!
Can you believe he missed that shot!
How the hell did he miss that shot?
How in the world could he have missed that shot?
And many, many others.
[Edit] As J.R. mentions in his comment, some people (of a calm and civil demeanor) might use different language to respond to the case where the ball just misses the goal. For example:
Oh! So close!
Almost got it!
Damn! Missed by a hair!
And so on. Now me, I'd still probably issue a string of expletives and say unkind things about the kicker's family. It really depends on personality.
procedural generation - How would I go about generating a star map?
Im trying to generate a star map.
My try would be:
- Have a width and height for the map.
- Place points (stars) randomly across the area of width and height.
A simple approach, but it has the problem of randomly placing stars extremely close to each other.
To solve this problem, one approach would be to have a minimum distance and when generating a star, you compare the distance from the new star to every generated star and if its below minimum distance, you generate a new one, but I dont know if thats efficient. Any tips?
Answer
A Poisson-Disk sampling distribution will allow you to select random points a minimum distance apart & Bridson's algorithm can efficiently solve the problem in O(n) - fast enough for real time provided your star count doesn't get too huge.
Bridson's algorithm divides the output region into a grid of cells sized relative to the minimum allowable distance, such that only one point can appear in each cell. Then, when you consider adding a new point, you only need to check a disk shaped collection of neighboring cells as opposed to the entire list of points. For instance, consider the following image:
When checking to see if the candidate blue dot is too close to existing dots, you don't need to check it against every existing dot. Instead you can restrict the search to the dots in the neighboring cells (which you can find quickly using a lookup table). Mike Bostock has a nice animation showing the algorithm in progress.
The standard implementation is only concerned with a fixed minimal distance between points. Herman Tulleken's Poisson Disk sampling article (includes source code) covers an adaptation for varying the minimum distance at different parts the image; basically like a dithering algorithm. Using perlin noise / simplex noise as shown in the article clouds might give a more natural looking star map. For example, I used the image on the left to generate the right:
To do this, when considering a candidate point, I first check the value of input image, which yields a value from 0 to 1. I then scale this to my desired min & max distance between points; in this case I selected 5 & 20 pixels. So when placing a point in the dark regions, my stars can be as close as 5 pixels to each other & when placing stars in the light regions, they can be up to 20 pixels apart.
It's worth noting that Bridson's speed up doesn't exactly work with variable distance sampling because the output points aren't using a uniform minimum distance. However you can still use a the output grid to reduce the searching. A smaller the grid results in a quicker the search for nearest neighbors at the expense of increased memory for a larger lookup table.
Grammatical terminology for the difference between 'hear' and 'listen'
Is there any grammatical terminology to describe the difference between 'hear' and 'listen'?
E.g.
Hear is a ____ verb and listen is its ____ counterpart.
Or,
Hear-listen is a pair of ____ words.
Answer
I think the term you're looking for is volition.
Listen is a volitional verb and hear is its non-volitional counterpart.
When you listen to something, you're paying attention to it on purpose.
Here's how the term is defined in David Crystal's A Dictionary of Linguistics and Phonetics, 6th ed.:
volition (n.) A term used in the semantic analysis of grammatical categories, referring to a kind of relationship between an agent and a verb. A volitional verb or construction is one where the action takes place as a consequence of the agent's choice, e.g. Mary left. A non-volitional verb or construction is one where the agent has no determining influence on the action, e.g. Mary slipped. Many verbs allow both interpretations (e.g. X hit Y – accidentally or on purpose?). The notion has also had a contrastive role in the analysis of the meanings of certain auxiliary verbs in English: for example, the volitional sense of will in I will go (in the sense of 'it is my decision to go') is distinguished from other senses, such as characteristic action (They'll sit there for hours).
(p.516)
phrase meaning - Usage of 'quick' as adverb
I heard the following dialog in a British English movie:
Words go round quick. All the little tongues go clack, clack, clack.
What does this mean, and why was the word "quick" used instead of "quickly"?
Answer
I see quickly as the correct adverb; I would correct my children if they said:
He's running quick.
However quick is widely used as an adverb, and in some phrases seems to work better:
a get rich quick scheme
Do it, and do it real quick
Some dictionaries do include that quick may be used as an adverb.
President George W Bush
We want to get this bridge rebuilt as quick as possible.
This article has some interesting observations
At to the meaning of the passage. The idea is of information (and suspect in particular malicious gossip) being transmitted very quickly from person to person. The individual tongues working very quickly like components of a machine.
This comes to mind:
A lie can travel halfway around the world before the truth can get its boots on
Monday, April 23, 2018
comprehension - Which is better for listening: intensive or extensive listening?
For improving listening capability, which method is better? First, intensive listening: to listen to a sentence or two with dictations. Second, extensive listening: to listen to long range of audios.: I want to know if there are studies about this.
(* My case: I’ve adopted first one for around over two years with BBC’s children’s news, BBC’s Learning English stuffs, and recently with Aussie ABC’s short news, which are consisted of two or three sentences for an event.
But the sounds and structures of English are far different from my mother tongue, Korean, it’s not content at all. But I do not want to change my way yet. For without good partial tactics, I think, a soccer team could not get a good result. Likewise without being good at catching partial fragment, how can I get the long range of things? Would you let me know consulting my experience?)
Answer
For the purpose of improving your listening skills, my answer is that none of them is more efficient than shadowing, which is say what you hear as soon as you hear it.
A long definition and useful description could be found here.
Also, there are couple of papers related with shadowing, but this study is recommended.
Cases of using an article before the gerund
I found an example of using "the" before the gerund:
During the crossing the passengers felt the ship toss
But according to the grammar, no article is used before the gerund. Or in this case the crossing isn't the gerund?
grammar - correct use of hyphens to connect two words
Should I use a hyphen to connect the following words? What is the general rule about that?
environment friendly --> environment-friendly
frontend --> front-end
backend --> back-end
speedup --> speed-up
Answer
Two words are joined by a hyphen when the collocation occurs in a non-standard context. For instance, we speak of the front end (space, no hyphen) of a car when this acts a noun phrase:
The front end of my Chrysler was dented.
My Chrysler was hit on the front end.
But when we use front end as an attributive, we hyphenate it:
My Chrysler suffered a front-end collision.
This lets the reader understand that we are speaking of a collision involving the front end rather than an "end collision" (whatever that might be - it has no obvious meaning) at the front.
In the same way, the phrasal verb is always speed up (space, no hyphen) when we use it as a verb:
Whenever we're behind schedule we speed up.
But if we want to use speed up as a noun, we hyphenate it.
We were behind schedule, so the foreman ordered a speed-up.
Two words are compounded - stuck together with neither a hyphen nor a space - when the collocation acquires a distinct sense, or the phrase becomes so common that it is felt to be a single word rather than two separate words. For instance, a dead line or dead-line was originally a line around a military prison which a prisoner could be shot for crossing; but when the phrase came to be applied metaphorically to the point by which a project must be completed, and became very common in the sense, it turned into the single word deadline.
Sunday, April 22, 2018
punctuation - Do I need to use a comma if a subject follows "and" in a sentence?
Mike went to the shop, and he bought vegetables.
or
Mike went to the shop and bought vegetables.
My understanding is that when the subject is there after 'and', the comma is required.
My understanding is that when there is no subject after 'and', the comma is not required.
Am I correct on the understanding?
Answer
The general rule we can apply here is that the first sentence calls for a comma because it is a compound sentence consisting of two independent clauses joined by a coordinating conjunction (even though the subjects "Mike" and "he" are complementary, referring to the same person):
1 Mike went to the shop.
2 He bought vegetables.
However, the comma is not always required. In shorter sentences, writers often leave out the comma:
I walked and Mike ran.
I called but no one answered.
The second sentence (Mike went to the shop and bought vegetables.) is a simple sentence (one independent clause) with a compound predicate consisting of two verbs ("went" and "bought"), and we should not include a comma.
Note that if the predicate contains three or more verbs, we can apply the "list rule" for commas and separate them:
Mike went to the store, bought groceries, and returned home.
meaning - Difference between gerunds and nouns ending in -tion
As we know, gerunds have the same function as nouns and can be substitute in noun phrases. Additionally as far as I know, meaning of them would be the act of doing that verb. (I don't know whether this is correct or not, this is my intuition though.)
- Creating : An activity in which we are creating something.
- Cleaning : An activity in which we are cleaning something.
In the other side, we have noun "Creation" with meaning:
the act of creating something, or the thing that is created:
Source: Cambridge Advanced Learner's Dictionary 4th edition
However, we don't have noun "clean + tion = cleanation". My questions:
Why don't some verbs have "-tion" nouns?
What is difference of meaning between gerund and "-tion" nouns? (for example: transformation and transforming)
Answer
The gerund refers to the act or process of doing something - the activity itself and nothing further.
The -ion form of a root can mean the act of doing something, but usually leans toward meaning its result, effect, or manifestation - something that persists or evidences after the activity.
Why don't some verbs have "-tion" nouns?
This may be a better question for https://english.stackexchange.com, but briefly looking into it, -ion comes from Latin and is generally used with words of Latin origin. Non-Latin words - such as those that are part of the Germanic "core" of English (e.g. all the irregular verbs) won't work with -ion.
verbs - "This book *reads* very well."
This book reads very well.
The usage of the verb read is unusual. Because it doesn't say here that the book reads something, but someone reads the book. Can you give me a hint what is this grammar point called?
Can I say these?
This story tells very well.
This wine drinks smoothly.
This show watches well.
Answer
I would say, when in doubt, check a dictionary.
As for the initial example ("This book reads very well"), that's clearly an acceptable use of the word – as indicated by Collins Def. #7:
If you refer to how a piece of writing reads, you are referring to its style.
· The book reads like a ballad.
· It reads very awkwardly.
As for your second example ("This wine drinks smoothly"), I understand what you're saying, and English is flexible enough to let you get away with non-standard usages like that. However, it's worth knowing when such a usage is recognized by a dictionary, and when it isn't. Collins' entry for drink shows some interesting uses of the verb:
⇒ he drank in the speaker's every word
⇒ he drank away his fortune
but "This wine drinks smoothly" is not included among the recognized, valid uses.
So, here's my bottom-line advice: Know what you're doing. Language evolves; someone has to be the innovator and use the verb intransitively first, if "...and the wine drank smoothly" is to ever start showing up on the pages of restaurant reviews. However, if you use a word that way, you should know that you're using it in a non-standard way, and be sure the context doesn't demand you switch to a more standard wording. You may think you're being clever with the language, but for every reader who agrees with you, there will probably be some pedant dubbing you "illiterate," claiming you don't know how to write. (As an example, there was once a hullabaloo over at ELU when someone – gasp! – dared used the word "fun" as an adjective).
English has ways of allowing someone to turn nouns into adjectives, and transitive verbs into intransitive verbs – but just because we can doesn't always mean we should.
game design - Regarding physics engines and the GPU
The rigid body physics engines that use a "bounding box" for collision detection, I am aware of how they are created.
What I want to know is, is there a physics engine that does not use "bounding box" but actually uses something like vertex data to do the physics calculations? What type of physics engine is this called, and does it use the GPU?
Answer
There are two general cases for using a physics system in a game:
For gameplay. That is, using forces and collisions to move objects around. The physics system manages the location and movement of game objects.
For visualization, things like particle systems. These are pure-rendering things that don't affect gameplay.
Handling #1 on the GPU is a bad idea performance-wise. The problem is that you need to do a CPU->GPU->CPU round-trip. The CPU needs to manage where objects are, so that AI and other systems can manipulate it. Therefore, the CPU may need to update the position of objects. The CPU also needs to read the positions of objects, as well as be notified of any collisions. So you can't just fire off some GPU "rendering" commands and then do something else; you need that information right now for AI and the like.
This forces a GPU/CPU synchronization. A GPU/CPU sync is one of the worst things you can do for performance. You want the GPU to operate as asynchronously as possible. Doing physics of type #1 on the GPU works against that.
Now, for #2 physics, things are different. In this case, the physics is completely subservient to the rendering of the object. It basically does physics solely to do rendering. Therefore, everything can effectively live on the GPU. For this, doing the physics on the GPU makes sense, because the AI and game engine don't care about any collisions or whathaveyou.
I don't know of anything complex enough for people to call it a "physics engine" that doesn't handle at least convex hulls. You can generally build concave meshes by taking many convex hulls and using constraints to effectively fuse them together, though how well this works depends on the physics system.
Many physics engines do have some way to run on GPUs. PhysX and Bullet have some mechanisms for it, though it may be limited to certain hardware that provides appropriate support.
sentence choice - Plural and countability of the word 'performance'
Algorithms A and B provide good performance.
Algorithms A and B provide good performances.
Could you please tell me which one between the above sentences is correct ?
Algorithm A provides good performance.
Algorithm A provides a good performance.
Also, between the above sentences, which one is correct ? In other words, is performance countable or uncountable in this context?
Saturday, April 21, 2018
grammar - Fight 707 arrives at/in Washington D.C. in ten minutes
Fight 707 arrives at Washington D.C. in ten minutes.
Fight 707 arrives in Washington D.C. in ten minutes.
Do we have to use 'at' or 'in' in this case? Washington D.C. is a big city, so we have to use 'in' normally. However, because the plane leaves the city soon, the city can be a particular point on a map. So, can we use 'at' in this case?
algorithm - How do I generate random mountains in a sidescroller?
So I'm trying to make a simplified Terraria style world using Perlin noise. I got that working and the terrain is randomized. However the terrain always looks like like a weird cosines curve. Hills and bottoms with different heights repeating. The effect I want to achieve is something similar to this:
Where the terrain is mostly flat looking and sometimes a large mountain will appear.
Is there an algorithm or "noise" that could achieve this effect or what other things do I need to do?
Answer
You want to mix different wave lengths with different levels of intensity.
E.G. Have one long wave, that has a high intensity, and a short wave with low intensity.
Now add the two(or more) waves together. Black line being long waves and high intensity.
Red line being short waves with low intensity.
Green being the final result.
float getHeight(float x) {
float longWave = getNoise(x / 100) * 20;
float shortWave = getNoise(x);
return longWave + shortWave;
}
Eventually add more waves, maybe using different noise algorithms. Play around with the values. To get more interesting results you could also try to multiply different wave lengths, make them exponential etc...
Interesting/Innovative Open Source tools for indie games
Just out of curiosity, I want to know opensource tools or projects that can add some interesting features to indie games, preferably those that could only be found on big-budget games.
EDIT: As suggested by The Communist Duck and Joe Wreschnig, I'm putting the examples as answers.
EDIT 2: Please do not post tools like PyGame, Inkscape, Gimp, Audacity, Slick2D, Phys2D, Blender (except for interesting plugins) and the like. I know they are great tools/libraries and some would argue essential to develop good games, but I'm looking for more rare projects. Could be something really specific or niche, like generating realistic trees and plants, or realistic AI for animals.
box2d - Why might a body suddenly stop while moving on continue platform?
I have a 32x32 sprite and I make some to be platform like this
for (int i = 0; i < 15; i++) {
attachChild(new Ground(32 * i, 200, regPlatform, vertexBufferObjectManager, physicsWorld));
}
And I have another sprite (32x32 also) moving over those platforms (A player object)
attachChild(new Player(10, 10, regPlayer, vertexBufferObjectManager, physicsWorld));
And the physicsWorld connects the player like this (Where move=1 when user click right button, and move=2 when user click left button)
physicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, false) {
if (move == 1) {
body.setLinearVelocity(new Vector2(8, body.getLinearVelocity().y));
} else if (move == 2) {
body.setLinearVelocity(new Vector2(-8, body.getLinearVelocity().y));
}
}
The Player moves smoothly form left to right and reverse. But sometimes, it is blocked. If the player move back a bit, and back again where it is blocked, it isn't blocked any more at the same place.
Anyone has any idea to fix this? Maybe it is a bug of andengine and box2d and I need some trick here? Please help me. (The two sprites above are just normal png with 32x32px)
Player image:
Platform image:
Answer
AndEngine's physics extension is a port of Box2D. And Box2D's faq says this about tile based environments that should be "smooth":
Using many boxes for your terrain may not work well because box-like characters can get snagged on internal corners. A future update to Box2D should allow for smooth motion over edge chains. In general you should avoid using a rectangular character because collision tolerances will still lead to undesirable snagging.
For more information see this post: http://box2d.org/forum/viewtopic.php?f=3&t=3048
Your description sounds like this problem.
phrase meaning - What does "at 19.45 hours" mean?
I was reading a book and this sentence seemed a little odd to me:
At approximately 19.45 hours the two men rose, stretched and yawned. They picked up their gear and stood at the door, ...
What does the first part mean? If it's the exact time, shouldn't it be 19:45? And if it's duration, shouldn't it be "After 19.45 hours"?
(The story here happens at an airbase, if it's of any relevance)
Edit: The book I've quoted is this:
The Sirius Crossing by John Creed.
The author is Irish and the text is set in northern England/Ireland.
Answer
It means the same as 19:45 or 7:45PM
There seems to be several elements in the original text that are confusing.
At approximately 19.45 hours...
The dot
The dot in the time notation is not a decimal point, as in "19 point 45", as in 45 hundredths of an hour. It's an alternative to the colon as the time separator and would be pronounced "nineteen forty five hours".
There are a variety of names for the "dot" symbol, but this one would be a "full stop" or a "period". Both terms are equivalent and are used in Commonwealth English and American English respectively.
Many languages use a dot as a separator between hours, minutes and seconds. In Germany, it was the standard notation up until 1996 and is still commonly seen.
The German standard DIN 5008, which specifies typographical rules for German texts written on typewriters, was updated in 1996-05. The old German numeric date notations DD.MM.YYYY and DD.MM.YY have been replaced by the ISO date notations YYYY-MM-DD and YY-MM-DD. Similarly, the old German time notations hh.mm and hh.mm.ss have been replaced by the ISO notations hh:mm and hh:mm:ss. Those new notations are now also mentioned in the latest edition of the Duden. The German alphanumeric date notation continues to be for example “3. August 1994” or “3. Aug. 1994”.
It is also popular in the United Kingdom. For example, The Guardian's recommended style guide has this (emphasis mine):
1am, 6.30pm, etc; 10 o’clock last night but 10pm yesterday; half past two, a quarter to three, 10 to 11, etc; 2hr 5min 6sec, etc; for 24-hour clock, 00.47, 23.59; noon, midnight (not 12 noon, 12 midnight or 12am, 12pm).
A quick look at this list of time notations by language reveals that the following are officially using a dot as the separator:
Since the dot serves the same purpose as a colon, the time is meant to be 7 hours after noon (midday), plus 45 minutes.
The "19"
Some cultures do not commonly use the 24-hour clock and a number higher than 12 in a time might be unusual. The 24-hour clock is the most common system in the world today and counts the number of hours passed since midnight, from 0 to 23. It is also called "military time" in the United States.
Therefore, "19" means "19 hours after midnight".
The "hours"
The redundant mention of "hours" after the numbers seems to be common in military settings. This answer on the pronunciation of time in 24-hour notation says that it is ingrained in the mind of soldiers. The Art of Manliness, an American website, also says this:
[As for] whether you should say “hours” after giving the time, that somewhat varies by what branch of the military you’re dealing with. If Soldiers and Airmen are saying 2:00pm, they’re a little more likely to give it to you as “fourteen hundred hours,” while Marines or Coast Guardsman [sic] are a little more likely to render it [as] just “fourteen hundred.” Across the branches though, it’s typical to drop the “hours” bit when you’re talking face-to-face and your meaning is obvious, only adding it in conversation and written communication that’s more formal and where you want to make sure the message is clear.
It would appear that the author wanted to add some military slang since the story happened at an airbase.
At approximately
The phrase "at approximately 19.45" seems unusual for some people who would rather see "about", "roughly" or "around". However, "approximately" reinforces the formality of the sentence, as it is something you might find in reports, legal settings or scientific documents. It sounds much more technical than "around" and again fits with a military setting.
Addendum: Locales
Time and date notations are notoriously difficult to get right. The sum of all the culture-specific quirks (also including number formatting, sorting, case conversions, etc.) is called a locale in computer science. There are as many locales as there are countries and languages. In fact, the "same" language in different countries might have different notations.
For example, in Canada, English and French are the two official languages and have different date notations (dd/mm/yy and yyyy-mm-dd respectively). Canadian English and British English also have different time notations (12-hour clock and 24-hour clock respectively).
In addition to official notations, there are also popular notations that are either:
- historical, because the standard was officially changed in a particular region of the world by its government; or
- a result of outside influences, because another country close by is using a different notation.
In this case, the dot is not the official notation in either Ireland or the United Kingdom. It is, however, a popular notation in the UK.
infinitives - meaning of "make-up" (besides to compensate)
More accurately I'm asking about made up. Can it be used in the same way as ended up?
She made up looking wonderful after going to the hairdresser
Now I know it's kinda weird. There are simpler ways to say that phrase. I'm asking this because in the subject of gerunds and infinitives I'm asked to correct the mistake in the following sentence:
The hairdresser made me to look wonderful
Now the easiest way to fix it is "made me look wonderful" and case closed. But is "look" by itself an infinitive? I got confused by this and started looking up ways to fix it with "looking/to look". Can it even be done this way?
Answer
No, they don't mean the same thing.
"Ended up" means "finished the (literal or figurative) journey", and is normally followed by some indication of where or how you finished.
We got lost, drove in circles for miles, and finally ended up in Cleveland.
I was angry at Sally, but I ended up forgiving her.
"Made up" has a number of meanings.
(a) Fictional (adjective) "His story isn't true: it's all made up."
(b) Invented a fictino (verb) "He made up that story."
(c) Reconciled, as in, after a conflict. "Alice and Bob had a big fight, but then they made up and were friends again."
(d) Made prettier by applying cosmetics, etc. (verb) "Sally made up her face using eye shadow and lipstick. She also made up her hair with braids and hair clips."
(e) Regained lost ground, compensated. "Our company lost money in the first quarter, but we made it up in the second quarter, so now we are back on track."
Whew, this idiom has a lot of meanings! Maybe there are more that I'm not thinking of.
I wonder if the sentence you quote has been garbled somewhere along the line, as women certainly do go to a hairdresser to be "made up". Perhaps, "She was all made up and looking wonderful after going to the hairdresser."
networking - Broadcasting terrain data
How can i send from server to client a large amount of tile data? Having chunks of almost 2MB of data seems prohibitive to send this information just like that. Minecraft compress each chunk and Terraria uses RLE, but im not sure if they send so much information.
Friday, April 20, 2018
3d - How to modify normal vectors with a tranformation matrix
Transformation is quite simple when it comes to Position or Color of the vertex, for Position just multiply matrix * vector and for color just don't do anything, but my question now is: How to handle normal vectors? If my thoughts are correct I would just need the rotation part of the matrix and apply it to the normal vectors, but how can I do that? Or is it better not to use a matrix for that, but instead allow only direct transformations, one at a time, so I can handle them differently for different vertex attributes?
Answer
Simply multiply the normal vector with the inverse transpose of the 3x3 sub matrix used to transform points.
Normaltransformed = Inverse ( transpose ( mat3 ) ) * Normal;
The rational behind this is that Normal vectors has the property of being perpendicular to the surface so you need the inverse transpose to retain that property. You need the 3x3 matrix and not the full 4x4 matrix is that normals are direction and shouldn't be translated. Alternatively, you can set the normal vector w
component to 0, but normals are usually vec3.
Note that if your matrix only contains rotation, the inverse transpose will result in the same original matrix so you don't need to do anything.
Normaltransformed = mat3 * Normal; // In case mat3 is only rotation.
More on the topic here.
c++ - Animation Blending Basics
Say I have a framework with characters that can run and walk and of course, stand still.
Am I right in thinking that animation blending is the process of smoothly transitioning between these by generating dynamic animations at runtime?
If so, what is the basic theory of how this works, and how would I implement it?
Answer
Character animation blending is more general and can be used for:
- Computing smooth transitions between 2 clips;
- Creating completely new animations from existing ones (potentially more than 2 at the same time);
- Achieving IK-like behaviors;
- etc.
The basic idea is that for two identical skeletons with different animation clips, for each joint rotation, you compute in-between values. Animation clips are represented with rotations. So linear interpolation is not what you should use if you want accurate results (even if you are using Euler angles). You can use slerp for example but more complex solutions exist.
This is a complex problem with complex solutions. Basically, if you have two animations clips A and B:
- If A and B are completely different (blending jump and swimming), then chances are you will have strange/funny results;
- If A and B are similar (two walking animation clips), then, you must first synchronize them to blend them when both left feet are on the ground for example.
- etc.
If you are interested, I suggest you start by reading this article so that you can better understand what the difficulties are: http://graphics.cs.wisc.edu/Papers/2003/KG03/regCurves.pdf
It is not the most up to date one, but it is easy to read.
I hope this helps. Best regards.
Thursday, April 19, 2018
Distrubuted Rendering in a CAVE system
I am currently working with CAVE systems and I'm looking into hooking up a pre-exisiting game engine in one. I know this is possible through Unity and the Unreal Engine as there is already research out there showcasing that it has been done.
Right now, I have not decided upon one game engine to use and I'm currently looking around and researching if it is possible with the likes of CryEngine and Valve's Source Engine. The one issue that I am going to face, however, is getting the image to correctly render across all four of the monitors / screens.
Thusly, as a result I have two questions:
- Does anyone know of any good research / books on distrubuted rendering? It doesn't need to be specificly for games, just the topic in general would be very useful
- Does anyone know if other developers have managed to get Source and the CryEngine to run in a CAVE system? Through all my research I haven't been able to find anything on this, but then my google skills aren't the greatest.
If anyone could spare the time to answer these questions, I'd be extremely greatful.
Thanks.
Answer
This isn't a research article on the subject (for that I would refer you to the Electronic Visualization Lab at the University of Illinois in Chicago where CAVE was invented) but having worked with these sorts of systems in the past I can say that CAVE style rendering almost always depends on having multiple cameras pointing in different directions all located at the same place.
There may be more exotic approaches out there (involving some sort distorted camera FOV or something) but every time I've done it was with multiple cameras parented to the viewer, and each camera carefully setup so that the multiple views line up appropriately. In a traditional CAVE setting the cameras are pointed at 90 degree angles from each other, but I've done things like a super-wide view by making the cameras side-by-side:
http://www.newarteest.com/coa/coa.html
Then you feed out each camera's view to a separate video card, with each projector in the CAVE hooked up to a different video card.
Incidentally, I wasn't using any of the engines you mentioned, but any 3D graphics engine that supports multiple cameras (which almost certainly includes all the game engines you mentioned) should do. Because CAVEs generally exist within academic settings, the graphics engines usually used also come from academic settings, like Ygdrasil or Electro
art - How do I find artists to work on my game?
I ask "how" rather than "where" because there are undoubtedly lots of artists that are just plain lousy or unreliable.
Let's assume both paying and non-paying (mods, free games/open-source) positions.
Answer
One tip I've heard is to build as much of the game as possible before looking for artists. Build the game with placeholder art before you post about the game so that artists can get a feel for the game, its play style and environment, etc before building assets for it. They can also use the prototype to decide if it's a project they'd actually like to work on.
Another tip I've heard is to avoid asking for people to "join your team" as this seems "noobish". Instead post the prototype and say that you need an artist or artists to finish it. If you post at the right communities someone will almost always come along that is interested.
You can, of course, pay an artist per asset, etc from a more "professional" site. This is really a personal choice. Modelers, musicians, voice actors, etc can all be hired from sites that can be found with some quick googling. However keep in mind that you should still provide these people with as much of a game as possible so they can create something that "fits". You can also easily determine if a model will deform properly, light well, etc before accepting the asset if you have build as much of the game as possible beforehand.
One final note, if you are building any artist tools: be sure to have them rock solid and well documented before sending them to an artist, or you will waste time and money sending them revised versions of the tool or having them rebuild assets.
c# - How to import or "using" a custom class in Unity script?
I have downloaded the JSONObject plugin for parsing JSON in Unity but when I use it in a script I get an error indicating JSONObject cannot be found. My question is how do I use a custom object class defined inside another class. I know I need a using directive to solve this but I am not sure of the path to these custom objects I have imported. They are in the root project folder inside JSONObject folder and class is called JSONObject.
Thanks
Some words which mean "thinking over something deeply or for a long time "
I put together some words which generally means thinking over something deeply or for a long time. I know that we can not use every word in the same sentence just because they have similar meaning. So I would like to ask you to fill in my sentence with suitable words among them. Please choose more than one word if possible:
I have been ................ my son (all day) since he left home for college.
I have been ................ my debt. I owe $10,000, and I will have to pay it by next week, but I don't have enough money. So I have to find a way.
I have been ................ my new school project. I don't know where to start.
The government .............. how to stop the protests (about raising student fees).
My words:
- to ponder
- to mull over
- to contemplate
- to cogitate
- to deliberate
- to ruminate
- to dwell on
and any advice is welcome to help me discern the differences among them.
Answer
to ponder
means to, over a period of time, think about the consequences of two or more choices in a decision. If there is only one thing you are pondering, you are pondering whether or not to do that thing.
to mull over
is the same as ponder - but you can mull over collective nouns, meaning you are trying to decide which one of the group. "I mulled over the candy, and found a good piece."
to contemplate
means to think about the consequences of something carefully, thoroughly, and for a long time. Typically when you contemplate something, you are deciding whether or not to do it, not picking among an array of choices. It has a serious connotation, likely due to the common phrase contemplate suicide.
to cogitate
I don't hear this word a lot. According to Google, it can be used intransitively, so you don't have to be cogitating about anything in particular. The other words here generally require a "target" to make sense.
to deliberate [on]
means the same as contemplate. When I hear this word, I think of court proceedings or meetings ("the jury will deliberate... etc.").
to ruminate
I don't hear this in speech very much. In my opinion it's a "less serious" version of contemplate.
to dwell on
means to think about something over and over. It could be the consequences of a decision not yet made, a decision that just has been made, or it could be going over past events in your mind. Dwell on can have a negative connotation, possibly that what you are dwelling on is bothering you or haunting you.
So, I would answer like this:
("depth 10k worths" doesn't make sense to me, so the second is a guess)
I have been dwelling on my son (all day) since he left home for college.
I have been mulling over my depth 10k worths because I will have to pay it by next week but I don't have enough money. So I have to find a way.
I have been dwelling on my new school project. I don't know where to start.
The government deliberated how to stop protest on raising student fees.
Wednesday, April 18, 2018
What does the slang "Breaking Bad" actually mean?
I heard this mentioned on the show that has the same name but the Portuguese translation is scary: The Chemistry of Evil
.... What the real sense that the writers of the show wanted to go with this "slang"?
breaking
Synonyms: breach, cracker, fracture, offscourings, break, rupture, disruption, breakage, burst, fracture, break, breach, breakage, cracking, transgression, trespass, offense, breach, infringement, eruption, rash, outbreak, acne, boil, bankruptcy, smash, ruin
bad
Synonyms: poor, mean, perverse, evil, wicked, mean, flagitious, felon, ill, bum, dark, unpleasant, nasty, disagreeable, distasteful, seamy, unfavorable, adverse, contrary, inopportune, unsuitable, untimely, inconvenient, importunate, harmful, detrimental, injurious, prejudicial, deteriorative, bottom, less, inferior, under, inelaborate, severe, harsh, stern, grim, strict, deficient, faulty, wanting, lacking, scanty, sore
Answer
You won't find it in a list of synonyms for "break", because lists of synonyms focus on just one sense of a word. The word "break" has many different senses, and "breaking bad" combines several unusual ones at once.
Basically, in the series title, it means "becoming bad": becoming a bad person or engaging in bad or violent behavior. But "break" in this sense has much richer connotations than "become"—which, of course, is why the show's creator chose to call it Breaking Bad and not Becoming Bad. Explaining connotations is hard, but here goes.
As your list of synonyms suggests, the primary sense of "break" is: "to sever into distinct parts by sudden application of force; to part by violence" [OED]. An extended sense is to break through a barrier, especially at the start or the end of a long process. To break ground is to begin digging into the ground, as the first step of constructing a building, or to begin digging in preparation to plant seeds in farmland, or metaphorically to undertake the first step of anything. When a pregnant woman breaks water, this means that the sac that holds the baby and amniotic fluid has burst, signifying that she will soon begin labor. Near a shoreline, a surf is said to break when it nears the shore and topples over.
Those extended senses all suggest some kind of important transition, where something "breaks" in the primary sense. Here are some more, which are closer to "breaking bad". To break free is to cross a barrier or burst through a bond that had previously constrained you; to escape. To break news is to tell someone the news for the first time. When the news itself is breaking, it's happening right now. When a storm breaks, a downpour of rain suddenly begins. The break of day is the moment when the Sun first appears above the horizon. To break even is to have your gains and your losses come out equal ("even"). If you are playing billiards, and the ball breaks left, that means it turns to the left instead of going straight.
Now are you starting to see how "break" stretches from its primary meaning toward something like "become"? The senses along the way are not completely forgotten; they're still suggested or evoked. This Time magazine article quotes Vince Gilligan, the lead writer of Breaking Bad, defining it as a Southern U.S. expression meaning "raising hell". But as the article notes, Gilligan's definition doesn't do justice to the full meaning of the term, which is probably impossible to define precisely. In the first episode, Jesse uses the phrase to refer to Walt's inexplicable change from a straitlaced, middle-aged high-school teacher into a budding criminal. That's the theme of the entire series, of course.
The OED offers this as definition 39c:
To happen, occur. slang (orig. U.S.)
and includes these illustrations:
"Things are breaking right for me."
"Everything'll break good."
So, breaking bad suggests something of the change of course of "breaking left" in pool, something of the transition into chaos of a "breaking" surf, and something of the end result as in "breaking even".
I can see why a translator would choose not to translate it, favoring instead a completely different title. What makes the title so expressive in English—the simultaneous resonance of many senses of break—makes it impossible to translate directly to another language.
Simple past, Present perfect Past perfect
Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...
-
As in many game libraries such as LWJGL, you can check mouse/keyboard events with Mouse.isButtonDown or Keyboard.IsKeyDown. I want to check ...
-
Will all the three sentences express this idea naturally? Section two roughly symmetrical pieces of your hair at the front. (Used by an Amer...
-
I am looking for a way to calculate surface area of a 3D mesh object and found this code from a Unity forum : public float Area(Mesh m) {...