# Question
Title: How do I check if an item no longer exists in GameMaker Studio?
Let's say I have an array of `objects[i,j]`, which has been fully populated by objects `obj_example`. I want to delete the `obj_example` at position \[1,2\]. That's simple, as `objects[1,2]` is currently pointing to that object (or is the object, or whatever logic Gamemaker uses).

But now, the object at `objects[1,2]` is destroyed.

What `if` statement would I use to check that makes `objects[1,2]` return an `undefined`(or null) value (but, clearly, not make the other, populated objects return such)?

Or how would I otherwise know that the `objects[1,2]` were destroyed?

EDIT: I added the following to my little project, after `object_handler` (which was made equal to the `objects[i,j]` to be deleted) was deleted. It returned "this is defined."

```
if (is_undefined(object_handler))
{
    show_message("this is undefined");
}
else{
    show_message("this is defined");
}

```

So...is\_undefined(n) does not work for this purpose.

# Answer
> 3 votes
It seems you have to use `instance_exists(object)` to check if the object has been deleted or not. This will return `false` when the object has been deleted. So in your case do

```
if (!instance_exists(objects[1,2])) {
    //Does not exist
}

```

To be safe you could also set your variable to a predetermined value when it is destroyed, perhaps set `objects[1, 2]` to `undefined` so you know it doesn't exist anymore.

---
Tags: game-maker
---


title: Why does handedness matter at all?

text:
# Question
Title: Why does handedness matter at all?
I'm really trying to understand this from a mathematical viewpoint. After all, numbers are numbers, the chirality or handedness depends on how one interprets it.

Say I've three basis vectors **x** (1, 0, 0), **y** (0, 1, 0) and **z** (0, 0, 1). The same basis vectors would be seen differently by the two systems *but* the numbers remain the same.

When we do a cross product of **x** and **y** we'd get **z** in both systems, again the numbers of the result are the same, it's just the interpretation of the observer.

Then why do I see questions about handedness all the time? Is there a place where a game developer needs to differentiate and work in converting between the two really? Eric Haines in a related article uses the term "right-handed data". What does this really mean, aren't they all numbers? Why would they force a coordinate system on the user? Also do APIs like GL or DX force a system at some point? I've read somewhere that, in OpenGL the camera is always at origin looking at -Z direction, while it's the opposite in DirectX.

It'd be great if someone can list out where this convention really makes a difference and why.

**EDIT:** I think can explain it more explicitly since many seem to misunderstand the question (sorry, I'm not a native speaker of this tongue). Why do people talk about converting an asset for handedness? Say a triangle with coords (0, 0, 0), (0, 1, 0) and (1, 0, 0) would mean the same in both systems mathematically, where is the handedness here?

# Answer
> 6 votes
I'm not sure about OpenGL but DirectX allows you to over write the default left-handedness therefore it wouldn't matter. As you've said, it's "nothing but" a convention, and at least DirectX allows you to work with both. Conventions do not matter by themselves, the only problem is that you need to be consistent with your choice. Mixing two such systems leads to either confusion (if you do make the conversions) or to all sorts of errors if you do not (but why would anyone do that, except for mistakes).

As to what Eric Haines refers to as "right-handed data" I bring this quote from the beginning "OK, so only for viewing you must also know the handedness of the data." and that's exactly where handedness matters, when viewing it. Does a Z-component of 1 make the object closest possible to the screen or furthest? That's why you need to know the handedness of the data, to interpret the data correctly when doing the depth test.

# Answer
> 3 votes
It doesn't matter in the sense that the handedness is arbitrary; either way works fine so they just picked one. They only "force" their way on the user in the sense that they had to pick something so they went with that way.

However it *does* matter in that you need to be consistent about what the numbers mean; it doesn't matter what decision was made initially, but once a decision is made you need to stick with it. For example, when you say:

> When we do a cross product of x and y we'd get z in both systems, again the numbers of the result are the same, it's just the interpretation of the observer.

that's not exactly true. The magnitude of the resulting vector is the same, but they point in opposite directions.

# Answer
> 2 votes
Handedness — and choice of axes, in the same way — matter because *the camera has to match* to get the results you want.

Suppose that you had a dataset (scene) which included not only the objects to view, but also a definition of the camera, in terms of a position and (right, up, forward) basis vectors and a winding order for face culling. In that case, then obviously once you apply the camera transformation to the data you get the same screen-space points no matter how the data is arranged in world space.

The reason that we care about the axes/handedness/ordering of 3D data is because in games, **the camera is not defined in the data** but added by the game engine afterward, so we choose a camera design and say that all the data has to match that. (Also, multiple 3D models are combined in one scene, and they *all* have to match the camera, or be transformed to match.)

---
Tags: 3d, vector, coordinates
---


# Question
Title: How to multiply a matrix by a point in directx 11
Just like the title, how do I multiply a point by a matrix in directx 11

# Answer
> 1 votes
You haven't specified if you are trying to do this on the CPU or on the GPU.

For GPU-based work, you do this in an HLSL shader. For example, from the Direct3D 11 tutorial #4:

```
VS_OUTPUT VS( float4 Pos : POSITION, float4 Color : COLOR )
{
    VS_OUTPUT output = (VS_OUTPUT)0;
    output.Pos = mul( Pos, World );
    output.Pos = mul( output.Pos, View );
    output.Pos = mul( output.Pos, Projection );
    output.Color = Color;
    return output;
}

```

If you are doing this on the CPU, it's important to understand that this isn't actually part of "DirectX 11". Instead, there are various utility libraries that can do this or you write your own. The recommended math library for DirectX development these days is DirectXMath which is included in the Windows 8.x SDK and the Windows 10 SDK.

With DirectXMath you use the `XMVector2Transform`, `XMVector3Transform`, or `XMVector4Transform` functions depending on your input vector.

```
using namespace DirectX;

XMVECTOR v1 = ...;
XMMATRIX m = ...;

XMVECTOR result = XMVector3Transform(v1, m);

```

> You use basically the same functions in the older xnamath library that was in the legacy DirectX SDK, although you should move to using DirectXMath instead. You should avoid using the deprecated D3DXmath functions.

Since you are apparently new to DirectX 11 development, I recommend you take a look at the DirectX Tool Kit tutorials, and in particular take a look at the SimpleMath wrapper for DirectXMath.

# Answer
> -1 votes
Try passing your point into D3DXMatrixTranslation(), and your newly generated matrix will be fit for multiplication.

---
Tags: directx11
---


# Question
Title: Limiting number of user clicks to reduce micro: best method of implementation?
I'm making a client-server game where the user can select armies and move them from one place to another.

In a bid to reduce the advantage of "being able to click faster" I've decided to implement several anti-micro measures, one of which is to limit the number of clicks (or move orders) that the user may issue.

In order to discourage individual unit micro, group move orders and individual unit orders both count as one move order.

What's the best way to implement this? I've thought of 2 ways:

1. Have countdown-timers both on the client and server. The timers must be synchronized - perhaps by the server sending the countdown time to the client. If the client issues a move order before the countdown is finished, the order is ignored.
2. Have randomly generated "move tokens" issued from the server to the client every few seconds. In order for an order to be accepted it must come with a valid move token, and each "move token" is only valid for one mode order.

Which way of implementing it is better? Any other good ways?

# Answer
Simply limiting the number of clicks a user can make approaches the problem from the wrong angle. At best, your players will perceive your game's input controls as unresponsive and glitchy. At worst, they will notice that you are using a cheap trick to prevent them from getting better.

If you want your game to be decided by macro-management strategy and not by micro-management skills, then you should approach this from a game-design perspective. Design your game in a way that being capable of making more actions-per-minute than your opponent just won't help you to win the game.

* Make units act smart and autonomous so they don't need the player's help to reach their full potential.
    + Have them automatically prefer targets which are vulnerable to their weapons
    + Have them automatically prefer targets which are already damaged, but have them still avoid unnecessary overkill
    + Make them capable of pulling off advanced maneuvers on their own (like kiting an opponent with less range and speed)
    + Have them use their special abilities on their own and not just when the player tells them to
    + Give your units some common sense self-preservation instincts (automatically move to nearby cover if under fire, automatically flee if attacked by an enemy and they can't attack back, etc.)
    + Add a lot of settings to dictate unit behavior for each unit. Any of the above behaviors should be possible to switch off and on, in case the player puts the units in a situation where these features are counter-productive.
* Don't make combat too fast-paced, so players have more time to react if they notice they are losing a battle. You can do that by increasing the number of hits each unit takes.
* Find and eliminate any exploits which require fast micro-management (like getting around attack cooldowns by quickly loading and unloading units into transports). Many RTS games intentionally leave such exploits in the game to extend the skill ceiling. If you want to keep the skill ceiling low, you should get rid of them. You might want to watch some videos showing off micro-management tricks in other RTS games and make sure none of these will work in your game.
    + Or alternatively, program your unit AI so that units can do these tricks on their own, as already mentioned before.
* Dive deep into the science of multi-agent route-finding algorithms to make sure that getting a large army from A to B as fast as possible doesn't require more than one click. There is a lot of research to this.

You might even go so far and remove direct unit control altogether. Let the player give indirect strategic priorities instead and have the player's units act on those priorities on their own.
> 11 votes

# Answer
You could design a "penalty" in to the units when they receive commands. So an idle unit could respond to a command immediately, while one that already has a command will take some time to respond.

Conceptually, following a command takes a unit away from their idle state, and in order to receive another command they need to go back to that idle state first.

This avoids the issue that Phillip raises:

> Simply limiting the number of clicks a user can make approaches the problem from the wrong angle. At best, your players will perceive your game's input controls as unresponsive and glitchy. At worst, they will notice that you are using a cheap trick to prevent them from getting better.

So long as you make the delay seem natural.

Some examples:

* A tank in motion can't just spontaneously turn around
* Perhaps some time to change a target, or switch weapons
> 3 votes

---
Tags: algorithm, multiplayer
---


# Question
Title: Can Neural Network play tic tac toe? Is this have any common sense?
I'm thinking about theoretical possibility of playing tic tac toe by neural net. Is this have any common sense? Let's consider tic tac toe which contains 3 rows and 3 cols (it's 9 cells). Ok, then the input vector is contains of all our cells: \[0..8\], where 0 - is: "O", 1 - is: "X" and 2 - is empty cell.

But what we have for the target vector? On every NN's step we need to know some target and make our distance to target shorter. But the target of this game is only win (or maybe draw), I don't understand how we can make shorter our distance to win. Is any suggestions?

My goal is to learn more about neural networks in games that's why I consider such easy game. Maybe it's not the best choice for the NN and I need to consider some other game? :)

# Answer
You define what is an advantage. For instance in an actual game scenario, an advantage may be defeating or damaging an enemy unit or perhaps recruiting an optimal unit. In this scenario, an advantage would be perhaps blocking one of the enemies paths while positioning yourself in a spot that is as unconstrained as possible.

Example:

Each player can win in two moves in two possible ways: straight column and a diagonal sequence.

```
X|_|O
_|_|_
 | |

```

Possibly worse move: player X can now win in two moves, in three ways (two columns and one diagonal). However she did not block player O at all.

```
X|X|O
_|_|_
 | |

```

A slightly superior move: player X can win in two moves in three ways (one column, one row and one diagonal) and also blocked one victory path for player) (the column).

```
X|_|O
_|_|X
 | |

```

A superior move: player X can win in one moves in one way (one diagonal) and two moves in two ways (one column, one row) and also blocked one victory path for player) (the column).

```
X|_|O
_|_|_
 | |X

```

Basically each move pays for a making a theoretical victory possible in less moves, blocking a winning path for the enemy and thus increasing her minimal move count to victory.
> 4 votes

# Answer
If it's really just for fun, how about you take the optimal solution that user41806 posted and use it to define the error?

Seeing that you know the number of possible wins, defeats and draws that each state can result in, you could assign a positive value to a win-scenario and negative values to defeats and draws. To get the desirability of a state you sum those values up and divide them by the number of total outcomes:

```
E = (nWins*3 + nDraws*-1 + nDefeats*-2) / (nWins + nDraws + nDefeats)

```

(or something like that)

Using an ANN here is really not practical though, because it's difficult to factor the opponent in: You might want to scale each outcome-value by the number of steps it takes to get to it, but in what way? With a dumb opponent you want to get to the end quickly, but a smart opponent might recognise a scenario that's too obviously bad for them.

ANNs are more useful for fuzzy, unclear situations, while perfect information games like Tic-Tac-Toe (Chess, Checkers etc) are usually done with mini/max, which is arguably a bit boring, but you can still make the agent behave more organically and human-like (stupid) by randomly limiting how far they look ahead or by scaling each state's desirability by a random Gaussian number, to make the agent make "mistakes".
> 1 votes

# Answer
"Neural network" is largely a buzzword, real game AI is a lot of different things, but rarely something that fits the term thoroughly.

The closest thing that can broadly be applied to games is automatic optimization of magic constants, that is when you have written a reasonable AI for your game, you can take all the potentially different constants of that AI, put them on a list, and have the AI play against itself with different values of those constants to determine which set is better. You can then take the winning set, apply some further changes, let the changed set play against the original etc. Depending on how fast you can play a game you might end up running through millions or billions of games in the process.

The process itself has to be crafted carefully, if you adjust the numbers too little it will be too slow, if you adjust them too much you'll almost never get anything better. If you don't play enough games with a given set of AIs the result might be too random. But do in general make sure that there is some random behaviour or you risk making an AI that only plays well against the previous iteration. Having a broad set of different enemies to test against may also be a good idea, even if they are objectively not very good.

And of course this whole process won't save you if you haven't made an AI that is suitable for it in the first place.

If you want to test it out on Tic Tac Toe, write an algorithm that for each possible move generate a number based on some properties of that spot. Then choose a move randomly with greater chance for choosing a move with a high number. If don't include the chance you won't train for countering a lot of the possible moves.
> 1 votes

# Answer
While training a neural network to play Tic Tac Toe should be possible, I don't see the purpose. The game was fully analyzed and the optimum approach is known. A very good visualization for that can be found here: http://xkcd.com/832/
> 0 votes

# Answer
When i started working on my Tic Tac Toe which uses neural net and get its training data from the opponents moves(Human Player), i was also thinking of this problem about the output vectors, then I tried something which may help. I used a multilayer perceptron network with 9 input neurons and 9 output neurons, for input neurons the inputs were 0-\>empty,1-\>X,-1-\>O and for each board state I generate an output array as 1-\>last move that opponent played and 0-\>all other moves. then with each move i find the neuron with the largest output vector and the index of that neuron was the Neural Player's move.
> 0 votes

---
Tags: ai
---


# Question
Title: How to avoid player base schisms created by levelling gaps in MMO games?
In WoW, players are split into strata (Pvp Tiers) 10-20 / 20-30 / 40-50 / 50-60...

This causes the playerbase to split. It creates a rift, players of uneven levels cannot be matched together for gameplay purposes. For example a lvl 1 player would suicide (1shotted) if he dares to attack an AFK druid from his thorn buff (30 min duration) before the autoattack lands.

Another game suffering from same issue is Clash Royale. If players power creep with additional level cap increases. And when more players reach the top strata, the other strata will become isolated.

Example: Low strata 0.1% playerbase. Top stratum 99.9% playerbase.

**Matchmaker Constant Bickering:** I was matched with a player N levels above me. This is unfair.

1. If the game was designed today from start, how would game design solve the issue before it ever began.
2. Is it possible to create "Power gaps" in player base, without splitting it?

# Answer
Generally such systems use \[player\_level\] +/- Y, where Y is some value that is roughly "fair." E.g. 5.

So a level 15 player is a decent matchup against both a 10 and a 20, even if a level 10 isn't a fair matchup to a level 20. This gives a "floating bracket" around which to match players together.

How wide your bracket is would depend on your game, how important +1 level is, and other factors, which would probably require some testing. There's no easy way to know that the lower-level player has a decent chance against the higher level player as there are a lot of factors: max hit points and damage output are only one. Status infliction abilities, max mana, gear, etc. etc. can all influence the outcome.

Another option (which works best when most players are "top tier") is to use a Chess Rankings-like system. When two players go up against each other, determine their ranking difference. If the higher-ranked player wins, the point change on both is small (and the greater the difference, the smaller that change is). If the lower ranked player wins, the point change is large (and the greater the difference, the larger that change is). For evenly-ranked players the point change isn't very large, but it would be the same for both players (i.e. it doesn't matter who wins, the point shift is still X). The EFC Grading page goes into detail on how to calculate the point shift, but you're free to come up with another algorithm.

So even at the "end game" where everyone is level 100 (the cap in your game) players will have different skill levels and this rating system will match up evenly skilled players. You can also allow any two players to face off against each other, regardless of their rating (although you may wish to give them the option to say "this game is unranked" so they aren't wagering points1).

For lower level players I would suggest a floating bracket with a hidden ranking number underneath. The level is more important during this time, while also having the system track wins and losses in the ranking system, then when the player hits the point at which they're allowed to fight players at the level cap, their ranking can unhide and be a better determination value. By tracking their ranking up to this point you don't dump them into the Big Kids pool with a default ranking score: afterall, you *could have* data about their performance up until now, so you may as well track and use it.

1Off-topic: back in highschool one of the math teachers ran a chess club during lunch. Against one friend I almost always won games that were ranked against him and almost always lost when unranked. Irked him pretty bad, as he was ranked quite a bit higher than I was.
> 1 votes

# Answer
Make your PvP gameplay level-agnostic by using different game mechanics in PvP which negate level advantage.

When you designed your game mechanics properly, you should have a progression formula which tells you how much hit points, DPS, etc. a level X character with level X appropriate equipment has on average. You will need such a formula in order to balance your PvE content properly.

Now you just have to use your power-by-level formula to adjust the character stats in PvP up or down depending on character level. That way even a level 5 character is mechanically on-par with a level 87 character. The combat will be decided by strategy, tactics and mastery of the game mechanics, not just on who spent more time grinding.

If you are worried that this will go completely against the idea of character building in an RPG: Remember that characters can still be above or below the power-by-level curve due to smart character building decisions and luck with equipment drops. So characters will still have different power in PvP. Just that they won't depend as much on level. Also, higher level characters will usually have access to more abilities, which gives them more flexibility (even if those abilities aren't mechanically stronger due to above described level normalization).

This is essentially how most non-RPG competitive multiplayer games with character progression work: Reward progress with access to more weapons and abilities, but don't just make characters nominally stronger.

**Possible pitfall:** If your game allows low-level characters to use high-level equipment or receive high-level buffs, their power will greatly exceed the average power on their level. That can make them extremely overpowered in PvP. The easy solution would be to simply disallow that (equipment gets level requirements, buffs received in PvE don't work in PvP). The harder solution would be to also have level-scaling rules for equipment and buffs in PvP.
> 0 votes

# Answer
For a current project, the approach I'm considering is to have lateral level progression. A low level maximum, and progression for players actually places them at a lower level. I haven't had a chance to implement or test this yet, so it's more a thought experiment at the moment.

Player experience is divided into three parts.

1. New to Game
2. New to Aspect (class, mechanic, etc.)
3. Mastery of Aspect

And apply a set number of levels for each part, I'm starting with 10 for each.

Level 1-10 are content for getting users used to the game both from a mechanics and story, as well as a social aspect (knowing terminology, how social features work, etc.)

At this point they can choose a specialization, in the form of a class for my use.

Then levels 11-20 is introducing different mechanics of that specialization. So all mechanics are available at level 20.

From levels 21-30 they're given customization choices for the specialization. This allows them to master that specialization.

At any level between 21-30 they can choose to change to a new specialization and this brings them back to level 10 or possibly 15 with some of the new mechanics of the new specialization.

With this, stat difference between the core of players, level 10 - 30, can be kept within a smaller range, and advantages for players may be found more in what specialization they have and how they use it.

This also allows for expansion of the game without having to bump the level cap with each addition.
> 0 votes

---
Tags: game-design, game-mechanics, mmo, balance
---


# Question
Title: Literature for Inverse Kinematics: Joint Limits and beyond
Recently I've been playing around with Inverse Kinematics and have been pretty impressed with the results. Naturally I want to take it further, but have no clue where to start. In particular, I would like to introduce joint limits (ie for a prismatic joint how far it can move, hinge joint what angles it has to be between, etc etc).

Currently I understand how to produce the Jacobian matrix for the various joint types. I am particularly looking for literature (preferably free, and preferably easy to understand) on various ways to implement joint limits. Also I would like to find out different ideas on how inverse kinematics can be used.

# Answer
> 4 votes
This is probably not the best answer I can give now, but consider Cyclic Coordinate Descent (CCD) which works for non-invertible Jacobian matrices. A short video here.

The best source covering CCD is Chris Wellman's own MSc thesis. For a minimal/short review, you can read this source that mentions most methods out there.

A more mathsy paper (for the researcher in you :D) is this one http://math.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf.

For the hardcore researcher: http://matwbn.icm.edu.pl/ksiazki/amc/amc19/amc1941.pdf

This seems like a hybrid method, although they're just slides with mostly familiar notions: http://cmp.felk.cvut.cz/~hlavac/TeachPresEn/55IntelligentRobotics/KjchoInverseKinematics.pdf One more worth reading: http://www.cns.atr.jp/erato/DB/PDF/tevatia-icra2000.pdf

Since you said you'd rather have free sources, I'm not gonna mention the few books that one can buy from Amazon that tackle this problem. Personally, I am satisfied with CCD. For ultra precision, I prefer the Inverse Jacobian (where I know the system yields an invertible matrix thanks to the 6 DOF of a robotic rig).

How can IK can be used? Mostly when you want to animate a character by supplying only a position and orientation of an end effector of a certain limb. (youtube for examples). If you want to start a career in robotics, IK is a must if you're dealing with articulated robots. In the world of gaming, it's a must when you employ motion detection of human gestures via a camera (e.g. http://www.youtube.com/watch?v=HSradQVj26E \- my simplistic example of a wiimote interface and a ccd virtual robotic arm).

# Answer
> 2 votes
# ***Original Article: Overview of Inverse Kinematics***

I highly suggest the above link for a high level overview of Inverse Kinematics. It goes over IK jargon, IK usage/applications, and high level descriptions of the forward kinematics and inverse kinematics.

# What are the uses of IK?

IK can be used for a humanoid arm to reach for an object/target, as we’ve seen. IK can also be used for foot stepping, such that we tell the foot where to step and the IK figures out how to configure the leg joints. IK is not usually used as an animation itself (reaching for an object), but more as an animation tool. So, if you are implementing a walk cycle, you could position some of the key frames using the IK tool.

Another key point about IK is that your goal/target is not limited to position alone — your goal can be defined as a rotation. For example, if your feet need to rotate based on uneven terrain, your IK rotation goal can be defined based on the floor’s normal. This way your feet are inclined along the floor, such as when you are walking up an incline. Note that you can also use IK to have your head (or even eyes) look in a certain direction. If you want your head to follow an object, you can use IK to have the head follow the object around.

# How do I implement joint limits?

I usually implement joint limits with a simple if-statement. For example, this would work for revolute joints.

```
if (limb.rotation >  45.0f) limb.rotation =  45.0f;
if (limb.rotation < -45.0f) limb.rotation = -45.0f;

```

It's a lot less mathematical than the Jacobian, and extremely easy to implement once you have the Jacobian working.

---
Tags: mathematics, inverse-kinematics
---


title: Inverse kinematic joint limits

text:
# Question
Title: Inverse kinematic joint limits
I want to limit the joint angle of my character. I have just one issue i can't get the value of the joint limits of the human -i search about max, min angle of each joint in x and y but i can't get them- can someone give me them.

# Answer
> 1 votes
# How do I implement joint limits?

I usually implement joint limits with a simple if-statement. For example, this would work for revolute joints.

```
if (limb.rotation >  45.0f) limb.rotation =  45.0f;
if (limb.rotation < -45.0f) limb.rotation = -45.0f;

```

This works with Jacobian Methods, CCD Methods, or FABRIK Methods.

---
Tags: c++, rotation
---


# Question
Title: How to dynamically animate a part of a 3d model towards something
I'm curious about how this sort of animation is typically done code-wise.

A few examples:

# Answer
> 4 votes
This is called inverse kinematics. Google is probably your best friend on this one as it can get complex.

# Answer
> 0 votes
# ***Original Article: How to Code an IK System***

Sometimes the IK that is built into Unity is not enough. I’m going to show you how to build your own IK script for Unity. You can apply this IK to any articulated body — fingers, hands, or feet. The IK that I’m going to review is currently used by Unity, Unreal, Panda, and several other game engines. It is called FABRIK.

FABRIK is an iterative method. An iterative method is a method that does not get the solution right away. An iterative method gets closer and closer to the correct solution with more iterations of the method — in other words, iterations of a loop.

Any IK problem has a given articulated body (a set of connected limbs with lengths and angles). The end effector (the position of the endpoint of the final limb) has a start position with a goal position. It might have other goals, such as angles.

Each FABRIK iteration has two main parts.

```
void FABRIK() {
    while( abs(endEffectorPosition — goalPosition) > EPS ) {
        FinalToRoot(); // PartOne
        RootToFinal(); // PartTwo
    }
}

```

The first part iterates from the final limb to the root limb. For the final limb, you need to change the angle/rotation of the limb to point at the goal position (keeping the inboard position anchored, and letting the outboard position be translated by the angle change). Next, you translate the final limb along the updated angle towards the goal position, until the limb’s outboard position equals the goal position (maintaining the angle, but letting the limb’s inboard position change). That’s pretty much it for the final limb, except that you now need to update the current goal position. The current goal position is now set to the updated inboard position of the final limb.

For each consecutive inboard limb, you do the same thing. To be clear I will outline it. For the current limb, you need to change the angle/rotation of the limb to point towards the current goal position. Next, you translate the current limb along the updated angle towards the current goal position, until the limb’s outboard position equals the current goal position. Finally, you update the current goal position to be equal to the updated inboard position of the current limb.

Repeat these operations until you’ve completed these operations on the root limb. After that, the first part has been completed.

```
/* Part One */
void FinalToRoot() {
    currentGoal = goalPosition;
    currentLimb = finalLimb;
    while (currentLimb != NULL) {
        currentLimb.rotation = RotFromTo(Vector.UP,
            currentGoal — currentLimb.inboardPosition);
        currentGoal = currentLimb.inboardPosition;
        currentLimb = currentLimb->inboardLimb;
    }
}

```

The second part iterates in the reverse direction: from the root limb to the final limb. For the root limb, you need to update its inboard position to the root position. This should translate the whole limb (without stretching). That’s pretty much it for the root limb, except that you now need to update the current inboard position. The current inboard position is now set to the updated outboard position of the root limb. For each consecutive outboard limb, you do the same thing. To be clear I will outline it. For the current limb, you need to update its inboard position to the current inboard position. This should translate the whole limb. That’s pretty much it for the current limb, except that you now need to update the current inboard position. The current inboard position is now set to the updated outboard position of the current limb.

Repeat these operations until you’ve completed these operations on the final limb. After that, the second part has been completed.

```
/* Part Two */
void RootToFinal() {
    currentInboardPosition = rootLimb.inboardPosition;
    currentLimb = rootLimb;
    while (currentLimb != NULL) {
        currentLimb.inboardPosition = currentInboardPosition;
        currentInboardPosition = currentLimb.outboardPosition;
        currentLimb = currentLimb->inboardLimb;
    }
}

```

Once the first part and the second part have been completed, you have completed the first iteration of the FABRIK method. Continue iterating on part one and two until the end effector is as close as you need it to be to the goal position, defined by some EPS (epsilon value).

That’s it! That’s the FABRIK method. Part One iterates backwards from the final limb. Part Two iterates forward from the root limb. The FABRIK method iterates Part One and Part Two until the end effector is close enough to the goal position.

---
Tags: 3d, animation, models, 3d-meshes, blending
---


# Question
Title: Unity 2D - Problem with player running ON wall instead of falling
I´m having a problem with my game (yes, I'm new with Unity). I'm trying to make a simple 2d platformer and I ran into this situation:

Youtube Link

As you can see, when the player hits the BoxCollider from the side, it tries to get a hold of it instead of just keep going down...

These are the properties of my player:

And the block only has the default box collider.

Any ideas? Thanks!

# Answer
> 0 votes
It seems you are returning grounded when against a wall so you are able to see a walk animation and also jump.

If you are using a ground layer to determine the ground then just create the walls on a different layer so you will not return grounded and will fall normally.

Adding a slipping effect using a physics material on a collider could also work around that issue if you are not using layers.

---
Tags: unity, collision-detection
---


# Question
Title: Character animation in physics-simulated environment
What are the standard solutions for animating characters in physics-simulated environments?

Let me explain what I mean - in most games characters are pretty much excluded from physics simulation - there are no forces acting on specific body parts (only gravity for the whole character) and limbs are forced to go into positions specified in key frames of animation... which in turn may produce infinite forces on the limbs and we know real muscles have limited strength...

What I want is character animation based on simulated muscles with plausible limitations - so character walking into a 1 T stone won't move it, or if he gets hit with a fast flying brick he would realistically fall (and brick won't just bounce like from the wall, whit character standing still like nothing happened).

Are there libraries that can do that? Maybe free ones for 2D simulations?

# Answer
> 3 votes
Inverse kinematics. That is the word I think you are looking for (easily googlable). As for libraries, I do not think so. It is very rare technique - the only game I can think of using inverse kinematics is Kingdom Come: Deliverance.

# Answer
> 1 votes
Mmmm, interesting question.

The first approximation could be the following: simply divide your character into a set of physical bodies. I mean, you could calculate resultant force on legs, feet, arms and hands and operate with the results. Think in Rayman, for example. It can be a good model to start with. The character would be formed by head, body, hands and feet. Every component would be attached to the body with a rope-like object (so if you make a lot of force in the body, the other parts will also be affected and viceversa). For example, if you pull a hand with a external force, the hand will move. But also a elastic force would appear to the hand, proportional to body distance. This will limit the separation. Also a proportional force would appear on body, pulling our character... I think you get the basic idea. Of course, if you add more elements, your model will be more realistic, but it will be also difficult to calculate.

Also, you can be a bit tricky. Looks like you want a character that reacts realistically to extern media. The examples you mentioned could be solved using a "walk force" (the force the body do in another body when it walk into it) proportional to walk speed, so if the player runs it will be able to move the stone. For the falls, simply divide your sprite into regions, get the collision angle and play an addecuate animation. You could have a set of 2-3 animations and make some changes (angle fall or speed) via code to make look it realistic. And believe me: a good animation with an appropiate walk speed can emulate perfectly muscle movement and physical behaviour of your character, if you code it well.

Hope this give you some ideas. It may not be the anwser you were expecting, but I think you first have to plan which simulation method are you going to use in detail :D

# Answer
> 1 votes
I've been puzzling with this in the creation of my physics based game. I've decided to settle with creating my animations used a skeletal key-frame based animations system (Similar to flash if you've used it).

I will then create physics bodies for each 'limb' of my character. Each of these limbs will have forces applied (depending on the distance from the intended position in the animation) in order to try and move them to the correct position.

This will allow reaction to collisions with scene objects, as well as reaction to projectiles and other effects.

in essence, you will have a fixed animation running in the background, with a physics based character running on top, which will always try its best to match the fixed animation. This should create a reasonable approximation of correct reactions to a physics based environment.

This is just my suggestion however, i did do a bit of research like you are before deciding on this method, but found a distinct lack of information on the subject.

# Answer
> 1 votes
There are a few solutions to your query. This field of study is called "Physically Based Character Animation".

You could try incorporating Ragdoll Physics: https://www.youtube.com/watch?v=-9wtaAOzpkc Ragdoll Physics became very popular around the year 2000 with the popular game Hitman. In the past decade, it has been very popular in death animations.

Also, you might want to consider the implementations from Roy Featherstone (1987) and Brian Mirtich: https://people.eecs.berkeley.edu/~jfc/mirtich/thesis/mirtichThesis.pdf This is similar to using Inverse Kinematics and making each limb a rigid body.

Using a sphere as a rigid body around the character is the least computationally expensive approach. Another more expensive approach is to make every element of the character a rigid body. The most computationally expensive (and still in research phases) is simulating the inner muscles of each limb/muscle in the character.

---
Tags: physics, animation, character
---


# Question
Title: Need an option to send camera output as video or frames in Unity3d 2017
Tools I've used in Unity 5.x are breaking my 2017 scene... and I do not see a way to output video or frames from Cinemachine (although I am trying to understand all of its features).

What is the best way in a mandatory C#/Unity 2017 workflow to capture camera output within Unity -- not a screen grab? No postprocessing needed... just frames!

In the past I have used Renderator Pro and VR Rocks, neither of which seem at the moment to support 2017 -- using deprecated code.

SOLUTION -- ROCK VR Does indeed work with Unity 2017... although not exactly the way I have modified it for 5.x.... but going back to stock import of resources and rebuilding works well.

# Answer
SOLUTION -- ROCK VR Does indeed work with Unity 2017... although not exactly the way I have modified it for 5.x.... but going back to stock import of resources and rebuilding works well.
> 0 votes

---
Tags: unity, camera, video
---


title: udp over cellular networks?

text:
# Question
Title: udp over cellular networks?
I'm starting to build a multiplayer iOS game using UDP. I want the game to be playable over cellular networks, but I can't really find that much information on it. Many people say that it's dependent on your carrier whether or not it will work.

I tried searching but I can't really find much info on this topic. I know carriers must allow UDP because of things like video streaming, but what about custom game protocols? Will UDP work over a cellular network? If anyone has a definitive answer or can point me to some resources that'd be great

# Answer
TL;DR: There is no guarantee of performance, latency, or working at all whatsoever.

---

Video streaming works with either UDP and TCP so a cell phone being able to stream video is no guarantee that UDP is allowed on the cell service provider network.

Even then it is possible only some UDP ports are allowed on the network's firewall, and possibly to only some servers.

The network may also do traffic shaping to give priority to video call services over an unknown video game's UDP/TCP ports.

Cellular networks also have a very high latency compared to WiFi and wired Ethernet. On top of this cell phones will switch towers whenever convenient for them causing a short delay in data transmission.

It may work really well in a large metropolitan center at off-hours on some service providers in some countries and not work at all for practical gaming purposes in any other situations.

Something to consider is that right now (2017) even if it works well were you are located it's likely that the number of situations where cellular data network's high ping and sporadic delays will create lots of frustrated users, complaints, and bad ratings depending on your game's network requirements.
> 1 votes

---
Tags: networking, ios, mobile, udp
---


# Question
Title: What is the necessary know-how to write an animation library (IK & FK)?
I can't find any good library for animation, the ones that I found are just really old and discontinued, but I have noticed that the libraries are relatively small, so I'm thinking about coding one on my own: where should I start? What are the basics for this? There is a book about this?

Some further notes about a good file format for animation are also highly appreciated.

I'm using C++.

# Answer
> 8 votes
Don't try to write anything from scratch. Refer to existing code and take it from there.

And if you want reading material:

# Answer
> 7 votes
Forward kinematics is just a prerequisite for inverse kinematics, in general.

For forward kinematics you must have some knowledge of transform chains (what a scene-graph means for example). As an example, a good point to start from is the Denavit-Hartenberg convention. For inverse kinematics, study Cyclic Coordinate Descent (CCD), Jacobian Inverse, Jacobian transpose and pseudo-inverse solutions. These concepts and algorithms offer you a decent overview of what the mathematics and partly the physics of this field is all about. The library, programming language or file formats are never the key element if you also want to *understand* what happens behind the magic.

If you need a quick solution or a component for some application you're working on, then do take a look on some of the libraries provided in the other answer(s) here. If you're into robotics, then OpenRAVE is a monster worth mentioning. Also, there is a Matlab Robotics Toolbox (provided you're into that kind of engineering side of the matter).

All of the concepts yield a truckload of relevant results on your favourite search engine, so sorry for not posting that many links to nice materials.

# Answer
> 1 votes
# ***Original Article: What do I need to know about Inverse Kinematics?***

You’ve probably heard of Inverse Kinematics. IK is a popular tool in Unity and computer graphics, but if this is the first time you’ve tried to create or use an Inverse Kinematics system then you might want more details. I’m going to explain what IK is, define the vocabulary, and review the uses. What is the necessary vocabulary to understand IK?

Before we get into the heart of IK, we need to define some IK-related vocabulary. IK is a method that is applied to an articulated body. What is an articulated body?

## Articulated Body

An articulated body can represent most animated bodies such as humans and animals with skeletons. Simply put, an articulated body is a tree of linked chains. The linked chains are made up of joints and links, where a link is a rigid cylinder.

## Types of Joints

As for joints, there are two types. The first type of joint is a revolute joint. It is connected to a link that rotates around it.

A revolute joint is much like the center pin of a clock — with a clock hand as a link.

A prismatic joint is a joint such that the connected link translates from the joint to extend/shorten the link.

A prismatic joint acts much like extending/retracting the length of the retractable handle on your luggage. If you look closely, a retractable luggage handle has 4 prismatic joints. 2 prismatic joints half way down the handle, and another 2 prismatic joints all the way down the handle at the top of the luggage.

If you’re confused by prismatic joints, don’t worry. They are not used that often in Inverse Kinematics, and as you might be able to tell, no humans have prismatic joints — only revolute joints.

## Hierarchical Structure

An articulated body has a root joint. The root joint is the base of the structure. The root joint for a humanoid is usually the center of the hips. The articulated body is formed from a tree of joints and links, starting at the root joint. A new joint and link is similar to a new branch on a tree. An inboard link/joint is a link/joint that is closer to the root joint within the tree hierarchy of the articulated body, as it relates to given joint/link. An outboard link/joint is a link/joint that is further away from the root joint within the tree hierarchy of the articulated body.

## End Effector

An end effector is a position at the most outboard position of the most outboard link. It is the free end of the chain of alternating joints and links. The end effector is not a joint. The end effector is merely the position at the end of an articulated body. An articulated body can have multiple end effectors, just like a binary tree can have multiple leaves.

*End Effector is depicted as a green circle here.*

## Articulations and Poses

An articulation is a rotation/translation of a joint which moves a connected link. On the other hand, a pose is a set of joint articulations which results in positioning the articulated body. In other words, the pose is a vector value of instead of a scalar value.

# What is Forward Kinematics?

Before we can get into what Inverse Kinematics is, we need to figure out what Forward Kinematics is. The Forward Kinematics function/algorithm takes a pose as the input, and calculates the position of the end effector as the output. Forward Kinematics is the inverse function of Inverse Kinematics. With Forward Kinematics, you need to define the whole pose of an articulated body so as to provide the function/algorithm with the pose input. This means you need to define the articulation of each joint in the articulated body. This might be fine if you have a low number of joints, but with a high number of joints this tends to be tedious.

# What is Inverse Kinematics?

Now, imagine if you’d like the end effector of your articulated body to reach a particular target position. This means that you know the end effector position you’d like to target, but you don’t know what the pose of the articulated body needs to be for the end effector to reach this target position. This is where Inverse Kinematics shines!

Inverse Kinematics is the inverse function/algorithm of Forward Kinematics. The Forward Kinematics function/algorithm takes a target position as the input, and calculates the pose required for the end effector to reach the target position — the pose is the output.

As you can see, the input and output are switched between FK and IK. With Inverse Kinematics, you do not need to define the whole pose of an articulated body — this gets calculated for your by the IK algorithm. With IK, you only need to define a position as the input.

Inverse Kinematics does all the challenging computational work of calculating what the pose is. In the Before State, there is an articulated body with some known pose. It defines a target position for the end effector to try to reach. Once the IK algorithm is applied to the articulated body, we have reached the After State. The After State shows that a new pose has been computed, such that the end effector is now at the target position.

# What are the uses of IK?

At this point, we know that IK is applied to an articulated body, we know what an articulated body is made up of, and we know the difference between IK and FK. We have a good overview of IK so far, but let’s round it out with some good use cases of IK as well. IK can be used for a humanoid arm to reach for an object/target, as we’ve seen. IK can also be used for foot stepping, such that we tell the foot where to step and the IK figures out how to configure the leg joints. IK is not usually used as an animation itself (reaching for an object), but more as an animation tool. So, if you are implementing a walk cycle, you could position some of the key frames using the IK tool.

Another key point about IK is that your goal/target is not limited to position alone — your goal can be defined as a rotation. For example, if your feet need to rotate based on uneven terrain, your IK rotation goal can be defined based on the floor’s normal. This way your feet are inclined along the floor, such as when you are walking up an incline. Note that you can also use IK to have your head (or even eyes) look in a certain direction. If you want your head to follow an object, you can use IK to have the head follow the object around.

---
Tags: c++, animation, inverse-kinematics
---


# Question
Title: Strange issue with bool comparing ToString always false - unity c#
I have another problem with my code that I can't fix :\

Basically i have an enum called 'type' in my Item class, which tells me if the item is consumable, or equipment, etc. In the database script I have made, it sets the type for each item (5 in total). So basically I have an inventory UI, with 5 items (inc. 2x consumables, 3x Equip)

After much debugging/checking things, I've found that the boolean prior to "sortedItems.Add(i);" is always FALSE. But it shouldnt be, BOTH VALUES ARE THE SAME as per the console log. I have input a print() line to check whats going on because my items are'nt sorting by type when I expect them to.

```
public void SortItemsByType(string type)
{
    sortedItems.Clear();
    foreach (Item i in allItems)
    {
        print("is the following true or false" + i.type.ToString() == type);
        print("this is iToString= " + i.type.ToString());
        print("and this is type: " + type);
        if (i.type.ToString() == type)
            sortedItems.Add(i);
    }
}

```

and (please note the 3 print lines, here is their output in the console: (sorry but the dumb IDE won't let me copy-paste the console, here is image):

Im still very much a noob to this, so I am sure there is something I have missed. But for the life of me i cannot figure out why that bool is always resulting in FALSE?

Any help is massively appreciated. Thanks

# Answer
Quick Answer: What your code actually currently does is compare references to check that they are the same, not the values of those references.

Try changing

```
print("is the following true or false" + i.type.ToString() == type);

```

to

```
print("is the following true or false" + string.Equals(i.type.ToString (), type));

```

When you use string.Equals, you're comparing the values instead of the references themselves. '==' checks to see that the references.

See more info below

https://stackoverflow.com/questions/814878/c-sharp-difference-between-and-equals https://www.dotnetperls.com/string-equals https://msdn.microsoft.com/en-us/library/system.string.equals(v=vs.110).aspx
> 4 votes

# Answer
Your first logging line isn't doing what you think it's doing. Unlike Java, C# overloads `operator ==` on strings so as long as `type` is a `string` you don't need the `.Equals`.

```
print("is the following true or false" + foo == bar); // wrong
print("is the following true or false" + (foo == bar)); // right

```

Otherwise, the function looks like it should work (at least, as far as updating the sortedItems list)
> 2 votes

---
Tags: unity, c#, game-mechanics, gui, databases
---


# Question
Title: Distributing damage across units in an army
I'm working on a game similar to the web game Utopia, insofar as players have a number of units with different values for attack and defense.

Question: how do I distribute damage across units when a conflict plays out?

Let's say I have two units:

* Infantry: 3 attack, 3 defense
* Cavalry: 5 attack, 1 defense

Let's say the player has 100 infantry (300 attack, 300 defense) and 50 cavalry (250 attack, 50 defense); the player now gets hit with an attack of 100 points of damage.

How do I resolve this in a way that doesn't force players to understand damage and micro-optimize, also given that I'm not going to store individual units' health values after the conflict?

* If I distribute damage to weakest units first, 33 infantry will die; but players will spam cavalry and keep a small number of "fodder" infantry around to absorb damage.
* If I distribute damage to strongest units first, 50 cavalry die; but players will spam infantry, thinking that stronger units are "not worth it" because they always die.
* If I distribute damage randomly (eg. some infantry get 1 damage, some get 2, some get 3 and die), I will likely end up with players thinking that conflict is not effective, because a number of units took damage but didn't die (and I don't keep track of damaged units -- they heal afterward).

Is there a distribution algorithm I can use that doesn't have any of these side-effects and appears "fair" to the player? If not, how can I make this make sense so players understand how this should work, without me hindering certain types of strategies?

I wrote an answer to a question here that looks similar, but I explicitly didn't tackle the problem of fairly distributing damage without sabotaging different strategies.

# Answer
I'd base the system on three basic principles:

1. each unit type has different HP values that affects its mortality rate.
2. all damage done is lethal (otherwise, just multiply by a scaling factor)
3. each squad takes total damage in proportion to the number of individuals.

Example: Your starting army army

```
1400 infantry   (ea. 50 HP)
500  cavalry    (ea. 100 HP)
500  conscripts (ea. 20 HP)
100  elites     (ea. 200 HP)
2500 total      (total HP pool 150k)

```

for an enemy army with incoming damage: 30k, Your damage numbers are:

* infantry takes 30k\* 14/25 damage, and 336 die
* cavalry takes 30k\* 5/25 damage, and 60 die
* conscripts take 30k * 10 / 25 damage and 300 die
* elites take 30k * 1 / 25 damage and 6 die

Further considerations:

1. You'll have to handle when an entire subgroup gets annihilated, applying remaining damage to the rest of the army. For example, in the previous example, if the enemy army did 60k damage, your conscripts would take enough damage to kill 600 guys but there were only 500 to begin this. You have to redistribute the 100 extra damage across the remaining army. Alternatively, just split damage into smaller rounds (like 30 rounds of 2k damage each) and deal with the smaller amounts of overkill per round. You'll have to use floats for the intermediate damage otherwise your elites may just never take enough damage per round to take any casualties.
2. This answer doesn't cover how to calculate the total incoming damage.
> 9 votes

---
Tags: game-design, strategy, turn-based-strategy
---


title: Easy way to edit vertex attributes

text:
# Question
Title: Easy way to edit vertex attributes
I'm trying to edit large amounts of vertex attributes in my models for my game. The main attributes I really care about are strength (so wind can interact with them) and a couple of other things so the interaction with wind looks decent.

However, I'm not quite sure how do edit them easily. Of course I could manually write all of them, but that would be ridiculous. My first thought was to use a format in Blender that I could just export vertex colours and use the value as the attribute value.

Here's a picture for example (red = leaves, very windy, strength = 0.1; green = wood, strength = 0.7)

I don't really see any problems with this other than the fact I don't know of any formats, but I'm sure I can find some.

Is is there any way (or any program that can do this easier)? Or is the way of just colouring them the best way to go.

# Answer
If you use weight painting instead of vertex colors, you could export the model in any format that supports skeletal animation.
> 3 votes

# Answer
You could simply use multiple textures on the vertices, where each channel of each texture contains the value of some attribute. Then you can paint the attributes in any program that allows you to paint a texture on a model. You can have 4 attributes per texture. In your vertex program you can sample the texture to get the attribute values at that location.
> 3 votes

---
Tags: opengl, vertex, vertex-attribute
---


# Question
Title: Difference in Shading Using Eye Space or Model Space Coordinates
While reading on shading, I came across a section in which the artist provides 2 different kinds of fragment shading:

Coloring using model space and eye space.

The result is as illustrated in the following image:

The author goes on with a brief explanation claiming that the image on the ***left*** is a result of shading in model space coordinates because the stripes follow the `vx` value running from the tip of the spout to the handle while the image on the ***right*** is based in eye space coordinates, with the stripes following the `vx` value from right to left.

My questions are as follow:

I have been spending hours trying to understand why and how the effects would be different in both cases (why are the stripes different in both cases?). In addition, is there any particular case when we need to perform shading in the model space coordinates and likewise only in eye space coordinates?

Thanks.

# Answer
First, you are misunderstanding the point of the article; these are not two different kinds of fragment shading. This is just an illustration two different coordinate systems.

Which one you use will depend upon which one is more convenient for whatever operations you're doing.

Let's take some simple examples:

# Texture Mapping

If you're just doing regular texture mapping, you don't need to think about any of this at all; your fragment shader doesn't need to know where a fragment is in space; just the coordinate to use to sample from a texture map.

# Lighting

The simplest form of lighting calculation is `float lightAmount = clamp(0,1,dot( -light_direction, surface_normal ));`, where 'light\_direction' and 'surface\_normal' tell you the direction the light is shining and the direction the surface faces.

It doesn't actually matter whether you express these directions in object local space, in world space, or in view space; the math works out exactly the same, as long as both vectors are in the same coordinate system.

In practice, it's awkward to convert the light direction into every object's local space, and so people don't tend to do that. But if you wanted to, you totally could, and there'd be no visible difference.

Folks on the Internet seem to have mostly settled on doing lighting calculations in view space (that is, relative to the camera), so that's mostly what you'll see in online tutorials. But for certain projects it may be simpler to do them in world space. Feel free to do whichever is simpler, or makes more sense for your program.

# Uniform Fog

Simple (i.e.: uniform) fog is implemented by simply blending a fragment's color toward some constant value, based upon the distance from that fragment to the camera.

As above, you can do fog calculations in object-local space, in world-space, or in view-space; just take the camera's position in that coordinate system, subtract the fragment's position in that same coordinate system, and find the length of the resulting vector.

Of course, the same problem as with Lighting happens here; converting the camera position into object-local space for every object you render is a pain, so nobody actually does that. But you could, if you really wanted to.

Nobody does fog calculations in world-space, either, even though it'd be easy to do. No, everybody does fog calculations in view-space for one simple reason; in view-space, the camera is, by definition, located at coordinate (0,0,0). And so if you're doing the fog calculation in view-space, you don't have to subtract the camera position from the fragment position, because the camera position is 0; you can just use the fragment position in the fog calculation directly.

But if you really wanted to do your fog calculations in object-local space, or in world-space, you totally could, and it'd work, and nobody would be able to tell you weren't doing it the conventional way unless they actually read your shader code.

That's really all that's going on in that article. Pointing out that there are these different coordinate systems available to you, and you can use whichever ones you like depending upon which is most convenient for whatever you're trying to do. And it isn't about different "kinds" of fragment shading which you must make a hard decision between; it's not unusual to use each of these different coordinate spaces in different parts of a single shader.
> 2 votes

# Answer
The use of 'shading' here is a bit off from the typical renderer meaning. The author appears to talk about how texture coordinates are computed.

In the first case, texture coordinates are assigned based on the model space positions of the mesh.

In the second case, texture coordinates are computed from the position of the vertices in eye space.

In a realtime renderer, you tend to always have your artist-authored texture coordinates fixed as vertex attributes up-front. Specialist modes like view/world-sourced texture coordinates don't really occur, unless such an effect is explicitly designed into a shader.
> 1 votes

# Answer
What this looks to me is just sampling form a texture using texcoords.xy and then texcoords.yx or using world space coords like worldpos.xz or worldpos.xy.

worldpos.xz will make the strips go horizontal and worldpos.xy will make them go vertical.

I do this for my triplaner mapping and blend mapping:

```
float Blend = BlendMap.Sample(colorSampler, input.WSPosition.xz / 2500).r; //flat ground
float Blend2 = BlendMap.Sample(colorSampler, input.WSPosition.yx / 6000).r; // hills

float2 coord1 = float2(input.WSPosition.zy / 400);
float2 coord2 = float2(input.WSPosition.zx / 75);
float2 coord3 = float2(input.WSPosition.xy /400);

```
> 0 votes

---
Tags: opengl, coordinates, fragment-shader, shading, vertex-shader
---


# Question
Title: Unity 5.6 - Where have Sun Shafts disappeared to?
I've just upgraded to Unity 5.6 from 5.4. I need to add some Sun Shafts to my camera but I cannot find the script *anywhere*.

I've looked in the docs, I've looked in the menu's but I can't locate them.

Has anyone else had this problem at all?

# Answer
Okay, this answer will be a bit short but I've found out what happened to your sun shafts and how you can get the new effects to replace them.

It seems Image Effects (which include Sun Shafts) are no longer a thing in Unity's 5.6 version. They now have post-processing instead and you can get the package for that from their asset store link.
> 4 votes

# Answer
The original SunShafts scripts can be found from unity's asset store(from their own page). It's titled "Legacy Image Effects".
> 0 votes

# Answer
you will find then at the lights gameobject... after select yours look at the inspector.
> -1 votes

---
Tags: unity
---


title: Changing alpha of Sprite

text:
# Question
Title: Changing alpha of Sprite
I'm using OnGUI to draw a rect when I "box select" or "drag select". The texture that gets drawn is a PNG file made in Paint.Net with the opacity - alpha channel set quite low. In Unity however, when I go to box select, the texture is completely opaque. How do I get Unity to honor the alpha set in Paint.Net? I also wouldn't mind using Unity itself to adjust the opacity, but I haven't found such an option in the import texture part of the inspector.

# Answer
> 2 votes
First of all, avoid at all costs OnGUI except for debug purpose. Use the Unity GUI system.

In your favorite image software (Paint.Net), **set the opacity of your image to 1** and import your image into Unity. Now, take a closer look to the following screenshot representing the Import Settings of an image and do the same to your own image :

The main things to notice are :

* **Texture type** : Sprite (2D and UI)
* **Alpha source** : Input Texture Alpha
* **Alpha is Transparency** : checked

Then, in your scene, add a new `Canvas` and add an `Image` as a child. Select the `Image` gameobject and set your image as a sprite of your image. Finally, you will be able to manage the opacity using the `Alpha` channel of the sprite color.

*Note : To create a canvas and the child image :*

1. *GameObject menu \> UI \> Canvas*
2. *Select the canvas in the Hierarchy*
3. *GameObject menu \> UI \> Image (or right click on your canvas : UI \> Image)*

---
Tags: unity
---


# Question
Title: Passing a unique Uniform buffer with each model
I have been following "Vulkan Tuturial" on GitHub as a reference on how to get basic objects rendering. In their tutorial, they create the command buffers at the start of the application after they have created a objects vertex and index buffers, then define that they want to draw it. Then one per frame they submit the command. That part I'm fine with.

I have been attempting to make it so I can send draw commands during the rendering loop, rather than just define one object that should be rendered and call that command every frame, the reason is so I can send custom uniform buffers with each command, to draw them in different locations on the screen.

Unfortunately, when I try and pass a diffrent uniform buffer for each draw call, only the last uniform buffer is applied.

**Render loop**

```
while (engine.Running())
{
    engine.PreRender();

    engine.BindMesh(mesh);
    engine.UpdateUniformBuffer(0.0f);
    engine.Draw();
    engine.UpdateUniformBuffer(90.0f);
    engine.Draw();

    engine.PostRender();
}

```

**UpdateUniformBuffer**

```
void Engine::UpdateUniformBuffer(float rot)
{
    static auto startTime = std::chrono::high_resolution_clock::now();

    auto currentTime = std::chrono::high_resolution_clock::now();
    float time = std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - startTime).count() / 1000.0f;

    UniformBufferObject ubo = {};
    ubo.model = glm::rotate(glm::mat4(), rot, glm::vec3(0.0f, 0.0f, 1.0f));
    ubo.view = glm::lookAt(glm::vec3(2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f));
    ubo.proj = glm::perspective(glm::radians(45.0f), window.swap_chain_extent.width / (float)window.swap_chain_extent.height, 0.1f, 10.0f);
    // Since GLM was made for OpenGL we need to flip the frame
    ubo.proj[1][1] *= -1;

    void* data;
    vkMapMemory(vulkan.device, vulkan.uniform_buffer.buffer_memory, 0, sizeof(ubo), 0, &data);
    memcpy(data, &ubo, sizeof(ubo));
    vkUnmapMemory(vulkan.device, vulkan.uniform_buffer.buffer_memory);
}

```

**Draw function**

```
vkCmdDrawIndexed(
        vulkan.command_buffers[i],
        static_cast<uint32_t>(indices.size()),
        1,
        0,
        0,
        0
    );

```

# Answer
I have managed to solve this issue using two uniform buffers, one for static data (data that does not change per frame like the projection matrix and the view matrix) and one for dynamic data (this is the model matrix).

I ended up using this small guide as the backbone of the solution. Link to Guide
> 0 votes

---
Tags: vulkan
---


title: Merge two or more PolygonShapes

text:
# Question
Title: Merge two or more PolygonShapes
This is a simple sprite rock

and on my LibGDX game I would create a PolygonShape like the following image

Like you see, I need 22 vertices and Box2D doesn't allow me create a PolygonShape with not more than 8 vertices so I think a possible way is merge two or more Polygons, is it possible? or I may use something else like for example a ChainShape?

# Answer
Box2D, as of 2.3.2, doesn't support polygons with that many vertices as you're aware. It also doesn't support concave polygons. Not directly at least.

That said, it turns out mathematically speaking that any concave polygon can be expressed as a composition of convex polygons. So that's a way to solve these limitations in Box2D. Algorithmically speaking you may find it helpful to read of things like Ear Clipping. And library/function code for concave polygon decomposition into collections of convex polygons can be found in the extras portion (under the `Contributions` folder) of Box2D as well as around the Internet.

OTOH, if you will never need the concave shape to move physically, i.e. if it's only going to be associated with a static body, you can use the looped chain shape to implement concave polygon shapes. Box2D just doesn't have support for chain shapes to be used with dynamic bodies however.

Lastly, there may be forks of Box2D or similar engines which have support for convex polygons with more vertices and or for other solutions that can be used dynamically. You can also make a fork yourself and increase the max number of polygon vertices by upping the value of `b2_maxPolygonVertices` that's currently at 8.

I am the author of such a fork though it's only available for C++ right now and not quite release ready IMO. You can find my code on GitHub under my PlayRho repo. This repo has support for using chain shapes with dynamic bodies as well as supporting convex polygons with up to 254 vertices. I'd love more testers and/or people assisting with it.

Hope this helps.
> 2 votes

# Answer
You can construct your `Body` from multiple convex `PolygonShape`s by creating many `Fixture`s for it.
> 0 votes

---
Tags: java, libgdx, box2d
---


title: Chroma depth shader unity

text:
# Question
Title: Chroma depth shader unity
I'm trying to reproduce a post-effect with unity seen in the answer here.

Chromadepth answer

For the moment I just manage to reproduce the wave effect with a quick edge detection. I tried multiple textures but can't find one that fit do the same effect.

I am using this texture

The result for far.

```
Shader "Unlit/ChromaDepthEdge"
{

    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _Ramp ("Texture", 2D) = "white" {}
        _Threshold("Threshold", Float) = 0.1
    }
    SubShader
    {
      Pass
      {
          ZTest Always Cull Off ZWrite Off
          CGPROGRAM
          #pragma vertex vert
          #pragma fragment frag
          #pragma target 3.0
          #include "UnityCG.cginc"

          struct appdata
          {
              float4 vertex : POSITION;
          };

          sampler2D _MainTex;
          sampler2D _Ramp;
          // Request camera depth buffer as a texture.
          // Incurs extra cost in forward rendering, "just there" in deferred.
          sampler2D _CameraDepthTexture;
          float4 _MainTex_TexelSize;

          float4x4 _InverseViewMatrix;

          float _Threshold;

          void vert (
              float4 vertex : POSITION,
              out float4 outpos : SV_POSITION)
          {
              outpos = UnityObjectToClipPos(vertex);
          }

          fixed4 frag (UNITY_VPOS_TYPE screenPos : VPOS) : SV_Target
          {
              // Convert pixel coordinates into screen UVs.
              float2 uv = screenPos.xy * (_ScreenParams.zw - 1.0f);

              //uv.y = (uv.y *-1) + 1;
              // Depending on setup/platform, you may need to invert uv.y
              // Sample depth buffer, linearized into the 0...1 range.
              float depth = Linear01Depth(
                    UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv)));

              float2 uvDist = 3 * _MainTex_TexelSize.xy;

              float depthUp =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(0, 1))));
              float depthDown =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(0, -1))));
              float depthLeft =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(-1, 0))));
              float depthRight =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(1, 0))));

              float mean = ((depthUp - depth) + (depthDown - depth) + (depthLeft - depth) + (depthRight - depth)) / 4;

              // Compressing the range, so we get more colour
              // variation close to the camera.
              depth = saturate(2.0f * depth);
              depth = 1.0f - depth;
              depth *= depth;
              depth = 1.0f - depth;
              //return depth;

              // Use depth value as a lookup into a colour
              // ramp texture of your choosing.
              fixed4 colour = tex2D(_Ramp, depth * 6 * _Time.y * 4);

              return lerp(colour, colour * 6, mean > _Threshold);
          }
          ENDCG
      }

    }
}

```

***What did I miss ?***

Thanks in advance.

# Answer
Here's the full shader source I wrote for that previous answer. As I mentioned there, this was just me playing around, so I make no claim that this is a best practice or optimized approach to get this effect. ;)

First up, the pulse wave ramp texture I'm using:

I'll annotate the code below with comments to explain what I'm doing.

```
Shader "Shader Workshop/Chromadepth"
{
    Properties
    {
        // Ramp texture for the pulse wave,
        // with a small bright spot & long tail.
        _MainTex ("Texture", 2D) = "white" {}
        // The speed at which the pulse travels, in cycles per second.
        // So 0.25 = 1 pulse every 4 seconds.
        _Pulse ("Pulse Speed", float) = 0.25
        // Brightness of the edge detection lines.
        _Edge ("Edge Highlight", float) = 1.0
    }
    SubShader
    {
        // Render after all opaque geometry.
        Tags { "RenderType"="Transparent" "Queue"="Transparent-1"}
        LOD 100

        // Don't write to the depth buffer.
        ZWrite Off

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 3.0
            #include "UnityCG.cginc"

            // Capture depth buffer as a readable texture.
            sampler2D _CameraDepthTexture;

            // Define a convenience method for sampling from this buffer.
            float sampleDepth(float2 uv) {
                // Sample depth buffer, linearized into the 0...1 range,
                // where 0 is the near plane and 1 is the far.
                return Linear01Depth(
                        UNITY_SAMPLE_DEPTH(
                            tex2D(_CameraDepthTexture, uv)));
            }

            // Access properties set in Material inspector.
            sampler2D _MainTex;
            float _Pulse;
            float _Edge;

            // Project object vertices to clip space.
            // Using an out parameter for SV_POSITION beacuse the VPOS
            // semantic we use below doesn't like living alongside SV_POSITION.
            void vert (
                            float4  vertex  : POSITION,
                        out float4  outpos  : SV_POSITION )
            {
                outpos = UnityObjectToClipPos(vertex);
            }

            // Take in the position of this fragment on the screen/render
            // target using the VPOS semantic, so we can line up exactly
            // with the rendered scene in the depth buffer we're sampling.
            fixed4 frag (
                    UNITY_VPOS_TYPE screenPos : VPOS) : SV_Target
            {
                // Convert this screen position (in pixels)
                // to a UV coordinate (in the range 0...1).
                // (_ScreenParams.zw is (1/width + 1, 1/height + 1))
                float2 uv = screenPos.xy * (_ScreenParams.zw - 1.0f);

                // For Macs, you may need to set (y = 1.0f - y)
                // ...there's a way to do this cross-platform automatically,
                // but I don't have access to a Mac atm to test it. Sorry!

                // Use our depth sampling method above to get the depth
                // of the scene directly behind the pixel we're drawing.
                float depth = sampleDepth(uv);

                // Initialize the edge detection to zero. Skip calculating
                // an edge detection if we're not going to use it.
                float edge = 0.0f;
                if (_Edge > 0.0f) {

                    // Calculate a 1-pixel offset in x+ y+, x- y- directions.
                    float4 offset = float4(1, 1, -1, -1)
                                    * (_ScreenParams.zwzw - 1.0f);

                    // Read the depth buffer 4 more times at offset positions
                    // to estimate the "average" depth near this pixel.
                    float average = 0.25f * (
                          sampleDepth(uv + offset.xy)
                        + sampleDepth(uv + offset.zy)
                        + sampleDepth(uv + offset.xw)
                        + sampleDepth(uv + offset.zw));

                    // The diference between the depth here and the average
                    // depth nearby will be zero in a flat area, and large
                    // where there's a depth cliff like a silhouette edge.
                    // We'll also get small non-zero values at crests and
                    // valley folds within a silhouette, and taking a square
                    // root helps emphasize this local detail.
                    edge = sqrt(abs(depth - average)) * _Edge;
                }

                // Here I make the depth values non-linear for style.
                // First inverting them so the far z is close to zero.
                depth = 1.0f - depth;
                // Then I square the result so far values get compressed
                // in a narrower range, and we stretch the range of
                // values in the near range (more detail close to the camera)
                depth *= depth;
                // Then finally I invert it back so zero values are near.
                depth = 1.0f - depth;

                // Change our depth value into a lookup into our warve texture.
                // This gives exactly one pulse at a time - the front wave needs
                // to reach the far plane before wrapping around to near again.
                // Increase that 1.0f * if you want multiple concurrent pulses.
                float samplePos = float4(1.0f * depth.xx, 0.0f, 0.0f);
                // Shift this sample window over time. (Set texture to repeat)
                samplePos.x -= _Pulse * _Time.y;

                // Sample the wave ramp texture at our computed sample position.
                fixed4 colour = tex2Dlod(_MainTex, samplePos);

                // Add edge brightening, tinted by the colour from the wave.
                colour *= (colour * (2.0f + edge * 30.0f) + edge * 5.0f);

                // Output our finished colour.
                return colour;
            }
            ENDCG
        }
    }
}

```

Note that since this version crosses your entire depth range before looping around to fire a new pulse, the wave will move *very* quickly with Unit's default camera settings. To handle very large scenes, Unity's camera far plane default quite a high depth - much deeper than the level I was using this shader in - so I pulled the far plane in closer to get more depth values nearby where I want them, making the wave super smooth.

For a scene with longer sightlines, you may want to fire multiple concurrent pulses as described in the comments above, so you can slow down the pulse movement without starving the nearby areas waiting for the wave to come back around.
> 2 votes

# Answer
Having actually looked at a similar effect in a HoloLens shader, what you're missing is a value that represents the *distance* the wave-pulse edge is at and optionally, a center point (although you can cheat and simply treat the camera as the center all the time).

That pulse edge is then changed over time (in the HoloLens case, via a MonoBehaviour script), likely through the user of a MaterialPropertyBlock.

You may wish to just take the HoloLens shader and modify it.
> 0 votes

# Answer
Make sure that your texture is not set to repeating, but rather set to clamp. This should create the effect that you're looking for, I believe.
> 0 votes

---
Tags: unity, shaders, depth
---


# Question
Title: Jump Script Component For Character Controller
I'm trying to implement a jump method into my FPSInput script. I know how to make this work for a Rigidbody, but how can I accomplish this with my Character Controller? Does CharacterController have a method comparable to AddForce?

First Person Movement Input:

```
public class FPSInput : MonoBehaviour {
    public float speed = 6.0f;
    public float gravity = -9.8f;

    private CharacterController _charController;

    void Start() {
        _charController = GetComponent<CharacterController>();
    }

    void Update() {
        float deltaX = Input.GetAxis("Horizontal") * speed;
        float deltaZ = Input.GetAxis("Vertical") * speed;
        Vector3 movement = new Vector3(deltaX, 0, deltaZ);
        movement = Vector3.ClampMagnitude(movement, speed);

        movement.y = gravity;

        movement *= Time.deltaTime;
        movement = transform.TransformDirection(movement);
        _charController.Move(movement);
    }
}

```

Works for Rigidbody only:

```
public class Jump : MonoBehaviour {

    public Vector3 jumpVector;

    // Update is called once per frame
    void Update() {
        if (Input.GetKeyDown(KeyCode.Space)) {
            GetComponent<Rigidbody>().AddForce(jumpVector, ForceMode.VelocityChange);
            }
        }
}

```

# Answer
Couldn't find a solution that works like AddForce, but I solved this using a verticalVelocity variable that gets passed into a Vector3 jumpVector variable which calls Move on the characterController.

```
public class FPSInput : MonoBehaviour {
    public float speed = 6.0f;
    public float gravity = -9.8f;

    private float verticalVelocity;
    private float jumpForce = 15.0f;
    private float gravityJump = 14.0f;

    private CharacterController _charController;

    void Start() {
        _charController = GetComponent<CharacterController>();
    }

    void Update() {
        float deltaX = Input.GetAxis("Horizontal") * speed;
        float deltaZ = Input.GetAxis("Vertical") * speed;
        Vector3 movement = new Vector3(deltaX, 0, deltaZ);
        movement = Vector3.ClampMagnitude(movement, speed);

        movement.y = gravity;

        movement *= Time.deltaTime;
        movement = transform.TransformDirection(movement);
        _charController.Move(movement);

        if (_charController.isGrounded) {
            if (Input.GetKeyDown (KeyCode.Space)) {
                verticalVelocity = jumpForce;
            }
        }

        Vector3 jumpVector = new Vector3(0, verticalVelocity, 0);
        _charController.Move (jumpVector * Time.deltaTime);

    }
}

```
> 1 votes

---
Tags: unity, physics, movement, first-person-shooter, jumping
---


# Question
Title: Key released, multiple Keys, how to go around ncurses limitations?
I have been trying to make a small game in the terminal in C++ using **ncurses**.

After searching around for some time, I came to realize that ncurses is pretty limiting as far as **keyboard inputs** are concerned :

1. How to separate keyPressed and keyReleased events?
2. How to deal with multiple keys pressed at the same time?

Do you know of any solution to go around those limitations?

To answer someone's comment, in other languages I would use a keyListener to detect if a key has been pressed or released, and keep each pressed key in an array that I can use later :

```
array pressedKeys[];

keyPressed(event)
{
    pressedKeys.add(event.getKey());
}

keyReleased(event)
{
    pressedKeys.remove(event.getKey());
}

... // Later in update()
    if keyPressed.contains("up")
        goUp();

```

This does not seem possible in ncurses as it just gets the last pressed character with getch(), and pressed means keydown then keyup, which does not allow to keep track of the different keys pressed at the moment.

# Answer
For future readers, here is what I did in order to handle multi key inputs with ncurses :

I realized you can call `getch()` multiple times during a frame, and it will return a different key each time as long as there are other key pressed. For example if I am holding keys 'A', 'B', and 'C', three calls to `getch()` will give me the 3 different keys, and the 4th call will give me `ERR` as no 4th key is pressed.

Then I just need to store all the pressed keys in an array and use them later as I would normally do.

A small pseudo-code may not hurt

```
int pressedKeys[];

while (gameRunning)
{
    int c;
    while ((c = getch()) != ERR)
        pressedKeys.add(c);

    ... // Later in update()
    if (pressedKeys.contains(KEY_UP))
        goUp();
}

```
> 7 votes

---
Tags: c++, c, ncurses
---


# Question
Title: How can I generate random meaningful words in a typing game?
I want to make a typing game where users have to type the words displayed on the screen. But I don't know how to generate meaningful English words not gibberish.

What technique can I use to achieve this?

# Answer
There's no built-in way in Java, but there's 2 ways you can do this.

The first way takes more time but requires pretty much no storage space. You can use an HTTP GET request and use an online random word service (like this one) to get a random word. This method requires internet connection.

The other way is lot faster, but uses more memory and storage space. You need to create a file with a dictionary of words, load it on start (if it's small enough) and get a random word from it. You can also make it change the words based on grammar rules (eat + ing -\> eating, provoke + ing -\> provoking).

The best would be to use both solutions and rely on the dictionary when there's no internet connection.
> 2 votes

# Answer
One way is to make a file with a lot of random words and pull words from random positions. That way you could have different difficulties, such as easy words, medium words, and difficult words. Here's an example, which just prints one word at a time(randomized) that the user must type. Make sure to create the `txt` file and call it `words.txt`. Also put it on your desktop:

```
import java.io.*;
import java.util.*;

public class TypingTest {
    private static Random rand = new Random();
    private static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {
        String fileName = "/Users/Tommy/Desktop/words.txt";
        File wordList = new File(fileName);
        List<String> words = new ArrayList<>();
        Scanner reader = null;

        try {
            reader = new Scanner(wordList);
        } catch (FileNotFoundException e) {
            System.out.println("file \"" + fileName + "\" not found");
            System.exit(0);
        }

        while(reader.hasNextLine()) {
            String word = reader.nextLine();
            words.add(word);
        }

        String result = playGame(words);
        System.out.println("Your score: " + result);
    }

    public static String playGame(List<String> words) {
        int wordNum = words.size();
        String attempt;
        int place;
        int correct = 0;

        for(int i = 0; i < 10; i++) {
            place = rand.nextInt(wordNum);
            String s = words.get(place);
            System.out.println(s);
            attempt = input.next();
            if (attempt.equals(s)) {
                words.remove(s);
                wordNum = words.size();
                correct++;
            }
        }
        return Integer.toString(correct) + "/" + 10;
    }
}

```

Here's a list of 500 random words you can use

```
wait
release
river
important
mark
electric
defective
poke
blue
beef
spring
hurt
orange
happy
zealous
flowery
accurate
brake
title
x-ray
festive
wrathful
scissors
peaceful
finicky
shape
soothe
head
spotted
needless
time
abundant
humdrum
mouth
trot
bounce
thank
avoid
shocking
minor
secret
rabbit
protect
honey
business
worthless
suggest
splendid
drab
safe
gigantic
arrive
drum
hate
dinosaurs
machine
tame
annoy
telephone
curtain
monkey
things
refuse
lunch
wooden
ruin
request
faded
camp
didactic
annoying
finger
acrid
overt
lamp
paste
rejoice
ignorant
exist
madly
doubt
increase
measly
mate
tangy
dislike
bikes
rambunctious
complete
motion
coast
air
obey
burst
nosy
consist
yellow
long
cakes
close
teaching
five
undesirable
squash
border
memorize
fowl
scarecrow
tie
present
well-to-do
meaty
wonderful
pencil
need
advice
wide-eyed
apologize
possible
dreary
skin
kick
stage
tongue
puffy
camp
ski
ghost
quickest
lip
frequent
one
efficient
angry
alleged
suit
notebook
wipe
dream
spark
work
pail
throne
unnatural
pale
brief
pets
ad hoc
overrated
house
rely
messy
pastoral
afternoon
enchanting
tense
army
spotless
button
good
reduce
leather
eye
spotty
growth
alert
statement
overflow
flame
disagree
whispering
lively
healthy
sedate
plant
melt
snatch
combative
grain
spurious
run
fuzzy
hot
large
exotic
woozy
unaccountable
zip
wren
courageous
match
form
comb
shut
pointless
languid
capricious
stop
mammoth
psychedelic
ordinary
cobweb
determined
stereotyped
sordid
arrest
inquisitive
carpenter
small
vivacious
guard
poor
funny
shaky
hilarious
egg
spiders
abounding
humor
sticky
plastic
ratty
productive
agree
fork
temper
prepare
whistle
responsible
drain
eight
nest
slow
loutish
saw
fear
scrub
volatile
moldy
attract
receptive
aberrant
neck
man
store
materialistic
shrug
billowy
driving
travel
fairies
lumpy
assorted
bow
babies
attend
dress
surprise
tranquil
marvelous
illustrious
clam
fact
plate
soft
cover
dad
trousers
cars
superficial
bawdy
drown
envious
wasteful
religion
bells
kick
announce
elastic
trap
smoggy
lively
serious
start
lavish
basin
wrench
lock
picture
hand
rail
delightful
trade
sand
face
tenuous
scream
produce
low
subtract
industrious
pass
station
wash
synonymous
red
wrong
warlike
low
contain
mailbox
liquid
expensive
string
time
open
admit
lettuce
decision
quixotic
towering
copy
better
cake
fluffy
yarn
grease
mountainous
stick
join
icicle
succinct
plastic
pear
acoustic
abrupt
position
spark
yak
bent
crook
kitty
sneaky
use
pollution
mundane
barbarous
delight
flesh
robin
party
milky
round
wretched
pleasant
treatment
winter
hot
available
train
writer
prose
furtive
building
cattle
wealthy
sassy
sponge
face
reflective
bear
wanting
bustling
wiry
tearful
hypnotic
ill
animated
verdant
toad
unlock
long-term
wall
direful
hunt
obtainable
walk
bleach
unarmed
happen
kiss
trick
queen
conscious
mourn
girls
frame
erect
secretary
field
helpful
science
crown
heady
grotesque
dress
degree
cushion
piquant
innate
square
cactus
tricky
company
remarkable
calculate
rinse
crime
push
mind
flagrant
man
permit
theory
thoughtful
crate
yummy
offbeat
paltry
bulb
optimal
stove
chemical
shallow
merciful
sore
abortive
perpetual
zonked
eyes
bore
tired
regret
fit
potato
confuse
childlike
vein
sound
attack
exchange
back
check
damaged
grandmother
division
groovy
throat
office
pin
stare
meddle
shivering
interfere
occur
hole
sugar
test
blind
free
perform
cherries
flavor
stupendous
purpose
extend
risk
fanatical
grubby
beg
romantic
outrageous
swift
bath
room
pocket
front
flower
quicksand
mark
sturdy
resolute
letters
expert
hapless
bloody
blue-eyed
hope
chew

```
> 2 votes

---
Tags: java
---