sentences:
Finding Closest of 8 Possible Angles to Theta Value I'm working on creating a gesture recognition system, and I saw one simple implementation that isn't as accurate, but is really easy to implement. The idea is that you have a unit circle with the 8 significant angles (0, 45, 90, 135, 180, etc) and you map those angles to a value of 1-8. So 45 would be 2, 180 would be 5, etc. Then you just use the Levenshtein distance algorithm to find the closest matching gesture.

I have a prototype that is "almost" working, but I'm having some trouble getting the math functions to play nicely with my algorithm. Right now, I have a list of points representing segments of a defined size that make up the gesture. I iterate over these points and get the theta value of the segment like so:

start = points[i]
end = points[i + 1]
theta = math.atan2((p2[1] - p1[1]), (p2[0] - p1[0]))
theta = ((theta + (math.pi * 2)) % (math.pi * 2))

The math.pi correction is so that I'll have all positive radian values. Makes it a lot easier to compare them. I also have a list containing the radian equivalent values of [0, 45, 90, 135, 180, 225, 270, 315, 360]. I iterate over the segments and compare the theta value to each of those 8 directions (360 is a redundancy so that I can compare values greater than 315 to 0). I use the index of the direction + 1 to get my mapped value.

So if I have a drawing of a box like so:

Then according to the algorithm, I should get the values "1357" to indicate the directions being 0, 90, 180, and 270 degrees in change.

However, something seems to be off about the way I calculate my theta values, or the way I compare them, because for that drawing, I get "1753" indicating that it's flipping the theta values for the second and third lines (the vertical ones). Here is how I'm comparing the points:

for i in range(len(points) - 1):
    p1 = points[i]
    p2 = points[i + 1]
    theta = math.atan2((p2[1] - p1[1]), (p2[0] - p1[0]))
    theta = ((theta + TWO_PI) % TWO_PI)
    closest = 0
    cDiff = TWO_PI
    for i in range(len(DIRECTIONS)):
        direction = DIRECTIONS[i]
        diff = abs(direction - theta)
        if diff < cDiff:
            cDiff = diff
            closest = I
    if closest == (len(DIRECTIONS) - 1):
        dir.append(1)
    else:
        dir.append(closest + 1)

So my theta values seem to be increasing clockwise, rather than counter-clockwise, so for the following angle:

...I would expect the theta value to be (pi / 4), but instead, it seems to be (7pi / 4).

Can anyone spot a flaw in my logic? This same math works in my game written in Java. Are Python's math functions different somehow?

Edit: Added a diagram to explain the encoded gesture movement values.

sentences:
How do I specify ARGB format textures in my input declaration? const D3D11_INPUT_ELEMENT_DESC InputLayoutDesc::Basic32[3] =
{
    {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
    {"NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
    {"TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0}
};

The TEXCOORD,
There is no support for a image that is ARGB. Only DXGI_FORMAT_R32G32B32A32_FLOAT

How can I load ARBG?

Or can I convert a ARGB TO A RGBA IMAGE?

sentences:
Basic terrain shader without using external texture I have this:

(Right now I have the height map in a x*x size 2D array and a 1D vector too.)
What I am trying to achieve is something like this:

Without using any textures, only plain colors. So basically smooth transitions and some shadow (using shaders).
My vertex shader looks like this:
    #version 330
    layout (location = 0) in vec3 Position;
    layout (location = 1) in vec3 Normal;
    layout (location = 2) in vec3 Color;

    out vec3 fragmentNormal;
    out vec4 ex_color,pos;
    out vec3 N;
    out vec3 v;

    void main () {
    pos= vec4(Position,1);
    ex_color = vec4(Color,1);
    fragmentNormal = Normal;

    v = vec3(gl_ModelViewMatrix * pos);
    N = normalize(gl_NormalMatrix * Normal);

    gl_Position = gl_ModelViewProjectionMatrix * vec4(Position,1);

I have normals for all the vertices. Color is set simply in the c++ code based on height.
Here is the fragment shader
    in vec3 N;
    in vec3 v;
    in vec4 ex_color;
    void main(void)
    {
       vec3 L = normalize(gl_LightSource[0].position.xyz - v);
       vec4 Idiff = gl_FrontLightProduct[0].diffuse * max(dot(N,L), 0.0);
       Idiff = clamp(Idiff, 0.0, 1.0);
       gl_FragColor = Idiff*ex_color;
    }

So I guess my problem is what formula should I use to mix the colors. I think I don't need to set the colors in the c++ code but in the shaders.
Update:
Here is the wireframe of the terrain.

Update2:
Based on @Babis' answer the result is:

So the gradient is not "projected" onto the surface as I would like to do. What could cause this? Maybe my qustion wasn't clear.

sentences:
How can I create a parabola that does not use negative X coordinates I am currently devloping my first javascript program ever which is a table tennis game.
I am trying to create trajectory for the ball to follow when hit - just a very basic parabola. However im not very good at math, and I have no idea how to do this!

I want to have the parabola start wherever the ball was hit. The X position will be either 100 or 110, since that is the only two positions where it is possible to hit the ball. And the Y position will completely vary.
So I need to create a parabola that - if your looking at a 2D table - starts from the right side of the net and ends up on the right side, as if you did an under arm hit.
I have no ides how to do this since there will be no minus positions!
- Maybe I should have two arcs one coming up and the other one coming down? I also have no idea what equation would make an trajectory in the shape of an arc.

sentences:
Photon Realtime, StripKeysWithNullValues cause heavy GC Alloc In our current project, we use Photon room properties to sync entities. and i noticed some heavy GC Allocs while deep profiling the game and it always ends down to this method.

Have anyone faced this issue before ? or attempted to fix it ? here is the source code of that method.

/// <summary>
        /// This removes all key-value pairs that have a null-reference as value.
        /// Photon properties are removed by setting their value to null.
        /// Changes the original passed IDictionary!
        /// </summary>
        /// <param name="original">The IDictionary to strip of keys with null-values.</param>
        public static void StripKeysWithNullValues(this IDictionary original)
        {
            object[] keys = new object[original.Count];
            original.Keys.CopyTo(keys, 0);

            for (int index = 0; index < keys.Length; index++)
            {
                var key = keys[index];
                if (original[key] == null)
                {
                    original.Remove(key);
                }
            }
        }

sentences:
How to cancel out simultaneous collisions in libGosu? I am working on an Asteroids remake. When the player's bullets hit a large meteor, it should break apart into 2 smaller meteors. This works when the player is only firing one bullet, but when the player's weapon is upgraded, shooting multiple bullets, sometimes two bullets hit the same meteor at the same time, causing it to break into 4 smaller meteors, not 2 as intended.

Is there a way to cancel out one of the collisions when there are two simultaneous collisions - or a way to omit the creation of the unwanted extra meteors when two bullets hit the same meteor at the same time?

Here is how I have the collision detection set up currently:

Bullet.each_collision(Meteor1) do |bullet, meteor|
  Explosion.create(:x => meteor.x, :y => meteor.y)
  Meteor2.create(:x => meteor.x, :y => meteor.y)
  Meteor2.create(:x => meteor.x, :y => meteor.y)
  meteor.destroy
  bullet.destroy
  @score += 100
  Sound["media/audio/explosion.ogg"].play(0.2)
end

Following are screenshots demonstrating the situation:

In the first two images (above) the player fires one bullet at a time, the large meteor breaks into two smaller meteors, and the score increases by 100.

In the last two images, the player fires three bullets at a time, the large meteor breaks apart into four smaller meteors, and the score increases by 200, due to a simultaneous collision.

sentences:
Static constants set to default value in HLSL I'm using dx11 and I'm working on SSAO. I am having wierd results, so I tried debugging it using RenderDoc and stepping through the pixel shader log, all the values of the static array seems to default to 0-vector. For example, look at r3-register in the following screenshot.

Here's the pixel shader I'm using. The global static variable that seems to be all null despite my initialization is the gSSAOKernel. Why is this? Isn't this correct?

#ifndef SSAO_PIXEL_HLSL
#define SSAO_PIXEL_HLSL

#include "Constants.h"
#include "Common.hlsl"

static const float gKernelSize = 16.0;
static const float gRadius = 1.5;
static const float gSSAOPower = 2.0;
static const float3 gSSAOKernel[gKernelSize] =
{
    float3(-0.0780436, 0.0558389, 0.0281286),
    float3(0.034318, -0.0635879, 0.0741237),
    float3(0.00230821, 0.0807279, 0.0805477),
    float3(0.0124638, 0.117585, 0.0578601),
    float3(0.093943, -0.0944602, 0.0816459),
    float3(0.139348, -0.109816, 0.0618508),
    float3(-0.181872, -0.129649, 0.0380075),
    float3(0.240066, -0.0494057, 0.118559),
    float3(0.115965, -0.0374714, 0.301286),
    float3(-0.294819, -0.100726, 0.225789),
    float3(-0.149652, 0.37459, 0.202967),
    float3(0.261695, -0.292813, 0.349015),
    float3(-0.37944, -0.425145, 0.206921),
    float3(0.628994, -0.189387, 0.224343),
    float3(-0.331257, -0.646864, 0.307335),
    float3(-0.467004, 0.439687, 0.618459),
};

cbuffer SSAOCBuffer : register(CBUFFER_REGISTER_PIXEL)
{
    float4x4 gViewProjMatrix;
    float4x4 gProjMatrix;
    float2 gScreenSize;
};

Texture2D gPositionTexture : register(TEXTURE_REGISTER_POSITION);
Texture2D gNormalTexture : register(TEXTURE_REGISTER_NORMAL);
Texture2D gNoiseTexture : register(TEXTURE_REGISTER_DIFFUSE);
Texture2D gDepthTexture : register(TEXTURE_REGISTER_DEPTH);
SamplerState gPointSampler : register(SAMPLER_REGISTER_POINT);

float linearizeDepth(in float depth, in float4x4 projMatrix) {
    return projMatrix[3][2] / (depth - projMatrix[2][2]);
}

float4 ssao(in float3x3 kernelBasis, in float3 originPos)
{
    float occlusion = 0.0;
    for (int i = 0; i < gKernelSize; i++)
    {
        float3 samplePos = mul(kernelBasis, gSSAOKernel[i]);   <---------------------- this line
        samplePos *= gRadius * originPos;

        float4 offset = mul(gViewProjMatrix, float4(samplePos, 1.0));
        offset.xy /= offset.w;
        offset.xy = offset.xy * 0.5 + 0.5;

        float depth = gDepthTexture.Sample(gPointSampler, offset.xy).r;
        depth = linearizeDepth(depth, gProjMatrix);

        float rangeCheck = abs(originPos.z - depth) < gRadius ? 1.0 : 0.0;
        occlusion += (depth <= samplePos.z ? 1.0 : 0.0) * rangeCheck;

    }
    occlusion = 1.0 - (occlusion / float(gKernelSize));

    return pow(occlusion, gSSAOPower);
}

float4 ps_main(float4 position : SV_Position) : SV_Target0
{
    float2 coords = float2(1920.0, 1080.0) / float2(4.0, 4.0);
    coords *= float2(position.x / gScreenSize.x, position.y / gScreenSize.y);

    float3 originPos = gPositionTexture[uint2(position.xy)].xyz;
    float3 normal = gNormalTexture[uint2(position.xy)].xyz;

    float3 rvec = gNoiseTexture.Sample(gPointSampler, coords).xyz; //texture(uNoiseTex, noiseTexCoords).rgb * 2.0 - 1.0;
    float3 tangent = normalize(rvec - normal * dot(rvec, normal));
    float3 bitangent = cross(tangent, normal);
    float3x3 kernelBasis = CreateMatrixFromCols(tangent, bitangent, normal);

    return ssao(kernelBasis, originPos);// gFinalTexture.Sample(gPointSampler, coords);//float4(1.0, 0.0, 1.0, 1.0);
}

#endif

Also - offtopic, but this pixelshader murders my framerate, all the way from solid 450+ to 80-90. I guess with all the texture lookups the technique is simply expensive, but still, I must be doing something wrong in regard to performance.

sentences:
How to calculate IsGrounded more effective? if (SimpleInput.GetButtonDown(jumpButton) && IsGrounded())
    {
        rb.AddForce(0f, 8f, 0f, ForceMode.Impulse);
    }

bool IsGrounded()
    {
        return Physics.CheckCapsule(Char_Collider.bounds.center, new Vector3(Char_Collider.bounds.center.x, Char_Collider.bounds.min.y, Char_Collider.bounds.center.z), Char_Collider.radius * 0.27f, GroundLayers);
    }

I've multiplied Char_Collider.radius with 0.27f 'cause in the tutorial that guy said You need to multiply this with %90 of your character's actual size That might be the problem because i don't actually know my character's size, i've made it in blender and scaled it down at the unity.

So if you look at the inspector panel you'll see it's 0.1 0.1 0.1 but it's actually not. I tried to spawn a cube and match them together roughly, cube's size was 0.3 1.2 0.3, that's way the number is 0.27f 'cause i just simply calculated it with the 0.3.

And finally my problem is:

I get return values from IsGrounded delayed, sometimes doesn't even get a value. Like example when i jump, sometimes it returns the value of IsGrounded False when i'm just about the hit the ground, and sometimes it doesn't returns the value of IsGrounded False. Because of this i can't make jump animation properly.

This is my HandleAnimation() method (I call that from FixedUpdate()):

void HandleAnimation()
{
    if (!IsGrounded())
    {
        anim.SetBool("Jumping", true);
    }
    else
    {
        anim.SetBool("Jumping", false);
    }
}

And this is my animator:

I am also adding those because sometimes when IsGrounded() returns false, animation doesn't works.

sentences:
2D Blizzard/Snowstorm Effect How can I implement a blizzard/snowstorm effect in a 2D platformer? I have a particle system for snow particles, but I need some kind of windblown texture similar to this as well: How do I create this windblown snow effect?

Could I generate a windblown texture using perlin noise in Photoshop or something and sample it similar to the answer in this question about fog? How to create a 2D fog shader?

In that case it would have to be more dense than the fog texture, so holes don't appear that you can peak through when sampling the texture.

BTW I have a wind speed variable for my snow particles, could that be used for the windblown texture as well somehow?

sentences:
The meaning of colours in other cultures According to http://www.color-wheel-pro.com/color-meaning.html and many other western websites certain colours have meanings.

To summarise the meaning of colours in the context of a typical RTS game:

red = danger or enemy
gold = wealth or high quality
yellow = energy
green = healing
aqua = protection
blue = power
pink = romance
white/grey = neutral territory
black = mystery

(There are many more meanings that I deliberately left out as it is not applicable to games)

However this information was collected from western websites.

If I have to design a game that needs to be played internationally, would it make sense to go with the above "colour rules" or could I expect that other cultures like the Eastern or African cultures could have a significant different association with colours than the Western cultures?

If so, would it make sense to not only translate the text of a game for a foreign culture, but also translate the colours too?

sentences:
Rotate vector by matrix? If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)?

I'm working in XNA if that helps.

sentences:
current value of x for vector2 game object I just need to push my game object in y direction not in of its x position,I need to assign it a new position but unable to access its current x position value so that can make it fix on its x position... please help

I tried this:

Vector2 curScreenPoint = new Vector2 (need the current x position of game object , Input.mousePosition.y);

Vector2 curScreenPoint = new Vector2 (0, Input.mousePosition.y);
     Vector2 curPosition = Camera.main.ScreenToWorldPoint (curScreenPoint);
    transform.position = curPosition;

sentences:
How can I parent an object whilst animating? Much like in Blender where you can parent an object to another, or the Armature, is it possible to parent an object to another, so when animating, the child object moves with the parent?

I've tried dropping the object I want influenced onto the character's parent object in the hierarchy and accessed it via the Animation tab. I added the object as a property and adjusted it's position, but the results have been pretty mixed.

How can I have an object automatically follow the animation without manually adjusting its curves for each frame?

sentences:
How do I use trigger colliders in Unity? I am trying to create a "Fruit Ninja" style game in Unity in VR. I have a BoxCollider on my sword set to "Trigger" and I have some "fruit" objects coming towards it. I then have this function:

void OnTriggerEnter(Collider other)
{
    Destroy(gameObject);
    Destroy(other.gameObject);
}

I've tried applying this script to the sword and to the objects, but nothing is destroyed.

In the documentation, there is also a note of "Trigger events are only sent if one of the Colliders also has a Rigidbody attached", but I've attached a Rigidbody to the objects.

sentences:
Unity: finding force vector to separate colliders in OnTriggerStay events In Unity, I have Trigger Colliders, and catch the OnTriggerStay(Collider other) events.

Once two Colliders are touching, how do I get the Force vector to make them want to separate again?

In the example below, I have a Sphere and a Box Collider touching. The OnTriggerStay is being called for the Sphere.

I cannot use the center positions of the transforms to get a direction, as that would not give me a very good force vector:

And I do not think I can use the Collider.ClosestPointOnBounds to figure out the Box touch position, because the point I look from (center of Sphere), could be inside the Box Collider itself, which I understand will just return me back the center of the Sphere again. I would not be able to resolve any force vector from that.

sentences:
Game performs poorly when sideloaded My game runs smooth when I deploy it to my windows phone directly from Visual Studio 2012 in debugging mode.

But when I sideload/deploy the same .xap file with the Application Deployment Tool, the game runs much worse.

Why is that happening?

sentences:
How to store unique keys for an infinitely generated, chunked world? My game is made up of chunks which are identified in world space with and X and Y coordinate. Each chunk contains 16 tiles by 16 tiles by 4 layers. So that I don't have to loop over every single tile every time I want to access things such as hitboxes or animation frames I store that tile's value as keys in various dictionaries such as "Animations" or "Collidables". Until now I have been doing it like this:

        public string GetTileKey(int layer)
    {
        string XString = X.ToString();
        if (XString.Length < 4)
        {
            XString = XString.PadLeft(4, '0');
        }
        string YString = Y.ToString();
        if (YString.Length < 4)
        {
            YString = YString.PadLeft(4, '0');
        }
        return layer.ToString() + XString + YString;

    }

which as you can imagine, slows things down considerably!

After chatting with a few awesome people in discord I was suggested a bitwise method which would store the first few bits as the X coordinate, the second few as the Y, and the last 2 as the layer like so:

public int GetTileKeyAsInt(int layer, IInformationContainer container)
    {
        return (X << 16) | (Y << 9) | layer;
    }

(The container parameter is not currently used, I was trying things out with its X and Y coordinates. It's really just the chunk)

which works fantastic when used with X and Y values which are between 0 and 128 and which are not negative. In addition it guaranteed no duplicate keys.

I quickly realized this wouldn't work with my world, which requires both positive and negative coordinates and an "infinitely" expanding number of chunks.

What is a better way to do this? I was planning on using a float or a double and using the first bit as the sign value, and the next eight (4 and 4) to store the X and Y coordinates of local tiles within chunks and then allocating the rest of the bits to allow for a massive number of allowable chunks. I'll admit I'm not super familiar with bitwise operations or even really the specifics between int, float and double :( but from what I've gathered it doesn't actually make sense to do bitwise operations with anything larger than an Int 32!

sentences:
Do I need a database to support a sign-in system to associate a player with their save/highscore data? I am making a 2d game with Unity, and in my game I want to add a username and a password for each player, so that when the player signs in, they will get all the data about what they played until the moment they signed in (like their highscore and so on)

So my question is: do I need to use a database like sqlite, or could this be done with Unity without needing an external database?

sentences:
How can I create a fade effect between scenes in Libgdx? I have implemented a screen fade with Scene2D.  It currently fades fades out of one screen to black, then then from that black into the next screen.  It would be really awesome if I could fade straight from the first screen to the new screen, without the black state between.  Is this possible?

I tried using the parallel method but it just did everything all at once.  I want it to kind of morph through the screens.

sentences:
How to either draw a group of tiles completely behind or completely in front of a player? Say you're rendering a 2D top-down tile map and there are some objects in the tile map that the player should be "in front" of when below them, and "behind" when on top of them. Like in this example screenshot:

This works because the player is on layer 1, the top two tiles are on layer 2, and the bottom tile is on layer 0.
Let's say in this example that the object has no collision. If the character then walks up, then the character will be half-in-front and half-behind, like this:

The reason why this is a problem is because with tiles, they don't really have a concept of state. If the 3 tiles were part of the same "object", then this wouldn't be a problem, because we could just render the entire group of 3 tiles as a single sprite, and then sorting could be done, and the entire sprite could be rendered behind or in front of the player.
However, with tiles, this knowledge isn't known, as they are purely decorative numbers.
One possible solution is just to instead forsake tiles for these sorts of objects, and force them to be entities in the game itself as opposed to just tiles, but because there can be many of these, that would be a performance hit. It also complicates the logic.
Is there any better solution?

sentences: Can I pause Unity Setup download and continue it whenever possible as per convenience(using Unity Hub)? Actually I get only 1.5GB data daily. So it's not possible for me to download the whole Unity setup in a day. So I wanted to know if I can pause and resume download process as per convenience. I am downloading using Unity Hub.

sentences:
How can I avoid assets reload if an Android activity is re-created? I've put my libGDX view inside a bigger Android layout. When the user rotates the screen, a new layout specific for the orientation is drawn, for this reason, the activity is rebuilt from scratch forcing the libGDX view to reload all assets.

I tried to store these assets in a static variable, but on the second time I create the libGDX view, they are not rendered correctly (it looks like textures are not loaded and everything is transparent).

How can I avoid reloading heavy assets (models and textures)?

sentences:
Need to generate seamless gradient noise texture for water Shader I need to generate something like this

for my water Shader, because on fly calculations are to expensive for mobile (https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Gradient-Noise-Node.html). The texture needs to be seamless. I currently clueless where and how to make this happen (especially about the seamless thing). Any help appreciated!

sentences: In Physijs, how do I detect that an object is still? I have a cylinder that simulates a flipping coin. I am using Physijs. The coin might bounce off the surface multiple times before stopping. How can I know when the coin has completely stopped moving?

sentences:
Setting the values of a struct array from JS to GLSL I've been trying to make a structure that will contain all the lights of my WebGL app, and I'm having troubles setting up it's values from JS. The structure is as follows:

struct Light {
    vec4 position;
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec3 spotDirection;
    float spotCutOff;
    float constantAttenuation;
    float linearAttenuation;
    float quadraticAttenuation;
    float spotExponent;
    float spotLightCosCutOff;
};
uniform Light lights[numLights];

After testing LOTS of things I made it work but I'm not happy with the code I wrote:

program.uniform.lights = [];
    program.uniform.lights.push({
        position: "",
        diffuse: "",
        specular: "",
        ambient: "",
        spotDirection: "",
        spotCutOff: "",
        constantAttenuation: "",
        linearAttenuation: "",
        quadraticAttenuation: "",
        spotExponent: "",
        spotLightCosCutOff: ""
    });

        program.uniform.lights[0].position = gl.getUniformLocation(program, "lights[0].position");
        program.uniform.lights[0].diffuse = gl.getUniformLocation(program, "lights[0].diffuse");
        program.uniform.lights[0].specular = gl.getUniformLocation(program, "lights[0].specular");
        program.uniform.lights[0].ambient = gl.getUniformLocation(program, "lights[0].ambient");

    ... and so on

I'm sorry for making you look at this code, I know it's horrible but I can't find a better way.

Is there a standard or recommended way of doing this properly? Can anyone enlighten me?

sentences:
Applying Y offset to rotation / position script I'm using the script stated below to move a spray bottle around a head.

The code works fine: I have assigned the script to the spray bottle, and I have set the head as the target.

However, I was not happy with the center that Unity seems to use for the spray bottle. The spray bottle never perfectly aimed at the center of the head.

To find out what is going on here, I added a long sphere to the spray bottle. Then I moved the sphere until it would perfectly visualize the center that Unity uses. As once can see, Unity uses the bottom of the spray bottle as its center.
I have uploaded a video here to show the effect.

I imagined that I need to tell the script that the center of the spray bottle is different. I would have to include an offset (I guess a Vector3) in order to set the nozzle as the center.

I haven't been able to find out how to plug this "offset" into the script.

Can anybody tell me where / how I could do that?

Thank you very much!

using UnityEngine;
using System.Collections;

[AddComponentMenu("Camera-Control/Mouse Orbit with zoom")]
public class MouseOrbitImproved : MonoBehaviour
{

public Transform target;
public float distance = 5.0f;
public float xSpeed = 120.0f;
public float ySpeed = 120.0f;

public float yMinLimit = -20f;
public float yMaxLimit = 80f;

public float distanceMin = .5f;
public float distanceMax = 15f;

private Rigidbody rigidbody;

float x = 0.0f;
float y = 0.0f;

// Use this for initialization
void Start()
{
    Vector3 angles = transform.eulerAngles;
    x = angles.y;
    y = angles.x;
}

void LateUpdate()
{
    if (target)
    {
        x += Input.GetAxis("Mouse X") * xSpeed * distance * 0.02f;
        y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f;

        Quaternion rotation = Quaternion.Euler(y, x, 0);

        Vector3 nTargetPos = target.position + new Vector3(0, 0.1f, 0);//10 centimetres lower. The original target.position's center would be around the nose. Instead I want the forehead to be the center, that's why I add 10 centimeters to the y position.

        Vector3 negDistance = new Vector3(0.0f, 0.0f, -distance);
        Vector3 position = rotation * negDistance + nTargetPos;

        transform.rotation = rotation * Quaternion.Euler(0, -90, 0);//compensate for the fact that the spray bottle should face the head (requiring yaw to be yaw-=90)
        transform.position = position;
    }
}

sentences: How To Resolve Collision Before it Occurs I have 2 objects, A and B, in a 2 dimensional space. If I know A is trying to move by vector M (that is to add vector M to the positional vector of A), and that A will collide with B after A moves, what math would be used to scale back the M's x and y components such that M will no longer collide, whilst still allowing M to make A slide along B should x or y be cut back? (eg. if A is on the left of B, moves with vector (1f,1f), cant move 1 right, but can move 1 up and does so).

sentences:
How to make the snake bodyParts follow same places and directions as the player on a curved surface? I try to make a game like the classic snake game but on a round ground (Earth). On a plane, the script works well, but when i moved it on a sphere, the bodyparts (prefabs), are not working good as you can see in the picture ( they are going right/left, but they do not sit on the spehre and i tried already to use sphere collider, box collider, rigidbody) and i dont know really how to make it so that they will follow 100% correctly the player. Thanks for help! :/ . Here i put the script for the Player and bodyparts:
using System.Collections;

using System.Collections.Generic;

using UnityEngine; using UnityEngine.UI;

public class PlayerMovementScript : MonoBehaviour {

protected Joystick joystick;
public float speed;
[SerializeField] private float turnFactor;
[SerializeField] private Transform planet;
public List<Transform> bodyParts = new List<Transform>();
public float minDistance = 0.25f;
public int beginSize;
public float rotationSpeed = 50;
public float timeFromLastRetry;
public GameObject bodyprefabs;
public Text currentScore;
public Text scoreText;
public GameObject deadScreen;
private float dis;
private Transform curBodyPart;
private Transform PrevBodyPart;

public bool isAlive;
 void Start()
{
 joystick = FindObjectOfType<Joystick>();
 speed = 3f;
 StartLevel();
}
public void StartLevel()
{
 timeFromLastRetry = Time.deltaTime;
 //deadScreen.SetActive(false);
 for (int i = bodyParts.Count -1; i > beginSize; i++)
 {
     Destroy(bodyParts[i].gameObject);
     bodyParts.Remove(bodyParts[i]);
 }
 bodyParts[0].position = new Vector3(0, 0.5f, 0);
 for (int i = 0; i < beginSize - 1; i++)
 {
     AddBodyPart();
 }
 bodyParts[0].position = new Vector3(0, 0.5f, 0);
 bodyParts[0].rotation = Quaternion.identity;
 currentScore.gameObject.SetActive(true);
 currentScore.text = "Score: 0";
 isAlive = true;
}
void Update()
{
 if (isAlive)
       Move();
 if (Input.GetKey(KeyCode.Q))
     AddBodyPart();
 //RotateAroundPlanet();
 var rb = GetComponent<Rigidbody>();
 //rb.velocity = new Vector3(joystick.Horizontal * 100f, rb.velocity.y, joystick.Vertical * 100f);
}
public void Move()
{
 float curspeed = speed;
 //if (Input.GetKey(KeyCode.W))
 //    curspeed *= 2;
 bodyParts[0].Translate(bodyParts[0].forward * curspeed * Time.smoothDeltaTime, Space.World);
 if (Input.GetAxis("Horizontal") != 0)
     bodyParts[0].Rotate(Vector3.up * rotationSpeed * Time.deltaTime * Input.GetAxis("Horizontal"));
 for (int i = 1; i < bodyParts.Count; i++)
 {
     curBodyPart = bodyParts[i];
     PrevBodyPart = bodyParts[i - 1];
     dis = Vector3.Distance(PrevBodyPart.position, curBodyPart.position);
     Vector3 newpos = PrevBodyPart.position;
     newpos.y = bodyParts[0].position.y;
     float T = Time.deltaTime * dis / minDistance * curspeed;
     if (T > 0.5f)
         T = 0.5f;
     curBodyPart.position = Vector3.Slerp(curBodyPart.position, newpos, T);
     curBodyPart.rotation = Quaternion.Slerp(curBodyPart.rotation, PrevBodyPart.rotation, T);
 }
}
public void AddBodyPart()
{
 Transform newpart = (Instantiate(bodyprefabs, bodyParts[bodyParts.Count - 1].position,
 bodyParts[bodyParts.Count - 1].rotation) as GameObject).transform;
 newpart.SetParent(transform);
 bodyParts.Add(newpart);
 currentScore.text = "Score: " + (bodyParts.Count - beginSize).ToString();
}
public void Die()
{
 isAlive = false;
 scoreText.text = "Your score was: " + (bodyParts.Count - beginSize).ToString();
 currentScore.gameObject.SetActive(false);
 deadScreen.SetActive(true);
}

sentences:
Mirror/Unet, RegisterSpawnHandler throws invalid asset Id error because assetId is 0 for dynamically loaded assetbundles Its weird how documentation literally states that

For more advanced uses, such as object pools or dynamically created
Assets, you can use the ClientScene.RegisterSpawnHandler method

But seems like its broken, because dynamically loaded objects' assetIds' are always 0:
(This is true for all other dynamically spawned objects)

My code structure:
I have a "MapLoader" script that loads objects from filesystem using its config file.
MapLoader creates vehicles and assigns them unique UIDs that are same across players.
Vehicles are added into Static dictionary with UID -> vehicle key/value pairs, and to a list of GameObjects:
        VehicleNetworking vehicleNet = spawned.AddComponent<VehicleNetworking>();
        vehicleNet.vehicleScript = vehicleScript;
        vehicleNet.uid = uid;

        spawned.tag = "vehicle";
        spawned.layer = 10;

        GameManager.vehiclesToSpawn.Add(spawned);
        GameManager.AddVehicle(vehicleNet);
    }

After vehicles have been added, I call functions on the local Player object to spawn them:
  foreach (GameObject vehicle in GameManager.vehiclesToSpawn)
    {
        if (isServer)
        {
            SpawnServerVehicles(vehicle);
        }
        else
        {
            SpawnClientVehicles(vehicle);
        }
    }

Spawn scripts:
[Server]
void SpawnServerVehicles(GameObject vehicle)
{
    Debug.Log("Server should spawn: " + vehicle.name);
    NetworkServer.Spawn(vehicle);
}

[Client]
void SpawnClientVehicles(GameObject vehicle)
{
    Debug.Log("Client should spawn: " + vehicle.name);

    MD5 md5 = MD5.Create();
    string vehicleId = vehicle.GetComponent<VehicleNetworking>().uid;
    byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(vehicleId));

    Guid result = new Guid(hash);
    Debug.Log(vehicle.name + "-" + result);
    ClientScene.RegisterSpawnHandler(result, SpawnHandler, UnSpawnHandler);
}

Spawn handlers:
private static GameObject SpawnHandler(Vector3 position, Guid vehicleGuid)
{
    Debug.Log("Called Spawn Handler");
    GameObject go = new GameObject();
    return go;
}

private static void UnSpawnHandler(GameObject gameObject)
{
    Destroy(gameObject);
    Debug.Log("Called UnSpawn Handler");
}

If I am doing everything right, and Mirror library is actually broken, then I'd like to know what could the workarounds be?
My goal is to have SyncVars on vehicles working and syncing with the server(But for this, I need to have NetworkIdentity on vehicles, and for them to work, they need to be spawned using NetworkServer or ClientScene).

sentences:
ECS component dependencies / sharing and cache locality I have been trying to wrap my head around how ECS works when there are components which are shared or dependent. I've read numerous articles on ECS and can't seem to find a definitive answer to this.

Assume the following scenario:

I have an entity which has a ModelComponent (or MeshComponent), a PositionComponent and a ParticlesComponent (or EmitterComponent).

The ModelRenderSystem needs both the ModelComponent and the PositionComponent.

The ParticleRenderSystem needs ParticlesComponent and the PositionComponent.

In the ModelRenderSystem, for cache efficiency / locality, I would like run through all the ModelComponents which are in a compact array and render them, however for each model I need to pull the PositionComponent. I haven't even started thinking about how to deal with the textures, shaders etc for each model (which will definitely blow the cache).

A similar issue with the ParticleRenderSystem.. I need both the ParticlesComponent as well as the PositionComponent, and I want to be able to run through all ParticlesComponents in a cache efficient / friendly manner.

I considered having ModelComponent and ParticlesComponent each having their own position, but they will need to be synched every time the models position changes (imagine a particle effect on a character). This adds another entity or component which needs to track and synch components or values (and potentially negates any cache efficiency).

How does everyone else handle these kinds of dependency issues?

sentences:
Using Lua for configuration and localization data Since my game is already going to be scripted with Lua, I've decided to make all my configuration and localization data defined using Lua tables.  For example, this could be a basic locale file:

-- en-us.lua
text = {
    error = {
        sdl = "Error initializing SDL",
        opengl = "Error initializing OpenGL",
        resource = "Error loading resource $",
        -- ...
    },
    menu = {
        offline = "Play solo",
        online = "Play co-op",
        quit = "Quit",
        -- ...
    },
    -- ...
}

Different locales and profiles can be loaded simply by choosing the right file, for example between en-us.lua and fr.lua.

Because the table is in global scope, it's easy for other Lua code to reference.  If a script needed to access a configuration variable or throw an error, it would just have to look up the value using something like text.error.opengl or config.graphics.fullscreen.

The difficulties come when native code (C) has to work with these values.  There are basically two options that I can think of:

The tables are loaded into client code as a tree.  It's easy to get and set values on the client side, but changes on either side need to be synchronized.
The native code does no caching and instead directly reads from/writes to the Lua state each time.  Possible performance issues?

What's the best way to handle this from the native side?

sentences:
Unity: White outline around seams in my character, make it stop! so once upon a time I made a really cool character for my game project and he looked great. Then at some unspecific point in time, my character's UV seams got these awful white outlines around them:

I assumed the problem was that during some texture revision, I didn't paint past the island seams, so I compared the texture file with an image of the UV output, but in fact I did paint past the seams, so that isn't the problem. I have heard that this may have something to do with antialiasing, but I don't want to turn that off if I can fix the problem another way. Also, notice that the enemy character in the above gif does not suffer from the same problem.

What could be causing this? How can I fix it?

sentences:
How can i display a nice big gui text in the middle of game view screen? The same idea like the message: "Display 1 No cameras rendering"
I'm trying to do it too but i don't see anything when running the game.

In the Hierarchy i have a empty GameObject and in the Inspector attached to it the script and two components: GUI Text and GUI Texture

This is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SwitchCameras : MonoBehaviour
{
    [Header("Cameras Init")]
    public Camera[] cameras;
    public Vector3[] originalPosition;
    [HideInInspector]
    public Vector3 currentCameraOriginalPosition, currentCameraPosition;

    [Space(5)]

    [Header("Cameras Switch")]
    public string currentCameraName;
    public Vector3[] lastCameraPosition;

    private int currentCamera = 0;

    [Space(5)]

    [Header("Gui Text")]
    public GUIText myGUItext;
    public GUITexture texture;
    public int guiTime = 2;

    void Start()
    {
        cameras = Camera.allCameras;
        lastCameraPosition = new Vector3[cameras.Length];

        if (cameras.Length >= 1)
        {
            originalPosition = new Vector3[cameras.Length];
            for (int i = 0; i < cameras.Length; i++)
            {
                originalPosition[i] = cameras[i].transform.position;
            }
        }

        if (cameras.Length == 1)
        {
            myGUItext.text = "Need more then 1 camera for switching..";
            myGUItext.gameObject.SetActive(true);
            texture.gameObject.SetActive(true);
            StartCoroutine(GuiDisplayTimer());
        }
        else
        {
            Debug.Log("Found " + cameras.Length + " cameras");
        }

        for (int i = 0; i < cameras.Length; i++)
        {
            cameras[i].enabled = false;
        }
        cameras[0].enabled = true;
        currentCameraName = cameras[0].name;
        currentCameraOriginalPosition = originalPosition[0];
    }

    void LateUpdate()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            cameras[currentCamera].enabled = false;

            if (++currentCamera == cameras.Length)
                currentCamera = 0;

            cameras[currentCamera].enabled = true;
            currentCameraName = cameras[currentCamera].name;

            currentCameraOriginalPosition = originalPosition[currentCamera];
        }
        lastCameraPosition[currentCamera] = cameras[currentCamera].transform.position;
        currentCameraPosition = lastCameraPosition[currentCamera];
    }

    IEnumerator GuiDisplayTimer()
    {
        yield return new WaitForSeconds(guiTime);
        myGUItext.gameObject.SetActive(false);
        texture.gameObject.SetActive(false);
    }
}

I used a break point and it's getting to the line:

myGUItext.text = "Need more then 1 camera for switching..";

But not showing it on the game view when running the game.

sentences:
Developing a 2D Android game on Unity - Pros and Cons Depending on your experiences, if you have created a 2D game on Android using Unity, was it painful? Have you ever said "I wish I have used X instead of Unity!"?

Tell me the Pros, Cons and the name of "X" please.

Edit: Consider it for a commercial shoot em up game. The programming language can be anything.

sentences:
How do I integrate bullet physics into my game? I downloaded the release file found here, but I'm just not sure where to start. In my game I have a number of oblongs and a sphere, I want all of these to collide with one another. (They all have meshes and associated bounding volumes)

edit - I just realised the cuboids actually have AABB's associated with them. I guess I'll have to change that at least.

What are the steps I need to follow?

sentences:
OpenAL Soft - Sounds cut off randomly I'm using OpenAL Soft 1.16.0.

Everything's running fine, but for some reason my sounds keep getting cut off at either the beginning or the end (hard to tell). It's not really noticable for music and longer sounds, but it's a big problem for anything shorter than a second, e.g. footsteps:

http://youtu.be/xrJVKjFEzYg

The sounds themselves are definitely not the issue, I've grabbed the footstep sounds from another game for testing purposes to be sure and I've tried various different sounds from different sources.

It's not the format either, the same problem occurs regardless of whether I use .mp3, .wav or .ogg files.

What could be causing this problem?

sentences:
How much memory does a Game Boy game have for save data? Is there a standard number of bytes a Game Boy game would have to store (battery backed up) save data?

If not a standard, is there an common size, or a few examples of save data sizes?

If Game Boy is not known, I'd be happy with the same information for NES.

Thanks!

sentences:
Deleting a game object causing an access violation I tried doing this but it cause an access violation.

void GameObjectFactory::Update()
{
     for( std::list<GameObject*>::iterator it=gameObjectList.begin() .....
          (*it)->Update();
}

void Bomb::Update()
{
     if( time == 2.0f )
     {
         gameObjectFactory->Remove( this );
     }
}

void GameObjectFactory::Remove( ... )
{
     gameObjectList.remove( ... );
}

My thoughts would be to mark the object to be dead then let the factory handle it the on next frame for deletion. Is it the best and fastest way? What do you think?

sentences:
What is the convention for column-major order matrix transformations? According to this cheat sheet for CG, if I want to use column-major order for my matrix/vector math I have to multiply from the left applying transformations from right to left, i.e. v' = P * V * v

I built my view and projection matrices like this

Matrix44 view(right.x, right.y, right.z, -position.x,
              up.x, up.y, up.z, -position.y,
             -forward.x, forward.y, forward.z, -position.z,
              0.0f, 0.0f, 0.0f, 1.0f)

Matrix44 projection(Sx, 0.0f, 0.0f, 0.0f,
                    0.0f, Sy, 0.0f, 0.0f,
                    0.0f, 0.0f, Sz, Pz,
                    0.0f, 0.0f, -1.0f, 0.0f);

However, when using them in the vertex shader

gl_Position = projection * view * vec4(position, 1.0);

I cannot see my geometry unless I swap the transformation to

gl_Position = vec4(position, 1.0) * view * projection;

which means that I am using row-major order instead of column order. So my question is if the pdf I'm following is correct in the notation for the column-major order for view and projection matrices or what am I missing?

sentences:
Creating a hostile Mob So I'm currently developing a 2D top down view java game. I have a mob called "Mutant" that currently does nothing. It generates a random number and depending on that number moves a few pixels in that direction. I"m trying to figure out how to make the mutant follow the player's x & y coordinates when the player comes near.

Here is what my mutant does currently:

    int xa = 0;
    int ya = 0;
    move = generator.nextInt(50) + 1;

    if(move == (50))
        ya = (random.nextInt(3) - 1) * random.nextInt(2);
        if (!hasCollided(xa, ya))

    if(move == 40)
        ya = (random.nextInt(3) - 1) * random.nextInt(2);
        if (!hasCollided(xa, ya))

    if(move == 30)
        xa = (random.nextInt(3) - 1) * random.nextInt(2);
        if (!hasCollided(xa, ya))

    if(move == 20)
        xa = (random.nextInt(3) - 1) * random.nextInt(2);
        if (!hasCollided(xa, ya))

    if(xa != 0 || ya != 0) {
        move(xa, ya);
        isMoving = true;
    } else {
        isMoving = false;
    }

Does anyone know how to make the mob simulate hostility towards the player? I haven't implemented a health system yet, I've only worked on the mob's A.I.

sentences:
Simple javascript HTML5 canvas start menu I'm currently looking for a simple and basic start screen for a game using javascript, so basically its the first function that is called and then press play which then goes into the game.

Looked online and they all seem to be advanced ones and can't seem to find any tutorials either.

sentences: How to use Game Assets from Behance I need to use dinosaur/dragon eggs in my game. I have found out this resouce from Behance.net. I am not sure how to download these resources. Can anyone help me with it.

sentences:
How to have a point light with no falloff in Unity 3D? Does anyone know of a good strategy to make point lights with no falloff, eg. anything in the radius of the light will be 100% illumination while anything outside the radius will be 0% illumination.

I want to use this as a sort of 3D line of sight drawing. The line of sight is a big sphere originating from the character's head that I thought would be a clever idea to have that represented as a point light, however with the falloff it doesn't correctly show where the edge of the line of site is.

I've tried a few solutions, such as a custom falloff package (doesn't seem to have the options I want) and a few shaders, but I am terrible at shaders so it's difficult for me to debug. I'll post the shader here in case somebody can tell me if I'm being dumb, otherwise if someone can point me to a different solution that would be great. Thanks!

Here's a shader I tried, but it just turns everything invisible and it's not immediately obvious to me why:

Shader "Custom/No Falloff v2"
{
    Properties
    {
        _Color("Color", Color) = (1,1,1,1)
        _MainTex("Texture", 2D) = "white" {}
    }
        SubShader
    {
        Tags{ "Queue" = "Transparent" }

        Pass
    {
        Blend SrcAlpha OneMinusSrcAlpha

        Tags{ "LightMode" = "ForwardAdd" }
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"
        #include "Lighting.cginc"

        // compile shader into multiple variants, with and without shadows
        #pragma multi_compile_fwdadd_fullshadows
        // shadow helper functions and macros
        #include "AutoLight.cginc"

        sampler2D _MainTex;
    float4 _MainTex_ST;

    fixed4 _Color;

    struct v2f
    {
        float2 uv : TEXCOORD0;
        SHADOW_COORDS(1) // put shadows data into TEXCOORD1
            float4 pos : SV_POSITION;
    };

    v2f vert(appdata_base v)
    {
        v2f o;
        o.pos = UnityObjectToClipPos(v.vertex);
        o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
        TRANSFER_SHADOW(o)
            return o;
    }

    fixed4 frag(v2f i) : SV_Target
    {
        fixed4 col = tex2D(_MainTex, i.uv) * _Color;

    // compute shadow attenuation (1.0 = fully lit, 0.0 = fully shadowed)
    fixed shadow = SHADOW_ATTENUATION(i);

    if (shadow < 0.5)
    {
        return fixed4(0.0156862745, 0, 0.23529411764,1.0); //or any other color for shadow
    }

    return col;
    }
        ENDCG
    }

        // shadow casting support
        UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
    }
}

sentences:
NPC interaction depending on conditions stored in XML I am developing a RPG game for Android using LibGDX, at this moment the NPCs in the game have some moving AI (pathfinding), like random directions and stuff.
Now I am working on the dialogue system, for that I have the following:

DialogueManager class that just renders the current dialogue on the screen if any
A Dialogue class which consists of an ArrayList of Strings which are the lines of the dialogue
The NPC class holds a Dialogue object, so I can just add(text) to the dialogue.

The result of this is the following

The player is near a NPC and presses Action key
A window is opened showing the current line of the dialogue
When the players touches the screen, the line is replaced by the next one until there is no more lines left and the dialogue window closes and the player can move again
If the player talks to the same NPC, the same dialogue lines are presented

It works fine, but that is not what I really want. I need to make the dialogue to be different depending on some conditions the player has. My dialogues are stored in an XML file:

<npc>
    <name>Alice</name>
    <interaction>
        <dialogue>
            <line>Hello there!</line>
            <line>This is a simple dialogue</line>
        </dialogue>
    </interaction>
</npc>

But I want to have something like this (and I have it in the XML):

<npc>
    <name>Alice</name>
    <interaction>
        <dialogue condition="timesTalked" value="0">
            <line>Hello there!</line>
            <line>You are talking to me the first time!</line>
        </dialogue>
        <dialogue condition="timesTalked" value="1">
            <line>Hmmm...I remember you! Have we met before?</line>
        </dialogue>
        <dialogue condition="haveItem" value="Apple">
            <line>Is that an apple? Gimme!</line>
        </dialogue>
    </interaction>
</npc>

So for example "timesTalked" is a real variable name and "value" is the condition, so the first condition would say

if(timesTalked == 0)
   // do stuff

Now the problem, how can I implement that? I know how to parse the XML, but how can I make it so the conditions work? I don't want to have it all hardcoded in Java, also I dont want to use a scripting language, I think it is good to have XML because is lightweight and easy to use.
Thankyou!

sentences:
Texture becomes white box when drawing it? My problem is that when I try to render my sf::Sprite it only renders a white box in my window.

I did some reading on this and couldn't really find anything that helped.

Some said that it's because of  the sf::Texture variable being in a local scope but mine is in a .h file, which isn't a local scope (I think, at least...)

Someone also mentioned std::vectors somehow destroying the sf::Texture 's,
but my sf::Texture is not in a std::vector.

However my class which contains sf::Texture is a object inside a std::vector but I don't know if that matters or not.

In my Sprite.h I have defined my sf::Sprite, sf::Texture and sf::Image like this :

sf::Sprite sprite;
sf::Texture texture;
sf::Image image;

and I load an image in like this :

if (!image.loadFromFile(PATH))
    std::cout << "Could not load image file : " << PATH << std::endl;

texture.loadFromImage(image);
sprite.setTexture(texture);

I render the sf::Sprite like this :

    for (int i = 0; i < entities.size(); i++)
    {
        entities[i].Draw();
    }

Lastly, here's my std::vector of my "sprite objects".

std::vector<Sprite>entities;
entities.push_back(Sprite(&window, sf::Vector2f(100, 100), 0, "Res/Images/Face.bmp"));

The picture file is a .bmp file, and the path to the file is valid.

(I did check both google and this forum for posts like this but none of them helped me.)

sentences:
How can I make the code run only once when I release the key? Im making a game in LWJGL 2 and Slick2d. Im trying to add an item to my inventory by releasing a key (the inventory system works properly, the part where I have to see if the button was RELEASED is difficult). Right now when I do...

if (Keyboard.getEventKey() == Keyboard.KEY_L) {
    if(Keyboard.getEventKeyState() == false){
        Inventory.addItem(1);
    }
}

... In my update method, Instead of it only calling the 2nd if statement once, ( because you can only release a key once) It just keeps going because the getEventKeyState variable stays false, but if Ive already released it once it should switch back to the opposite. Although I can do it by making it add an item when i hold the key, I cant exactly make it add only the 1 item, it keeps adding items while I hold it.

public static void addItem(int id){
    for(InventorySlot s : inventoryslots){
        if(s.getItem() == -1){
            s.setItem(id);
            System.out.println("Added item " + id + "!");
            break;
        }
    }
}

Thats the addItem method, and if I would approach this by making it add the item while holding, I would have to make it so that it adds it only once. Any suggestions please? Thank you

sentences:
Render BitmapFont with size < 1 in Libgdx My ingame camera has units that 25 times less than screen units so when I render BitmapFont generated for camera which used in non-game screens (settings, level choose etc.) it's even doesn't fit in camera.

I came up with some solutions:

Generate font with right size, but No cap character found in font exception caught.
Scale font with font.getData().setScale(float scaleXY) but got this:
Increase camera units but I'll need to rewrite a lot of code depending on camera combined matrix.

Is there any easier way to do this?

sentences:
How much memory can i safely use on android? To make my game more fluid, I try to prevent memory allocations during the game I am writing.  To that end, I allocate a whopping 16MB of buffers on startup and then use those as I go along.  When I check in Eclipse my game now uses 24MB in total, which does not change noticeably during the game.

This all works fine on the phone I have now (android 2.3, motorola defy) but I wonder if I'm going to run into problems with this on other phones or tablets that run android 2.2 or higher (which is what I'm aiming for)?

sentences: What is Surface.set_colorkey() in Pygame? In pygame, what does Surface.set_colorkey() do? Explain it in a very easy way please. Also, what exactly does it do? I heard it makes parts that are the same color as the colorkey transparent, but what is the point of that?

sentences:
How do I hide an Input field? I have in my hierarchy tab a Canvas. Inside the canvas I have an Input Field that holds a placeholder and a text.

I read the documentations and didn't find how to hide the Input field.

I want that if a if statement is true, then it will show the input field. Else you won't see it.

How can I implement it?

EDIT

I thought about an idea to test: If I press the O key on the keyboard it disappears, and if I press again it appears; and so on.

This is what I tried:

bool shown = true;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    GameObject inputField = GameObject.Find("InputField");
    if (Input.GetKeyDown (KeyCode.O)) {
        shown = !shown;
        inputField.SetActive (shown);
    }
}

I play the scene and when I press the O key I get

NullReferenceException: Object reference not set to an instance of an object

If I double-click on the console message it highlights me the if (Input.GetKeyDown (KeyCode.O)) { line.

Something not good does the SetActive(bool) method, I suppose.

sentences:
Good baseline size for an A* Search grid? I'm working on a grid based game/prototype with a continuous open map, and are currently considering what size to make each segment. I've seen some articles mention different sizes, but most of them is really old, so I'm unsure how well they map to the various platforms and performance demands common today.

As for the project, it's a hybrid of 2D and 3D, but for path-finding purposes, the majority of searches would be approximately 2D. From a graphics perspective, the minimum segment size would be 64x64 in the XZ plane to minimize loaded segments while ensuring full screen coverage. I figure pathfinding would be an important indicator of maximum practical size.

Addendum:

I realize I was a bit unclear when talking about sizes and segments.

Each segment is a cubical map of blocks, e.g. 64x64x64 blocks. These represent both geometry, but also if an actor can move into that location and is thus a potential node in the graph.

Each of these segments again combine to a larger square or cubical world map. Neighboring segments are to be loaded dynamically to ensure a seamless local map.

Therefore how many blocks fit into the screen space when rendered, sets a practical minimum for the segments, but we would probably want to have larger segments than the absolute minimum. However, since a block also represents a potential node, the segment size also affects the size of the graph, which have to be considered when choosing a segment size.

sentences:
How to make UI Button to rotate an gameobject? I'm trying to make a button to make a gameobject rotate and stay rotating in its own axis (Y) but I cannot make it work...

As far as I know it's very simple:

Create an empty gameobject (or whatever you want)
Make a script and attach it to the gameobject
Create public methods
Link the gameobject with the script attached to the button onClick event
Click the button and test the script

My problem is that I don't know how I'm wrong here are the scripts of my project

This first script is my attempt using keys, and it works like charm

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TurntableRotation : MonoBehaviour
{
    public GameObject turntable;
    public float turnSpeed;
    public bool canRotate = false;

    void Start ()
    {
    }

    void Update ()
    {
        StartTurntableRotation();

        StopTurntableRotation();
    }

    public void StartTurntableRotation()
    {
        if (Input.GetKey(KeyCode.I))
            {
                canRotate = true;
            }

            if (canRotate)
            {
                turntable.transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime);
            }
    }

    public void StopTurntableRotation()
    {
        if (Input.GetKey(KeyCode.P))
        {
            canRotate = false;
        }

        if (!canRotate)
        {
            turntable.transform.Rotate(0,0,0);
        }
    }
}

This second script is my work in progress

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TurntableUIBtns : MonoBehaviour
{
    public GameObject turntable;
    public float turnSpeed;

        //This is my public method used by the button
    public void StartTurntableBtn()
    {

                //This is my attempt to write the code for the object to rotate
        turntable.transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime);
    }
}

As far as my knowledge goes, it is supposed to work, but I have to click every time to rotate my object, my goal is to click the button and make the object rotate and stay rotating

sentences:
matrix 4x4 position data I understand that a 4x4 matrix holds rotation and position data.

The rotation data is held in the 3x3 sub-matrix at the top left of the matrix.

The position data is held in the last column of the matrix.

e.g.

glm::vec3 vParentPos(
    mParent[3][0],
    mParent[3][1],
    mParent[3][2]
);

My question is - am I accessing the parent matrix correctly in the example above?  I know that opengl uses a different matrix ordering that directx, (row order instead of column order or something), so, should the mParent be accessed as follows instead?

glm::vec3 vParentPos(
    mParent[0][3],
    mParent[1][3],
    mParent[2][3]
);

thanks!

sentences:
Smoothly extend eased animation to new target value I am implementing animated double property from scratch, currently with SmoothStep easing, however when new target value is set, there is visible "jump" in animation speed (probably due to applied easing). I would like setTarget to smoothly extend currently ongoing animation.
I have tried to calculate originalValue_ and remaining_ based on current t (offsetting those correctly, I think, will solve the problem), but haven't managed to find the correct formula.
How do I smoothly extend ongoing smoothstep animation to new target value?

void setTargetValue(double value, double duration = 1.0)
{
   originalValue_ = currentValue();
   targetValue_ = value;
   remaining_ = duration;
   duration_ = duration;
   t = 0.0;
}

double currentValue() const {
   return SmoothStep(originalValue_, targetValue_, t); //x*x*(3 - 2*x)
}

void update(double deltaT) {
   remaining_ = fmax(0.0, remaining_ - deltaT);
   t = clamp(0.0, 1.0, 1.0 - remaining_ / duration_)
}

sentences: Detecting mouse click for the uppermost layered 2d sprite in Unity I have two sprites. One for the entire background and another small sprite, which is a foreground object. I have written code for both of these objects in their OnMouseDown() functions. When I click on the foreground object, theMouseDown()method of background object also gets called since it is behind the foreground.I just want my foreground sprite to react when I click it, not both foreground and background sprites.

sentences: WM_PAINT and Direct3D I've seen people who've written in code where the graphics of a scene are rendered in response to WM_PAINT. I only ever rendered the scene once all Windows messages were done translating, and then rendered the scene. Is this the wrong way to go about it, or should I only use DirectX rendering in response to WM_PAINT?

sentences:
How best to detect device performance capabilities and set quality setting accordingly when using Unity I am developing a Mobile game for Android and iOS on Unity.

Currently Im in the optimisation stage of development and trying to work out what is the best way to detect device capabilities, with the aim of then setting an appropriate quality setting.

OS/platform detection is simple, but how can I detect between a high performance android device and a low or medium performance device at runtime?

I did find this question that is similar https://stackoverflow.com/q/21565468/4148676 but the question is old, the answers not great and hoping there's a better way in the last 4 years of solving the problem.

The only other solution I have is monitor the average FPS and adjust the quality based on the frame rate.

Any advice would be appreciated.

sentences:
How can I make a peer-to-peer multiplayer game? How can I make a p2p multiplayer game?
I would like to have a server-less multiplayer game. But then, how all the clients know each other?

Why the p2p-protocol is so famous in file transfer but not in multiplayer games?

sentences:
How do I reuse the same vertex data, but with different colors, for my sphere objects? I'm using OpenGL to display a 3D network, with nodes represented as spheres (I haven't gotten to edges yet). I'm a total novice, and having a bit of trouble wrapping my head around OpenGL.

These networks need to be generated programmatically, so I've got a function that produces vertices for a sphere with radius 1 centred at the origin, and I'm translating and scaling it to produce each of the nodes in the network. I'm using glDrawElements() to draw my nodes, so I'm storing indices for the vertices of my sphere as well.

Once a network is produced, it doesn't change. The camera position can change, but nothing else will. My current strategy is the following:

When a network is generated, for each node, make a copy of the unit sphere, and apply the appropriate translation * scale matrix. Store all of the vertices (and associated colours) in a single array/VBO.
When drawing, set the scene-to-camera and perspective matrices to a uniform, then use a single glDrawElements() call to draw all my nodes.

So a couple of questions about this:

Since all my nodes are essentially identical, I could just store vertices for one sphere, and transform the sphere on the fly when I render the scene. There might be a lot of nodes, so this could save substantial memory. But each sphere has quite a different set of colours... is there a way to tell OpenGL to use an offset for the colour data but not the vertex data?
Assuming the answer to part 1 is no, would it be better to keep vertices for a single sphere in my VBO, and then substitute the colour data and draw each node with a separate call to glDrawElements()? Or is there some other solution that I'm not thinking of?

sentences:
How to implement a professional fighting game input buffer? Ok guys, I understand how to make a basic input buffer.

Here is my code:

public class InputBuffer : MonoBehaviour {

    public int max_buffer;
    public enum keys { down, up, left, right, X, Y, Z, A, B, C }
    public List<keys> InputPlayer;
    public enum Special { WPunch, MPunch, SPunch, WKick, MKick, SKick, Hadouken, Shoryuken }
    public List<Special> SpecialsPlayer;

    void Start () {
        InputPlayer = new List<keys>();
        SpecialsPlayer = new List<Special>();
    }

    void AddKey(keys key)
    {
        InputPlayer.Add(key);

        if (InputPlayer.Count > max_buffer)
        {
            InputPlayer.RemoveAt(0);
        }
    }

    void CheckSpecial()
    {
        if (InputPlayer[InputPlayer.Count-1] == keys.A)
        {
            if (InputPlayer[InputPlayer.Count-2] == keys.right)
            {
                if (InputPlayer[InputPlayer.Count-3] == keys.down)
                {
                    SpecialsPlayer.Add(Special.Hadouken);
                }
            }
        }
    }
}

This works really well, but then I get repeated keys in the buffer when I keep a key pressed.

I could fix it by having a last keypressed variable and then only calling the inputbuffer.getkey if the key pressed is diferent. But this makes the buffer to behave rather stiff.

I would love to see how can I improve my code so It doesn't recognizes multiples keys when a button is kept pressed, but also allow for charge moves (Guile's sonic boom).

I also would love to see how input shortcuts works (using a previous special command as part of a second one, usually used in cancels to supers).

I would love to see what's the proper way to handle input buffers in kof and SF.

sentences:
What is the mesh generation technique shown in Chrome Music Lab? The Google toy of the day, https://musiclab.chromeexperiments.com/Spectrogram, features a continuously scrolling 3D render of a shape with cross sections that seem to equal the spectrograph of sound at a single instant.

Assuming the frequency information is available as input, how does that information become a mesh that updates continuously?

sentences:
How to stop sprite when overlap on in libgdx? How can I stop my player if he overlap or touch the ball? In my top down game my player is cat and I want to stop  his moving or stack in that place of the ball is located if he hit the ball I'm using acceleromter to move the cat left and right.

Here is my code. How can I add collide method just like the image bellow? Thank's and advance!

// Load the sprite sheet as a texture
cat = new Texture(Gdx.files.internal("cat.png"));
catsprite = new Sprite(cat);
player = new Rectangle();
player.width = 20;
player.height = 80;
player.x = 300;
player.y = 0;

basketball = new Texture(Gdx.files.internal("ball.png"));
ball = new Circle();
ball.x = Gdx.graphics.getWidth() / 2;
ball.y = Gdx.graphics.getHeight() / 2;
ball.radius = basketball.getWidth() / 2;

In render method

camera.update();
TextureRegion currentFrame = walkAnimation.getKeyFrame(stateTime, true);
spriteBatch.draw(basketball, ball.x-ball.radius, ball.y-ball.radius);
spriteBatch.draw(currentFrame,player.x, player.y);// Draw current frame at (50, 50)

if(player.y < 0)
    player.y = 0;
if(player.y > 900 - 80)
    player.y = 700 - 80;

// check collision
if(Intersector.overlaps(ball, player)){
    tmp.set(player.x, player.y + player.height/2, player.width, player.height/2);

    if (Intersector.overlaps(ball, tmp)){
        //top half (or both top and bottom) hit
        Gdx.app.log("overlaps", "yes");
    } else {
        //bottom half hit
    }
}

//Mobile acceleration
if (Gdx.input.isPeripheralAvailable(Input.Peripheral.Accelerometer)) {
    player.x -= Gdx.input.getAccelerometerX();
    player.y += Gdx.input.getAccelerometerY();
}

if (player.y > Gdx.graphics.getHeight() - 100)
    player.y = Gdx.graphics.getHeight() - 100;

if (player.x < 0) {
    player.x = 0;
    player.x += Gdx.graphics.getDeltaTime() * catSpeed;
}

if (player.x > Gdx.graphics.getHeight() - 250) {
    player.x = Gdx.graphics.getHeight() - 250;
}

sentences:
Smooth rotation Unity3d I have an animation and I modified some rotations of some bones in the animation at a certain frame. What I want to do is how to make the animation in the next couple of frames interpolate smoothly so that the changes I made looks smooth?
Like for example, if I have an animation of a game object, and in frame number 100 it rotated 90 degree in the x-direction. So now frame 100 has a modified rotation angle of the object, but frame 101 has the original animation. I want to smooth the rotation so that the transition of the obect from the modified frame back to the original animation looks smooth.

sentences:
Unity 5 - Texture/Material rendering issue I am working on a Minesweeper clone that started as a Unity 4.6 project and ended up as a Unity 5 project. I have cube objects that use Legacy Shaders/Diffuse. I am new to Unity 5, so I am not fully aware of the changes to the shaders.

The following texture on cube objects does not render as it is (I think it used to).

I want the flag appear on the cube as it is. What causes this output and how do I fix it?

sentences:
Allow a game object to pass out of a collider but not back in - Unity In my game I have enemies that shoot projectiles out at the player, the only way for the player to get rid of them is by guiding them into a structure.

An example of my enemy shooting a projectile.

The problem I have is that sometimes the enemy spawns on top of one of these structures as seen below.

This results in the projectile exploding/colliding with the structure the moment it is spawned.

I'm not entirely sure how to go about fixing this issue.

I have tried to find a way to disable the collider on the projectile for a few seconds but I couldn't get the timer right. I also think this might cause some odd game-play issues.

The second thing I tried was a platform effector, however I could only get it to form a circle and this didn't work out because my structures are of all different sizes and shapes.

If anyone could point me into the right direction or even help me find a better solution I'd be extremely grateful.
Thanks

ublic class MultiBullet : MonoBehaviour {

    public float speed = 1f;

    private Rigidbody2D rb;

    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody2D>();

    }

    // Update is called once per frame
    void Update () {
        rb.velocity = transform.up * speed;
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        ////Add explosion Effect
        //if (collision.gameObject.tag == "Player")
        //{
        //    // Add game over screen here
        //    Debug.Log("Player Killed");
        //    Destroy(gameObject);
        //}
        ////Debug.Log("BOOM");
        ////Destroy(gameObject);
        if(collision.gameObject.tag != "BulletIgnore" && collision.gameObject.tag != "Cloud")
        {
            //Debug.Log("BOOM");
            Destroy(gameObject);
        }
    }
}

Just a simple class to handle when projectiles collide with objects.

sentences: How to pass rendered frames from OpenGL to DirectX 11? I have a dll that does some rendering using OpenGL.  I need to render it to a texture and use that texture in direct x 11.  My current attempt has been to render the OpenGL to a texture on one process, and then use Cuda to encode the texture to a h264 video stream, and then decode that stream on another process using cuda / directx 11.  However, I'm wondering if there is an easier way to get a portion of a scene rendered OpenGL to DirectX11.

sentences:
Good practices in screen states management? I wonder what are the best ways to organize different screens in a game?

I am thinking of it like this:

Inheriting a base State class, and overriding update and render methods, to handle the current screen.
Then, under certain events a StateManager is able to activate another Screen State, and the game screen changes as only the current State is rendered.

On the activation of a new screen, effects like fading could be added, and also the same goes for its deactivation. This way a flow of screen could be made. By saying when A ends, B starts, allowing for complex animations etc.

Toughts?

sentences:
What's a good way to programmatically manage a cloneable entity? Say you have missiles or rockets that a player can fire.

What's a good way to programmatically manage the cloning of a base rocket, for example?

I can think of 2 ways to do it:

Player has a currently selected weapon (which is an int)
When player shoots, the selectedWeapon member is looked at, and the correct instance of rocket is created (with some base parameters)

Or

Player has a currently selected weapon (which is a pointer, to a "base instance" of the rocket object)
When player shoots, the base instance rocket is cloned, transformed, and shot into the game world

sentences:
A good place to learn about Game Programming with Mathematical Vectors? I am looking for a place in the web where I can turn my current game development process into a vector based approach. I am sorry If this question has been asked once.

According to my google search analysis, few places I've found pretty interesting are Tony Pa's tutorials and Metanet. But, due to limited explanations, I found it little bit tough to implement. I could try out the same examples as provided there, but when I have to use it in my games, I am STUCK. I want to know about the dot products and cross product stuff, Its uses and detecting collisions and predicting collisions with these mathematical techniques.

Please, write down some links and a brief description of the link. Thank you

sentences:
Network limitation in multiplayer game I have a multiplayer cooperative game (PVE) in where there can be up to 200 enemies at a time (somewhere around that) and I was wondering how devs generally synchronize these? I already have packets being sent every 0.2 seconds or so to players telling other player's position, health points and things like that, and I have no idea how much of the network I can actually use (in a P2P UDP connection).

I really don't wanna leave the clients to sync the enemies positions themselves, as myself as a player have played games like these and its so annoying to have you shooting an enemy in one corner of the map and your friend shooting the same enemy on the other corner. But I have no idea if sending every 0.3 seconds or so updates from 200 enemies and their position is reasonable.

TL;DR: How would devs synchronize a high number of entities for multiple players and what is the limitation of a UDP connection? Is there a number of packets per second that you would work towards?

sentences:
Calculate vector in local space I have a vector (8,5). It's origin is at (10,9)

I can calculate a perpendicular like so:

MyPerpendicularVector.x = -MyVector.y
MyPerpendicularVector.y = MyVector.x

Given that I now know these two axis, how do I make these axis (made up of my new vectors) now my "local" axis? for example I want to plot a vector (2,3) on the "local" axis but I have no idea how to calculate it in relation to the "global" axis

Image of the problem here:

sentences:
How can I export a 3D model with keyframes to use in Blender? I'm currently trying to export some 3D data and load it into Blender, but I've encountered some problems at the time of processing the meshes. They all have keyframes (nothing too complex, just texture change and rotation) but I cannot use traditional Wavefront Obj to export it, because it does not support this data.

How can I export this keyframe information in a way Blender will understand?

sentences:
Unity: Can't press space to unpause. Is this a Unity UI bug? Or maybe poorly written code? So I think I have a bug with my pause menu. For the sake of simplicity I've boiled down what I'm trying to acheive: When the player first starts up the game there's a UI menu with one button: 'Start Game' that they have to press to start the game. They can then pause and bring up this menu again at any time by pressing space. The player can resume the game either by pressing 'Start Game' or by pressing space again.

The problem right now is that when the player presses space again to unpause, nothing happens - unless they click anywhere on the screen. It's sort of complicated to explain but I'll try my best.

Say the player previously started or unpaused the game by clicking the 'Start Game' button. If they pause the game again, they can only unpause the game by pressing space if they click somewhere on the screen. This works if the player clicks somewhere on the screen before or after they press pause.

However, If the player previously unpaused the game by pressing space, they can pause and unpause by pressing space indefinitely (until they unpause by pressing 'Start Game'). Is this a bug with the Unity UI system (I'm using Unity 5.0)? Or maybe with my code?

Here's my code:

public class GameController : MonoBehaviour
    {bool paused;
    public GameObject canvas; //in the editor I set this to reference the canvas that
                              //the 'Start Game' button is on

    void Awake()
        {PauseGame ();}

    void Update()
        {if (Input.GetKeyDown (KeyCode.Space))
            {PauseGame ();
            Debug.Log ("Pressed 'Space'");}
        }

    public void PauseGame()
        {paused = !paused;
        if (paused == true)
            {Time.timeScale = 0;
            canvas.SetActive (true);
            Debug.Log ("'Pause' Called");}

        else
            {Time.timeScale = 1;
            canvas.SetActive (false);
            Debug.Log ("'Unpause' Called");}
        }
    }

*The 'Start Game' button calls the PauseGame() method from the GameController script

Update

I wrote some debugging lines to figure out what was happening. Apparently, if the player previously unpauses by pressing 'Start Game' then pauses again, when they try to unpause by pressing space the game does indeed unpause but then immediately pauses again. However it only does this if the player previously unpaused by pressing 'Start Game' (and can be remedied by clicking somewhere on the screen before or after pausing). This doesn't happen if the player previously unpaused by pressing space.

Update

Apparently the 'Unpause' is being called by the event system, and the 'Pause' is being called by pressing space. I guess Unity has it built in that if a player previously clicked a UI button, pressing space will click that button again when the option is available. Does anyone know how to alter this?

sentences:
most efficient way to create a grid system in unity I'm creating a little tower defence game to get myself acquainted with unity.

At first I was going to emulate a grid system by capturing touches / mouse clicks and rounding the coordinates to the nearest whole numbers. This is very low cost and works well for placing things, however I'm a bit of an AI geek and I've decided to make a more tangible grid so that the agents can run searches on it for pathfinding.

For this I'll need a grid of nodes and for those nodes to have a bit of information attached. Would it be a much better idea to do this entirely in code? Or could I get away with placing actual cubes in a big grid on the map?

This would certainly be easy as then I could ray cast against them - but I've tried this and rendering that many cubes slows down the game a lot!

I suppose my question is - is it unnecessarily expensive to have a load of cubes set up like this, but not rendered? Or should the cost of having a load of cube shaped collision volumes be only marginally more expensive than emulating this in code? (if at all...)

Also as a side question - should I be able to render say, 200 cubes and have a smooth game? Am I missing some instancing options? I presumed things would be automatically instanced.

sentences:
Why does my shader's Texture become unselected when I run my game? I'd like to add a custom material to a line that I'm drawing in Unity (using Vectrosity).  I'm using Unity's built-in "Unlit/Texture" shader.  When I drag a texture from my Resources directory into the "Texture" slot in my shader, everything looks good:

But when I click play, the texture disappears:

and my line doesn't show up in my game.  However, if I drag the texture to the shader's texture slot after I click play, the texture seems to "stick" and my line renders as expected:

But once I stop and start the game, the texture again disappears.

Why is Unity kicking out my texture when my game starts?  Is there something wrong with my texture?  I don't see any warnings or errors in the console.  I've tried with numerous different textures, and they all do the same thing.

I'm using Unity 5.6.1f1.

sentences:
Animator Component gets removed automatically - Unity I am creating a simple scaling animation on image (in Unity). When I play game in unity editor, the animator component get removed automatically. Here I am copying snapshop of Inspector of Image.

What should I correct?

sentences:
Unity3d Sprite Mask Nonexistent in Build I am developing a 2D game which uses sprite masks to limit the player's information to a circle around them. The feature works perfectly in the Unity Editor. It can be disabled and reenabled, have the shape of the mask itself change, and more.

However, whenever I build the project and run the executible the screen is blank. If I disable the sprite masks altogether, the sprites are all visible. I have debugged Unity3d builds before, but that was specifically looking at variables as they changed during the execution of the program.

Does anyone have any specific knowledge related to sprite masks or have any idea why this would occur? I can provide more information if necessary. My current thought is that the sprite mask is masking everything for some reason. It's weird to me though that it would only break in the build.

All help is appreciated.

sentences:
No perfomance gain on LIBGDX GLES with sampler2D[] I'm trying to render 3 textures 400 times (first,second,third 400 times). I use vertex shader that takes attribute tex_id; - this is the id of texture to use. In fragment shader i have sampler2D textures[3]; and binding them via setUniformi("textures[0..3],0...3);
So i draw all textures in one draw call binding them once. In desktop i have really fast results, but on GLES there is no difference at all. Using 1 draw call with 1 tetures binding, or using 400 drawcalls with 400 textures bindings has same fps. Why? First i think about gles limitations of lower android versions, then try adroid 4.4+ with API18 glSurfaceView20, but nothing changes.

sentences:
Insert 3d text to the front face of a cube GameObject I want to add a text to a cube in Unity.

I have a cube which has a 3d text as a child.

I am using the below UnityScript to write on the 3d text:

var countdown : int = 200;

function Update()
{
    GetComponent(TextMesh).text = countdown.ToString();
}

I am trying to write/show the text to the front face(or very close) of the cube but I am failing.

EDIT: My difficulty is to make the text appear in the front side/face of the cube, like it is written on it. Attaching the text or the script to any object is not an issue

My last failed try was to use the below lines:

var tm = gameObject.AddComponent(TextMesh);
tm.text = countdown.ToString();

Any ideas?

sentences:
GL_TRIANGLE_ADJACENCY and glDrawElements So I've not been able to find much online about how data should be stored for triangle adjacency.

Currently I calculate my adjacent using half-edges (mention in an answer here).

But do I store this data in with my VBO? (Which means twice the vertex data)
Or do I store it in my element array buffer? And if so how do I tell opengl the interleaving I would have in it?

sentences: Xna: Splitting one large texture into an array of smaller textures I would like to split a large texture into a one dimensional array of smaller textures. How should I do this?

sentences:
How to force a custom component on every GameObject? I want to have a custom component which will have a drop down. I want this to be applied to ever GameObject in the project, which means every GameObject in the hierarchy and every GameObject prefab. Something like a transform component. It should not be removable, and it should be added by default when creating new GameObjects.

In the drop down, I will select a few options, and I want to store those values in an array on that custom forced component for that GameObject.

So if I have 2 new GameObjects in scene named XYZ and ABC, and the component is PQR, I should be able to do this-

ABC.GetComponent<PQR>().someArrayVar = whatever;
XYZ.GetComponent<PQR>().someArrayVar = anotherWhatever;

Anyone know how to do this? Any help appreciated. Thanks in advance :)

sentences:
How can I easily model semi-realistically human movement and collision in a 2D game? I am writing a sports simulation game in which the simulated players will interact physically with each other (i.e. tackle, push, bump...) as well as do individual actions such as changing direction of motion quickly in response to a changing game state.

At the moment all movement occurs with no inertia and infinite acceleration (so each step of the game loop the player can move at their top speed in whatever direction they want, regardless of their current motion). This has been sufficient to develop the main parts of the player AI, but it's time to get a little more realistic. The game has a cartoony look and feel so it doesn't need to be perfectly realistic, but player movement and interaction should give a semblance of reality.

So, how could human movement be summarized in a few key restrictions? I've toyed around with setting maximum acceleration and turning rates, as well as a momentum/inertia model for dealing with player collisions, but the game ends up looking like it's played by a bunch of bumper cars, rather than people (i.e. these restrictions and collision model describe cars on a slippery surface, not bipeds).

sentences:
Derive direction in which a spot light emites its light from a projection matrix First of all, sorry if my question sounds too basic or even makes no sense. I'm new with game development

I'm working with HPL1Engine, specifically, the lights parts. I need to know the direction in which a spot light emits its light. But the class that represents a spot light, doesn't have any direction vector.

So, I've been reading about lights in 3D engines, and I've detected in the class some other properties that I consider important. Like a projection matrix and angles (FOV and aspect). I'm trying to focus on the projection matrix (here, how the engine calculates it), but I'm not sure if I'm wasting my time.

Again, my goal is to know the direction in which a spot light emits its light (a vector), but I just have this matrix, and many other properties I don't relate with the spot direction calculation.

How could I know this direction from which I have (what the class provides me)?

Many thanks in advance.

sentences:
Plotting a pseudo 3D globe I would like to plot a small globe where the main character can walk, exactly like Sonic & Knukles Bonus Stage. For those who won't google it, here is a picture.
I am familiar with Raycasting, used in Wolfenstein and other games to "simulate" a 3D perspective in a 2D map.
But I could not figure how to program the globe thing, and I suppose that it was not a real 3D rendering, as Sonic was a 16 bit game.
Any idea on how to do it without any sofisticated 3D engine?

sentences:
How i can make better jump to my game? - C++ SFML So, I ask question about my 2D game, actually it is not game, but it is something like poor game. Well i made moving system and now is time to make jump. I made some kind of gravity with tutorial but I don't like it. It is simple and nice but there is problems in that gravity example: 1. You can hold up arrow and "fly" with jump. I tried to fix that and make some kind of limit to jump but it was bad try. Second problem is that when you jump and you release up arrow (jumping key) then my sprite fall very fast and I can't really control that sprite in air.

This is my first game and I want spend time to do that, but now i have problem that i can't solve with my self so if you can help, please do it. I use C++ with CodeBlocks and SFML multimedia library.

So there is little parts of my code.

First there is velocity and gravity configuration:

     //gravity & velocity
     const float gravity = 1;
     int ground = 600; //height of ground
     Vector2f velocity(Vector2f(0,0));
     float movingSpeed = 0.5f, jumpingSpeed = 2.0f;

Then there is simple when you press button you jump:

if(Keyboard::isKeyPressed(Keyboard::Up)){
            skeleton.move(0,velocity.y = -jumpingSpeed);
            source.y = Up;
            isWalking = true;
        }

And there is system what recognize if you jump and this make you fall:

if(skeleton.getPosition().y + skeleton.getScale().y < ground || velocity.y < 0){
             velocity.y += gravity;
        }else{
            skeleton.setPosition(skeleton.getPosition().x, ground - skeleton.getScale().y);
        }

So my sprite name is "skeleton". And yeah this is first time with game physics. I'm not very good game programmer so these code can be poor and yeah... if you invent a solution share it.

sentences:
Lag created when detecting collision I'm fairly new to gamedev and have encountered a problem with the collision detection system.

The collision is essentially worked out like this:

for (int x = 0; x < playerprojectiles.Count; x++)
        {

            for (int i = 0; i < enemyships.Count; i++)
            {
                Vector2 projectilepos = new Vector2(playerprojectiles[x].position.X, playerprojectiles[x].position.Y);
                Vector2 enemypos = new Vector2(enemyships[i].position.X, enemyships[i].position.Y);

                Console.WriteLine("I=" + i + "  ,  " + "x=" + x);
                if (Vector2.Distance(enemypos, projectilepos) < 20)
                {
                    playerprojectiles.RemoveAt(x);
                    x--;
                    break;
                }

            }

        }

I can see the problem; it is having to iterate through too many items. However, I can't think of a way to overcome this.

Any help? To specify, can someone direct me to a method that would allow me to detect collision without impeding performance so severely.

sentences:
Is it possible to connect an external source machine to Live Link? I would like to be able to connect multiple external machines to Unreal Engine via Live Link in order to stream solved motion capture from one of the Vicon run-time solvers/retargeter (i.e. Pegasus). In one of the streams, it was mentioned that Vicon provides a client-side plug-in for Unreal that was used in the Siren demo. I decided to test Live Link's capabilities by connecting from a different machine to UE4 from Maya (I assume that the concept is the same regardless of the source program because at the end of the day we are sending solved animation data, right?). It turned out that Live Link in Unreal out-of-the-box only detects the incoming data from the source machine that is on the same computer where Unreal is running. I am curious as to whether it is possible to modify Live Link or build a custom plug-in using Live Link that would enable me to connect from an external machine to the engine over the network.

The whole topic is very new to me, but I am tasked with providing a solution, so any information would be appreciated. Please correct me if I misunderstand the process. If you know where to look for more details regarding the problem, please tell me.

sentences: Drawing geometry to an SDL_Texture? As a direct result of this question that I asked a few days ago, I want to draw potentially-complex geometry to a SDL_Texture or, I suppose, an SDL_Surface. Ultimately, I want the foreground of a 2D platformer on this texture so that I cant draw a specific portion to the screen, as explained in the above link. Most of the geometry will be simple rectangles, but I would also like to draw slopes and possibly circles. Diving into OpenGL seems like a viable option at this point, but if I could avoid it, that would be grand.

sentences:
Shooting weapons Unity I'm trying to create a falling word game like z-type (code here). Once the game starts a few words are displayed on the screen. When the user types a letter and if that matches with the first letter of any of the words displayed, an "activeWord" tag is added to the word. I have also created a laser script that checks if the tag is active and when that happens, it shoots the laser. What's happening right now is that the laser is shot only once i.e when the first letter matches but doesn't shoot a laser when the remaining words are typed. Can someone please have a look at the code and tell me where I'm making a mistake.

this is the word display script where the active word is assigned:

public void RemoveLetter() // remove the first letter if its correct and so on for the remaining letters. change the color of the word to red and add the "activeddWord" tag.
 {
 text.text = text.text.Remove(0, 1);
 text.color = Color.red;
 text.gameObject.tag = "activeWord";
 }

public void RemoveWord()
{
    Destroy(gameObject); // removes the word from display
}

here is the input manager script:

public class WordInput : MonoBehaviour {

public WordManager wordManager;

void Update () {
    foreach (char letter in Input.inputString)
    {
        wordManager.TypeLetter(letter);
    }
}

EDIT

This is the player script where the laser is instantiated:

public class Player : MonoBehaviour {
public GameObject laserPrefab;
void Start () {
    transform.position = new Vector3(0.0f, -3.92f, 0); // player position
}

void Update () {
      Instantiate(laserPrefab, transform.position, Quaternion.identity);
        }
}

This is the updated laser script:

public class Laser : MonoBehaviour
{
public float speed = 10.0f;

private Vector3 laserTarget;

private void Start()
{

}

GameObject activeWord = GameObject.FindGameObjectWithTag("activeWord");

if (activeWord != null && activeWord.GetComponent<Text>().text.Length > 0){

  laserTarget = activeWord.transform.position; // find position of word
  transform.Translate(laserTarget * speed * Time.deltaTime);

  for (int i = 0; i < Input.inputString.Length; i++){

   Debug.Log("Character from input string: " + Input.inputString[i] + "\n" +
   "Character from word displayed: " + activeWord.GetComponent<Text>().text[0]);

   if (Input.inputString[i] == activeWord.GetComponent<Text>().text[0]){

     laserTarget = activeWord.transform.position; // find position of word
     transform.Translate(laserTarget * speed * Time.deltaTime); // shoot the laser
  }
 }
}

After I do this, there are two major errors that I get:

As soon as I hit play, the laser fires continuously without stopping.
The laser still shoots only once after the word is typed...This is the message I get in the console (screenshot attached). There is a difference of one word between the input string and whats displayed on the screen...Can someone please tell me how to rectify these.....

sentences:
Möller-Trumbore false positive result in specific point I copied code from this whitepaper and i can't figure out while it gives me false-positive intersections.

Here's problematic values:

Triangle points: (100.0, 100.0, 100.0), (-100.0, 100.0, 100.0), (-100.0, 100.0, 50.0);

Ray origin point: (0.0, 98.0, 50.0);

Ray direction point: (-100.0, 5.88235, 73.5294).

This points gives me an intersection when it shouldn't.

Here's my implemetation:

#include <iostream>
#define EPSILON 0.000001
#define CROSS(dest, v1, v2) \
    dest[0] = v1[1] * v2[2] - v1[2] * v2[1]; \
    dest[1] = v1[2] * v2[0] - v1[0] * v2[2]; \
    dest[2] = v1[0] * v2[1] - v1[1] * v2[0];

#define DOT(v1, v2) (v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2])
#define SUB(dest, v1, v2) \
     dest[0] = v1[0] - v2[0]; \
     dest[1] = v1[1] - v2[1]; \
     dest[2] = v1[2] - v2[2];

int intersect_triangle(double orig[3], double dir[3],
                    double vert0[3], double vert1[3], double vert2[3],
                    double *t, double *u, double *v) {
    double edge1[3], edge2[3], tvec[3], pvec[3], qvec[3];
    double det, inv_det;

    // find vectors for two edges sharing vert
    SUB(edge1, vert1, vert0);
    SUB(edge2, vert2, vert0);

    // begin calculating determinant - also used to calculate U parameter
    CROSS(pvec, dir, edge2);

    // if determinant is near zero, ray lies in plane of triangle
    det = DOT(edge1, pvec);

    if (det > -EPSILON && det < EPSILON)
        return 0;
    inv_det = 1.0 / det;

    // calculate distance from vert to ray origin
    SUB(tvec, orig, vert0);

    // calculate U parameter and test bounds
    *u = DOT(tvec, pvec) * inv_det;
    if (*u < 0.0 || *u > 1.0)
        return 0;
    //prepare to test V parameter
    CROSS(qvec, tvec, edge1);
    //calculate V parameter and test bounds
    *v = DOT(dir, qvec) * inv_det;
    if (*v < 0.0 || *u + *v > 1.0)
        return 0;
    // calculate t, ray intersects triangle
    *t = DOT(edge2, qvec) * inv_det;

    return 1;
}

int main() {
    double orig[] = {0.0, 98.0, 50.0};
    double dir[] = {-100, 5.88235, 73.5294};

    double vert0[] = {100.0, 100.0, 100.0};
    double vert1[] = {-100.0, 100.0, 100.0};
    double vert2[] = {-100.0, 100.0, 50.0};
    double* u;
    double* v;
    double* t;

    if(intersect_triangle(orig, dir, vert0, vert1, vert2, u, v, t))
    {
        std::cout << "Intersect" << std::endl;
    }
    else
    {
        std::cout << "Doesn't intersect" << std::endl;
    }
    return 0;
}

Another implementation of this algorithm tells me that intersection is in (-34, 100, 75).

sentences:
Draw multiple triangle strips in one draw call DirectX I'm running into a bottleneck where I'm drawing many basic disconnected colored triangle strips in DirectX 9 (XNA). The problem comes with drawing them all in seperate draw calls, so I'd like to batch them all together into a single buffer and draw them in one draw call.

I understand that in DirectX10 and above, there's a way to draw many triangle strips in the same draw call by inserting a special "cut" index (-1) into the index buffer after every line strip.

Is there a way to do this without the use of the cut index? (Which as far as I know, isn't present in directx 9?)

sentences:
Projecting Coordinates from one Space into another, but with "twisting" i'm trying to generate a decal mesh kinda like this: http://blog.wolfire.com/2009/06/how-to-project-decals/

but instead of projecting the decal with a box, i need to project it with a sort of triangular space. the "decal space" will have a start triangle and an end triangle. the end triangle isn't necessarily the same size as the start triangle and it isn't necessarily parallel to it and it can be rotated.

i need to be able to transform coordinates into that space and back out. how can i do that? can you do that with a normal 4x4 matrix?

sentences:
Open website URL from image marker using ARCore in Unity How can I open a website URL from an image marker using ARCore in Unity?
I am trying to build an AR app using ARCore in Unity. I have ten images and ten url links to websites, I need to link the ten images with those ten url links. When I scan the image with the phone's camera, I want the URL to open directly.
I've done image tracking with video before, but now I want to do image tracking linking to a URL.

sentences:
Path finding between multiple maps I'm interested in path finding between multiple maps - could be indoor/outdoor maps, different levels in a building etc but the main restraint is that there are one (or more) ingress/egress points between the different maps.  I've looked and couldn't find any good solutions, yet I'm aware of several games which use similar systems.

I've found this paper - Hierarchical Shortest Path Finding Applied to Route-Planning for Wheelchair Users which seems to address a similar issue, but it is purely theoretical.

Anyone done similar with some experience they could share, or some tips?

sentences: Versions of GL and its device that don't display or required powers of 2 for the sprites From this question aside from identifying possibilities of displaying images that don't needed to require powers of 2, what are the versions of GL that can actually display images even if don't needed the power of 2 size?

sentences: What Javascript game engines are out there, other than Impact? Does anybody know of a decent (meaning preferably free ;)) alternative to Impact? Any suggestions are very much appreciated!

sentences:
should my static class be derived from UnityEngine.MonoBehaviour instead? I am working on creating an object to maintain state of the game, player data, etc.  It is static (singleton lifecyle) through the life of my game.

I started down the path of a static class, with a static instance, like this:

public class PlayerState
{
    private static PlayerState DATA_INSTANCE = new PlayerState();
    public static PlayerState Instance
    {
        get { return DATA_INSTANCE;  }
    }
}

Then I started looking around and I see implementations that derive from UnityEngine.MonoBehaviour and implement the instance handling differently, adding the script to a game object and using DontDestroyOnLoad() to ensure it stays in memory.

So I am wondering: what is the correct idiomatic pattern in unity for a singleton type?

Do I really need all of the unity functionality of a UnityEngine.MonoBehaviour derived type (eg: Update()) for my static type?

I admit I am uneasy about static classes, in general.  In this case, I am equally uneasy adding another type that potentially gets in the frame cycle when its not needed (I mean that unity will call the methods like  Update() for every cycle).

Thnx
Matt

sentences:
What are the pros and cons of non-unique display names? I know of at least big title game (Starcraft II) that doesn't require unique display names, so it would seem like it can work in at least some circumstance.

Under what situations does allowing non-unique display names work well?  When does it not work well?

Does it come down to whether or not impersonation of someone else is a problem?

The reasons I believe it works for Starcraft II is that there isn't any kind of in-game trading of virtual goods and other than "for kicks" there isn't much incentive to impersonate someone else in the game.  There's also ladder rankings so even trying to impersonate a pro is easily detectable unless you're on a similar skill level.

What are some other cases where it makes sense to specifically allow or disallow duplicate display names?

sentences: Is it possible to have a point light cast shadows but no reflection? I'm working in Unity 5.3.6.  I have a point light that is simulating sunlight from a window.  It looks great, except the floor reflects a bright white circle.  I want the floor to reflect other lights in the room, just not this one.  Is this possible?

sentences:
Testing a Client's Camera in a Multiplayer FPS I'm attempting to do a logic test regarding a client's camera in a multiplayer FPS in Unity and I'm a little uncertain of which way to implement the functionality.

The scenario:
 - I have a host and a client playing together.
 - I want to be able to tell if specific objects are visible from each player's camera, even on the edges of their screens.

For a local player this is simple, I just take the local camera reference, convert the target object's position to that camera's viewport space to see if it's within the bounds of the camera, and then raycast to test for blocking objects.

In a Host-Client setup, I've been attempting to ensure I do everything on the Host's machine, but the Client's camera does not exist in that context, only a third-person remote-player.

Possible solutions:

I could pass the object's position to the client, convert it to the client's viewport space on their machine, then send that converted position back to the Host every frame, but this seems like a lot of network traffic for this. Furthermore it would use a stale client's camera position on the Host's up-to-date object position.
Or I could do the full logic test on the client machine and only tell the host the result (e.g., success/fail). But from my understanding this is an ill-advised practice given how authority should be handled in a Host-Client setup...
Or I could keep a camera object on the remote-player and synchronise that with the client's camera position and then do the test solely on the Host's machine involving that synced camera and objects.

I'm not sure which approach to pursue and would appreciate any input!

sentences:
Map color collision problem Hello i'm doing a game in WPF, 2D version (top view)

I have the map and i'm trying to check for color collision in pixel each time the timer is activated

Well...with 1 object it works fine but with more objects at same time it just slow down the process

This is my code every time the dispatchertimer activates and i loop to check for collision on every object

CroppedBitmap cb = new CroppedBitmap(source, new Int32Rect(x, y, 1, 1));
int px = 1 * (source.Format.BitsPerPixel / 8);
byte[] pixels = new byte[px * 1];
cb.CopyPixels(pixels, px, 0);
Color c = Color.FromArgb(pixels[3], pixels[2], pixels[1], pixels[0]);
if (c.R == 255 && c.B == 255 && c.G == 255) {
   pixels = null;
   return true;
}

Any help to simplify the process? I really want to do it in WPF

PS: The map is 1018x731

sentences:
Minecraft Forge setTextureName method not working I am attempting to make an item using the latest version of Forge. For some reason, the setTextureName method gives me an error that says:

  The method setTextureName(String) is undefined for the type ItemKey

I have been trying to fix this for a while, and notice that when I remove the quotation marks from the colon the error for setTextureName disappears, but I get an error on the colon that says:

  Syntax error on token ":", delete this token

an error on the + sign that says

  The operator + is undefined for the argument type(s) String

and finally an error on "key" that says

  The method setTextureName(String) is undefined for the type ItemKey

This is my first time trying to make an item, so help would be greatly appreciated.

EDIT: I just figured out that if I change MODID to modid in the setTextureName method I stop getting an error message for setTextureName but instead get an error for modid saying that

  modid cannot be resolved or is not a field

package com.arti.artismod;

import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;

public class ItemKey extends Item {
    private String name = "key";
    public ItemKey() {
        setUnlocalizedName(ArtisMod.MODID + "_" + "key");
        setTextureName(ArtisMod.MODID + ":" + "key");
        setCreativeTab(CreativeTabs.tabMisc);
    }
}

sentences:
How to get a 2D vectorial terrain from an image for Java collision detection? I'm trying to make a 2D Java-only game with a terrain like the one shown below. In the previous games I made, I used tile based collsions, but now, I want to use vector based collsions, as an uneven terrain would require minuscule tiles.

What I'd like to know, is how I can get the vectors from the map above, and how I should use them.

For the first part, I could manually measure out each of the coordinates, as shown below, but especially for lager and more detailed maps, that would be a tremendous amount of work.

I was wondering if there is a way to do this easier. I've seen tools that let you draw the vectors over the image, but those export only to engines like Box2D and Unity, which are programmed in different code languages. As I stated before, I only want to use Java.

For the second part, if I have the coordinates of the vectors, what should I do with them? I previously used rectangles, but now I would need to use either lines or polygons that connect each coordinate.

Also, how do I check for collisions between the player's polygon or rectangle, and the polygons or lines that form the terrain? When using rectangles, I could use playerR.Intersects(terrainR), but how can I do this with a terrain?

A link to an easy-to-understand tutorial would be a nice answer too, especially for the last part of my question.

Thanks in advance.

sentences:
Unity cloud build speedtree textures incorrect type after build So I finally (after a few days) got unity cloud build to work.

When I build it using the unity editor everything is fine. However, when the cloud build service builds it I get some odd textures for my grass and trees:

Is there anything specifically I have to do to make sure this doesn't happen.

I don't know if it matters but I am using unity 2019.1 with HDRP.

sentences:
Building 2D Assets for a Game Targeting Multiple Framerates To make a real-world example, lets assume I want to build an animated sprite for an explosion. The duration of the animation should last ~1 second, and we'll say exactly one second to make the math a bit more simple. And lets assume I'm using XNA and my goal is to target both XBox (60fps), PC (60fps), and Windows Phone 7 (30fps).

My question is this, how should I build the sprite animations so that my programming is as simple as possible without simply using a timer to calculate which frame I should be on (which I feel would make the animation "choppy")?

sentences:
How to rotate two scaled objects I have two objects. The head and tail of a future "grapple". The head and tail always point in the same direction. However, when I tried using scaled rectangles (that were bigger/smaller than the source rectangles) the rotations no longer worked, as in, the drawn head was no longer "attached" to the tail. (Without scaling them, this worked fine.)

The red sprites are without any rotation (Code below). The others are rotated about their respective "lower" origins (bottom center) (Rotation = 0)

So, the non-red sprites should be touching head to tail (the same way the red sprites are).

I have been fiddling with the code for a while... here is what I think you will need to see to help:

Initialization()
{
    Rectangle headSize = new Rectangle(0,0, 29, 100);
        Rectangle linkSize = new Rectangle(0,0, 29, 67);
        Rectangle tailSize = new Rectangle(0,0, 29, 53);

        Rectangle headSource = new Rectangle(0, 0, 29, 53);
        Rectangle linkSource = new Rectangle(0, 53, 29, 67);
        Rectangle tailSource = new Rectangle(0, 120, 29, 53);

        this.headSize = headSize;
        this.linkSize = linkSize;
        this.tailSize = tailSize;

        headSource = headsource;
        linkSource = linksource;
        tailSource = tailsource;

        chainHandle = new Link(new Rectangle((int)position.X,
                (int)position.Y,
                tailSize.Width,
                tailSize.Height),
                tailSource,
                0);

        chainHead = new Link(new Rectangle((int)position.X + tailSize.Width / 2 - headSize.Width / 2,
            (int)position.Y - headSize.Height,
            headSize.Width,
            headSize.Height),
            headSource,
            0);

}

    public Link(Rectangle rectangle, Rectangle sourceRect, float rotation)
    {
        TruePosition.X = rectangle.X;
        TruePosition.Y = rectangle.Y;

        Position = TruePosition;
        Rotation = rotation;

        scaledUpperOrigin = new Vector2(rectangle.Width / 2, 0);
        scaledLowerOrigin = new Vector2(rectangle.Width / 2, rectangle.Height);
        scaledCenterOrigin = new Vector2(rectangle.Width / 2, rectangle.Height / 2);

        upperOrigin = new Vector2(sourceRect.Width / 2, 0);
        lowerOrigin = new Vector2(sourceRect.Width / 2, sourceRect.Height);
        centerOrigin = new Vector2(sourceRect.Width / 2, sourceRect.Height / 2);

        dims = new Vector2(rectangle.Width, rectangle.Height);
    }

    public void Draw(SpriteBatch sb)
    {
        //debug purposes
        sb.Draw(chainAtlas, chainHead.GetRect(), headSource, Color.Red);
        sb.Draw(chainAtlas, chainHandle.GetRect(), tailSource, Color.Red);

        sb.Draw(
            chainAtlas,
            chainHead.GetRect(),
            headSource,
            Color.White,
            MathHelper.ToRadians(chainHead.Rotation),
            chainHandle.scaledLowerOrigin,
            SpriteEffects.None, 1);

        sb.Draw(
    chainAtlas,
        chainHandle.GetRect(),
            tailSource,
            Color.White,
            MathHelper.ToRadians(chainHandle.Rotation),
            chainHandle.scaledLowerOrigin,
            SpriteEffects.None,
            1);
}

Any ideas on how to fix this? I have tried using both original sized origins and scaled origins to no avail, as well as different points of origins.

If you have read this far, thank you for your time! Let me know if you see a fix.

sentences:
How to duplicate Blender glow and reflection effects in Unity? I am trying to make my game more interesting by making a background with this NEON tunnel made of glowing lines.

Since I am not a good 3D artist, I choose to hire some freelancers, and they made a model that looks great in Blender. I have all that I need...but when I import my object into Unity, it does not have any effects, any colors, any glow or any "mirror" reflection.

The biggest problem is that I cannot find any other freelancer who actually knows how to fix this problem.

This is how it shows up in Blender when my freelancers made it, and it looks perfect:

I want to have the same effects, same look, same colors, same glow in my Unity project, but I don't know how to actually import this object and reproduce that same look.

This is all zip folder which contain pictures, object in blender file, same object in .fbx,.obj.mtl and in many more formats.. but seems like any of those models doesn't work in Unity because I bet Unity needs more modifications...

I hope someone will help me step by step to achieve my goal.

sentences:
C# XNA - Sky Sphere Question I have been banging my head against the wall trying to get a sky sphere to work appropriately in XNA 4.0. I have the sphere loading correctly, and even textured, but i would like something a little more dynamic that can support a day/night cycle.

My issue is that, while i know a good amount of C# and XNA, i know next to nothing about HLSL. (I could make an ambient light shader if my life depended on it...) I also have not been able to find a tutorial on how to build a sky sphere like this. Of course i don't expect to be able to make an amazing one right off the bat, i would like to start small, with a dynamic coloring sky i'll work out the clouds and sun later.

My first question:
Does anyone know of any good tutorial sites that could help me get a decent grasp around HLSL?

Second:
Does anyone have a good example of or know where to find one of a gradient sky using XNA and C#?

sentences:
script execution order on changing scene In script execution order , i set A start first before B , and B start first before C .

So normally the script execution order should be A -> B -> C

C is already loaded on scene 1 without the help of other script .

B will be added by C on scene 1 and A will be added by B on scene 2 , and C will be added again by A on scene 2.

The gameobject in which B is attached won't be destroyed when changing scene , or in simple term , DontDestroyOnLoad() .

When Scene 1 loaded , C will load B , B will request scene change , which mean C will be destroyed afterward .After scene change , B will load A , then A will load C . B will request Application.Quit after 50 frame since it's loaded.

So if player start from scene 1 , is the script execution order has changed ? and how is script execution order from start until Application.Quit ? Please explain with details this problem almost made me lose my brian clels .

sentences:
How should I change the script so I will be able to change the transform height while the game is running and the transform is following? using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class Follow : MonoBehaviour
{
    public Transform targetToFollow;
    public Transform missionTarget;
    public Text textDistance;
    public Text textSpeed;
    public float lookAtRotationSpeed;
    public float moveSpeed;
    public float followRadius = 1.5f;
    public float fastRadius = 5f;
    public float speedBoost = 0.5f;

    void Start()
    {

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        Vector3 lTargetDir = targetToFollow.position - transform.position;
        lTargetDir.y = 0.0f;
        transform.rotation = Quaternion.RotateTowards(transform.rotation,
            Quaternion.LookRotation(lTargetDir), Time.time * lookAtRotationSpeed);

        float ms = moveSpeed;
        var distance = Vector3.Distance(transform.position, targetToFollow.position);
        // Compute a position no further than followRadius away from our target.
        Vector3 fromTarget = Vector3.ClampMagnitude(-lTargetDir.normalized, followRadius);
        Vector3 stopPoint = targetToFollow.position + fromTarget;

        // Compute a speed that's faster when far away and slower when close.
        float speedBlend = Mathf.Clamp01((distance - followRadius) / (fastRadius - followRadius));

        ms = moveSpeed + speedBlend * speedBoost;

        // Move as far as we can at our speed ms to reach the stopPoint, without overshooting.
        transform.position = Vector3.MoveTowards(transform.position, stopPoint, Time.deltaTime * ms);
    }

    private void Mission()
    {

    }
}

I mean the transform of the gameObject the script is on.
I want to keep the y position up all the way or at least make it finish moving on the ground or above the ground depending on my settings.
Now the transform the script is attached to the name is NAVI.
NAVI is by default position Y set to 5.94 :

Then the game start NAVI is moving to the target the kid_from_space in this case.
Kid_from_space position is at 0,0,0 when the NAVI getting close to the target NAVI position Y is 0 and the result is :

Therefore the NAVI is not on the ground and I also can't change it's Y position up or down. The NAVI is stuck at the Y 0 position. I want to be able to change the Y position up/down, for example if before the game is running I'm setting the Y position of NAVI to 5.94 or 6 or 21 I want the NAVI to stay at this position on the Y and not move down to 0.

sentences:
Unity: Can we not change Animator State inside Update? void Update () {

        if (goright == true) {
            rig.velocity = new Vector2 (m.movespeed, rig.velocity.y);
            m.anim.SetInteger ("State", 1);
        }

        if (goleft == true) {
            rig.velocity = new Vector2 (-m.movespeed, rig.velocity.y);
            m.anim.SetInteger ("State", 1);
        }
    }

    public void ondownMoveLeft(){

        goleft = true;
    }

    public void ondownMoveRight(){

        goright = true;
    }

    public void onupMoveLeft(){

        m.anim.SetInteger ("State", 0);
        goleft = false;
    }

    public void onupMoveRight(){

        m.anim.SetInteger ("State", 0);
        goright = false;
    }

i am using this code to move my character using UI buttons with the help of Event Triggers. i set it to change the animation from idle to running or from State 0 to 1 when the player moves and it does works that way but the problem is once it goes into State 1 it never comes back to State 0 but it should since i am setting the State back to 0 when the OnPointerUp trigger gets activated. am i missing something?

OnPointerDown is calling its respective ondown method and OnPointerUp is calling its respective onup method. for eg, when you press the left button it calls OnPointerDown which is set to call the method ondownMoveLeft.

i also checked with Debug.Log and everything is being executed but still the animation State is not changing.

sentences:
How do I alert enemies to my presence when I make a sound? I am working on a raycast-based 3D game, using Lua with Löve2D, and I am now currently working on the AI for the enemy. I want to make it like how "DOOM" did it, but I don't know how to handle how and when an enemy can hear your gunshot so they can "wake up" and become alert.

The map format is a simple grid, where 1 represents solid, and 0 represents open area. How did "Wolfenstein" and "DOOM" do it?

sentences:
Glitch-free cross-fades in HTML5 In my HTML5 canvas game, I need to cross-fade two sprites which have some glow around them. (Glow is backed into sprites.)
Initially, the first sprite is visible. During the cross-fade the first sprite should vanish, and be replaced with the second one. How exactly the cross-fade is done — does not matter, as long as it is smooth and there are no visual glitches.
I've tried two techniques:

During the cross-fade I simultaneously interpolate alpha of the first sprite from 1.0 to 0.0, and alpha of the second sprite — from 0.0 to 1.0.
With this technique I can see background in the middle of the cross-fade. That's because both sprites are semi-transparent most of the time.

During the cross-fade I first interpolate alpha of the second sprite from 0.0 to 1.0 (first sprite alpha is at 1.0), and then interpolate alpha of the first sprite from 1.0 to 0.0.
With this technique background is not seen, but the glow around sprites flashes during the cross-fide — when both sprites are near the full visibility.

In non-HTML5 game I'd use shaders to do cross-fade separately in RGB and alpha channels. Is there a trick to do the cross-fade I need in HTML5 without visual glitches?

sentences:
Why does my SDL code crash when I move the mouse over the window? Whenever I move my mouse below where the image renders in my game, the SDL window crashes and closes down.

I have narrowed the crash down to the bit of code where I check to see if the Escape key was pressed and quit my game; the relevant part of my event loop is:

while (SDL_PollEvent(&e))
{
  if (e.type == SDL_QUIT)
  {
    quit = true;
  }
  if (e.key.keysym.sym == SDLK_ESCAPE)
  {
    quit = true;
  }
}

I found that if I remove the if(e.key.keysym.sym... check, the crashing stops. What is wrong with my code?

sentences:
How can I make a shader effect that looks like a lightly shaded pencil drawing? I want to make a shader effect using OpenGL ES 2.0 that looks like this image:

I'm not sure if this image was painted or is the result of some filter, but I want to create a shader that produces images looking similar.
I want to know a Shader algoritm to produce this kind of output!

sentences:
Get current window position with Monogame I'm looking for some help figuring out the current position of the Monogame windowed form.  My ultimate goal is to figure out when the user is clicking inside of the game window and where they're clicking.
Getting the mouse position is easy:

var mouseState = OpenTK.Input.Mouse.GetState();
var mousePosition = new Point(mouseState.X, mouseState.Y);

That returns a Point relative to the computer's display.  I'm running my app as a windowed form, so I need to compute the mouse position inside of the window based off the forms current location on the monitor.
And in reading up on the subject, it looks like this should give me the point data I need:

System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(this.Window.Handle);
var formPosition = new Point(form.Location.X, form.Location.Y);

Trouble is, that the object form is always coming back as a null object.  this.Window.Handle will return a valid (System.IntPtr) handle ID, but the form object is never created.

While I'm stopped at a break point, I can see the data I need inside the this.Window located at  ((OpenTK.NativeWindow)(((Microsoft.Xna.Framework.OpenTKGameWindow)(this.Window)).window)).Location - but that location is a non-public location so I can't get it out of there.

Any suggestions?

sentences:
OpenGL ES 2.0: Picking Individual Polygon Sprites from within VBO Say, I send 10 polygon pairs (one polygon pair == one 2d sprite == one rectangle == two triangles) into OpenGL ES 2.0 VBO. The 10 polygon pairs represent one animated 2D object consisting of 10 frames.

The 10 frames, of course, can not be rendered all at the same time, but will be rendered in particular order to make up smooth animation.

Would you have an advice, how to pick up proper polygon pair for rendering (4 vertices) inside Vertex Shader from the VBO?  Creating separate VBO for each frame would end up with thousands of VBOs, which is not the right way of doing it.

I use OpenGL ES 2.0, and VBOs for both Vertices and Indices.

sentences:
How to check version of Unity package in project through script I'm writing an asset that will be used by many people, but it depends on TextMeshPro (TMP). I ran into a bug in TMP that can only be fixed by upgrading to a preview version. I want to warn users that install my asset that they need to upgrade their TMP version if they are using a prior version. Surprisingly, I can't find this anywhere online or in the docs.

just something like

if (TextMeshPro.version < MyAsset.RequiredTMPVersion) {
    Debug.LogError("Need to upgrade TMP");
}

sentences:
Storing Prefab properties in a scene and applying them to prefab instantiated via Addressables I am working on a small script to replace Prefabs in a scene with Addressable versions of the same prefab. This is working so far by creating a second scene with the Prefabs stripped out an a small loader object in their place. When the 2nd scene run the addressables are instantiated and everything is fine.
However, this only works for the absolute base simple case of no changes to the default prefab properties. What I am trying to solve now is storing the current settings of the prefab along with it's addressable reference so that they can be reapplied when it is instantiated.
So far I have looked at PropertyModification to get a list of all the properties and their values, but as this is an Editor only structure it is no good for the instantiation of the objects at runtime. I was thinking I could store the property names and values, but cannot find anyway to then reapply those values back to the newly instantiated object.
Is there any way I can apply (ideally wholesale without the need of custom instantiation scripts) the stored properties to a prefab ?
Thanks in advance.

sentences: How to load up many images without using too much memory When writing games, I am aware that images take up a lot of space. If one has a large graphical game, they don't want problems with memory, or to give players the message "Go buy a better computer to run this game". However, loading up images everytime one needs an image and discarding it is very slow. So if a programmer has a large graphical game, how can they draw many images without sacrificing performance/memory?

sentences:
Fixing rootmotion by calculating a lerp force I have a json full of rotation and forward + right force for rootmotion. The problem is the end position in the animations don't end on a straight line. You can see where I end up and what my desired position is. The problem is I can only add or subtract from the forward and right movement force. And the rotation of the character changes each frame. So I have to find a way to calculated a forward&right force for current rotation to slowly lerp to the desired position while using the rootmotion data.
I am working on unity

sentences:
How to use mipmap in OpenGL-ES I have recently entered in the OpenGL world. I am very pleased with the performance that I got with opengl compared to those obtained with a SurfaceView and its canvas. At the same time because of the limitation of the images to be in power of two I noticed that the quality of the sprite of my game is a little decreased. I read that we can use mipmap in Android but I have not found a real tutotial.

Are they compatible with Android 2.2+ ?

Which program creates mipmaps?

How do you actually use in code?

sentences:
Automated Unity iOS command line build on Mac I am doing the iOS builds for a group of Unity (Unity3d) game developers.

After pulling the latest git updates, I start up the Unity editor on my Mac and choose "Build Settings", select the iOS target platform, press Build, specify a destination folder and that is it.

Can this exact process be done automatically via the terminal prompt?

sentences:
Program compiled with assimp will not start I have recently updated my game engine source code to use the visual studio(2017) vc141 toolkit.

I am using Assimp 3.1.1 for model loading. The project compiles and links, and the appropriate dll's are in the debug folder for the solution.

To begin with I was getting a missing dll error "assimp-vc140-mt.dll", which disappeared, when I redownloaded the library, and replaced the dlls/libs/includes, in my solution.

But now, when I try to run the program I get:

"The application was unable to start correctly (0x000007b). Click OK to close the application."

I've never seen this error before. Could this be related to the new toolkit?

sentences:
How to make it so units don't stack up in one location? Possible Duplicate:
  Is there a simple way to stop enemies standing in the same spot?

So I'm making a game in AS3, it's a strategy DotA-like game (for flash game equivalent, there's UDE) so far so good, I have the A* pathfinding algorithm all sorted out and the minion units move to the desired location as I want them to be.
The problem a rise when a unit stops in a node that has already occupied by another friendly unit. Both (or more than two) of them stacks up in one location, it looks like they're one unit.

I want to add collision detection so when they collide they don't stack up together. But now they stop when they collide on they way to a node. This isn't good because they won't move at all midway (they won't respond to enemy attacks like that). I've added a deltatime so they only stopped for 2 seconds before they move again to their designated designation. This moves them again but they flicker. Not how I want it.

So, like the title said. How to make more than one units don't stack up in a node? And if possible, how to make them not flicker while moving (it's good if they can tell other friendly units on the way and avoid them accordingly)?

sentences:
Why do I get java.lang.OutOfMemoryError in android studio after adding a 2nd activity? After I decided to create an activity to show the results of the game with try again button. Every 3rd try the game will stop with this error.

  java.lang.OutOfMemoryError: Failed to allocate a 3819212 byte allocation with 610080 free bytes and 595KB until OOM

What am I doing wrong here?

My try again button code.

 public void tryAgain(View view) {
    startActivity(new Intent(getApplicationContext(), StartActivity.class));
}

How I call my result activity

Intent intent = new Intent(Constants.CURRENT_CONTEXT.getApplicationContext(), ResultActivity.class);
            intent.putExtra("SCORE", obstacleManager.getScore());
            Constants.CURRENT_CONTEXT.startActivity(intent);

sentences:
What are windows used for? I have a very general question: In games, what use does the programming concept of a window have? Or, in other words, why do some game dev libraries offer interfaces through which to create multiple windows? — Why would you need more than one windows in a game?

Are multiple windows used as different views/states of the game? (I.e. in-game, main menu, pause menu, etc.)

sentences:
Scripting and Cinematics without Threading I've been struggling with how to implement scripting in my game engine. I only have a few requirements: It should be intuitive, I don't want to write a custom language, parser and interpreter, and I don't want to use threading. (I'm certain there's a simpler solution; I don't need the hassle of multiple game logic threads.) Here's an example script, in Python (aka pseudocode):

def dramatic_scene(actors):
    alice = actors["alice"]
    bob = actors["bob"]

    alice.walk_to(bob)
    if bob.can_see(alice):
        bob.say("Hello again!")
    else:
        alice.say("Excuse me, Bob?")

That epic piece of storytelling poses implementation problems. I can't just evaluate the whole method at once, because walk_to takes game time. If it returns right away, Alice would start walking up to Bob, and (in the same frame) say hello (or be greeted). But if walk_to is a blocking call that returns when she reaches Bob, then my game gets stuck, because it's blocking the same thread of execution that would make Alice walk.

I considered making each function enqueue an action -- alice.walk_to(bob) would push an object onto a queue, which would get popped off after Alice reached Bob, wherever he was. That's more subtly broken: the if branch is evaluated immediately, so Bob might greet Alice even if his back is turned to her.

How do other engines/people handle scripting without making threads? I'm starting to look in non-game-dev areas, like jQuery animation chains, for ideas. It seems like there should be some good patterns for this sort of problem.

sentences:
How to license free assets but prevent asset flipping? I'm a hobbyist prop artist and give away everything I make for free, even for commercial use. At the moment I use the CC BY 4.0 license which is great except for the fact that someone would be able to download my assets and sell unmodified for a profit.

Ideally, I would like a license where you are free to download and use my assets for free but can only be used for commercial purposes where the assets are not the primary focus of the product e.g. included as part of a game.

Does anyone have any experience here about how best to achieve this?

sentences:
How should I represent matrices in C++? I'm teaching myself 3D mathematics and in the process building my own rudimentary engine (of sorts). I was wondering what would be the best way to structure my C++ matrix class. There are a few options:

Separate member variables:

struct Mat4 {
    float
        m11, m12, m13, m14,
        m21, m22, m23, m24,
        m31, m32, m33, m34,
        m41, m42, m43, m44;

    // methods

}

A multi-dimensional array:

struct Mat4 {
    float[4][4] m;

    // methods

}

An array of vectors

struct Mat4 {
    Vec4[4] m;

    // methods

}

I'm guessing there would be positives and negatives to each.

From 3D Math Primer for Graphics and Game Development, 2nd Edition p.155:

  Matrices use 1-based indices, so the first row and column are numbered 1. For example, a12 (read “a one two,” not “a twelve”) is the element in the first row, second column. Notice that this is different from programming languages such as C++ and Java, which use 0-based array indices. A matrix does not have a column 0 or row 0. This difference in indexing can cause some confusion if matrices are stored using an actual array data type. For this reason, it’s common for classes that store small, fixed size matrices of the type used for geometric purposes to give each element its own named member variable, such as float a11, instead of using the language’s native array support with something like float elem[3][3].

So that's one vote for method one.

Is this really the accepted way to do things? It seems rather unwieldy if the only benefit would be sticking with the conventional math notation.

sentences:
Imitate a textured sphere in 2D I'm writing planet generator, using pico8. I got surface generation done:

And the last thing to do is to map the texture onto a sphere.
Pico8 has no triangle function. So my question is, how do I make a sphere in my 2d space, and how do I apply a texture on it?

Looking for an effect like this (with no lighting, of course!):

I have really bad knowledge of 3d space manipulations.
The full list of available API functions can be found here.

Update 4:

Solved!

Try it live here.

sentences:
Camera (pole cam) implementation problem In my project I have simple scene graph to render whole scene and Bullet physics SDK to provide physics simulation.

Each rendered object is represented as scene node. Camera always has target and located behind this target. Target can be any scene node.

First, I want to describe my rendering pipeline.

1)When time to render whole scene, we calculate view matrix from target's world matrix. We take offset vector in order to locate camera behind targeted scene node and transform it to scene node world's coordinate. Then add position of target with transformed offset vector. Finally, get inverse matrix of scene node. This method always is called before rendering whole scene.

HRESULT CameraNode::SetViewTransform(Scene *pScene)
{
    //If there is a target, make sure the camera is
    //rigidly attached right behind the target
    if(m_pTarget)
    {
        Mat4x4 mat = m_pTarget->VGet()->ToWorld();
        Vec4 at = m_CamOffsetVector;
        Vec4 atWorld = mat.Xform(at);
        Vec3 pos = mat.GetPosition() + Vec3(at);
        mat.SetPosition(pos);
        VSetTransform(&mat); // Set normal matrix and calculate inverse matrix
    }
    m_View = VGet()->FromWorld(); // Get inversed matrix
    pScene->GetRenderer()->VSetViewTransform(&m_View);
    return S_OK;
}

2)Then, when time to render particular scene node, we calculate projection matrix and send it to the vertex shader.

Mat4x4 CameraNode::GetWorldViewProjection(Scene *pScene)
{
     Mat4x4 world = pScene->GetTopMatrix();
     Mat4x4 view = VGet()->FromWorld();
     Mat4x4 worldView = world * view;
     return m_Projection * worldView;
}

I have next problem, when I calculate view matrix from target's world matrix and locate target on coordinate ( x = 0; y = 10; z = 1) it started to fall due to physics and jerk/twitch. [1]

When I set view/camera matrix only offset position. Scene node falls without jerking/twitching. [2]

How I can fix this jerking/twitching when camera is following the scene node ?

I suppose that it is problem of matrices multiplication, when Bullet SDK sets new coordinates to scene node. But I have no idea how it can be solved.

sentences:
How do I scroll to follow my sprite in the physical world? I am using andengine to make a game where a sprite (player) is going up across the stage,  and I want the camera to stay centred on the sprite the entire time.

This is my world so far:

final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager);
final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2, vertexBufferObjectManager);
final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
final Rectangle right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);

final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);

/* Create two sprits and add it to the scene. */

this.mScene.setBackground(autoParallaxBackground);

this.mScene.attachChild(ground);
this.mScene.attachChild(roof);
this.mScene.attachChild(left);
this.mScene.attachChild(right);

this.mScene.registerUpdateHandler(this.mPhysicsWorld);

The problem is that when the sprite reaches the top wall, it crashes.
How can I fix this?

sentences:
How can I randomly pick points on a triangle? Please can help me for a geometry query, I am working out fast mesh to voxel algorithm without using rays and complex maths...

What are the maths to sample N points on a triangle randomly? If you can sample randomly i think it means you know the same equation that can distribute points on a triangle at same spacing.

I found some info here but it's too difficult to understand:

https://math.stackexchange.com/questions/18686/uniform-random-point-in-triangle

http://mathworld.wolfram.com/TrianglePointPicking.html

The reason is to sample N points on every triangle and round each into a voxel space and send the rounded position of every sample as a true value to a boolean spacial voxel array of X,Y,Z true false values to represent voxels.

Thanks for any info's you may provide!

sentences:
How to mix pixel colors in Shader? I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything.

How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this:

half3 original = half3(1, 1, 1);
half3 mycolor = half3(1, 0, 0);
half3 result = original * mycolor;

But what can I do if:

half3 original = half3(0.36, 0.74, 0.18);
half3 mycolor = half3(1, 0, 0);
half3 result = ?;

What operation or function should I apply to my original pixel color to override it ?

sentences: How do I randomly create and store enemy data for my iPhone game? In my game you need to protect something from enemies. There can be many on the screen at once. But I don't know how to create the enemies randomly, and how I can save the data to each enemy? Can give good tips or good links to tutorials?

sentences:
Where can I modify the default damage system on UDK I want to make a custom damage system on my game but I can't find the function that handles it...

I looked on Actor.uc but the only thing I've found is the event TakeDamage, but there's nothing on it that actually deals the damage.

Thanks in advance.

sentences:
How can I apply an overlay effect to a sprite in XNA? Suppose I have a character sprite and I want to apply some animating effect that overlays its color, how would I do it? What I desire is something along this line:
(From final fantasy tactics)

It is a sprite overlay with animating gray effect and white color for black line.

However, in XNA, pixel shader support only shading of all sprite in the scene. If I am to pixel shade only specific sprite I want, I have to either apply stencil buffer which makes the system more complicated when I have multiple, separated effects for each sprite ( I have to determine stencil buffer clipping for each effects ). Another forum suggest using seperate sprite batch for each sprite drawn (call Begin / End for each sprite) and create my own sorting routine, but I found out that this batching method will really consume alot of GPU performance.

On the other hand, If I have 2D texture filled prerendered overlay effect, then I apply it onto the character sprite for some blending effect, the Sprite batch will not clip out the overlay effect and limit it only to character shapde but will pass it onto the background too.

Therefore, any suggestion to tackle this problem?

sentences:
How to rotate model, around its own center? I have a 3d Model that it wasn't made from the origin of the 3d program, lets say that it was built at (100, 100, 100), I know how to rotate a model, but around the model origin point, (0, 0, 0),  now how can I rotate the model around its own center? In this example the (100, 100, 100) so that instead of going around the origin point (like the earth around the sun) it will rotate around its own center (like the earth rotation around its center) so I can create an effect of the earth rotating around the sun and rotating around its own center.

Here's my code:

modelTransform = (Matrix.CreateScale(3f, 3f, 3f) * Matrix.CreateRotationX(rotation) * Matrix.CreateTranslation(myModel.Position));
effect.World = transform[mesh.ParentBone.Index] * modelTransform;

with this code my earth is rotating around the sun, but I have no idea how to rotate it around its own center.

sentences:
How can I shoot when I touch the Box Collider I want to change the Computer Input to Mobile Touch Input, if I press Space Button it shoots but how do I change this [Code] to Touch Input ?

I want it to have it into void OnTouchDown() but what do I have to put into the if(...) in the ShootingScript if I want to have it for Mobile to work ?

Here is my Shooting Script and my Player Controller Script

ShootingScript:

public GameObject shootingBullets;

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown (KeyCode.Space))
    {
        Instantiate(shootingBullets, transform.position, Quaternion.identity);
    }
}

PlayerControllerScript:

public float jumpHeight;

void OnTouchDown()
{
    if (GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>().velocity.y < 0.001f && GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>().velocity.y > -0.001f)
    {
        GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>().AddForce(Vector2.up * jumpHeight);
    }

}

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown (KeyCode.UpArrow) && GetComponent<Rigidbody2D>().velocity.y < 0.001f && GetComponent<Rigidbody2D>().velocity.y > -0.001f)
    {
        GetComponent<Rigidbody2D>().AddForce(Vector2.up * jumpHeight);
    }

    if (Input.GetKeyDown (KeyCode.DownArrow))
    {
        GetComponent<Rigidbody2D>().AddForce(-Vector2.up * jumpHeight);
    }

}

sentences:
Unity C# Array Scripting! I was just trying and make a simple 2D game. I have a simple circle sprite (red, green and blue). These circles fly upwards with my scripting as shown below:-

public class Direction : MonoBehaviour {
    public GameObject[] ballons;
    public float increase;
    public float timeInterval;
    public float timeForGetGo;
    public float increaseInterval;

    public float startTime;
    public float timeForNextSpawn;
    public Transform instantiatePos;
    void Start () {;
        StartCoroutine (direction ());

    }

    void Update () {
        increase += increaseInterval;
        direction ();
        Instantiater ();
    }

    IEnumerator direction (){
        while (true){
            foreach (GameObject gameObjects in ballons) {
                gameObjects.transform.position = new Vector3 (gameObjects.transform.position.x, gameObjects.transform.position.y + increase, 0f);
                yield return new WaitForSeconds (timeInterval);

                }
                }

So, instead of making them fly with one script by one script, which I normally do, I tried to make array of these gameObjects and make them go upwards. **It worked great!** But, I have a problem. I want these upward going circle to instantiate but when I instantiate them, they won't go upwards as they aren't in the list of arrays I put earlier as in:-

public GameObject[] ballons;

in first line in that script.

So, as in conclusion, my problem is the instantiated objects won't have same property coz the script is attached to another gameobject and not in the original gamobject itself. Any ideas?

sentences:
Why is the player not showing up on UI when connecting to server? I want to create a playerList, that whenever a player joins server, his/her name will show up on a list in UI. But currently the names are only showing up on the Client + host side. Below is my NewtworkManager code. lobbyPlayerList is just a UI element with VerticalLayoutGroup. lobbyCharacter is just UI textElement with a networkBehavior script that sets the text field value and also has newtworkIdentity and networkTransformation.
  public struct PlayerInfo: NetworkMessage
{
    public string name;
}

public class LobbyManager : NetworkManager
{
    public GameObject lobbyCharacter;
    public GameObject lobbyPlayerList;
    // Start is called before the first frame update

    public override void OnStartServer()
    {
        base.OnStartServer();

        NetworkServer.RegisterHandler<PlayerInfo>(CreateLobbyCharacter);
    }

    public override void OnClientConnect(NetworkConnection conn)
    {
       // base.OnClientConnect(conn);

        PlayerInfo info = new PlayerInfo
        {
            name = "Test"
        };

        conn.Send(info);
    }

    private void CreateLobbyCharacter(NetworkConnection conn, PlayerInfo info)
    {
        GameObject gameobject = Instantiate(lobbyCharacter, lobbyPlayerList.transform);

        gameobject.GetComponent<LobbyCharacter>().SetText(info.name);

        NetworkServer.AddPlayerForConnection(conn, gameobject);
    }
}

sentences:
Raycasting to AddForceAtPosition goes to the wrong direction I'm trying to get my coin object's Rigidbody to move whichever way it was swiped on by the user through RayCast

void Awake()
{
    coinRigidBody = coin.GetComponent<Rigidbody>();
}

void Update()
{

    foreach (Touch touch in Input.touches)
    {
        if (touch.phase == TouchPhase.Began)
        {
            firstTouchPos = new Vector3(touch.position.x, touch.position.y, Camera.main.nearClipPlane);
        }
        if (touch.phase == TouchPhase.Moved)
        {

            lastTouchPos = new Vector3(touch.position.x, touch.position.y, Camera.main.farClipPlane);
        }

        if (touch.phase == TouchPhase.Ended)
        {

            Vector3 firstTouchWorldPos = Camera.main.ScreenToWorldPoint(firstTouchPos);
            Vector3 lastTouchWorldPos = Camera.main.ScreenToWorldPoint(lastTouchPos);
            Vector3 diffWorldPos = lastTouchWorldPos - firstTouchWorldPos;
            direction3D = diffWorldPos.normalized;
            power = diffWorldPos.magnitude * (force / Time.deltaTime);

            Ray firstTouchRay = Camera.main.ScreenPointToRay(firstTouchPos);
            Ray lastTouchRay = Camera.main.ScreenPointToRay(lastTouchPos);

            RaycastHit hit;
            Debug.DrawRay(firstTouchRay.origin, lastTouchRay.direction - firstTouchRay.direction, Color.red, 50.0f);

            if (Physics.Raycast(firstTouchRay.origin, lastTouchRay.direction * 100, out hit))
            {
                Vector3 hitLocation = hit.point;
                if (hit.collider.tag == "Coin")
                {

                    projectedVector = Vector3.ProjectOnPlane(direction3D, plane.normal);
                    coinRigidBody.AddForceAtPosition(projectedVector * power, hitLocation * 5);
                    throwCoinObject.throwWithForce(power, hitLocation, direction3D);
                }
            }
        }
    }
}

The Code is working but my only problem is that it goes only in a certain direction? And it seems that direction is manipulated by how the camera is facing the objects.
I just want it to hit the first touch origin then move to the direction the swipe was made.

Help would be really appreciated

sentences:
Transparent parts of texture are opaque black instead I render a sprite twice, one on top of the other.  The sprites have transparent parts, so I should be able to see the bottom sprite under the top sprite.  The transparent parts are black (the clear colour) and opaque instead though and the topmost sprite blocks the bottom sprite.

My fragment shader is trivial:

uniform sampler2D texture;
varying vec2 f_texcoord;
void main()
{
    gl_FragColor = texture2D(texture, f_texcoord);
}

I have glEnable(GL_BLEND) and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) in my initialization code.  My texture comes from a PNG file that I load with libpng.  I'm sure to use GL_RGBA when initializing the texture with glTexImage2D (otherwise the sprites look like noise).

Edit: Here's a screenshot.

sentences:
Export Maya Animation Data I have a pretty simple character rig animation. How can I export the raw data of that animation?

I'm looking for some way to export a raw text array of data that tells exactly what every joint does on every frame. This means rotation, translation, etc.

EDIT:
Thanks for the answers so far. We are looking for a way to get something like this:
This would be one joint of a 14 frame animation.

 <joint>
      <name> rightShoulder </name>
      <xPos>12 14 16 18 19 20 21 24 26 28 32 34 36 38 </xPos>
      <yPos>100 99 98 97 96 95 94 93 92 91 90 91 92 95 </yPos>
 </joint>

We are also trying to keep the file lightweight. So we will be ONLY including this data, no meshes, cameras or anything else. I've been looking into .DAE but it seems pretty heavy.

Any suggestions? If nothing standard works, how would one go about writing their own Maya exporter? Does something like this seem possible?

sentences:
Remove nested if statements I have been learning a new method of programming. I have been programming many years and am recently finding out there is a better method in general via abstract classes.

My question is how to convert a small section of my code so i can understand how this works entirely. So far i could only figure out how to do 1 part:

public abstract class Water
{
    public abstract string GetString(double AmountToAdd);
}

public class AddTotalWater : Water
{
    public double TotalWater;

    public override string GetString(double AmountToAdd)
    {
        TotalWater += AmountToAdd;
        if (TotalWater > 999999)
            return TotalWater.ToString(Globals.ScientificNotationFormatter);
        else
            return TotalWater.ToString();
    }
}

and use it with:

TotalWater.text = AddTotalWater.GetString(amountToAdd);

I would just like some guidance to learn how to do this fully.
Is this the proper way to do this to begin with?

This is the nested nightmare I have currently that i want to convert:

public void DetermineWaterValues()
    {
        if (Time.deltaTime < TotalWaterProductionTime)
        {
            double tempWaterTime = waterCounter += Time.deltaTime;
            if (tempWaterTime > TotalWaterProductionTime)
            {
                tempWaterTime = TotalWaterProductionTime;
                waterCounter = 0;
                WaterProgressBar.fillAmount = 0;
                TotalWater.text = AddTotalWater.GetString(amountToAdd);
            }
            else
            {
                if (TotalWaterProductionTime >= 0.1)
                    WaterProgressBar.fillAmount = (float)(tempWaterTime / TotalWaterProductionTime);
                else
                    WaterProgressBar.fillAmount = 1;
            }
        }
        else
        {
            WaterProgressBar.fillAmount = 1;
            TotalWater.text = AddTotalWater.GetString(amountToAdd);
        }
    }

It's quite complicated to figure out how to do this properly.
This is the way i did it for over 10 years heh...

sentences: Can "dumbphones" play JavaScript games? Are JavaScript games exclusive to modern smartphones, or are older phone models also able to play games written in JavaScript?

sentences: NullReferenceException: Object reference not set to an instance of an object Hi so im displaying food, health an water on the screen in a text box by using UnityEngine.UI and making text variables. They are all defined in the update function so they will keep changing and are all defined one after another with nothing in between. it will only call the first one there and the others it gives me the error message above.

sentences:
How do I detect the side of collision? I got a simple method of detecting collision between two objects. The next step is to figure out what side of the hitbox was hit so I know whether I need to push the other object back in X or Y axis. I am using 6502 assembly to keep things simple. This means that some modern methods are too slow. Here is some known information about the objects:

object X/Y positions
object A begin above/below and to left/right of object B
object X/Y speeds
hitbox top/left/bottom/right bound distance from object position
the amount of hitbox overlap in X/Y axis

Also there should be a way to detect if a corner is hit so that can be treated differently (eg. when hitting top corner favor pushing object on top of the other object, landing on it, rather than pushing the object aside and falling)

sentences: Path-finding with obstacles that can be destroyed There are several buildings on the map with size n * n， and a lot of tiles of obstacles that can be destroyed.  Suppose I put one soldier on (x,y) of the map, the soldier can reach a building by moving and destroying the obstacles.  I need a way to figure out the best choice for the soldier and because there might be a lot of soldiers I hope this process can use as little computing resources as possible.  I have come up with path finding and K-D tree finding the nearest neighbor, but neither fits well, since K-D tree works with no obstacles and  path-finding needs to traverse a lot building.  Besides, the destroying obstacles will affect those have made one path plan.

sentences:
Instantiate a new Prefab I’m developing a little 3D game to improve my Unity C# development.
However, I am faced with a recurring error that I cannot find the solution to :/
In fact, I always get the error Nullreferenceexception: Object reference not set to an instance of an object when I want to create a new Gameobject in my scene.

I wish I could spawn a bonus based on a percentage of chance when an enemy is killed.

So I created a Bonus mother class and a Bonushealth daughter class. So Bonushealth inherits the Bonus methods.

Here’s the mother class code (Bonus) :

using UnityEngine;

public class Bonus : MonoBehaviour
{
    protected int lifeTime;

    public int LifeTime { get => lifeTime; set => lifeTime = value; }

    protected void RandomDropBonus(Transform posEnemy)
    {
        int chance = Random.Range(1, 100);

        switch (chance)
        {
            case int n when (n <= 100):
                Instantiate(Resources.Load<GameObject>("bonus"), new Vector3(posEnemy.position.x, posEnemy.position.y, posEnemy.position.z), Quaternion.identity);
                break;
        }
    }

    public void RandomBonus(Transform posEnemy)
    {
        int rdn = Random.Range(1, 1);
        Debug.Log(rdn);

        if(rdn == 1)
        {
            RandomDropBonus(posEnemy);
        }
    }
}

Here's the daughter class code (BonusHealth) :

using UnityEngine;

public class BonusHealth : Bonus
{
    public GameObject prefabHealth;
    // Start is called before the first frame update
    void Start()
    {
        LifeTime = 10;
    }
}

I call the RandomBonus() method when an enemy is killed (in the Enemy class), Here's is the code :

private Bonus bonus;
bonus.RandomBonus(this.transform);

if I make Bonus bonus = new Bonus()
I always get this error : ArgumentException: The Object you want to instantiate is null.

In my prefab folder is contained my bonus prefab named bonus. I added the Bonushealth script on it.

I did a lot of research on the Internet but no way to find a solution :/

Thanks in advance ;)

sentences:
Gravity: Slow down on ground approach I'm looking for some math, nothing language dependant.

"Standard" gravity for a character in a 2D game would go something like this:

if player.y > ground.y {
   player.velocity.y = player.velocity.y - gravity
}

In the little game I'm implementing I would actually like the gravity to weaken, and the velocity to slow, as the player approaches the ground.

IE: When the character is 100m above ground he should fall faster than when he is 1m above ground. He should land like a feather in a way.

sentences:
XNA Framework doesn't recognise controller So just a little bit of XNA code:

if (this.IsActive && (Keyboard.GetState().GetPressedKeys().Length > 0 || Mouse.GetState().LeftButton == ButtonState.Pressed || Mouse.GetState().RightButton == ButtonState.Pressed || Mouse.GetState().MiddleButton == ButtonState.Pressed) || GP_state.GetButton(8) == ButtonState.Pressed)
                    {
                        Current_GameState = GameStates.Game;
                            bg_music.Play();
                    }

If something is done --> Switch to a different game state.
Works with: Keyboard and Mouse, but not with the gamepad (which is new and it works with other games) So why does XNA not recognise it correctly??

EDIT: I do have a working solution and mark my own answer as soon as possible as right...

sentences:
Change Pawn movement speed I'm newbie in Unreal development and I don't know how to move my pawn faster.

By the way, I'm using Unreal 4.16.

I'm developing Pong game and I have this method to move the pawn:

void AAIPaddle::MovePaddle(float Scale)
{
    // Add a movement input, hardcoding Z speed to 100.0f
    FVector direction = FVector(0.0f, 0.0f, 100.0f);

    // Scale could be -1.0f or 1.0f or 0.0f.
    AddMovementInput(direction, Scale);
    if (OurMovementComponent &&
        (OurMovementComponent->UpdatedComponent == RootComponent))
    {
        OurMovementComponent->AddInputVector(direction * Scale);
        ZVelocity = Scale;
    }
}

You can find the class AAIPaddle here.

I use this FVector direction = FVector(0.0f, 0.0f, 100.0f); to set its speed, but I change the value 100.0f with 400.0f or another greater values and it moves with the same speed.

Maybe I haven't understood anything. How can I change its movement speed?

I'm using the following class that inherits from UPawnMovementComponent.

void UPaddlePawnMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    // Make sure that everything is still valid, and that we are allowed to move.
    //      PawnOwner: which pawn owns this MovementComponent.
    //      UpdatedComponent: the component we move and update.
    //      ShouldSkipUpdate: Possibly skip update if moved component is not rendered or can't move.
    // If none own this component or there isn't anything to move or we have to skip this update, then return.
    if (!PawnOwner || !UpdatedComponent || ShouldSkipUpdate(DeltaTime))
    {
        return;
    }

    // Get (and then clear) the movement vector that we set in ACollidingPawn::Tick
    FVector DesiredMovementThisFrame = ConsumeInputVector().GetClampedToMaxSize(1.0f) * DeltaTime * 150.0f;
    // If movement isn't nearly zero
    if (!DesiredMovementThisFrame.IsNearlyZero())
    {
        FHitResult Hit;
        // Move our UpdatedComponent by the given DesiredMovementThisFrame, and sets rotation to
        // UpdatedComponent->GetComponentRotation(), do a bSweep and store any hit on Hit.
        SafeMoveUpdatedComponent(DesiredMovementThisFrame, UpdatedComponent->GetComponentRotation(), true, Hit);

        // If we bumped into something, try to slide along it
        if (Hit.IsValidBlockingHit())
        {
            StopMovementImmediately();
        }
    }
};

The project is public in Github.

Maybe I don't understand something about Vectors.

sentences:
Rows of coins in libgdx? I have my coin image in the assetLoader class, then I import it into gameWorld.

My question is, how can I draw() rows of coins without having to write out 15 different coins?

i.e., coin1, coin2, coinRect1, coinRect2, coinX1, coinX2, etc.
Wouldn't it be more efficient/easier on memory&performance to create a 'coin' class and use a loop somehow?

It's a vertical scroller so the coins should be lined up vertically and disappear individually as the playerRect intersects the coinRect.

The coins should not intersect the obstacles and the randomly generated number of coins in any row (e.g. a row of 6 coins all lined up) should be between 1 and 10.
If I used a loop (somehow...) the integer i would be the randomly generated number of coins in any row, so that 1<=i<=10, and if coin.position intersected obstacleRect then it i would become i-1 so that the coins stopped right before the obstacle.

sentences:
Taking MSAA screenshot using D3DX10SaveTextureToFile() I have some screenshot code (pasted below) which was working fine until I enabled MSAA. The first time I tried to use this code, it complained that the texture I'm creating needed to match the sample count of the source texture. Fine- my MSAA value is 8 currently, so I set the screenshot texture to a sample count of 8 also.

Now when I try to use the code, it complains:

  ERROR: ID3D10Device::CreateTexture2D: A multisampled Texture2D cannot be bound to certain parts of the graphics pipeline, but must have at least one BindFlags bit set. The following BindFlags bits (0) cannot be set in this case: D3D10_BIND_VERTEX_BUFFER (0), D3D10_BIND_INDEX_BUFFER (0), D3D10_BIND_CONSTANT_BUFFER (0), D3D10_BIND_STREAM_OUTPUT (0)

Note- this happens when I call CreateTexture2D(). However, if I take the hint and try a BindFlag with my created texture (D3D10_BIND_RENDER_TARGET for example) I get the exact same error message when D3DX10SaveTextureToFile() is called.

Here is the code:

ID3D10Resource* pScreen;
mpRenderTargetView->GetResource( &pScreen );

HRESULT hr;

D3D10_TEXTURE2D_DESC texDesc;
texDesc.ArraySize = 1;
texDesc.BindFlags = D3D10_BIND_RENDER_TARGET;
texDesc.CPUAccessFlags = 0;
texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
texDesc.Width = (unsigned int)mWindowSize.x;
texDesc.Height = (unsigned int)mWindowSize.y;
texDesc.MipLevels = 1;
texDesc.MiscFlags = 0;
texDesc.SampleDesc.Count = 8;
texDesc.SampleDesc.Quality = 0;
texDesc.Usage = D3D10_USAGE_DEFAULT;

ID3D10Texture2D *texture;
hr = mpD3DDevice->CreateTexture2D( &texDesc, 0, &texture );
mpD3DDevice->CopyResource( texture, pScreen );

char* filename = "TestFile.dds"

D3DX10SaveTextureToFile( texture, D3DX10_IFF_DDS, filename );
texture->Release();
pScreen->Release();

I should also mention that I've tried various file formats with no success yet. This function has been a real pain in the butt so if there's a better way of doing this, I'd love to know it!

sentences: Unity - best way to make intro with images I have made and rendered an intro in blender for my unity game. The intro currently consists of 150 PNG-images. Should I make it into a video before importing it to unity or should I just import the images to unity and handle the animation there and if so how do you do that?

sentences:
Java Game How to change opacity of an image? Hello I have a game where you feed animals. A few minutes after you feed them they do a poo. I want the poo to fade away after a few seconds. I want to know how to change the opacity on the image. How can I do this?

here is my code:

package items;

import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;

public class poo {

    public int x, y;
    private Image img;

    public int time = 0;
    public int timer = 100;
    public boolean remove;

    public float alpha = 1f;

    public poo(int x, int y) {
        this.x = x;
        this.y = y;

        alpha = 1f;
    }

    public void tick() {
        if (time >= timer) {
            time = 0;
            // remove = true;
        } else {
            time++;
        }
        if (alpha > 2) {
            // alpha--;
        } else {
            // remove = true;
        }

    }

    public void render(Graphics g) {

        ImageIcon i2 = new ImageIcon("res/items/poo.png");
        img = i2.getImage();

        g.drawImage(img, x, y,6,8, null);

    }
}

sentences:
What would be a good way to scroll a large html canvas (that contains little repetition if any) What would be a good way to scroll the content of a huge html5 canvas so that the scroll is crisp and smooth, and memory consumption (and cpu load or battery consumption) is also reasonable?

any good library that can take care of it for you? Any specific plotting algorithm that will avoid a jumpy feel?

I guess the best way is to pre-plot upwards and downwards of the current viewport, but if the user quickly scrolls a whole lot up, I assume that some algorithms outperform others.

My canvas has very little repetition drawn on it, in case it matters, and the content doesn't change much. Just a very very long canvas element that also contains a lot of text, and needs to smoothly scroll in the browser viewport.

sentences:
Unity rope/cable physics / anchor points I'm creating a cable in Unity, which should behave realistically. I found 2 different ways to approach the problem.

First was to simply rigg a subdivided cylinder in Blender, Cinema4D or whatever editor you like and you set up hinge joints between the bones in Unity.

Second approach was to apply a Cloth Component in Unity. I tried the second approach with the cloth component. The physics work nice, but I don't know, how to make anchor points for the cloth object. I'm just able to add colliders, but the object is slipping away pretty fast from them.

So my first question is, which approach has the most benefits above the other and which benefits do they have. Second question, how can I create anchor points for my cloth object.

sentences:
Best way to implement a class or interface for a set of UI buttons that only differ in their Draw() function? I have three types of UI buttons that go on a cooldown bar:

A traditional cooldown bar button where once the corresponding key is pressed, a timer shows over the button and dims the texture.
A button that shows a cooldown, doesn't dim and adds stacks counting upwards to a max (say 5) in the upper left
A button that acts like a toggle with no timer, but dims depending on if it's on or off

These all inherit from my AbilityButton class. I'd like to put all three Draw() functions in AbilityButton like:

public virtual DrawNormal() {...stuff...}
public virtual DrawStackable() {...stuff...}
public virtual DrawToggle() {...stuff...}

... and tell the children to implement the correct one. The problem is that I don't think it's possible to just tell my children to use one of those. From what I've seen, I'd need to make an instance of the parent in each child and call the corresponding method. This just feels weird and wrong - like I'm designing incorrectly to land in this position in the first place.

Is there a better way to do this? Is this better suited for interfaces? One interface per button type? The problem with interfaces is that I want to actually define the method functionality in the parent which interfaces do not allow.

sentences:
How can I obtain in-game data from Warcraft 3 from an external process? I am implementing a behavior algorithm and would like to test it with my lovely Warcraft III game to watch how it will fight against real players.

The problem I'm having is that I don't know how to obtain information about in-game state (units, structures, environment, etc.) from the running WC3 game. My algorithm needs access to the hard drive and possibly distributed computing, that's why JASS (WC3's editor language) isn't appropriate; I need to run my algorithm from a separate process.

Direct3D hooking is an approach, but it wasn't done for WC3 yet and a significant drawback of that approach would be the inability to watch how the AI performs online, since it uses the viewport to issue commands.

How I read in-game data from WC3 in a different process in a fastest and easiest way?

Precisely what I need for Warcraft 3 exists for Starcraft: BWAPI.

sentences:
How to find a point on a plane? I'm using Unreal Engine 4.  Currently I ray trace to a surface in game and I'm trying to find the location of the point relative to the surface1 instead of the world.
I have the world position of the origin of the surface and the world position of the impact point.  I also have the X,Y,Z bounds of the object  What I would like to find out is how to get X',Y' position of the hitpoint relative to the upper left corner.  I've tried rotating the hitpoint around the origin to calculate the hitpoint based on refernce Roll, Pitch, and Yaw like so:
FVector RotatePointAroundPivot(FVector hitpoint, FVector pivot, FRotator angles) {
FVector dir = hitpoint - pivot;
FQuat quat(angles);

dir = quat*dir;
hitpoint = dir + pivot;

return hitpoint;
}

But it changes based on the rotation of the plane no matter what I do.
I also tried a very limited technique like so which just assumes it's in one of the correct orientations:
if (actorRotation.Yaw >= 0) {
    xpos = (actorBounds.Y - clickPosition.Y) / (actorBounds.Y * 2) * compscale.X * 1000;
    ypos = (actorBounds.Z + clickPosition.Z) / (actorBounds.Z * 2) * compscale.Y * 1000;
}
else {
    xpos = (actorBounds.Y + clickPosition.Y) / (actorBounds.Y * 2) * compscale.X * 1000;
    ypos = (actorBounds.Z + clickPosition.Z) / (actorBounds.Z * 2) * compscale.Y * 1000;
}

But it's flawed.  All I want is to be able to use the surface like a screen.

Any help would be appreciated.

sentences:
Last Matrix operation ignored? I have 2 methods, one to rotate my Quad and one to flip it (using scaleM), they are as follows: (Note, all values in these methods have been properly defined).

If I call just one, they work as expected, but if I call both, then only the one that is called last if applied - why is this?  If I combine them into on 'flip and rotate method' - then my quad is both flipped and rotated. (See third code snippet)

Why is this?

Method to rotate

    public void rotate(float x, float y, int angle){

    //Rotate the quad

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

}

Method to 'flip' (horizontally)

    public void flipHorizontal(float x, float y){

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.scaleM(mRotationMatrix, 0, -1, 1, 0f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);
}

Combined method

    public void flipHorizontal(float x, float y, int angle){

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f);
    Matrix.scaleM(mRotationMatrix, 0, -1, 1, 0f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

}

sentences:
Designing for visually impaired gamers Globally the number of people of all ages visually impaired is estimated to be 285 million, of whom 39 million are blind.
— World Health Organisation, 2010.

(That's 4.2% and 0.6% of the world population.)
Most videogames put a strong emphasis on visuals in their content delivery. Visually impaired gamers are largely left out.
How do I design a game to be accessible to visually impaired gamers?

sentences:
IgnoreCollision while Dodging & Colliding I'm working on a mechanic to allow the player to dodge through enemies. However I'm running into the issue where the player is only able to dodge through enemies while their already dodging when they collide with the enemy.

I want this to work both ways, as in, when their colliding with the enemy, they should be able to dodge through then.

Here's what I've been trying:

void OnCollisionEnter (Collision col) {

    //    STOP ENEMY FROM MOVING/PUSHING
    if (col.gameObject.tag == "Enemy") {
        Debug.Log("Collided with: " + col.gameObject.name);
        target = col.gameObject;
        target.GetComponent<ZombieController>().mRigidbody.isKinematic = true;

        //    IGNORE DODGING COLLISION WHEN ALREADY COLLIDED
        if (isDodging) Physics.IgnoreCollision(col.collider, GetComponent<Collider>(), true);
    }

    /*    IGNORE DODGING COLLISION
    if (isDodging && col.gameObject.tag == "Enemy") {
        Physics.IgnoreCollision(col.collider, GetComponent<Collider>(), true);
    }*/

}

It just doesn't seem to work when the player has already collided with the enemy. Hopefully all that made sense.

sentences:
How can I create an exclusive asset for multiple clients who all want basically the same thing? This is more of a legal question than for example a coding question, but I hope that it's allowed as well. I recently started working as a freelance VFX Artist and do a lot of work with shaders and particle systems. Now, I am currently working on some dynamic shader, which creates cartoon-ish flames. I signed a contract with one of my clients, which states that I do not re-sell the work I did for them. But, I wonder what I should do when my next client gives me the exact same task and wants a dynamic cartoon fire shader, which is something almost every (cartoon) project needs at some point.

Would it be enough to just use a couple different nodes in Shader Graph, which would still basically do the same? Even then, let's say I get 5 more clients, who want the same from me. There are only so many variations I can do to the shader when the task was to make it dynamic. With particle systems I could just paint a different material and it would be a piece of art asset, but how does that translate to shader work?

sentences:
How is 'mass' handled in video games? Mass is one of the basic scalar quantities, which is required in most rigid body physics calculations.

In a game, does every moving object have mass defined in the code, or is it allotted by the rendered objects size? Size should not be the only solution, though, since density also comes into play.

For example how does the physics engine handle mass in the Frostbite engine used in "Battlefield 3"?

sentences:
Unity 2D softbody with custom spring I'm trying to make custom 2D softbody physics that can interact with other Unity colliders.
My starting point was to implement a custom spring joint capable of connecting two entities ("particle") together.
With these joints and with 4 particles I made a simple rectangle. The 4 particles are created inside a GameObject used as a container, to which I applied the RigidBody2D and PolygonCollider2D components.
So the displacement of the particles is relative to the container.
If I apply forces directly to the particles the figure deforms correctly and works quite well, but the problem is that I don't know how to get the forces directly from the collider or the rigid body.
What I would need is to deduce from the collisions the forces to be applied to the particles, and at the same time keep the standard behavior of the collision.
Do you have any suggestions on this?

sentences:
Java: creating an instance of a user defined class by reading xml file I am trying to write an engine for a game, in particular a component-based one (in my approach components contain both data and logic). So basically I have entities, and each entity has a list of components (each component extends the Component class). Now, I want to be able to define templates for my entities in xml files, and load them at runtime. The template would look something like this:

<Entity>
   <Component name="MovementComponent">
      <...Variables to be initialized...>
   </Component>
   <Component name="RenderComponent">
      <...Animations...>
   </Component>
</Entity>

The "name" attribute is the name of the corresponding component class. Now, of course the components are game-specific so I need a way to create an instance of the component and add it to the entity's list without actually knowing the specific class. I thought about Class.forName("...the "name" attribute...").newInstance(), but this way I can't add the components to the list, since it is an ArrayList of Component and the program cannot know that the object returned by the method newInstance is actually a subclass of Component. Is there any simple way to do this?

sentences:
How to make an application architecture a global strategy game? I am doing a global libgdx strategy, how can I properly design the architecture?
So far, I'm in some kind of chaos, because there are different events that need to be shown to the player in the form of widgets.
For example, one problem is that I need to understand how the Province class will display a message that there is a hunger problem. Should it:

immediately inside itself display a message?
send event data to the main class of the game, which processes the data and, depending on the event, display the message or take some other action?
do something else entirely?

I had the idea to make a separate class of events and so that all game objects create this object and pass it to the main class of the game, which handles them and decides what to do with it, and if necessary, pass it to the players.
And I read about the fact that there is a class java.util.EventObject. Is it worth implementing it with the help of it, or should it be implemented like that yourself? Or maybe it should be done in a completely different way?
The game is turn-based. There are separate provinces and the units move from one province to the neighboring one in 1 turn.
At the beginning of each turn, a series of windows appear in turn, notifying of certain events, for example, famine in a province or enemy troops attacked a province, etc.
There are classes of the province, the player, various UI - windows, which display information about events.

sentences:
Adding some recoil to the Camera so that the crosshair is pushing to the sky (FPS game) I just want to add some recoil to the camera, but I can't find a working script. It's an fps, so I take my mouse axis to rotate the camera. And now I want a pushback to the top, so that the camera looks into the sky after shooting a whole clip. It should be pretty easy, just add some amount to the axis, but it isn't working for me.

I've got something like this from another post, but it just does nothing for me... I got a feeling that my axis is locked in some way, I'm using the "MouseLook" from the standart assets.

transform.Rotate( recoil * Time.deltaTime, 0, 0 ) ;

Update:

This Script is working partially, but I think I reactivate the MouseLook too fast after the Rotate, so that the Mouse just jumps back to the starting position.

 mouseLook.enabled = false;
 transform.Rotate (-5, 0, 0);
 mouseLook.enabled = true;

sentences:
How to snap a 2D Quad to the mouse cursor using OpenGL 3.0? I've been having issues trying to snap a 2D Quad to the mouse cursor position I'm able :

1.) To get values into posX, posY, posZ

2.) Translate with the values from those 3 variables

But the quad positioning I'm not able to do correctly in such a way that the 2D Quad is near the mouse cursor using those values from those 3 variables eg."posX, posY, posZ"

I need the mouse cursor in the center of the 2D Quad.

I'm hoping someone can help me achieve this.

I've tried searching around with no avail.

Heres the function that is ment to do the snapping but instead creates weird flicker or shows nothing at all only the 3d models show up :

void display()
{
  glClearColor(0.0,0.0,0.0,1.0);
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

  for(std::vector<GLuint>::iterator I = cube.begin(); I != cube.end(); ++I)
  {
      glCallList(*I);

       }

     if(DrawArea == true)
     {

    glReadPixels(winX, winY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);

cerr << winZ << endl;

glGetDoublev(GL_MODELVIEW_MATRIX, modelview);

glGetDoublev(GL_PROJECTION_MATRIX, projection);

glGetIntegerv(GL_VIEWPORT, viewport);

gluUnProject(winX, winY, winZ , modelview, projection, viewport, &posX, &posY, & posZ);

    glBindTexture(GL_TEXTURE_2D, DrawAreaTexture);

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

    glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, DrawAreaSurface->w, DrawAreaSurface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, DrawAreaSurface->pixels);

    glEnable(GL_TEXTURE_2D);

    glBindTexture(GL_TEXTURE_2D, DrawAreaTexture);

glTranslatef(posX , posY, posZ);

     glBegin(GL_QUADS);

     glTexCoord2f (0.0, 0.0);
     glVertex3f(0.5, 0.5, 0);

     glTexCoord2f (1.0, 0.0);
     glVertex3f(0, 0.5, 0);

     glTexCoord2f (1.0, 1.0);
     glVertex3f(0, 0, 0);

     glTexCoord2f (0.0, 1.0);
     glVertex3f(0.5, 0, 0);

     glEnd();

        }

      SwapBuffers(hDC);
}

I'm using :

OpenGL 3.0
WIN32 API
C++
GLSL

if you really want the full source here it is -> http://pastebin.com/1Ncm9HNf , Its pretty messy.

sentences:
WebGL immediate mode I know that WebGL is based on OpenGL ES 2.0 and that glBegin and glEnd have been removed and replaced with vertex buffer objects. I understand that VBOs are faster and use less code but is there a library or add-on for JavaScript / WebGL that re-implements these functions?

After more research, I have discovered that this functionality is called immediate mode.

sentences:
Correct way/How to think to plan out "control/animation flow"? So basically, a problem I've had in past attempt at making games (little playing around with stuff): how to do a correct, non-sloppy way of planning the flow of animations/control?

Let's take an example: you have a character, that can walk in the 4 cardinal directions, and can attack. It's that simple. Obviously, you can only walk in one direction at the same time, and let's assume you can attack when not moving in a direction only.

How would you take upon implementing this? Don't know if I'm clear, but what'd your thinking process go like?

I always end up with a huge mess of ifs and else ifs to get the animations to represent what is actually supposed to happen after moving in a direction,
ie. character after having moved up, will maintain it's upwards facing (will stay on the "up" animation);
Have the facing direction when moving be consistent: if you start walking left, it gets the left animation, correct. Then you start walking upwards at the same time, or downwards, and you'd like the animation to keep @ being left.
You start walking up, up animation. And as you start moving left or right after starting to move up, you maintain up animation.

See what I mean? I'll be here for clarifications on the question, sorry if confuse.

For 4 directions it'd not be that hard to do something "decently structured", but when things start adding up, it becomes so confuse!

Edit: Another thing I hadn't thought about: I was simply, upon WASD, altering the object's velocities, and handling all the animation stuff through what velocities were involved. Which leads to wrong things I had thought about, such as if I get pushed, it'd walk left stupidly instead of backing off facing the direction it had.

Another edit:  What I want is an answer of the sort: "First, for movement, you'd have a look at all the possible directions, and have an int or such indicating what's the current direction. Do a big switch, and inside of each direction, you'd have ifs for further x and y, but not z, because that's gonna be englobed in whatever. Then you should also have another control layer directly on the input handling to help filter unwanted actions or combinations, such as, you don't want to press A and D and have the velocities cancel each other out. For such, you'd have some further "status" for the object..." something of this kind! Thanks!

sentences:
Is there a cross-platform special directory I can use for game save files? I'm developing with LWJGL and Java on a Windows 7 laptop. I've successfully set up saving to the %appdata%\gamename\saves\ or long form c:\users\user\appdata\roaming\gamename\saves\ folder by using File dir = new File(System.getenv("APPDATA") + "\\gamename\\saves\\");.

I have hobbyist level experience with Linux, and zero experience with OSX. My game will be fully cross platform.

Is System.getenv("APPDATA"); cross platform? If so, where does it point to on Linux or OSX? Is there a best practices alternative that I should use?

sentences:
How do I calculate the tangent to a point on a circle? I have a line that is from the center of a circle to a point on it's edge that is changing constantly (radius is drawn to a point orbiting a circle)
I want to make a line tangential to the circle whose midpoint is always the orbiting point. I know how to do it on paper but coding it in logic is the problem. Can someone show me how or point me to resources that I could use that would help me?

    public Line calculateTangent(Circle ball){

    //the point orbiting the circle
    circleEdge = new Vector2f((float)(radius*Math.cos(angle*Math.PI/180f)), (float)(radius*Math.sin(angle*Math.PI/180f)));
    //the line that I want to be perpendicular to at all times
    radiusLine = new Line(ball.getCenterX(), ball.getCenterY(), circleEdge.getX(), circleEdge.getY());
    //no idea how to do this last part
    perpendicular =

    }

sentences:
OnTriggerEnter With First Person Controller I'm working on an FPS for my first time.

I'm creating a simple terrain and instatiating 15 cubes on my terrain. (This works fine). Each cube is named "cube" and has a static trigger collider.

Here's what my scene looks like:

When my first person controller collides with my cube (instantiated object) then I want the cube to deactivate and add 1 to my score, but nothing happens.

Code:  I added this code in FirstPersonController.cs

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.name == "cube")
    {

        other.gameObject.SetActive(false);
        // when the player touches my spawned object then I want to
        // deactivate my cube, but nothing happens

        Debug.Log("collidedwith:" + other.gameObject.name);

        score += 1;
        scoreText.text = score.ToString();

    }
}

sentences:
2D animation: Animated 3D models or sprites with animation frames? Starting out with new project, I am stuck choosing between:

3D textured model animated directly through the renderer
2D sprites and drawing each animation frame

The game will be 2D platform, I would like the pros and cons of each method to help make a decision between the two.

sentences:
Determining axis to rotate around I'm trying to implement a free-look third person camera (using glm). I know that the general transformation is

newCameraPosition = translate(lookatPoint) * rotation(angle,axis) * translate(-lookatPoint);

So I need to find the axis to rotate around, with the constraint that I give the algorithm an axis in camera space to rotate around. Sounds confusing.

For example, let's take a camera that points up (0,1,0), is positioned in the XY plane at (-1,0,0) and is looking at the origin (0,0,0). So it is looking "along the x-axis".

Now I want to rotate the camera around the "camera-space-x-axis" (1,0,0). In words: The axis that "points to the right" when looking through the camera. Simply rotating around (1,0,0) doesn't work, since it will rotate the camera around the world-space x-axis. From the point of the camera however, the x-axis is in fact the z-axis in world space (0,0,1);

How do I go from the given camera-space axis to the world-space axis? I've tried just applying the inverse transform of the current camera transform to the given camera-space axis using

glm::vec3 rotateAxis = swizzle<X,Y,Z>(glm::inverse(GetCameraTransform()) * cameraSpaceAxis);

where cameraSpaceAxis.w = 0;

but that produces wrong results, e.g. if I give the algorithm the axis (1,0,0) to rotate around, continuously rotation around it in 1 degree steps just creates a wobbly circular motion around y and x axis;

sentences:
How to translate vertex buffer coordinates in 2D I am trying to (using a 2D Directx9 engine library) rotate/translate a set of points in a vertex buffer.

I understand how this would be done in a 3D system - i.e using the vertex shader stage of the rendering pipeline with transformation matricies...

But Im not sure that applies in 2D? (or am I wrong).  I don't know where any of the vertex shader stage happens in 2D? or whether it happens at all.

Basically I can create a transformation matrix using some thing like D3DXMatrixTransformation2D()
and I know how to apply that to an LPD3DXSPRITE object (using Sprite->SetTransform()),  but how can I apply that transformation matrix to a set of 10+ coordinates stored in a vertex Buffer instead of a sprite.

Any help or suggestions would be greatly appreciated.
Thanks

sentences:
Incorrect colour blending when using a pixel shader with XNA I'm using XNA 4.0 to create a 2D game and while implementing a layer tinting pixel shader I noticed that when the texture's alpha value is anything between 1 or 0 the end result is different than expected.

The tinting works from selecting a colour and setting the amount of tint.  This is achieved via the shader which works out first the starting colour (for each r, g, b and a) :

float red = texCoord.r * vertexColour.r;

and then the final tinted colour :

output.r = red + (tintColour.r - red) * tintAmount;

The alpha value isn't tinted and is left as :

output.a = texCoord.a * vertexColour.a;

The picture in the link below shows different backdrops against an energy ball object where it's outer glow hasn't blended as I would like it to.  The middle two are incorrect as the second non tinted one should not show a glow against a white BG and the third should be entirely invisible.

The blending function is NonPremultiplied.

Why the alpha value is interfering with the final colour?

sentences:
Algorithm to zoom a plotted function I'm making a game in android and I need plot a function, my algorithm is this:

    @Override
    protected void onDraw(Canvas canvas) {
        float e = 0.5f;
        //from -x axis to +x evaluate f(x)
        for (float x = -z(canvas.getWidth()); x < z(canvas.getWidth()); x+=e) {
                 float x1,y1;
                 x1 = x;
                 y1 = f(x);
                 canvas.drawPoint((canvas.getWidth()/2)+x1, (canvas.getHeight()/2)-y1, paintWhite);
        }
        super.onDraw(canvas);
    }

This is how it works. If my function is, for example f(x)=x^2, then z(x) is sqrt(x). I evaluate each point between -z(x) to z(x) and then I draw them. As you can see I use the half of the size of the screen to put the function in the middle of the screen. The problem isn't that the code isn't working, actually plots the function. But if the screen is of 320*480 then this function will be really tiny like in the image below. My question is: how can I change this algorithm to scale the function?. BTW what I'm really wanting to do is trace a route to later display an animated sprite, so actually scale this image doesnt gonna help me. I need change the algorithm in order to draw the same interval but in a larger space. Any tip helps, thanks!

Current working result

Desired result

UPDATE:
I will try explain more in detail what the problem is. Given this interval [-15...15] (-z(x) to z(x)) I need divide this points in a bigger interval [-320...320] (-x to x). For example, when you use some plotting software like this one. Although the div where is contain the function has 640 px of width, you dont see that the interval is from -320 to 320, you see that the interval is from -6 to 6. How can I achieve this?

sentences:
Reducing APK File Size by using JPG instead of PNG for game background images I've just finished my (openGL ES 2.0 Android) game and it's almost ready for Alpha-testing.

When I export the application to an APK File, the file is taking up 16MB and I would like to reduce this as much as I can.

Here are some points about what the project contains and what I've tried to reduce the size already:

222kb of Ogg Vorbis files used for Sound Effects
1 x MP3 file at 5.59MB (128kbps Bitrate)
4 x sets of PNG files used for textures (XHDPI, HDPI, MDPI & LDPI - I'm not using XXHDPI)
Just over 1MB of code

What I've tried thus far to get where I am:

I've optimised the PNG files using Optiping
I've applied ProGuard to my code before exporting, this didn't really help by much as 99% of my app is resources.

So my question is, is there really much else I can do to reduce the size of the APK?  I was thinking about maybe using JPG format source files for my Background OpenGL textures instead of PNG - anyone have any experience with this?  Does it hurt performance at all?  I can see that it would make quite a difference - my atlas of backgrounds in PNG format for XHDPI is 1.7MB - and a 90% compressed JPG comes in at around 650KB.  I'm just not sure if it's a good idea as everyone always advocates PNG > JPG.

Any pointers from personal experience would be helpful & also if I've overlooked anything other than using JPG's.

sentences:
Design of (texture) resource system For an open source game I wanted to redesign the resource management system but got into a dead end and need some pointers to some reading material or where to go now.

Starting point was (mostly) a Loader class Header/Src

Format of the resources:

Resources are (usually) in archives, that consist of numbered files (no names) which can be of any type and may contain related meta data (size, draw offset, ...)
Often common formats (wav, midi, bmp) but custom formats possible, e.g. for textures:

2D Offset (model matrix translation)
Player color mask (extra greyscale bmp)
Partitioned bmps (e.g. links (indices) to body and head (bmps) to reuse bmps in the same file)

Extensions/Overwrites possible: Having 2 archives with the same name (different folders) will merge them (later loaded archive entries add or overwrite ones from the earlier ones)

The problems I wanted to solve are messy code (no SRP...), non-uniform handling of resources and a dynamic_cast for most accesses (basically: dynamic_cast<type*>(Get("foo", 42))). Having only 1 type of texture would also simplify rendering (maybe 2: One with player masks, and one without)

My approach (based on ENTT):

ResourceLocator: Given a name, returns the list of archives to load (handles extension/overwrites)
ResourceCache<Type>: Holds a loaded resource of a given type
ResourceLoader<Type>: Loads a resource
ResourceRegistry: Holds multiple caches, 1 locator and (maybe) loaders. Provides access to all resources by checking the cache first, and loading it on miss (adding it to cache)

This works well for sound effects and music:

SoundEffect& get(ResId id){
   if(id in soundcache) return it;
   archive& = get(id.name);
   SoundEffect* effect = load(archive)
   add to cache and return effect;
}

This is nice and generic. But I'm struggling on how to do this for textures for which I have different types:

"normal" textures (backgrounds, buttons...) -> easy
map-specific textures (e.g. trees with snow or w/o snow depending on map type. Previously the Loader stored a reference to the map archive and consumers simply called GetMapTexture(idx) -> might not be required for all maps, shall I unload all of them on map change and reload as required?
nation-specific textures (every nation has an archive and/or an offset in an archive) -> Using ("archive", number) as the key does not work anymore.

Additionally lots of textures may need to be combined (e.g. the split-bitmaps or shadow with buildings/people...) and there are animations. This led to having fixed size multi-D-arrays with many different indices where the meaning is contained in the Loader class.

So the "normal" textures are easy: Just load them into an OGL texture and use them. The others need (usually) multiple images combined into 1 texture. So I don't want to put those parts into the texture cache but only the combined one. But having those multi-D-Arrays also feels like a design flaw. And how would I reference/use them? How are others doing that?

Note: The indices of the images making up a texture/bld... can be (kinda) easily calculated from the nation index, building index, animation frame index, ...

Example usages (from current/old) code:

drawAnimal(int type, int dir, int animationFrame){animal_cache[type][dir][animationFrame].draw(pos...);}
drawCarrier(...){carrier_cache[carriedWare][dir][animationFrame][isFat].draw(pos, playerColor,...);}
drawBuilding(...){building_cache[nationIdx][bldIdx].draw(pos, playerColor,...);}

sentences:
Fixed timestep with interpolation & rounding draw positions: jerky animation when the character is not moving I've implemented a deterministic, fixed timestep system from here:
http://gafferongames.com/game-physics/fix-your-timestep/

Everything works fine, output is the same with each step but there's one problem - the animation is jerky while the character isn't moving.

Here's the code responsible for interpolation:

    draw.x = previous.getX() * alpha + current.getX() * (1.0f - alpha);
    draw.y = previous.getY() * alpha + current.getY() * (1.0f - alpha);

    g2d.drawImage(image, (int)draw.x, (int) draw.y, null);

Here's how 'alpha' looks like:

0.29991353
0.35988057
0.41996205
0.41996205
0.4799291
0.4799291
0.53989613
0.5998632
0.5998632
0.65994465
0.7199117
0.97999954
0.039999668
0.099999785
0.1599999
0.21999958
0.2799997
0.33999982
0.39999995
0.4599996
0.51999974

Let's assume that player's initial position is x = 100 and he's not moving.

His interpolation gives values like 100.0000123123 (which when casted to int gives 100 - OK) but it also gives values like 99.99999998, which when casted to int gives 99 (which makes the jerk).

I don't know how to handle this, maybe just make a statement (if previous != current then do interpolation) and that's it?

Thanks very much

Edit
Here's my gameloop:

    float fps = 60;
    float dt = 1 / fps;
    float accumulator = 0;

    Time time = new Time();
    float frameStart = time.getSeconds(); - // returns seconds since initialization for ex. 1.32234, 6.43243

    while(match_running) {

        float currentTime = time.getSeconds();

        accumulator += currentTime - frameStart;

        frameStart = currentTime;

        if (accumulator > 0.2f)
            accumulator = 0.2f;

        while (accumulator > dt) {
            doPhysics(dt);
            accumulator -= dt;
        }

        float alpha = accumulator / dt;
        gamePanel.drawGame(alpha); // here's the interpolation

    }

sentences: What is the name of the AI/algorithm used by most MMOs for monsters or mobs? Is there a standard name for the (fairly dumb) AI that most MMOs use where you 'aggro' a monster/mob when you are within a certain radius of it, and the monster chases your character for a set amount of time or distance when you attempt to run away?

sentences:
Portal frustum culling Our Levels consists of rooms.
Each room has an arbitrary number of portals into other rooms.
We frustum cull rooms by testing whether all portal vertices (a portal consists of a single quad) are outside of the frustum this is done recursively until no room is found.
This however has one flaw. if a portal is visibly occluded, it is still taken into account because it is within the frustum.

Is there an easy way to cull the rooms which are in the frustum but occluded?
I had Hardware occlusion culling in mind, but I am not sure whether this is too overkill.

sentences:
How to determine the end of list has been reached? I'm trying to animate my object according to a set of recorded values from kinect skeleton stream by saving the (x,y,z) stream from the skeletal data into a list and then set my objects x and y position from the x,y of the list. However, once the list end has been reached it starts to animate again from the start. I don't want that - I just want the model position to keep going in the positive X direction. Is there any way I can check if end of the list has been reached and to just update the model position in x direction?

Or is there any other way to continue moving my sprite once the points in the list are over... i dont want it to start animating all the way again..

   protected override void Update(GameTime gameTime)
        {

            //position += spriteSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

            //// TODO: Add your update logic here
            using (StreamReader r = new StreamReader(f))
            {
                string line;
                Viewport view = graphics.GraphicsDevice.Viewport;
                int maxWidth = view.Width;
                int maxHeight = view.Height;

                while((line = r.ReadLine()) != null)
                {

                    string[] temp = line.Split(',');

                    int x = (int) Math.Floor(((float.Parse(temp[0]) * 0.5f) + 0.5f) * maxWidth);
                    int y = (int) Math.Floor(((float.Parse(temp[1]) * -0.5f) + 0.5f) * maxHeight);

                    motion_2.Add(new Point(x, y));
                }

            }

                position.X = motion_2[i].X;
                position.Y = motion_2[i].Y;

            i++;

            a_butterfly_up.Update(gameTime);

            a_butterfly_side.Update(gameTime);

            G_vidPlayer.Play(mossV);

            base.Update(gameTime);
        }

sentences: Level Implementation I recently started to create a sidescroller game, for learning purposes. While creating several levels for it, i stumbled upon the question, how to implement these levels into my game. I made (and i think this is the common way, correct me if i am wrong, i appreciate it) a state-based game, with a menu-state, a game-state and so on. So whats the common way to implement various levels in the game-state? Should i create a new state for each level? or should the game-state be the only "playable" state, and "know" (however realized) the current level it is in? How would you realize point-counting or something like that (like a live system, or a simple beat-the-highscore point system)

sentences:
How does the Wii controller work? I've never played the Wii or Kinect, but to my understanding, the Wii captures user movement with 4 cameras and translates them to controls.

How does this work? Has Nintendo published anything on this? I'd appreciate a mathematical explanation.

sentences:
Why Unity Corrupts textures when used on a Sample Texture node shader I am trying create a glow effect on a background, to do this I am using shaders, when I use the main texture everything is okay, but when I put the emission map the texture corrupts

Here's the original image for those trying to replicate the problem:

I am beginner about shaders and Unity

sentences:
Unity 2D, how to turn a bool true, after a set amount of time? I have an enemy working to damage the player when they stay in collision for too long, at the moment, the enemy will attack about 30 times per second, however I want there to be a delay between each enemy attack, here is my current code:

void OnCollisionStay2D(Collision2D col){

    if (col.collider.CompareTag ("Player") && canAttack == true) {
        player.Damage (enemyDamage);
        canAttack = false;
        //wait 3 seconds or so
        canAttack = true;
    }
}

sentences:
glDrawArrays (layered rendering using geometry shader) only draws one point I have been debugging this for a while but I can't seem to find the issue.

I created a framebuffer for layered rendering like this

GLuint buffer;
glGenFramebuffers(1,&buffer);
glBindFramebuffer(GL_FRAMEBUFFER,buffer);

glFramebufferTexture(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,textures[0],0);

GLenum blub[] = {GL_COLOR_ATTACHMENT0};

glDrawBuffers(1,blub);

where textures[0] is a 3D texture for layered rendering. The texture is texture complete, using nearest for min and mag filtering, no mip mapping, clamp to edge for s,t and r. I can sample from it fine (I initialize the texture to a color based on the z coordinate inside the 3d texture, it's initialized fine as well). The size of the 3D texture right now is 32x32x32 texels.

The framebuffer is framebuffer complete (checked it using glCheckFramebufferStatus).

Then I create and fill a buffer with vertex data for the points like this:

vector<vec2> points;
points.push_back(vec2(0.0f,0.0f)); //should draw in the middle
points.push_back(vec2(0.5f,0.5f)); //3/4th in each direction
points.push_back(vec2(-0.5f,-0.5f)); //opposite of second point
points.push_back(vec2(-0.95f,-0.95f)); //first texel on the bottom left

glGenBuffers(1,&result);

glBindBuffer(GL_ARRAY_BUFFER,result);
glBufferData(GL_ARRAY_BUFFER,points.size()*2*sizeof(float),&points[0],GL_STATIC_DRAW);

where vec2 is the vec2 floating point vector class provided by GLM.

Then I render it by doing this:

glViewport(0,0,textureSizeX,textureSizeY);
glBindFramebuffer(buffer);
glUseProgram(shader);
glBindBuffer(GL_ARRAY_BUFFER,_pointbuffer);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0,2,GL_FLOAT,GL_FALSE,0,0);
glDrawArrays(GL_POINTS,0,4);

where shader is a shader constructed from vertex, geometry and fragment shaders. It compiles fine without warnings. Depth and stencil testing are disabled. textureSizeX and textureSizeY are the width and height of the 3D texture.

Vertex shader:

#version 430

layout(location =0) in vec2 pos;

void main()
{
    gl_Position = vec4(pos.xy,0,1);
}

Geometry shader:

#version 430

layout(points) in;
layout(points, max_vertices = 1) out;

void main()
{
    gl_Layer = 0;
    gl_Position = vec4(gl_in[0].gl_Position.xy,1,1);
    gl_PointSize = 1.0f;

    EmitVertex();
    EndPrimitive();
}

Fragment shader:

#version 430

out vec4 outcolor;

void main()
{
    outcolor = vec4(0,1,0,0);
}

However, only the first point is drawn, as expected in the middle of layer 0 of the 3D texture. I can move around the coordinates of the first point and get the expected results. The points after the first point are always ignored, however. What am I doing wrong?

Hardware is GTX 770 with driver version 331.82 (latest version). Tested it on GT 555M (Notebook GPU), same results. The OpenGL device context is version 4.3.

edit: Tried so far: When I extend the attribute input of the vertex data to a vec4, and change the argument in glVertexAttribPointer accordingly, as expected the z and w components of the vec4 contain the coordinates of the second point, so the positions seem to be in memory as expected.

Similarly, if I change the offset using glVertexAttribPointer (e.g. putting (void*)(sizeof(vec2)*3) as the last parameter), the respective point is drawn.

Just to test if something may be wrong with the rasterization in general, I tried emitting triangles instead of points in the geometry shader. This works as expected.

sentences:
Unity - Water Cube (to 2D game) I wonder if you can create a cube of water within the unity!

I'm starting to use the Unity, and took a sought as to whether there was already something like this ... but have not found any tutorial

The idea is to use the 3D feature of water and turn it into a 2D scenario:

As shown below:

For this result:

The idea would be to make the cube of the material is "water".

Its possible?

sentences:
How can I manually draw a Sprite in Unity? I'm creating a simple workaround on the unsupported prefab-on-prefab.

I've thus created this simple class:

[ExecuteInEditMode]
public class PrefabLinker : MonoBehaviour
{
    public GameObject prefab;

    private GameObject spawn;

    void Awake ()
    {
        #if UNITY_EDITOR
        if (!EditorApplication.isPlaying)
            return;
        #endif

        spawn=(GameObject)Instantiate(prefab);
        spawn.transform.parent=transform.parent;
        spawn.transform.localPosition=transform.localPosition;
    }

    #if UNITY_EDITOR
    void Update ()
    {
        if (EditorApplication.isPlaying)
            return;

        // Manually draw the Sprite

    }
    #endif
}

However I've no clue on how to manually draw the Sprite, without adding it to the scene.
Obviously I can't add it to the scene like I do when I play it, because otherwise the spawn would be saved in the prefab, polluting it and creating a mess.

I'm hesitant to add the spawn to the scene "somewhere else" and updating its position, because I'd like to prevent the level designers from mistakenly move this spawn instead of the PrefabLinker object.

This only needs to work with 2D stuff. I've found this link which I guess does something similar to my needs, but I've no idea how to fix it to work with sprites (and doesn't work out of the box).

sentences:
Adding Google IAP License Key into Unity Games I have added Google Play Services and AdMob successfully into my app. But I want an in-app purchase button that lets you remove the adverts. (I have the button already but not the billing).

Google Developers Console tells me I need to input my app's specific license key into my app. The Android Manifest.xml to be specific. But it's not the clearest instructions. The Unity guide seems very lacking too, and mostly I can only find stuff about Unity IAP.

The Unity guide I did find tells me it makes the Manifest automatically and only tells me that I can write my own complete Manifest and import it over the top of the auto-made one.

I don't really want to do that if possible as I have just finished adding all the other Google stuff via Unity into the Manifest.xml

I'm sure this is a common feature that lots of devs use, so that makes me think there must be some way to do it via Unity.

sentences:
Libgdx Do a fixed rotation for orthographic camera I'm trying to rotate my OrthographicCamera in the render loop to a fixed angle, but I can only make the camera spin. This is the code that I have:

in create():

OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(true, 100, 100);
camera.position.set(50, 50, 0);
camera.update();

in the render loop:

camera.rotate(30);
camera.update();

The camera keeps spinning each frame. But I'd like the camera to stay at 30 degrees.

I have already seen this answer:

https://stackoverflow.com/questions/16509244/set-camera-rotation-in-libgdx

But I don't like it because this code is too drastic.
I wonder if there is a more "common" way to do this.

sentences:
Circle-Rectangle collision in a tile map game I am making a 2D tile map based putt-putt game.

I have collision detection working between the ball and the walls of the map, although when the ball collides at the meeting point between 2 tiles I offset it by 0.5 so that it doesn't get stuck in the wall. This aint a huge issue though.

  if(y % 20 == 0) {
    y+=0.5;
  }

  if(x % 20 == 0) {
    x+=0.5;
  }

Collisions work as follows

Find the closest point between each tile and the center of the ball
If distance(ball_x, ball_y, close_x, close_y) <= ball_radius and the closest point belongs to a solid object, collision has occured
Invert X/Y speed according to side of object collided with

The next thing I tried to do was implement floating blocks in the middle of the map for the ball to bounce off of. When a ball collides with a corner of the block, it gets stuck in it. So I changed my determineRebound() function to treat corners as if they were circles. Here's that functon:

   `i and j are indexes of the solid object in the 2d map array. x & y are centre point of ball.`
   void determineRebound(int _i, int _j) {
     if(y > _i*tile_w && y < _i*tile_w + tile_w) {
        //Not a corner
        xs*=-1;
      } else if(x > _j*tile_w && x < _j*tile_w + tile_w) {
        //Not a corner
        ys*=-1;
      } else {
        //Corner
        float nx = x - close_x;
        float ny = y - close_y;
        float len = sqrt(nx * nx + ny * ny);
        nx /= len;
        ny /= len;

        float projection = xs * nx + ys * ny;
        xs -= 2 * projection * nx;
        ys -= 2 * projection * ny;
      }
    }

This is where things have gotten messy. Collisions with 'floating' corners work fine, but now when the ball collides near the meeting point of 2 tiles, it detects a corner collision and does not rebound as expected.

I'm a bit in over my head at this point. I guess I'm wondering if I'm going about making this sort of game in the right way. Is a 2d tile map the way to go? If so, is there a problem with my collision logic and where am I going wrong?

Any advice/feedback would be great.

sentences:
How to handle "weapon slots"? I'm working on implementing an RPG engine, and I'm trying to figure out the best way to implement equipment.  The really tricky part is the hand slots.

It would be easy to give a character one hand slot for a weapon, and one off-hand slot for a shield.  But defining it that way would make it impossible to dual-wield, or to wield two-handed weapons.  Giving the character two generic "hand slots" would allow for dual wielding, two-handed weapons is where things get tricky.

The obvious way to equip a two-handed weapon is by filling both slots with the same object. But then I need special-case code for calculating stat bonuses (you can't simply sum all bonuses from all slots, because the weapon's values will get added twice) and for removal (you can't just clear the item from one slot).  If I only put the object in one slot, then calculating bonuses becomes easy again, but there needs to be special-case code to check whether the "empty" offhand slot is really empty or not.

Obviously I'm not the first person to face something like this. Two-handed weapons have been around in RPGs for decades.  Is there any elegant way to handle the logic involved?

sentences: Why do we have to resize the screen in LibGDX In a lot of the libgdx tutorials that I have took until now, I am told to resize the screen of the game using the SetToOrtho() of the orthographic camera. However, I don't get this part. Why do I have to resize the screen and make the sprites look bigger when I can just make the sprites themselves big at the first place?

sentences:
Call native code from Unity iOS build error I created NativeCallProxy.cs in Unity

    public class NativeCallProxy: MonoBehaviour
    {
        [DllImport("__Internal")]
        public static extern void iOSUnloadUnityGame();

        public static void UnloadUnityGame()
        {
#if UNITY_IPHONE
            // Now we check that it's actually an iOS device/simulator, not the Unity Player. You only get plugins on the actual device or iOS Simulator.
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                iOSUnloadUnityGame();
            }
#endif
        }
    }

and created two files in Assets/Plugin/iOS
NativeCallProxy.m

#import <Foundation/Foundation.h>
#import "NativeCallProxy.h"

@implementation UnityBridgeAPI
id<UnityBridgeNativeCallsProtocol> api = NULL;
+ (void) registerAPIForNativeCalls:(id<UnityBridgeNativeCallsProtocol>)proxy {
    api = proxy;
}
@end

and NativeCallProxy.h

#ifndef NativeCallProxy_h
#define NativeCallProxy_h

@protocol UnityBridgeNativeCallsProtocol
@required
- (void)unloadUnityGame;
@end

__attribute__((visibility("default")))
@interface UnityBridgeAPI: NSObject
+ (void) registerAPIForNativeCalls:(id<UnityBridgeNativeCallsProtocol>)proxy;
@end

#endif /* NativeCallProxy_h */

and when I try to compile exported project I get an error in Xcode.

How can I figure out it?

sentences:
Extrude only vertices where the assigned texture is transparent? I am looking at implementing a water surface on my spherical object and have created a texture with transparent pixels where the water should be. However, I am currently confused on how I can extrude only vertices where the texture is transparent. Do I have to test the texture at the appropriate position prior to assigning the vertex and just assign a Color.Transparent value to that vertex or am I thinking about this all wrong?

Special thanks to @Bram for helping me to answer some questions that could help clarify my specific situation.

What geometry do you extrude?

Individual vertices with a geometry, fragment, or hull shader.

What is the extrusion for?

To make waves in the water.

When I mention testing texels and then assigning colors to a vertex, I mean doing so beforehand when creating the Vertex[] object. This would be easy enough to do I suppose; I'd have to look into some samples of how to test the texture on the C# side, which is why I'd love to do it in a shader that has a similar flow as below:

Vertex Shader

Create the sphere.

Pixel Shader

Grab only vertices that have transparent pixels via TEXCOORD0.

Geometry/Fragment/Hull Shader

Extrude those vertices.

sentences:
Need help in determing what, if any, tools can be used to create a free Flash game Yes I proudly -and sadly- declare that I am a complete nincompoop when it comes to Flash, and I have been fishing around the big wide web for information. The reason for this is that I have been contracted to create a game(s) for a website -the usual flash-based games caveat. Please I do not mean things like by those gaming generator websites, I mean small yet professional games- but the caveat, as always, is that impossible dream: it needs to be done all for free. The budget...well imagine it as not there.

Annoyingly is that I am a game designer yes, but with a ridiculously tight deadline I haven't got much time to re-learn (ah the heady days of programming at uni) everything by the end of March, so I'd like to ask some people who know their stuff rather than keep looking at a gazillion different things.

This is my understanding: with the flash sdk you can create a game, albeit you need to be pretty programming savvy. FlashDevelop helps there -yet I am not entirely sure how. Yet even FD says to use Flash for the animation/graphics.

Yes its undeniably powerful but as I said there is the unattainable demand of no money. The million dollar question: what, if any, tools can I use to create a free flash game?

sentences:
How to count rotations or spins when using addtorque? I have a rigidbody and use 4 keys to addtorque in 4 different directions:

W adds torque positively along the X axis (pitch forward)
S adds torque negatively along the X axis (pitch backward)
A adds torque negatively along the Y axis (yaw left)
D adds torque postively along the Y axis (yaw right)

The rigidbody is able to rotate around/spin in any combination of these directions, but my issue is how can I count the number of rotations it has done in any given axis? Eg. if the player has completed 2 360 rotations to their left I would like to display "2 Left Spins" etc.

I have tried storing the eulerangles of each axis but this is no good as it resets after certain degrees.

I think the way it could work is on keydown reset a degrees counter, while the key is being held I could continue to store the change in rotation for that axis, and then on keyup I could divide this total number of degrees by 360. I'm not sure how to do this in C# though, or if this is the best way to do this.

How could I do this?

sentences:
Console vulnerabilities in javascript-based game Been toying around with a basic browser-based game for a while now, and getting deep into the vulnerabilities of client-side script. I know enough to understand that no client-side script is ever safe. Ever. But I don't fully understand to what degree.

Using, say, Chrome's developer tools, I know I can set variables at will - even Object.freeze and Object.seal can be overcome. I also know I can put in breakpoints at key points and use the console to read variable values. Now, let's say I have a function checkStep() that fires each time the player moves on the grid. It sends a blank ajax request, and the server returns only a boolean to signify if a random battle has started or not. If a user is able to rewrite/disable this checkStep(), they can effectively eliminate random battles. Is there a way to redefine or disable functions from the console command line? If you were bent on preventing this function from firing, how would you do it? Could you even do it?

EDIT Clearly I worded this poorly. Going to accept the current answer and re-post.

sentences:
How does a game's frame rate change for each missed vsync? I seem to remember reading somewhere that a game's frame rate is halved each time it misses a vsync. In other words, the number of frames per second decreases to 1/2, 1/4, and 1/8 the normal rate for the first, second, and third missed vysnc cycles (respectively) rather than to 1/2, 1/3, and 1/4 the normal rate.

Is this correct? If so, why?

sentences:
PHP and Javascript/HTML5 Collaboration I've recently been working on a fairly complicated game. I've stored information with local storage, but that allows the player to edit it, and does not transfer from computer to computer. The two scripts run on a single server, and I use the following to ping the php server:

function initiateLoginSequence() {
    var isnewplayer=prompt("Hello! Are you new?(Y/N)");
    if(isnewplayer.equalsIgnoreCase("N")) {
        var username = prompt("Enter username.");
        var password = prompt("Enter Password.");
        //parsing code goes here later.
    } else {
        var username = prompt("Enter a username. This will be used for future logins.");
        var password = prompt("Enter a password. This will be used for future logins.","*");
        var req = new XMLHttpRequest();
        req.open('POST', 'http://69.144.34.106/Scores.php', true);
        req.send("returning=false"+"&name="+username+"&pw="+password+"&level="+lvl+"&save=true");
        req.send();
    }
}

I then process the results with this:

<?php
   $returning=_POST["returning"];
   $save=_POST["save"]
   $password=_POST["pw"];
   $username=_POST["name"];
   $score=_POST["lvl"];
   $connection=mysql_connect("localhost:3306","****","*****");
   if($returning=="false" && $save=="true") {
     mysql_select_db("userdata",$connection);
     $sqlcmd = "CREATE TABLE ".$username."(
     Username varchar(".$username.")
     Password varchar(".$password.")
     Score varchar(".$score.")
     )";
     mysql_query($sqlcmd);
   } else if($save==false) {
     $sqlcmd="SELECT * FROM userdata"
     $result = mysql_query($sqlcmd);
     while($row=mysql_fetch_array($result)) {
        if($row['Username']==$username && $row['Password']) {
            echo row['Score'];
        }
     }
   } else if($save==true) {
     $sqlcmd="SELECT * FROM userdata"
     $result = mysql_query($sqlcmd);
     while($row=mysql_fetch_array($result)) {
        row['Username']=$username
        row['Password']=$Password
        row['Score']=$Score
     }
   }
?>

But after creating the mysql database, nothing is populated. So my basic question is, Am I doing this right? If not, what am I missing?

sentences:
What are the specifications for 3D animated game assets on the Android platform? (apologies if this is phrased vaguely due to my lack of knowledge; I'm happy to change the question entirely if someone can suggest a more realistic query)

I'm getting a grip on creating 3D characters in Lightwave, Maya, Blender, etc. My goal is to focus on creating creature & character animations specifically for games. I thought it would be a good exercise to make a few critters with a specific scope. As a non-programmer (I've written a few scripts, but I really don't have a passion to code) - can you point me in the right direction to find some guidelines? (I have a programmer handy who will write the code, but I want to be able to give him assets that are as usable as possible)

I assume that Android games are intended to run on limited hardware - maybe there's a polycount I should shoot for, or a particular memory limit? The resources I've found so far all seem to be helpful to developers - haven't found much oriented in my direction

sentences:
How do I code a 2D tile map? I'm new to game development and I want to know how to create a tile map. The map should be divided into squares, such that each square represents a location like x : 10, y : 10.

The width and height of the squares, as well as the number of squares, should be configurable.

How can I do this? (I'm using MVC .NET.

sentences:
How can I launch a GameObject at a target if I am given everything except for its launch angle? I am trying to launch an object at a target, given its position, its target position, the launch speed, and the gravity.  I am following this formula from Wikipedia:

$$ \theta = arctan \bigg( \frac{v^2 \pm \sqrt{v^4-g(gx^2 + 2yv^2)}}{gx} \bigg) $$

I have simplified the code to the best of my ability, but I still cannot consistently hit the target.  I am only considering the taller trajectory, of the two available from the +- choice in the formula.

Does anyone know what I am doing wrong?

using UnityEngine;

public class Launcher : MonoBehaviour
{
    public float speed = 10.0f;

    void Start()
    {
        Launch(GameObject.Find("Target").transform);
    }

    public void Launch(Transform target)
    {
        float angle = GetAngle(transform.position, target.position, speed, -Physics2D.gravity.y);
        var forceToAdd = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * speed;
        GetComponent<Rigidbody2D>().AddForce(forceToAdd, ForceMode2D.Impulse);
    }

    private float GetAngle(Vector2 origin, Vector2 destination, float speed, float gravity)
    {
        float angle = 0.0f;

        //Labeling variables to match formula
        float x = Mathf.Abs(destination.x - origin.x);
        float y = Mathf.Abs(destination.y - origin.y);
        float v = speed;
        float g = gravity;

        //Formula seen above
        float valueToBeSquareRooted = Mathf.Pow(v, 4) - g * (g * Mathf.Pow(x, 2) + 2 * y * Mathf.Pow(v, 2));
        if (valueToBeSquareRooted >= 0)
        {
            angle = Mathf.Atan((Mathf.Pow(v, 2) + Mathf.Sqrt(valueToBeSquareRooted)) / g * x);
        }
        else
        {
            //Destination is out of range
        }

        return angle;
    }
}

sentences:
Shader to render objects with distance independent size I am trying to find a way to render certain objects in my 3d scene without the effects of the perspective projection. E.g. I want them to have the same pixel dimension independent of distance to the camera or the dimensions of the viewport.

Here is what I tried in the vertex shader so far

uniform vec2 screen_size;

varying float camera_distance;

void main() {
    mat4 mvp = projectionMatrix * modelViewMatrix;

    float scaleFactor = 2.0 * 50.0 / screen_size.x;
    float w = (mvp * vec4(0.0, 0.0, 0.0, 1.0)).w;
    w = w * scaleFactor;

    gl_Position = mvp * vec4(position.xyz * w, 1.0);
}

So far no luck.

sentences:
OpenGL ES multiple objects not being rendered I am doing the following to render multiple balls move around the screen but only 1 ball is seen to appear and function. I don't know why the rest (count-1) balls are not being drawn

public void onDrawFrame(GL10 gl) {
        // TODO Auto-generated method stub
        gl.glDisable(GL10.GL_DITHER);
         gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
         gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glClientActiveTexture(DRAWING_CACHE_QUALITY_HIGH);
         gl.glLoadIdentity();
         for(int i=0;i<mParticleSystem.getParticleCount();i++){
            gl.glPushMatrix();
                  gl.glTranslatef(mParticleSystem.getPosX(i), mParticleSystem.getPosY(i), -3.0f);
                  gl.glScalef(0.3f, 0.3f, 0.3f);
                  gl.glColor4f(r.nextFloat(), r.nextFloat(), r.nextFloat(), 1);
                  gl.glEnable(GL10.GL_TEXTURE_2D);
                  mParticleSystem.getBall(i).draw(gl);
            gl.glPopMatrix();

         }

    }

Here is  my void draw(GL10 gl) method

public void draw(GL10 gl){

gl.glEnable(GL10.GL_CULL_FACE);
gl.glEnable(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
//  gl.glTranslatef(0.2f, 0.2f, -3.0f);
//  gl.glScalef(size, size, 1.0f);

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

}

I couldnt take the snapshot on my Samsung Phone but here is the emulator screenshot. In reality, the ball moves around with change in orientation and acceleration and keeps changing color randomly (due to r.nextFLoat()) . However, the other 35 balls arent even being rendered as you can see. How can I fix this?

sentences:
Why does Assimp appear to be loading vertices in the incorrect order in this code? I'm getting a weird bug in my code that is reading in the vertices from an .obj file.

The .obj file is just a cube, hence there are eight vertices. When I print out the vector it seems to work perfectly up until the 5th vertex, and then it seems to read the last 3 backwards.

This is the file:

# Blender v2.69 (sub 0) OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v 2.000000 -2.000000 -2.000000
v 3.000000 -3.000000 3.000000
v -4.000000 -4.000000 4.000000
v -5.000000 -5.000000 -5.000000
v 6.000000 6.000000 -6.000000
v 7.999999 7.000000 7.000001
v -8.000000 8.000000 8.000000
v -9.000000 9.000000 -9.000000
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8

This is my code:

m->vertices = new glm::vec3[m->numVertices];
for (GLuint i = 0 ; i < m->numVertices ; i++) {
    const aiVector3D* pPos = &(mesh->mVertices[i]);
    m->vertices[i] = glm::vec3 (pPos->x, pPos->y, pPos->z);
    std::cout << "X:" << m->vertices[i].operator[](0) << " Y:" << m->vertices[i].operator[](1) << " Z:" << m->vertices[i].operator[](2) << std::endl;
}

However this is what is stored in the vector (what the above code prints out):

X:2 Y:-2 Z:-2
X:3 Y:-3 Z:3
X:-4 Y:-4 Z:4
X:-5 Y:-5 Z:-5
X:6 Y:6 Z:-6
X:-9 Y:9 Z:-9
X:-8 Y:8 Z:8
X:8 Y:7 Z:7

As you can see the last three lines are messed up, I have no idea how this is happening in the loop.

sentences:
Can I use real currency name/symbol as an in-game currency? Can I use a real currency name (i.e USD, PKR) or symbol ($, Rs.) for my in-game currency with the same exchange value as original currency? I couldn't find anything about it in google play store policies neither in government websites.

Of course I have other options, I can call it gold or silver etc but I'm just wondering if it is allowed or not.

sentences:
Sphere turns to ellipsoid further away from origin (OpenGL ES 2, Android) I'm not even sure what code to share, but maybe someone's been in a similar situation or has a good suggestion.

I'm basically rendering a sphere in the middle of the screen (placed at (0, 0, 0)) and it looks fine. However, if I choose to render the same sphere further away from the origin, it gets an egg shape. I think the egg shape is in the direction of the translation. Here's the code that sets up the model matrix:

Matrix.setIdentityM(mModelMatrix, 0);
Matrix.scaleM(mModelMatrix, 0, 0.15f, 0.15f, 0.15f);
Matrix.translateM(mModelMatrix, 0, 0, 0, distance);

When distance = 0, the sphere shows up normally, however if distance = -1.5f, then the sphere is sort of stretched on the z axis. Any suggestions for fixing this behavior?

sentences:
Still i can't make the cross hair to be in the middle of the screen, What am i missing? In the editor i did:

GameObject > UI > Image

On the Canvas i changed the Render Mode to Screen Space - Camera.

It created a Canvas and a child Image in the Hierarchy.
Then i changed the Image source to UISprite changed the color to red also added to it a material in red.

I can't changed the Canvas anchors not sure why.

The Image rect transform anchors is set to the center.

I don't have a Main Camera the only camera i have is on the FirstPersonController (The FirstPersonController is a child of a FPSController).

But still the red dot/circle is a bit to the left not in center.

Screenshot of the Canvas:

And two screenshots of the Image:

And

sentences:
Planar shadow matrix and plane b value I implemented planar shadows with the function D3DXMatrixShadow.

As you know, we need plane and light factor to calculate a shadow matrix.

The problem is that when I set the plane as D3DXPLANE p(0, -1, 0, 0.1f), the shadows by directional light are correctly rendered, but the shadows by point light are not rendered.

However, if I use D3DXPLANE p(0, 1, 0, 0.1f), the situation is reversed, shadows by directional light are not drawn, the shadows by point light are ok.

I cannot understand why it happens. Is it normal or am i missing something? Please explain to me why this happens.

Thanks in advance.

Code

//main.cpp
ID3D10EffectTechnique* oldTech = meshes[i]->technique;

D3DXPLANE groundPlane(0, -1, 0, 0.01f);
D3DXMATRIX S;//shadow matrix
D3DXVECTOR4 light;
if(lightType != 2) //2 here means point light
{
    light.x = lightDirection.x;
    light.y = lightDirection.y;
    light.z = lightDirection.z;
    light.w = 0;
}
else
{
    light.x = lightPosition.x;
    light.y = lightPosition.y;
    light.z = lightPosition.z;
    light.w = 1;
    groundPlane.b = 1;
}

D3DXMatrixShadow(&S, &light, &groundPlane);
D3DXMATRIX W = meshes[i]->GetWorldMatrix();
D3DXMATRIX matWorld = W * S;

meshes[i]->technique = shadowTechnique;
meshes[i]->render(&matWorld);
//Meshes here are drawn by ID3DX10Mesh,
//but I tested other code with LPD3DXMESH, it has the same problem.

meshes[i]->technique = oldTech;

 //shader code(.fx file)
 PS_Input VS_Shadow(VS_Input input)
 {
    PS_Input output = (PS_Input)0;
    output.pos = mul(float4(input.pos, 1), matWorld);
    output.pos.y = 0.1;
    output.pos = mul(mul(output.pos, matView), matProjection);
    output.normal = mul( input.normal, (float3x3)matWorld );
    output.color = input.color;
    output.worldPos = (float3)mul(input.pos, matWorld);
    output.tex = input.tex;
    return output;
 }

 float4 PS_Shadow( PS_Input input) : SV_Target
 {
    return float4(0,0,0,0.5f);
 }

 DepthStencilState StencilIncreaseOnce {
    DepthEnable = true;
    DepthWriteMask = ALL;
    DepthFunc = LESS_EQUAL;

    StencilEnable = true;
    FrontFaceStencilFunc = EQUAL;
        FrontFaceStencilPass = INCR;
    FrontFaceStencilFail = Keep;
 };

 BlendState BlendAlpha {
    AlphaToCoverageEnable = FALSE;
    BlendEnable[0] = TRUE;
    SrcBlend = SRC_ALPHA ;
    DestBlend = INV_SRC_ALPHA ;
    BlendOp = ADD;
    SrcBlendAlpha = ONE;
    DestBlendAlpha = ZERO;
    BlendOpAlpha = ADD;
    RenderTargetWriteMask[0] = 0x0F;
 };

 technique10 ShadowRender
 {
    pass P0
    {
        SetVertexShader( CompileShader( vs_4_0, VS_Shadow() ) );
        //SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, PS_Shadow() ) );

        SetDepthStencilState( StencilIncreaseOnce, 0x0 );
        SetBlendState( BlendAlpha, float4( 0.0f, 0.0f, 0.0f, 0.0f ),
                   0xFFFFFFFF ); //blendState, blendFactor, sampleMask
    }
 }

sentences:
cocos2d: syncing CCAnimation frames with Box2d Shape manipulations my cocos2d game currently has a ccsprite attached to a box2d body.
during the game i apply different CCAnimations on my sprite, i would like to perform certain manipulations to the box2d body according to the frame currently displayed by the sprite (change rotation of the body, etc.) my current idea on implementing this is to subclass ccsprite and change the setDisplayFrame implementation but i thought somebody here probably did the same and already has a solution, so any suggestions on how to implement this?

thanks!

sentences:
Why is my OpenGL 4.1 shader not working on OS X Macbook ( works on Linux )? I've recently rebuild shaders for my program and it stopped "working" ( black screen ) on OS X ( El Capitan ), but it's ok on Linux. What could be the cause?

There are no shader compilation errors, and here is my shader code:

https://github.com/Marqin/YuriaViewer/blob/master/vertex.glsl

Keep in mind that this software worked on El Capitan with OpenGL 4.1 before shader rewrite. Here are my glfw hints:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

My program also is checking for GL_ARB_gpu_shader_fp64 and it's available on my Macbook ( Macbook Air 2013 mid ).

EDIT1:

I've "debugged" it a little and it looks that i is always lesser than vis on OS X, that's why it's black.

EDIT2:

I made a simple test - I've typed all uniform values in shader by hand and now it wasn't black, but I've got some gibberish on screen. Then I've changed every dvec3 and dvec2 to float versions and it showed nice fractal. So it looks like double is not working on OS X. But how can it be? It's saying that GL_ARB_gpu_shader_fp64 is available and it even doesn't complain when I request it in vertex shader.

EDIT3:

It works on iMac with R9 M395. So it's problem with Intel hardware ( or problem with OS X Intel driver ).

sentences:
box2D and libgdx: Attach ParticleEffect to Body Hello I am a newbie with libgdx, my question is: how could I add a Particleeffect to a Body that is moving? I searched about the matter and I didnt find anything related to it.

I have the following code to add my ball:

public Body createThrowedBall(float x, float y) {

    Gdx.app.log("createThrowedBall", "("+x+","+y+")");

    BodyDef ballDef = new BodyDef();
    ballDef.type = BodyType.DynamicBody;
    ballDef.position.set(x,y);

    CircleShape shape = new CircleShape();
    shape.setRadius(5.5f);

    FixtureDef fixtureDef= new FixtureDef();
    fixtureDef.shape = shape;
    fixtureDef.density = 1f;
    fixtureDef.friction = 0f;
    fixtureDef.restitution = 0f;
    fixtureDef.filter.groupIndex = -1;

    Body body = world.createBody(ballDef);
    body.createFixture(fixtureDef);
    shape.dispose();

    // note the massive impulse vector

    body.applyLinearImpulse(new Vector2(0, 5500), new Vector2(x,camera.viewportHeight), false);

    return body;
}

That draws a simple circle shape that is throwed up. I want to add like a fire effect burning during the throw ( I did it with the Particle Editor) but I dont know how to attach it.

sentences:
Underwater Shader Animation Help I found an underwater (distort) effect and I got it to work but somehow I cannot make it animate given the offset here:

Fragment Shader code:

uniform sampler2D fbo_texture;
uniform float offset;
varying vec2 f_texcoord;

void main(void) {
  vec2 texcoord = f_texcoord;
  texcoord.x += sin(texcoord.y * 4*2*3.14159 + offset) / 100;
  gl_FragColor = texture2D(fbo_texture, texcoord);
}

Original Source here

sentences:
Quaternion.LookRotation() not rotating 360 degrees In my scene I have two cubes one has a tag "Respawn" and another one has the following script attached:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

    void Update () {
        transform.rotation = Quaternion.LookRotation (
            GameObject.FindGameObjectWithTag("Respawn").transform.position
        );
    }
}

When I run it and move around my second cube with "Respawn" tag the first cube doesn't always looks at it, at certain point it just starts rotating the opposite side as if it has bounds to it's rotation. What am I doing wrong?

sentences:
Use of FlxG.camera.follow to follow a character vertically I am developing a prototype for a game in Flixel in which a character floats upward continually to traverse the level. I would like to have a "tall" layout for levels and set the FlxG.camera to follow the character as he floats upward. My issue is in understanding the proper use of FlxG.camera. I have my game constructor coded as follows:

package
{
    import flash.display.Sprite;
    import org.flixel.*;

    [SWF(width="640",height="480",backgroundColor="#000000")]
    public class MyGame extends FlxGame
    {
        public function MyGame()
        {
            super(320,240,PlayState,2);
            forceDebugger = true;
        }
    }
}

In the override of create() in the PlayState.as file I attempt to set the camera to follow the player as follows:

public var TheClimber:BalloonHero;

        override public function create():void
        {
            /*set background color*/
            FlxG.bgColor = FlxG.BLUE;

            /*Set data for player*/
            TheClimber = new BalloonHero(FlxG.width/2-5,480);

            /*Add camera and set it to follow The Climber*/
        //which will automatically set the boundaries of the world.
        FlxG.camera.setBounds(0,1280,640,1280,true);
        FlxG.camera.follow(TheClimber,FlxCamera.STYLE_PLATFORMER);

            /*add player to the game*/
            add(TheClimber);
        }

I assumed this would set the camera bounds to twice the height of the SWF background(i.e. the FlxG height) and then scroll the background along with the specified FlxObject(TheClimber in this case) until it had reached the height of the game. However, I must be going about it incorrectly because when the zoom is 2 and the game height 720 the camera starts at the top of the screen with the player character not visible at the bottom of the game height.
Is there a way to start with the camera/game focused on the bottom of the game object(FlxG.height) ? Or am I going about this the wrong way and have other issues with the way I am using the camera? Thanks in advance.

sentences:
Effecient tilemap rendering I have done mostly tile based games, but never really bothered with optimization. I always just rendered all the tiles that convered the viewport.
I am currently working on platformer for a mobile device, which has some performance issues, ecspecially when using multiple layers of tiles.

Most tiles are pretty static without animations. I wouldn't really have to render them each frame. The clear() -> draw() loop is really printed into my brain, I'm having a hard time thinking how the handle rendering without clearing the screen each frame.

I'm currently doing this:
 - start game, render screen once
 - Once a tile changes, save this in a "tile_changed" array
 - Each frame, re-render all the changed tiles and clear the array

This works pretty fine, and there is a notable boos in performance. However, there are a view issues
 - The PlayN framework offers no way to "erase" drawn items. Whenever I want to erase a single tile I have to completely clear the screen and redraw every tile. (PlayN SurfaceLayer). I'm using a scroll background, so can't just fill an empty tile with the background color.
I can imagine low level libraries like opengl having this same issue, do they use some sort of workaround for this?

I'm not sure how to recognize when new tiles come into the screen whenever the camera moves. I would normally just render the tiles in view each frame, so this never posed a problem.
I have no idea if having such a big drawn rendertarget in memory is a good idea. The player could have walked across a huge map and have thousands of tiles drawn. Should I worry about this?

Any other optimiztions that I'm missing are appreciated.

The awnsers note that most engines draw all tiles every frame. But I know that on some less powerfull platforms this is not the case. I believe flashpunk is using some sort of buffer that only draws new tiles when you make changes in the grid.
Unfortunately this is not possible for me because I have no way of clearing a single tile without clearing the entire buffer.

I'm looking into optimazations like this, which enable me to have a very large amount of tiles on the screen.

sentences:
How to efficiently handle registration/anchor points for graphics? I am currently working on an iPhone project, but most of my work has been in Flash. Flash has a feature where you can place a bitmap into a MovieClip, set its registration point with the mouse and it's automatically adopted. It's one of the lovelier Flash features.

Now I'm doing iPhone stuff, using TexturePacker for importing the graphics, and I'm having to write code like this:

if(graphic == "spikes1") setAnchorPoint(ccp(1, 0));
if(graphic == "spikes2") setAnchorPoint(ccp(.5f, 0));
if(graphic == "spikes3") setAnchorPoint(ccp(.5f, 0));
if(graphic == "spikes4") setAnchorPoint(ccp(.5f, 0));

if(graphic == "bush-a") setAnchorPoint(ccp(.5f, .25f));
if(graphic == "bush-b") setAnchorPoint(ccp(.5f, .25f));

if(graphic == "tree1") setAnchorPoint(ccp((float)134/209, (float)34/202));
if(graphic == "tree2") setAnchorPoint(ccp((float)96/236, (float)31/184));

I can obviously use macros or functions to shorten this a little, but is there a more intelligent way to go about this?

How do professional platformer games (on consoles and PC) handle this?

sentences:
Can't parent the standard FPSController during gameplay I'm parenting the standard assets FPS controller during play with a simple script. The controller get's parented but also instantly inherits the rotation of the parent. This doesn't happen in Editor mode. This incorrect behavior happens regardless if I move the player with a script or by parenting him with my mouse cursor.

I suspect the error comes from the way the character controller script is set up.

In the FPS controller script the player rotates via mouse movement in the Update function in the following way:

private void Update()
{
    RotateView();
}

private void RotateView()
{
    m_MouseLook.LookRotation (transform, m_Camera.transform);
}

m_MouseLook get's its rotation from m_Camera.transform. It in turn uses transform.localPosition.

I think it's the use of localposition that causes the strange behavior.

How do I fix it?

I added the script that I used to re-parent the fps controller below:

    public Transform ParentTarget;
    public GameObject player;

     void OnTriggerEnter(Collider other)
    {
        player.transform.SetParent(ParentTarget, true);
    }

     void OnTriggerExit(Collider other)
    {
        player.transform.parent = null;
    }

As I said the script is fairly simple and the same error happens when I re-parent the controller by dragging it with my mouse during play.

If I set worldPositionStays to false then the player is offset and doesn't inherit the parent rotations at all. This isn't what I want.

Here is my scene before the player steps unto the trigger. The red box is the trigger. The blue box is the new parent (the parent is rotated 45 degrees)

Here is the original incorrect behavior. The player is instantly rotated 45 degrees as he steps unto the trigger. This is wrong

Here is the behavior when worldPositionStays is set to false. Rotating the parent has no effect. This is wrong.

The desired behavior is to keep the player rotation, and then change it as the parent is rotating after the re-parenting event. This is what would happen if I re-parented any ordinary GameObject.

It is the character controller mouse look part that is most likely causing all the trouble.

I suspect I have to abandon the re-parenting solution and simply add the transforms to the camera mouse look part of the character controller script.

I would be very grateful is someone more knowledgeable would help me out with achieving this. Hopefully by getting re-parenting to work, since it is simpler, and simplicity is always king. I would settle for help with writing a script to add rotations and positions correctly to the controller.

sentences:
Ray casting fails when it shouldn't I have two objects that should collide. My player should stand on a ship. The position where my player stands, is exactly on the edge of two adjacent triangles (in the ship's model). To Check for collision, I'm using ray picking. I cast a ray from the player's hips downwards. This intersection tells me if the player should be falling (no collision), or if there is a floor under his feet (collision).
In some occasions, the ray is fired exactly between two triangles, causing the ray to not collide, causing the player to fall through the floor.

I've solved this in my "RayIntersectsTriangle" function by slightly increasing the triangle's size. It feels hacky, and like it's bad practice.

I realise I could also solve this by casting multiple rays from the player downwards, and check if at least one collides. But obviously, this consumes more operations, and also feels like it should not be the way to do it.

FYI: The RayIntersectsTriangle function definitely works, no question. I'm just wondering if floating point precision is messing this up.

Is there a way to make sure that a raycast can never pass between two triangles in a mesh due to floating point errors, or should I make a workaround like I did?

sentences:
ResolutionException: Cannot find candidate artifact for com.google.android.gms:play-services-games:8.1+ Getting this error:

  ResolutionException: Cannot find candidate artifact for
  com.google.android.gms:play-services-games:8.1+
  Google.JarResolver.PlayServicesSupport.DependOn (System.String group,
  System.String artifact, System.String version)
  GooglePlayGames.BackgroundResolution.AddDependencies () (at
  Assets/GooglePlayGames/Editor/BackgroundResolution.cs:53)
  GooglePlayGames.BackgroundResolution..cctor () (at
  Assets/GooglePlayGames/Editor/BackgroundResolution.cs:45) Rethrow as
  TypeInitializationException: An exception was thrown by the type
  initializer for GooglePlayGames.BackgroundResolution
  System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor
  (RuntimeTypeHandle type) (at
  /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs:101)
  UnityEditor.EditorAssemblies.ProcessEditorInitializeOnLoad
  (System.Type type) (at
  C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:123) Rethrow
  as TargetInvocationException: Exception has been thrown by the target
  of an invocation. System.Reflection.MonoCMethod.Invoke (System.Object
  obj, BindingFlags invokeAttr, System.Reflection.Binder binder,
  System.Object[] parameters, System.Globalization.CultureInfo culture)
  (at
  /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:519) System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
  System.Reflection.Binder binder, System.Object[] parameters,
  System.Globalization.CultureInfo culture) (at
  /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:528) System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters)
  (at
  /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/ConstructorInfo.cs:77)
  System.Activator.CreateInstance (System.Type type, Boolean nonPublic)
  (at
  /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:372) System.Activator.CreateInstance (System.Type type) (at
  /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:254) UnityEditor.AssetPostprocessingInternal.GetMeshProcessorVersions ()
  (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:145)
  UnityEditor.AssetPostprocessingInternal:GetMeshProcessorVersions()

How to solve this?

sentences:
How to map changing stances (southpaw/orthodox) to gamepad controls? I am developing a third person hack n slash style game which features a variety of melee and projectile weapons as well as unarmed combat. The player will be able to dual wield any combination of the above weapons eg. a sword and a pistol, or a knife and a bare fist. I'm trying to work out the gamepad controls based on the game mechanics, but I've come to a dilemma regarding the movesets.

Originally I had the left and right triggers mapped as the left and right hand attacks. However, some of the attack moves that I have planned involve the player taking a step forward. Meaning they may have started in orthodox stance (left foot forward) but will end up in southpaw (right foot forward). For some weapons like firearms the stance makes no difference, since the attacks will be the same from either. But for some melee weapons and especially for unarmed combat this is a significant difference. For example, from orthodox stance the left trigger should logically do a jab attack from the front hand, while the right trigger should do a straight punch attack from the back hand. If the player now does a lunging attack in which they take a step forward, they end up with their other foot infront, meaning that now the left trigger cannot do a jab but must perform a straight punch since the left hand is no longer in front.

So the question is how to resolve this without having a controls system that confuses the player. There are a few options I have considered after studying other games, but I am looking to see if a better alternatives exists.

1) Seen in Elder Scrolls, Dark Souls, Tekken:

Use 2 attack buttons but have the player always stay in a single stance. This way they the left and right limbs will always perform the same move. The downside of this is that attacks which would normally leave the player in another stance have to either be avoided or the animation has to include the player returning to their original stance. While this solves the problem it can look unrealistic.

2) Seen in DOA, VF:

Use only 1 attack button, instead of one for each limb. This will mean that the stance of the player is irrelevant since a single button will play the correct attack animation of either the left limb or right limb depending on the stance. While this is more realistic it makes it difficult to have dual wielding weapons with only one button controlling both. For example, consider if a pistol and sword are being dual wielded, the left trigger may swing the sword while the right trigger may fire the pistol; but if both weapons are mapped to only the right trigger what attack should happen? The sword, the pistol, both? Here lies the problem.

3) Seen in MK:

Use 2 attack buttons which refer to the front or back limb, not the left or right limb. This method allows for the player to switch stances, since for example the left trigger may refer to the front hand irrespective of which stance the player is in. In a side scrolling game this may not be a problem, but in a third person game where the camera is behind the player, I am concerned that this type of controls will be confusing. Especially since the convention (correct me if I'm wrong) for dual wielding seems to be that the left and right triggers control the left and right weapons/limbs.

So are these the only options, or is there a better way of mapping the controls for this use case?

sentences:
Sync clocks on a real time multiplayer game - Is this ok? I'm developing a multiplayer game through Gamecenter in unity with prime31 plugin. This is how I sync the clocks of the two players (right now there will only be 2 player in one match), and I wanted to now if it's ok:

This is done one time at the start of the match.

I have device A and device B.
Device A resets it's game clock to 0.0f.
A sends a reliable message to B saying that A has reset it's game clock.
B recieves the message and resets his game clock as well and sends a message to A saying he has also reseted the clock.
A recieves the message and does the following.

float delayAtoB = getCurrentTime() / 2;
setGameClock(delayAtoB);

delayAtoB is actually this the time it took to get to B, so right now the two devices have the same clock. It works ok, but I wanted some opinions because I'm not sure if it's the best way and some exceptions might ocur..

sentences:
How do I make my character jump in any angle? My character is a square which can spin in any angle but it can not jump in certain angle.

Can anyone help?

public class Player: MonoBehaviour {

  public float maxspeed = 10f;
  bool facingRight = true;

  Animator anim;

  bool grounded = false;
  public Transform groundCheck;
  float groundRadius = 0.2f;
  public LayerMask whatIsGround;
  public float jumpFocre = 500f;

  bool doubleJump = false;

  void Start ()
  {
    anim = GetComponent<Animator> ();
  }

  void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    if (grounded)
      doubleJump = false;

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
  }

  void Update()
  {
    if((grounded || !doubleJump) && Input.GetKeyDown ("up"))
    {
      anim.SetBool("Ground", false);
      GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpFocre));

      if(!doubleJump && !grounded)
        doubleJump = true;
    }
  }

  void Flip()
  {
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
  }
}

sentences:
Endless runner game: Dynamic world vs Static world I've seen a lot of tutorials on how to build infinite runners and came up with a question about game optimization.

This types of games are built on two ways, according to my research; these are:

Set the player and camera static. Usually on the origin of the world space, and have all the environment assets created on the distance and move them towards the user.
The environment assets are created on a straight line to infinity and the player and the camera both move forward until the player loses. This means the environment's position will not be changed once they are created.

My question arises from here. Which of the two involves less calculations? Which one gives the player a better feel of movement? Is the difference actually significant (in terms of performance) or is it just a trivial question?

sentences:
How do I make a 2D game resolution independent? I'm working on a simple 2D game. I've finished the mobile phone version.

However, my boss wants the game to works on his RT.
I'm doing the "conversion" but my buttons are in the wrong places, because I hard-coded the screen size, like this:

 texture = game.Content.Load<Texture2D>("StartScreen");
 mainFrame = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height);

 // button definitions
 startbrect = new Rectangle(300, 258, 88, 88);
 startbtext = game.Content.Load<Texture2D>("bplay");

In this example, mainframe is fine, but startbrect isn't, because I defined the size to match a Windows phone's screen.
How can I handle responsive design when all Windows 8 phones' screens are different? Is there a formula or macro to calculate each time the good size?

sentences:
sfml/opengl, two objects of same class are sharing variables whenever I use the none-default constructor, it only adds to the coordinates of the previous class(in an array)

wall_1x1 wall[2] = {
    wall_1x1(0, -2, 0), //first argument is x, second z, and third ry
    wall_1x1(1, -2, 0)
};

the second object in the array will be behind the first object(by -2 z) and if I give the first object an ry of 90, all the other objects will have the same rotation.

#pragma once
#ifndef WALL_1X1_H

#include <GL\glew.h>
#include <SFML\Graphics.hpp>

class wall_1x1 {

public:
  wall_1x1();
  wall_1x1(float x, float z, float ry);
  ~wall_1x1();
  void up();

private:
  float m_x;
  float m_z;
  float m_ry;
  GLuint tex;
  sf::Image data;
};

#endif

and the .cpp class:

#include "wall_1x1.h"

GLfloat verts[] = {
  0, 0, 0,
  1, 0, 0,
  1, 1, 0,
  0, 1, 0
};

GLfloat coords[] = {
  0, 0,
  2, 0,
  2, 2,
  0, 2
};

wall_1x1::wall_1x1() {
  m_ry = 0;
  m_x = 0;
  m_z = 0;
}

wall_1x1::wall_1x1(float x, float z, float ry) {
  m_ry = 0;
  m_x = 0;
  m_z = 0;

  m_x = x;
  m_z = z;
  m_ry = ry;

  data.loadFromFile("wall1.png");

  glGenTextures(1, &tex);
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexImage2D(
    GL_TEXTURE_2D,
    0,
    GL_RGBA,
    data.getSize().x,
    data.getSize().y,
    0,
    GL_RGBA,
    GL_UNSIGNED_BYTE,
    data.getPixelsPtr());
}

wall_1x1::~wall_1x1() {
}

void wall_1x1::up() {
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  glVertexPointer(3, GL_FLOAT, 0, verts);
  glTexCoordPointer(2, GL_FLOAT, 0, coords);
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  glTranslatef(m_x, 0, m_z);
  glRotatef(m_ry, 0, 1, 0);
  glDrawArrays(GL_QUADS, 0, 4);
  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}

and the important parts in main:

wall_1x1 wall[2] = {
    wall_1x1(0, -2, 0),
    wall_1x1(1, -2, 0)
};
....

wall[0].up();
wall[1].up();

sentences:
Approach to implement space junk Ogre3D

I would like to put some space junk in my game environment. Make it look like the first 2 search results. Those junks don't need to be interactive. Just need to have a 3D junk circling around the earth.

Can the community give some suggestion on how to implement this? Should I use particle in Ogre3D or create entities for those junks, or any other approach? If using particle, how should I make the object still and spread out around the earth? Thanks.

sentences:
How to implement 2d collision detection that is immune to low framerate and fast movement? I am trying to implement my own collision detection for a 2.5d voxel style platformer using Three.js.
I have a problem with my implementation - if the framerate is too low or the character is moving too fast (usually when falling from high places) it falls right through. Is there a way to improve collision detection to be immune to problems like this?

This is how I detect collisions:

function render(){
    requestAnimationFrame(render);

    setVelocity();
    animate();
    manageCollisions();

    renderer.render(scene, camera);

}

function manageCollisions(){
//Check every game object for collision -> TODO: implement broad phase when dealing with many objects
for(i=0; i < world.length; i++){

    //Check for bottom collision <- ALWAYS check (unless moving up)
     if(velocityY<0) {
        if( (character.position.y - character.height/2) < (world[i].position.y + world[i].height/2)
            && (character.position.y + character.height/2) > (world[i].position.y + world[i].height/2)
            && (character.position.x + character.width/2) > (world[i].position.x - world[i].width/2)
            && (character.position.x - character.width/2) < (world[i].position.x + world[i].width/2))
        {
            console.log("bottom collision " + i);

            velocityY=0;
            jumped=false;
            grounded = true;

            character.position.y = world[i].position.y + world[i].height/2 + character.height/2 - 0.1; //-0.1 prevents shaking
        } else {
            grounded = false;
        }

    }

    //Check for right collision <- ONLY if moving right (velocityX is positive)
    if(velocityX > 0){
        if( (character.position.y) < (world[i].position.y + world[i].height/2)
            && (character.position.y + character.height/2) > (world[i].position.y - world[i].height/2)
            && (character.position.x + character.width/2) > (world[i].position.x - world[i].width/2)
            && (character.position.x - character.width/2) < (world[i].position.x - world[i].width/2))
        {
            console.log("right collision" + i);
            velocityX=0;
            character.position.x = world[i].position.x - world[i].width/2 - character.width/2;
        }
    }

    //check for left collision <- ONLY if moving left (velocityX is negative)
    if(velocityX < 0){
        if( (character.position.y) < (world[i].position.y + world[i].height/2)
            && (character.position.y + character.height/2) > (world[i].position.y - world[i].height/2)
            && (character.position.x - character.width/2) < (world[i].position.x + world[i].width/2)
            && (character.position.x + character.width/2) > (world[i].position.x + world[i].width/2))
        {
            console.log("left collision" + i);
            velocityX=0;
            character.position.x = world[i].position.x + world[i].width/2 + character.width/2;
        }
    }

    //check for top collision <- ONLY if moving up (velocityY is positive)
    if(velocityY > 0){
        if( (character.position.y + character.height/2) > (world[i].position.y - world[i].height/2)
            && (character.position.y - character.height/2) < (world[i].position.y - world[i].height/2)
            && (character.position.x + character.width/2) > (world[i].position.x - world[i].width/2)
            && (character.position.x - character.width/2) < (world[i].position.x + world[i].width/2))
        {
            console.log("top collision" + i);
            velocityY=0;
            character.position.y = world[i].position.y - world[i].height/2 - character.height/2;
        }
    }

}

}

sentences:
Understanding how texCUBE works and writing cubemaps properly into a cube rendertarget My goal is to create accurate reflections, sampled from a dynamic cubemap, for specific 3d objects (mostly lights) in XNA 4.0.

To sample the cubemap I compute the 3d reflection vector in a classic way:

    half3 ReflectionVec = reflect(-directionToCamera, Normal.rgb);

I then use the vector to get the actual reflected color:

    half3 ReflectionCol = texCUBElod(ReflectionSampler, float4(ReflectionVec, 0));

The cubemap I am sampling from is a RenderTarget with 6 flat faces.

So my question is, given the 3d world position of an arbitrary 3d object, how can I make sure that I get accurate reflections of this object, when I re-render the cubemap. Should I build the ViewProjection matrix in a specific way? Or is there any other approach?

sentences:
How do I reference one game object in a script attached to another? This is all in Unity, with C#.

I have attached a script to my player that should destroy a TreeGroup (as in a forest) whenever I press 'Q' and instantiate one when I press 'E'.

Here is the code:

using UnityEngine;
using System.Collections;

public class DisableTrees : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

        if (Input.GetKeyDown (KeyCode.A)) {
            //Disable Trees on A Keypress

            Debug.Log("Trees Disabled!");
        }

        if (Input.GetKeyDown (KeyCode.E)) {
            //Enable Trees on E Keypress

            Debug.Log("Trees Enabled!");
        }

    }
}

How do I access and find my 'TreeGroup' object group while script not being attached to 'TreeGroup' but my character instead and then Destroy on Q Keypress?
And how do I Instantiate it?

sentences:
How can I implement the traffic(+drawing) functionality in the game? I am a beginner game developer. Games such as "Cities: Skyline", "Simcity", "Citybounds", and "Traffic lanes 3" directly build roads and show simulations of cars moving over them. I have no knowledge to make these things. I can use Unity, construct2. How can I express things like roads, lanes, intersections, snapping, traffic simulations, path finding, driver AI,  traffic lights, even wheels on the road?

Road drawing

Traffic simulating

sentences:
Back button press on Windows Phone 8.1 Monogame I am developing a simple game for windows phone and I got stuck when at the handling the back button press.

I have been searching for a while on google but I have not found anything that could work for me. I have seen a function GamePad but i couldn't find on which namespace is this function located, and if it is working on WP8.1.

So my question is, how can I set up a function in which I can handle some code when user press back button.

Thanks.

sentences:
No local transform with skinned mesh with assimp? I'm trying to add skeletal animation to my engine and I'm importing meshes with assimp, but I think I misunderstood the skinned mesh concepts (or don't understand assimp).
When I import a model, everything works fine, regardless of mesh hierarchy. I'm using collada files.
Here's how the model should look if it was imported correctly:

However, if I try to import skinned meshes, I get something really weird like this:

It happens because each mesh is imported without any local transform and everything stays in the wrong place/rotation.
But shouldn't the model stay the same as the first picture, because it should work even if it don't have a skinned mesh? Shouldn't the bone transform just be the offset matrix to convert from mesh space to bone space when using animation data to interpolate between key frames? I'm really confused.
I'm learning from Tutorial 38 - Skeletal Animation with Assimp.

sentences:
openGL ES - change the render mode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY on touch i want to change the rendermode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY when i touch the screen.

WHAT i Need :
Initially the object should be stationary. after touching the screen, it should move automatically. The motion of my object is a projectile motion ans it is working fine.

what i get : Force close and a NULL pointer exception.

My code :

public class BallThrowGLSurfaceView extends GLSurfaceView{

MyRender _renderObj;
Context context;
GLSurfaceView glView;

public BallThrowGLSurfaceView(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    _renderObj = new MyRender(context);
    this.setRenderer(_renderObj);
    this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    this.requestFocus();
    this.setFocusableInTouchMode(true);
    glView = new GLSurfaceView(context.getApplicationContext());
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    if (event != null)
    {
        if (event.getAction() == MotionEvent.ACTION_DOWN)
        {
            if (_renderObj != null)
            {   Log.i("renderObj", _renderObj + "lll");
                // Ensure we call switchMode() on the OpenGL thread.
                // queueEvent() is a method of GLSurfaceView that will do this for us.
                queueEvent(new Runnable()
                {
                    public void run()
                    {
                        glView.setRenderMode(RENDERMODE_CONTINUOUSLY);
                    }
                });
                return true;
            }
        }
    }
    return super.onTouchEvent(event);
}

}

PS : i know that i am making some silly mistakes in this, but cannot figure out what it really is.

sentences:
How to fix model matrices colliding in vertex shader? I am new to OpenGL programming and I'm writing some basic code to display a few objects onto a screen.

I have a pyramid shape that I'm displaying, as well as a box shape that I am displaying. The pyramid shape is a class (C++), and each pyramid object creates it's own VBO (storing the points/colours). The same thing goes for the box.

The problem I'm having is that I have two shapes, and the shapes use the same vertex shader. Since I apply a model matrix for each object in the shader, the model matrix gets set for one object, but then when the other object goes to display itself it overwrites the model matrix for the previous object with it's own. So only one object has the correct model matrix after they are all done their display method.

I am also using hierarchical transformations to attach objects to each other. I have the root object storing the view/projection matrices, and the children of the hierarchy tree storing their individual model transformations. When a child wants to display itself, it walks up the tree to compute all the transformations it needs to do to itself. The problem also applies here, since the last child to be displayed will be the one whose model matrix is applied in the vertex shader.

I can't seem to figure out how to differentiate in the shader which MVP matrix to apply to which vertex. I think I'm missing something very basic here but I can't seem to figure it out... Any help would make my life a lot easier!

Edit: Is it possible that the shader is overwriting the MVP matrix in between glDrawArrays()/glDrawElements() calls?

sentences:
What is the name of the perspective style of games like Final Fantasy 6, Chrono Trigger or Alundra? What is the actual term for the 'top-down' style of the Super Nintendo games such as Final Fantasy 6, Chrono Trigger, et cetera. I'm looking for the equivalent term of:

'isometric' - (Jaggered Alliance, Final Fantasy Tactics, Fallout),
'first person' - (Half Life, Doom, Quake),
'birds eye' - (Grand Theft Auto)
? insert term here ? - (Final Fantasy 6, Chrono Trigger)

sentences:
Unity - Problems with scene object orientation and rotation after updating my project from 5.0.0 to 5.2.2 Last year I made a large project on Unity 5.0.0, today I re-opened it on 5.2.2 to do some work on it. I was given the message that the project needed to be updated, I allowed it to do the update. Now when I open up my scenes, many of my scene objects are misplaced, the rotation is completely wrong and positioned in the wrong place. My scenes are of a refinery and the most commonly broken object is the pipework, something that would take hours to correct manually.

My pipework is created this way...

All pipes are made in blender and each scene's pipes are saved as a single blender model (with each pipe make from a bezier curve and left as a separate object).
Once imported into Unity (as a single .blend file), I've then dragged and dropped coloured materials onto all the individual pipes, so they are all coloured correctly.

This has all been fine until updating the project to 5.2.2 - now some of the pipes are in the right place, but many are rotated in completely the wrong direction, leaving it looking a mess. If I delete the pipes from Unity and reimport the pipe model back in, this would solve the problem, but then all the materials/colours will be gone. Due to the sheer amount of pipes throughout the whole project, to re-colour them all again would be an extremely problematic task, especially as it's critical that the pipes are the right colour.

I am confused how some of the pipes within the same pipe model are fine and the others are wrong, it would be so much easier to sort if they had all changed rotation together, then I could just switch them all back in 1 go. I have a total of 13 scenes and so far all of them have suffered the same problem.

Nothing whatsoever has been changed on any of the scenes, assets or indeed anything in the project folder. In fact I haven't touched a single file within the project since October last year, so it is certainly to do with updating to 5.2.2. Is there anything I can do to fix the problem without having to re-import the models back in or manually rotate everything back?

I have attached some screenshots to show the issue - See how in the blender image, all the pipework is placed correctly and then in the Unity image, half the pipes have flipped and are facing the wrong way. I have removed the ground so this can be seen clearer. Any help would be much appreciated.

Many thanks

sentences:
Algorithm for randomly generating reachable platforms I want to randomly generate reachable platforms on the fly for a 2D game.  Right now, I am just creating platforms at random x,y positions.  Only 4 platforms can exist at once, so once the 5th one is generated the 1st one is removed (fifo).

So, I want to ensure that the player can jump from his current platform to at least one other at any given time.

I was thinking of using some variant of the distance formula to calculate the location of the next platform being generated.  I was hoping someone could help me out with the formula for calculating the next platforms possible x,y positions.

The player variables I am assuming will be important are speedX, speedY, and gravity.

From here, I should be able to calculate the maximum distance to plug into the distance formula.

However, I am thinking that some variation of the distance formula that contains a variable for slope would be better in my case.

I want to ensure that the player will never get stuck on a platform with no where it can jump.  Also, I want to ensure that platforms aren't generated on top of each other.

Formulas/images/code are a huge plus.

Here is how jumping is currently working.

Field speedY:Float = 4
Field GRAVITY:Float = .05

Method Update:Void()
    If KeyDown(KEY_SPACE) And not jumping Then
        dy=-speedY
        jumping = true
    EndIf

    If jumping
        dy += GRAVITY
        local tempY:Float = y + dy
        y = tempy
    Endif
End Method

Edit:
I now understand that the formula is just the displacement of basic projectile motion.

Except, in my case, we don't care about cos/sin because the angle will always be the same.

sentences:
Handling collisions with objects that use vector of unique pointers #pragma once
#include "Entity.h"
#include <iostream>

class Projectile : public Entity
{
public:
    Projectile() {}

    Projectile(float x, float y) {
        load("Graphics/Projectile.png");
        m_sprite.setPosition(x, y);
        m_speed = 400;
    }
};

#pragma once

#include "Entity.h"
#include <iostream>
#include "Projectile.h"

enum class Color {
    red,
    yellow,
    brown,
    blue
};

class Enemy : public Entity
{
public:
    Enemy(const Color& c, const sf::Vector2f& pos) {
        switch (c) {
            case Color::blue:
            {
                load("Graphics/blueEnemy.png");
            }
            break;
            case Color::red:
            {
                load("Graphics/redEnemy.png");
            }
            break;
            case Color::yellow:
            {
                load("Graphics/yellowEnemy.png");
            }
            break;
            case Color::brown:
            {
                load("Graphics/brownEnemy.png");
            }
            break;
        }
        setPos(pos);
        m_speed = 100;
    }
};

  #pragma once
    #include "Entity.h"
    #include "Projectile.h"
    #include <vector>

class Spaceship : public Entity
{
public:
    Spaceship();
    void move(float);
    void shoot(float);
    void update(float);
    void draw(sf::RenderWindow*) override;
private:
    bool wasSpacePressed;
    std::vector<std::unique_ptr<Projectile>> m_projectiles;
    sf::Clock m_clock;
};

class EnemyFleet : public Entity
{
public:
    EnemyFleet();
    ~EnemyFleet();
    void move(float);
    bool isEnemyBottom() const;
    bool isLeftMost() const;
    bool isRightMost() const;
    void moveX(float);
    void moveDown();
    void update(float);
    void draw(sf::RenderWindow*) override;

private:
    std::vector<std::unique_ptr<Enemy>> m_enemyFleet;
    bool m_leftToRight; //motion of the enemyfleet
    float m_speedModifier;
};

I want to be able to delete a projectile and enemy when they collide with each other, but I'm not sure how to do this since unique_ptr cannot be copied into any parameter in some collision manager class bc it has exclusive ownership. Is unique_ptr still something i should use bc i dont have to call delete (like if its a raw ptr)?

sentences:
Multiplayer Game Data Serialization Problems I want to create a simple game that can be played with one to two player. I plan on using TCP sockets, Farseer Physics, XNA, a BinaryFormater and a Memorystream.

as far as i know i can't do the physics on both clients, or you'll end up with everything out of sync. So my Idea was to do the physics on the host side then send the Farseer World data to the other client, however it is un-serializable and I also realized this was a lot of data to send every tick.

I could just send the players movements back to the server and send a Texture2D to the client to be drawn, however a Texture2D is un-serializable as well. it has dawned on me i must be doing this completely wrong.

But this is how i am attempting to send the data:

[Serializable()]
class ServerData
{
    public Texture2D Test;

    public Vector2 Test2;
}

    static void SendData()
    {
        byte[] DataBuffer = null;

        MemoryStream stream = new MemoryStream();
        BinaryFormatter formatter = new BinaryFormatter();
        NetworkStream netStream = PlayerOneSocket.GetStream();

        ServerData ServerDataToSend = new ServerData();

        formatter.Serialize(stream, ServerDataToSend);
        DataBuffer = stream.ToArray();
        netStream.Write(DataBuffer, 0, DataBuffer.Length);
        netStream.Flush();
    }

what am i doing wrong or how do i do it right.

I've done basic server stuff before with custom classes and serialization, I'm just at a loss on how to make a multiplayer game.

Thanks for the help

sentences:
How should I isolate game entities with their concrete Drawable components (in C#)? I've designed my game entities using a common pattern of separating the entity from its components.  In my case, I've used the Strategy pattern to give each of my entities an IDrawable component.

I construct my entities using a factory, which constructs the entity and adds an appropriate drawable, e.g.:

public static PlayerEntity CreatePlayerEntity(...)
{
   PlayerEntity playerEntity = new PlayerEntity(...);
   SpriteDrawable spriteDrawable = new SpriteDrawable(...);
   playerEntity.Drawable = spriteDrawable;

   ...

   return playerEntity;
}

Now here's the question: If I later want to update the player drawable in some way (e.g. modify the sprite, change the animation, etc.), how and where should I do this?

My first thought is to have C# events that the PlayerEntity publishes and the Drawable subscribes to, but this gets tricky from a purist standpoint, because it's hard to do this without the Drawable requiring a reference to a PlayerEntity.  My current hacky solution is to subscribe to these events from within the CreatePlayerEntity() method itself, using anonymous delegates, which can take advantage of the fact that you've still got a reference to the concrete IDrawable implementation.  It just doesn't seem right for the factory to have this responsibility, though:

public static PlayerEntity CreatePlayerEntity(...)
{
   PlayerEntity playerEntity = new PlayerEntity(...);
   SpriteDrawable spriteDrawable = new SpriteDrawable(...);
   playerEntity.Drawable = spriteDrawable;

  playerEntity.SomeEvent += new EventHandler((sender, e) => { spriteDrawable.Texture = blah; });

   ...

   return playerEntity;
}

What is a better, approved way to accomplish this communication between concrete implementations?

sentences:
Project rendering onto a polygon in the scene I have a function that renders a simple OpenGL scene. I want to display this scene on a polygon within another scene, without the function having to know about it. For example, to display the scene on the red polygon indicated:

I can set up the projection and modelview matrices to render to a small rectangle on the screen, but that doesn't work in a case like the image shown, where the target polygon is transformed and is no longer a rectangle on the screen. Is it possible to render to a non-rectangular target like this? The target is defined by four vertices, and I'm just not sure how to put those into the matrices.

I am aware of VBO/FBO functions that can render the sub-scene to a texture, which could then be mapped onto the polygon. However, this would be a bit more work as I'd have to add support for these functions to LuaGL, and I get the feeling it'd be slower than simply altering the display matrices - if it can even be done that way.

sentences:
Packaging JARs for Linux I realise that this question exists but the answer doesn't explain how to create DEB packages and whether they're suitable.

I'd like to package my Java 8 game for Linux. Most people don't have Java 8 (and some don't even have Java), so including the JRE in the package would be great.

The package should also have a logo that shows up on most desktop environments.

Lastly, the package should be cross distro (or cover a large number of distros), if possible, because there are simply so many distros.

How would I go about achieving this?

sentences:
Manipulating time in Unreal messes up Physics simulation? I'm trying to achive a Super Hot like gameplay, where the time only flows when the player moves.

But when I stop time, then restart it, physics simulation will be messed up. Like:

Cloths starts flying around like they are in a tornado.
Rigidbodies fly away, like they were shot from a cannon.

All of these without any kind of forces being applied to them. They were just standing still, I stopped time, then I restarted Time and Booom, rigidbodies fly around.

I use this in the player's Tick method:

auto settings = GetWorld()->GetWorldSettings();
settings->SetTimeDilation(timeScale);

sentences:
If I flip the normal on a backface, do I need to flip tangent and bitangent I have a mesh that is just a plane and need to be seen front and back.
In order to do light computation, on the back face I have to flip the normal, do I have to flip the Tangent and Bitangent?
It seems to me that I have to flip all of the three to keep the computation correct.

sentences:
Select Unity Prefab from enum choice After a couple tries, I still haven't found any solution to this problem of mine.

Currently, I have a script inheriting from MonoBehavior which creates a map with Perlin Noise. Let's call it mapGenerator.
It instantiates a HexTile object from another script, which does not inherit from MonoBehaviour, that contains a refere to my terrain prefab and an enum value which says its type (so water, grass, wood, etc.). There is an array declared at the beginning of the script that I manually change as I'm adding terrains.

Everything works fine except when tweaking the map generation, If I want to change some values for perlin intervals, I might have to add another value to my HexTile[] and then drag my terrain prefab and set the enum value.

What I want is to know if there is a way to make the script select a prefab depending on the value the enum was set to.

Here is the code (simplified):

public class ProceduralTerrainGenerator : MonoBehaviour
{
public bool regenerateMap = true;

public Hextile[] hexTiles;

void Update()
{
    CreateMap();
}

private void CreateMap()
{
    // Some code for Perlin Noise generation inside perlinMap[,]
    for (int i = 0; i < mapLength; i++)
    {
        for (int j = 0; j < mapHeight; j++)
        {
            // Setting up position from i and j index
            foreach (HexTile hexTile in hexTiles)
            {
                if (ValueInRange(perlinMap[i,j], hexTile.LowLimit, hexTile.HighLimit)
                {
                    Instantiate<HexTile>(hexTile.tile, position, Quaternion.Euler(0f, 0f, 0f), this.transform);
                }
            }
        }
    }
}
}

and my other script

[System.Serializable]
public class HexTile
{
    public GameObject tile;
    public HexMetrics.HexType hexType;
    public float perlinNoiseLowLimit;
    public float perlinNoiseHighLimit;
}

=========== EDIT 1 ===========

I tried simplifing my problem, because I'm more interested in the concept, but here are more details.

I have a class named HexSettings, which contains the hex prefab (HexTile) named tile, its HexType, and the perlin noise bundaries.

[System.Serializable]
public class HexSettings
{
    public HexTile tile;
    public HexMetrics.HexType hexType;
    public float perlinNoiseLowLimit;
    public float perlinNoiseHighLimit;
}

Here is the HexType enum contained inside HexMetrics

public class HexMetrics
{
    // Hex metrics data for placement in grid data

    public enum HexType
    {
        GRASS,
        FOREST,
        WATER,
        SNOW,
        DESERT,
        LAKE
    }
}

What I would like is to have some soprt of dictionnary that contains the correct prefab according to the selected HexType.

As you can see in the image below, I can set my HexType to my terrain types, but I also have to set the HexTile object manually, where it could be set automatically according to the HexType value set. That is what I'm looking for.

I tried adding it in a dictionnary (something like Dictionnary<Hextype, HexTile>), looking for prefabs in my folder prefab with Resources.LoadAll<HexTile>("prefab");, no success, prefabs couldn't be loaded in HexSettings.

sentences:
Prevent instances from overlapping gamemaker studio I have a game where multiple instances of an enemy move towards a player in their step process.  There can be as many as 50 instances on screen.

The issue is that the instances all end up in 1 big group as they follow the player.
I would like to prevent them from getting more than 2 pixels of each other.

the code is as follows:

if distance_to_object(player) < 160 {
  direction = ppoint_direction(x,y, player.x, player.x, player.y)
  p_potential_step(x,y, player.x, true);
}

If I put a distance check of 2px in this code, the instance starts making jerky movements and spins. I would like the instance to continue following the player, but just not allow themselves to overlap.

sentences:
Sending light data from Vertex Shader to Pixel Shader? We have a pixel shader constant buffer that contains the light data for the item that is currently rendered.
To implement tangent space normal mapping, i would need to transform each light into tangent space.
Is it a valid approach to instead bind the light data to the vertex shader and then send the transformed Light Data to the pixel shader since the vertex shader runs less frequently than the pixel shader?
As a side note: I am using forward rendering with a limited light count.
Our pixel shader constant buffer looks like this:
struct RendererLight {
    float3 Position;
    float3 Color;
    float3 Direction;
    float Intensity;
    float In;
    float Out;
    float Range;
};

cbuffer LightsBuffer : register(b2)
{
    RendererLight Lights[8];
    uint NumLights;
};

sentences:
Errors on LibGDX tutorial I get the following errors on the LibGDX tutorial "Simple App"

  Exception in thread "main" java.lang.UnsatisfiedLinkError: no gdx64 in
  java.library.path     at java.lang.ClassLoader.loadLibrary(Unknown
  Source)   at java.lang.Runtime.loadLibrary0(Unknown Source)   at
  java.lang.System.loadLibrary(Unknown Source)  at
  com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:118)
    at
  com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.load(LwjglNativesLoader.java:41)
    at
  com.badlogic.gdx.backends.lwjgl.LwjglApplication.(LwjglApplication.java:52)
    at com.badlogic.drop.DesktopGame.main(DesktopGame.java:7)

I copied and pasted the final code onto the project, but I don't know why it wont run.

Whats the problem?  Is it the project set-up?

sentences:
Horizontal scroll only part of the view I would like to know the best way on how to implement horizontal scrolling to only part of the view and vertical scrolling to complete view. I was able to achieve horizontal and vertical scrolling to the complete view. If I have to use layers can you explain a bit more on how to achieve layers and draw shapes on those layers separately.

I tried using two different SurfaceViews it does not work. Here is my code for scrolling horizontally.

@Override public void onDrawFrame(GL10 unused) {

GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

// Set the camera position (View matrix)
Matrix.setLookAtM(mVMatrix, 0, mXOffset, mYOffset, -3, mXOffset, mYOffset, 0f, 0.0f, 1.0f, 0.0f);

// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);

mGraph.draw(mMVPMatrix);

mLine.draw(mMVPMatrix);
msquare.draw(mMVPMatrix);

}

sentences:
Why is my counter not incrementing when OnTriggerEnter is called? I have a script that handles the destruction of game objects based on what they collide with.  I am trying to count the number of objects destroyed when they collide with specific objects.  However, this is not happening.  Instead, the counter is getting to "1" and no longer counting.  Can anyone explain why?

public class Destroy:MonoBehaviour{
    public GameObject asteroid_explosion;
    public GameObject ship_explosion;
    private int destroy_count = 0;

    void OnTriggerEnter(Collider other){
        if(other.tag == "Boundary"){
            return;
        }

        if(other.tag == "Bolt"){
            destroy_count = destroy_count + 1;
            Instantiate(asteroid_explosion, transform.position, transform.rotation);
            Debug.Log(destroy_count);
        }

        if(other.tag == "Player"){
            destroy_count = destroy_count + 1;
            Instantiate(ship_explosion, other.transform.position, other.transform.rotation);
        }
        Destroy(other.gameObject);
        Destroy(gameObject);
    }
}

sentences:
How to report bugs found on procedurally generated levels? There is many topics on how procedural generating works but I couldn't find any info on how to test and - what's more important - how to report bugs that may occur on procedurally generated levels. What is the best way to describe a bug, for example related to level design, on a map that will look different each time you play new game? What information should be included in bug report so reproducing it would be easier for level designer, level artist, etc. and then also during regression process?

EDIT:
It is worth mentioning that the game, I am preparing to test, is in very early phase of developing and is constantly changing along with the systems responsible for generating levels. The purpose of this research is to learn how to describe bugs (what info to include in report) so the regression in a changing environment would be as less time consuming and as effective as possible.

sentences:
Fast exact frustum culling for sphere Given a view frustum and a sphere, how do I exactly determine whether or not the sphere  intersects the frustum? The typical way of checking a sphere against a frustum finds the signed distance of the sphere center from each frustum plane, but this isn't an exact test and will sometimes fail:

One method is to split the frustum geometry into triangles and test each triangle against the sphere for an intersection but this is slow.

Can SAT be used with a sphere? Are there any other faster methods?

sentences:
Android - Efficient way to draw tiles in OpenGL ES I am trying to write efficient code to render a tile based map in android. I load for each tile the corresponding bitmap (just one time) and then create the according tiles. I have designed a class to do this:

public class VertexQuad {

private float[] mCoordArr;
private float[] mColArr;
private float[] mTexCoordArr;
private int mTextureName;
private static short mCounter = 0;
private short mIndex;

As you can see, each tile has it's x,y location, a color array, texture coordinates and a texture name.
Now, I want to render all my created tiles.

To reduce the openGL api calls (I read somewhere that the state changes are costly and therefore I want to keep them to a minimum), I first want to hand ALL the coordinate-arrays, color-arrays and texture-coordinates over to OpenGL. After that I run two for loops. The first one iterates over the textures and binds the texture.
The second for loop iterates over all Tiles and puts all tiles with the corresponding texture into an IndexBuffer. After the second for loop has finished, I call

gl.gl_drawElements()

whith the corresponding index buffer, to draw all tiles with the texture associated. For the next texture I do the same again.

Now I run into some problems:
Allocating and filling the FloatBuffers at the start of each rendering cycle costs very much time. I just run a test, where i wanted to put 400 coordinates into a FloatBuffer which took me about 200ms.

My questions now are:

Is there a better way, handling the
coordinate and color structures?
How
is this correctly done, this is
obviously not the optimal way? ;)

thanks in advance,
regards Markus

sentences:
Sorting sprites based on Z index I am working on a 2D game engine in C# using OpenGL. I am trying to find a collection to satisfy my needs for sprite ordering, and I can't seem to find the combination of performance and functionality.

The following is the criteria I am after:

The ability to be iterated over in order according to "Z" value, which may change for any sprite at any time
Possible for many sprites to be added/removed within a single frame, so sorting each time a value was added/removed will have large performance impact without the correct implementation
Insertion/removal speed is much lower priority than access speed during enumeration
Have no need for indexing
Only unique values, but with the correct collection, I can manage that manually if the base collection does not implement it, as I do in the example

Currently, this is the best I could come up with. (I removed all the interface implementations for clarity, leaving only the important stuff)

    public class SpriteBatch : ICollection<IRenderable>
{
    private readonly Dictionary<uint, IRenderable> _dict;
    private readonly List<uint> _keys;
    private bool _needSort;

    public SpriteBatch()
    {
        _dict = new Dictionary<uint, IRenderable>();
        _keys = new List<uint>();
        _needSort = false;
    }

    public void Add(IRenderable renderable)
    {
        if (renderable == null)
            throw new ArgumentNullException(nameof(renderable), "Item cannot be undefined.");
        if (_dict.ContainsKey(renderable.Id))
            return;
        _needSort = true;
        renderable.Disposed += (sender, args) => Remove(renderable);
        renderable.ZChanged += (sender, args) => _needSort = true;
        _keys.Add(renderable.Id);
        _dict.Add(renderable.Id, renderable);
    }

    public bool Remove(IRenderable renderable)
    {
        if (renderable == null)
            return false;
        _dict.Remove(renderable.Id);
        return _keys.Remove(renderable.Id);
    }

    public IEnumerator<IRenderable> GetEnumerator()
    {
        if (_needSort)
            _keys.Sort((a, b) => _dict[a].Z.CompareTo(_dict[b].Z));
        foreach (var key in _keys)
            yield return _dict[key];
    }
}

Was curious if anyone else had a better approach, or what the "standard" tried-and-true way of doing this is?

sentences:
How to know the adresses an editor modifies while saving a file I hope this question belongs here.

Suppose an editor for a specific file extension. It usually has a user friendly interface so you don't see raw data. Once you edit anything and save the editor modifies some data. Is there any way to keep track of these changes and see which specific data is modified?
This is motivated by the fact that an editor is a program that has its limitations and sometimes it does not allow some changes. This protects the original file from fatal damage. As an example suppose a .nes file that can be edited through the HEX editor or a "level" editor. I might not know the ROM address where some level information is stored but (i guess) the "level" editor knows. So I can edit, save and search the region of the ROM, with the HEX editor, that was modified. That would give me information on where this level data is stored and be able to understand it.

My system is Windows so I wonder if there is any "save register" that keeps track of this save operations. Or is it an editor specific thing and each one has its own way of saving data, meaning i should look into the editor's code more than a general Windows place?

Thanks,

PD: I'm sorry if I misunderstood something essential but I'm not experienced with how this precesses work.

sentences:
Best solution for "level string"? I have a game that generates a random level map at the start of the level. I want to implement some way to save and load the level.

I was thinking maybe XML would be a good option for saving all the variable, then it would be easy for me to build something that can parse that XML and generate the exact same level.

But XML is probably overkill for my needs. I remember back in the day with the old Sega console that didn't have the ability to save your game (I think the Worms game did it too), that they would give you a bunch of character that you could write down. If you punched in that string later on, it would load the exact level.

Would a "level string" be a good option? Would it be some kind of "base60" conversion? How would I implement this?

sentences:
Easy Method to Change Color on UI Elements This isn't a language-specific thing as far as I'm concerned.  I was wondering what may be a quick way to change the COLOR of a certain on-screen element such as a button and its associated text.

I would assume there is a trick to making a graphics engine so maybe individuals pixels or groups of sprites can have their colors easily shifted.  A lot of game interface buttons and such have this so you know when an event like a click has occurred.

Any pseudo code would be helpful and I am working in Android (not XML fluff), but again, this probably is not a very specific question, just an inquiry on how to go about this.

sentences:
Preserving Cocos2D context between UIKit screens My app is designed to use Cocos2D in the "main game screen" but the rest of the screens are in UIKit. While I feel that this isn't ideal, I really don't have time to port the rest of the screens into Cocos2D for the time being.

One of the problems I face is that I am required to load all the textures each time I enter the main game screen, and discard them once I leave Cocos2D-land (and repeat the process all over again)... or am I?

I am actually wondering if I could preload all the textures needed in a CCTextureCache during startup, even when the EAGLView and context hasn't yet been set up until I visit the main screen (and in doing so preserve the texture cache contents). But whenever I try this the app crashes.

Any way in which I can do this?

sentences:
Visual Studio 2012 and Game Development Alright, I think it's a simple question, but I got difficulties to find some answers around.

I already read that XNA wouldn't be in Visual Studio 2012.  I recently learned to use XNA, but since I would like to work on games, I'd like to know if there's a way to develop games using C# on Visual Studio 2012, or if I should learn everything again using C++ and Direct3D?

C# is a language I like a lot, so if there's no way to do it in C# but something quite easy to use Java for game development, I'd also be interested.

Thanks a lot!

sentences:
removing box2d objects before collision occurs I am having a problem with a collision detection between the character and items, both created as box2d objects.
What I am trying to do is to delete the item or remove item from the collision method before character hits item and bounces away. Thus, I want to detect when the item and character collided to gain item effects.

Current sources are as below :

mWorld.setContactListener( new ContactListener() {
        @Override
        public void endContact(Contact contact) {
        }
        @Override
        public void beginContact(Contact contact) {
            Body bodyA = contact.getFixtureA().getBody() ;
            Body bodyB = contact.getFixtureB().getBody() ;

            Box2DUserData dataA = (Box2DUserData) bodyA.getUserData() ;
            Box2DUserData dataB = (Box2DUserData) bodyB.getUserData() ;

            if( dataA.id == Box2DUserData.ID_ITEM ) {
                //mWorld.destroyBody(bodyA);
                //bodyA.setTransform(new Vector2( 0, 0 ), 0 ) ;
                bodyA.setActive(false );
            }
            else if( dataB.id == Box2DUserData.ID_ITEM ) {
                //bodyB.getWorld().destroyBody(bodyB);
                //bodyB.setTransform(new Vector2( 0, 0 ), 0 ) ;
                //mWorld.destroyBody(bodyB);
                bodyB.setActive(false );
            }
        }
    });

This source works okay, but the bodies are removed after collision detection. So I can get the character walk through items, after the character bumped in item and stopped for a frame or so.

I am not sure if I am supposed to use World.setContactListener or another method, it would be grateful if someone could give me the right method or another way to detect collision and the way to remove body from collision method before it actually collides.

Thanks

sentences:
Zooming into generated map I have generated a 1024 X 1024 heightmap using Open simplex noise. Now i want to zoom into a 64X64 area. Every pixel in the 64X64 is not 16X16 on the larger scale.

I tried just generating the area, but problem is, that I want to also calculate normals from it, and the normals are different for the zoomed in area from the big map. The difference comes from the fact that on the big map the height difference between 2 pixels can be quite large, but when zoomed in, new pixels are place between the original 2 so if now normals are calculated, they are totally different.

How can I zoom into an area of a generated heightmap but retain the normals?
On the left is the large scale map and on the right is the zoomed in area. Zoomed in area is the upper left corner of the large scale map. As you can see the normals are completely different. Both of these images are textures. There are no meshes or anything only textures, and there will not be any meshes in future either.

This is how I calculate normals from heightMap.

            u = noiseValues[x + (y - 1) * width];
            r = noiseValues[x + 1 + y * width];
        }
        Vector3 up = new Vector3(0, 1, (noiseValues[index] - u)*100);
        Vector3 across = new Vector3(1, 0, (r - noiseValues[index])*100);

        normal = across.Cross(up).Normalized();
        normal = (normal + new Vector3(1, 1, 1)) / 2.0f;

After updating these lines in normal calculation:

 Vector3 up = new Vector3(0, 1/zoomFactor, (noiseValues[index] - u)*100);
        Vector3 across = new Vector3(1/zoomFactor, 0, (r - noiseValues[index])*100);

This is the result after adjusting normal calculation:

sentences:
Neural Network ai evolution? I've created a small simulation game and I have a basic neural network in place, each "creature" in my game has random weights on it's nodes and they all behave differently.

Their goal is to stay inside a circular "safe zone" that moves around the center of the game world. After 1000 generations of evolution not a single one of them makes any attempt to follow the circle around, so I was thinking I either..

Don't know how to train them properly
Don't know how to find who should live/ die.
Using the wrong input/ outputs.

Here is the diagram of the brain (ignore the numbers)

Can anyone shed any light on what my issue is here? I'm sorry if this is vague I've only been using these for a couple of hours. But to elaborate on my question, what kind of inputs/ outputs should I be using with my neural network and what is the general procedure (in respect to my evolution approach) to train them to do the correct thing?? Could the error be caused by the number of nodes in the hidden layer or something?

sentences:
Queueing up character actions I'm developing a 2D platformer with action-fighter elements. Currently things are working relatively smoothly but I'm having difficulty sorting something out. For the time, keeping my character's states and actions separated and preventing them from stepping on each others' toes is working out well and properly, but I would like to add a feature to my character to get him to behave a little bit more fluidly for the player.

At the moment, he has numerous attacks and abilities that he can execute, all of them being executed with button presses. Here lies the problem: Being as everything is executed through button presses, while an action is in progress I flag the game to disregard further button presses until the action has completed. Therefore, consecutive actions cannot be performed until after the previous action has completed entirely. In runtime this behavior feels very icky, and very ungamelike.

In games that rest most memorably at the forefront of my mind the player is able to execute button commands during the process of actions, and at the end of the current action, the following action is executed (seems like some sort of a queue system or something)

Can anybody offer any guidance with this?

sentences:
3d complex collision and trigger detection I'm a Unity developer and I use monobehavior functions to dot things like collision detection.
I have read about articles about collision detection. Most of them work with geometrical structures like sphere or boxes.

How are complex collisions with no formal and geometrical structures calculated?

sentences:
FPS controller initializing at bizarre location I have got the hang of basic construction, terrain modification, applying materials, placing trees, etc.  I have created a water plane, positioned my terrain above it, and am able to sink lakes and pools, and raise hills and mountains.  Built a couple of primitive structures too.

Initially (before mucking about with the Y position of the terrain) I was also able to invoke Gameplay mode and walk around my game using FPS Character Controller.  I could walk into and out of my structures and hike over the hills and valleys of my terrain.

However, since changing the Terrain Heightmap to make the "sinkhole" (negative altitudes) work, I am having the strangest trouble with my FPS Character Controller.  I position it at a reasonable height above the terrain, and everything looks fine in Editor mode;  but when I start Play mode my FPS character starts out miles below the world, looking up at the underside of the terrain.

So far nothing I have tried will make the FPS Controller start in the location where I have dragged it in Editor mode.  I have tried Saving Scene and exiting and reloading.  I have deleted and recreated the FPS controller.  No matter what I do, it persists in initializing itself in this oddball "way below the world in outer space" location.

I have googled diligently but have not found any mention of this problem.  Presumably I'm skipping some important step, but tutorial videos don't offer any advice beyond "drag the fps controller into the scene and it should work."

sentences:
Issues with Flashlight Handle position with player rotation I want the flashlight to look same while looking up and down as when looking straight.

Normal Position for Hand and flashlight:

Looking up and down, position is completely off:

More images for character/camera prefab rotation:

Basically the position of the Hand held flashlight changes when I look up or down, as well as the arm stretches. How do I fix this?

Code for character rotation:

private void CharacterRotation()
{
    float posX = Input.GetAxis(mouseX) * ((StructsInitializers.Sensitivity * 5) + StructsInitializers.Sensitivity*50) * Time.deltaTime;
    float posY = Input.GetAxis(mouseY) * ((StructsInitializers.Sensitivity * 5) + StructsInitializers.Sensitivity*50) * Time.deltaTime;
    yAxisClamp += posY;

    if(yAxisClamp > 90.0f)
    {
        yAxisClamp = 90.0f;
        posY = 0.0f;
        ClampYAxisRotation(270.0f);
    }
    else if(yAxisClamp < -90)
    {
        yAxisClamp = -90.0f;
        posY = 0.0f;
        ClampYAxisRotation(90.0f);
    }
    transform.Rotate(Vector3.left * posY);
    PlayerBody.Rotate(Vector3.up * posX);
}

private void ClampYAxisRotation(float value)
{
    Vector3 eulerRotation = transform.eulerAngles;
    eulerRotation.x = value;
    transform.eulerAngles = eulerRotation;
}

PS: I am new to game developing. I have lack of experience.

sentences:
OpenGL ES 2.0: Controlling Transparency in Fragment Shader The following is the OpenGL ES 2.0 simple GLSL Fragment Shader, I use to place textures on polygons, to render 2D sprites.

varying mediump vec2 TextureCoordOut;
uniform sampler2D Sampler;

void main()
{
gl_FragColor = texture2D(Sampler, TextureCoordOut);
//gl_FragColor = vec4(texture2D(Sampler, TextureCoordOut).xyz, TextureCoordOut.w * 0.5);

}

The fragment shader places voxels with alpha information taken from the source 2D texutre(.png image). Apart from alpha information, I need to control overall polygon/sprite transparency to achieve Fade In/Fade Out effects.

Could you show me, please, how to modify the above shader to control the overall transparency, besides the alpha information?

Note: The commented out line is used for my attempts to achieve the transparency. I wish to combine both the alpha information with the overall polygon/sprite transparency.

Thanks.

sentences:
Unity Text Mesh Pro can not get referenced in VSCode I am using Text Mesh Pro in my Unity 2019.3.4f. The TMP works fine in unity, but in the code editor, Visual Studio Code, the TMP related things are marked with red wave underline, which means the VSCode could not get the reference of TMP.
In my csproj file, the TMP reference exists, here are some related codes:
<ProjectReference Include="Unity.TextMeshPro.csproj">
  <Project>{e8ae9ed6-ed86-3de7-e777-7e6794b003b2}</Project>
<Name>Unity.TextMeshPro</Name>

ProjectReference Include="Unity.TextMeshPro.Editor.csproj">
  <Project>{af8771c0-66d3-f01a-48b5-78951bce8a23}</Project>
<Name>Unity.TextMeshPro.Editor</Name>

My TMP works fine in every aspects, but there are code warnings in the VScode, "could not fine the namespace of TMPro". Is there anyone know how to fix it?

sentences:
Unity 2D Prevent knockback effect from 2D Translation I've just started looking into developing with Unity, and read through the tutorials and introductions. For my first project, I decided to try something simple - so a breakout clone. However, when the ball hits the player, the player gets knocked down a few pixels.

The player and ball have BoxCollider2D attached to them, and the player also has a RigidBody2D attached to it. The player is also checked as a "static" object.
The ball moves towards the player using transform.translate().

Here is the balls script:

using UnityEngine;
using System.Collections;

public class BallScript : MonoBehaviour {

    public float speed;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        this.transform.Translate (Vector3.down * speed * Time.deltaTime);
    }

    void OnCollisionEnter2D (Collision2D col) {
        this.speed = -speed;
    }

}

sentences:
How can I support objects larger than a single tile in a 2D tile engine? I´m currently working on a 2D Engine containing an isometric tile map. It´s running quite well but I'm not sure if I´ve chosen the best approach for that kind of engine.
To give you an idea what I´m thinking about right now, let's have a look at a basic object for a tile map and its objects:

public class TileMap {
   public List<MapRow> Rows = new List<MapRow>();
   public int MapWidth = 50;
   public int MapHeight = 50;
}

public class MapRow {
   public List<MapCell> Columns = new List<MapCell>();
}

public class MapCell {
   public int TileID { get; set; }
}

Having those objects it's just possible to assign a tile to a single MapCell. What I want my engine to support is like having groups of MapCells since I would like to add objects to my tile map (e.g. a house with a size of 2x2 tiles). How should I do that? Should I edit my MapCell object that it may has a reference to other related tiles and how can I find an object while clicking on single MapCells? Or should I do another approach using a global container with all objects in it?

sentences:
Java how to color text without using JNI? I am working on a small text-based game in Java.  I am trying to understand the concept of how to color the output without needing to use JNI. C++ has the ability to modify the console directly and also make system calls but as far as I can tell JAVA doesn't because of its ability to be system independent.

Is this possible or should I look at using a JFrame and the paint object?

sentences: UE4 Procedural Planet Design I am building a game that requires a full planet but it would be too complicated to create it as one mesh, so I decided that I will use procedural generation to create the (partially) editable landscape, rocks, trees, caves, etc. I was wondering on what server-side a procedural planet is generated? For example, is it generated when the player first plays the game, and is it the same for every player? Or is it completely rebuilt each time the player enters the game? If the answer is the latter, is there any way to somehow save the planet and make it into one map for everybody using the game and not change if they reload the game? If possible, I would strongly prefer any answers in Blueprints rather than C++. FYI: I haven't started building the game yet and am still researching my options for how to create the world. I didn't find much about saving the character's location anywhere so far.

sentences:
3D Illusion of a 2D Planet Texture Several years ago I overheard a technique that gives the user the illusion of a rotating planet by using a 2D texture. Given that the user isn't able to change its position or viewport.

What's the name of this technique?

sentences:
How can I fix these errors with Panda3D's sample projects? I just installed the latest Panda3D packages on a Mint 12 32-bit virtual machine. Then I downloaded and configured Eclipse and tried to run the Asteroids sample project. The window is created properly. But after rendering the scence once the game freezes. This happens with the other sample apps, too.

Here's the error log:

DirectStart: Starting the game.
Known pipe types:
  glxGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(warning): Occlusion queries advertised as supported by OpenGL runtime, but could not get pointers to extension functions.
OpenGL Warning: glXChooseFBConfig returning NULL, due to attrib=0x6, next=0xffffffff
:display:glxdisplay(warning): No suitable FBConfig contexts available; using XVisual only.
depth_bits=16 color_bits=24 alpha_bits=8 stencil_bits=8 accum_bits=64 back_buffers=1 stereo=1 force_hardware=1
AL lib: pulseaudio.c:331: PulseAudio returned minreq > tlength/2; expect break up
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
:display:gsg:glgsg(error): at 5703 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4654 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4654 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
:display:gsg:glgsg(error): at 5703 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 3057 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 3057 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
OpenGL Warning: No pincher, please call crStateSetCurrentPointers() in your SPU
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
:display:gsg:glgsg(error): at 5703 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 5703 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 3661 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 3661 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
:display:gsg:glgsg(error): at 4765 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid enumerant
:display:gsg:glgsg(error): at 5703 of panda/src/glstuff/glGraphicsStateGuardian_src.cxx : invalid operation
:display(error): Deactivating glxGraphicsStateGuardian.

What can I do to fix the problem ?

sentences:
C# XNA Normals Question I have been working on some simple XNA proof of concept for a game idea I have as well as just to further my learning in XNA. However, i seem to be stuck on these dreaded normals, and using the BasicEffect with default lighting i can't seem to tell if my normals are being calculated correctly, hence the question.

I'm mainly drawing cubes at the moment, I'm using a triangle list and a VertexBuffer to get the job done. The north face of my cube has two polygons and 6 vectors:

Vector3 startPosition = new Vector3(0,0,0);
corners[0] = startPosition; // This is the start position. Block size is 5.
            corners[1] = new Vector3(startPosition.X, startPosition.Y + BLOCK_SIZE, startPosition.Z);
            corners[2] = new Vector3(startPosition.X + BLOCK_SIZE, startPosition.Y, startPosition.Z);
            corners[3] = new Vector3(startPosition.X + BLOCK_SIZE, startPosition.Y + BLOCK_SIZE, startPosition.Z);

            verts[0] = new VertexPositionNormalTexture(corners[0], normals[0], textCoordBR);
            verts[1] = new VertexPositionNormalTexture(corners[1], normals[0], textCoordTR);
            verts[2] = new VertexPositionNormalTexture(corners[2], normals[0], textCoordBL);
            verts[3] = new VertexPositionNormalTexture(corners[3], normals[0], textCoordTL);
            verts[4] = new VertexPositionNormalTexture(corners[2], normals[0], textCoordBL);
            verts[5] = new VertexPositionNormalTexture(corners[1], normals[0], textCoordTR);

Using those coordinates I want to generate the normal for the north face, I have no clue how to get the average of all those vectors and create a normal for the two polygons that it makes.

Here is what i tried:

            normals[0] = Vector3.Cross(corners[1], corners[2]);
            normals[0].Normalize();

It seems like its correct, but then using the same thing for other sides of the cube the lighting effect seems weird, and not cohesive with where i think the light source is coming from, not really sure with the BasicEffect.

Am I doing this right? Can anyone explain in lay mans terms how normals are calculated. Any help is much appreciated.

Note: I tried going through Riemers and such to figure it out with no luck, it seems no one really goes over the math well enough. Thanks!

sentences:
Vector problem: which one is the left / centre / right one? In aviation, runways are named according to their magnetic orientation seen from the pilot's perspective. For example: a strip of asphalt oriented along the east-west axis will be named 9 for the pilot coming from west (east is at 90° from North) and 27 for a pilot coming from east (west is 270° from North).

When several runways have the same orientation, the naming convention uses letters L/C/R for distinguishing between the Left/Centre/Right ones (look at the 22 runways in the capture above).

In the game I'm coding, I chose to describe runways by the following three attributes:

Orientation (between 0° and 180°).
Position of their geometrical centre relative to the aeroport one.
Length

With this data I'm able to generate all the touchdown points and give them the correct number, but I can't find a straightforward method to assign the correct letter, as I could not think to a straightforward way to mathematically determine which one is "left/centre/right" from a "landing pilot's perspective".

So the question is:

  Is there a simple, straightforward vector formula that - given two
  parallel vectors pointing in the same direction - will return the
  leftmost (or rightmost) one?

Please note that this question is really about the straightforwardness of the formula, as I already found a non-straightforward way to get the result, but I would like to find a more elegant way to solve the problem.

Many thanks in advance for your expertise and contributions!

sentences:
Costs/profit of/when starting an indie company In short, I want to start a game company. I do not have much coding experience (just basic understanding and ability to write basic programs), any graphics design experience, any audio mixing experience, or whatever else technical. However, I do have a lot of ideas, great analytical skills and a very logical approach to life. I do not have any friends who are even remotely technical (or creative in regards to games for that matter).

So now that we've cleared that up, my question is this: how much, minimally, would it cost me to start such a company? I know that a game could be developed in under half a year, which means it would have to operate for half a year prior, and that's assuming that the people working on the first project do their jobs good, don't leave game breaking bugs, a bunch of minor bugs, etc.. So how much would it cost me, and what would be the likely profit in half a year? I'm looking at minimal costs here, as to do it, I would have to sell my current apartment and buy a new, smaller one, pay taxes, and likely move to US/CA/UK to be closer to technologically advanced people (and be able to speak the language of course).

EDIT: I'm looking at a small project for starters, not a huge AAA title.

sentences:
Detecting Groups for Formations In Starcraft 2, unit formations are created when a "group" is generated from a command. Generally, the rules for a group are:

All units in the group are in the same spatial "clump".
All units in the group were given the same move command.
If any unit in the move command is not in the clump, the group is broken and units move towards the destination individually.

How do I define a clump programmatically and detect in a unit is not in the clump?

sentences:
How do I read color data from UTexture2D in UE4? Here's my code:

// get RenderTarget2D
static ConstructorHelpers::FObjectFinder<UTextureRenderTarget2D> TargetObj(TEXT("/Game/Textures/RenderTexture"));
// generate a UTexture2D
CameraTexture = TargetObj.Object->ConstructTexture2D(Target->GetOuter(), "mytexture", Target->GetFlags(), 255);
//Turn off Gamma-correction
CameraTexture->SRGB = 0;

//Guarantee no garbage collection by adding it as a root reference
CameraTexture->AddToRoot();

//Update the texture with new variable values.
CameraTexture->UpdateResource();

GetColor(CameraTexture);

...

FLinearColor ANextGenHUD::GetColor(UTexture2D *MyTexture2D)
{
     FColor* FormatedImageData = static_cast<FColor*>(MyTexture2D->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_ONLY));
     for (int32 y = 0; y < MyTexture2D->PlatformData->Mips[0].SizeY; y++)
     {
         for (int32 x = 0; x < MyTexture2D->PlatformData->Mips[0].SizeX; x++)
         {
             int32 curPixelIndex = (y * MyTexture2D->PlatformData->Mips[0].SizeX) + x;
             FColor c = FormatedImageData[curPixelIndex];
             c.A = 255;
             MyTexture2D->PlatformData->Mips[0].BulkData.Unlock();
             return c;
         }
     }
}

This code is a bit messy fo testing purposes, but shoiuld theoretically get me the color of the first pixel. Instead it just gives me a random color the constantly changes as well when I draw it on the HUD.

What am I doing wrong?

sentences:
Crowdfunding an indie game. What should I offer back? I have seen many indie games making money for development using crowd funding (Kickstarter, IndieGoGo, et cetera). Some of the games will offer something back. For example, in an RPG game, you might get an NPC character based on you. Some other projects simply give you the final version for free.

Apart from actually finishing the game, which is probably the main reason why anyone would want to give you the money, what should my reward strategy be?

sentences: How to manage the lifetime of Ogre3D objects? I haven't found tutorials that are concerned about deleting scenenodes and entities. I assume that the scenemanager will take ownership of them when they are attached (am I right?). However, I can imagine many situations where I would like to deterministically and selectively terminate objects, for example if I were to use OGRE to display a huge open-world level, I would like to dynamically load and unload parts of the world. How can I do this while also telling the scenemanager that his pointer is no longer valid?

sentences:
Quaternion to direction vector - flipping I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need:

Now I have the following code:

Vector3 boneDir = getBoneWorldOrientation(mEntity, mHips) * Vector3::UNIT_Z; //mDirection;
Vector3 dir = mCameraTrans->_getDerivedDirection();

Vector3 zAdjustVec = dir;
zAdjustVec.normalise();

Quaternion targetWorldOrientation;

Vector3 xVec = Vector3::UNIT_Y.crossProduct(zAdjustVec);
xVec.normalise();

Vector3 yVec = zAdjustVec.crossProduct(xVec);
yVec.normalise();

targetWorldOrientation.FromAxes(xVec, yVec, zAdjustVec);

mTransform is basically the SceneNode of the character, I'm multiplying the target orientation with it's inverse orientation to get it to parent/character-space.
mHips->_setDerivedOrientation(mTransform->_getDerivedOrientation().Inverse() * targetWorldOrientation);
The above code was taken from OgreCamera.cpp, the setDirection function, the part with the fixed yaw axis.
Now, that works... Sorta, I now get this problem at near-90 degree pitch, the orientation kind of flips to the other side, I've made another video to showcase this:

https://www.youtube.com/watch?v=6bdFhW_vtUs

Any ideas on how to fix this ?

I've asked on both the OGRE3D and GameDev.net forums, I'll link to there just in case.

OGRE3D: http://ogre3d.org/forums/viewtopic.php?f=2&t=78213
GD.Net: http://www.gamedev.net/topic/644417-vectorquaternion-help-pitch-bone-to-direction-vector/

sentences: Camera rotation according to target direction I am facing issue when camera is following to my target and target rotates to 90 degree or -90 degree than camera is not rotating.i want smooth rotation according to target when target is change the direction of movement.please help me if you can..thanks in advance.

sentences:
Vertex data from a buffer I'm using a geometry shader to generate polygons for my voxel terrain (marching cubes).  The data is output into a buffer using the method shown in the article I link to below.

http://msdn.microsoft.com/en-us/library/bb205122%28v=vs.85%29.aspx

Is there any way to somehow extract the vertex data from the buffer, sort of like the inverse operation of this?

struct Vertex
{
    float x, y, z;
    float tu, tv;
}

Vertex[] data = new[] // this is what I want to get
{
    ...
};

DataStream stream = new DataStream(bufferSize, true, true);
stream.Write(data);
stream.Position = 0;
buffer = new Buffer(device, stream, description);

sentences:
Procedural Generation of tile-based 2d World I am writing a 2d game that uses tile-based top-down graphics to build the world (i.e. the ground plane). Manually made this works fine.

Now I want to generate the ground plane procedurally at run time. In other words: I want to place the tiles (their textures) randomised on the fly. Of course I cannot create an endless ground plane, so I need to restrict how far from the player character (on which the camera focuses on) I procedurally generate the ground floor.

My approach would be like this: I have a 2d grid that stores all tiles of the floor at their correct x/y coordinates within the game world. When the players moves the character, therefore also the camera, I constantly check whether there are empty locations in my x/y map within a max. distance from the character, i.e. cells in my virtual grid that have no tile set. In such a case I place a new tile there.

Therefore the player would always see the ground plane without gaps or empty spots.

I guess that would work, but I am not sure whether that would be the best approach.
Is there a better alternative, maybe even a best-practice for my case?

sentences:
Can Google Translate's audio files be used in a game? For my game, I need text-to-speech. Since it's Android, I decided to settle for MP3s, since the range of words spoken is few.

For my prototype, I'm using Google Translate to generate the audio since it has awesome pronounciation across multiple languages.

But can I use it in production? What if I sell my game for $1 on the app store?

All I can find on SE is that the API may be LGPL, and that the licensing page mentions the API is only available for academic research -- nothing more. My usage is a bit different; I'm actually capturing the audio bits and using those instead.

I'm curious to know the license for this; I can't find anything with my Google-fu.

sentences:
Cant find a way to set fps for sf::Time Myclass
{
void run();
sf::Clock m_clock;
float m_time;
float timestep
}
Myclass::run()
{
if (m_time>= timestep)
{
//update
m_time-=timestep;
}
restartCLock();
}
Myclass::restartCLock()
{
m_time+=m_clock.restartAsSeconds();
}

How do i do the same but when m_time is being sf::Time?

sentences:
Style: When to call GL Enable/Disable I'm working on an OpenGL application and some routines render textured objects, some are just colored primitives. I was wondering if there was a standard convention for how to deal with setting the OpenGL 'state'.

For example, consider this routine (using OpenGL ES / OpenTK):

/// <summary>
/// Renders the given tile at the corresponding screen-tile location.
/// </summary>
public static void RenderTile(float[] vertices, float xOffset, float yOffset, uint textureId)
{
    GL.EnableClientState(All.VertexArray);
    GL.EnableClientState(All.ColorArray);
    GL.EnableClientState(All.TextureCoordArray);

    GL.PushMatrix();

    GL.Translate(xOffset, yOffset, 0.0f);

    GL.BindTexture(All.Texture2D, textureId);
    GL.VertexPointer(2, All.Float, 0, vertices);
    GL.ColorPointer(4, All.Float, 0, SQUARE_COLORS);
    GL.TexCoordPointer(2, All.Float, 0, SQUARE_TEXTURE_COORDS);

    GL.DrawArrays(All.TriangleStrip, 0, 4);

    GL.PopMatrix();
}

I'm curious about that GL.EnableClientState(All.TextureCoordArray); bit. Should I just get into the habit of calling GL.Enable(...) / Gl.EnableClientState(...) for everything the current function needs? Even if it is largely redundant? Or is it better to just assume that the application has a certain set of things enabled (blending, back-face culling, 2D textures, etc.).

I know this question is pretty subjective, so I'm looking for advice from someone who has worked with a large OpenGL codebase. (As all my experience is for solo projects.)

sentences:
Drag And Drop in libGDX (Target and Source) I'm trying to put together a drag and drop system in libGDX with the help of DragAndDrop class. I have the typical system in which you can drag something into a box.

So far it is working all dough I don't know if I am doing it in the most optimal way because but the problem is that one of the draggable object contains two more targets.

So say I have all draggable objects on the left and the boxes (the targets) on the right.

This is what I do for every draggable object:

dragAndDrop = new DragAndDrop();
dragAndDrop.addSource(new Source(icon) {
            @Override
            public Payload dragStart (InputEvent event, float x, float y, int pointer) {
                Payload payload = new Payload();

                payload.setDragActor(drag);
                payload.setValidDragActor(valid);
                payload.setObject(icon);
                icon.addAction(Actions.alpha(0.7f));
                return payload;
            }
            @Override
            public void dragStop(InputEvent event, float x, float y, int pointer, Payload payload, Target target){
                icon.addAction(Actions.alpha(1));
                if(target!=null){
                    draggedInDragBox((CommandBin) target.getActor());
                }

            }
        });

The DraggableObject extends Group and contains Image icon. That's what I pass to the constructor of the source. (Maybe I should pass all the object [this]). I also have the images drag and valid in the DraggableObject. The actual Texture is the same for all icon, valid and drag but I think I need all 3 objects to make it work. Am I right?

Then in the boxes I do:

dragAndDrop.addTarget(new Target(this) {
        //Logic is in source
        public boolean drag (Source source, Payload payload, float x, float y, int pointer) {
            return true;
        }

        public void reset (Source source, Payload payload) {
        }

        public void drop (Source source, Payload payload, float x, float y, int pointer) {

        }
    });

So I pass the object DragBox to the constructor of the target. As you can see all the logic is in the Source. Ass you can tell there. What I do is. If target =! null it means that we dropped the object in a valid place so I want to add the DraggableObject to the DragBox (addActor).

public void draggedInDragBox(DraggableObject do){
    //We add the command in the box
    addCommand(_this); //This simply calls addActor(do) in DragBox
    //We create a new draggable object to be able to use it again
    DraggableObject drOb = new DraggableObject();
    northController.draggableObjectsContainer.addActor(drOb);
}

The difference between a normal DraggableObject and the one that displays subDragBoxes (which extends the first one) is this in the constructor:

public RedDraggableBox() {
    super();
    subdraggableBox[0] = new DraggableBox();
    subdraggableBox[1] = new DraggableBox();
}

And when it is dragged to a main box I just call:

public void showSubDraggableBoxes(){
    addActor(subdraggableBox[0]);
    addActor(subdraggableBox[1]);
    icon.toFront();
}

This is what I want to accomplish.

Say the red is a special DraggableObject that creates subdraggable boxes when placed in a draggable box. So when it is there in the box I add to the group DraggableObject the two boxes. Currently I can drag any DraggableObject to a main box. When I drag an object to a box that has already an object it destroys the current object and places the new one instead, which is exactly what I want it to do.

The problem with red DraggableObjects is that when I Drag something to one of its subDraggableBoxes it erases the red draggable object (with the boxes) and substitutes it by the new one in the main DraggableBox. So by the time a RedDragBox is visible: RedDragableBox.parent() -> RedDraggableObject, RedDraggableObject.parent() -> DraggableBox (the main one).

Thanks in advance.

sentences:
How many VBOs should I use and should I keep a copy of their data? Firstofall, I am sorry if my question is to broad.

I am developing a tile based game and switched from those gl.Begin calls to using VBOs.

This is kind of working allready, I managed to render a hexagonal polygon with a simple shader applied.

What I am not sure is, how to implement the "whole" tile concept.

Concrete the questions are:

Is it better to create 1 VBO for a single tile and render it n-Times in
  every different position, or render one huge VBO that represents the whole "world"
Depending on the answer above, what is the best way to draw a "linegrid".
  Overlay with the same vbo using the respecting polygon.mode , or is there a way
  to let the shader to this?
How would frustum-culling or mousepicking work then, do i need to keep the
  VBO-data in memory?

sentences:
PNG image as a level map for 2d game I've been using a tilemap editor for making levels, but I was wondering if there was a way to use PNG images as the level map, as maps created in tiled editor are graphically uninteresting.

Background: I've recently started 2d game development and have learned basics i.e collision, game loop etc. I am developing game in JavaScript for Windows 8, but c#/c++ would work for me also.

sentences:
How can I compute a "steepness" value for height map cells? Here's a question related to height map generation. From a 2D height map I want to produce a second map, I guess you can call it sort of a derivative map, which shows the "steepness" of all the discrete values of the map. I plan to use it to quickly determine what kinds of objects can be placed on different locations.

In practice you would have many areas where rise/run is a fractional value, since many places do not have 45 degree angle slopes. But running through the pixels of the height map in any direction, the value differences are all integer values.

So what I planned to do in order to represent smooth slopes of varying degrees is, iterate through the pixels row by row, and find the lengths of all the distances where height does not change, and for every change in height, divide that by the length of the distance. Do the same thing column by column and then average the two results for each pixel. I do have to wonder how accurate this is in situations where a lower elevation is surrounded by two walls/plateaus since the rise/run is technically infinity, as it represents a completely vertical climb.

Is this a reasonable way for calculating steepness? I haven't found any resources on how to produce a 2D array of steepness values from height maps, just things on topographic (real-life maps) with the basic rise/run formula.

sentences:
How to avoid wagon wheel illusion of a rotating gun barrel reversing direction? I didn't know which forum to post this in, but I'm going to try here first. I am making a shotgun with 3 barrels which spin. However, I also want it to have kickback in the animation, but every time I add that recoil it breaks the animation, making a strange wagon-wheel style illusion. No matter what I try, it always reappears once I add the recoil. Here is the animation:

Here is how the animation is supposed to be perceived, with the barrels spinning in one direction:

But this is what I often see when I look at it, where it seems to snap backwards one step:

It may be a bit hard to see, but if you look at it long enough it will flip between the two, similar to that animation of a ballerina which can be spinning in either direction.
I have tried having it only spin when it is down, only spin when it is up, changing the interpolation of the spinning and of the recoil, everything I can think of, but none of it works.
How do I solve this problem? Can I stop the optical illusion while keeping the recoil?

sentences:
Panning value of 2nd GameObject's AudioSource is not initializing I'm making a prototype and stuck in a problem where two GameObjects swap but there values of panStereo of AudioSource is not initializing from a float array which contains all the default values of panStereo of all the GameObjects in a scene:
 panningArray = new float[Inventory.bowlsManager.BowlPanningValues.Length];
    for (int i = 0; i < Inventory.bowlsManager.BowlPanningValues.Length; i++)
    {
        panningArray[i]=Inventory.bowlsManager.BowlPanningValues[i];
    }
    Selectable = false;
    SelectedBowl.GetComponent<AudioSource>().spatialBlend = SelectedBowl2.GetComponent<AudioSource>().spatialBlend = 1;
    iTween.MoveTo(SelectedBowl, iTween.Hash("position", temp2, "time", transitionspeed));
    iTween.MoveTo(SelectedBowl2, iTween.Hash("position", temp, "time", transitionspeed));

    SelectedBowl.GetComponent<Renderer>().material = SubsituteMaterial;
    SelectedBowl2.GetComponent<Renderer>().material = SubsituteMaterial;
    int SelectedBowlIndex = Array.FindIndex(Inventory.allBowls.ToArray(), x => x == SelectedBowl.GetComponent<Bowl>()); ;

    int SelectedBowlIndex2 = Array.FindIndex(Inventory.allBowls.ToArray(), x => x == SelectedBowl2.GetComponent<Bowl>());
    print(Inventory.bowlsManager.BowlPanningValues[SelectedBowlIndex2]);
    print(Inventory.bowlsManager.BowlPanningValues[SelectedBowlIndex]);

   val1=  BowlPanning(SelectedBowl2 , panningArray[SelectedBowlIndex]);
     val2= BowlPanning(SelectedBowl , panningArray[SelectedBowlIndex2] );

Here is my bowl panning function:
 public float BowlPanning(GameObject BowlRequire,float value)
{
    BowlRequire.GetComponent<AudioSource>().panStereo = value;

    return BowlRequire.GetComponent<AudioSource>().panStereo;

}

sentences:
Building a flexible GLFW Event handling system (for beginners) The 2017 Thread "How to improve my input handling in GLFW?" is brilliant!  Exactly my question and what seems like some great solutions.

However "Tyyppi_77" is hard for me to understand as a beginner.  For starters:

1) how is addBinding called and when in the flow?  Can you describe what the parameter Callback% callback is and its purpose?

I'll stop there for now. Ty!

class Window
{
public:
    using Callback = std::function<void()>;

    void addBinding(int key, const Callback& callback)
    {
        m_Callbacks[key].push_back(callback);
    }

    void onKeyPress(int key)
    {
        for (Callback& callback : m_Callbacks[key])
        {
            callback();
        }
    }
private:
    std::map<int, std::vector<Callback>> m_Callbacks;
};

sentences:
What is wrong with my vertex declaration? What is wrong with my vertex declaration below? I am using it with instancing. After adding TextureInformation to it, it renders weird and has an epileptical seizure.

    public struct VertexInstance : IVertexType
    {
        public Matrix World;
        public Color Color;
        public Vector3 TextureInformation;

        // I use arithmetic here to show clearly where these numbers come from
        // You can just type 28 if you want
        public static readonly int SizeInBytes = sizeof(float) * 23;

        // Vertex Element array for our struct above
        public static readonly VertexElement[] VertexElements = {
            new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 0),
            new VertexElement(sizeof(float) * 4, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 1),
            new VertexElement(sizeof(float) * 8, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
            new VertexElement(sizeof(float) * 12, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3),
            new VertexElement(sizeof(float) * 16, VertexElementFormat.Color, VertexElementUsage.TextureCoordinate, 4),
            new VertexElement(sizeof(float) * 20, VertexElementFormat.Vector3, VertexElementUsage.TextureCoordinate, 5)
        };

        public static VertexDeclaration Declaration
        {
            get { return new VertexDeclaration(VertexElements); }
        }

        VertexDeclaration IVertexType.VertexDeclaration
        {
            get { return new VertexDeclaration(VertexElements); }
        }
    }

sentences:
How do I load tmx files with Slick2d? I just started using Slick2D and learned how simple it is to load in a tilemap and display it. I tried atleast a dozen different tmx files from numerous examples to see if it was the actual file that was corrupted. Everytime I get this error:

Exception in thread "main" java.lang.RuntimeException: Resource not found: data/maps/desert.tmx
    at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:101)
    at game.Game.init(Game.java:17)
    at game.Tunneler.initStatesList(Tunneler.java:37)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
    at game.Tunneler.main(Tunneler.java:29)

Here is my Game class:

package game;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.tiled.TiledMap;

public class Game extends BasicGameState{
    private int stateID = -1;
    private TiledMap map = null;

    public Game(int stateID){
        this.stateID = stateID;
    }
    public void init(GameContainer container, StateBasedGame game) throws SlickException{
        map = new TiledMap("data/maps/desert.tmx","maps");//ERROR
    }
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException{
        //map.render(0,0);
    }
    public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException{
    }

    public int getID(){return stateID;}
}

I've tried to see if anyone else has had similar problems but haven't turned up anything. I am able to load other files, so I don't believe it's a compiler issue. My menu class can load images and display them just fine. Also, the filepath is correct.

Please let me know if you have any pointers that might help me sort this out.

sentences: How do I make a rope from point A to B in Box2D? I need to make a rope (preferably not elastic) from one point to the next in Box2D. If it helps, I'm trying to develop one of those 2D Spiderman games, like this: http://www.gamesbutler.com/game/4327/Hanger/

sentences:
How can I make an infinite cave using stage3d? I want to make an infinite cave in my 3d game using flash stage3d. But I got no idea about how to build that cave. Can anyone can give me some solution or hint?
update:
I've tried agal fragment shader like squeae tunnel in shadertoy

code:

var fragmentProgramCode:String =
                AGALUtils.build()
                .mov("ft0","v0")
                .div("ft1","ft0.xy","fc3.xy")
                .mul("ft2","fc6.x","ft1")
                .sub("ft3","ft2","fc5.x")//vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy;
                .mul("ft1","ft3.x","ft3.x")
                .mul("ft2","ft3.y","ft3.y")
                .pow("ft4","ft1","fc6.z")//float r = pow( pow(p.x*p.x,16.0) + pow(p.y*p.y,16.0), 1.0/32.0 );
                .pow("ft5","ft2","fc6.z")
                .add("ft1","ft4","ft5")
                .pow("ft4","ft1","fc6.w")
                .mov("ft5","fc5")//uv
                .sub("ft1","fc7.x","ft4")
                .add("ft5.x","fc7.x","ft1")//uv.x = .5*time + 0.5/r;
                .mov("ft6","fc0")//for atan
                .atan2("ft5.y","ft3.y","ft3.x",new <String>["fc7.y","fc5.x","fc7.z","fc7.w","fc8.x","fc8.y","fc8.z","fc8.w","fc9.x","fc9.y"],"ft6")
                .tex("ft0","ft5","fs0","repeat","linear","nomip")//tex
                .mul("ft1","ft4","ft4")
                .mul("ft2","ft1","ft4")//r*r*r
                .mul("ft1","ft0.xyz","ft2")
                .mov("ft0.w","fc5.x")
                .mov("oc","ft1").toString()

it can only apply one material,but my project requires different types of material (like floor,ceilling).
so ,I create a 3d model
Is there anyway to make that 3d model render like "infinity cave"? use agal to make each side of cave's texture move?
thanks for your help

update again:

I tried glsl to make a cube,when using color It looks good,but when I don't know how to apply texture's transform. It's really hard for me to accomplish this,haven't 3d experience before,thanks for your time !

#ifdef GL_ES
precision highp float;
#endif

uniform vec2 resolution;
uniform float time;
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D tex3;

vec4 p1 = vec4(0.0, 1.0, 0.0, 1.3);//down
vec4 p2 = vec4(0.0, - 1.0, 0.0, 1.3);//up
vec4 p3 = vec4(1.0, 0.0, 0.0, 1.3);//left
vec4 p4 = vec4(-1.0, 0.0, 0.0, 1.3);//right
vec4 p5 = vec4(0.0, 0.0, 1.0, 1.3);//center

void main(){
 vec2 uv = -1.0 + 2.0*gl_FragCoord.xy/resolution.xy;
 uv.x *= resolution.x/resolution.y;
 vec3 o = vec3(0.0, 0.0, 2.3);
 vec3 rd = normalize(vec3(uv, -1.0));
 vec3 lp = vec3(sin(time), sin(time), cos(time));
 float li = 2.0;
 vec3 co;

 float tm = 10000.0;
 float t=- (dot(p1.xyz, o)+p1.w)/dot(p1.xyz,rd);
 if(t>0.0&&t<tm){
   co =vec3(.2);//down
   tm=t;
 }
 t=- (dot(p2.xyz, o)+p2.w)/dot(p2.xyz,rd);
 if (t>0.0&&t<tm){
   co =vec3(.3);//top
   tm = t;
 }
 t=- (dot(p3.xyz, o)+p3.w)/dot(p3.xyz,rd);
 if (t>0.0&&t<tm){
    co =vec3(.4);//left
    tm = t;
 }
 t=- (dot(p4.xyz, o)+p4.w)/dot(p4.xyz,rd);
 if (t>0.0&&t<tm){
    co =vec3(.5);//right

    tm = t;
 }
 t=- (dot(p5.xyz, o)+p5.w)/dot(p5.xyz,rd);
 if (t>0.0&&t<tm){
     co =vec3(.6); //center
     tm=t;
 }
 gl_FragColor = vec4(co, 1.0);
}

sentences:
Architechture problem of implementation of a tutorial for a game I'm creating one for my game and I'm confused a bit. I made special TutorialManager class and a number of steps to pass for player first time entered the game.

The problem is that tutorial steps are N separated classes, and each has some logic to lead the player. The problem is that I had to open (make public) a lot of private methods of UI and field to give TutorialStep classes ability to operate with objects I need, and it's an awful solution as far as I can see. But I have no idea how to organize it in other way.

I'm not sure I've described the problem clear enough, so any questions will be answered.

sentences:
MVC? patterns for game development? Possible Duplicate:
  MVC-like compartmentalization in games?

I am thinking of the best way to structure my project and was thought a MVC style pattern would be appropriate. Would be correct having the model handle the majority and basically being the game engine?

Are there any standardised patterns recommended for simple game development?

Model / Game Engine

Data: Level Design, Chat feeds, etc
Game Status: Player status, Enemy status, World Status etc etc.
Engine: Physics, Collisions, AI

View

3D: Gameplay, Camera, Rendering...
2D: UI etc

Controller:

Player Input
UI Input

sentences:
Pygame collision detection less frequent when objects are increased I currently experiencing an issue in pygame where whenever i increase the number of objects e.g. platforms, rocks

for a in range(150):
    rock = Rock(0,0)

OR incresing the range which they spawn in:

rock.rect.x = random.randrange(-200,30000)
rock.rect.y = random.randrange(80,500)
rock_list.add(rock)
all_sprites_list.add(rock)

LINE 232

(which i really need to do for an ENDLESS mode) collision detection between the player and all the objects that have have been changed will become less frequent, so the character will just go through th objects as they weren't even there... you can see the character fall through the objects, it falls through in front of the object and not behind. All game code is below, I have tried a number of different techniques and values but I have found that these numbers and ranges work best.

Collision Detection code:
 FOR PLATFORM

medium_collide = pygame.sprite.spritecollide(player, medium_list, False)
if medium_collide:
    player.rect.y-=2

FOR ROCK

    rock_collide = pygame.sprite.spritecollide(player, rock_list, True)
    if rock_collide:
        lives-=1
    if rock_collide:
        player.rect.y = 100
        player.rect.x = 50

!!!!!GAME CODE BELOW!!!!!

GAME CODE

sentences:
How do I properly import an fbx 3D model into Unity3D? I am trying to properly import a 3D model that was made for my game in Unity3D. I was able to import the model, and I put the texture on it, but there are several other files that go unused. I think I'm not importing the files properly, or I'm not using the files properly.

The files provided for me are as followed: (You can see these in this link as well)

Cheese.FBX
Cheese.obj
Cheese.png
Cheese_D.png (What does the "_D" indicate?)
Cheese_N.png (What does the "_N" indicate?)

Perhaps I am overthinking it, but i feel like I should be attaching cheese_d and cheese_n to the prefab I'm making somehow, but I don't understand their function. I am fairly new to 3D modeling, so I think I'm missing some conventions.

sentences:
Looking for a square-to-hex pixel coords algorithm So as the headline suggests, I am looking for an algorithm/algorithms used for square-to-hex and hex-to-square pixel coordinates convertion.

I have an image which looks kinda "interpolated", meaning some pixels are of one colour, while some have a slightly different shade etc. So pixel colour kinda stores offset or whatever. If you're interested, it's here

It has to do with pathfinding, the logical part of map is made of hexmap while the visual part of map is made of squares. Here, size of the square = 1 pixel, same hex size is equal to 1 pixel.

So basically I will be trying to convert an image with hex pixel coords to image with square pixel coords and vise versa.

I'm sorry if this was answered already somewhere, I couldn't find it anywhere.

P.S. I reverse engineered the image, so in binary it was only X and Y coords stored plus a third byte value which I took as a greyscale colour (later compared with another image and it matched)

Image:

sentences:
Drawing from an ArrayList drawing same image repeatedly (Slick2D) This is the game I'm working on.

I isolated the problem into this class.

public class Runa extends BasicGame {
int startTime, tracker;
public ArrayList<Circle> circ = new ArrayList<Circle>();
public int[] a = new int[]{
        15, 16, 17, 18, 19, 32, 36, 40, 45, 46, 55, 56, 57, 58, 63, 65, 68, 70, 72, 74, 79, 80, 81, 82, 86, 94, 95, 96, 97, 98, 99,
        100, 101, 102, 103, 104, 105, 117, 120, 122, 126, 128, 129, 130, 131, 133, 138, 139, 140, 142, 149, 151, 155, 156,
        158, 164, 166, 172, 174, 180, 182, 184, 188, 189};
public ArrayList<Integer> aList = new ArrayList<Integer>();
public Runa(String title) {
    super(title);
}

@Override
public void init(GameContainer c) throws SlickException {
    startTime = 0;
    tracker = 0;
    //this just transfers the hard coded values into an arraylist
    for(int i = 0; i<a.length;i++){
        aList.add(a[i]);
    }
}
@Override
public void update(GameContainer c, int d) throws SlickException {
    //this calculates the rhythm of the game
    startTime+=d;
    if(startTime>((60/(calcBPM(195.8,89)))*1000)){
        startTime=0;
        tracker++;
    }

    //this adds a new circle every time the current beat (tracker) reaches a beat on the aList
    if(aList.indexOf(tracker)>0)
        circ.add(new Circle(50,50,50));
    //this should just move one circle at a time, meaning I thought that only one circle would be added above, and move it down 4 px
    for(Circle circle: circ)
        circle.setCenterY(circle.getCenterY()+4);
}

@Override
public void render(GameContainer c, Graphics g) throws SlickException {
    //draws each circle in the arraylist
    g.setColor(Color.red);
    for(Circle circle: circ)
        g.draw(circle);
}
//calculates the bpm
public double calcBPM(double d, int numSecs){
    return d*60/numSecs;
}
public static void main(String[]args) throws SlickException{
    new AppGameContainer(new Runa("Test"),680, 480, false).start();
}

}

Why is it doing that weird stretch thing? Is that because I'm using an arraylist?

sentences:
UV unwrapping and texturing for a voxel terrain As sugested by another kind user, I started using MagicaVoxel to create the scenery for my game (which is in the 2.5D style of Pokémon Gen 5 or Octopath Traveler).

I managed to import the test object that I made into Blender (actually it was a .ply export so i could have all the blocks be individually shown).

Now my question is, how can I unwrap and texture 1 of the blocks and replicate this to all of them? (Is this even feasible?)

I want to apply textures similar to the blocks in Minecraft for example.

sentences:
Unrealscript tutorials for self-made maps I've been looking up tutorials for UnrealScript, but I'm very confused by what I find.

All tutorials seem to use Visual Studio and nFringe for the coding, plus the UDK editor for the maps.

Every tutorial I've come across seems to assume I want to either modify UT2004 or edit physics. This is not the case. I plan on making some custom maps in UDK with no textures or anything, and script some events for those maps. Lights turning on and off. Doors opening and closing. Walls shifting. That kind of stuff.

As such, the tutorials I've found are confusing and take up a lot of time and configuration I don't understand. Can someone get me on the right path for what I'm trying to do here?

sentences:
Downsides of using this integration formula for movement? So I read that Gaffron integration basics tutorial and noticed how the Euler integration method gives a small error over time. I implemented the RK4 and noticed that with constant acceleration, I could simplify the formula. Over the course of an hour with some use of wolframalpha, I noticed that the formula eventually just simplifies down to just this:

float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

Position += (0.5f * Acceleration * dt + Velocity) * dt;
Velocity += Acceleration * dt;

I ran it through a console and sure enough, it gives the proper values for each timestep and the correct final value.

Will this formula always yield perfectly accurate answers? My acceleration will always be constant. Is there a name for this formula?

sentences:
How does one calculate color intensity? How do I calculate color intensity if I have a image sample of RGB?

The sample is of a float3 of red, green, blue. I'm trying to do a bilateral blur and have to not change the image if the color intensity is the same so it will preserve edges.

 float4 BilateralFiltering(VertexOut input) : SV_Target
{

 const float pixel = 0.01f;

     float4 centralColor;
     float gaussianWeightTotal;
     float4 sum;
     float4 sampleColor;
     float distanceFromCentralColor;
     float gaussianWeight;
     float distanceNormalizationFactor = 1.0;
     centralColor = gDiffuseMap.Sample(samAnisotropic, input.Tex.xy + float2(0,0));
     gaussianWeightTotal = 0.18;
     sum = centralColor * 0.18;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     return sum / gaussianWeightTotal;

     }

sentences:
How to set widget size that is independent of screen resolution/density in kivy I had coded a simple click game with Python-kivy to android.

You should click dots which are popping out randomly at screen. I set their size 20px to 60px as your level. But it seems when I try on different device screen resolution change the hardness of game. low resolution phones have higher change. I also look at some game (2048 - piano tiles etc) they are also have the same problem.

Should I keep ignore the resolution or try to solve this problem? If so how?

sentences:
Staggered Isometric Map: Calculate map coordinates for point on screen I know there are already a lot of resources about this, but I haven't found one that matches my coordinate system and I'm having massive trouble adjusting any of those solutions to my needs.
What I learned is that the best way to do this is to use a transformation matrix. Implementing that is no problem, but I don't know in which way I have to transform the coordinate space.

Here's an image that shows my coordinate system:

How do I transform a point on screen to this coordinate system?

sentences:
HTML5 without a framework I am looking to get into game development, after a lot of searching I have decided to try with html5 and, while I can see the advantages of frameworks, I would like to learn the basics without a "crutch".

Is it realistic to even try and start learning game development without using a framework? Also, if I decide to use one, what should I consider when deciding on one?

sentences: Isometric tile map rotation Is it possible to rotate an isometric tile map, either in LibGDX or Tiled map editor? My problem is that LibGDX renders the (0, 0) position from Tiled at bottom-left corner like it usually does (see the attachments), however that introduces awkwardness when editing the map as you have to keep in mind that the top corner of the map will be the left corner when rendered in game. Is there any workaround for this?

sentences:
Implementing a camera / viewport to a 2D game What is the most practical way to implement camera/viewport to a 2D-game?

I've read, that I should store the object world position instead of position relative to the screen?

Current situation:

I have implemented a simple 2D-game where I load objects and levels from XML-files. Currently the level XML-file looks like this:

<map>
   <tile obj="ground" x="0" y="555" />
   <tile obj="ground" x="16" y="555" />
   <tile obj="ground" x="32" y="555" />
   ...
</map>

All objects have a 2d-vector "position" storing their current location on the screen.

What I want it to be:

In the picture:

Camera is either 800x600 or 640x480
Blocks and sprites are 16x16 pixels.
World size may vary
The coordinates probably should be normalized relative to the world, not to the screen?
Viewport position relative to player's x, y and moves when the player reaches camera dead zone (similar to this video).

I'm asking pseudo examples / articles, but if you need to know what I'm using for the development: SDL & C/C++.

sentences:
MonoGame - correct overloads for SpriteBatch.Draw flipping horizontally I want to flip my sprite horizontally while drawing and I can't figure out how to use the correct parameters without either an error or a warning about the method being obsolete.

This is what I assume it would be:

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, Color.White,
SpriteEffects.FlipHorizontally);

Except it comes up for errors for the color (cannot convert from color to rectangle) and the SpriteEffects bit (cannot convert from sprite effects to rectangle).

What is the correct way to lay out these arguments?

P.S: When I provide all the default values (says it's obsolete):

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, null, null, null, 0f, null,
Color.White, SpriteEffects.FlipHorizontally);

sentences:
How do I choose an optimal texture size for a mobile Unity game? I am developing a 2D game with Unity2D for Android, iOS, WebPlayer and maybe for desktop computers. I think the working resolution of my game is 1280*800.

How do I choose the optimal size of textures? May the textures be high resolution, for example 1920*1080? I read somewhere that it could be bad for devices with a small resolution.

sentences:
My GLSL shader isn't compiling even though it should. What should I investigate? I'm porting an iOS game to Android. One of the shaders I'm using wouldn't compile until I reduced the number of uniform variables. Here are the uniform definitions:

uniform highp   mat4 ViewProjMatrix;
uniform mediump vec3 LightDirWorld;
uniform mediump int  BoneCount;
uniform highp   mat4 BoneMatrixArray[8];
uniform highp   mat3 BoneMatrixArrayIT[8];
uniform mediump int  LightCount;
uniform mediump vec3 LightPos[4]; // This used to be 12, but now 4, next lines also
uniform lowp    vec3 LightColour[4];
uniform mediump vec3 LightInnerOuterFalloff[4];

My issue is that the GLSL shader wouldn't compile until I reduced the count of the above arrays from 12 to 4. My understanding is that if those 3 lines were arrays of 12 then I would be using 56 vertex uniform vectors. I query the system at startup (GL_MAX_VERTEX_UNIFORM_VECTORS) and it says that 128 are available. Why wouldn't it compile with 56? I'm having issues on the Kindle Fire.

sentences:
Event-driven vs state synchronizing networking model I was going through the Tribes network model and the network model used in Quake3. What I understand is that Tribes is more of an event based model where as the Quake model uses game states and delta game states to sync clients. Is my understanding right?

What kind of games do these models favor? Also what are the drawbacks of one model compared to the other. I am currently developing a two player First Person maze solver game and trying to choose between the two models.

sentences:
How can I modify how my scene is drawn to make it look like it's taking place at different times of day? My game has a day-time association with the scene, that the morning light will be different from the afternoon and the night. But I don't know how to make this difference.

Here is an example in Pokemon game:

I have an idea that put a layer on the top of the game with the transparency about 10 - 20%, and change its color depends on the time, but I don't know which color is good.

Are there any other mechanisms to do some kind of day/night cycle in a game of this style?

sentences:
Why ImGui not rendering image correctly in my game ui [Scene:]

I am working on a game project.In a part of my project,I have to do following things.

1.Read a image

2.Detect face(I am using opencv)

3.view in my imgui window using ImGUi::image()

I already have abstracted my texture object working fail~safe(without any runtime error).I also abstracted a class integerating use of opencv.That part is also fail~safe.

Opencv reads imagefile and detects face and return its unsigned char*(format demanded by opengl)which later fed to my texture object..creating Opengl texture

ImGui requires opengl texture id to render an image using ImGui::image()function..After all my texture is ready,so no problem in calling the function

[Problem:]

I tried drawing two different image

1.Whole image(512x512)

2.The facial part of Whole image(173x173)

Whole image is rendered quite well.but when i render facial part image seems to shear or say disort..why?i mean it is not rendered correctly...

This the first part i did...I read lena.jpg and rendered whole image in imgui window...this was the result

And then in second part i detected face using opencv and fed to gl texture the face ROI and rendered the image.But result was this

both imageg are square matrix..one is rendered well while other is not..How shall i fix this

sentences:
How to move the camera to center an object in screen? For example, an object is located at (x,y,z) in world space. Now how to calculate the offset translation, I mean no rotation, that will be applied to the camera so as to place the object at the center of the screen?

BTW, I'm using three.js r91. But pseudo code/C++/C# is also OK.

sentences:
Getting an images rgb value at click I'm not sure if this is at all possible, but maybe it will spark up an interesting conversation. (Sidenote: working on a small game in Löve).

I'm making an archery shooting kind of game, and I was thinking it might be cool to have critical and regular hits based on where the user shoot the arrow at the enemy. Example, if I have a troll image, and the user clicks the head of the troll, it will count as a critical hit.

Checking to see if the user clicked on the top part of the image vs the bottom, isn't the tricky part. The hard bit will be to check if the user clicked on apart of the image, instead of blank space in the png...

So, main question: Is it possible to get the rgb value of where an image has been clicked, to determine if they hit or missed the target.

Also, if this is at all possible, is there anyone familiar with Löve that can confirm it is doable?

Edit: I'm realizing now it's not the rgb value I want to look for, it is whether or not the clicked pixel has transparency. If it is 100% transparent that means the user missed the image.

sentences:
experience/level growth system formula based on a plot chart, what kind of equation suits this one? Hi I am trying to build a experience/level growth system based on the following plot chart, however I can't think of a proper formula or equation to this chart. Can anyone lend me a hand, please? The x-axis grow significant bigger very fast but the y-axis grow very slow after it reaches 200.

I have tried log and power function but can't make it work. What kind of equation should I use to make it conform to this chart?

sentences:
How to calculate score in my game based on playtime and coins picked? I've been trying to figure out a way to calculate the score in my game.... but nothing seems to work properly...

The score is to be calculated according to:

playtime
coins collected.

The playtime should be as low as possible and number of coins should be as high as possible.

For example:
Let's say an idle play for a level X has:

playtime = 15 seconds
coins = 20.

The score is 100.

Then what will be the score when the:

playtime = 20 seconds
coins = 14.

P.S.: Pardon me if the example is wrong but I can't figure out how to explain my problem...
Thanks in advance.

sentences: Can SpriteBatch be used to fill a polygon with a texture? I basically need to fill a texture into a polygon using the SpriteBatch. I've done some research but couldn't find anything useful except polygon triangulation method, which works well only with convex polygons (without diving into super math which is definitely not something I'm pretty good at). Are there any solutions for filling in a polygon in a basic way? I of course need something dynamic (I'll have a map editor that you can define polygons, and the game will render them (and collision detection will also use them but that's off topic), basically I can't accept solutions like "pre-calculated" bitmaps or anything like that. I need to draw a polygon with the segments provided, to the screen, using the SpriteBatch.

sentences:
Why is this Procedural Content Generation while that other isn't? I'm reading the online Procedural Content Generation book and on chapter 1, page 2 there's one example of what PCG is and another of what PCG is not and I can't tell them apart.

This is PCG according to them:

  game engine middleware that rapidly populates a game world with vegetation

This is NOT PCG according to them:

  a game engine capable of integrating automatically generated vegetation

Also on page 1 they explicitly said they do not consider a game engine PCG

  A key term here is “content”. In our definition, content is most of what is contained in a game: levels, maps, game rules, textures, stories, items, quests, music, weapons, vehicles, characters, etc. The game engine itself is not considered to be content in our definition.

My guess is the PCG example is a code in a game (or it could be a code that adapts to any game) that recognizes the game map and populates it with vegetation according to it. And the not PCG example for me would be like an option available from the game engine were the developer can add the vegetation offline via the user interface.

The last one is a very very wild guess from me, I'm pretty sure I'm wrong cause at first glance they both sound like PCG. Please help me differentiate them.

sentences: How to properly protect a flash game? If I understand correctly, the main point of protecting a single player flash game is to keep it sitelocked. How to do this right and are there any other reasons to do this?

sentences:
How to offer directional ambient audio I'm working on a game side-project that will be heavily audio-based. One feature I'd like to offer are ambient sound zones which correspond to locations of nearby areas.

Say for instance the player is standing on a beach with waves breaking to the right, and a rainforest to the left. Each of these regions has its distinct ambience. If you continue forward, the breaking waves should still be just as loud on your right. Similarly, if you head into the forest, the sound of the waves should slowly be replaced as you move away from the beach. Many games seem to treat ambient sound as either vaguely positional, or as an environmental sound that comes from everywhere at once. What I'm trying for are different areas with different distinct sounds so you can actually orient yourself to them (I.e. you should be able to return to the beach by listening for the breaking waves, they shouldn't just be omnidirectional and faint.)

I don't want to get too deep into architecture, but my system is simple 2-D tile-based. I've thought of several possible approaches and am wondering a) which is best or b) if I've missed one that is better.

Place distinct, loud ambient sounds in specific locations. This would certainly provide directionality of a sort, but I wonder if the ocean waves might eventually sound ahead or behind and right as you walk down the beach, since all the ambience is coming from a single point. This also wouldn't allow for, say, walking out in the ocean past the breakers and hearing them behind you.
Placing sound sources throughout the area, spaced a reasonable distance apart. So for instance the breakers might be a single row of wave sounds which you could walk along or past. Similarly, the forest would be a grid of scattered nature sounds. This seems like the best approach, but I wonder if I'd quickly hit some limit for number of sounds that can be mixed. I'm using the web audio API, not sure if that intelligently doesn't render sounds that are too soft to hear. While this seems conceptually simpler, a long beach might have hundreds of distinct sound nodes placed along it.
Track the player's nearest intersection with a given zone, and play its ambience at those coordinates. So if you're walking along a beach with breaking waves to your right, I'd project out an invisible circle for as far as you can realistically hear, identify the closest intersection with various audio zones, and play their respective ambience. Maybe limit this to the nearest 2-3, since any more would likely be overwhelming. This seems least demanding in that it'd play fewer sounds, but would likely require more collision checks and thus might be impractical.

Thoughts?

sentences:
Is Deferred Rendering The Future? Is deferred rendering the future of real-time 3d rendering on pc hardware (at least until raytracing becomes feasible)?  I'm aware of the benefits (lots of lights, less state changes) and also trouble spots such as anti-aliasing, translucent items, and higher memory bandwidth.

But will the next-gen engines all be using deferred?  Is forward rendering a thing of the past?

sentences:
can someone help me with this code for my platformer. ive been working on the script for an eternity but unity keeps saying there is an error using UnityEngine;
using System.Collections;

public class player_controler : MonoBehaviour {

    public float moveSpeed;
    public float jumpHeight;

    // Use this for initialization
    void Start () {
    }

    // Update is called once per frame
    void Update () {

        if(Input.GetKeyDown) (KeyCode.Space))
        {
            rigidbody2d.velocity = new vector2(0,jumpHeight;)
        }

    }
}

This is what shows up:

Assets/scripts/player_controler.cs(16,53): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

sentences:
Augment an existing game with touch gestures I want to enhance Homeworld 2 gameplay with touch gestures. The game is running on Windows.

So, two questions:

Is it possible to wrap the game with a program that would capture
touch gestures, convert it to keyboard and mouse input and send it
to the game?
How would I approach this task? Using 3rd party libraries, making my own, or something built in to Windows?

sentences:
Creating Complex Collision Shapes in GMS2 I'm pretty new to Game Maker Studio 2 and I've hit a wall in programming with their built-in physics engine. I created a irregularly shaped object and I want to modify the collision shape so that it fits the shape of the sprite. In the built in collision shape editor it only allows you to create a convex shape with a max of 8 points. Is there another way to do this without having to plot out points individually in code?

Thanks!

sentences:
Issues with background coordinate configuration in objective c with runAction? In my game I want to have two backgrounds going one after the other creating a continuous loop moving to the left. However, right now one goes, and the other does not follow it.

Here's what I currently have, which isn't working.

if((self = [super init]))
{

    self.isTouchEnabled = YES;

    background=[CCSprite spriteWithFile:@"testbackground88.png"];
    [self addChild:background z:1];
    background.position=ccp(500,240);
    id repeat1 =[CCRepeatForever actionWithAction:[CCSequence actions:
                                                         [CCMoveTo actionWithDuration:7 position:ccp(-300,240)],
                                                         [CCPlace actionWithPosition:ccp(800,240)],nil]];
   [background runAction:repeat1];

    background2=[CCSprite spriteWithFile:@"testbackground92.png"];
    [self addChild:background2 z:1];
    background2.position=ccp(500,240);
    id repeat2 =[CCRepeatForever actionWithAction:[CCSequence actions:
                                                         [CCMoveTo actionWithDuration:7 position:ccp(-300,240)],
                                                         [CCPlace actionWithPosition:ccp(800,240)],nil]];
   [background2 runAction:repeat2];
}

sentences:
Infinite loop of prerendered 3d graphic I have a game where I want a never ending pathway for the character to walk along. So in my 3d modeling tool I created a path like this:

now I want to loop that model over and over in my prerendered 2d game for the character to walk on (most of the other game elements are in 2d). The problem is that simply overlaying one image on top of another results in the tiles facing opposite directions. Here's another picture I slapped together so you'll get the idea. In the final game the outer border of the pathway won't separate the two paths.

as you can see, the tile pattern looks unnatural, like one pathway segment is a mirror of the other. How can I change the lens/render the model differently so that it can become a seamlessly looping 2d texture?? Can it be done using only the camera view, without a "quadrilateral reshape" or falsely stretching the back end of the platform in my 3d modeler?

sentences:
Chunked QuadTree creation & handling I am new to LOD-based techniques so please be lenient with your comments about my naive questions.

Preface:

My aim is a simple terrain renderer (preferred C++ and OGL) that is to load a height-map (say 990 x 990 x 8bit) organized into 33x33 vertex chunks. No on-demand paging, just the sampling vertices from the height-map data directly into the vertex-buffers of the chunks. The rendering should be done via a quadtree whereas the leafs would render a whole chunk (33x33 vertices).

After reading Thatcher Ulrich's "Adaptive Quadtree" article, as well as chunked LOD and quite many other articles and questions on stack-exchange, I still seem to be too stupid to wrap my head around on how to actually proceed. Ulrich rendered leafs as triangle-fans directly (in his demo-code) which was appropriate at that time (I guess) but my prerequisite is a batch of triangles at once, hence the chunked approach.

1) Using a quad-tree (which is easy enough to understand, at least conceptually, and will -presumably- not lead to patent-wars later as with e.g. 'geo-mipmaps'), at some point the tree will have to be created. My guess was to load (or generate) a height-map first and then PRECALCULATE a quad-tree based on this map. Would that be a viable approach?
Various articles seem to expect the reader to know this fact a priori, so it is nowhere clearly stated. If pre-calculated, then all possible child-nodes would be pre-allocated in the RAM and walked top-down with some distance-to-node-by-width LOD criteria that would force the child-nodes to take over.

2) If pre-allocated, HOW would one render the chunks if lower LOD is required. I.e, the chunk being 32x32 quats => 33x33 vertices, an index buffer holding 33x33 indices would render the whole chunk as is. Now, a neighbor-node with one lower LOD-level is not a leave anymore, and its index buffer would not only need to span the four chunks of it children, it would also have to have an index buffer that indexes every second vertex as well to maintain only a single level of difference (or so my understanding). So I guessed (again) that EVERY node (leaf or not) would have to have (at least) one index buffer, and this index buffer would also have to be created/calculated during creation of the entire tree. (Which I would place in the engine's loading section, not anywhere close to the rendering-loop).
What I really don't understand is, how to do the rendering with the above approach (if it were the way to go, that is)... When nodes way above (in terms of lower LOD-level, i.e. coarser resolution) must draw their content, would that mean that the vertex-buffers of ALL chunks (in the leaf nodes way down) must be bound? And how would the index buffer of this node address the vertices in all the chunks?...
Or, would one have an empty 33x33 patch standing to the ready to collect vertices from various chunks as indexed by this lower-level node? (Sounds cheesy already whilst writing this...)

I would love to see an answer to this. I would accept a NO-CAN-DO with quadtrees and alternative suggestions, but a quad-tree solution is what I hope for.

My own alternative solution (which is a whack-job on my mind though) is a kinda 'Infinite Snapshot Quadtree' that starts with a root and creates nodes on-the-fly, but does only store as many nodes as required to render the visible world. A node however must carry all information to recreate its parent as well as to be able to create a chunck-geometry. The subdivision depth with this approach is (virtually) infinite (not considering issues with precision here), but the neighbor-linking mayhem is beyond good and evil...

Best Regards.
Edward

sentences:
Unity Pre Build Script - Add target dependent UI Elements I wrote a postbuild script that deploys my builds to google drive. That works great, but when I tried to use the same type of logic on a pre build script, it fails. I'm trying to enable all game objects with the tag Mobile if the platform is mobile (andriod or ios). Otherwise turn those off. This is what I have for a script:

#if UNITY_EDITOR
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
using UnityEditor;

public class PreBuild : IPreprocessBuildWithReport
{
    public int callbackOrder => 0;

    public void OnPreprocessBuild(BuildReport report)
    {
        var mobileGameObjects = GameObject.FindGameObjectsWithTag("Mobile");
        switch (report.summary.platform) // todo: make sure all targets are populated here
        {
            // mobiles
            case BuildTarget.Android:
            case BuildTarget.iOS:
                //enable all game objects
                foreach (var mobileGameObject in mobileGameObjects)
                {
                    mobileGameObject.SetActive(true);
                }

                break;
            // standalones (desktops)
            case BuildTarget.StandaloneWindows:
            case BuildTarget.StandaloneLinux64:
            case BuildTarget.StandaloneOSX:
                foreach (var mobileGameObject in mobileGameObjects)
                {
                    mobileGameObject.SetActive(false);
                }

                break;
            // todo: consoles
        }
    }
}
#endif

The build runs fine, but when I run in mobile, none of the UI elements are there (off by default). Here is the heirarchy of them in my project:
 (screenshot not working):

- UI (Canvas Game Object)
  - Mobile ("Empty" Game Object, is tagged with "Mobile")
    - Joystick1
    - Joystick2
    - ActionButton

What am I missing?

sentences:
Separating scene generation and scene starting in Unity? I'm working on a game, where the map is generated, and:

The map is generated in an Awake(), so when an object's Start() is called, the map should be fully initialized.
But the scene's physics world won't be updated till the next FixedUpdate.
So when Start() is called, there is a high chance, that physics operations are done in an incorrect world (like raycasting)

I tried using Physics.SyncTransforms, but it didn't solve the issue for some reason. (Why?)

My next approach was to start the objects with a delay. Precisely: after a FixedUpdate.

So I started a Coroutine in the Start() method, which waits for a FixedUpdate, then starts the object.
But this caused that for example: ObjectA's Update() is called before ObjectB's Start coroutine finishes.

How could I achieve that scenes won't be started until the scene is fully initialized?

Is there a way to tell Unity to call every Start() i.e. 1 frame later? Or how else could I fix this? What is the best solution?

sentences:
Drawing Colored Geometry in OpenGL using SDL First off, I will confess I have asked the same question on stackoverflow, but I think this forum might be a better fit.

I am trying to combine 2 things using SDL:

Draw a webcam feed via an SDL_Surface (from OpenCV).
Draw some plain colored geometry on top, using OpenGL.

The problem I have is that—I think—the geometry is textured by the screen texture that I draw the webcam feed in, even if I call glDisable(GL_TEXTURE_2D) right before drawing the quad. See the screenshot below, the square in the top-left is supposed to be white, but it seems to have the color of the bottom-right texel.

The code in my Display function is as follows:

// screen_surface_ contains a frame from the camera
SDL_UpdateTexture(screen_texture_, NULL, screen_surface_->pixels, screen_surface_->pitch);
SDL_RenderClear(renderer_);
SDL_RenderCopy(renderer_, screen_texture_, NULL, NULL);

glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glColor3f(1.0, 1.0, 1.0);
glBegin( GL_QUADS );
  glVertex3f( 10.0f, 50.0f, 0.0f ); /* Top Left */
  glVertex3f( 50.0f, 50.0f, 0.0f ); /* Top Right */
  glVertex3f( 50.0f, 10.0f, 0.0f ); /* Bottom Right */
  glVertex3f( 10.0f, 10.0f, 0.0f ); /* Bottom Left */
glEnd( );

glColor3f(1.0, 1.0, 1.0);
SDL_RenderPresent(renderer_);

You can view all the code of relevant functions here.

I got a blanket answer saying "Don't mix SDL and OpenGL draw code"; as addressed in this bug report. But that would mean I'm simply stuck waiting for that bug to be fixed, so I'm still looking for a way to disable texturing after SDL_RenderCopy has been called.

Edit: I've confirmed that it's indeed still using the screen_texture_. Setting the texCoord to values between 0-100 shows a part of the webcam feed. (I tried 0-1 first but then I read that texCoords are different for rectangular images).

sentences:
Instantiating, Inheritance, Objects and Children basics in Unity First off, please understand I am horrendously confused with how to do things in Unity. I might not even be asking the right questions, I'll pose my problem and hope it shows my gap in knowledge.

For my game project (a clicker game), I have a several types of object for the player to interact with. Food, Training Dummies, Enemies etc. As per most games, I need objects of the similar type to have different parameters. eg. blue enemy does 1 damage, red enemy does 2. Unlike most games, I will only be showing one 'interactable' object per scene. once you defeat that enemy, it dies, you get experience and it respawns. once you've eaten the food, it vanishes and you get whatever bonus and then it restocks based on what you have in your inventory.

So, I'd made a base class Enemy (which is a unity script, right? which is just a c# class you can attach to a GameObject?)

Next step, adding my child game objects into the scene when I need them. I think this is where the confusion sets in.

So far I'd placed a GameObject in my scene, set it's layout etc and attached the enemy script to it.
my respawn mechanic (for a single enemy object repeating itself) was to access the canvasgroup component and set the alpha & interactivity off and then back on, the 'new' enemy would also have it's health refilled, the total updated, all inside a single script using one class.
I'm doing it in such a primitive way because I can't quite understand how to correctly create a new child object into my scene and interact with it.

if I make a c# script "BlueEnemyScript" inherit from script "EnemyScript", that's a "child object" in c#?

I create a GameObject (Blue_Enemy) and attach all the components to it including BlueEnemyScript c# script, then drag it into prefabs.

I then have another GameObject called EnemyManage that will instantiate the prefab via a script.

When I instantiate this prefab (is that a Child in Unity?), it will have it's own unique instance of BlueEnemyScript?

If I were to instantiate the non child Enemy, but change it's parameters as part of the method to instantiate it, wouldn't it have the same effect since it has a unique instance of the script?

Do I even need multiple instances because I'll only have one of the same object type active at a time? should I just swap which method inside the object script is being accessed?

Happy to have this question closed, I understand it's a mess.

I read some old questions but they haven't made it much clearer:

Inheritance Hierarchy and Design -- avoiding multiple inheritance
Trying to better understand Unity gameobjects

sentences:
Mesh filter component is removed from prefab [Unity] I am trying to procedurally generate a city with cubes. I generate the cubes' location, size and textures randomly with an external program and I save to a txt. I created a script in C# that loads that txt file and by instancing a "cube" (made of 6 quads) I generate the buildings. It is important to use these cubes since I can control what textures to use on each side. So far so good, the script runs at runtime (I know it is not the best thing to do) and saves these buildings as prefabs that I can see in the editor.
The problem comes when I want to control the tiling of the textures, since these are buildings, the amount of windows is proportional to the height of the building. I don't want to set the x-y scales of the textures because this creates a considerable amount of materials and affects the batching and performance in general.
What I thought was to instead of changing the material, it would be more efficient to change the mesh uv coordinates of each quad. But as soon as I barely access this component, the mesh filter component of the prefabs disappear.
This code below creates a "voxel" --cube formed by 6 quads--
cube = Instantiate(voxel);
cube.transform.parent = building.transform;
cube.transform.localPosition = something;
cube.transform.localScale    = something;
cube.transform.localEulerAngles = something;

and this below is what breaks the prefabs, note that I don't do anything yet with the mesh, just accessing it messes everything up.
If I comment the line with the mesh, everything is okay. But if I run it like this, in the game the cubes are visible, but when coming back to the editor, the quads in the saved prefabs lack of the mesh filter component and hence they are invisible.
for(int i = 0; i < 6; i++){
    child = cube.transform.GetChild(i).gameObject;  // this is the i-th quad
    Mesh mesh = child.GetComponent<MeshFilter>().mesh; // PROBLEMATIC LINE

    material = set_material(mat_name2[i]);
    child.GetComponent<Renderer>().sharedMaterial = material;
}
localPath = "Assets/Buildings/" + building.name + ".prefab";
PrefabUtility.SaveAsPrefabAssetAndConnect(building, localPath, InteractionMode.AutomatedAction);

As I explained, I need to modify the values of this mesh in order to efficiently control the tiling, this seems to be an impossible task. Since I don't even modify the values of this component, I feel like this is a very annoying bug, I don't see what is wrong with the code.
I have lost several hours trying to understand what is going on. Any help is appreciated!

sentences:
How do I find out at runtime if Vulkan and/or OpenGL support is available? I'm building an engine, which has Vulkan for its primary rendering engine. But to have at least some backwards compatibility with devices that don't get drivers for (Mainly mobile) it I want to implement an OpenGL fallback. Now, how do I check what API's are available in the current system?

I want to check if Vulkan support exists, if not then if GL support exists and if not that then crash.

sentences:
Why when using Mathf Lerp the speed is not changing according to Time.deltatime? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DetectCollision : MonoBehaviour
{
    public Transform player;
    public Transform target;
    public bool turnOnOffPlayerAnimator = false;

    float timeElapsed = 0;
    float lerpDuration = 3;
    float startValue = 1;
    float endValue = 0;
    float valueToLerp = 0;

    private Animator playerAnimator;
    private bool entered = false;
    private bool prevFacing = false;
    private Rigidbody rigidbody;
    private bool stopped = false;

    // Start is called before the first frame update
    void Start()
    {
        rigidbody = player.GetComponent<Rigidbody>();

        playerAnimator = player.GetComponent<Animator>();

        if (turnOnOffPlayerAnimator)
            playerAnimator.enabled = false;
    }

    // Update is called once per frame
    void Update()
    {
        var currFacing = IsFacing(target);
        if (currFacing != prevFacing)
        {
            // here you switched from facing to not facing or vise verca.
            timeElapsed = 0;
        }
        prevFacing = currFacing;

        var distance = Vector3.Distance(player.position, target.position);

        if (IsFacing(target))
        {
            if (entered && distance > 30)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);

                valueToLerp = 0;
            }
        }
        else
        {
            if (valueToLerp < 0.9f)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(endValue, startValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);
            }

            Mathf.Lerp(valueToLerp, 0, Time.deltaTime * 0.0001f);
        }

        if(turnOnOffPlayerAnimator)
        {
            playerAnimator.enabled = false;
        }
        else
        {
            playerAnimator.enabled = true;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        entered = true;

        Debug.Log("Entered !");
    }

    private void OnTriggerExit(Collider other)
    {
        entered = false;

        Debug.Log("Exited !");
    }

    private bool IsFacing(Transform target)
    {
        Vector3 forward = player.TransformDirection(Vector3.forward);
        Vector3 toTarget = target.position - player.position;
        return Vector3.Dot(forward, toTarget) > 0;
    }
}

I tried first 0.1f but it didn't change the lerp speed.
I want that if the player is pressing the W key and moving the player forward and then stop pressing the key W it will smooth slow will lerp to 0. and it does but I also wanted to control the lerp speed.
I want that when the player is starting moving backward direction if the player leave the W key the player should stop slowly to 0. This should be the line :
Mathf.Lerp(valueToLerp, 0, Time.deltaTime * 0.0001f);

but the Time.deltaTime does not seems to affect the lerp at all.
the lerp is working fine I just wanted to control the lerping speed too.

sentences:
Keeping rotation between two objects In my XNA game I have two objects that collide. When the first object collides with the other it is able to latch on to it and move it about the world. I am having a problem with the math here (Math isn't my strong point). I currently have the second object latch on to the first and move around with it, but I cannot get it to keep it's original direction. So, if the object is facing up it should keep this direction relative to how it is being rotated with the original item.

Any tips on how I could best to achieve this?

sentences:
How can I mark a pixel in the stencil buffer? I never used the stencil buffer for anything until now, but I want to change this. I have an idea of how it should work: the gpu discards or keeps rasterized pixels before the pixel shader based on the stencil buffer value on the given position and some stencil operation.

What I don't know is how would I mark a pixel in the stencil buffer with a specific value. For example I draw my scene and want to mark everything which is drawn with a specific material (this material could be looked up from a texture so ideally I should mark the pixel in the pixel shader), so that later when I do some post processing on my scene I would only do it on the marked pixels. I didn't find anything on the internet besides how to set up a stencil buffer and explaining the different stencil operations. I was expecting to find some System-Value semantics like SV_Depth to write to in the pixel shader (because the stencil buffer shares the same resource with the depth buffer in D3D11), but there is no such thing on MSDN. So how should I do this?
If I am misunderstanding something please help me clear that up.

sentences:
AI remembering obstacles without a grid For some research purpose I've build a small tanks game where you have 1 tank controlled by a player and one or more NPC tanks.

Now I want these NPC tanks to navigate through a field which they have no knowledge of. They can detect obstacles if they are in a certain range. If they detect those obstacles they should save them in a certain data construct that's easy to query. So that they can take them in account in pathfinding.

Now here is where I'm stuck : if my field would be a grid (level discretized in tiles) it would be quite easy for me, I would just save which tiles the obstacle is on.

But I haven't really worked with a grid, my tanks just move forward a few pixels depending on their speed, so a tank can be located on any pixel combination. Is this bad game design?

I could probably make a grid just for my obstacles, but that restricts a bit the kind of obstacles I can have.

Any suggestions/tips ? Please ask more information if needed, I was not really sure what to include.

sentences:
How to change mute/unmute button? I'm saving music in libgdx preference, the following code works perfectly but if you enter the settings again you'd see the initial button up regardless if the sound is muted or not.

TextureAtlas buttonsAtlas = new TextureAtlas("ui/dialogButtons.pack");
textButtonStyle.up = skin.getDrawable("music.down");
textButtonStyle.checked = skin.getDrawable("muteMusic.up");
button.addListener(new InputListener() {
 public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
  return true;
 }
 public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
  setMusicplaying(!musicplaying);
  if (getMusicplaying() == false)
   playMusic.stop();
  else playMusic.play();
 }
});

I tried to do this, it works perfecly but doesn't switch the button, when the user is clicking on it, it only switches when the user closes the dialog

if (getMusicplaying() == true) {
textButtonStyle.up = skin.getDrawable("music.down");
textButtonStyle.down = skin.getDrawable("muteMusic.up");}
if (getMusicplaying() == false) {
  textButtonStyle.up = skin.getDrawable("muteMusic.up");
  textButtonStyle.down = skin.getDrawable("music.down");}

sentences:
How to create a depth-recording shader for shadow mapping? I am attempting to implement shadow maps.

I am first going to implement spotlights over directional lights (I am aware this is harder).

Since I was already rendering the geometry, my attempt was to recycle my old shaders and modify them to make shaders to create the depth maps.

This created the following vertex shader:

#version 450

layout(location = 0) in vec3 position; //(x,y,z) coordinates of a vertex

layout(std430, binding = 3) buffer data_buffer
{
    vec4 cubes_info[];//first 3 values are position of object
};

uniform mat4 view = mat4(1); //Camera orientation and position
uniform mat4 proj = mat4(1); //The projection parameters (FOV, viewport dimensions)

void main()
{
    gl_Position = proj*view*(vec4(position, 1.0) + vec4(vec3(cubes_info[gl_InstanceID]),0));
}

And fragment shader:

#version 450

layout(location = 0) out float fragmentdepth;

void main()
{
    fragmentdepth = gl_FragCoord.z;
}

As you can see, both shaders are pretty basic, they are a little more complex than they would otherwise be since they are using instancing, but overall they are simple.

However the output of these shaders is:

Where the original image is:

As you can see, the depth is being lost.

I think this is because my perspective, projection and model matrices are identical for both shaders.

In other words, I think that the camera I use for rendering the second image does not store the depth information. I wanted to know how can you generate a similar projection matrix to store the depth?

sentences:
How does one structure a Player GUI I am using Java and the Slick2D library.

I've been testing around with ways to develop a Player Graphical User Interface (GUI) (to show armour, items picked up, weapons equipped, etc). The one problem I am facing however is how to actually make such a system work.

I do not know if Slick2D has a system for creating a Player GUI. I have tried looking up resources on the internet with limited success.

Currently I am thinking of having a BasicGameState named StatePlayerInventory which is the Player Inventory for the player to interact with and I have another BasicGameState named GameState which is the Over-world map and whatever items the player gets from the over-world map, it will render in the Player Inventory GUI. I already have a functionable inventory class and an item class but it isn't able to be rendered because of I have no GUI for the Player currently.

My question is is what does if this kind of system I have is efficient/workable. If there are better ways of creating the Player Gui, I am open to suggestions. Also, if there are online resources on Player Inventories, it would be nice to have access to them.

sentences:
How can the Unreal Development Kit be used with Android? I've read the UDK will support Android development, I checked the download page on the site and found nothing related to Android.

also read that Dungeon Defenders Android game was built with Unreal engine.

so is there a way to use the UDK with Android ?

sentences:
Multi-layered tilemap I need to be able to efficiently render a tilemap which can be constructed this way:

There is one non-transparent base layer

Then there can be 3 partially-transparent layers on top of it. Each tile consist of tile texture + alpha texture.

I do not know much about rendering tile maps but I do have some knowledge of using shaders in Unity. I know something about control texture technique and about texture atlases.

I have about just 50 textures so I could easily put them all in one texture atlas 2048x2048 which most devices (even mobile) support today.

Also I have one animated texture (sea), so chosen approach should consider that.

What I don't know is how I should generate my mesh (two triangels per tile?) and which data exactly I should pass to my shader and how to do rendering there. Everything considering that there is 4 textures + 3 alpha textures per tile and they should be strictly ordered when rendered.

sentences:
Learning To Create Better Art (2D Games) Until one of my games "makes it" big, or I get flooded with gold ingots, I will have to handle most or all of my game art myself. The crux of my question is: how can I learn enough art to get beyond "programmer art" and into something I would actually be proud of?

The focus of my question is 2D, not 3D.

I already have a good grip on:

Photoshop/GIMP (image maniplation and creation)
Flash (animation and drawing simple art)
Simple drawing (by hand)
Digitizing hand-drawn art
Graphic design

However, games require complex and varied art; anything from backgrounds to icons, sprites, animation, and complex effects.

How do I bridge the gap, artistically?  I already have the experience and confidence that I can do it; I only need to know the direction in which to put my modest efforts. I know this will pay off, especially in the long term. But I'm not sure how to get there.

Using existing art is something I already do, so please don't address that in your question.

sentences:
Mouse look rotation not rotating object axis in Unity So, I made a simple First Person Camera script for my game, and the way it's supposed to work is the camera is rotated by localEulerAngles to rotate the camera around, and then just the Y-axis rotation is also applied to the character, so that he moves in the direction of the camera.

This isn't how its working now.

I've narrowed down the two most likely problems in the scripts, and this first one is from the camera controller:

player.transform.localEulerAngles = new Vector3(0, rotationX, 0);
cam.transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);

Note: the camera works just fine, and rotates perfectly in all directions.

Secondly, the player movement controller, which might not be actually be moving locally? I can't tell.

transform.Translate (new Vector3(0, 0, Input.GetAxis("Vertical") * walkSpeed));
transform.Translate (new Vector3(Input.GetAxis("Horizontal") * strafeSpeed, 0, 0));

There you go. Right now, even though the camera moves just fine with the mouse, and, incidentally, the whole script used to work, the player moves forward on the global Z-axis with W and backwards with S, all the while acting like a shooter on rails.

Thank you!

sentences:
SpriteBatch being drawn outside of Stage? Currently working on my first game, though running into some problems with libgx and screen aspect ratio.

What I have is a Stage which contains things like menu buttons etc, and the rest of the game is pretty much sprites being drawn with via SpriteBatch. To avoid having multiple SpriteBatches and cameras, I have re-used the ones that are created when Stage is created.

    stage = new Stage(WIDTH, HEIGHT, true); // keep aspect ratio
    batch = stage.getSpriteBatch();
    camera = (OrthographicCamera) stage.getCamera();
    // move camera so 'active' screen is centred
    stage.getCamera().translate(-stage.getGutterWidth(), -stage.getGutterHeight(), 0);

Anything that is Stage/Actor related is drawn fine - all goes within the aspect ratio adjusted boundaries.

The problem I'm having is anything that drawn via SpriteBatch, seems to ignore this viewport that is defined by Stage and can be visible outside of the Stage area.

batch.begin();
...
sirWuffles.draw(batch);
...
batch.end();

For example, in the above, if Sir Wuffles is generated outside of the defined WIDTH/HEIGHT it might still appear in the "gutters" of the screen.

Tried to explain it in the below screenshot. It's an exaggerated screen ratio to make the gutters large. I've also covered most of the gutter area in the blue/cyan rectangle so they are very obvious.

Does anyone know what is happening? and how to fix it?

Currently, my "fix" is to use ShapeRenderer to draw rectangles that correspond to the gutters on top of the sprites...

sentences:
How does one escape the GPL? DISCLAIMER I don't pretend to know anything about licensing. In fact, everything I say below may be completely false!

Backstory:

  Recently, I've been looking for a decent game engine, and I think I've
  found one that I really like, Cafu Engine.

  However, they have a dual licensing plan, where everything you make
  with the engine is forced under GPL, unless you pay for a commercial
  license. I'm not saying that it's a bad engine, they even say that
  they are very relaxed about the licensing fees. However, the fact that
  it even involves the GPL scares me.

So my question is basicly, how does one escape the GPL.

Here's an example: The id Tech engine, also known as the Quake engine, or the Doom engine, was the base for the popular Source engine. However, the id Tech engine has been released under the GPL, and the Source engine is proprietary. Did Valve get a different license? Or did they do something to escape the GPL? Is there a way to escape the GPL? Or, if you use GPL'd source code as a base for another project, are you forced to use the GPL, and make your source code available to the world. Could some random person take the id Tech engine, modify it past the point of recognition, then use it as a proprietary engine for commercial products? Or are they required to make it open source.

One last thing, I generally have no problem what-so-ever with open source. However I feel that open source has it's place, but that is not in the bushiness world.

sentences:
How can I teleport seamlessly, without using interpolation? I've been implementing Bukkit plugin for creating toggleable in-game warping areas that will teleport any catched entity to other similar area.

I was going to implement concept of non-Euclidean maze using this plugin, but, unfortunately, I've discovered that doing Entity.teleport() causes client to interpolate movement while teleporting, so player slides towards target like Enderman and receives screen updates, so for a split second all underground stuff is visible.

While for "just teleport me where I want" usage this is just fine, it ruins whole idea of seamless teleporting, as player can clearly see when transfer happened even without need to look at debug screen.

Is there possibility to somehow disable interpolating while teleporting without modifying client, or maybe prevent client from updating screen while it's being teleported?

sentences: Keeping 2 objects within cameras view I have two object to control and I wanted to keep them at cameras view without adjusting the cameras size but the camera can move only in positive y-axis meaning ones it goes up it shouldn't move down but it's okay if one object gets out of bounds. Since its 2D the camera is Orthographic view.

sentences:
Random Range Without Duplicates I have an array of gameobjects (some questions) if player hit some triggers a question from the array is displayed randomly, I want to avoid duplication of displaying questions.

 public GameObject[] Q;
 public static int ColliderCounter = 0;
 int WrongAnswerCounter = 0;
 public int i,old;

 private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Obstcle")
        {
            i = Random.Range(0, Q.Length);
            old = i;
            ColliderCounter++;
            Q[i].SetActive(true);
            GetComponent<PlayerMovement>().enabled = false;
        }

    }

 IEnumerator waitWrongAnswer()
    {
            WrongAnswerCounter++;

            yield return new WaitForSeconds(3f);
            Q[old].SetActive(false);
            i++;
            Q[i].SetActive(true);
            old = i;
    }

And I want to know how to check if all questions are displayed do something.

Thanks in advance

sentences:
Why is perlin noise generating flat terrain in Unity? I am trying to generate terrain using perlin noise however the terrain being generated is a plateau. Here is the code that I'm using:

var xlength = 65.0;
var ylength = 65.0;
var scale = 4.1f;
var heights = new float[xlength, ylength];
function Start () {
    for (var i = 0; i < xlength; i++)
        for (var j = 0; j < ylength;j++)
            heights[i,j] = Mathf.PerlinNoise(Time.time * i / xlength * scale/1000,Time.time * j / ylength * scale/1000)*i*j;
    gameObject.GetComponent(Terrain).terrainData.SetHeights(0,0,heights);
}

What am I doing wrong here?

sentences:
Object not clamping after applying force/impulse? I am having issue with clamping the vertical position of my character after applying force. This causes a jittery effect in my character.

There are other several ways I think of, but I dont know if its the right way.

Use translate, but ive read somewhere that if I am dealing with physics its better that to use addforce.
Add an invisible gameobject with a collider to set bounderies.

and third is clamp its movement while using addforce which in my case does not work. here is my code which I call on the update.

 rb = player.GetComponent<Rigidbody2D>();
 Vector3 clampedPOS = player.transform.position;

    clampedPOS.y = Mathf.Clamp(player.transform.position.y, -6f, 4f);
    player.transform.position = clampedPOS;

    rb.AddForce(Vector2.up * upForce, ForceMode2D.Impulse);

could someone help me with these?

sentences:
Tiled Rendering - Projection matrix I'm trying to figure out how to perform tiled rendering of my 3d scene (OpenGL).  The motivation is to cut the scene up into several textures, combining them into a single image for saving at a very high resolution, or for printing.

I've done some reading on this and apparently I just need to put appropriate parameters into my projection matrix for each tile in the scene.  This is where I'm failing (miserably).  I can't see where or what to use for it.

My perspective projection matrix is pretty standard, like this:

const T fov2 = Math::Tan(fov / 2), extent = (farPlane - nearPlane);

assert(fov2 != 0);

Matrix4x4<T> r;

r.m11 = 1 / (aspect * fov2);    r.m12 = 0;          r.m13 = 0;                                      r.m14 =  0;
r.m21 = 0;                      r.m22 = 1 / fov2;   r.m23 = 0;                                      r.m24 =  0;
r.m31 = 0;                      r.m32 = 0;          r.m33 = -(farPlane + nearPlane) / extent;       r.m34 = -1;
r.m41 = 0;                      r.m42 = 0;          r.m43 = -(2.f * farPlane * nearPlane) / extent; r.m44 =  0;

return r;

I tried an implementation of glFrustum (no longer available as I'm using core profile of course) as follows:

Matrix4x4<T> r(InitialiseAs::InitialiseIdentity);

r.m11 = 2.0f * nearPlane / (right - left);  r.m12 = 0;                                  r.m13 = (right + left) / (right - left);                    r.m14 = 0;
r.m21 = 0;                                  r.m22 = 2.0f * nearPlane / (top - bottom);  r.m23 = (top + bottom) / (top - bottom);                    r.m24 = 0;
r.m31 = 0;                                  r.m32 = 0;                                  r.m33 = -(farPlane + nearPlane) / (farPlane - nearPlane);   r.m34 = -(2.0f * farPlane * nearPlane) / (farPlane - nearPlane);
r.m41 = 0;                                  r.m42 = 0;                                  r.m43 = -1;                                                 r.m44 = 0;

return r;

But, alas I'm not sure what parameters I need to use for left, top, right and bottom when iterating across the scene, viewport or screen.

Can anyone assist me?

Edit: I found this example (unfortunately D3D) of someone doing something similar. The author seems to be just multiplying _11 and _22 by the width (scale up) and then modifying _31 and _32 according to the current tile position - iterating through the whole grid.

I did try this but I got a black screen of doom.

sentences:
Cocos2d Box2d contact listener call different method in collided object I have the building object, when it collides with another object I want to call some method inside it.
Building.mm

-(void)printTest
{
    NSLog(@"printTest method work correctly");
}

in my ContactListener I'm trying to call it so:
ContactListener.mm

#import "ContactListener.h"
#import "Building.h"
void ContactListener::BeginContact(b2Contact* contact)
{
    b2Body* bodyA = contact->GetFixtureA()->GetBody();
    b2Body* bodyB = contact->GetFixtureB()->GetBody();

    Building *buildA = (Building *)bodyA->GetUserData();
    Building *buildB = (Building *)bodyB->GetUserData();
    if (buildB.tag == 1) {
        NSLog(@"tag == 1");
    }
    if (buildA.tag == 2) {
        NSLog(@"tag == 2");
        [buildA printTest];
    }
}

NSLog(@"tag == 2"); work correctly, but [buildA printTest]; get error

  Terminating app due to uncaught exception
  'NSInvalidArgumentException', reason: '-[CCSprite printTest]:
  unrecognized selector sent to instance 0x18595f0'

Obviously I'm referring to the wrong object.
How I can get different method and property in contacted objects from contactlistener class?

sentences:
Why do 3D animations have framerates As far as I'm aware, all 3D animation software (Maya, Blender...) has framerates. That is, keyframes can only be placed on discrete points in time. Why is that? Why can't animation keyframes be placed at any point in time?
The animations are interpolated in the game engine anyway, the game framerate is rarely the same as the animation framerate and even then, somethimes the game's frames land inbetween the animation's frames and we see the interpolated animation anyway.

sentences:
How to rotate object not from it's center point but from it's another point? I am new in unity and I am developing a game where I want to rotate my object I try this code for it.

if(Input.GetMouseButton(0)){
        if(Input.GetMouseButtonDown(0)){
            LastMousePosition = Input.mousePosition;
        }
        else if(LastMousePosition.y> 112){
            Bow.Rotate(Vector3.up*(Input.mousePosition.y - LastMousePosition.y));
        }
        else if(LastMousePosition.y<112){
            Bow.Rotate(Vector3.down*(Input.mousePosition.y - LastMousePosition.y));
        }
        LastMousePosition = Input.mousePosition;
    }

It works fine for me but my object is rotate from It's center point and I want to rotate it from another point can any one help me with this?

sentences:
Outputting Unity commandline build log to console? I'm using Blue Ocean to do a Unity3D build through command lines (https://docs.unity3d.com/Manual/CommandLineArguments.html).

I currently have a stage in blue ocean which runs the build command in a 'Windows Batch Script' outputting the log to a text file on the computer.

is there a way to also output that same logging text to the blue ocean build output? Right now all I see is the batch command.

One way to accomplish this would be if the build output was sent to the console instead of just the logfile passed in the argument.

sentences:
How Can I Find a Shape on 2D Array? For the code in my test project,  I want to find 2D[,] array shape on the char[][] list. I created an actual map with 'char[][]' array.
So, how can I find a tileChar's shape on the worldChar array?

How to do this in Java, C#, JavaScript, pseudo-code, algorithm or etc.?

For Example;

List<string> mainShape = GetRandomShape().Split('#').ToList();
char[][] tileChar = mainShape .Select(a => a.ToArray()).ToArray();
char[][] worldChar = GenerateRandomWorld();

Example Image:

'*' -> NOT NULL

'-' -> NULL

sentences:
Is Physics2D.BoxCast a safe alternative to a row of raycasting? Raycasting in rows is a common practice.

Is using the Physics 2D BoxCast function a good alternative to using
multiple raycasts spread out (an example use being collision
detection in a custom character controller script)?
There is limited documentation on boxcasting. Would boxcasting be
too intensive or more friendly to call each frame?

sentences:
How to align a hint arrow to point along a path? I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of Vector3 of path.corners. Lets call those vectors A and B. Let me illustrate this using figure.

Now I want to position my arrow above the midpoint of the line from B to A, and orient it so it's pointing along the direction from B to A.

When I orient the arrow with LookAt(), it doesn't point in the same direction as the path. Here is an image of my arrow prefab, showing how it's oriented:

sentences:
Why the shareware (not demo) model died? In the early days of the industry, instead of fighting piracy, companies let the users share their games freely, and put some nag screen or something like that on the game.

Then they would sell DLC and expansions (yes, DLC is 20 years old actually :P), hintbooks, cheat codes, swags, etc...

Why this model died?

Note: I am talking about classic shareware, not the crippleware or demo crap.

sentences:
VS Graphics Diagnostic Tools and IDXGIFactory::EnumAdapters() I have the following constructor for my main application class where i enumerate all adapters, that looks something like this:

CApplication::CApplication()
{
    IDXGIFactory* factory;
    CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&factory));

    IDXGIAdapter* adapter;
    unsigned adapterIndex = 0;
    while (factory->EnumAdapters(adapterIndex, &adapter) != DXGI_ERROR_NOT_FOUND)
    {
        mAdapters.push_back(adapter);
        ++adapterIndex;
    }

    ReleaseCOM(factory);
    //...
    HRESULT hr = D3D11CreateDevice(
        mAdapters[adapterIndexToUse],
        mDriverType, nullptr,
        createDeviceFlags,
        nullptr, 0, D3D11_SDK_VERSION,
        &md3d11Device, &mFeatureLevel, &md3d11ImmediateContext);
}

I have Intel HD Graphics 4000 as  primary display adapter and NVIDIA GeForce GT 620M as "back-up" display adapter which do all the heavy work.(i.e. rendering in games)

I want to use Visual Studio 2013 Graphics Diagnostic tools while using NVIDIA GPU, and since NVIDIA GPU is secondary adapter, this corresponds to setting adapterIndexToUse=1.
Problem is that while enumerating adapters only Indel GPU gets enumerated.
That is, call to factory->EnumAdapter(adapterIndex, &adapter) returns DXGI_ERROR_NOT_FOUND if adapterIndex > 0 while using Visual Studio Graphics Diagnostic tools and so my mAdapters class attribute which is std::vector<IDXGIAdapter*> have size 1 causing out of bounds exception when we try to create the Device with adapterIndexToUse specified as 1 (So i use my secondary NVIDIA GPU).

Only cause of this error i have come to think of is that Graphics Diagnostic tools is only supported on primary display adapter, but i don't see why that would be the case.

sentences:
Creating refraction map problem I'm reading riemers tutorial on how to make a water effect and trying to translate it from xna 3 to xna 4. So far I figured out I have to create a shader in order to clip the planes for my refraction map. I'm new to hlsl and how to implement custom shaders into my program, so I am wondering what I am doing wrong here.

  float4x4 World;
  float4x4 View;
  float4x4 Projection;

  float4 ClipPlane0;

  void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0)
  {

clipDistances.y = 0;
clipDistances.z = 0;
clipDistances.w = 0;

position = mul(mul(mul(position, World), View), Projection);

    clipDistances.x = dot(position, ClipPlane0);
  }

  float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0
  {
clip(clipDistances);

return float4(0, 0, 0, 0); // TODO: whatever other shading logic you want
  }

  technique
 {
pass
{
    VertexShader = compile vs_2_0 vs();
    PixelShader = compile ps_2_0 ps();
}
  }

This is the fx file that I found on an xna forum just for reference.

Major edit:

I was able to get the program running successfully but when I viewed the saved screenshot of the refraction map, nothing was clipped.

    public void DrawRefractionMap(Effect clipEffect, Camera camera, GraphicsDevice device)
    {
        Plane refractionPlane = CreatePlane(waterHeight + 1.5f, new Vector3(0, -1, 0), camera, false);
        clipEffect.Parameters["ClipPlane0"].SetValue(new Vector4(refractionPlane.Normal, refractionPlane.D));

        device.SetRenderTarget(refractionRenderTarget);

        device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0);

        foreach (EffectPass pass in clipEffect.CurrentTechnique.Passes)
        {
            pass.Apply();

            DrawTerrain(clipEffect, camera, device);
        }

        device.SetRenderTarget(null);
        refractionTexture = (Texture2D)refractionRenderTarget;

        FileStream stream = File.OpenWrite("Screenshot33.png");

        refractionTexture.SaveAsJpeg(stream, refractionTexture.Width, refractionTexture.Height);
    }

sentences:
What are the fundamentals of a Quad Billboarding effect? I'm taking my first venture in to writing a shader and what I really need to do is create a billboarding effect. A thorough Google search turns up a number of threads on the topic and they always end with

A) Figured it out. Thread closed.

B) Anyone?

C) "long language/system-specific answer without explanation"

Most commonly, people are directed to Riemers which is fine, except his code isn't compatible with XNA 4.0 (what I'm using) and he doesn't explain the shader itself.

Can anyone explain/direct-me-to a language/system agnostic answer of how quad billboarding works?

EDIT: For others so they don't need to dig through the comments: NtscCobalt pointed out that I was attempting to use an orthographic camera when applying the shader. This essentially voided some of the effects of the shader. After changing to a perspective-based cam, the shader worked as it should have.

sentences:
How to display consistent background image Drawing a large background is relatively slow in PyGame.
In order to avoid drawing BG every frame, you could draw it once, then do nothing.

However, if something is overdrawn onto the surface and keeps moving, you will need to redraw the background in order to "erase" the color pixels left by moving object; otherwise, you will have "traces" of the moving object.

I have a moving object in my PyGame. However, I do not want to "clear the color buffer" by redrawing the background image. Redrawing the background image every frame is slow.

My solution :

I will "clear" only required portions (where the "traces" of moving object are left)  of the "buffer" by redrawing portions of background.

Is there any other better way to have a consistent background?

sentences:
Implementing DirectX 7 light attenuation in Unity's Universal Render Pipeline I am create a modern Unity based client of an old MMO from 2000, and I am working on implementing their lighting system. Based on the data I have reverse engineered, it looks like they used a custom attenuation formula. The original client uses DirectX 7. I have found a reference sheet for DX7 light.
http://developer.download.nvidia.com/assets/gamedev/docs/GDC2K_D3D_7_Vert_Lighting.pdf
The relevant info starts at page 17. In the URP, in Lighting.hlsl, I have set up linear attenuation:
float range = rsqrt(distanceAndSpotAttenuation.x);
float dist = distance( positionWS, lightPositionWS);
half attenuation = 1.0f - dist/range;

Looks good! https://i.imgur.com/5bfJ5fF.png
Everything looks good. Now I am trying to (based on the document) recreate the same linear attenuation. It should look something like this:
// DX 7
float range = rsqrt(distanceAndSpotAttenuation.x);
float dist = distance( positionWS, lightPositionWS);
half c0 = 1.0f;
half c1 = 1.0f;
half c2 = 0.0f;
half d = dist/range;
half attenuation = 1.0f / ( c0 + c1 * d + c2 * d * d );

This should give me linear attenuation according to the doc, but it ends up bleeding light way past the range of the light. So I am convinced the distance is wrong. What kind of value is expected here? Normalized distance? It doesn't specify. I have played around with the distance a lot. Set it to the attenuation in the first code example, to the raw value, and a bunch of other values. No luck: https://i.imgur.com/JWJ0HF2.png
Does anyone have any ideas?

sentences:
2D car physics and high speed turning I've been looking at the following page, which has been very helpful: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html but have come into problems with the high speed turning section (about two thirds down the page)

He gives the following function to calculate the slip angle:

but it looks as if Vlat and Vlong are both vectors, and I can't see how putting vectors into the arctan function or the sgn function (which I assume is a function which returns -1 or 1 depending on the value of the sign) works.

The immediately below this he talks about F n,lat which he describes as "normalized lateral force for a given slip angle", but I am not sure how to calculate this value.

I'm not sure of any of the maths below this either, but this may be because I have not yet worked out the above bits, so if you wish to explain things below it then I would be grateful but it is not necessary.

I am writing the code using C# and XNA if this is important.

Thanks

sentences:
Player position triggering teleports I'm developing a Minecraft plugin (bukkit) in which a server admin can create 'portals' - a small region that will teleport any  players who enter it. I have the teleportation sorted and I know how I could define areas that the player's position could be tested against.

This would involve an ArrayList containing the zones and then hooking the PlayerMoveEvent so that the ArrayList is searched each time for a matching portal region.

Although this method would work, I doubt that it would be very efficient when 100+ players are all moving around at the same time. Is there a better way of checking a player position against a set of 'zones' / regions?

sentences:
How to get started in Card Games My end goal is to play a card game with my friends from other locations over the internet. I am going to start with a card game like blackjack and want people to be able to play in real time or close to it. I am not really sure where to start here and in which language. I was kind of thinking of making a website that can do this but I am not really sure. My end goal is to play MTG with friends and build decks.

Any ideas on a language to choose or where to get started? My current plan is C# asp.net webforms... Would Java be a good idea? I dont need it fancy, just functional. I am good at C and C# and some Java.

Thanks.

sentences:
What is a good algorithm for a stock market simulation? I am making a text game about investing in the stock market, however I need a better algorithm, as the current simulation just goes up and down randomly. How can I make it so that its a more realistic simulation in python.

I've looked at the answer to the question
"How would I implement a realistic stock market?", but I want the stock price to be influenced by the users actions, and based on non random actions that they have done. For example, if they buy a massive quantity of an item in the game, the value will go up

sentences:
Calling CCRepeaForever on CCLabelTTF Makes Label Not Show Up I have a CCLabelTTF in the top right hand corner of the view.

-(void)scrollScoreLabelAndMonkey{
scoreLabel = [CCLabelTTF labelWithString:@"0000" fontName:@"Marker Felt"
fontSize:30 ];
scoreLabel.position=ccp(420,300);
scoreLabel.color = ccGREEN;
[self addChild:scoreLabel];
}

I simply add this code to the bottom of the above method. However as soon as i add this line, the label doesnt show up at all.

id moveScore = [CCMoveBy actionWithDuration:.7 position:ccp(scoreLabel.position.x + 10, 0)];
CCRepeatForever *scrollScoreLabel = [CCRepeatForever actionWithAction:moveScore];
[scoreLabel runAction:scrollScoreLabel];

Any help is greatly appreciated!

sentences:
Add UVs back into a model I built a 3D model in Autodesk 123d design, then exported it as an stl. When I convert it into an obj, however, there were no UVs in it.

Is there a way I can add the UVs back into the model using a program like blender?

Cheers!

sentences:
Would landscape left/right make difference when developing Google VR CardBoard Game with Unity? I'm trying to make a simple VR cardboard game using Google VR SDK for Unity. I'm really confused about the problem as my title. Will the values got from

GvrViewer.Instance.HeadPose.Orientation.x;

change when the orientation of smartphone change from Portrait to Landscape Left/Right?

The following code works in Unity demo (after press play button and use alt+right-click to trigger head movement simulation), but I don't have a cardboard so I'm not sure whether it will still work on smartphone with landscape left or right attached to a cardboard.

private void Update()
{
    // forward if the value is positive.
    float forwardValue = GvrViewr.Instance.HeadPose.Orientation.x;
    // turn left if the value is negative.
    float turnValue = GvrViewr.Instance.HeadPose.Orientation.y;
}

private void Move()
{
    Vector3 movement = transform.forward * forwardValue * m_Speed * Time.deltaTime;

    // Apply this movement to the rigidbody's position.
    m_Rigidbody.MovePosition(m_Rigidbody.position + movement);
}

private void Turn()
{

    // Determine the number of degrees to be turned based on the input, speed and time between frames.
    float turn = turnValue * m_TurnSpeed * Time.deltaTime;

    // Make this into a rotation in the y axis.
    Quaternion turnRotation = Quaternion.Euler(0f, turn, 0f);

    // Apply this rotation to the rigidbody's rotation.
    m_Rigidbody.MoveRotation(m_Rigidbody.rotation * turnRotation);
}

sentences:
Adding an InputListener to a Group I'm trying to detect when a Group actor (my "slot") on my stage is clicked by add an InputerListener to the group. I've added the stage to my InputMultiplexer, but when I click on the actor, nothing happens.

Relevant code from the main Screen:

InputMultiplexer inputMultiplexer = new InputMultiplexer();
Stage stage = new Stage();
inputMultiplexer.addProcessor(stage);
Gdx.input.setInputProcessor(inputMultiplexer);

From the Group class:

Label amountLabel = new Label("", GameScreen.labelStyle);
Image itemImage = new Image();
Image slotImage = new Image(new TextureRegionDrawable(new TextureRegion(new Texture("Slot.png"))));
public SlotGroup() {
    this.addActor(amountLabel);
    this.addActor(itemImage);
    this.addActor(slotImage);

    this.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("Hello world");
            return true;
        }
    });
    this.setStage(Screen.stage);
}

sentences:
Unity: How to receive input events on a RectTransform that does not contain any image/text/...? In Unity 2018.3: Imagine a GameObject with only a RectTransform component and a custom script attached to it - otherwise completely empty. Is there a way to receive input events (like IPointerClickHandler.OnPointerClick) without adding any graphical GUI components like text/image/rawimage/etc. ?

In other words: Is there a component or superclass available to receive input events without adding an unused graphical component?

Any clarifications are welcome,
Thank you.

sentences:
Is using SharpDX or SlimDX easier than using DirectX directly from C++? I decided to learn to program in DirectX yesterday, and, not being a huge C++ fanatic, went looking for a .Net wrapper. After reading about SlimDX and SharpDX, I decided I liked what the SharpDX people were doing and began trying to use it. Although they have a huge number of samples that are really nice,  I had trouble finding any tutorials specifically for it. I ended up seeing a huge number of C++ tutorials. Besides the really long and less than aesthetically pleasing function names, it really didn't seem any more complicated than using the managed wrappers.

So my options (and what I think about them) are:

SlimDX/SharpDX are in a language I am familiar with, but nearly as complicated as the C++
DirectX is C++, something I am not too familiar with. I would really need to learn proper memory management.
Focus on really learning C++ well before diving into game programming with straight Direct3D. This would allow me to learn proper memory management and get comfortable with C++.

My original thinking was that if using Direct3D was just as easy as a managed equivalent, there would be no point starting with the managed equivalent. On the other hand, if the managed equivalent is much easier, it would allow me to focus on the ins and outs of developing a game rather than constantly worrying about the language and getting even small things done.

So, will using one of these managed wrappers be easier than using the native Direct3D API itself?

sentences:
Wait until a method finish I'm using Firebase Realtime Database and I'm trying to compare if a name is available to other user. The problem is the method finish before the Firebase's method finish its execution. Here is the code:

private bool IsNameAvailable (string nick)
{
    bool available = false;
    FirebaseDatabase.DefaultInstance.GetReference ("users").OrderByChild ("name").EqualTo (nick).GetValueAsync ().ContinueWith (task => {
        if (task.IsFaulted) {
            Debug.LogError ("A error encountered: " + task.Exception);
        } else if (task.IsCanceled) {
            Debug.LogError ("Canceled ...");
        } else if (task.IsCompleted) {
            DataSnapshot snapshot = task.Result;
            available = (snapshot.GetValue (true) == null);
        }
    });
    return available; //This line executed before the Firebase's method end.
}

What can i do??
Thanks in advance.

sentences:
How to calculate best move in Match-3 game? I am having a hard time identifying how to approach this problem.
If you have a match 3 game and the objects can only be swapped horizontally and vertically, and only swapped if it will result in a match of 3 or more jewels, which will be removed, with each removed jewel adding +1 to the score.
How would I find the best possible move? I'm confused at where to start and been searching for a while now and getting nowhere.

Board  6x6 or 8x8
Matches  = 3 or more of same kind
write function to find best swap for maximum score.

Any help would be greatly appreciated !
EDIT: So I could iterate through the entire board with a nested for loop for the rows and columns, but im not sure what approach to take from here.
For example, say I start with top left which is "red" and I want to test if swapping this will result in a match. How would I go about searching and identifying all possibilities that would result in swapping this left equaling a match and score of 5.
**If I am being really unclear I apologies and will remove my question and possible reword.

sentences:
Generate Random Integers I am trying to make a dice rolling game. I want to generate a random integer in the range of the number of dice I have multiplied by the number of sides the dice has. For example, if two dice were played with three sides, then there could be any number between 2 and 6.

Here is my code; when I put in, for example one dice and two sides, it prints numbers upwards of 13. The problem is that it doesn't create an integer between the amount of sides and dice.

condition = "Start"
while condition == "Start":
Dice = int(input("Please select number of dice you would like to use (atleast 1)"))
Sides = int(input("Please select number of sides on dice you would like to use (atleast 2)"))
if Dice <= 0 and Sides <= 1:
    condition = "Start"
elif Dice >= 1 and Sides >= 2:
    print("You have selected", Dice," dice and", Sides,"Sides")
    condition = "play"
    Roll1 = 0
    Roll2 = 0
    Score1 = 0
    Score2 = 0
while condition == "play":
        Roll1 += randint(Dice,Sides)
        Roll2 += randint(Dice,Sides)
        print (name1,"'s Roll", Roll1)
        print (name2,"'s Roll", Roll2)

sentences:
Rotate character 180 degrees determine direction In my game it should be possible to rotate the character 180 degrees. I always want the character to rotate clockwise.

If the character is rotated 0 degrees and I press the rotate button, the character rotates clockwise to 180 degrees. However, if I know press the rotate button again, the character rotates to 0 degrees but doing so counterclockwise. How can I modify my code so that the character always rotates in a consistent direction?

One solution I've been thinking of is to do the rotaiton in steps like on first button press { 90, 180 } and on second {270, 0 }...

Any help would be greatly appreciated!

_currentTurnAroundAngle += TurnAroundSpeed*Time.deltaTime;

transform.rotation = Quaternion.Euler(0, Mathf.Lerp(transform.rotation.eulerAngles.y, _targetTurnAround, _currentTurnAroundAngle), 0);

if (transform.rotation.eulerAngles.y >= (_targetTurnAround - 0.1f) && transform.rotation.eulerAngles.y <= (_targetTurnAround + 0.1f))
{
    _currentTurnAroundAngle = 0;
    transform.rotation = Quaternion.Euler(0, _targetTurnAround, 0);
    _targetTurnAround = (_targetTurnAround == 0 ? 180 : 0);
    _isTurning = false;
}

sentences:
Backface culling in Unity I am a Unity noob trying to recreate something I did a long time ago in raw OpenGL.

I draw a scene normally glCullFace(GL_BACK), and then draw the walls a second time with face culling flipped glCullFace(GL_BACK) and a semi-transparent alpha to everything.

So my question is how to achieve this in Unity?

Can I basically set up Unity to draw the scene twice, the second time with the new culling mode, a global alpha and perhaps only drawing meshes that are children of node with a particular tag?

Or is there some better or other way to achieve this affect?

sentences:
Game build in unity3d project transfer from a previous developer Can someone help or give me some idea what are the necessary deliverables from a previous developer that I need to ask regarding the game project transfer?

The situation is, there is a company that is developing our game in unity3d and it is already available in Apple store and Playstore. They developed it from scratch and on our part, we are just doing the game testing process. So now, we are going to ask them to transfer the entire project development to us. The company is in another country so we are just communicating thru emails, and we never done the communication by video calls.

And That's it. what are the things they need to transfer to us?

Thanks in advance.

sentences:
javascript game loop and game update design There is a main game loop in my program, which calls game update every frame. However, to make better animation and better control, there is a need to implement a function like updateEveryNFrames(n, func).

I am considering implementing a counter for each update. The counter will be added by one each frame. The update function will be invoked according to the counter % n.

For example, in a sequence of sprites animation, I can use the above function to control the speed of the animation.

Can some give some advice or other solutions?

sentences:
How can I optimize performance when updating tiles? So I'm making a side-scrolling adventure type game in Java. The worlds are procedurally generated, so I can't manually place tiles. Therefore, I every 20 ticks (1/3 second) I update every block's tile on the screen. I know this is a terrible solution, and it's causing a bit of lag. I tried only updating the blocks' tiles once when it was created, but it doesn't work well with the way I've programmed my world generation.

Basically, how the ground is generated is the top layer of ground is generated first, then when the player gets close enough, the layers below are created.

public void testForBlocks()
{
        topTaken=false;
        bottomTaken=false;
        rightTaken=false;
        leftTaken=false;

        for(int i=0;i<handler.screenBlocks.size();i++)
        {
                Block b = handler.screenBlocks.get(i);
                if(b.solid)
                {
                        if(b.oneWay==oneWay)
                        {
                                if(b.x==x&&b.y==y+32)
                                        bottomTaken=true;
                                if(b.x==x&&b.y==y-32)
                                        topTaken=true;
                                if(b.y==y&&b.x==x+32)
                                        rightTaken=true;
                                if(b.y==y&&b.x==x-32)
                                        leftTaken=true;
                        }
                }
        }

        setSprite();
}

This means that if I only update the tile's position once, the tile won't recognize that there is a block below it yet(because there isn't), and will be assigned the wrong tile.

Basically, my question is: How can I update tiles, while keeping it efficient?

I feel like I'm missing an obvious solution. Can anyone help me? Thanks in advance. :)

sentences:
How to change the transparency of an object in Unity c# scripting? I have laser-object in my scene, which I want to be seen only when I press the 'E' button on the key board(just an example of a key).
I have seen many ways to change the transparency , however, none of them worked.
one of them was -

gameObject.renderer.material.color.a = 0.0f ;

I get an Error -  UnityEngine.renderer does not contain color and material sub-functions.

I don't know how to do it, and I tried many ways.
Does someone have an easy way to make an object transparent and visible in C# script ?
Thank you

sentences:
A way to make camera get distance from the player when the player gains velocity? I'm building upon roll a ball example and I'm trying to make the camera gain distance from the player, when the player starts moving (gaining velocity). i came up with this, but it feels clunky and the camera jumps.
is there a better way to achieve this?

public float MiddleLineForCameraAdjuster = 2.4f;
float velocityCounter, offsetCounter, normalizedVelX, normalizedVelY, normalizedVelZ;

//Camera Adjuster
private void CameraAdjuster()
{
    if (rb.velocity.x < 0) normalizedVelX = -rb.velocity.x;
    else normalizedVelX = rb.velocity.x;
    if (rb.velocity.y < 0) normalizedVelY = -rb.velocity.y;
    else normalizedVelY = rb.velocity.y;
    if (rb.velocity.z < 0) normalizedVelZ = -rb.velocity.z;
    else normalizedVelZ = rb.velocity.z;

    if (normalizedVelX + normalizedVelY + normalizedVelZ < 25)
    {
        velocityCounter = normalizedVelX + normalizedVelY + normalizedVelZ;
    }
    else if (normalizedVelX + normalizedVelY + normalizedVelZ >= 25)
    {
        velocityCounter = 25;
    }
    else velocityCounter = 0;

    if (normalizedVelX > 0 || normalizedVelY > 0 || normalizedVelZ > 0)
    {
            offsetCounter = 2.4f + (velocityCounter / 10);
            CameraController.offset.x = (CameraController.offset.x * offsetCounter) / MiddleLineForCameraAdjuster;
            CameraController.offset.z = (CameraController.offset.z * offsetCounter) / MiddleLineForCameraAdjuster;
            MiddleLineForCameraAdjuster = offsetCounter;
    }
}

offset = (transform.position - Player.transform.position);

sentences:
Creating a random lottery system I would like the game to give all 16 characters (15 NPC + 1 player) a number: 1-16. This number stays the same no matter what and is unique only to that character so two characters cannot have the same number. At a point in the game, the character presses a button.

I need this button to generate a random number and load a scene based on the number. Example: Player's pre-determined number is "8", if the number generator generates an "8" as well, it would load the next scene (where the player has to run away from a mob) If the generator generates anything else other than "8" It will load a different scene (where the player chases an NPC)

Just to clear it up if the number generator generates 1-7 or 9-16 it will load the same scene no matter what. (Getting "9" from the generator would load the same scene as "2" would. Only when "8" is generated, would there be a separate scene)

I'm still incredibly new to Unity and coding in general, so a brief summary of what each line of code is doing would be majorly appreciated! (but not at all demanded!)

I'm most comfortable with C# so if you could have the code in that would be great!

sentences:
Game crashes when sound is finished I'm trying to code a simple audio playback test game (which will be used in my actual project), and everything works fine, except for the fact that after the audio has finished playing, the game will crash with a 'stopped working' dialog.

Here's the code that's used to load and play the audio. Regardless of whether it's in LoadContent or not, the crash still happens.

List<SoundEffect> soundEffects;
FileStream soundStream = new FileStream("test.wav", FileMode.Open);
soundEffects.Add(SoundEffect.FromStream(soundStream));
soundStream.Dispose();
SoundEffectInstance soundeffectinstance = soundEffects[0].CreateInstance();
soundeffectinstance.Volume = 0.35F;
soundeffectinstance.Play();

The audio file is a 2 seconds long beep. The game works fine, and the graphics draw fine too. I should also mention that the SoundEffectInstance's State property doesn't seem to work properly as well.

I'm using Visual Studio 2010 with .NET 4.0, and MonoGame framework 3.4.0.459 (MonoGame.Framework.WindowsDX, from NuGet), because that's the only thing I can use without Visual Studio telling me to upgrade to .NET 4.5.

I am unable to debug, as when I debug, the 'stopped working' dialog appears again (for some reason I cannot debug any projects directly through the Debug option in VS), and the debugger hook gets confused.

Is this an upstream issue, or is there just something wrong with the way I load the audio file? (P.S. I'm not using the Content Pipeline due to the nature of my project)

sentences:
Is it possible to do freelancing with 3dsmax? I am learning 3dsmax architecture for building models of houses. Is it possible to do freelancing with house modelling thing?  For various reasons I have to stay at home.

So I was wondering if I can earn some money by making some house models for someone.

I really don't know how this works but may be someone can give some ideas.

Would I need to go to construction or real estate companies and ask them if they want something like this?

sentences:
Given its direction, and another vector that begins at the same point, how can I find the magnitude of that vector using only vector math? I've solved this using the law of sines, but I was wondering if there's a way to do this with just vector math.
Here's a diagram that will hopefully help illustrate what I'm trying to do:

Given vector a and the direction of b, how can I find the magnitude of b? Both vectors share a common origin point. The white line is just supposed to show that both vectors will extend to the same position on either the x or y axis.

sentences:
How to make the damage inflicted to the enemy and the main character more unpredictable I am developing a small mobile game. The enemy can damage my player by throwing objects at his side, and the player can damage the enemy by hitting him with a bat.

For the moment, I am calculating the damage that was caused by the player or the enemy in a very simple way. For example, my enemy has 100% of health. When the player hits him with a bat, the enemy is losing 10% of his health. So after 10 hits the enemy is "dead".

But this is not interesting. The game process is very simple and predictable: you are moving, see the enemy, hit him 10 times, and the move to the next enemy. When the enemy hits the player,the player loses 10% of his  health. That is not cool (the game process is very static).

An alternative, is to use random integer values to calculate damage values. Can anyone give an idea, how to make damage process more interactive and unpredictable, and how to make proportional link between player health and enemy health and the damage.

sentences:
How to avoid the cutoff of a Sprite when overlapping in a terrain? I have a scene where I have a terrain as a PlaneGeometry. And I'm trying to locate a building on it as Sprite. But I'm not able to put that building/sprite centered on the terrain without getting a cutoff.

Make sense because the terrain is cutting the half. But I'm just wondering if there is a technique to solve this problem.

I tried to rotate the sprite as a 3D object. But does not have this property. Also tried using a PlaneGeometry with a MeshBasicMaterial, but the result of the Image looks blurry and without transparency.

sentences:
Game Object Factory: Fixing Memory Leaks Dear all, this is going to be tough: I have created a game object factory that generates objects of my wish. However, I get memory leaks which I can not fix.

Memory leaks are generated by return new Object(); in the bottom part of the code sample.

static BaseObject * CreateObjectFunc()
{
    return new Object();
}

How and where to delete the pointers? I wrote bool ReleaseClassType(). Despite the factory works well, ReleaseClassType() does not fix memory leaks.

bool ReleaseClassTypes()
{
    unsigned int nRecordCount = vFactories.size();
    for (unsigned int nLoop = 0; nLoop < nRecordCount; nLoop++ )
    {
        // if the object exists in the container and is valid, then render it
        if( vFactories[nLoop] != NULL)
            delete vFactories[nLoop]();
    }
    return true;
}

Before taking a look at the code below, let me help you in that my CGameObjectFactory creates pointers to functions creating particular object type. The pointers are stored within vFactories vector container.

I have chosen this way because I parse an object map file. I have object type IDs (integer values) which I need to translate them into real objects. Because I have over 100 different object data types, I wished to avoid continuously traversing very long Switch() statement.

Therefore, to create an object, I call vFactoriesnEnumObjectTypeID via CGameObjectFactory::create() to call stored function that generates desired object.

The position of the appropriate function in the vFactories is identical to the nObjectTypeID, so I can use indexing to access the function.

So the question remains, how to proceed with garbage collection and avoid reported memory leaks?

#ifndef GAMEOBJECTFACTORY_H_UNIPIXELS
#define GAMEOBJECTFACTORY_H_UNIPIXELS

//#include "MemoryManager.h"
#include <vector>

template <typename BaseObject>
class CGameObjectFactory
{
public:
    // cleanup and release registered object data types
    bool ReleaseClassTypes()
    {
        unsigned int nRecordCount = vFactories.size();
        for (unsigned int nLoop = 0; nLoop < nRecordCount; nLoop++ )
        {
            // if the object exists in the container and is valid, then render it
            if( vFactories[nLoop] != NULL)
                delete vFactories[nLoop]();
        }
        return true;
    }

    // register new object data type
    template <typename Object>
    bool RegisterClassType(unsigned int nObjectIDParam )
    {
        if(vFactories.size() < nObjectIDParam) vFactories.resize(nObjectIDParam);

        vFactories[nObjectIDParam] = &CreateObjectFunc<Object>;
        return true;
    }

    // create new object by calling the pointer to the appropriate type function
    BaseObject* create(unsigned int nObjectIDParam) const
    {
        return vFactories[nObjectIDParam]();
    }

    // resize the vector array containing pointers to function calls
    bool resize(unsigned int nSizeParam)
    {
        vFactories.resize(nSizeParam);
        return true;
    }

private:
    //DECLARE_HEAP;

    template <typename Object>
    static BaseObject * CreateObjectFunc()
    {
        return new Object();
    }

    typedef BaseObject*(*factory)();
    std::vector<factory> vFactories;
};

//DEFINE_HEAP_T(CGameObjectFactory, "Game Object Factory");

#endif // GAMEOBJECTFACTORY_H_UNIPIXELS

sentences: How to change Unity's display settings/resolution? Unity displays in poor quality on my computer (the software itself), I was wondering how to change resolution/display settings?

sentences:
How to make "Events"/ Scripted Scenes I want to make cutscenes etc, in my game.

I thought of a similar System like in the RPG Maker:

If you enter a certain Area, a list of commands and arguments is played.

E.g. like this:

[Move Object: Right, right, right; Wait until done;]
[play Sound: sound.sfx]
[Show Message: Speaker: player, message]

I don't want to use external libraries.
Someone has a basic idea on how to implement this?

I thought of a "stack" for these kind of "events", but I'm not sure about it.

sentences:
How to add AdMob to Libgdx in 2018? I found this article here: https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx
But it's from September 2017, and since then Android and Android Studio have been updated. How can I add AdMob to my LibGdx game currently in 2018?

sentences:
How do you deal with transitions in animating walking? I'm pretty new to this whole animating models thing. Just learning the ropes. I got a nice walking animation going, which I can loop while a character is walking, but what about when they stop walking?

I mean, they could be at any point in the animation at the time the player stops walking. How do I get them to smoothly return to a standing still position without having them snap into that position? The same goes for starting walking from a standing still position. Do you need a separate animation? How is this dealt with?

sentences:
What am I missing? (Converting 2D mouse coords to 3D space) I'm making a networked game which has a birds-eye view and I'm trying to convert the 2D mouse coordinates into 3D space. Right now I have a perfectly flat grid and it intends to remain perfectly flat, all I really want is the mouse coordinates to translate onto this grid.

I had a solution figured out that worked fine if the camera was perfectly straight looking down which I thought was going to be enough for what I wanted, but now I've found that it would be nicer if the camera had a slight tilt to it which completely messes with what I have. Could someone help me out in what I'm missing?

nearsourceV = GD.Viewport.Unproject(new Vector3(mouse.X, mouse.Y, 0f), camera.Projection, camera.View, camera.World);
farsourceV = GD.Viewport.Unproject(new Vector3(mouse.X, mouse.Y, 1f), camera.Projection, camera.View, camera.World);

mouseCoordinatesIn3D = Vector3.Normalize(farsourceV - nearsourceV);

zoomMultiplier = -mouseCoordinatesIn3D.Y;
zoomMultiplier = camera.CameraOffset.Y / zoomMultiplier;

mouseCoordinatesIn3D = mouseCoordinatesIn3D * zoomMultiplier;

mouseCoordinatesIn3D.X = mouseCoordinatesIn3D.X + camera.CameraOffset.X;
mouseCoordinatesIn3D.Z = mouseCoordinatesIn3D.Z + camera.CameraOffset.Z;

//Sends data and moves character

I figured I needed to include the camera rotation into it somehow, but I'm not really sure how or where.

Thanks!

sentences:
Simulating beer pong physics in Unity I'm trying to create a simple beer pong game in Unity. The basic idea is this - when it's your turn to shoot, you use your mouse to pick a point on the table that you want the ball to hit and bounce off of.

Then you press the left mouse button, and while it's pressed, move it up and down to determine the degree of the arc of the shot (the ball should hit the same previously chosen spot on the table no matter which degree is chosen).

The arc should be visible as well. It would look something like this:

So my questions are:

Given a target point and a launch angle, how do I calculate the trajectory?
Given the same, how do I calculate the force to apply to the ball?
What is the best way to display the trajectory in Unity? My first idea is manually placing a bunch of particles (which is how I did it in the screenshot), but I'm not sure if that's the best choice performance-wise.

sentences:
Unity Render Texture Artifacting I'm having weird black artifacts appear on my render textures when they are transformed while the game is running.

I am using a ScrollRect as a scrolling container for buttons (the buttons are just textured quads with the same render texture applied to them). When I translate the quads while the game is running, strange black artifacts will appear on the quads themselves.

Is there a way to fix this?

Edit: Interesting to note, setting every quad inactive except for one fixed the artifacting on the only visible quad: http://i.imgur.com/OInBBWs.png

The intensity of the artifacting seems to be related to the number of objects on-screen that use the same render texture. 5 quads active with the same render texture has a really pronounced artifacting, 3 is more subtle, 1 is visibly non-existent.

sentences:
Rotating a planet around a ships axis I have a planet rotating around its own axis (like regular planets, and Pluto) and a spaceship that can fly around in space.
The idea is to lock the player (ship) in a deadzone "above" the planet and when he moves to an edge, the planet begin to rotate in the direction that the ship is traveling. I.E. not rotate the player or camera, but instead rotate the planet.

The problem is I need to rotate the planet (in THOSE cases) around the ship's axis and not its own. So I need some way to create the rotation matrix for the planet using the ship's right and Up vector.

I don't want to use the CreateAxisFromAngle method because I don't want to automate the rotation (assuming that is how the function works, correct me if I'm wrong). I want to rotate the planet while the player is moving in a direction and stop rotating when they stop moving.

I also am not very comfortable with Quaternions. So if that is the solution (which I fear it is), please lay it out to me like you would a child, cause I am quaternions retarded. General math is fine though.

sentences:
Offline XNA Deployment to XBOX. Can it be done? Well,

The question is pretty explicit on its own. I want to know if I can deploy a game from my PC directly to a XBox. I'm not a professional developer of games, I do it on my free time because it amuses me, but nothing else. Im planning on buying an XBox but only if I can connect directly to my Visual Studio and test the games. I don't want to connect to XNA creators club or anything like it, is this possible?

I have XNA 4.0 with VS Ultimate 2k10

Best regards and many thanks in advance,
David

sentences:
3D models on 2D background perspective mismatch we are working on a tactics game, with a hand drawn 2D backgrounds and 3D models moving on them. The game generates a 2D grid placed on a XY plane, with faux isometric tiles (Diamond Grid).

I have tried following the guides found here to create the "isometric" effect on the 3D models: prepared two ortho cameras, one perpendicular to the 2D elements and seeing only them and another rotated (30,45,0) which sees only 3D models. Like this:

The issue we're having is the mismatch of the positions between the elements seen by the cameras.

Character should be standing on the tile with the green border. This cannot be solved by simply moving the 3D camera to match these positions because the seem to differ for objects placed in different parts of the screen.

Could anyone please help?

Thanks!

sentences:
Even tiles wide pathfinding on square based tilemaps? By editing my A* algorithm as such that:

a tile is valid if all of its neighbours are valid (checking this N-1 deep)

I can find N wide paths, where N is odd, and my unit just follow the "center" tiles.

But what if my unit is even tiles wide?

Yes, I generate a 2 tiles wide path, and then traverse it with an offset, so my unit will walk on the overlapping edge between the 2 tiles. (maybe there is a better solution, suggestions are welcome)

But how do I find even wide paths?

(Or my whole approach is bad?)

sentences:
glGenArrays - This functionality is not available Whenever I call glGenVertexArrays(), I get the following exception:

  Exception in thread "main" java.lang.IllegalStateException: This functionality is not available.
      at org.lwjgl.system.Checks.checkFunctionality(Checks.java:36)
      at org.lwjgl.opengl.GL30.getInstance(GL30.java:651)
      at org.lwjgl.opengl.GL30.nglGenVertexArrays(GL30.java:3101)
      at org.lwjgl.opengl.GL30.glGenVertexArrays(GL30.java:3128)
      at me.package.name.ClassName.methodName(ClassName.java:ANY_LINE_NUMBER)

The operating system is OS X Yosemite 10.10.2, Java 7. I think that this problem is OS X specific.

Immediate mode drawing does work.

I am using LWJGL 3.

sentences:
(Java) Trying to animate an arraylist of coins with a (working) animation class I have a coin class which takes in an integer numOfCoinsand an enum LayoutType, which can be linear or curved. A linear layout displays the coins in a straight line one after the other - we'll work with this since the method is small and straight forward.

My constructor looks like this:

public Coin(float xPos, float yPos, int numOfCoins, LayoutType layout) {
        setType(ObjectType.COIN);
        coinList = new ArrayList<Coin>(); // arraylist of coins
        setPos(xPos, yPos); // set starting position of coin(s)
        if (layout == LayoutType.LINEAR)) {
            linearLayout(); // display coins in a straight line
        } else if (layout == LayoutType.CURVE{
            curveLayout();
        }

}

And my linearLayout() method looks like this

public void linearLayout() {
        //draw numOfCoins amount of coins in a straight line
        for (int i = 0; i < numOfCoins; i++) {
            Coin coin = new Coin(xPos, yPos);
            coinList.add(coin);
            xPos += 50; // place coins 50 pixels apart
        }
}

I have a working animation class and a spritesheet for the coins - however, the way I have modelled my coins is in such a way that 1 coin object can contain numOfCoins amount of coins, so I can't just directly call the animation in the draw method.

The class' draw() method is in an abstract class GameObject which Coin extends. It looks like this:

public void draw(SpriteBatch batch) {
    // if the object is a coin iterate through the list of coins
    // and draw the sprites, if it isn't a coin, simply draw the objects sprite
    if (type == ObjectType.COIN) {
        for (Coin coin : getCoinList()) {
            coin.getCoinList().draw(batch);
        }
    } else {
        sprite.draw(batch);
    }
}

This draw() method is called in World.render().

How would I create an animation using my Animatorclass for each coin if I have 6 coins in a straight line for instance? I can't seem to find a way. Highly grateful for any help, thanks.

sentences:
State changes in entities or components I'm having some trouble figuring how to deal with state management in my entities.

I don't have trouble with Game state management, like pause and menus, since these are not handled as an entity component system; just with state in entities/components.

Drawing from Orcs Must Die as an example, I have my MainCharacter and Trap entities which only have their components like PositionComponent, RenderComponent, PhysicsComponent.

On each update the Entity will call update on its components. I also have a generic EventManager with listeners for different event types.

Now I need to be able to place the traps: first select the trap and trap position then place the trap.

When placing a trap it should appear in front of the MainCharacter, rendered in a different way and following it around. When placed it should just respond to collisions and be rendered in the normal way.

How is this usually handled in component based systems?

(This example is specific but can help figure out the general way to deal with entities states.)

sentences:
Foreach loop with 2d array of objects I'm using a 2D array of objects to store data about tiles, or "blocks" in my gameworld. I initialise the array, fill it with data and then attempt to invoke the draw method of each object.

foreach (Block block in blockList)
  {
    block.Draw(spriteBatch);
  }

I end up with an exception being thrown "Object reference is not set to an instance of an object".

What have I done wrong?

EDIT:
This is the code used to define the array

Block[,] blockList;

Then

blockList = new Block[screenRectangle.Width, screenRectangle.Height];
  // Fill with dummy data
  for (int x = 0; x <= screenRectangle.Width / texture.Width; x++)
  {
    for (int y = 0; y <= screenRectangle.Height / texture.Width; y++)
    {
      if (y >= screenRectangle.Height / (texture.Width*2))
      {
        blockList[x, y] = new Block(1, new Rectangle(x * 16, y * 16, texture.Width, texture.Height), texture);
      }
      else
      {
        blockList[x, y] = new Block(0, new Rectangle(x * 16, y * 16, texture.Width, texture.Height), texture);
      }
    }
  }

sentences:
How can I play audio instantly in Java? I know JavaSound API like this:

audioInputStream = AudioSystem.getAudioInputStream(file);
AudioFormat audioFormat = audioInputStream.getFormat();
DataLine.Info info = new Info(SourceDataLine.class, audioFormat);
sourceDataLine = (SourceDataLine) AudioSystem.getLine(info);
sourceDataLine.open();
sourceDataLine.start();
floatVoiceControl.setValue(-20);
byte[] buf = new byte[0xFF];
int onceReadDataSize = 0;

While file is the File object.

But when I tried to play some very small audio very frequently (say, the audio played when a small enemy is killed), it blocks my main thread and make the game very slow.
Is there any alternative or workarounds? I prefer something inside the Java's standard library, since I'm developing a game engine based on Swing.

sentences:
How do I get the InputManager to recognize a certain axis/Vector2D with a Vive motion controller? Right. So basically I want to map the Vive motion controller touchpads (certain locations) to the certain inputs in Unity's InputManager. How do I do this? Like I want a certain area on the touchpad to equate to forwards/backwards in the InputManager. How would I do this? I am not seeing a way to do it natively.

Long story short I'm wondering if I can use the Vive with the InputManager or not.

sentences:
How can I implement pre-rendered 2D sprites that can face any direction? I've been Googling how games like Clash of Clans render their troops, and it appears they are pre-rendering 3D models to 2D sprite sheets before runtime, and rendering those 2d images at runtime. However, troops in Clash of Clans can face any direction.

In my similar game, if I were to create an image for every orientation (0-360 degrees) for every troop type (there are 18 types) at each frame in their animation, they would have to produce a massive amount of images. I can't imagine this is what other developers are doing, so how can I actually accomplish this?

sentences:
place sprites in grid pattern within an area I have been trying to do this for a few hours in unity now but cant get my head around it. basically i have 4 points(vector3) 1 each for the 4 corners topleft, topright, bottomleft, bottomright. now i have a sprite that i use as a block what i want to do is basically fit X number of blocks within the four points. see the image below. Icant think of a way to do this right now.
I would really appreciate any help in how to achieve this. thanks for helping.

sentences:
How to convert depth values into Unity's distance I am new in Unity and now only studying for my work project. I need help with computing real distances from depth values. Can't figure it out.
My shader is:
Shader "Custom/MyDepthShader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}

    }
    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert // compile function vert as vertex shader
            #pragma fragment frag // compile function frag as fragment shader

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;
            sampler2D _CameraDepthTexture;

            fixed4 frag (v2f i) : SV_Target
            {
                float depth = tex2D(_CameraDepthTexture, i.uv).r;
                depth = Linear01Depth(depth);
                depth = depth * _ProjectionParams.z;
                return depth;
            }
            ENDCG
        }
    }
}

I Blit then these values from renderTexture to texture2D and use function GetPixel(i,j). Knowing, that a cube is at 1.5 units distance from camera I can't get this value from depth texture. Thank you for your help.
Now I suspect that I have got distance values, but they are biased by 0.5 for some reason... Can anyone explain this as well?
I found how to get distances from depth texture, so basically I can answer this question, but there is still unexplained bias in measurements.

sentences:
How to skip comparing if one of the value is null? I am using libGDX - Ashley as entity-system framework. My problem is I don't know how do I avoid having a java.lang.NullPointerException when using Comparator<Entity> entity comparison. There is a situation where Entity is removed from the engine, but the Comparator is still continuing. Now how do I skip the comparing if one of the nearby is null?

@Override
public int compare(Entity nearby1, Entity nearby2) {
    Vector2 ownerPos = Mapper.transform.get(owner).position;
    Vector2 nearbyPos1 = Mapper.transform.get(nearby1).position; // possible null
    Vector2 nearbyPos2 = Mapper.transform.get(nearby2).position; // possible null
    return ...
}

When I sort the Array<Entity> for example, using my custom comparator, it returns an error because one of the entity is null or one of the component entity is null. I don't know what to return to make the comparison skip.

boolean skip = ownerPos == null || nearbyPos1 == null || nearbyPos2 == null;

if(skip) {
   return ???
}

I'm thinking of using try-catch statement to skip the sorting. But is this performance safe?

try {
   array.sort(comparator);
} catch(Exception e) {

}

sentences:
Sprite rotation and question about sampler state I'm not an expert in creating game engines, but I'm doing fine for now. Recently I reached a point that I couldn't solve any of my problems. I have two questions:

I'm using D3DXMatrixTransformation2D to produce the transformation matrix for my sprites, but I have a problem with rotation. Whenever I try to set a rotation for my sprite, it does turn when there is a fixed value of rotation. If I give 0.5f it won't rotate, but when I set 1, 2, 3, ... it'll work and that's not really cool. And, I searched a lot about pScalingRotation but it seems it's hasn't any influence. My rotation's value is fine, but the produced matrix doesn't act the way I expect it to.
I want to get a smooth edge for my sprites when they're rotating and I saw p_device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);. Where should I set the sampler state? After creating the device or after every update? And, what about texture filters? I use D3DXCreateTextureFromFileEx to load textures from file and it has Filter and MipFilter. Are these related to the sampler state?

sentences: Is using Sprites the most recommended way for doing 2d animations with Directx? I am working on a game engine of my own and I was using Vertex buffers to create triangles and then draw textures on them. Now I want to extend it so I can do simple 2d animations using "sprite sheets". I'm not sure how to accomplish this by using vertex buffers, since those are "hard coded" and I can't figure out an easy way to draw "portions" of the sprite sheet using them. I've been searching online and most tutorials use DirectX Sprite functions to do it so my question is, is it possible to achieve this by using vertex buffers or should I go and use sprites? The only thing that is stopping me from using sprites is the fact that some graphics stuff I have already relies on vertex buffers.

sentences:
Issues with spine animation alpha in iOS We are seeing a ton of artifacts and strangeness with alpha on iOS for our spine animation assets. You can see an example of one of these grid-like artifacts here, but we're also seeing pixelation etc.
Does anyone know why this is happening, whether we need to make adjustments or change certain settings to address this issue?

sentences:
How to trace contour of shapes with holes? I am experimenting with the RVO2 library for collision avoidance in a 2D simulation. This library supports specifying arbitrary obstacles as a list of vertices. The obstacles must be full shapes, i.e. they must not contain holes.

I've pretty much figured out how to find the contour of a shape (using algorithms such as these), but holes are giving me trouble. Basically I need to solve the following questions:

How to tell if a contour is inside or outside the shape?
How to tell if a shape has a hole inside?
Once a shape has been determined to have a hole, how to segment it to form a shape without hole?

This drawing illustrates the third idea: the outer shape has been segmented so the contour is continuous, i.e. RVO2 can consider it as a shape without hole.

sentences:
Unity3D RigidBody adding force diagonally (x,y,0) results in two separate movements instead of one diagonal movement? The intentions of this function are to utilize the RigidBody component from a "target" object and clear its force while applying a diagonal force in the direction upwards and away from the side they are facing. I have omitted the portion in which detects the other direction for the sake of simplicity in reading the function as I've been testing this function while the user faces the right-hand direction.
Variables:

target refers to the other object currently in the scene
targBody refers to the RigidBody component of the target
object   damage refers to the current damage integer of the
object.      The damage used in this instance is from the target
object   facingRight refers to a bool in which is true
whenever the current object is facing the right-hand
direction.

    public void Damage() {
        targBody.velocity = Vector3.zero;
        if(facingRight) {
            Vector3 newVel = new Vector3(target.GetComponent().damage/16, target.GetComponent().damage/16, 0);
            targBody.AddForce(newVel, ForceMode.Impulse);
            print("Stuff");
        }
        target.GetComponent().damage+=3;
    }
For some reason, when I apply the force, the target object doesn't move diagonally. Instead, it moves horizontally before moving vertically; however, for some strange reason the horizontal speed is always greater than the vertical speed as it goes so fast that it nearly teleports!
I'm not sure if this error happens because of a coding problem on my part that I'm just not recognizing or if it's a problem with RigidBody in which I need to use a workaround for.Anyone have any ideas on what can make this function work the way I want it to?

sentences:
Pathfinding in hex grid based game I'm making a TBS using a hex grid. Player can move units from one hex to another using bridges, which will be randomly generated. I'm using cubic and axial coordinate system for my grid, it's well described in Red Blob Games' Hexagonal Grids.

I don't know how to make a hex understand connection with another one and then calculate best path for units.

I'm not sure how to approach the issue - should I make six slots for bridges in my hex class and then calculate path or should I make movement system somehow and then use absence of bridge as a "blocker"?

sentences:
Is Google App Engine suitable for a real-time but single player game? I'm in the planning stage of a new project. Without going into details, this is a real-time 2D game with some basic construction aspects, combat, and a large procedurally generated world.

Because of the design of the game, it really makes most sense for it to run directly in a browser with all of a player's progress stored on the server. Basically each player will have their own persistent 2D map which they can modify, and I want them to be able to access it from any computer. It's not multiplayer.

Imagine a real-time 2D action and building game that could be played completely offline, except it saves your progress to a server so it can be accessed from anywhere.

This will be my first foray into making an online game or web application, so I'm wanting it to be as painless as possible. Would GAE work well for a game like this? I've been told that GAE is simply not appropriate for a real-time game; however, this has always been said in the context of a multiplayer game, not a single player game.

I should also note that it would be acceptable for the game to have an ordinary save option and to only save data to the server when this option is used by the player. Since that means the player would lose progress if he just closed the tab or browser window without saving, it could be accompanied with a 5 minute autosave.

sentences:
How to split a group of tiles in a grid into separate groups if a break occurs between tiles? I have a grid where objects can be placed down by the player.  Each object that gets placed down is added to a dictionary where the key is the grid position.

Each object that gets placed down either gets added to a new zone, or added to an existing zone if any of the neighbors are in an existing zone.  If there are multiple zones, then it just picks the first one it finds and adds it.

The issue I am struggling with is how to handle splitting up zones if an object is removed from the grid.

In the first image I have 2 zones.

In the second image, I add a new object to the grid, because that tile contains 2 neighbor tiles that are in a zone, it merges the 2 zones into one.

In the third image, I remove an object from the grid, which removes it from the zone, and in this case it creates 2 new zones (but could be more depending on neighbors).  This is where I am struggling to work out the best way to efficiently do this.

I have a grid array that holds all objects placed on the grid.
A zone contains a list of tiles that are in that zone.
Each tile in a zone also gets a zone id.

What would be a fast efficient way of splitting up a zone into multiple zones?

I thought about checking all the tiles in the zone by checking its neighbors, but thought that it could be quite slow, as a zone can grow to be very big over time (zones can auto merge as well).  Also wouldn't there be a chance of an endless loop?

sentences:
Procedural sketch / painting shader So after some google searching apparently I don't even know what this technique is specifically called:

I'm trying to figure out how to create an effect in unity that 'paints' a 2d asset on screen.

By paint, I mean animates brush strokes, eventually 'revealing' the final image. (Start with outlines, then colors)

What is the conventional name for a technique like this, and where would I get started going about creating this kind of effect?

I am not talking about a shader / filter that simply adds a 'painted' or 'hand drawn' effect to an image, but one that simulates actually 'painting' it.

sentences:
DirectX shader - how to spread raytracer computation over multiple frames? I'm playing around making a shadertoy style SDF raytracer in HLSL and to make it run faster on high resolutions (1080p and up) I'd like to spread the computation over multiple frames.

Right now I have a fragment shader that does raytracing for every pixel of a screen sized quad. I've noticed that if I discard (clip()) the fragment for every second pixel, I get 0 framerate improvement despite effectively only rendering half the image. But if I lower the render texture resolution to half, I see improvement obviously. Also if I clip a contiguous half of the fragment and render the other half, I get a similar performance boost.

This must mean that the gpu thread groups are by default allocated in a tiled fashion on the screen, and that all threads of a group must be done computing before the (other) resources of the thread group can be used again.

Does anyone know of any magic that can force a fragment shader to only allocate resources for say half the pixels of the screen? (but keep the render target size)

Alternatively I suppose I could assign my own thread groups in a Compute shader system where I manage all this stuff myself. Is that the only way to do it? And how would I handle the render target then? (know any resources?)

I'm also pretty sure I've seen people make this kind of grainy multi-frame raytracers years ago before compute shaders were a thing.

sentences:
Crash when creating RenderTargetViews for Cubemap I want to create a cubemap and I want to render to it and later sample from it for reflections.
However, It crashes when I try to create the faces for the cubemap.
Here is my code:
RenderTargetCube::RenderTargetCube(ID3D11Device* device, int resolution, DXGI_FORMAT format) {

    D3D11_TEXTURE2D_DESC desc = {};
    desc.Width = resolution;
    desc.Height = resolution;
    desc.MipLevels = 1;
    desc.ArraySize = 6;
    desc.Format = format;
    desc.SampleDesc.Count = 1;
    desc.SampleDesc.Quality = 0;
    desc.Usage = D3D11_USAGE_DEFAULT;
    desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
    desc.CPUAccessFlags = 0;
    desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;

    HRESULT res = device->CreateTexture2D(&desc, NULL, &Texture);
    throwIfFailed(res);

    D3D11_RENDER_TARGET_VIEW_DESC viewDesc = {};
    viewDesc.Format = desc.Format;
    viewDesc.Texture2DArray.ArraySize = 6;
    viewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
    for (int i = 0; i < 6; i++) {
        viewDesc.Texture2DArray.FirstArraySlice = D3D11CalcSubresource(0, i, 1);
        res = device->CreateRenderTargetView(Texture.Get(), &viewDesc, RenderTargetView[i].GetAddressOf()); // crash here
        throwIfFailed(res);

    }

and here is the message I receive:

D3D11 ERROR: ID3D11Device::CreateRenderTargetView: The Dimensions of the View are invalid due to at least one of the following conditions. MipSlice (value = 0) must be between 0 and MipLevels-1 of the Texture Resource, 0, inclusively. FirstArraySlice (value = 1) must be between 0 and ArraySize-1 of the Texture Resource, 5, inclusively. With the current FirstArraySlice, ArraySize (value = 6) must be between 1 and 5, inclusively, or -1 to default to all slices from FirstArraySlice, in order that the View fit on the Texture. [ STATE_CREATION ERROR #137: CREATERENDERTARGETVIEW_INVALIDDIMENSIONS]

I dont quite understand the error message, especially the last part about ArraySize, why does it want it to be between 1 and 5 and not 0 to 5?

sentences:
Game engine for "racing" game I've been planning for a long time to mix data from OpenStreetMap, some digital elevation model (heightmap), satellite imagery for textures, and cook a racing/cruising game where I could drive around familiar parts of the city.

OpenStreetMap contains very nice and detailed maps of all the locations I've checked, so I imagine it won't be so hard to download data for a specified region, like Boone County, Nebraska and stuff them into the game. I could generate buildings in 3d somewhat, as they have defined contour in OpenStreetMap. Roads would be the easiest thing to do as they are the core part of OSM.

What I'm worried about is the game/"simulator" part. I don't know where particularly to start. I suppose I would have to generate a lot of this world during the loading / on the fly. I don't even know if there is anything racing/vehicular-like out there available to use, except for the XNA Racing Game. I'm employed as C# developer, so I'm skilled in that language, but I'd be willing to venture into Python or something similar, if it would increase productivity in this hobby project.

Can you recommend me some engines worth looking into?

sentences:
Switching between Discrete and Integrated GPUs I have a machine with two discrete GPUs and one integrated GPU. I can currently switch between them using NVIDIA's software, but I would like the ability to do so within my applications for purposes of benchmarking and general convenience. Apparently this requires the "NDA version" of NVIDIA's Driver API, which I know not how to obtain. Would using this API be the only way to accomplish what I seek, and if so, how would I obtain it? A solution using Windows APIs would also be acceptable, though less preferable to one which would leverage a cross-platform API. I have created a similar thread concerning the matter on NVIDIA's forum, which is down at the time of this writing.

Thanks for reading my question; it is much appreciated!

Edit: Here's a link to the original post I made on the NVIDIA forums - no luck on either site yet, though.

sentences:
Libgdx change the image inside table dynamically I am trying to draw a HUD that shows the score and time and image like loading but I want to update and change the image when the score get higher but I tried to do that but it is not working. I thought maybe I can define new table in the update method and put different image each time but I don't want to define new table each time. is there anyway to update the image only inside the table: this is the code:

public class Hud implements Disposable{

        public Stage stage;
        private Viewport viewport;
        private static Integer worldTimer;
        private float timecount;
        private static Integer score;
        Label countdownLabel;
        private static Label scorelabel;
        private Label timelabel;
        private Label levellabel;
        private Label worldlabel;
        private Label mariolabel;
        private Image loading;
        private Table table;
        public Hud(SpriteBatch sb)
        {
            worldTimer=40;
            timecount=0;
            score=0;
            viewport=new FitViewport(Fruits.V_WIDTH,Fruits.V_HIEGT,new OrthographicCamera());//2
            stage=new Stage(viewport,sb);//stage is as box and try to put widget and organize things inside that table
            table = new Table();
            table.top();//table at top of our stage
            table.setFillParent(true);//table is now fill all the stage
            countdownLabel=new Label(String.format("%02d",worldTimer),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            scorelabel=new Label(String.format("%02d",score),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            timelabel=new Label("TIME",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            levellabel=new Label("1-1",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            worldlabel=new Label("WORLD",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            mariolabel=new Label("Score"    ,new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            loading = new Image(new Texture("10%.png"));
            //loading.setSize(40, 10);
            table.add(mariolabel).expandX().padTop(10);

            table.add(timelabel).expandX().padTop(10);
            table.add(worldlabel).expandX().padTop(10);
            table.row();
            table.add(scorelabel).expandX();

            table.add(countdownLabel).expandX();
            table.add(loading).width(50).height(10);

            stage.addActor(table);

        }
        public void update(float dt)
        {
            timecount+=dt;
            if (timecount>1)
            {
                worldTimer--;
                if(worldTimer>=0) {
                    countdownLabel.setText(String.format("%02d", worldTimer));
                    loading=new Image(new Texture("90.png"));
                }
                timecount=0;

            }
        }
        public static int getTime()
        {

            return worldTimer;
        }

        public static void addScore(int value)
        {
            score +=value;
            scorelabel.setText(String.format("%02d",score));
        }
        public static int getScore()
        {
            return score;
        }
        @Override
        public void dispose() {
            stage.dispose();
        }
    }

sentences:
Make a trigger work for only a certain type of object Is there a way you can make a trigger only exist to a certain type of objects while excluding other ones. I don't think the code will help but I just put anyway.

public class Girl : MonoBehaviour {

    public Attacker attacker;
    public Animator anim;
    public float girlHealth;
    public GameObject obj;

    // Use this for initialization
    void Start()
    {
        attacker = GetComponent<Attacker>();
        anim = GetComponent<Animator>();

    }

    // Update is called once per frame
    void Update () {
        if (!obj)
        {
            anim.SetBool("isattacking", false);
        }
    }
   void OnTriggerEnter2D(Collider2D collision)
    {
        obj = collision.gameObject;

        if (obj.tag == "Axe") {
            anim.SetBool("isattacking", false);
            anim.SetTrigger("ifAx");
        }

        if (obj.tag == "Stone") {
            anim.SetBool("isattacking", true);
        }
        if (obj.tag == "ActiveDefender")
        {
            anim.SetBool("isattacking", true);
        }

    }

}

I figured out a way to do it

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Attacker))]
public class Girl : MonoBehaviour {

    public Attacker attacker;
    public Animator anim;
    public float girlHealth;
    public GameObject obj;
    // Use this for initialization
    void Start()
    {
        attacker = GetComponent<Attacker>();
        anim = GetComponent<Animator>();

    }

    // Update is called once per frame
    void Update () {

        if (!obj)
        {
            anim.SetBool("isattacking", false);
        }

    }
   void OnTriggerEnter2D(Collider2D collision)
    {

       if(collision.gameObject.tag == "Stone")
        {
            obj = collision.gameObject;
        }
       else if (collision.gameObject.tag == "ActiveDefender")
        {
            obj = collision.gameObject;
        }

         if (obj.tag == "Stone") {
            anim.SetBool("isattacking", true);
        }
         else if (obj.tag == "ActiveDefender")
        {
            anim.SetBool("isattacking", true);
        }
        Debug.Log(collision.gameObject);

    }
    void OnTriggerExit2D(Collider2D collision)
    {

    }

}

sentences:
why collision not detection not happened in Two Sphere I start practice 3d collision detection of sphere in OpenGl containing two sphere one sphere hit using cannon gun but collision not detect when it hit and when i debug code collision statement triger when sphere is too far of each other here is sphere One code

    glPushMatrix();
    glTranslatef(400, 50, -400);
    drawBomb();
    glPopMatrix();

Connon gun code is here which control by keyboard handler

glPushMatrix();
    glTranslatef(600, 0, -400);
    glRotatef(-longFire, 1, 0, 0);
    glRotatef(-longFireChaw, 0, 1, 0);

    //glTranslatef(0, 0, -25);
    drawFireHolder();
    //printf_s("Long fire is %d", longFire);

    glPopMatrix();

second sphere code is here which hit by mouse handler

glPushMatrix();
 // bombX is global variable of value 600
 // bombY and bombZ is global variable of value 0
    glTranslatef(bombX, bombY, -400);
    //glRotatef(-longFire, xRotate, yRotate, zRotate);
    glRotatef(-longFire, 1, 0, 0);
    glRotatef(-longFireChaw, 0, 1, 0);
    //glRotatef(longFire, 0, 1, 0);
    glTranslatef(0, 0, bombZ);
    glTranslatef(0, 0, 25);
    drawBomb();
    glPopMatrix();

Timer and Shphere collsion detection code s here

dx = 400 - bombX;  // 400 for sphere one x and bombX for sphere two
        dy = 50-bombY;  //50 for sphere one y and bombY for sphere two
        dz = -400 -(-400);// 50 for sphere one z and bombz for sphere two

        float distance = sqrt(dx*dx + dy*dy + dz*dz);

        if (distance <=6+6) // 6 is radius of first and second sphere
        {
            printf("Collision Occur");
        }

        bombX-=1;

        bombY =0.3+bombY*sin((longFire*3.1424543567) / 180);
        bombZ++;
        //printf("Y IS %f",bombY);

Keyboard Handler  code is here

if (key == 't' || key == 'T')
    {
        xRotate = 1, yRotate = 0, zRotate = 0;
        longFire += 5;
        handlerMove();
    }
    if (key == 'e' || key == 'E')
    {
        xRotate = 1, yRotate = 0, zRotate = 0;
        longFire -= 5;
        handlerMove();
    }
    if (key == 'r' || key == 'R')
    {
        xRotate = 0, yRotate = 1, zRotate = 0;
        longFireChaw += 5;
        handlerMove();
    }
    if (key == 'w' || key == 'W')
    {
        xRotate = 0, yRotate = 1, zRotate = 0;
        longFireChaw -= 5;
        handlerMove();
    }

sentences:
Customizable 3D "growing" Avatars within Unity I'm working on a project that allows the user to pick their personal avatar (change faces/body settings/etc), and then have child/adult versions of those.  Ideally, they will allow an age progression from Age 3 - Age 100 (or something).

I've built an HTML5 page with something conceptually like what I want (github repo here), but obviously I'm looking for a system that works within Unity3D for fully animated avatars.

It seems that a possible solution is UMA2 (with the ingame avatar creator), but there's very little documentation and I can't find any "getting started guides online".  It also seems to have a DNA system that I could use for having parents have representative children, but can't find details.  There is a YouTube video series that I'm going through which seems quite good, but I haven't yet seen if there's anything to create children procedurally and how that would work.

Does anyone know whether the Unity team recommends this system or another one or what their roadmap is.  I see some UMA tools look like they're discontinued, some posts say they don't work with latest versions of unity, etc... but no ground-truth.

My current plan is to just buy a bunch of UMA stuff and slowly learn it through Trial and Error, but would appreciate if anyone has a good analysis of this area that they can share.

Note: I'm familiar with Makehuman and Adobe's Mixamo (both awesome and things I've spent a lot of time studying), but I am looking for something in-game to allow people to grow and evolve over time.  Bonus points if I can have 20 generations of marriages/children that show genetic traits passing down the line.  I've built support for that into the HTML5 system above, but not sure if it exists in the 3d space.

Thanks in advance!

sentences:
Lookup table in shader opengl es What I need is apparently very simple, a lookup table in a fragment shader. It seems that the natural way would be an array float lut[], but in some implementations of OpenGL ES I am getting an error

  "profile requires index expression to be compile-time constant".

Next approach would be a 1D texture filled with the values, but again OpenGL ES doesn't like that :)

What would be the simplest way to have a lookup table of 256 float elements in the fragment shader? (I guess it will be a 2d texture but it looks like it is some overhead and I am not sure if it's possible to handle two textures on a shader)

P.S. I am a very beginner in OpenGL but what I need is simple handling of images in textures.

sentences:
Copying a ID3D11Texture2D created by one device without the D3D11_RESOURCE_MISC_SHARED flag to another device I'm writing a native plugin for Unity that is responsible for presenting the rendered Unity scene in a separate window with its own swap chain and an associated device and context all owned by the plugin. I'm rendering the Unity scene to a texture and passing the native pointer of the texture to the plugin. Had Unity's texture been created with the D3D11_RESOURCE_MISC_SHARED flag enabled, I could have simply accessed the texture using OpenSharedResource and created a ID3D11ShaderResourceView bound to it. But since Unity does not specify that flag at the creation of its texture, I need to copy that texture to another texture which is created with the D3D11_RESOURCE_MISC_SHARED flag enabled. I'm facing issues while doing this copy.

To test this pipeline, I'm working with the SpriteBatch example in DirectXTK tweaking it a little bit - create a texture using one device, and pass it on to another device (the original example uses the same device to create the first texture) which is responsible for rendering it on the screen.

I create a first texture from an image file using the first ID3D11Device1 without the D3D11_RESOURCE_MISC_SHARED flag enabled, and create a second empty texture using the second ID3D11Device1 with the D3D11_RESOURCE_MISC_SHARED flag enabled. Then I copy the contents of the first texture to the second texture, and create a ID3D11ShaderResourceView bound to the second texture.

ComPtr<ID3D11Resource> textureResource;
DX::ThrowIfFailed(CreateWICTextureFromFile(m_d3dDevice.Get(), L"cat.png", textureResource.GetAddressOf(), nullptr));

ComPtr<ID3D11Texture2D> cat;
DX::ThrowIfFailed(textureResource.As(&cat));

CD3D11_TEXTURE2D_DESC catDesc;
cat->GetDesc(&catDesc);

ComPtr<ID3D11Texture2D> spriteBatchTexture;
D3D11_TEXTURE2D_DESC sharedTextureDesc = catDesc;
sharedTextureDesc.Usage = D3D11_USAGE_DEFAULT;
sharedTextureDesc.Format = catDesc.Format;
sharedTextureDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
sharedTextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

//Create a texture which is a copy of cat, that belongs to the wicDevice but with a SHARED flag
DX::ThrowIfFailed(wicDevice->CreateTexture2D(&sharedTextureDesc, nullptr, spriteBatchTexture.ReleaseAndGetAddressOf()));
wicContext->CopyResource(spriteBatchTexture.Get(), cat.Get());

IDXGIResource* sharedResource(nullptr);
HANDLE sharedHandle;
DX::ThrowIfFailed(spriteBatchTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&sharedResource));
DX::ThrowIfFailed(sharedResource->GetSharedHandle(&sharedHandle));
sharedResource->Release();
DX::ThrowIfFailed(m_d3dDevice->OpenSharedResource(sharedHandle, __uuidof(ID3D11Texture2D), (void**)(spriteBatchTexture.GetAddressOf())));

D3D11_SHADER_RESOURCE_VIEW_DESC sbSRVDesc = {};
sbSRVDesc.Format = catDesc.Format;
sbSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
sbSRVDesc.Texture2D.MipLevels = 1;
sbSRVDesc.Texture2D.MostDetailedMip = 0;

DX::ThrowIfFailed(m_d3dDevice->CreateShaderResourceView(spriteBatchTexture.Get(), &sbSRVDesc, m_texture.ReleaseAndGetAddressOf()));

The m_texture is the ID3D11ShaderResourceView that is finally used by the example to render the image on to the screen.

The code goes through fine, but there's no image rendered onto the window when I do this.

Note: It does not seem to matter which device - m_d3dDevice or wicDevice I choose as the creator of the spriteBatchTexture. As long as OpenSharedResource is used properly, the code does not break but the end result is the same blank screen.

sentences:
How to make the inside of a cube accessible I have a cube, it is made up of smaller cubes each making the big cube 8x8x8. The cube is the map. The player of the game needs to be able to appraise the entire map and understand it without having to zoom through the inside of the cube since he may need to see opposite ends and interior at the same time.

How can I make this cube easy for the player to access?
Requirements:

Player must be able to see any 2 cubes at the same time, including the interior.
Player must be able to understand depth of cube
Player must be able to click on interior cubes.
Player must be able to differentiate between allied/enemy soldier, and soldier class.

if it helps at all, imagine if the rubiks cube had more cube inside it, obviously in the real world, we have no way to control them, but in a game, how would i allow someone to see and manipulate several at one time. Note: not a realtime game.

sentences:
Pygame Bounding Box at Player Feet I'm new to python and pygame and am trying to build a very simple "game" (it's more of a test for me to figure things out) in which you move a character around the screen and he can collide with walls and things. Everything is broken up into 32x32 tiles and the player is 32x64. This means that when his head hits a wall his feet are 2 tiles away and I've been trying to get it so that he's only 1 away, ie. I'm after a 32x32 hitbox starting at x=0, y=32 on the player image.

Do I need to create a separate rect to deal with this and if so how would I go about implementing it? Any help would be greatly appreciated.

Here's the code for my player class so far, hopefully it's not too messy:

class Player(pygame.sprite.Sprite):
'''The Main Player Class'''
def __init__(self, x, y):
    pygame.sprite.Sprite.__init__(self) #Call sprite initialiser
    self.image, self.rect = load_image("char.png")
    screen = pygame.display.get_surface()
    self.area = screen.get_rect()
    self.rect.x, self.rect.y = x, y
    self.x, self.y = x, y
    self.vx, self.vy = 0, 0
    self.movespeed = 2

def update(self):
    self._walk()

def _walk(self):
    if self.vx != 0:
        self._walk_single_axis(self.vx, 0)
    if self.vy != 0:
        self._walk_single_axis(0, self.vy)

def _walk_single_axis(self, vx, vy):
    "normalise for diagonal movement if necessary"
    if self.vx != 0 and self.vy !=0:
        norm = 1/(2**0.5)
    else:
        norm = 1
    "set new x and y positions"
    self.x += vx * self.movespeed * norm
    self.y += vy * self.movespeed * norm
    self.rect.x, self.rect.y = self.x, self.y

    "check for collisions with any walls"
    for wall in walls:
        if self.rect.colliderect(wall.rect):
            if vx > 0: #collide with the left side of the wall
                self.rect.right = wall.rect.left
                self.x = self.rect.x
            if vx < 0:
                self.rect.left = wall.rect.right
                self.x = self.rect.x
            if vy > 0:
                self.rect.bottom = wall.rect.top
                self.y = self.rect.y
            if vy < 0:
                self.rect.top = wall.rect.bottom
                self.y = self.rect.y

    "bound the player within the screen edges"
    if self.rect.x < self.area.left:
        self.rect.x = 0
    if self.rect.x > self.area.right-32:
        self.rect.x = self.area.right-32
    if self.rect.y < self.area.top:
        self.rect.y = 0
    if self.rect.y > self.area.bottom-64:
        self.rect.y = self.area.bottom-64

self.x and self.y are there because applying the movement directly to self.rect.x and self.rect.y caused the character to move at different speeds depending on which diagonal direction he was travelling in. self.vx and self.vy just return either +1 or -1 depending on the direction of travel.

sentences:
glm direction vector rotation I'm working on a flight simulator, but I'm stuck with my airplane orientation. I tried some things but noone worked correctly. This is what I have :

To be able to move it and roll it around himself, I need two vectors, forward and up, and use them to create quaternions I need for the rotation :

void Plane::Update()
{
    m_position += ( m_forward * m_speed );

    mat4 translation = translate( mat4( 1.0f ), m_position );

    float angle = dot( vec3( 1.0f, 0.0f, 0.0f ), m_forward );
    quat direction = angleAxis( acos( angle ), cross( vec3( 1.0f, 0.0f, 0.0f ), m_forward ) );

    m_matrix = translation * mat4_cast( direction );
}

vec3( 1.0f, 0.0f, 0.0f ) is my model orientation. Note that in this code, I don't have quaternion for rolling the plane, because I first want to have a correct direction.

This works great, what doesn't work is when I want to make him taking off. To do that, I first get the right vector, then use it to create my quaternion with the angle I need, and I apply the rotation to the forward and up vector.

void Plane::FlyUp()
{
    vec3 right = cross( m_forward, m_up );

    quat temp = angleAxis( radians( 1.0f ), right );

    m_up = temp * m_up;
    m_up = normalize( m_up );

    m_forward = temp * m_forward;
    m_forward = normalize( m_forward );
}

Using debugger and an online vector visualizer, It seems to give me the good vectors, but the plane is rotating weirdly ( in fact, that's not even only rotating, he's scaled too for some reasons... ).

What am I doing/understanding wrong?

Edit :

To be more precise, here is screenshoots of what I have :

And what I'm trying to have, whatever the m_forward vector is pointing to :

sentences:
Multi touch gesture terminology What term would you use to describe the type of touch gesture whereby the user touches a point on screen, and an object moves (ease-out) to the location where the finger is touching the screen?

Can you tell me the names of the different types of multi-touch gestures (screen-based) such as tap, swipe, etc.?

sentences: Unity crossplatform native plugins I need to create a c++ native plugin for my game. If I want to support macOS and Windows, do I need to write my plugin twice - one in XCode with a bundle project and another in VS for windows or is there a way to support both with one codebase?

sentences:
Premultiplied alpha, yea or nay? Should I be using premultiplied alpha?  Reading Tom Forsyth's article it seems a nobrainer.  Premultiplied alpha (AKA additive blending) is superior in every sense.
However, premultiplied alpha seems to have one major drawback, it's not well supported with tools.

Do you/have you used premultiplied alpha?

How is the tool support?

In particular, I don't think gimp will edit premultiplied alpha images well.  Are there any gimp plugins to export premultiplied alpha?  How about an external tool?

sentences:
How can I draw a circle around a specific object, not necessarily the object the script is attached to? I have this script that draws a circle around the object the script is attached to.
I would like also to use the centerObject variable as an option to draw another circle around the centerObject, or just only around the centerObject and not the transform the script is attached to. I'm not sure how to do it.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[ExecuteAlways]
[RequireComponent(typeof(UnityEngine.LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    public GameObject centerObject;
    [Range(1, 50)] public int segments = 50;
    [Range(1, 500)] public float xRadius = 5;
    [Range(1, 500)] public float yRadius = 5;
    [Range(0.1f, 5)] public float width = 0.1f;
    [Range(0, 100)] public float height = 0;
    public bool controlBothXradiusYradius = false;
    public bool draw = true;

    [SerializeField] private LayerMask targetLayers;
    [SerializeField] private LineRenderer line;

    private void Start()
    {
        if (!line) line = GetComponent<LineRenderer>();

        if (draw)
            CreatePoints();
    }

    private void Update()
    {
        if (Physics.CheckSphere(transform.position, xRadius, targetLayers))
        {
            Debug.Log("player detected");
        }
        else
        {
            Debug.Log("player NOT detected");
        }
    }

    public void CreatePoints()
    {
        line.enabled = true;
        line.widthMultiplier = width;
        line.useWorldSpace = false;
        line.widthMultiplier = width;
        line.positionCount = segments + 1;

        float x;
        float y;

        var angle = 20f;
        var points = new Vector3[segments + 1];
        for (int i = 0; i < segments + 1; i++)
        {
            x = Mathf.Sin(Mathf.Deg2Rad * angle) * xRadius;
            y = Mathf.Cos(Mathf.Deg2Rad * angle) * yRadius;

            points[i] = new Vector3(x, height, y);

            angle += (380f / segments);
        }

        // it's way more efficient to do this in one go!
        line.SetPositions(points);
    }

#if UNITY_EDITOR
    private float prevXRadius, prevYRadius;
    private int prevSegments;
    private float prevWidth;
    private float prevHeight;

    private void OnValidate()
    {
        // Can't set up our line if the user hasn't connected it yet.
        if (!line) line = GetComponent<LineRenderer>();
        if (!line) return;

        if (!draw)
        {
            // instead simply disable the component
            line.enabled = false;
        }
        else
        {
            // Otherwise re-enable the component
            // This will simply re-use the previously created points
            line.enabled = true;

            if (xRadius != prevXRadius || yRadius != prevYRadius || segments != prevSegments || width != prevWidth || height != prevHeight)
            {
                CreatePoints();

                // Cache our most recently used values.
                prevXRadius = xRadius;
                prevYRadius = yRadius;
                prevSegments = segments;
                prevWidth = width;
                prevHeight = height;
            }

            if (controlBothXradiusYradius)
            {
                yRadius = xRadius;
            }
        }
    }
#endif
}

sentences:
With Slick, how to change the resolution during gameplay? I am developing a tile-based strategy game using Java and the Slick API.

So far so good, but I've come to a standstill on my options menu. I have plans for the user to be able to change the resolution during gameplay (it is pretty common, after all).

I can already change to fullscreen and back to windowed, this was pretty simple...

//"fullScreenOption" is a checkbox-like button.
if (fullScreenOption.isMouseOver(mouseX, mouseY)) {
   if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      fullScreenOption.state = !fullScreenOption.state;
      container.setFullscreen(fullScreenOption.state);
   }
}

But the container class, contrary to my previous beliefs, does not seem to have any resolution-change functions! And that's pretty much the situation...I know it's possible, but i don't know how to do it, nor what is the class responsible!

The AppGameContainer class, used on the very start of the game's initialization as of Slick's examples and tutorials, is the only place with any functions for changing the display-mode that I've found so far, but it's only used at the very start, and i haven't found a way to travel back to it from my options menu.

  //This is my implementation of it...
  public static void main(String[] args) throws SlickException {
    AppGameContainer app = new AppGameContainer(new Main());
//    app.setTargetFrameRate(60);
    app.setVSync(true);
    app.setDisplayMode(800, 600, false);
    app.start();
  }

I can define it as a static global on the Main, but it's probably a (very) bad way to do it...

sentences: No idea of how to simulate car crashes I have a simple car game with all the basic collision detection and movement in Unity with C#. But when I was building the "engine" for the game I didn't include a detail I later decided to include. I want the possibility so that cars can get damaged and so that the model can change. For example the car looked like it was new and after a crash it looks like a wreck. Please help me by pointing to some resources or by telling me approximate ways of implementing this new feature. Thanks!

sentences:
2D Rain Creation (and Fluid Dynamics) I am experimenting with weather conditions in a game of mine, and I was impressed by the way Starbound handled the rain. Basically, when rain hits the ground, it's either dispersed horizontally (and absorbed by the ground), or it creates piles of water (when raindrops land inside a hole in the ground).

This video demonstrates this clearly:
http://imgur.com/gallery/CKCGKbG

I know how to make rain fall and check where it hits the ground, but that's where I get stuck. My question is: how could this have been created? And how could one model the water flow so perfectly, without killing performance?

Thanks in advance!

sentences:
UI object catches click event even by clicking outside of that object I'm running to a weird issue where I have a Canvas and some objects on it which are adding as prefabs. Each object has a OnClick event attached to it. The problem comes in when I click somewhere in Canvas only to see one of those prefabs catch the click event (and I don't know which one got it).

The whole thing was working good, till it wasn't anymore. I'm not sure if I did something or maybe it happens after updating Unity.

Here's some more details:

I guess the problem happened after installing Unity Pro 2017.1
I've changed the ordering layers in some different ways and problem still was around!
I'm using IPointerClickHandler for receiving click events.
I've removed UI elements one by one in play mode to check if it makes any differences. The problem stays until I remove the last object which has the script for receiving click event.
Maybe it worth mention that the prefabs are adding to a parent with grid layout group.

Has anyone ran to this issue before or has any idea why this would happen?

UPDATE

Screenshot included:

sentences:
Unity Animation makes object spawn at x0 y0 z0 I was making an animation for a coin in my game in Unity, and when I was testing the full game, I saw that the coin is spawning at x0 y0 z0 and is doing the animation there.
Then I realized that it was the animation, that increases and decreases y position and y rotation, starting at 0.
So, I need to make the animation, that increases and decreases position y and rotation y, without affecting the actual position, because it will be different the position of the coins each time.
In a while I will upload a screenshot for describing better the problem.
Any clue?

sentences:
OpenAL listener position for isometric camera I have an isometric camera for an RTS that looks like this:

Basically, I don't know how to set the listener's position in OpenAL because I represent the camera's position with only two coordinates.

I build my projection matrix as a standard orthographic projection:

projectionMatrix = new Matrix4f()
            .setOrtho(-25, 25, -25 / aspect, 25 / aspect, -300, 300);

and my view matrix like so:

viewMatrix.identity()
            .rotate(-rotation.x / 180.0f * Util.PI, 1, 0, 0)
            .rotate(-225.0f / 180.0f * Util.PI, 0, 1, 0)
            .rotate(-rotation.z / 180.0f * Util.PI, 0, 0, 1)
            .scale(zoom)
            .translate(-position.x, 0, -position.y);

Where rotation is a 3D vector of the Euler angles, and position is a 2D vector controlled by the keyboard or dragging the mouse. (rotation.y is ignored)

How would I translate this 2D position into the 3 coordinates required for OpenAL? I tried to give a y-offset like: alListener3f(AL_POSITION, position.x, 20, position.z);, but it gave really weird attenuation results.

(PS: I'm using Java, LWJGL, and JOML for math)

sentences:
How to make a road terrain for unity game? im making a FP game in low poly style. I want to make some terrains for my game, with roads, trees, rocks, buildings and e.t.c. Unity terrains are not as good as i thought. They allow a good tool for placing multiple objects (like tree-to-sprite tools, trees mesh copy for perfomance), but the terrain building tool itself is very poor, so i cant use 3d terrain, because there will be no great tools for placing surroundings.

So my plan is - make low poly mountains, trees, rocks in Blender, then make a simple terrain with hills in unity and just place my surrounding objects on it. I have some troubles, for example - roads. I have a road elements, and by connecting & banding them i can get a really nice road. But how can i make a road on Unity's terrain?

For example it could be useful to export unity terrain as a 3d mesh to Blender, then make my roadways and export them in Unity.

sentences:
Libgdx optimization of big arrays I am working on a game using libgdx and I have the following code that I want to optimize.

    Array<Bullet> enemyBullets = Enemy2.getEnemyBullets();
    for (Bullet bullet : enemyBullets) {
        c = bullet.getHitBox();
        debugRenderer.circle(c.x, c.y, c.radius, 5);
    }

Basically I just have a big array of objects that I want to preform some action on and I am not sure if this is the best way to do it. I'm not sure if it would be better to use a pool or try to use an iterator instead. I am just not really familiar with these things and I need some help.

sentences:
Mental Image of the engine behind an RTS like SimCity/Settlers, what is it? Disclaimer: I'm first a programmer and then an RTS gamer. This means I'm a complete and utter newb in terms of patterns, best practices and glossary of technical terms on the game dev world.

Since I was a kid that most of my electric/electronic toys were always taken apart to learn how they were made and most of the pieces were stored for future use.
This gave me a VERY curious mind in terms of: How does it work?

I've started planning/scribbling for more RTS games than the market has dished out, but never got around to implement any of them due to the lack of basic knowledge about Game Devel.

So what I'm asking is that someone could point me in the direction of the engine schematics of an RTS game like SimCity/Civ/Settlers. Something that will assume a bit of programming background but will introduce the terms used for programming a RTS base game.

How do they do the Unit Manager? Is it called this way?
Is creating a complex multi threading system wise?
Should I use multi-threading just for groups of units?

Well, I think you get the picture of how newb I am ;)

Many thanks in advance.

sentences:
Get Stencil buffer working iOS OpenGL ES 2.0 I have been trying to get this work but either get black screen or reporting error when using XCode to analyze the GL code like below. Any help appreciated.  I am using Swift here if that making a difference. Any help appreciated.

The code I used to attach a stencil buffer is like below:

var depthRenderbuffer: GLuint = 0
glGenRenderbuffers(1, &depthRenderbuffer)
glBindRenderbuffer(GLenum(GL_RENDERBUFFER), depthRenderbuffer)
glRenderbufferStorage(GLenum(GL_RENDERBUFFER), GLenum(GL_DEPTH24_STENCIL8), 2208, 1242)
glFramebufferRenderbuffer(GLenum(GL_FRAMEBUFFER), GLenum(GL_STENCIL_ATTACHMENT), GLenum(GL_RENDERBUFFER), depthRenderbuffer)

sentences:
Character on spherical terrain My game is played on a big spherical world. Made up of a big spherical mesh with sphere collider, with 'gravity' at it's center (gravity for objects is controlled trough scripts).

Now if I put a ball (spherical rigid-body) on there and push it, it will just go around as expected. But when I try to add an object with character-controller and move the character it will always stand as if the gravity is pointing up, and not at the center of the big sphere.

Since there is apparently no way to rotate the character-controller component (it's made for flat worlds) What are my options for controlling my characters on this spherical world?

sentences: How is data written from two different gpu cores to the same memory? Does each core’s data get written to the shared memory one at a time or both at the same time? For instance, when two cores that are next to each other need to write to the same memory spot does the gpu write the core from the left first, then the next core or does it happen at the same time? I’m asking because I want to know if I can get the 2nd core to check a value that the 1st core changed before writing the data.

sentences:
OpenGL ES 2. How do I Create a Basic Fading Streak Effect? For the iPad app I am writing using OpenGL ES 2 I have a single quad - shaded using GLSL - that is dragged around the screen. Very basic. This works fine. But is rather boring.

I want to increase the coolness a bit in the following way: when the user drags the quad it leaves a streak behind that fades over time. Continuous dragging would be a bit like a streaking comet across the night sky.

What is the simplest way to implement this?

Thanks.

sentences:
Unity Mathf.Atan2 algorithm complexity using Unity5.5.1f;
using C#;

So I have a circle (2D) divided equally by 16 directions, and I also have a direction V which is different from the other 16.

In order to know which direction is the closest I thought of two apporaches:

Dot product between V and all the other directions and choose the max one
Store atan for all the 16th directions then compute atan for V and see which angle is the closest to V's

My questions are,does anyone know what is the complexity of Mathf.Atan2? Or of an Atan2 algorithm in general? I read it gets worse and worse as the angle becomes bigger, is it true?

sentences:
What is this JavaScript gibberish? I am studying how to make a 2D game with JavaScript by reading open source JavaScript games and I came across this gibberish...

aSpriteData = [
    "}\"¹-º\"À+º\"À+º\"À+º\"¿¤À ~C_ +º\"À+º\"À+º\"À*P7²OK%¾+½u_\"À<¡a¡a¡bM@±@ª",    //  0 ground
    "a ' ![± 7°³b£[mt<Nµ7z]~¨OR»[f_7l},tl},+}%XN²Sb[bl£[±%Y_¹ !@ $",        //  1 qbox
    "!A % @,[] ±}°@;µn¦&X£ <$ §¤ 8}}@Prc'U#Z'H'@· ¶\"is ¤&08@£(",           //  2 mario
    "  ´!A.@H#q8¸»e-½n®@±oW:&X¢a<&bbX~# }LWP41}k¬#3¨q#1f RQ@@:4@$",         //  3 mario jump
    "   40 q$!hWa-½n¦#_Y}a©,0#aaPw@=cmY<mq©GBagaq&@q#0§0t0¤ $",         //  4 mario run
    "+hP_@",                                    //  5 pipe left
    "¢,6< R¤",                                  //  6 pipe right
    "@ &  ,'+hP?>³®'©}[!»¹.¢_^¥y/pX¸#µ°=a¾½hP?>³®'©}[!»¹.¢_^  Ba a",        //  7 pipe top left
    "@ , !] \"º £] , 8O #7a&+¢ §²!cº 9] P &O ,4    e",              //  8 pipe top right
    " £ #! ,! P!!vawd/XO¤8¼'¤P½»¹²'9¨  \"P²Pa²(!¢5!N*(4´b!Gk(a",            //  9 goomba
    "   Xu X5 =ou!¯¬a[Z¼q.°u#|xv ¸··@=~^H'WOJ!¯¬a=Nu ²J <J   a",          // 10 coin  // yui
    "@ & !MX ~L \"y %P *¢ 5a K  w !L \"y %P *a%¬¢ 4  a",               // 11 ebox // yui
    "¢ ,\"²+aN!@ &7 }\"²+aN!XH # }\"²+aN!X%  8}\"²+aN!X%£@ (",          // 12 bricks
    "} %¿¢!N° I¨²*<P%.8\"h,!Cg r¥ H³a4X¢*<P%.H#I¬ :a!u !q",         // 13 block
    makeSpace(20) + "4a }@ }0 N( w$ }\" N! +aa",                    // 14 bush left
    " r \"²y!L%aN zPN NyN#²L}[/cy¾ N" + makeSpace(18) + "@",            // 15 bush mid
    makeSpace(18) + "++ !R·a!x6 &+6 87L ¢6 P+ 8+ (",                // 16 bush right
    " %©¦ +pq 7> \"³  s" + makeSpace(25) + "@",                 // 17 cloud bottom left
    "a/a_#².Q¥'¥b}8.£¨7!X\"K+5cqs%(" + makeSpace(18) + "0",             // 18 cloud bottom mid
    "bP ¢L P+ 8%a,*a%§@ J" + makeSpace(22) + "(",                   // 19 cloud bottom right
    "",         // 20 mushroom
    "", // koopa 16x24
    "",             // 22 star
    "",                         // 23 flagpole
    "",         // 24 flag
    "",                 // 25 flagpole top
    "  6  ~  }a }@ }0 }( }$ }\" }! } a} @} 0} (} $} \"² $",             // 26 hill slope
    "a } \"m %8 *P!MF 5la\"y %P" + makeSpace(18) + "(",             // 27 hill mid
    makeSpace(30) + "%\" t!DK \"q",                         // 28 hill top
    "",         // 29 castle bricks
    "",                         // 30 castle doorway bottom
    "",                 // 31 castle doorway top
    "",         // 32 castle top
    "",         // 33 castle top 2
    "",             // 34 castle window right
    "",             // 35 castle window left
    "",         // 36 castle flag
    makeSpace(19) + "8@# (9F*RSf.8  A¢$!¢040HD",                    // 37 goomba flat
    "     *(!¬#q³¡[_´Yp~¡=<¥g=&'PaS²¿ Sbq*<I#*£Ld%Ryd%¼½e8H8bf#0a",         // 38 mario dead
    "   =  ³ #b 'N¶ Z½Z Z½Z Z½Z Z½Z Z½Z Z½Z =[q ²@ ³  ¶   0",           // 39 coin step 1
    "   ?@ /q /e '¤ #³ !ºa }@ N0 ?( /e '¤ #³  ¿  _a  \"",               // 40 coin step 2
    "   /  >  ]  º !² #¢ %a +  >  ]  º !² #¢ 'a  \"",               // 41 coin step 3
    "   7¢ +² *] %> \"p !Ga t¢ I² 4º *] %> \"p  ¡  Oa  \""              // 42 coin step 4
],

What does it do? If you want to look at the source file, here it is. Beware, there is more gibberish inside. I can't seem to make sense of any of it.

sentences: Change back to initial value of rotation? I have a sprite that I can rotate and I wonder if there is a way to change the rotation back to the initial value?

sentences:
Unity 2D: Dealing damage when character is crushed between two solid objects Whats the best approach to dealing damage to a player when they get stuck between two solid objects? For instance, I'm trying to make moving platforms that the player can ordinarily touch. It's only when the player is caught in-between the moving platform and the ceiling, for example, that damage is dealt or the player dies.

So, what would be the best way to approach this? Thanks in advance!

sentences:
Slick2D - Entities and rendering I have been trying to create my very first game for quite a while, followed some tutorials and stuff, but I am stuck at creating my entity system. I have made a class that extends the Entity class and here it is:

  public class Lazer extends Entity{//Just say that it is some sort of bullet

private Play p;//Play class(State)
private float x;
private float y;
private int direction;

public Lazer(Play p, float x , float y, int direction){
    this.p = p;
    this.x = x;
    this.y = y;
    this.direction = direction;
    p.ent.add(this);
}

public int getDirection(){
    return direction; //this one specifies what value will be increased (x/y) at update
}
public float getX(){
    return x;
}
public float getY(){
    return y;
}
public void setY(float y){
    this.y = y;
}
public void setX(float x){
    this.x = x;
}
     }

The class seems pretty good , after speding some hours googling what would be the right thing.
Now, on my Play class. I cant figure out how to draw them. (I have added them to an arraylist) On the update method , I update the lazers based on their direction:

public void moveLazers(int delta){
       for(int i=0;i<ent.size();i++){
           Lazer l = ent.get(i);
           if(l.getDirection() == 1){
               l.setX(l.getX() + delta * .1f);
           }else if(l.getDirection() == 2){
               l.setX(l.getX() - delta * .1f);
           }else if(l.getDirection() == 3){
               l.setY(l.getY() + delta * .1f);
           }else if(l.getDirection() == 4){
               l.setY(l.getY() - delta * .1f);
           }

       }
   }

Now , I am stuck at the render method. Anyway , is this the correct way of doing this or do I need to change stuff? Also I need to know if collision detection needs to be in the update method. Thanks in advance ~ Teo Ntakouris

sentences:
How can glass breaking effect from Smash Hit be achieved? I saw Smash Hit the other day and was amazed by the physics of the game, specially the shattered glass effect:

I've read other posts about this subject but I still feel that they don't share enough details to let me get started on implementing this on my own with OpenGL/GLSL.

Is it possible for somebody with an enhanced perception and graphics understanding to watch the gameplay and give some pointers on how this effect could be replicated?

I rather not use 3rd party physics engine and do the entire thing on my own for educational purposes, so could you mention some of the physics that goes behind this as well?

References to other documents and demos are highly appreciated.

sentences:
Unity - job system compatibility for end user? I'm thinking about using Job system. But it requires .Net 4.x (also look like .Net 4.x will be default for Unity in 2019). It is a little hassle for me cause I'm using Visual Studio 2015, I have to download & install .Net target pack 4.7

My question is: If my game is developed with .Net 4.7.2 (so that I can use Job system), does it require the end user installing .Net 4.7.2 to play the game?

My target user is low-end PC (they may using windows 7, I see that .NET Framework 3.5.1 is included in Windows 7)

sentences:
Box2D strange collisions (jitter) on sharp edges I'm currently developing 2D side scroll game with Libgdx + Box2D.
And I'm facing some problems with ChainShape (the ground) and PolygonShape (the cart body) collisions.
Please look at this video: http://www.youtube.com/watch?v=gljgMn8lYfs

As you see the PolygonShape jitters(?) when collides with ChainShape.
BUT it only happens on sharp edges!

What I've tried:

Increase/decrease velocityIterations/positionIterations. Didin't
help. Currently they are set to 10/8 (as shown in video).
Turn off CCD. Didin't help. Currently is turned on.
Set velocityThreshold to zero. Didin't help. Currently is default - 1f.
Set restitution/friction values to zero. Didin't help.

Any suggestions why it's happening and how can I fix/avoid it?

sentences:
How do I create modular/replaceable game/engine code interfaces with C++? I've spent some time when I can spare it experimenting with c++ and at the same time learning a bit about game programming. I like most thought I'd start with creating a simple game engine but with some experimenting and plenty of advice along the lines of create a game, not an engine I forgot about the engine and just experimented with building a game.

Suffice to say in the process of doing that I hacked together rendering code (ogre3d) and physics (bullet) and input/output (OIS) and a couple of times over experimented with basic game ideas to the point of loading a map and being able to walk around it. Nothing special I know but it's an achievement for me.

Moving on from that now I would like to learn more about creating reusable code that falls more under engine programming than just a game. I'm sure the skills will be transferable to more than just games.

Basically I'd like to move from having everything intertwined to being able to separate and replace the individual parts. For example, build a 3d renderer dll/so in OpenGL and another with DirectX (as a dll). Or the same for other aspects such as Physics, sound, input, networking.

I'm learning about general dll programming and shared libraries on Linux but would like some more information with regards to game specific interfaces. I am also aware that Ogre3d which I previously mentioned is already cross platform and capable of both opengl and direct-x... I'm not saying I want to replace a library like that, more make it able to be unplugged and have something else plugged in instead.

So you are aware. My programming experience has been C with some more recent exposure to C++. Mostly recently I have been doing web development with both PHP and C#.NET (mostly php). I've also got average experience with c#, python, perl, etc. I'm a bit of a jack of all trades and I pick up things pretty quickly. What I'm hoping for is not to be spoon fed the code but rather some good places to research the concepts etc. (Although I won't turn down code if you're offering) ;)

sentences:
How to assign an instance of an object to an array? Game Engine: Gamemaker Studio

I am making a game similar to bejeweled. I decided to use an array to control everything. Placing instances of objects themselves in to the array seems to be the best way to accomplish this because then I won't have to check where the square is in the room, and then compare it to where in the array that lines up, and so on and so forth.

However, I can't figure out how to do that. How do I do it?

sentences:
Advice on mapping tiles to a height map/3D world I've been attempting to think of a way to map tiles to a height map. Where a grid can be either layered or integrated into the world data. However, since I am not using voxels I could use some advice on where to start or look into on doing something like this.

For example a 16x16 grid layout on 3D world data.

sentences:
libGDX : Paint And Remove Color From Actor with touchDragged I created two-dimensional array of Button actor, then I added new ClickListener() {
touchDragged } as the following code:

buttons = new Button[3][3];

for (int row = 0; row < buttons.length; row++) {
    for (int col = 0; col < buttons[0].length; col++) {

buttons[row][col] = new Button(drawable);

buttons[row][col].addListener(new ClickListener() {

                @Override
                public void touchDragged(InputEvent event, float x, float y, int pointer) {
                    for (int row = 0; row < buttons.length; row++) {
                        for (int col = 0; col < buttons[0].length; col++) {
                            if (buttons[row][col].isOver()) {
                                buttons[row][col].setColor(Color.GREEN);
                            }
                        }
                    }
                }
   }
}

the code inside touchDragged method if the buttons isOver the buttons colored GREEN (it works fine) as shown in image

Now, How can I remove Color.GREEN i.e. (Color.WHITE) from buttons in the same calling touchDragged method, I mean undo GREEN to WHITE ??

this image clear my question :

like Alphapetty Game from king company, if you know it :).

Sorry, For bad English

sentences:
Rotation of a ball moving on a surface I have a ball that moves along a platform. The ball is characterized as a sphere that has a radius and a position. The platform basically is a rectangle consisting of two vertex triangles. Its class also stores the normal of the platform.

While moving the ball and applying the physics of gravity doesn't pose a problem, I just can't get the sphere to rotate correctly. To represent the rotation(s) I'm using Qt's QQuaternion class.

Here's my current rotation code:

QVector3D right = QVector3D::crossProduct(tile->getSurfaceNormal(), step).normalized();
QVector3D forward = QVector3D::crossProduct(right, tile->getSurfaceNormal()).normalized();

float radian = QVector3D::dotProduct((ball - position), forward) / radius;
angularRate = ((radian / interval) * 180.0f / M_PI) * right;

QQuaternion rotation(angularRate.length() * interval, angularRate);
orientation = rotation * orientation;

The orientation quaternion is initialized like this:

orientation = QQuaternion(0.0f, QVector3D(0.0f, 0.0f, 1.0f));

When drawing the ball I update the model matrix (QMatrix4x4) like this:

    modelMatrix.setToIdentity();
    modelMatrix.translate(position.x(), position.y(), position.z());
    modelMatrix.rotate(orientation);
    modelMatrix.scale(radius);

What I noticed when debugging is that the final model matrix gets NAN values in the first three columns. Is there any physical flaw in my calculation or could it have to do with the model matrix itself?

If that's important, here's the full code for updating the ball's properties:

void Ball::update(float interval) {
    collision = false;

    // Calculate new velocity
    velocity += (MOVE_FORCE / mass * interval) * pushDirection;
    velocity.setY(velocity.y() - (GRAVITY * interval));

    /* Collision detection */
    QVector3D normal(0.0f, 0.0f, 0.0f);
    QVector3D step = interval * velocity;
    QVector3D ball = position + step;

    // Check all tiles for collision with ball
    for (unsigned int i = 0; i < tiles->length(); i++) {
        Tile *tile = tiles->at(i);
        QVector<QVector3D> mainVertices = tile->getVertices();

        QVector3D a1 = VectorMath::closestPointOnTriangle(ball, mainVertices[0], mainVertices[1], mainVertices[2]);
        QVector3D a2 = VectorMath::closestPointOnTriangle(ball, mainVertices[2], mainVertices[3], mainVertices[0]);

        float d1 = (ball - a1).length();
        float d2 = (ball - a2).length();

        QVector3D a = (d1 <= d2) ? a1 : a2;
        QVector3D aN = a - tile->getAdjustedSurfaceNormal();

        float aBallLength = (a - ball).length();
        float aNormalBallLength = (aN - ball).length();

        if (aBallLength <= radius || aNormalBallLength <= radius) {
            QVector3D distance = (aBallLength <= aNormalBallLength) ? a - ball : aN - ball;
            float l = distance.length();

            QVector3D move = -((radius - l) / l) * distance;

            // Rotation
            QVector3D right = QVector3D::crossProduct(tile->getSurfaceNormal(), step).normalized();
            QVector3D forward = QVector3D::crossProduct(right, tile->getSurfaceNormal()).normalized();

            float radian = QVector3D::dotProduct((ball - position), forward) / radius;
            angularRate = ((radian / interval) * 180.0f / M_PI) * right;

            ball += move;
            normal += move;

            collision = true;
        }
    }

    // Set new ball position
    position = ball;

    normal.normalize();

    // Applying rebound
    if (collision) {
        float velocityNormal = QVector3D::dotProduct(velocity, normal);
        QVector3D rebound = (-(1 + ELASTICITY) * velocityNormal) * normal;

        velocity += rebound;
    }

    // Damping
    velocity *= DAMPING;

    QQuaternion rotation(angularRate.length() * interval, angularRate);
    orientation = orientation * rotation;

    if (position.y() < -10.0f) {
        reset();
    }
}

sentences:
Smooth shading along edges with duplicate vertices On this generated mesh, I have sharp edges, because each square has duplicate vertices separate from its neighbours.
I can't remove the duplicate vertices because I'm using them to provide unique UV texture coordinates on each square. If I share the vertices then the texture wraps around the surface in an unwanted way.
Is there a way I can get smooth shading along these edges, even without shared  vertices?

sentences:
Professional game design documents Possible Duplicate:
  How should I structure a design document?

I'm planning to apply for a game designer position at a big company. But the problem is, according to my CV, I'm not fit for being a game designer. (I'm a programmer).

But, I don't like this and still would like to try my chances. Even though I'm a programmer, I have lots of ideas which I can put on paper in any detail depth imaginable. (It's not like "bro, I have this cool game idea in which you fly a spaceship and you see these scary monsters just like in ....", I can really make it professional).

To be able to achieve this, I want to send a game design with my application, written in proper way, that will make it easy for them to accept me.

Question is, what is the proper format for game design documents? Is there a template? What is the detail level? Where can I find a final game design document for a released professional game?

sentences:
Scene for Computer Screen We are developing a scene that will involve heavily interacting with a "touch screen monitor" in the scene.. Because the workflow of the touch screen will need to be dynamic we are creating a REST API that Unity will fetch JSON data and use that to build out the various parts of the UI. For instance, we get a JSON file that has a list of users and attributes and build out UI elements with that data.

The question is should I build out the display and underlying logic as a 2D scene that I add in to our 3D room or just build it all in the 3D scene.

I want to abstract away as much of the logic as I can for the interactive screen; I want to make sure we can drop this screen in a different Scene down the road without too much reverse-engineering.

Sorry if this is a straightforward question, my background is software dev, not game design.

sentences:
Unity keyboard GUI navigation priority I noticed something strange while playing with my menu on keyboard.

I have four items arranged in a square (i.e. the top-left item should be able to navigate to the top-right and the bottom-left). If I hover over top-left, hold the right key, and then tap down, the cursor moves to the top-right and then to the bottom-right.

However, if I hold the down key and then tap right, it moves to the bottom-left and does not move to the bottom-right.

This also happens on the reverse side, so it seems as if vertical navigation is being given preference over horizontal. If a vertical key is being held, horizontal navigation is impossible.

How can I turn this off? My buttons are all set to Automatic navigation, and when I turn Visualize on, they all look like they're connected properly.

sentences:
Keeping Players in Groups tl;dr How can one enforce that groups of players stay together in units in Minecraft?

I'm developing a plugin for a Minecraft server. It's based off feudalistic societies, like Ancient Europe or Japan. I understand that many ancient societies had advanced battle tactics (like this and this, for example). I think this is very interesting, and would add some more interest to a server.

However, Minecraft isn't particularly well suited for this kind of play. Generally, in battles, all the players just run willy-nilly and charge the enemy. There are no units of players, much less the units combining in a smart way to defeat the enemy. How can one enforce players staying together in one unit or group? Keeping each player in a certain position no matter what is not an option, since the players cannot PvP. Once players are grouped into units, I assume they will take up certain battle strategies and use them in a smart way.

sentences: Adding more effects to a Unity3d mixer I recently started exploring the wonderfull world of audio in unity. I noticed that you can add a bunch of effect modules to a mixer. Now I'm wondering if you can add your own custom effects( for example export a plugin from a audio program or something) and add them to the list. I cant seem to find anything related to the question.

sentences:
Problem with position for player and 2D camera I'm not sure I understand how the Matrix class for a 2D camera works in XNA. I have a Player object that I'm trying to position in the middle of the screen and then I have the Camera object that I want to follow the Player. But The position of the player is at the top left corner!?

Preciate som help to understand and to improve my code.

Game1.cs

player = new Player(texturePlayer, new Vector2(screenSizeX / 2, screenSizeY / 2));

And in the Update method:

camera.Position = player.PlayerPosition;

The Camera class:

    class Camera
{
    public Vector2 Position { get; set; }
    private Viewport viewPort;

    // Konstruktor
    public Camera(Viewport viewPort)
    {
        this.viewPort = viewPort;
        Position = Vector2.Zero;
    }
    public Matrix GetViewPortMatrix()
    {
        return Matrix.CreateTranslation(new Vector3(-Position, 0f));
    }
}

I guess there is no need to calcualte an origin for the Matrix when the camera isn't going to rotate!?

And finally some part of the Player class. Note that I'm using a "timer" to achieve a movement of the player in steps. Is this OK or is there a better way to achieve this?

    class Player:GameObjects
{
    //public Vector2 Position { get { return position; } }

    private int walkingSpeed = 60;
    private float walkingTimer = 100;
    private float milliSeconds1;

    // Konstruktor
    public Player(Texture2D texture, Vector2 position) : base(texture, position)
    {
    }

    public void Update(GameTime gameTime)
    {
        milliSeconds1 += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
    }

    public Vector2 PlayerPosition
    {
        get
        {
            return position;
        }
        set
        {
            position = value;
        }
    }

    public void Up()
    {
        if (milliSeconds1 >= walkingTimer)
        {
            if(position.Y > 60)
                position.Y -= walkingSpeed;

            milliSeconds1 = 0;
        }
    }

    public void Down()
    {
        if (milliSeconds1 >= walkingTimer)
        {
            if(position.Y < 630)
                position.Y += walkingSpeed;

            milliSeconds1 = 0;
        }
    }

sentences:
How to calculate if a point is contained in rectangular camera viewport with rotation? I am working with my camera, and am trying to improve it so that I can calculate if a world point is on screen, taking rotation into account. Currently, my camera rectangle is calculated as so:

    public Rectangle Rectangle
    {
        get
        {
            int width = (int)((ViewportWidth / _zoom));
            int height = (int)((ViewportHeight / _zoom));
            return new Rectangle((int)(_pos.X - width / 2), (int)(_pos.Y - height / 2), width, height);
        }
    }

Then, to check if a point is on screen, I call one of the following functions:

    public bool IsOnScreen(Point location)
    {
        return this.Rectangle.Contains(location);
    }

    public bool IsOnScreen(Rectangle bounds)
    {
        return this.Rectangle.Intersects(bounds);
    }

However, none of these calculations take the rotation factor into account; only position and the zoom factor. I know that I can calculate the corners of the camera, in world space, using the following transformations:

var topLeftCorner      = Vector2.Transform(new Vector2(0, 0), Matrix.Invert(ViewMatrix));
var topRightCorner     = Vector2.Transform(new Vector2(ViewportWidth, 0), Matrix.Invert(ViewMatrix));
var bottomLeftCorner   = Vector2.Transform(new Vector2(0, ViewportHeight), Matrix.Invert(ViewMatrix));
var bottomRightCorner  = Vector2.Transform(new Vector2(ViewportWidth, ViewportHeight), Matrix.Invert(ViewMatrix));

However, the rectangle object that I am using is not able to take this into account, since it cannot store rotation. What is the calculation that I can use to check if a point is inside the virtual rectangle with these points, or if a rectangle intersects with the virtual rectangle?

Here's some graphics to better illustrate some of my code:

sentences:
Finding which side one point is from another point I have a simple question I think, if point a is to the right of another point I a dirx to be 1, otherwise -1. Likewise for a diry var, if it's above the other point I want it to be -1 otherwise 1. This is what I've worked out so far:

dirx = (abs(disx+1)/(disx+1))*-1;
diry = (abs(disy+1)/(disy+1))*-1;

The disx and disy are the distance from each other on x and y. I have a +1 to keep from having a division by 0 error, lastly I'm *-1 it all so that it'll match the coordinate system of the game screen where something higher has a lesser value than something lower.

My problem is that I'm still getting a division by 0 error with this code, I'm not sure why as I even added +1 to make sure it wasn't possible???

sentences:
Dynamic object creation from data I want to write somewhat randomized object activation effects, like when you step on a trap, you can be tepelorted, damaged, cursed and so on. I applied strategy pattern for this: damage/healing managed by class ChangeHealth, teleportation by class SetPosition etc.

I want to know how can I manage creation of objects in code from data, so, for example I want to be able to set that there will be trap which will damage player and there will be shrine which should teleport you upon activation from, for example, string or bit stream.

I'm working in C#, but interested in overall approach to this problem.

sentences:
Smooth mesh from voxel grid Im trying to implement smooth voxel grid meshing using marching cubes algorithm but I dont quite understand how to do the interpolating (I understand that this would solve the problem) to achieve the smooth transitions on the borders between the empty space and filled space.

In the picture above I have rendered my voxel grid cells as cubes.
Currently the voxel grid is just a 3d array which stores the values if the cell is empty (0.0) or filled(1.0) (not sure if this is ok, do I need to store each cell corners instead).

When processing marching cubes iteration I have to sample my data at floating point indices e.g. I need to look up if position (3.316, 0.16, 0.5) is empty space / on the surface of the data / inside the data.

Currently I just check the cell value where the position is e.g. (3, 0, 0) for the example above which results with cube mesh.

This shows what I want to do more or less:

sentences:
Flixel: doesn't light tile up i'm creating a game with flixel, and I want to have a effect when you mouse over a tile, I tried implementing it, and this is what it gives:

    public class GameState extends FlxState
{
    private var block:EmptyBlock;
    public function GameState()
    {

    }

    override public function create():void {
        for (var i:Number = 0; i < 30; i++) {
            block = new EmptyBlock(i, 20);
            block.create();
        }
    }

    override public function update():void {
            block.update();
            super.update();
    }
}

}

GameState class

and here is the EmptyBlock class:

public class EmptyBlock
    {

    private var x:int;
    private var y:int;
    private var row:FlxRect
    public function EmptyBlock(x:int, y:int )
    {
        this.x = x;
        this.y = y;
    }

    public function create():void {
         row = new FlxRect(x, y, 32, 32);
        trace ("Created block at" + x + y);
    }

    public function update():void {
        if (FlxG.mouse.screenX == row.x) {
            if (FlxG.mouse.screenY == row.y) {
                var outline:FlxSprite = new FlxSprite(row.x, row.y).makeGraphic(row.width, row.height, 0x002525);
            }
        }
    }

}

}

UPDATE:

The problem is still not solved.

I tried what you recommended, this is the new code:

  public class EmptyBlock extends FlxSprite {
       private var outline:FlxSprite;
       [Embed(source = 'freetile.png', mimeType="image/png")] private var    freeTile:Class;
    public function EmptyBlock(x:int, y:int) {
        this.x = x * 32;
        this.y = y;
        width = 32;
        height = 32;

        // Note: this is a block, rather than an outline.
        // Create an outline image, then use loadGraphic()
        // instead of makeGraphic() if you want an outline.
        outline = new FlxSprite(this.x, this.y);
        outline.loadGraphic(freeTile, false, false, 32, 32, false);
    }

    override public function draw():void {
        super.draw();
        if (overlapsPoint(FlxG.mouse.getScreenPosition()))
            outline.draw();
    }
}
}

And I call it here:

        public function  createMap():void {
        var block:EmptyBlock = new EmptyBlock(0, 0);
        block.draw();

    }

Do you see what i'm doing wrong?

Thanks!

sentences:
Why doesn't my C#6 code compile in Unity? Why can't Unity work with C# 6 code? It always gives me compiler errors. Here are some code examples:

using static System.Convert;
using static System.Environment;

$"€{punten}{NewLine}€{Money}{NewLine}€{KilledEnemies}{NewLine}€{bonus}{NewLine}€{total}";

I use Visual Studio as my code editor and build with no errors. If I press play in Unity it won't build.

sentences:
LWJGL 3.0.0 glMapBuffer I am currently working on a project and usually in C++ I use the function.
ByteBuffer glMapBuffer(int target, int access)

usage:

FloatBuffer buffer = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY).order(
    ByteOrder.nativeOrder()).asFloatBuffer();

But in java (lwjgl 3.0.0) this function returns null, because of this reason it throws a NullPointerException.

Anyone any idea how to use this function in java?

There are several functions:

glMapBuffer(int target, int access)
glMapBuffer(int target, int access, ByteBuffer old_buffer)
glMapBuffer(int target, int access, long length, ByteBuffer old_buffer)

I hope this is specific enough, thank you for your help :D

sentences:
Destroying a networked projectile and creating a client side visual for all clients in Unity? I'm making a shooter in Unity with UNET, and of course I handle projectile (like arrows) collision on the server.

The arrows are Networked rigidbodies with NetworkBehaviours, and I would like to spawn a Non-networked, eye candy like client side prefab at the collision point.

Current solution:

protected override void OnServerFixedUpdate()
{
    var distanceSincePreviousFrame = Vector3.Distance(positionAtPreviousFrame, rb.position);
    Collider collider;
    Vector3 impactPoint;
    if(CheckForImpactInNextFrame(distanceSincePreviousFrame, out collider, out impactPoint))
    {
        transform.position = impactPoint;
        DoImpactEffect(collider);
        GetComponent<Rigidbody>().isKinematic = true;
        NetworkServer.Destroy(gameObject);
    }
    positionAtPreviousFrame = rb.position;
}
void OnDestroy()
{
    var go = Instantiate(ClientSidePrefab, transform.position, transform.rotation);
}

The rigidbody flies on the server (rigidbody synced), and CheckForImpactNextFrame checks collision by raycasting. (needed so projectiles won't go through things due to simulation errors).
If it collides, then it does its impact effect, then destroys itself on the network.
Clients instantiate a client side, non networked prefab for visuals when the networked projectile is destroyed.

At the server side this works well, "client side arrow" is instantiated at the impact position,

but at clients, it's instantiated at its previous position, because the transform.position = impactPoint; in the if isn't synced before it is destroyed on the clients.

How could I make those client side visuals appear at the correct position?

Could I call a "force sync" before destroying?

I can't call an RpcCreateVisuals(position) method, because the entity may be destroyed on the client when the Rpc message arrives. (because the destroy message was faster.)

I could call an "always alive" object's Rpc, like a ProjectileManager's method, and I think that it will always arrive, because destroying the projectile has no effect on it. But it feels hacky, non OOP. Doesn't it?

How should I solve this solution? What is the common approach for this problem?

The same problem described by someone else: https://answers.unity.com/questions/1636182/client-objects-not-traveling-same-distance-as-on-s.html

Maybe I could disable them, and subscribe them to a "GarbageCollector" system, which destroys them only after a delay? Is this a well designed solution?

sentences:
Algorithm for a rain effect (Shaders) I'm trying to implement a rain effect using shader, I use godot 3-alpha, which uses a simplified GLSL 3.0 language. But I'm just finding very complex examples for me, I understand little about shaders, I wanted to achieve something very basic even to be able to walk. I thought of doing the following, moving the texture with just a few painted pixels. Yet I still do not know where to start.

I found this code, I really wanted to understand what is done in it:

http://www.glslsandbox.com/e#36547.0

I managed to translate the code for godot 3, but it does not work very well, I believe this line is to blame:

p=0.5+0.35*sin(11.0*fract(sin((s+p+scale)*mat2(vec2(7,3),vec2(6,5)))*5.0))-f;

What really is done that line? I can not understand what he does.

I did so:

shader_type canvas_item;

uniform float direction;
uniform float velocity = 1.0;
uniform float intensity;

float snow(vec2 uv, float scale, float time)
{
    float w = smoothstep(1.0,0.0,-uv.y*(scale/10.0));
    if(w<0.1){return 0.0;}
    uv+=time/scale;
    uv.y-=time*velocity/scale; //VELOCITY
    uv.x+=sin(uv.y+time*0.5)/scale;
    uv*=scale;
    vec2 s=floor(uv);
    vec2 f=fract(uv);
    vec2 p;
    float k=3.0;
    float d;
    vec2 t = (s*p*vec2(scale))*mat2(vec2(7.0, 3.0), vec2(6.0,5.0));
    p.y=-(0.5+0.35*sin(11.0*fract(sin((s.y+p.y+scale)*t.y)*5.0))-f.y);
    p.x = f.x;

    d=length(p);
    k=min(d,k);
    k=smoothstep(0.0,k,sin(f.x+f.y)*0.01);
    return k*w;
}

void fragment(){
    vec2 uv=(COLOR.xy*2.0-SCREEN_UV.xy)/min(SCREEN_UV.x,SCREEN_UV.y);
    float c=smoothstep(1.0,0.3,clamp(uv.y*0.3+0.8,0.0,0.75));
    c+=snow(uv, 30.0, TIME)*0.3;
    c+=snow(uv, 20.0, TIME)*0.5;
    c+=snow(uv, 15.0, TIME)*0.8;
    c+=snow(uv, 10.0, TIME);
    c+=snow(uv, 8.0, TIME);
    c+=snow(uv, 6.0, TIME);
    c+=snow(uv, 5.0, TIME);
    c+=snow(uv, 2.0, TIME);
    COLOR = vec4(vec3(c),0.5);

}

and this happens:

I have discovered that by decreasing the value I am passing to the scale, it increases the "particles", I mean how octaves in a noise, the smaller the number last, the greater the peaos generated. But my screen seems to be divided in two, cut by a diagonal line, I do not understand much because. I realize that here is the problem:

vec2 uv=(COLOR.xy*2.0-SCREEN_UV.xy)/min(SCREEN_UV.x,SCREEN_UV.y);

  Up 1:

I managed to improve with this:

vec2 uv= UV;

now it's like this:

but what he wanted was to be able to pass three uniforms, direction, velocity and intensity, and to be able to control the direction (right equer), the speed with which they fall, the intensity (higher or lower particles, more or less drops). But I still do not understand how well it is done to do that. Even more that what I will do is rain, I have to understand what is done with the colors to get the idea of rain and not snow.

  Up 2:

I was stirring here and the velocity, intensity and direction I was able to configure passing a uniform. But I can not change the color of the drops, it always comes out black and white. How would you put a blue color for example?

I try to change the color to red for example using the mix() function:

vec3 col2 = vec3(1.0, 0.0, 0.0);
vec3 resultColor= mix(vec3(c), col2, 0.7);
COLOR = vec4(vec3(resultColor),0.3);

and I get this:

I wanted to change only the color of the drops?

R= I got it like this:

 COLOR = vec4(vec3(0.3, 0.3, c),0.5);

but I'm not very fond of the result, it's very bright, and my breasts are too big, I'll fix it.

sentences: How do I implement parallax scrolling in 2D? Suppose I have three layers: a foreground, an intermediate-ground and a background.  What is involved in using these three layers to create parallax scrolling?

sentences:
How do you handle 'move to mouse', if the player is already at the mouse? I'm making a top-down-2D game. When my player moves, the cursor does not move with it. In my game, the player moves by facing the cursor and then walking toward it. This means that eventually, the player will reach the cursor and then glitch out.

How do I handle player movement when they reach the mouse?

sentences:
Unity3D free in game purchase solution Am making an android game with unity and i want to add an in-game purchase feature, i looked around and all the suggestion lead to non-free plugins (mainly prime31 plugin) but in the current moment i cannot afford to invest in some of these plugins, does anyone of you have a free solution for this "problem" ?

thank you

sentences:
Player keeps moving when he shouldn't My player in unity moves but doesn't stop when i let go of the key heres the code:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

    Vector3 movement = new Vector3();
    public CharacterController player;
    public float speed;
    public float vertSpeed;
    public float gravity;
    // Use this for initialization
     void Start(){

    }
    void Update(){
        PlayerMovement ();
    }
    void PlayerMovement(){

        if (Input.GetKeyDown (KeyCode.Space)) {
            transform.Translate(Vector3.up * vertSpeed * Time.deltaTime, Space.World);
            if (!player.isGrounded) {
                movement.y = movement.y - gravity * Time.deltaTime;
            }
        }
        if (Input.GetKey (KeyCode.A)) { // left
            movement.x = movement.x - speed * Time.deltaTime;

        } else if (Input.GetKey (KeyCode.D)) {// goes right
            movement.x = movement.x + speed * Time.deltaTime;
        }

        player.Move ((movement * speed) * (Time.deltaTime));
    }

}

sentences:
Sprite and Physics components or sub-components? I'm taking my first dive into creating a very simple entity framework. The key concepts (classes) are:

Entity (has 0+ components, can return components by type)
SpriteEntity (everything you need to draw on screen, including lighting info)
PhysicsEntity (velocity, acceleration, collision detection)

I started out with physics notions in my sprite component, and then later removed them to a sub-component. The separation of concerns makes sense; a sprite is enough information to draw anything (X, Y, width, height, lighting, etc.) and physics piggybacks (uses the parent sprite to get X/Y/W/H) while adding physics notions of velocity and collisions.

The problem is that I would like collisions to be on an entity level -- meaning "no matter what your representation is (be it sprites, text, or something else), collide against this entity." So I refactored and redirected collision handling from entities to sprite.physics, while mapping and returning the right entity on physics collisions.

The problem is that writing code like this.GetComponent<SpriteComponent>().physics is a violation of abstraction. Which made me think (this is the TLDR): should I keep physics as a separate component from sprites, or a sub-component, or something else? How should I share data and separate concerns?

sentences:
Collision Detection Problems So I'm making a 2D tile based game but I can't quite get the collisions working properly. I've taken the code from the Platformer Sample and implemented it into my game as seen below.

One problem I'm having is when I'm on the ground for some strange reason I can't move to the left. Now I'm pretty sure this problem is from the HandleCollisions() method because when I stop running it I can smoothly move around with no problems. Another problem  I'm having is when I'm close to a tile the character jitters very strangely.

I will try to post a video if necessary. Here is the HandleCollisions() method:

void HandleCollisions() {
    Rectangle bounds = BoundingRectangle;

    int topTile = (int)Math.Floor((float)bounds.Top / World.PixelTileSize);
    int bottomTile = (int)Math.Ceiling((float)bounds.Bottom / World.PixelTileSize) - 1;
    int leftTile = (int)Math.Floor((float)bounds.Left / World.PixelTileSize);
    int rightTile = (int)Math.Ceiling((float)bounds.Right / World.PixelTileSize) - 1;

    isOnGround = false;

    for(int x = leftTile; x <= rightTile; x++) {
        for(int y = topTile; y <= bottomTile; y++) {
            if(world.Map[y, x].Collidable == true) {
                Rectangle tileBounds =
                     new Rectangle(x * World.PixelTileSize, y * World.PixelTileSize,
                                           World.PixelTileSize, World.PixelTileSize);
                Vector2 depth = RectangleExtensions.GetIntersectionDepth(bounds,
                                                                         tileBounds);

                if(depth != Vector2.Zero) {
                    if(Math.Abs(depth.Y) < Math.Abs(depth.X)) {
                        isOnGround = true;
                        position = new Vector2(position.X, position.Y + depth.Y);
                    }
                    else {
                        position = new Vector2(position.X + depth.X, position.Y);
                    }

                    bounds = BoundingRectangle;
                }
            }
        }
    }
    ...
}

sentences:
How Use loop's in cocos2d-x I've for loop which work well on Windows

double speed = 35;

    for(int i=0; i<60 ;i++){

        speed += 0.3;
        Sleep (1000); // sleep 1000 mili seonds

     }

But it responds an error on cocos2d-x.what should i do in cocos2d-x.
In my code i want to increase my speed to N unit every X second.

auto Action = MoveBy::create(3  *   visibleSize.width,Point(-visibleSize.width * speed, 0));

My way is right or should I do something else

sentences:
How can one access the depth buffer for Unreal Tournament 2004? I'm looking for a way of getting depth buffer data for a virtual 3D sensor.

Currently the method used is raycasting (implemented in UnrealScript), but I want to use the depth buffer data instead for faster output of the sensor in FPS.

One complete frame of data takes many seconds to generate currently, which is bad for my application which must parse this 3D depth data and also control a vehicle with it.

I'd like to get the data from D3D but don't know if it's possible.

sentences:
assets access with index offsets My question if about resource management.
Is it a good idea to store resources like Sounds in an array and then make a second array(lets call this SoundCollections) as a sort of reference table(name + index of sounds array).

The SoundCollection structure looks like this:

struct SoundCollection{
    unsigned char name[64];
    unsigned int offset;
    unsigned int count;
};

GameObjects can aqcuire a SoundCollectionHandle and use the SoundCollection[SoundCollectionHandle].offset in the Sounds array.
GameObjects then can call

Audio.playsound(Sounds[SoundCollection[SoundCollectionHandle].offset + PlayerSounds::Jump])

for playing a jump sound.

The SoundCollection::count is used as offset for next SoundCollection and bound checking. The same thing I want to use for Sprites and Textures.

Are there any other methods you usually use in your games?

sentences: Who know how to implement the 2D bone animation showed in the game? I wonder how do they implement the bone animation in the flash game http://www.foddy.net/athletics.swf Do you know any study materials which I can start to learn 2D bone system from? I just implemented a avatar system by compose multiple bitmaps in each frame(similar with maple story), but some guys tell me that, a bone system can save more art resources, so I want to learn some thing about that.

sentences:
Unity, NavMeshAgent SetDestination acts funny I had a scene set as the following picture.

And a NavMesh baked as the following picture.

But my "player" (The left-bottom corner sphere) don't go where I want it want to go!

Test vedio

Source Codes:

public Camera cam;
public NavMeshAgent agent;
public GameObject particle;
// Update is called once per frame
private void Start()
{
    particle.GetComponent<Renderer>().material.color = Color.red;
}
void Update ()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if(Physics.Raycast(ray,out hit))
        {
            Vector3 v = hit.point;
            agent.SetDestination(v);
            Instantiate(particle,v,transform.rotation);
        }
    }
}

Could somebody please help me out!?

Much appreciated!!!

PS.

I found out through my "particle" that after first few hits, the "hit position" starts to "float"!

That's why my "particle" became bigger!

It doesn't "hit" the plane no more!

It always hit at somewhere above the plane!

That's why my "player" can NOT go to the destination!

Could somebody teach me how to fix it please!

Much appreciated!

sentences:
Why shouldn't I permit changing the field of view, if the technology allows for it? This is less of a question aimed at developing a game and more about the technology behind it. A number of gaming journalists and pro gamers (both in the tournament and the home entertainment sector) often hammer on the matter that any first or third person game should have a way to change the field of view, and I agree with them. The main reason they mention this is because a pretty large number of players get motion-sickness related headaches and eyestrain if they play with an overly constrained field of view.

I can understand if an indie developer does not allow this due to budget constraints, because they need to add support to the engine for that. However, a number of developers use high profile third party engines like Frostbite, Unity, Unreal, or Cryengine, but don't offer an option for changing the field of view.

Why shouldn't I permit changing the field of view, if the technology allows for it?

sentences:
How can this kind of entity/component organization improve cache efficiency? I've been reading up about entity component systems as a design pattern for an OpenGL engine. The style I'm trying to implement has entities only being integers, and components being long contiguous arrays of, for example glm::vec3 for a world-position component.

The entity integers then work as indices into those arrays. All of this described best by this post.

As I understand, the main benefits of an ECS would include:

Simplification and elimination of unnecessary dependencies and spaghetti code
Performance boost: contiguous component arrays translate into fewer cache misses and an overall de-bloating of complex inheritance

While I do agree with the first point, I don't understand how the second could be true.

On a regular draw call, you'd need almost always the majority of components. You need position, scale, rotate for loading a MVP matrix into the shaders. You need the mesh and textures for rendering itself. You even need details like light color or whether or not it casts shadows. Everything! This means that you will inevitably encounter cache misses in some form, since you can't fit your component arrays in cache.

Add to that the fact that since the entity integers are indices into the component arrays, all of the component arrays need to grow in size whenever you add an entity - independent of it's type. This means that adding 30 entities with no mesh will inevitable generate 30 empty mesh allocations that will never be used.

How would you implement such a system to truly minimize cache misses without incurring in unnecessary memory waste?

sentences:
How to create rounded TV edges effect in Unity? Is there a way to get rounded TV edges like these:

I want rounded egdes and the distortion effect, but I can't find a way to do this. I am using Unity 2017.

sentences:
Why does adding LIBGDX "fadeIn" action to a table in a group make the whole stage fade in? I'm trying to "fadeIn" a store "screen" which is really just an invisible group. I set the group to visible=true, set the alpha to 0 and then do a "fadeIn" on the group. The problem is that the whole stage goes black (my clear screen color) and then fades back in.

storeGroup.addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

I even went as far as to make the Table within my StoreGroup accessible and adding the action to that, but the result is the same.

storeGroup.getTable().addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

Essentially I just want my store group to fade in over whatever is currently displaying, but the fade in seems to apply to every other actor in my Stage, not JUST the one I'm adding it to.

Any help would be greatly appreciated, I've been working on this all morning and can't figure out why the "fadeIn" is applying to everything.

sentences:
XNA - How to move skinned model and merge animations After you helped me to resolve my loadContent problem I've wrote some code and made 3D model with animation. Because XNA 4.0 doesn't support .fbx with multiple animations I've generated 3 models with different animations:
1. Start animation ( when you press arrow for the first time)
2. walk animation ( when you still hold it)
3. stop animation ( when button is up)

And here comes my question. How to apply those 3 models to work with arrows.
Now I'm using to render animations (http://xbox.create.msdn.com/en-us/education/catalog/sample/skinned_model )

 protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("end_R");

        // Look up our custom skinning information.
        SkinningData skinningData = currentModel.Tag as SkinningData;

        if (skinningData == null)
            throw new InvalidOperationException
                ("This model does not contain a SkinningData tag.");

        // Create an animation player, and start decoding an animation clip.
        animationPlayer = new AnimationPlayer(skinningData);

        AnimationClip clip = skinningData.AnimationClips["end_R"];

        animationPlayer.StartClip(clip);
    }

file with model and animation's name is identical.

I have also second question :) How to get model position from or how to move this model? Now it's connected with camera coordinates but I'd rather prefer the model to have it's own coordinates and transform it independently from camera.

sentences:
What exactly are sprites and entities and what are the differences between the two? Well I was looking at a few game based tutorials, as well as articles. I found out about two terms:
Entities and Sprites. Now they seem related but different, what is each and how are they the same and/or different?
I have some basic ideas already:

An entity is an item/thing/object/person any object that can be interacted with in the world.

A sprite is like an entity, but usually for NPCs/players/monsters.

Or a sprite can be the name of a picture assigned to a specific entity.

Do I have the right idea or are sprites and entities something completely different?

sentences:
Level Design V.S. Modeler From what I understand being a level designer and a character/environment/object/etc Modeler are two different jobs, yet sometimes it feels like a Modeler can also do the job of the level designer.  I know this also depends on the scale of the game.  For small games maybe they are one and the same, but for bigger games they become two different jobs.

I understand a background in some modeling could not hurt when it comes to level design, but the question I have is:  Do jobs prefer people who can model for level designing?  This way they can kill two birds with one stone and have someone to create the assets and design the level.

What is your opinion of the training?  Does level design contain skill sets that make them completely different from what a modeler can do, or is this an easy transition for a modeler to become a level designer?  Can you be a bad level designer but a good modeler and vice versa?

sentences:
Why does my triangle ray intersection test always return -1.0f? I'm trying to get the mouse click position on a terrain geometry, but multiple times in each frame; doing it on the CPU was way too slow, so I'm trying to do it with a compute shader. I can't seem to get a valid result back. I guess it's somehow related to my raydirection/rayorigin vectors, because I tried 4 different written DirectX HLSL solutions, but none of them works for my case; though, I did have to modify them. Anyway, this is my code to generate the ray vectors:

XMFLOAT3 RayOriginFloat = m_Camera->GetPosition(); //The eye position of the camera. I use this vector in the compute shader.

XMVECTOR worldPos;
XMVECTOR RayOrigin = XMLoadFloat3(&RayOriginFloat);
DirectX::BoundingFrustum frustum;

// I use the DirectXMath XMVector3Unproject method to project the mouse coord to worldspace.
ScreenToWorld(m_mouseX, m_mouseY, &worldPos);

XMVECTOR RayDir = worldPos - RayOrigin;
RayDir = XMVector3Normalize(RayDir); //And finally the normalized direction vector

And this is the HLSL code:

cbuffer RayBuffer
{
    float3 RayOrigin;
    float3 RayDir;
    matrix view;
};

struct ComputeInputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD;
    float3 normal : NORMAL;
};

struct ComputeOutputType
{
    float distance;
    float3 position;
};

static const uint ThreadSize = 32;

StructuredBuffer<ComputeInputType> BufferIn : register(t0);
RWStructuredBuffer<ComputeOutputType> BufferOut : register(u0);

[numthreads(ThreadSize, ThreadSize, 1)]
void PickingCSMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    float result;
    float3 vertices[3];
    float3 edge[2];

    if (dispatchThreadID.x < 64 && dispatchThreadID.y < 64)
    {
        vertices[0] = BufferIn[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].position;
        vertices[1] = BufferIn[(dispatchThreadID.x + (dispatchThreadID.y + 1) * ThreadSize * 2)].position;
        vertices[2] = BufferIn[(dispatchThreadID.x + 1 + (dispatchThreadID.y + 1) * ThreadSize * 2)].position;

        edge[0] = vertices[1].xyz - vertices[0].xyz;
        edge[1] = vertices[2].xyz - vertices[0].xyz;

        float3 normal = normalize(cross(edge[0], edge[1]));
        float b = dot(normal, RayDir);

        float3 w0 = RayOrigin - vertices[0].xyz;
        float a = -dot(normal, w0);
        float t = a / b;

        result = t;

        float3 p = RayOrigin + t * RayDir;
        float uu, uv, vv, wu, wv, inverseD;
        uu = dot(edge[0], edge[0]);
        uv = dot(edge[0], edge[1]);
        vv = dot(edge[1], edge[1]);

        float3 w = p - vertices[0].xyz;
        wu = dot(w, edge[0]);
        wv = dot(w, edge[1]);
        inverseD = uv * uv - uu * vv;
        inverseD = 1.0f / inverseD;

        float u = (uv * wv - vv * wu) * inverseD;
        if (u < 0.0f || u > 1.0f)
        {
            result = -1.0f;
        }

        float v = (uv * wu - uu * wv) * inverseD;
        if (v < 0.0f || (u + v) > 1.0f)
        {
            result = -1.0f;
        }

        BufferOut[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].distance = result;
        BufferOut[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].position = vertices[0].xyz;
    }
}

The result is always -1.0f. I don't get it; I might have made a big mistake, but I can't find where.

Why does my triangle ray intersection test always return -1.0f?

sentences:
How would I move something around inside of a sphere without it going outside of the sphere? I want to be able to do this, but not go outside of the 4.4 meter limit, the radius is 4.4 meters, and it has zero gravity and no friction. I have a hard time explaining this, but imagine holding a hollow sphere with a little ball inside, when you shake it around the ball goes around the inside, I need something like that, but with zero gravity and no friction. I wasn't really sure how to do this, but I tried:

void Slide() {
if (slide) {
    for (uint32_t deviceIndex = 0; deviceIndex < vr::k_unMaxTrackedDeviceCount; deviceIndex++) {
        glm::vec3 position = devicePos[deviceIndex].xyz();
        if (sqrt(pow(position.x - 0.35, 2) + pow(position.y + 1.75, 2) + pow(position.z + 0.85, 2)) >= 4.4) {
            if (abs(position.x) > abs(position.y) && abs(position.x) > abs(position.z)) {
                if (position.x > 0) {
                    velocity.x = ((abs(velocity.y)) + (abs(velocity.z))) / 2;
                }
                else {
                    velocity.x = ((abs(velocity.y) * -1) + (abs(velocity.z) * -1)) / 2;
                }

            }
            if (abs(position.y) > abs(position.x) && abs(position.y) > abs(position.z)) {
                if (position.y > 0) {
                    velocity.y = ((abs(velocity.x)) + (abs(velocity.z))) / 2;
                }
                else {
                    velocity.y = ((abs(velocity.x) * -1) + (abs(velocity.z) * -1)) / 2;
                }

            }
            if (abs(position.z) > abs(position.x) && abs(position.z) > abs(position.y)) {
                if (position.z > 0) {
                    velocity.z = ((abs(velocity.x)) + (abs(velocity.y))) / 2;
                }
                else {
                    velocity.z = ((abs(velocity.x) * -1) + (abs(velocity.y) * -1)) / 2;
                }
            }
        }
    }
}

}

sentences:
Collision Checking in Unity immediately after instantiation I'm working on a dungeon generation script and I'm having some issues detecting overlap. Each piece that I spawn has attachment points, with rotation values and an offset amount so things lineup correctly. So far this is working. After spawning, I then check to see if the piece is overlapping with another, but sometimes it seems like unity hasn't caught up with the collision system, as I check to see if a bool bOverlap is true(which gets set in an ontriggerstay function) and if so destroy the piece. However, many times the script will have gotten past this collision check portion, before the collision event fires.

Any suggestions?

Each piece has a rigidbody and box collider on it for the simple collisions.

sentences:
how to disable enum if bool is not true in inspector unity I want to enable an enum when a bool value is true through the inspector and disable it when the value is false.
Please see the relevant code below:

public bool hasWeapon;

[System.Serializable]
public enum WeaponType {HandGun, Sword, ShotGun, Spear, BowAndArrow};

public WeaponType weaponType;

From the above code weaponType should only appear in the inspector if hasWeapon is true.

How can this be done?

sentences:
glVertexAttribPointer alters completely different shader program My program contains two shader programs in it. The following code is for preparing one of the shader program's attributes:

int positionHandle2 = glGetAttribLocation(programAColorUTranslate, "vPosition");
glEnableVertexAttribArray(positionHandle2);
glVertexAttribPointer(positionHandle2, 2, GL_FLOAT, GL_TRUE, 2 * sizeof(float), 0);
translateHandleAColorUTranslate = glGetUniformLocation(programAColorUTranslate, "vTranslate");

int aColorHandle = glGetAttribLocation(programAColorUTranslate, "aColor");
glEnableVertexAttribArray(aColorHandle);
/*glVertexAttribPointer(aColorHandle, 3, GL_FLOAT, GL_TRUE, 5 * sizeof(float), 0);*/

At this point, the program works fine, except that the vertices drawn by the above shader program are not colored, since the line above is commented out. However, if I uncomment the line above (and change the stride of position handle to 5 * sizeof(float)) to try to add colors to the above shader program's vertices, random shapes appear in my program. Supposedly, the above line should only alter triangles rendered by one of the shader programs, not both. However, every single vertex in my program is being rendered incorrectly after uncommenting the about line, to the point that the program becomes unrecognizable from before.

sentences:
Problem animating in Unity/Orthello 2D. Can't move gameObject I have a enemy npc that moves left and right in a corridor.
It's animated with 2 sprites using Orthello 2D Framework.

If I untick the animation's play on start and looping, the npc moves correctly.
If I turn it on, the npc tries to move but is pulled back to his starting position again and again because of the animation loop.
If I turn looping off during runtime, the npc moves correctly again.

What did I do wrong?

Here's the npc code if needed.

using UnityEngine;
using System.Collections;

public class Enemies : MonoBehaviour
{
    private Vector2 movement;
    public float moveSpeed = 200;
    public bool started = true;
    public bool blockedRight = false;
    public bool blockedLeft = false;
    public GameObject BorderL;
    public GameObject BorderR;

    void Update ()
    {
        if (gameObject.transform.position.x < BorderL.transform.position.x)
        {
            started = false;
            blockedRight = false;
            blockedLeft = true;
        }
        if (gameObject.transform.position.x > BorderR.transform.position.x)
        {
            started = false;
            blockedLeft = false;
            blockedRight = true;
        }

        if(started)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedRight && !started && blockedLeft)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedLeft && !started && blockedRight)
        {
            movement = new Vector2(-1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
    }
}

sentences:
Unity strange clones behavior I am setting up a grid of tiles (2d sprites) in Unity with this code:

public class Grid : MonoBehaviour {

public GameObject slot;
public int gridW = 9;
public int gridH = 9;

private GameObject [,] grid = new GameObject[9, 9];

void Awake(){

    for(int y=0; y<gridW; y++)
    {
        for(int x=0; x<gridH; x++)
        {
            GameObject gridSlot = (GameObject)Instantiate(slot, new Vector3(x, y, 0), Quaternion.identity);
            gridSlot.transform.parent = transform;
            grid[x,y]=gridSlot;
        }
    }

}

I then would like to have printed on the console the x,y coordinates of an individual tile when clicked on it. This is the script attached to the tile prefab:

public class Tile : MonoBehaviour {

void Start () {

}

void Update () {

    if(Input.GetMouseButtonDown(0))
        Debug.Log(transform.position.x + " " + transform.position.y);
}

Yet when I click on a tile I get printed the coordinates for ALL of the tiles on the grid. Why is this happening? Is there something very basic I am missing...?

Thanks!

sentences:
What is the best way to limit player movement? I'm currently programming a 2d game where the player moves around on a rectangular playing field. The player has a direction and a velocity. What is the best way to limit the player's movement so he/she cannot move past the boundaries of the playing field?

Thanks,

DLiKS

sentences:
Unity-Error within Tree Editor I've been making a tree in with the Tree Editor in Unity, and for a realistic effect, I need to make all the leaves face a general direction, the problem is that most of them don't face that direction and are upside down or sideways.

So you further understand, i'll add some images.

I'd like all the leaves to face in this direction.

(Image 1) In here you can see that some leaves are upside down or sideways and i'd like to make all the leaves face the same way.

(Image 2) In here you can see the leaf is facing up and this is the way I would like all the leafs to face.

Any help is appreciated, thank you.

sentences:
Why Sorting process not happening? I created 10000 array and assigned value 1 and 0 to it, then used gizmos to generate 10000 cubes. I paint it black or white depending on the assigned value.
After that I use the bubble sort algorithm to sort the cubes, expecting all black cubes pieled on the bottom but when I run it, the sorting does not happen and I can't spot where my mistake is.
    using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    int x;
    int y;
    int z;

    int[,] array1 = new int[100, 100];
    int temp;
    // Start is called before the first frame update
    void Start()
    {

        for (x = 0; x < 100; x++)

        {
            for (y = 0; y < 100; y++)
            {
                array1[x, y] = Random.Range(0, 2);

                Debug.Log(string.Format("{0},{1},{2}", x, y, array1[x, y]));

            }
        }
        OnDrawGizmos();

    }
    void OnDrawGizmos()
    {

        for (x = 0; x < 100; x++)
        {
            for (y = 0; y < 100; y++)
            {
                Vector2 pos1 = new Vector2(0 + x, 0 + y);
                Gizmos.DrawCube(pos1, transform.position);
                Gizmos.color = (array1[x, y] == 1) ? Color.black : Color.white;
            }
        }
    }

    void update()
    {
        for (z = 0; z < 100; z++)
        {
            for (x = 0; x < 100; x++)
            {
                for (y = 0; y < 100 - z; y++)
                {
                    if (array1[x, y] > array1[x, y + 1])
                        temp = array1[x, y];
                    array1[x + 1, y] = array1[x, y];
                    array1[x, y] = temp;

                }
            }
        }
        OnDrawGizmos();
    }
}

sentences: Unity Multiplayer functionalities or Google's plug-in? I want to add multiplayer matches to a game I'm making for Android/PC, and something echoed in my mind: would the network functionalities Unity provides work in Android? I ask this because Google has a free plug-in for their services, but Unity also offers possibilities. Also, using any of the above, do I need to pay to rent a server? Or, for example, since we need a paid developer account to register our game at Google Play Store, the servers are part of the deal?

sentences:
Lightmapped prefabs for procedural content I'm doing a game with procedural content from handmade prefabs, but I ran into a problem as Unity bakes the scene instead of objects when lightmapping with Beast. So when the prefabs are instanced they are without lightmaps.

Is there a way to get lightmaps for dynamically created prefabs with Unity's built-in lightmapper?

sentences:
Can't Build Cocos2Dx emscripten project I need to port a Cocos2D-x project to Web (JS+HTML5). I'm trying to compile cocos2D-x samples using the emscripten project for cocos2d-x, and I've followed this tutorial http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Emscripten_usage without success.

First, I followed the emscripten-specific guide using Linux Mint 15 with this tutorial:
https://github.com/kripken/emscripten/wiki/Tutorial

And also on Windows 7 64-bit following this another tutorial: https://github.com/kripken/emscripten/wiki/Using-Emscripten-on-Windows

The emscripten samples worked ok. Then, I downloaded the Cocos2D-x project:

git clone https://github.com/cocos2d/cocos2d-x.git
git submodule update --init --recursive

This version from github, has the "proj.emscripten" project. But, when I try to compile the cocos2D-x project and samples with:

make -f Makefile.emscripten -j 8

...after compiling several modules, it stops at "cocos2d-x/extensions/proj.emscripten" with this error:

mingw32-make[1]: Leaving directory `c:/dev/GitHub/cocos2d-x/CocosDenshion/proj.emscripten'
mingw32-make -C extensions/proj.emscripten all
mingw32-make[1]: Entering directory `c:/dev/GitHub/cocos2d-x/extensions/proj.emscripten'
makefile:12: *** recipe commences before first target.  Stop.
mingw32-make[1]: Leaving directory `c:/dev/GitHub/cocos2d-x/extensions/proj.emscripten'
Makefile.emscripten:21: recipe for target `all' failed
mingw32-make: *** [all] Error 2

This happens on both systems: Windows and Linux. I've installed the same version of the required dependencies that apears on those tutorials. Does anybody know what I'm doing wrong? Is there any easier way to get cocos2D-x running on the web without using the cocos2D-x proj.emscripten?

EDITED: There is an error on cocos2d-x/extensions/proj.emscripten/Makefile file. Changing the line 11 from this:

-I../network

...to this:

-I../network \

...solves this problem. Now compiles some more modules, but now I'm getting compiler errors, like

error: no member named 'bind' on namespace 'std'

could be a problem with the C++ compiler standards C++0x, C++11...?

sentences:
Vector movement in space type game (Mouse rotation) I'm having an issue with my movement in my 'game' prototype. It's basically not working and admittedly my knowledge with vectors is lacking.

The issue I'm running into is that the ship won't move in the direction of my mouse. (I'm using my mouse as rotation)

Mouse look example video I took yesterday

I would love it if someone could look at my code/Vector math and tell me if they can notice anything I'm doing terribly wrong, I would greatly appreciate it.

private Vector2f acceleration;
private Vector2f force;
private Vector2f velocity;
private Vector2f position;
private Image image = null;
private float mass;
private float angle;

//Constructors
public Ship(float xin, float yin) {
    this.mass = 5000; // temp value of mass
    this.angle = 0;

    // Image of the ship
    try {
        this.image = new Image("res/ship.png");
    } catch (SlickException e) {
        e.printStackTrace();
    }

    // Vectors
    position = new Vector2f(xin, yin);
    velocity = new Vector2f(0, 0);
    acceleration = new Vector2f(0, 0);
    force = new Vector2f(0, 0);
}

public void update(Input input, float delta) {
    float mouseX = input.getMouseX();
    float mouseY = input.getMouseY();

    float xDistance = mouseX - (position.x + image.getWidth()/2);
    float yDistance = mouseY - (position.y + image.getHeight()/2);

    angle = (float) (Math.toDegrees(Math.atan2(yDistance, xDistance)) + 90);
    image.setRotation((float)angle);

    if (input.isKeyDown(Input.KEY_W)) {
        this.move(delta);
    } else if (input.isKeyDown(Input.KEY_S)) {
        //this.move(delta);
    } else {
        acceleration = new Vector2f(0, 0);
    }
}

public void move(float delta) {
    /*
     * Acceleration = Force / Mass
     * Velocity += Acceleration * ElapsedTime (delta)
     * Position += Velocity * ElapsedTime (delta)
     */
    System.out.println(delta); //debugging
    //delta = delta/10; //debugging
    //System.out.println(delta); //debugging
    force = angleToVector(angle); // Direction
    force = force.normalise();
    force = force.scale(2);
    acceleration = force.scale(1/mass);

    velocity = velocity.add(acceleration.scale(delta));
    position = position.add(velocity.scale(delta));
}

public Vector2f angleToVector(float angle) {
    return new Vector2f((float)Math.cos(angle), (float)Math.sin(angle));
}

If you want to see the full .java for my ship class here's a link.

sentences:
Problems generating procedural mesh I have this code below that I found on catlikecoding that generates a procedural grid that I want to apply noise to, however once I go over a certain value it does expand vertically. Can anyone see why it wouldn't?

For example, 100x100:

However, 500x500 is clearly wrong:

Code used:

using UnityEngine;

[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class Island : MonoBehaviour {

public int xSize, ySize;

    private Mesh mesh;
    private Vector3[] vertices;

    private void Awake () {
        Generate();
    }

    private void Generate () {
        GetComponent<MeshFilter>().mesh = mesh = new Mesh();
        mesh.name = "Procedural Island";

        vertices = new Vector3[(xSize + 1) * (ySize + 1)];
        Vector2[] uv = new Vector2[vertices.Length];

        for (int i = 0, y = 0; y <= ySize; y++) {
            for (int x = 0; x <= xSize; x++, i++) {
                vertices[i] = new Vector3(x, y);
                uv[i] = new Vector2((float)x / xSize, (float)y / ySize);
            }
        }

        mesh.vertices = vertices;
        mesh.uv = uv;

        int[] triangles = new int[xSize * ySize * 6];
        for (int ti = 0, vi = 0, y = 0; y < ySize; y++, vi++) {
            for (int x = 0; x < xSize; x++, ti += 6, vi++) {
                triangles[ti] = vi;
                triangles[ti + 3] = triangles[ti + 2] = vi + 1;
                triangles[ti + 4] = triangles[ti + 1] = vi + xSize + 1;
                triangles[ti + 5] = vi + xSize + 2;
            }
        }

        mesh.triangles = triangles;
        mesh.RecalculateNormals();
    }
}

sentences:
Calculate Discrete Fourier Transform by using c# There is a definition of Discrete Fourier Transform:

I want to calculate amplitude and phase of a transformed sequence.

I tried :

 public ArrayList phase = new ArrayList();
 public ArrayList amp = new ArrayList();
 public float phi = 0;

 void Start ()
 {
      DFT();
      foreach (var ampList in amp)
      {
        Debug.Log(ampList);
      }
 }

 void DFT()
 {
  //Given sequence of Numbers

  float[]  X = {1,2,3};
  float[]  Y = {2,3,5};
  float  N = X.Length;
  float re = 0;
  float im = 0;

  for (int k = 0; k < N; k++)
  {
      //The discrete Fourier transform, lists of Re & Im instead of a+ib
      for (int n = 0; n < N; n++)
       {
           float phi =  (Mathf.PI * k *n)/N;
           re += X[n] * Mathf.Cos(phi) - Y[n] * Mathf.Sin(phi);
           im -= Y[n] * Mathf.Cos(phi) - X[n] * Mathf.Sin(phi);
       }

      re = re/N;
      im = im/N;
      var  ampp = Mathf.Sqrt(re*re + im*im);
      var  phasse  = Mathf.Atan2(re,im);

      phase.Add(phasse);
      amp.Add(ampp);
  }
}

but answer is Not correct, I use Wolfram Mathematica to check the answer :

sentences:
How to gain visibility on the Play Store? Sometime in the near future I'll release my first Android game. It's not going to be anything special, but I'm trying to make it as polished as possible and I would like to know what I can do to prevent it from falling into obscurity.

If you look hard enough, you can find some pretty well-crafted games on the Play Store that, nonetheless, are virtually unknown. I recently came across one developer that has published six well made games that are pretty fun and have good art as well; out of these six, two are moderately popular (10,000–50,000 downloads), while the rest have very few downloads (1,000 or fewer).

What are some techniques to increase your game's visibility on Google Play upon its launch?

sentences:
Animator from another gameobject keeps disappearing from script on play I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to the script keeps disappearing.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RifleShooting : MonoBehaviour
{
    private float NextTimeToFire = 0f;
    private int CurrentAmmo;
    private bool IsReloading = false;

    [Space(10)]
    [Header("Floats")]
    public float Damage = 10.0f;
    public float Range = 100.0f;
    public float ImpactForce = 60f;
    public float FireRate = 15f;
    public float ReloadTime = 1.0f;

    [Space(10)]
    [Header("Others")]
    [Space(5)]

    [Space(10)]
    [Header("Others")]
    [Space(5)]
    public int MaxAmmo = 10;
    public Camera FPSCamera;
    public Animator GunAnimations;
    public ParticleSystem MuzzleFlash;
    public GameObject impactEffect;
    public bool AllowedToShoot = true;
// Start is called before the first frame update
    void Start()
    {
        GunAnimations = GetComponent<Animator>();
        if (CurrentAmmo == -1)
            CurrentAmmo = MaxAmmo;
    }

    private void OnEnable()
    {
       IsReloading = false;
        GunAnimations.SetBool("Reloading", false);
    }
    // Update is called once per frame
    void Update()
    {
        if (IsReloading)
        return;

        if (CurrentAmmo <= 0)
        {
            StartCoroutine(Reload());
            return;
        }

        if (AllowedToShoot == false) return;
        {
            if (Input.GetButton("Fire1") || Input.GetButtonDown("Fire1") && Time.time >= NextTimeToFire)
            {
                NextTimeToFire = Time.time + 1f / FireRate;
                Shoot();
            }
        }
    }

    IEnumerator Reload()
    {
        IsReloading = true;
        Debug.Log("Reloading...");
        GunAnimations.SetBool("Reloading", true);
        GunAnimations.SetBool("IsShooting", false);
        yield return new WaitForSeconds(ReloadTime - .25f);
        GunAnimations.SetBool("Reloading", false);
        yield return new WaitForSeconds(.25f);
        GunAnimations.SetBool("IsShooting", true);
        CurrentAmmo = MaxAmmo;
        IsReloading = false;
    }

    void Shoot()
    {
        //shooting script here
    }
}

Also if it helps here is what I see in the console when I try to fire:

MissingComponentException: There is no 'Animator' attached to the "M4A1" game object, but a script is trying to access it.

sentences:
SQL Database using Adobe Air How do you create an SQL database (I believe it's tinySQL/SQLite) using Adobe Air? I have searched around, and all sites give code, and then explains to wrap it within an xml document, for example here.

So I have created this xml file, but no one seems to explain what to do from there. I am also VERY new to database creations and management. So any super n00b friendly help would be much appreciated.

Thanks.

sentences:
When someone joins or leaves a room, send the entire user list or just the delta? I'm developing a game that has a lot of rooms and most rooms will have between 2 and 15 users. On the UI there is a list of all the players currently in the room. I'm wondering, when someone joins a room, should the server send the entire list of players (admittedly not much) to everyone, or just the delta?

Option 1) Send the entire list to the new person joining because he needs all of them and send the one user to the rest of the players because they already know who else is in the room. Possible synchronization issues and harder to code.

Option 2) When someone enters or leaves a room, resend the entire list of players to everyone. No synchronization issues, much easier to code and test, but increased packet sizes.

Which option would you choose or is there a third one? For reference I'm using node.js and socket.io.

sentences:
Perlin noise - copying the algorithm on the CPU? I have successfully made a Perlin noise algorithm on the GPU. It works as expected, and generates great results. Now, as part of the physics calculations in my game, I need to replicate the exact same algorithm on the CPU, so that I can (given an X, Y and Z coordinate) determine whether or not that is inside a wall, or a walkable area.

I have debugged the shader through PIX, and I've gotten everything almost right, except for the part below (seen in shader code).

GPU (shader) code (HLSL)

float4 perm2d(float2 p)
{
    return tex2D(permSampler2d, p);
}

permSampler2d samples a texture that I generate out of Color structures and then pump to the GPU. The way I generate the texture on the CPU is the following:

CPU code (XNA C#)

int createPerm2d(int i)
{
    return permutation[i % 256];
}

public Texture2D GeneratePermTexture2d()
{
    permTexture2d = new Texture2D(device, 256, 256, true, SurfaceFormat.Color);
    permutationData = new Color[256 * 256];
    for (int x = 0; x < 256; x++)
    {
        for (int y = 0; y < 256; y++)
        {
            int A = createPerm2d(x) + y;
            int AA = createPerm2d(A);
            int AB = createPerm2d(A + 1);
            int B = createPerm2d(x + 1) + y;
            int BA = createPerm2d(B);
            int BB = createPerm2d(B + 1);
            permutationData[x + (y * 256)] = new Color((byte)(AA), (byte)(AB),
                                            (byte)(BA), (byte)(BB));
        }
    }
    permTexture2d.SetData<Color>(permutationData);
    return permTexture2d;
}

As said before, all this works as expected, until I run the code on the CPU to get the noise data back later.

According to PIX, the part that fails is indeed perm2d on the CPU (as seen below), which produces incorrect results.

CPU code (XNA C#)

static Vector4 perm2d(Vector2 p)
{
    return permutationData[(int)p.X + ((int)(p.Y) * 256)].ToVector4();
}

At the particular area (in the exact same pixel with the exact same seed used to generate the map, where it returns the incorrect results, PIX reports that the GPU returns "{0.035, 0.067, 0.365, 0.408}" from the perm2d function whereas the CPU code returns "{X:0,7450981 Y:0,345098 Z:0,5137255 W:0,09803922}".

Other than that, the rest of the functions produce the right outputs.

sentences: Is there anything equivalent to Portal 2's linked_portal_door in any other engines? I need the functionality of the linked_portal_door that's in Portal 2. I've searched a little in UDK and mostly got people trying to duplicate the portal gun. Does anyone know if UDK, CryEngine, Unity3D, or any other engine has something similar? I'm not against using Source, I just want to know what my options are.

sentences:
(Abstract) Game engine design I am writing a simple 2D game (for mobile platforms) for the first time. From an abstract point of view, i have the main player controlled by the human, the enemies, elments that will interact with the main player, other living elements that will be controlled by a simple AI (both enemies and non-enemies). The human player will be totally controlled by the player, the other actors will be controlled by AI. So i have a class CActor and a class CActorLogic to start with.

I would define a CActor subclass CHero (the main player controlled with some input device). This class will probably implement some type of listener, in order to capture input events. The other players controlled by the AI will be probably a specific subclass of CActor (a subclass per-type, obviously). This seems to be reasonable. The CActor class should have a reference to a method of CActorLogic, that we will call something like CActorLogic::Advance() or similar.

Actors should have a visual representation. I would introduce a CActorRepresentation class, with a method like Render() that will draw the actor (that is, the right frame of the right animation). Where to change the animation? Well, the actor logic method Advance() should take care of checking collisions and other things.

I would like to discuss the design of a game engine (actors, entities, objects, messages, input handling, visualization of object states (that is, rendering, sound output and so on)) but not from a low level point of view, but from an high level point of view, like i have described above.

My question is: is there any book/on line resource that will help me organize things (using an object oriented approach)?

Thanks

sentences:
SceneKit - Creating a sense of scale I'm experimenting with 3D using SceneKit on iOS.  I'm trying to create a galaxy but would appreciate some guidance on the following things:

I'm having a hard time working out how to make the galaxy seem 'big'.  I've created multiple solar system nodes in a spiral, but the distances between them are hard to get right.  I want to get a sense of scale, but I'm not sure of the best approach.  Do I want to put huge distances between solar systems, and make the objects in the system very large too?  In this case I need to set the camera zFar to be massive.  I feel like I'm missing something.
I've created a cube map for the 'galaxy'.  As I zoom in on a solar system, the cube map seems to come in very close, which breaks the illusion of scale.  How do I make that better?

Thanks for any guidance!

sentences:
Unity Hub 2.3.0 Buggy Setup? I recently downloaded the new Unity Hub 2.3.0 setup and since I hadn't used (or downloaded Unity Core) using the previous version of the Hub, I simply deleted the folder containing Unity Hub instead of uninstalling it like any normal person would. Now, every time I open the Unity Hub Setup and try and install it, it always shows the same "Installation Aborted, could not install successfully," error. I can't even uninstall the previous version from Windows Settings! I've tried changing the destination folder, but still doesn't work.

Any help is appreciated!

P.S. This error occurs when installing UnityHub, not the Unity Core Platform! I've also looked at all other similar posts.

Thanks.

sentences:
Building meshes conforming to terrain deformation I have an uneven terrain on which the player is supposed to build buildings. For most structures I can just fudge the foundations, have them extend through the terrain.
For roads, pipes, tracks and such I do have however the problem how to make them line up. What techniques can I best use to make the meshes of adjacent pieces line up, making it conform to the terrain?

sentences:
How to restart the game when pressed enter in XNA If the following code allows the game to exit when pressed esc ..

if (gamePad.Buttons.Back == ButtonState.Pressed
    || keyboard.IsKeyDown(Keys.Escape))
{
    this.Exit();
}

Then this code should allow the game to restart when pressed enter...

if (gamePad.Buttons.Back == ButtonState.Pressed
    || keyboard.IsKeyDown(Keys.Enter))
{
    this.Reset(); //<< PROBLEM HERE!!
}

What do I put here? Because Reset is not the keyword for it...
I'm a beginner so if this is so wrong and stupid I am  sorry.

sentences:
Programatically placing musical notes on a stave I'm trying to program a musical stave and have come against the problem of where to place a note, given its index.

The index of a note is defined from a model created from the table in the following: Piano Note Frequencies

For example, in the model, C4 has an index of 40 and D#5 an index of 55.

Here is an image of what the stave currently looks like:

The text in red shows the indices the stave has available to put notes (disregard the horizontal position). Only a few indices are shown, however they extend much further. For example, placing a note on the stave at index 0, it appears at A4 on the stave.

I'm having difficulty translating from an index in the note model, to an index on the musical stave.

At first, I've done a (knowingly) naive implementation. Index 0 in the stave corresponds to A4, or index 49 in the note model. Given an index from the model, calculate how many half steps away the index is and use this as the index in the stave. For example, C5 is index 52 and gives a stave index of 3. Looking at the above image, it's clear this is wrong for two reasons.

Firstly, we didn't account for a note and its sharp laying on the same index. Secondly, we didn't account that B4 and C5 have one half step between them, but are in different places on the stave.

I've been scratching my head over this for a while. What are the rules to follow for translating from a note index to a position on the stave?

EDIT: Each note in the note model knows whether it is sharp or not, its pitch (e.g. C, D, E, etc), and octave.

sentences:
Circular draggable UI element in Unity canvas I am trying to implement my own runtime color picker that's easy to use for touch interfaces. I want the hue slider to be a ring, along these lines, except the whole ring texture would rotate when dragged.
I have scavenged enough code to get a raw image object rotating when dragged in a UI canvas in the manner I'm looking for:
    private float baseAngle;
    private Vector2 pos;

    public void OnBeginDrag(PointerEventData eventData)
    {
        pos = transform.position;
        pos = eventData.pressPosition - pos;
        baseAngle = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg;
        baseAngle -= Mathf.Atan2(transform.right.y, transform.right.x) * Mathf.Rad2Deg;
    }

    public void OnDrag(PointerEventData eventData)
    {
        pos = transform.position;
        pos = eventData.position - pos;
        float ang = Mathf.Atan2(pos.y, pos.x) * Mathf.Rad2Deg - baseAngle;
        transform.rotation = Quaternion.AngleAxis(ang, Vector3.forward);
    }

Since it doesn't use colliders, how can I limit the draggable region to a circle within the square bounds of the texture? Even better, also limit it to a ring rather than a whole circle. Will I have to implement my own check based on some pure math or is there a built in way?
thanks!

sentences:
2D physics collision/gravity problem? I'm using Love2D and my own physics engine to create a 2D platformer. Y collision works fine, but X collision... well, it's a bit buggy. When I move off of a small platform I've created, I fall but it is a lot slower than what my gravity is set to. Here's my code for collision:

function world.collisionCheck(o)
    for k, v in pairs(world.objects) do
        if v ~= o then
            if v.Type == "Rectangle" and o.Type == "Rectangle" then
                if o.Position.Y + (o.Size.Y / 2) > v.Position.Y - (v.Size.Y / 2) then o.Velocity.Y = 0; o.onGround = true; end
                if not (o.Position.X + (o.Size.X / 2) > v.Position.X and o.Position.X - (o.Size.X / 2) < v.Position.X + (v.Size.X)) then o.onGround = false; end --right left
            end
        end
    end
end

As you can see, it's pretty bad. The code for the actual physics (gravity, movement, etc.) is a bit better:

function world.update(t)
    for k, v in pairs(world.objects) do
        if v.Static ~= true then
            v.Position.X = v.Position.X + v.Velocity.X
            if v.onGround == false then if v.Velocity.Y < world.Gravity then v.Velocity.Y = v.Velocity.Y + world.Gravity * t end end
            v.Position.X = v.Position.X + v.Velocity.X * world.Meter
            v.Position.Y = v.Position.Y + v.Velocity.Y * world.Meter
            v.Velocity.X = v.Velocity.X * world.Friction
            world.collisionCheck(v)
        end
    end
end

However, it could still use some work. Whenever I step off of a 150 pixel by 15 pixel platform, I fall a lot slower than 9.8 meters per second. My meters are set to two pixels, and I'm falling at about a meter per second, which is much slower than the expected ~20 pixels per second I get while still on the platform. Everything I've tried doesn't seem to fix it; there's no problem in the movement code, and nothing I change in the collision code seems to fix it. Is there some silly problem I've overlooked?

EDIT: Okay, so I implemented a small fix which somewhat solves my problem. I modified the collision code so that it checks if it is below what is being tested for collision, and it seems to accelerate as normal when the top of the object is below the object being collided with, and vice versa. Am I correct in assuming I just need to add something to detect if the x-value is in the correct range, too?

sentences:
Changing coordinate system from Z-up to Y-up Blender's coordinate system is different from what I'm used to, in that Z points upwards instead of Y. What would be the simplest way of converting all the world data (so that all animations, texture coordinates, etc still work) so that Y points upwards?

Clarification:

Object positions are defined as matrices, so just switching translation/rotation/scale information in matrices is not a trivial task. (at least it does not seem like a trivial task to me)

sentences:
timeScale=0 doesnt stop all prefabs in unity As expected timeScale=0 can be used for stopping the game or pausing but when i make timeScale equal to 0 some prefabs still move and they can shoot bullets but addforce doesnt effect to bullets and they stop there. I know i can fix the problem on handling code of my prefabs but they are a lot. is there a good way to do the trick in my game?
thank you for helping

sentences:
Method for interpolation between 3+ quaternions? I'm currently using spherical linear interpolation (slerp) to interpolate between two quaterions with a weighted value. But, I'm having a difficult time coming up with a method to interpolate between 3, 4, 5, etc quaternions with normalized weights.

I.E. I want a final quaterion which is 60% of QuaterionA, 30% of QuaterionB and 10% of QuaterionC.

Thanks,
Cameron

sentences:
LibGDX - Actors on top of each other, avoid multiple draw calls I am writing a card game with multiple cards that will stack up on the unplayed deck, and also on player hands.

Currently I add all 100 card actors to the screen at the start to make it easier so i don't have to manage adding them when they are needed. They all start on top of each other and some get dealt out to players hands, which are also just piles of cards. So in theory with a 5 player game there are only 6 cards visible, the deck and the top off each player's hand.

I'm hoping someone can tell me off a clever method to mean that only 6 draw methods get run on the actors that are visible, or do i have to manage all this myself?

If i do, would you suggest adding the actors only when i need them, or adding them invisible and then setting them visible when i need to?

Or another method?

sentences:
Make colour change depending on time I'm making a Flash game (ActionScript 3) and for dynamics I'd like to make the background change colour depending on the clients' time of day.

I have a rough idea on how I want to do this,

At sunrise, I want the background to be yellow-orange
In the middle of the day, I want the background to be cyan/clear sky colour
At sunset, a reddish-orange
During the night, a navy blue.

I will be using this method to change the colour of the symbol, which is at default a dark grey colour. (unless someone points out a better way to do this). This means I have access to the red, blue and green components of the background.

On implementing the system itself;
I suppose I could simply get the client time and do

if (hour > 9) and (hour < 18)
{
    colour = SKY_BLUE
}

and similar for the other times of day, but I'd like it to tween slowly between colours as time progresses. For example, if 6AM is yellow-orange and 9AM is blue, 7:30AM would be yellow moving towards blue. I have a feeling I need to come up with an algorithm to link time to the RGB components of the colour, but I've always been terrible at maths and I can't think of how to do this, so that's why I'm asking.

Please tell me how I would do this, both concept outlining and sample code, or even just tips are welcome. :)

sentences:
Sound activated particlesystem I am trying to make a particle system that is activated by sound. Like emitting on the beat resizing on the beat and such things.  I found some nice tutorials on how to make things like Windowsmediaplayer visualsynths but they dont really help me to convert it to a particle system.

Anysuggestions how i could do this ?

sentences:
How do OpenGL's texelFetch and texture differ? I understand the main differences between texelFetch and texture, but have some questions about the details:

Does texelFetch involve a performance penalty? Such as not using a cache or such?
Are texelFetch and texture interchangeable when using GL_NEAREST?

sentences:
Agent stuck with each other As the title. I have stuck on this:
When many agents have same destination, they will be stuck with each other. I want they find a new path as character in the picture a attached below
How can i make agent more clever like this gif bellow. Any one have experiemnt or solution on this? Thanks!

sentences:
Max Row and Col for Animating Sprite in Andengine I want to animate a Sprite in Andengine , I have used the following

this.mSnapdragonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this,"arrow.png", 10, 10);

As show above in code its array is 10x10 that means I have 100 images to be animated, here is the image (I had individual image and joined it online so I created image below):

My issue is if I place this code and image it show black patch instead of animated image, i hv tried with 2x3, 4x2 animated sprite that is > working fine . Is my issue because of 10x10 ? what is the max row and col I can place to animate a Sprite in Above Code

Here is my output :

sentences:
How do I efficiently perform collision detection on an NxN rectangle grid? I have a simple level that is constructed from an NxN rectangle grid. Some of the rectangles are walls, and some of them are the path. The player is allowed to move only on the path they are on and also the path rectangles on the grid. So I have two kinds of rectangles in the grid:

"path"
"wall"

The player is a sprite above the grid. I want to efficiently find if the player is colliding with the wall. I want to loop through the rectangles, to see if they intersect. What is the best method?

sentences: How do I get the axes for SAT collision detection In SAT collision detection how do I calculate the axes for projection?

sentences: How to achieve a hard edge at this geometrical intersection? Im trying to make this edge appear smooth, soo that the faces on each side seem to meet up smoothly. But I want the green edges around this to be hard and sharp. I am using 3ds max, and this is the result.

sentences:
Monogame - All effects in one file? I am successfully drawing all of my geometry with an AlphaTestEffect and would like to apply shaders. I've built a shader Effect from a tutorial and can't seem to find anything on the web that answers my question:

Does monogame support passing separate effects with the same geometry to the Graphics Device, or do you have to perform all Techniques you intend to apply to a model in the same effect?

sentences:
Mapping a Vertex Buffer in DirectX11 I have a VertexBuffer that I am remapping on a per frame base for a bunch of quads that are constantly updated, sharing the same material\index buffer but have different width/heights. However, currently right now there is a really bad flicker on this geometry.

Although it is flickering, the flicker looks correct. I know it is the vertex buffer mapping because if I recreate the entire VB then it will render fine. However, as an optimization I figured I would just remap it. Does anyone know what the problem is?

The length (width, size) of the vertex buffer is always the same.

One might think it is double buffering, however, it would not be double buffering because it only happens when I map/unmap the buffer, so that leads me to believe that I am setting some parameters wrong on the creation or mapping.

I am using DirectX11, my initialization and remap code are:

Initialization code

  D3D11_BUFFER_DESC bd;
  ZeroMemory( &bd, sizeof(bd) );
  bd.Usage = D3D11_USAGE_DYNAMIC;
  bd.ByteWidth = vertCount * vertexTypeWidth;
  bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
  //bd.CPUAccessFlags = 0;
  bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

  D3D11_SUBRESOURCE_DATA InitData;
  ZeroMemory( &InitData, sizeof(InitData) );
  InitData.pSysMem = vertices;

  mVertexType = vertexType;

  HRESULT hResult = device->CreateBuffer( &bd, &InitData, &m_pVertexBuffer );

  // This will be S_OK
  if(hResult != S_OK)
     return false;

Remap code

  D3D11_MAPPED_SUBRESOURCE resource;
  HRESULT hResult = deviceContext->Map(m_pVertexBuffer, 0,
     D3D11_MAP_WRITE_DISCARD, 0, &resource);

  // This will be S_OK
  if(hResult != S_OK)
     return false;

  resource.pData = vertices;

  deviceContext->Unmap(m_pVertexBuffer, 0);

sentences:
How can I load raw Bayer images using OpenGL? I want to load a raw Bayer format image and convert it to RGB using OpenGL.

So far I have played around with glTexImage2D() and loaded a Bayer image as a monochrome texture. My question is: how can I do per-pixel operations on this texture so that I can convert it to an RGB image?

sentences: What are developers using for voice chat on Windows? On Xbox360 XHV2 is used for dealing with voice data, and XAudio2 is used for the low-level processing of that data. What is the XHV2 equivalent under Windows, assuming FMOD is used for the low-level audio processing? Previously DirectPlay.Voice was used to facilitate this.

sentences:
Compute spheres 2D speeds in perspective projected animations I created two animations that consist of spheres moving in a perspective projected 3D space, which means that the size and speed of the spheres vary with the distance: they increase when they are closer to the viewer (the camera) and decrease when they move farther away from the viewer. Both animations are played on a computer 2D screen.

In the Random Movement Animation, the spheres are moving randomly in different directions (GIF 1). In my code, I computed their spherical coordinates (sphere.position.xyz) with the two angles theta and Phi (see below the formulas used for the position and their derivates).

In the Optic Flow Animation, it is the camera that moves along the z-axis (camera_z -= .1) and the spheres don't move (GIF 2).

In the context of a neuroscientific experiment, I need to match the perception of speed between the two animations, thus I need to first compute the 2D speed in both animations (By 2D, I refer to the screen coordinates rather than the world coordinates). What are the respective speed formulas for each animation? Does the speed of each sphere in the optic flow calculation equal to the camera's speed?

How I generated Spheres coordinates in the Random animation:

for sphere in spheres:

        sphere.position.xy = np.random.uniform(-25, 25, size=2)
        z = np.random.uniform(near_z, far_z)

        sphere.position.z = z
        sphere.position.x *= z/-50
        sphere.position.y *= z/-50

        sphere.theta_deg = np.random.rand(1) * 360
        sphere.phi_deg = np.random.rand(1) * 360

        theta_rad = sphere.theta_deg * np.pi / 180
        phi_rad = sphere.phi_deg* np.pi / 180

        sphere.dx = speed * np.sin(-phi_rad - theta_rad) / frameRate
        sphere.dy = -speed * np.cos(phi_rad + theta_rad) / frameRate
        sphere.dz = -speed * np.cos(theta_rad) / frameRate

sentences:
Creating a unit selection box in Unity (2D) I've been trying to get my head around how to create a selection box for a selected unit in a 2D top-down type game. When you click on a unit, a small box would appear around that unit based on some sort of box-size.

I do not know/understand how to either calculate the size that box needs to be, draw the box (have an object under the game object that is sized appropriately with the selection box texture?) or how to make the selection box adjust it's size/shape like in this gif: http://i.imgur.com/xY7XW6C.gif

I don't expect anyone here to hand feed me what I need to use, but some idea of how to go about doing this in Unity (starting from the smallest, and most simple thing, like just making the box) would be very much appreciated.

Thanks!

sentences:
Animate Loading Screen During CPU-Heavy Scene Load I have a scene with lots of lightweight objects and one that takes anywhere between 10 and 45 seconds to load.
At a high level, the Awake method does...

Query database
For each result do some (fairly heavy) calculations
Populate a list
Use that list to generate game objects

[Only the last step of which requires the main thread]
I have another scene to display a loading screen. It has a UI panel with a shader that shows an animation.
The Loading screen starts a coroutine to switch level...
private IEnumerator LoadNewScene() {
    AsyncOperation async = SceneManager.LoadSceneAsync("GalaxyMap", LoadSceneMode.Single);
    while (!async.isDone) {
        yield return null;
    }
}

At which point, the animation freezes for 10-45 seconds while the heavy object loads.
In an attempt to make the animation CPU-independent, it's coded as a shader using the built-in _Time property.
I assume this is because my heavy object's Awake() is running on Unity's main thread and thus is blocking updates to the shader.
If so, I can move a lot of the heavy lifting onto a background thread, but I can't work out how to release the thread back to Unity temporarily.
The Awake() method isn't async, and any attempt to create a Task and wait for it will just block the same thread.
Conversely, I could have a completion callback for when the load is done. That would allow me to release the main thread sooner, however, Unity would think my scene had finished loading prematurely and remove the loading screen.
How can I either:

Release control of the thrad intermittently so Unity can refresh the UI
Explicitly tell Unity when it should consider a scene "loaded" and ready for display

?

sentences:
What is the preferred starting address for a C64 game? When writing a C64 game in 6502 Assembler and loading the game using LOAD "Game",8,1, I can choose the address where the game is loaded to. The most popular address I saw is $c000, closely followed by $0810, but I also saw $1000 and $2000 used a lot.

Why would I choose one over the other? I understand $0810 because it's close to $0801 which you have to write the SYS instruction to, but the other addresses all seem arbitrary.

Can someone shed some light into this?

sentences:
Where can I find/download a decent, free voice synthesizer? I've been looking all over the net, and I've found some voice synthesizers, but they either don't work, aren't free, or just have 5 or so voices to choose from... I need to get a synthesizer with which I'm able to edit the voice myself. This is needed for GLaDOS-like robotic character for my game.

I did some searching here on GDSE, and it seems that questions like this often get closed as "not constructive". I believe that this is not the case, as this could help many other people who happen to be searching for the same thing.

sentences:
Why do not Easy Mobile Pro scripts know about each other? I am getting this error when I try to build the project:

Assets\EasyMobile\Scripts\Modules\NativeAPIs\NativeUI\Nati
veUI_AlertPopup.cs(68,17): error CS0103: The name 'AndroidNativeAlert' does not exist in the current context

I tried adding this to my NativeUI_AlertPopup.cs:

    #if UNITY_ANDROID
        using EasyMobile.Internal.StoreReview.Android;
    #endif

Hint says unnecessary using.
Googling, searching Unity EMP forum and thread did not bring any results.
Unity version 2019.2 .net 4.x EMP 2.5
If I try adding a breakpoint it says:

The breakpoint will not currently be hit. Unable to find a corresponding location.

AndroidNativeAlert is a static class, have have no clue why it can't been seen from the other one.

sentences:
Unity3D Multiplayer Networking I am making a multiplayer game using Unity3D, similar to SecondLife (but focusing on a particular gameplay task). Users will be able to register/login directly in the game and their character will be spawned.
So far, I have made the back-end Rest-ful API to manage users. I am able to use login and register from the unity itself ( Using REST Calls e.g. www.myDomain.com/api/login ) but how do I spawn the characters accordingly?

Also, currently I am making a token based authentication system for the API ( much like Facebook, Twitter) as the API itself is state-less. Should I be storing the tokens in playerprefs?

I have gone through this tutorial but it doesn't seem to solve my problem.
Any kind of direction will help. Thank you.

sentences:
Shadows shimmer when camera moves I've implemented shadow maps in my simple block engine as an exercise. I'm using one directional light and using the view volume to create the shadow matrices. I'm experiencing some problems with the shadows shimmering when the camera moves and I'd like to know if it's an issue with my implementation or just an issue  with basic/naive shadow mapping itself.

Here's a video:

http://www.youtube.com/watch?v=vyprATt5BBg&feature=youtu.be

Here's the code I use to create the shadow matrices. The commented out code is my original attempt to perfectly fit the view frustum. You can also see my attempt to try clamping movement to texels in the shadow map which didn't seem to make any difference. Then I tried using a bounding sphere instead, also to no apparent effect.

    public void CreateViewProjectionTransformsToFit(Camera camera, out Matrix viewTransform, out Matrix projectionTransform, out Vector3 position)
    {
        BoundingSphere cameraViewFrustumBoundingSphere = BoundingSphere.CreateFromFrustum(camera.ViewFrustum);

        float lightNearPlaneDistance = 1.0f;

        Vector3 lookAt = cameraViewFrustumBoundingSphere.Center;

        float distanceFromLookAt = cameraViewFrustumBoundingSphere.Radius + lightNearPlaneDistance;
        Vector3 directionFromLookAt = -Direction * distanceFromLookAt;
        position = lookAt + directionFromLookAt;
        viewTransform = Matrix.CreateLookAt(position, lookAt, Vector3.Up);

        float lightFarPlaneDistance = distanceFromLookAt + cameraViewFrustumBoundingSphere.Radius;

        float diameter = cameraViewFrustumBoundingSphere.Radius * 2.0f;

        Matrix.CreateOrthographic(diameter, diameter, lightNearPlaneDistance, lightFarPlaneDistance, out projectionTransform);

        //Vector3 cameraViewFrustumCentroid = camera.ViewFrustum.GetCentroid();

        //position = cameraViewFrustumCentroid - (Direction * (camera.FarPlaneDistance - camera.NearPlaneDistance));
        //viewTransform = Matrix.CreateLookAt(position, cameraViewFrustumCentroid, Up);

        //Vector3[] cameraViewFrustumCornersWS = camera.ViewFrustum.GetCorners();
        //Vector3[] cameraViewFrustumCornersLS = new Vector3[8];
        //Vector3.Transform(cameraViewFrustumCornersWS, ref viewTransform, cameraViewFrustumCornersLS);

        //Vector3 min = cameraViewFrustumCornersLS[0];
        //Vector3 max = cameraViewFrustumCornersLS[0];
        //for (int i = 1; i < 8; i++)
        //{
        //    min = Vector3.Min(min, cameraViewFrustumCornersLS[i]);
        //    max = Vector3.Max(max, cameraViewFrustumCornersLS[i]);
        //}

        //// Clamp to nearest texel
        //float texelSize = 1.0f / Renderer.ShadowMapSize;
        //min.X -= min.X % texelSize;
        //min.Y -= min.Y % texelSize;
        //min.Z -= min.Z % texelSize;
        //max.X -= max.X % texelSize;
        //max.Y -= max.Y % texelSize;
        //max.Z -= max.Z % texelSize;

        //// We just use an orthographic projection matrix. The sun is so far away that it's rays are essentially parallel.
        //Matrix.CreateOrthographicOffCenter(min.X, max.X, min.Y, max.Y, -max.Z, -min.Z, out projectionTransform);
    }

And here's the relevant part of the shader:

if (CastShadows)
{
    float4 positionLightCS = mul(float4(position, 1.0f), LightViewProj);

    float2 texCoord = clipSpaceToScreen(positionLightCS) + 0.5f / ShadowMapSize;

    float shadowMapDepth = tex2D(ShadowMapSampler, texCoord).r;

    float distanceToLight = length(LightPosition - position);

    float bias = 0.2f;

    if (shadowMapDepth < (distanceToLight - bias))
    {
        return float4(0.0f, 0.0f, 0.0f, 0.0f);
    }
}

The shimmer is slightly better if I drastically reduce the view volume but I think that's mostly just because the texels become smaller and it's harder to notice them flickering back and forth.

I'd appreciate any insight, I'd very much like to understand what's going on before I try other techniques.

sentences:
Dealing with occlusion in an isometric sandbox game Imagine a 3D sandbox game like Minecraft with third-person isometric graphics. If the camera only moves in two dimensions, and doesn't rotate, then a large portion of the world will always be occluded e.g. caves, areas behind mountains and buildings, etc. Obviously this isn't acceptable.

I'm trying to figure out how such a game could deal with this issue while preserving certain properties: the world must be entirely buildable/destructible and must extend in some manner along all three axes. Other than that, nothing is off the table.

I can't think of any simple culling algorithm that wouldn't either leave too much occluded or needlessly cull things. Which features are visible where seems to be a very high level design issue. If you are underground, you don't want to see the ground above you at all. But some small objects you probably never want culled, even when standing behind them.

And it's not at all clear what you would want to do with medium-sized objects, like buildings... perhaps make them translucent when the player walks behind them. But how would such objects be classified? And how would you distinguish the outside of the building from the inside? You probably don't want the inside of buildings to become visible when you walk behind them.

If the player can place objects anywhere, what happens if they place an object behind an occluder? Is it now impossible to interact with this object without destroying the thing in front of it, even when the player is standing right next to it? What about important features on back-facing surfaces? Are they never rendered at all?

It seems to me that isometry is just not capable of practically representing arbitrary three dimensional architecture, which suggests that the game needs to be designed in such a way that arbitrary architecture can't be built. Rather, it needs to be constrained to some kind of 2.5D model, where occluded things simply cannot exist. But how could a world like that feel consistent and logical to the player while they dig and build in it?

sentences:
Why is my sprite displayed offset from its Box2D body? I found out about this using a debug renderer. When the game starts, everything is in order. But when a collision happens, the sprite's rotation is way larger than its body. The sprite and body match when the body is completely horizontal.

The sprite's rotation origin seems far distant from where it should be. Here's my code:

Sprite sprite = data.sprite;
position = body.getPosition();
sprite.setPosition(
    position.x - sprite.getWidth()  / 2,
    position.y - sprite.getHeight() / 2
);
sprite.setOrigin(position.x, position.y);
sprite.setRotation(MathUtils.radiansToDegrees * body.getAngle());

As you can see, I am even trying to set center of its rotation with setOrigin without success. How can I fix this?

sentences:
How can I orient a circle relative to the position of a 3D object? How can I orient a circle that has a position to a 3D object? If I have a 3D object which is a hemisphere, I would like to let the circle be underneath that hemi-sphere and whenever the hemisphere moves, the circle move with the same angle and position, and underneath it.

In other words, I would like to attach a 2D circle to a hemisphere and parallel to it.

sentences:
How to use Pixel Bender (pbj) in ActionScript3 on large Vectors to make fast calculations? Remember my old question: 2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing?

I figured I could use a Pixel Bender Shader to do the computation for any large group of elements in a game to save on processing time. At least it's a theory worth checking.

I also read this question: Pass large array to pixel shader

Which I'm guessing is about accomplishing the same thing in a different language.

I read this tutorial: http://unitzeroone.com/blog/2009/03/18/flash-10-massive-amounts-of-3d-particles-with-alchemy-source-included/

I am attempting to do some tests. Here is some of the code:

        private const SIZE : int = Math.pow(10, 5);
        private var testVectorNum : Vector.<Number>;

        private function testShader():void
        {
            shader.data.ab.value = [1.0, 8.0];
            shader.data.src.input = testVectorNum;

            shader.data.src.width = SIZE/400;
            shader.data.src.height = 100;
            shaderJob = new ShaderJob(shader, testVectorNum, SIZE / 4, 1);
            var time : int = getTimer(), i : int = 0;
            shaderJob.start(true);
            trace("TEST1 : ", getTimer() - time);
        }

The problem is that I keep getting a error saying:

[Fault] exception, information=Error: Error #1000: The system is out of memory.

Update:

I managed to partially workaround the problem by converting the vector into bitmapData:
(Using this technique I still get a speed boost of 3x using Pixel Bender)

    private function testShader():void
    {
        shader.data.ab.value = [1.0, 8.0];
        var time : int = getTimer(), i : int = 0;
        testBitmapData.setVector(testBitmapData.rect, testVectorInt);
        shader.data.src.input = testBitmapData;

        shaderJob = new ShaderJob(shader, testBitmapData);
        shaderJob.start(true);
        testVectorInt = testBitmapData.getVector(testBitmapData.rect);
        trace("TEST1 : ", getTimer() - time);
    }

sentences:
Help with the calculation of the usage of my speed stat I am working on a freeroam, action RPG (before you read further, I am not noobish to programming, plus have friends to help with actual content rather than the base code). Anyway, I am trying in Skills to the game. I decided the movement-based skills and animations should be a priority, so I began integrating it in. The animations work fine, but alas my movement skill Athleticism is making the character move unrealistically fast at a higher skill. The skill ranged from 1 to 100. After realising I should do some calculations to make you go from normal to Sonic the Hedgehog, I am using this formula currently:

(Athleticism / Mathf.Sqrt(Athleticism)) * 0.05f * runMod;

This has helped, but it still looks weird. I need some help to make a formula that makes that the skill doesn't have such of a linear effect on the movement.

EDIT:

Trying to be specific. The player moves, currently about 0.05 walking units per second at Athleticism 10, which is nice. However, the movement rate at Athleticism 100 cranks up to 0.15 units, which is a little too fast. I am aiming for 0.1 instead.

sentences:
How can I give the player the impression of speed? Possible Duplicate:
  Effects to make a speeding spaceship look faster

I am currently developing a racing game akin to F-Zero in that the race is held at very fast speeds. The player is therefore placed in a 3rd person view.

Graphically, I'm thinking of using motion blur and lowering the camera angle when the ship is going faster to give the player the impression of speed. This from the fact that the closer you are to the ground, the more you percieve speed.

This question has intersting answers, but don't really apply because the effect needs to be progressive and constant, not like a boost effect.

I was wondering if these techniques are viable, and if any other techniques exist?

sentences:
Are all conditions in an if statement checked? If I have an if statement like this:

bool conditionOne = true;
bool conditionTwo = false;
bool conditionThree = false;

if(conditionOne || conditionTwo || conditionThree)
{
    //do something
}

Will conditionTwo and conditionThree actually be checked even though conditionOne is already true, and thus has met the requirements of the if statement to run the code inside it? It would be pointless to check if conditionTwo and conditionThree are true because either way the code inside the if statement would be run.

I'm thinking this would be useful to know if I have some really long and quite expensive checks to do.

sentences:
Why does a translation matrix need extra row? Following recommendation of this answer I've recently read the series of articles of Wolfire about linear algebra. I'm somewhat familiar with matrices and I came to a conclusion that vector and a matrix multiplication is in fact multiplication of 2x2 and 2x1 matrices:

\begin{equation*}
\begin{bmatrix}
a & c \\
b & d
\end{bmatrix}
\qquad
\begin{bmatrix}
x \\
y
\end{bmatrix}
\end{equation*}

In the article the author reveals that to accomplish translation in addition to rotation we need to add a row and a column to the translation matrix:

  If we want to translate by a vector (e,f), we can just tack it onto our change-of-basis matrix like this:
  \begin{bmatrix}
a & c & e\\
b & d & f\\
0 & 0 & 1
\end{bmatrix}
  And then we add an extra 1 to the end of each position vector like this:
  \begin{bmatrix}
x\\
y\\
1
\end{bmatrix}

P.S. I edited the direction of the vector to make it comply with matrix multiplication conditions.

The 1 at the third row of the vector is totally understandable: to multiply 2x3 matrix we need a 3-row matrix.

What I didn't get here is why we need extra row for translation matrix? I can't see any difference in multiplication (except for the useless 1):

\begin{equation*}
\begin{bmatrix}
a & c & e\\
b & d & f\\
0 & 0 & 1
\end{bmatrix} *
\begin{bmatrix}
x\\
y\\
1
\end{bmatrix} = \begin{bmatrix}
ax + cy + e\\
bx + dy + f\\
0 + 0 + 1
\end{bmatrix}
\end{equation*}

\begin{equation*}
\begin{bmatrix}
a & c & e\\
b & d & f\\
\end{bmatrix} *
\begin{bmatrix}
x\\
y\\
1
\end{bmatrix} = \begin{bmatrix}
ax + cy + e\\
bx + dy + f\\
\end{bmatrix}
\end{equation*}

So the same question for 3D matrices, just it's easier to convey with a 2D case

sentences: How to unpack tileset or image atlas In order to define boundary of each tile, I need to have individual image of the tile. Is there any way to extract each image of tiles from a tileset?

sentences:
How can I create a tunnel/parallax/depth effect based on mobile device tilting? I would like to create applications similar to what's displayed in these videos:

VR Tunnel Live Wallpaper for Android
The parallax view Part 1

These mobile application are supposed to react to tilting of the phone, so I created a few 3D objects for this purpose in Blender (one similar shape - 2nd link), but I do not know how to move the back of this object in Unity because I am a beginner.

Can you give me some tips on how to figure this out? I’m not talking about a ready solution or something, I just do not know how to ask a specific question and I do not know what to do next.

sentences:
Multiplication and Division Bug Hi guys first time poster with a quick question. I'm just getting started with coding and as an easy exercise I wanted to make a block move and sprint. I got it to do that but when I press the shift key too fast the getKeyUp part divides the speed variable too many times. How do I fix this?

public class Movement : MonoBehaviour
{
    public float speed = 5f;
    public float speedmutiplier = 2f;

    private void FixedUpdate()
    {
        if (Input.GetKey("w"))
        {
            transform.Translate(0, 0, speed * Time.deltaTime);
        }

        if (Input.GetKey("s"))
        {
            transform.Translate(0, 0, -speed * Time.deltaTime);
        }

        if (Input.GetKey("a"))
        {
            transform.Translate(-speed * Time.deltaTime, 0, 0);
        }

        if (Input.GetKey("d"))
        {
            transform.Translate(speed * Time.deltaTime, 0, 0);
        }

        if (Input.GetKeyDown("left shift"))
        {
            speed = speed * speedmutiplier;
        }

        if (Input.GetKeyUp("left shift"))
        {
            speed = speed / speedmutiplier;
        }
    }
}

sentences:
Smoothly fitting texture tiles using alpha gradient on edges I'm trying to draw a background texture with tiles that I'll rotate and mirror to create a maze. Here is a sample tile:

As you can see, I use an alpha gradient on the borders. If I'd use a sharp border instead, you'd notice the border between a tile and another because these shadows and glows are not perfectly symmetrical.

So far it works OK, but I've noticed there is a slightly darker spot where two tiles connect:

I used Photoshop to create these gradients, and was very careful to make sure these gradients are linear and start exactly where the next gradient ends, so that the total alpha of every pixel add up to exactly one.

I'm using a SpriteBatch to draw these textures and use the default blending mode (I don't set any blend function at all). Apparently I'd need some blending function whose output will be the sum of both image's alphas and the average of their colors. Is this the default mode (if so, I guess my picture's alpha gradients are not perfectly linear)? And if not, what should I set my SpriteBatch's blend function to?

Edit: So I tried batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_DST_ALPHA) and it fixed the dark spot, but now the textures I draw on top look messed up, even if I revert it back to the old blending mode right after drawing my tiles.

sentences:
Designing a "Grid" like object that contains game objects I am working on a 2D game, where there's a game "board" on which other game objects are placed.

This this is 2D, my starting point was to design a class that will internally use a 2d array for the actual stored game objects.

This class could be simply accessed by 2 indices: (i, j) to get game objects on it.

My problem is that i have no idea how to make the game "board" "propagate" its data onto its children.

Design questions i ran into are:

Should the children placed on the board have display properties such as size, screen position?
Should the board itself dictate this information?
How to update children in case the board changes some of its properties? (position, etc).
Should the board be aware of the types of objects stored in it ?

I have no idea how similar things such as WPF or other UI frameworks go about organizing a "container like" object that can arrange or apply certain UI properties to its children.

sentences:
Need to count a number of programmatically created objects in separate script I have a game that creates and places a random number of "pickups" on a plane at random places.

I then have a script on the "Player" game object that uses OnTriggerEnter to tell when an item has been "picked up" and compares a count (the score) to the number of objects that are created:

void OnTriggerEnter(Collider other)
{

    // Get all game objects with the Tag "Pickup"

    if (other.gameObject.CompareTag ("Pickup")) {

        // Deactivate objects that are touched/collected
        other.gameObject.SetActive (false);

        // add to count
        count++;

        scoreText.text = "Score: " + count;

        //TODO: fix this statement; pickupCount is always 0 here, why?

        if(count >= pickupCount){
            winText.text = "You Win!";
        }

    }

}

The problem I am facing is that during building this worked fine, I built the project and it outputted "You Win!" after picking up 1 "pickup", I found out this is because for some reason the value of pickupCount is now always 0.

pickupCount =  GameObject.FindGameObjectsWithTag("Pickup").Length;

My guess is that because the Playerscript checks at Start() and the SpawnScript creates at Start() that the reason the number is always 0 is because at the time of checking there are in fact no "pickups" created. My question is then, how do I check for the total number of these pickups without doing it in an update function?

SIDE NOTE

I know I could just change the OnTriggerEnter() function to be something like this:

void OnTriggerEnter(Collider other)
{

    // Get all game objects with the Tag "Pickup"

    if (other.gameObject.CompareTag ("Pickup")) {

        // Deactivate objects that are touched/collected
        other.gameObject.SetActive (false);

        // check number of pickups left
        pickupCount =  GameObject.FindGameObjectsWithTag("Pickup").Length;

        // add to count to show the score
        count++;

        scoreText.text = "Score: " + count;

        if(pickupCount <= 0){
            winText.text = "You Win!";
        }

    }
}

But it is more a case of curiosity now more than anything. Is what I am asking even possible?

sentences:
Android Loop : Draw Loop : How to pull off smooth FPS? I am writing 2D side scrolling bullet hell-like game.
I am at a point where I struggle to pull off smooth fps.
I have separated loop that manages drawing.

However I want update the position of sprites from game logic(for bullets).
Since there are many bullets, waiting for new set of position significantly decreases the speed in which the drawing loop executes itself.

I thought about another approach like this:

I could upload and stack positions of bullets somewhere. So my drawing method can pull off only the previously completely uploaded data, but doing so it can free itself from worrying about waiting for updating since stacked data is already in there. however <- that approach seems counter intuitive.

sentences:
ScreenToWorldPoint and ViewportToWorldPoint I'm currently following tutorials on Youtube to learn howto use Unity. My code runs perfectly as per the tutorial, but i just have some questions regarding the code, with regards to screenToWorldPoint & viewportToWorldPoint.

The purpose of the code is for a 2D platformer, where the character's arms will rotate and face where the mouse cursor is.

Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ArmRotation : MonoBehaviour {

    public int rotationOffset = 0;

    // Update is called once per frame
    void Update () {
        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; //Gets the difference between
        difference.Normalize(); //Normalizing the vector

        float rotateZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
        transform.rotation = Quaternion.Euler(0f, 0f, rotateZ + rotationOffset);
    }
}

I've done some googling and am aware of the difference between screenToWorldPoint and viewportToWorldPoint as per the answer here  https://answers.unity.com/questions/168156/screen-vs-viewport-what-is-the-difference.html

Where

Screen: from [0,0] to [Screen.width, Screen.height]
Viewport: from [0,0] to [1,1]

Questions:

Why do we have to calculate the difference between the position of the mouse cursor and the position of the character's arm instead of just setting the following:
. Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition);

I've tried setting it to the position of the mouse cursor instead of using the difference between the arm & the cursor and while the code still works and the arm is still able to rotate, it is a little "off" from the direction of the cursor. E.g A little higher than where the cursor is. Why does using the difference solve this issue?

Why do we call difference.Normalize() ? To my understanding, Normalize returns a vector between 0 & 1.However, Mathf.Atan2 returns the angle in radians whose Tan is calculated by y/x. As such, calling Normalize and returning a vector to a value between 0 & 1 makes no difference because the value calculated will be the same between a un-normalised and normalised vector since the proportions are the same?

When i use ViewportToWorldPoint instead of ScreenToWorldPoint, i do not use Normalize because to my understanding, the Vector returned by ViewportToWorldPoint should already be within 0 & 1, hance we do not have to normalise it. However, when i test the code out in play mode,the arm barely rotates. Why is this so?

I would appreciate any help or pointers in the right directions.

Thanks!

EDIT: I had a look at the manual and realise that Normalize() returns a vector with the same direction, but magnitude 1, but i'm still just as confused

sentences:
Is multipass rendering possible with SpriteBatch? I'm trying to implement a bloom effect. This requires three shader passes: a brightness threshold, a horizontal blur, and a vertical blur. It also requires resizes, but these are irrelevant to the question. I've also omitted the threshold, as the problem lies in the blurs.

Now, I've read that HLSL passes are just syntactic sugar for different shaders, and that switching between them is about as expensive as setting a new effect to the GraphicsDevice. Still, I prefer to keep them in one .fx file.

The passes:

    pass Pass0
    {
        PixelShader = compile ps_2_0 PS_Threshold();
    }
    pass Pass1
    {
        PixelShader = compile ps_2_0 PS_BlurHorizontal();
    }
    pass Pass2
    {
        PixelShader = compile ps_2_0 PS_BlurVertical();
    }

The blurring code:

        private void Blur(SpriteBatch SpriteBatch, RenderTarget2D Source, RenderTarget2D Rendertarget1, RenderTarget2D Destination)
        {
            // Blur pass 1
            Contents.BloomEffect.CurrentTechnique.Passes["Pass1"].Apply();
            SpriteBatch.GraphicsDevice.SetRenderTarget(Rendertarget1);
            SpriteBatch.GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, Contents.BloomEffect);
            SpriteBatch.Draw(Source, Rendertarget1.Bounds, Color.White);
            SpriteBatch.End();

            // Blur pass 2
            Contents.BloomEffect.CurrentTechnique.Passes["Pass2"].Apply();
            SpriteBatch.GraphicsDevice.SetRenderTarget(Destination);
            SpriteBatch.GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, Contents.BloomEffect);
            SpriteBatch.Draw(Rendertarget1, Destination.Bounds, Color.White);
            SpriteBatch.End();
        }

Finally, the Draw loop:

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.SetRenderTarget(RT1);
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, bloom);
            spriteBatch.Draw(android,
                             new Rectangle(0, 0, 258, 294),
                             Color.White);
            spriteBatch.End();

            Blur(spriteBatch, RT1, RT11, RT1);

            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null);
            spriteBatch.Draw(RT1,
                RT1.Bounds,
                Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }

The output, however, is as follows:

It's obvious what happens: the last pass is applied twice. I've tested the passes individually by snipping them out of the shader, and they work fine. Is EffectPass.Apply() simply not meant to be used with SpriteBatch, or is there another way to change what passes are applied (without putting the passes in different .fx files)?

This has all been in XNA. To make this even weirder, when I do the same thing in Monogame the opposite occurs: the shader will only use Pass0. However, I'm converting the shader to OpenGL there, so that might be a conversion quirk.

EDIT: I fixed this by putting the different passes in different techniques, and switching techniques instead of passes. That doesn't answer the original question though, so I'll leave it open.

sentences:
Reduce the number of edges of a graph, keeping it connected I'm designing a game with random generated dungeons. I'd like to view this as a connected, undirected graph in which nodes are rooms and edges are doors or corridors. Then I choose a "side" node as the dungeon entrance, I calculate the distance between this entrance and all other nodes, and decide that one of the farthest nodes is the "goal" of the dungeon (the location of the treasure, boss, princess, etc.).

I saw 2 ways to generate the final dungeon topography:

Generate first a random graph, then try to fill the 2d world with rooms at random locations, respecting the edge connections. I figured this would be sometimes difficult because the room generation could be "locked" trying to fit rooms in impossible places.
Generate first rooms, placing them randomly where they fit, then map the result to nodes and edges. I decided to try this.

My idea consists in :

First generate a big room that would contain the whole dungeon.
Put a wall inside the big room, at a random location, dividing the big room into 2 smaller rooms of different area.
Then I continue to divide each room into 2, until they are too small, or the total number of room reach a maximum (or any other condition). Each new room is a node.
Once finished, I check each room and find all adjacent other rooms, marking the 2 nodes as connected by an edge.

That way I ensure that all rooms have a possible location in the 2D world, and are correctly mapped by a connected graph.

My problem is that there are too many doors and corridors connecting the rooms.

So I'd like an algorithm that reduces the number of edges of a connected undirected graph, but keeping it connected (all nodes stay reachable) in the end.

sentences:
XNA GameComponent.Initialize() not called I have a game which creates an object in its Initialize() method:

    private GameComponent1 _thingy;
    protected override void Initialize() //Game1.Initialize()
    {
        base.Initialize();
        _thing = new GameComponent1(this);
    }

In the GameComponent1 class:

    public GameComponent1(Game1 game) : base(game)
    {
        _game = game;
        game.Components.Add(this);
    }

    public override void Initialize() //GameComponent1.Initialize()
    {
        //Do stuff here
        base.Initialize();
    }

However, in this case, _thing's Initialize method is not called. Why is this?

It behaves fine when the object is created in, say, Game1's Update method...

sentences:
Scale texture at runtime in unity I need to scale the texture in unity3d.In unity we are able to adjust the scale using the option in the toolbar

How will I scale the texture at runtime using the mouse pointer.

the texture should scale when i click and drag on the any four corners of the image as shown in the below image

Can anybody please help me in solving this.

sentences:
floating health bar above gameObject for 2D mobile game I know it's been asked a lot but I can't find the best solution for mine  this whole day. I'm new in programming, so I have a health bar which is a child of my character which is position above it.  My script is working but not the way I want it to. the local position is not decreasing as the health does and the scales size is bigger. Now I have tried several tweeks but I just could not figure it out.

Here is my code attached on the healthbar object :

 Vector3 mylocalScale;

void Start() {

    mylocalScale = transform.localScale;
}

void Update() {
    mylocalScale.x = PlayerHealthSystem.PHS.P_Health;
    transform.localScale = mylocalScale;
}

this is the current health bar behaviour on how it it decreases which is not I want.

my desired result it should decrease from left to right, can anyone help me to do this and understand how to do it? thanks.

sentences:
Can I my iOS-based editor save .plist files that my Mac game can read? I want to make an editor on iOS which will record touch positions into a file. That file (in the .plist format) will eventually be used for positions in my Mac connect-the-dots game.

Can I save one .plist file to my Mac from an iOS app?

sentences:
XNA Sprite Flash Effect I'm looking for a way to render every non-transparent pixel in a sprite solid white (to 'flash' the sprite white when the player takes damage etc). This is on Windows Phone 7.

I was using a very simple custom shader to do this under XNA 3.1, but WP7 doesn't support these and finding an alternative's proving difficult.

I'd appreciate any help or suggestions. I'd rather not have to manually create a solid white copy of every sprite in my game though.

sentences:
How do I make a gun alignment to camera matrix in OpenGL GLSL? I am trying to program a FPS game with OpenGL.

I am using 3D eight the OpenGL 3.3 programmable pipeline.

I have a gun and a camera that I loaded.

When I load all of the assets for the game, I put everything int a 4x4 matrix, as it is compatible with the view matrix.

I set the corresponding matrix for the model equal to all the needed variables, then I use another variable that I defined in a header file to draw the actual model...

I did some searching because I do not have the code with me, and the closest I could find is learnopengl’s model loading tutorial as that is the most similar.

What I have tried;
I have tried multiplying the matrix for the gun’s world info, which I will call the model view matrix (such as position and scale) times the view matrix. I have also tried doing the same but multiplying the model view times the inverse of the normal view matrix.

I already set the guns position equal to the camera’a position, but when I run the application and try to move around, the gun still moves away from the camera.

I knew a way of how to fix this in OpenGL 1.1 by using glLoadIdentity, which is now deprecated with the core version of OpenGL 3.*.

When i try to set the two matrices equal, I get different results because the gun doesn’t move at all.

When I move the camera with the inverse of view times gun, it moves away from the camera...

I learned about the inverse matrix thing from here:
https://forums.khronos.org/showthread.php/81932

My matrixes are also set up the same. The gun model view * inverse(view matrix) has worked the best... this link is where I found it.

sentences:
Pathfiding for groups of agents How can we refine this path search method to make group movement more elegant? I'm trying to make a RTS-style game, using a 2d tiled gameworld. I have implemented an A* pathfinding algorithm which works well enough for single units. I've also make some functionality to make agents walk around other agents they stumble across on their way.

Here is some of my code:

def move(self, agent, clickbox, nogolist):
    impassable = []
    impassable.extend(nogolist)
    mapinfo1 = MapInfo(self.map_layout.finalsize,self.map_layout.finalsize,impassable)
    graph, self.nodes = self.make_graph(mapinfo1)
    paths = AStarGrid(graph)
    for c in self.map_layout.all_map_objects:
        if clickbox.box.collidepoint(c.checkpoint):
            path = []
            if len(agent.travel_list) > 1:
                v = agent.travel_list[1]
                start = self.nodes[v[0]][v[1]]
            elif len(agent.travel_list) == 1:
                start = self.nodes[agent.grid_pos[0]][agent.grid_pos[1]]
            end = self.nodes[c.gridnumber[0]][c.gridnumber[1]]
            path = paths.search(start, end)
            try:
                agent.target = self.convert_path(path)
                agent.travel_list = self.waypoints((agent.grid_pos[0],agent.grid_pos[1]), path)
            except:
                print 'road error'

When one or more agents are selected and the player right-clicks somewhere, self.move gets called on each agent individually, they are at this point still ignorant of other agents positions. The next part is where I try to have agents not walk over each other, or just stop if 'travel_list' only contains one more step, and another agent occupies it.

if not len(self.traveling_agents) == 0:
    for a, b in combinations(self.agent_list, 2):
                self.resolve(a, b, self.nogolist)
                self.resolve(b, a, self.nogolist)

def resolve(self, a, b, nogolist):
    try:
        if len(a.travel_list) > 1 and b.travel_list[0] == a.travel_list[-1]:
            a.travel_list = a.travel_list[:-1]
            a.target = a.target[:-1]
            if a.travel_list[1] == b.travel_list[0]:
                self.traveling_agents.remove(a)
        elif len(a.travel_list) > 1 and b.travel_list[0] == a.travel_list[1]:
            path = []
            go = a.travel_list[0]
            goal = a.travel_list[-1]
            impassable = []
            impassable.append(b.travel_list[0])
            impassable.extend(nogolist)
            mapinfo1 = MapInfo(self.map_layout.finalsize,self.map_layout.finalsize,impassable)
            graph, self.nodes = self.make_graph(mapinfo1)
            paths = AStarGrid(graph)
            start = self.nodes[go[0]][go[1]]
            end = self.nodes[goal[0]][goal[1]]
            path = paths.search(start, end)
            a.target = self.convert_path(path)
            a.travel_list = self.waypoints((go[0],go[1]), path)
            del impassable
    except: a.stop()

This works reasonably well for solo agents encountering other stationary solo agents. But when moving in a group towards a common target, this method falls way short of what would be desired. What can we do to achieve smoother group movement like what is seen in some of those old school RTS games?

For some additional insight on my code, check my previous entry on implementing the A-star search algorithm: https://stackoverflow.com/questions/14390458/how-to-structure-an-adjacency-list-for-this-a-program/

sentences:
Find required entities to accomplish specific task in shortest time I have a grid like map with entities that can perform turn-based actions like moving or growing strength. When I have a task that requires a certain strength, I want to find the entities required to solve that task as fast as possible and move them to the target.

The distance to the target is important, since moving a tile takes 1 turn. When entities move on a tile with an existing entity, their strength is combined together. A task can be solved only if the combined strength of the last entity is greater than the requirement. This logically means that entities near the target can grow while additional entities need to move to the target immediately.

It feels like I could use a modified pathfinding, but I can't formulate the procedure to get something meaningful. This inablity also worries me a bit that the problem might be np-hard.

Can you help me?

sentences:
What is the camera direction vector for an isometric view? What values correspond to a 3D vector for screen-normal from within an isometric game?

It needs to be in game coordinates. It is a standard isometric where tiles are rotated 45 degrees and half height (in 2D projection).

For example [+x,0] in game corresponds to north-east on screen. But what is the vector leading out of the screen. This vector is always the same (a fixed orthographic projection).

sentences:
Raycast wrong direction I use Physics.Raycast and transform.forward to shoot a ray in front of my gameobject, but the ray gets cast downwards instead.

if (Physics.Raycast(transform.position, transform.forward, out var hit, range))
{
   Debug.Log(hit.transform.name);
}

Debug.DrawRay(transform.position, transform.forward * 50, Color.green);

What's wrong with my code?

sentences: Efficient way to go about acquiring game assets I was thinking about buying assets, but I don't want to waste time and want to acquire assets as fast as possible, and acquire a large amount of them, because I want to make several different games from the assets (rpg, action, shooter, etc.) Also, I want to commercialize the game, so what would you recommend me doing?

sentences:
Is it possible to tell Unity3d to ignore part of its hierarchy? One aspect of the game I'm making is each level is made up of room objects, which contain the sprites, physics objects and so on. When you enter a level the whole level is deserialsed and loaded into memory but only the room you are currently in is considered, nothing else is drawn, updated or whatever.

I was wondering how I would achieve this in Unity3d. I can imagine having a hierachry with lots of rooms with the various room contents as children, can I tell unity to ignore everything (for updating, drawing, physics and so on) in the hierarchy but the current room and its children?

sentences:
Footstepper with Vr Unity I have the Footstepper: Complete Footstep Solution from the unity store, and i dont get it working with the Vr,
I made the footstep material like official documentation said, Then
i put the Footstepper Setup in the ovrPlayer object.
The problem is that sometimes sound the default fallback, so i think that the colission is not detected as it suppose.
Some idea ?

sentences:
Efficient player state architecture in Google App Engine I am investigating Google App Engine for use in a browser based MMO. The player will make a server request when ever they build, buy or do any other action that the server needs to process. Therefore I am estimating a server request no faster than once per 10 seconds.

I want to store all my player data in one data structure (entity), because I have heard this is the most efficient way -- if not please correct me. So I figure that when a player causes a server request, I need to load/access the player's state data, carry out the action the player wanted to do and then store the result.

However, from an efficiency point-of-view, what is the best way to access the player data? I thought about using the datastore and maybe memcaching the result in memory for fast lookup. But don't I still need to write the data back out to the data store if it's cached? Should I write it out every time data changes? I looked at write behind caching but this seems to eat through your task queue quota.

Any ideas on the best approach? Best being defined as the most efficient method using the Google App Engine.

sentences:
How can I gain access to a player instance in a Minecraft mod? I'm creating Minecraft mod with a pickaxe that takes away experience when you break a block. The method for taking away experience from a player is addExperience on EntityPlayer, so I need to get an instance of EntityPlayer for the player using my pickaxe when the pickaxe breaks a block, so that I can remove the appropriate amount of experience.

My pickaxe class currently looks like this:

public class ExperiencePickaxe extends ItemPickaxe {

public ExperiencePickaxe(int ItemID, EnumToolMaterial material){
    super(ItemID, material);
}

public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
{
    if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
    {
        EntityPlayer e = new EntityPlayer(); // create an instance
        e.addExperience(-1);
    }

    return true;
}
}

Obviously, I cannot actually create a new EntityPlayer since it is an abstract class. How can I get access to the player using my pickaxe?

sentences: Where the fxc.exe is located in Windows SDK? I'm using Windows SDK under Windows 8 with Visual Studio 2013. Where I can find fxc? I do not use old Directx SDK.

sentences:
How can I convert screen coordinates to world coordinates on the floor (when the y component = 0)? I am using the Irrlicht Engine and would like to convert the coordinates of the mouse on the screen to the floor of my world. I am currently trying to use

getRayFromScreenCoordinates()

which returns a "Ray starting from the position of the camera and ending at a length of the far value of the camera at a position which would be behind the 2d screen coodinates." Then I do this to get the position:

    core::line3df line = getRayFromScreenCoordinates(receiver.mousePos, device);
    irr::core::vector3df lineVector = line.getVector().normalize();
    irr::core::vector3df pos = line.start + lineVector*x;

x would be the magnitude from camera to the coordinate. However I do not know how to calculate x (as I don't know the coordinate yet).

The page I got the code from, written in 2003

sentences:
What Type of Options should be on the Game Settings Menu? I have seen a post about the main menu options here:
UI: Main Menu options for mobile games. What options should be listed? What do users want to see?

But I want to know what kind of options should/need to be available on the settings screen.

I am making a rather simple 2D game for Android, but really I haven't found many aspects that warrant an options button or a check box besides turning the sound and music on/off.  I was thinking graphics settings but then again, how many apps really need graphics settings besides immersive 3D ones?

sentences:
Perfect FPS camera angle I am making a multiplayer FPS and I am in search of some helpful tips on the perfect FPS camera angle. Because it is a multiplayer, I am making a full body model holding the gun, I find, however, that some of the gun positions (when held naturally) seem awkward when placing the camera on the position of the characters eyes. Moving the camera has other consequences, for example, when moving the camera to a more appropriate fps position, when looking at your feet, it seems that your head is too far right, as your point of view is past your left foot..

Any expert advice?

sentences:
How to avoid minecraft-like map to blend I am making a minecraft-like world, with some differences. For instance, the camera will be facing always in the same direction.

I am having trouble with the visuals. Here is an example:

As you can see, when looking at a "step", as long as you can see the wall between the 2 levels, kinda like looking from it upwards, it is easy to identify. But when the wall disappear, kinda like when you are looking at it downwards, the step seems to blend, to a point where it is hard to tell where the step begins.

I thought of adding outlines, but due to the heavy palette of tiles that I am going to have, it would require to re-think a lot the logic to choose the correct tile, and I was hoping to find an easier solution.

What could I do to solve this problem?

sentences:
Pitch (X-axis) rotation problem Situation:
From a first person perspective (camera position) I want to be able to grab an object and have it fixed to the center center of the screen while looking up-down (pitch) and looking left-right (yaw). The yaw works fine. The pitch only works facing the object head on when camera position z > object z. Turning 180 degrees the pitch rotation is opposite. How do I compensate for this. This is what have:

double yawRadians = Math.toRadians(yaw - oldYaw);
double pitchRadians = Math.toRadians(pitch - oldPitch);

//center position of object, minus camera position
double x = grabbedObject.x0 - position.x;
double y = grabbedObject.y0 - position.y;
double z = grabbedObject.z0 - position.z;

double sinX = Math.sin(pitchRadians);
double cosX = Math.cos(pitchRadians);

double sinY = Math.sin(yawRadians);
double cosY = Math.cos(yawRadians);

double sinXY = sinX * y;
double cosXZ = cosX * z;

double newX = cosY * x + sinY * sinXY - sinY * cosXZ;
double newY = cosX * y + sinX * z;
double newZ = sinY * x + cosY * -sinXY + cosY * cosXZ;

grabbedObject.addTranslation(newX - x, newY - y, newZ - z);

sentences:
How can I abort the closing of a dialog in libgdx? Dialog dialog = new Dialog("Warning", skin, "dialog") {
    public void result(Object obj) {
        System.out.println("result "+obj);
        if(obj == true) {
            >> abort the dialog closing ? <<
        }
    }
};
dialog.text("Info?");
dialog.button("Yes", true);
dialog.button("No", false);
dialog.key(Keys.Enter, true);
dialog.show();

how to abort the closing of the dialog?

sentences:
Loading and storing content efficiently So for example I have a class called TypingKeyboard. It allows you to display a string while it's being typed by the computer with sounds. I need one in the menu, for the title. And one for the credits, and some in-game.
So loading every sound and storing it to the RAM for every instance of TypingKeyboard is not very efficient.

So, I want to make a class that already holds these sounds, then call it when I need it, so I don't have to load everything.

How do I design this? I mean, how do you get these sounds loading and then make them accessible without initializing a class for it?

sentences:
RPC events with client side interpolation I've implemented client side interpolation, where a specified delay is put on each client. This allows them to interpolate between positions and rotations. Unfortunately, this means every thing else must be delayed, otherwise events ( like a particle effect on a collision ) will happen ahead of time( according to the interpolated data. )

Should I delay everything along with the interpolated data, or do I have the wrong idea about client side interpolation? I haven't seen a single mention of this problem anywhere, which makes me think I'm missing something.

sentences:
How to iterate through a list of enemies and display results? I'm making an turnbased RPG and I wanted to add a traditional multiple enemy system where a user could attack different enemies when it's there turn. I started by making a list of everybody who is going to attack and having that as the turn order. My question is how do I go through that list, and for every enemy that attacks display the damage they did and wait for the user input to continue to the next enemy.

Getting it to process all the attacks is easy, but a computer will do it in milliseconds and I need it to wait for the user input to continue.

I have started the following code:

for (int i = 0; i < turnOrder.Count; i++)
{
     if (turnOrder[i].isMonster)
     {
          ProcessEnemyChoice(enemyToAttack);
     }
     else if (turnOrder[i].isMonster == false)
     {
          ProcessUserChoice(enemyToAttack);
     }
     //enemyToAttack is assigned as a the enemy the user selected
}

I tried a do-while loop but that stopped my program from doing any updating, which makes sense. I'm at a loss here and any input from the geniuses here would be much appreciated.

sentences: Difference between Unity's Camera.ScreenPointToRay and Camera.ScreenToWorldPoint? What is the difference between Unity's  Camera.ScreenPointToRay and Camera.ScreenToWorldPoint. And where we can use these. I've watched some tutorial and documentation but I didn't get a clear understanding.

sentences: PokeMMO. How they do it? Well PokeMMO is a JAVA game project which basically is the original FireRed title for the GBA made online. They know this type of projects don't last long because of the copyrighted material used, but they somehow made their client extract resources from ROMS. So they don't offer any copyrighted material on their download. I wonder what technique they could be using for this? All I know is that they use LWJGL.

sentences:
Box2D simulation running slower on lower FPS(even when the desired FPS is lower than the actual) I´m playing around and trying to make myself an easy platformer using the Box2D physics, before that I was not using it and was using my own physics implementation(just simple movements with timestep). My gameloop architecture now works like this:

while (_isRunning) {

    //Processing input events
    processInput();

    update();

    //Rendering stuff
    startFPSCap();

    render();

    delayFPS();
}

The update function is consisting of updating a game world (normal update function without deltatime) - inside this I´m calling a Box2D step function, with desired timestep at 1/60(wanted to have simulation at 60 fps) and then I call my own timestep function to update entity components(so they can be updated also with timestep not just the physics).

void update()
{
    _physics->Step(1.0f / 60.0f, 6, 2);

    updateEntitiesWithOwnTimestep();
}

However when I tried to run it on slower FPS, the simulation slow downs (even when I capped the FPS to like 200 at the start, so running it at 100 fps is like a slowmotion). I thought that when I set the desired physics simulation for 60 fps it will be no problem when reducing the FPS, but it seems like I´m missing something. Or is there something wrong? I mean, maybe the fact I´m running also my own timestep function.. Thanks for help.

Edit1 - according to Timos answer

Do you mean I should put the delta value I pass to my update function during each step in my own timestep? Like this:

void TimestepManager::update() {

int i = 0;

while ((_totalDeltaTime>0.0f) && (i<MAX_PHYSICS_STEPS)) {

    _deltaTime = std::min(_totalDeltaTime, MAX_DELTA_TIME);

    //This is std::function - i can define my own behavior via this
    _f.exec(_deltaTime);

    _physics.Step(_deltaTime, 6, 2);

    _totalDeltaTime -= _deltaTime;

    i++;
}

}

Or should I pass the total deltaTime? Because I thought that I should keep this unchanged because I don´t want to tie the simulation with the FPS.

sentences:
Why can't I play 2 animation track at the same time in Timeline for additional Camera? I try to move and rotate camera at the same time in timeline. To do this, I added two animation track to camera. One animation track changes position of the camera. And the other one changes rotation of camera. But they are not working at the same time. When I press "preview" button, only rotation of camera changes

This video may help understanding if question is not clear
https://vimeo.com/user133731359/review/517045792/43b6c6ec49

sentences:
Can't figure out how to create texture from a font-surface I can't seem to be able to render my font, it crashes and I can't figure out why. It seems to load the font correctly, but the parts relating to surface crashes.

Why does my texture crash?

Here is the code bits relating to it. SDL2 and TTF has been initialized properly.

        TTF_Font *arial;
        SDL_Color mm_txt_color = {255, 255, 255, 0};
        SDL_Texture *myTexture;
        SDL_Rect myRect;
        load_font(MM_FONT_ARIAL, 18,  &arial);

        get_text_and_rect(0, 0, "Exit", arial, &myTexture, &myRect);

int load_font(char *filepath, int size, TTF_Font **font)
{
    (*font) == TTF_OpenFont(filepath, size);
    if((*font) == NULL ) {
        printf("ERROR: Failed to load font: %s.\n", filepath);
        return FAILURE;
    }
    return SUCCESS;
}

    void get_text_and_rect(int x, int y, char *text, TTF_Font *font,
        SDL_Texture **texture, SDL_Rect *rect)
    {
        int text_width;
        int text_height;
        SDL_Surface *surface;
        SDL_Color textColor = {255, 255, 255, 0};

        surface = TTF_RenderText_Solid(font, text, textColor);
        *texture = SDL_CreateTextureFromSurface(renderer, surface);
        text_width = surface->w;
        text_height = surface->h;
        SDL_FreeSurface(surface);
        rect->x = x;
        rect->y = y;
        rect->w = text_width;
        rect->h = text_height;
    }

sentences:
How could I do simple per-fragment lighting on BSP geometries? I am programming a graphics engine for an old game. The game uses a BSP geometry which I have rendering perfectly. For it's lights however, it simply has light instances with the standard x, y, z, rgba, brightness, type. Now I know that OpenGL has an 8 light limit. How should I go about handling multiple lights.

I am learning per fragment light just to have the concepts under my belt. I know per pixel lighting is the standard and I will eventually move there, just want to learn how to get this concept put in play as well.

I assume I will just calculate which lights are the closest and render those 8. Does anyone have any other ideas?

sentences:
How do you create hitboxes that will detect stationary targets too? I've created a basic attack combo system that chains 3 attacks together.

When the player clicks the mouse button, it enables a boxCollider2D attached to the player.

The boxCollider is a trigger and will cause damage to a valid target using OnTriggerEnter2D.

This doesn't seem to be very responsive, and often will not work if the target is stationary. I've thought about trying Raycasts as an alternative but am looking for advice on how to handle this properly.

public class Attack : MonoBehaviour
{
     private int comboIndex;
     public float lastAttack;
     private Animator _animator;
     private string[] attackName;
     private float comboResetTimer;
     private BoxCollider2D _hitbox;

     private void Awake()
     {
         attackName = new[] {"Attack1", "Attack2", "Attack3"};
         _animator = GetComponent<Animator>();
         _hitbox = GetComponent<BoxCollider2D>();
     }

     private void Update()
     {
         var canAttack = Input.GetMouseButtonDown(0);

         if (canAttack && comboIndex < attackName.Length)
         {
             _animator.SetTrigger(attackName[comboIndex]);

             _hitbox.enabled = true;
             comboIndex++;
             comboResetTimer = 0f;
         }

         if (comboIndex > 0)
         {
             comboResetTimer += Time.deltaTime;
             if (comboResetTimer > lastAttack)
             {
                 _animator.SetTrigger("Reset");
                 comboIndex = 0;
                 _hitbox.enabled = false;
             }
         }
     }
 }

sentences:
Unexpected results with D3D9 depth bias I've run in to some problems with the D3DRS_DEPTHBIAS render state after converting an older game's D3D8 renderer to D3D9.

D3D9 replaced the old (and poorly supported) D3DRS_ZBIAS with D3DRS_DEPTHBIAS, but it doesn't seem possible to get it to work the same way that ZBIAS did. This game renders shadows and other "decals" onto the ground as flat textures, and to avoid the obvious z-fighting issues that would result would set D3DRS_ZBIAS to 2 when rendering decals in the D3D8 renderer (which I did not write).

The best approximation of the old D3D8 behavior that I've been able to come up with is setting D3DRS_DEPTHBIAS to -0.00003 when rendering shadows. This works fine for shadows on flat terrain that are relatively close to the camera, but when the camera is far above a shadowed object, the shadow will draw on top of the object itself. This can also happen even on near objects if they are on uneven terrain.

It doesn't seem possible to solve this by manipulating the DEPTHBIAS value alone, as no change fixes it entirely without causing other problems.

Is there any way to solve this? Failing that, is there a more modern technique for rendering decals that could be used? I would much rather avoid lots of rewriting as I'm not very familiar with D3D and didn't write any of the original code, but if that is the only option...

sentences:
What is the correct way to implement hit detection with non-rectangular sprites? What is the correct way to implement hit or touch detection for non-rectangular sprites in Cocos2d?

I am working on a jigsaw puzzle, so our sprites have some strange forms (jigsaw puzzle bricks). As of now, we have implemented the "detection" this way:

- (void)selectSpriteForTouch:(CGPoint)touchLocation {
    CCSprite * newSprite = nil;

    // Loop array of sprites
    for (CCSprite *sprite in movableSprites) {

        // Check if sprite is hit.
        // TODO: Swap if with something better.
        if (CGRectContainsPoint(sprite.boundingBox, touchLocation)) {
            newSprite = sprite;
            break;
        }
    }
    if (newSprite != selSprite) {
        // Move along, nothing to see here
        // Not the problem
    }
}

- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
    CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
    [self selectSpriteForTouch:touchLocation];
    return TRUE;
}

I know that the problem is in the keyword "sprite.boundingBox". Is there a better way of implementing this, or is it a limitation when using sprites based on .png's? If so, how should I proceed?

sentences: What's the best low cost ways to host your own "play in browser" games I've been developing games as a hobbiest/part-time indie for a few years now and have half a dozen games that I'm reasonably proud of. I was wondering if anyone could suggest good, relatively low cost options for setting up a web-site to host my games, playable natively in the browser, to more easily share them with friends, online communities, and potential employers.

sentences:
How can I use one method and also switch between a coroutine and the main method? Now I'm using two methods, one as StartCoroutine and one not.

What I want to do is to have just one method and when I set the StartCoroutine variable to true or false when the game is running I want it to switch between the coroutine and the main. Is there a simple way to do it with one method and not two, if not, how do I achieve this?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Grid : MonoBehaviour
{
    public GameObject gridBlock;

    public int worldWidth = 10;
    public int worldHeight = 10;
    public bool StartCoroutine = false;

    public float spawnSpeed = 0;

    void Start()
    {
        if (StartCoroutine)
        {
            StartCoroutine(GenerateGridSC());
        }
        else
        {
            GenerateGrid();
        }
    }

    private void GenerateGrid()
    {
        for (int x = 0; x < worldWidth; x++)
        {
            for (int z = 0; z < worldHeight; z++)
            {
                GameObject block = Instantiate(gridBlock, Vector3.zero, gridBlock.transform.rotation) as GameObject;
                block.transform.parent = transform;
                block.transform.name = "Block";
                block.transform.tag = "Block";
                block.transform.localPosition = new Vector3(x, 0, z);
            }
        }
    }

    IEnumerator GenerateGridSC()
    {
        for (int x = 0; x < worldWidth; x++)
        {
            yield return new WaitForSeconds(spawnSpeed);

            for (int z = 0; z < worldHeight; z++)
            {
                yield return new WaitForSeconds(spawnSpeed);

                GameObject block = Instantiate(gridBlock, Vector3.zero, gridBlock.transform.rotation) as GameObject;
                block.transform.parent = transform;
                block.transform.name = "Block";
                block.transform.tag = "Block";
                block.transform.localPosition = new Vector3(x, 0, z);
            }
        }
    }
}

sentences:
Why Godot over Cryengine, UE4, Armory3d or Unity3d? Godot have a low performance in linux systems and lack of functionalities? This appear not been in account when peoples vote for him over other engines and i wonther whi.
I know it is under MIT lisence, but the others engines have a very permisive licences and in some cases they help you with funding for your games.
I ask this because i have maded survey on google plus about a selection of engines, and people still bote for godot over other engines. I want to select an engine for my future games, and when i compared, godot's not get a good place.

sentences:
How to make player move into next level in pygame When my player reaches at the end of the map, I want it to enter to the next level. I've created the first level and it all works fine. All I want to do is that when player finishes 1st level I want to load another map on which it can move forward. But I'm not able to understand how to do it.
Here is piece of my code:
def runGame(theGame):

    theGame.clock.tick(FPS)

    # This function consists code for Events
    theGame.events()
    # This function consists code from enemy hit events
    theGame.hit_or_not()
    # This function consists code for player movements
    theGame.movements()
    # This function consists code for drawing the sprites over the screen
    theGame.redrawGameWindow()

def readyGame(run, gameOver):
    game = Game()

    while run:
        runGame(game)

        keys = pygame.key.get_pressed()

        if keys[pygame.K_x]:
            game = Game()
        elif keys[pygame.K_ESCAPE]:
            run = False
        pygame.event.pump()

        if gameOver:
            runGame(game)

readyGame(True, False)

Here is my whole code which is responsible for my 1st level please kindly check it - https://pastebin.com/zMFetAd6 (Game Class)
Do I have to create another class for 2nd level like I did for the 1st level?
Can anyone please help me out in this issue? Thanks in advance!

sentences:
In behavior trees, how do you retain your place in a sequence? For context, I am coding a naive implementation of behavior trees myself, in C#. Let's say I have two scenarios that I want to create behaviors for. Both AI's will traverse/patrol four specific locations (markers), in order, and then repeat the path.

AI 1) Upon seeing the player, freeze. Once the player is out of sight, begin patrolling again, but from the very first marker (i.e. restart).

AI 2) Upon seeing the player, freeze. Once the player is out of sight, begin patrolling again, but from whatever marker it was previously on before being interrupted by the player (i.e. carry on).

I would expect both of these behaviors to be modeled by first checking for the player, and if that fails proceeding further down to a Sequence node that contains four children, each being a "traverse to maker" behavior.

In other words -> after a behavior is interrupted by a node higher up the tree, how do I retain the current place in a sequence and carry on when we finally make it back down the tree again?

sentences:
Accidental noise - Gradient function Related to my previous question (2D Terra(ria)in generation - Accidental noise) I'm stuck on understanding how the gradient function itself works (in the Accidental library).

After help on chat (thanks Jon!) I understand that upon defining the gradient, for example, Gradient(0,0,0,1), it returns a function that upon its turn would return correct values between 0 & 1 for the arguments you provide.

So calling the this function with (0,40) would give you a value back between (0,1). However, I don't understand how it would do this without knowing the outer "range".

E.g. If you'd render the gradient image that's shown on his site:

Would you do that by defining the gradient(0,0,0,1) and then calling it for each pixel? (0,1) (0,2), (50,50),...? In that case, pixel (0,200) would have to return 1, but if you'd have an image of 400 pixels high, (0,200) would have to return 0.5

And calling it with values between (0,0) & (0,1) with predefined steps (1/200 or 1/400 for example), seems to make the gradient noise function itself rather useless.

If possible, pseudo or python code would be very welcome to illustrate how the "internals" on that gradient function would work, perhaps I'm thinking of it too complex.

Thanks in advance!

sentences:
Unity blit() not writing to RenderTexture I found a nice Gaussian Blur shader online and am attempting to use it to blur a render texture using blit(). However, the render texture remains unblurred. I know for a fact the blur shader works as I've used it to blur the main camera, but it just doesn't seem to want to blit() my render texture.

C# Blur Script:

 void Update()
 {
     if (_material == null)
     {
         _material = new Material(_shader);
         _material.hideFlags = HideFlags.HideAndDontSave;
     }

     RenderTexture rt1, rt2;

     if (_downSampleMode == DownSampleMode.Half)
     {
         rt1 = RenderTexture.GetTemporary(source.width / 2, source.height / 2);
         rt2 = RenderTexture.GetTemporary(source.width / 2, source.height / 2);
         Graphics.Blit(source, rt1);
     }
     else if (_downSampleMode == DownSampleMode.Quarter)
     {
         rt1 = RenderTexture.GetTemporary(source.width / 4, source.height / 4);
         rt2 = RenderTexture.GetTemporary(source.width / 4, source.height / 4);
         Graphics.Blit(source, rt1, _material, 0);
     }
     else
     {
         rt1 = RenderTexture.GetTemporary(source.width, source.height);
         rt2 = RenderTexture.GetTemporary(source.width, source.height);
         Graphics.Blit(source, rt1);
     }

     for (var i = 0; i < _iteration; i++)
     {
         Graphics.Blit(rt1, rt2, _material, 1);
         Graphics.Blit(rt2, rt1, _material, 2);
     }

     Graphics.Blit(rt1, source);

     RenderTexture.ReleaseTemporary(rt1);
     RenderTexture.ReleaseTemporary(rt2);
}

sentences: How can I represent a tile-based map and related properties on disk? I'm trying to load a tile-based map in my game. I've been watching SDL tutorials for a while now but they never covered how to represent the map in a file? How can I represent a tile map on-disk in a way that also lets me store information about collision and other properties?

sentences:
Moving an image by rotating and increasing y axis causes a trailing issue Forgive me if me anything is unclear, this is a tricky thing for me to explain.

In an applet I draw a little ship gif. I have it so I can rotate the object and then increase or decrease the y axis to move the little guy around the screen. The problem it seems is that the coordinates for the ship are not in sync with those of the applet window?

For example: the boundaries for my applet window are 800 by 600. I move the ship by rotating it and then increasing or decreasing the y axis, but whenever the Y axis is exceeds 600 or is lower than 0 I get this weird trailing issue. Am I doing buffering right?

here are my "Main" and "ship" classes:

Main class:

    public class Main extends Applet implements Runnable, KeyListener
{
    ship player1;
    private Image i;
    private Graphics buffer;
    AffineTransform affineTransform = new AffineTransform();

    public void init()
    {
        this.setSize(800, 600);
        this.setBackground(Color.BLACK);
        addKeyListener(this);
    }

    @Override
    public void start() {
        player1 = new ship();
        Thread thread = new Thread(this);
        thread.start();
    }

    @Override
    public void paint (Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        player1.paint(g2d, this);
    }

    @Override
    public void update(Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        if(i == null){
            i = createImage(this.getSize().width, this.getSize().height);
            buffer = i.getGraphics();
        }
        buffer.setColor(getBackground());
        buffer.fillRect(0, 0, this.getWidth(), this.getHeight());
        buffer.setColor(getForeground());
        paint(buffer);
        g2d.drawImage(i, 0, 0, this);
    }

    @Override
    public void keyPressed(KeyEvent e) {
        switch(e.getKeyCode()){
        case KeyEvent.VK_RIGHT:
            player1.rotateRight();
            break;
        case KeyEvent.VK_LEFT:
            player1.rotateLeft();
            break;
        case KeyEvent.VK_UP:
            player1.moveUp();
            break;
        case KeyEvent.VK_DOWN:
            player1.moveDown(this);
            break;
        }
    }

    @Override
    public void keyReleased(KeyEvent e) {
    }
    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void run() {
        while(true){
            repaint();
            try {
                Thread.sleep(17);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

ship class:

    public class ship {
    private Image sprite_ship;
    //private Image ship_engines_green;
    private int x = 300;
    private int y = 500;
    //private int dx = 10;
    private int dy = 10;
    private int my = 0;
    AffineTransform affineTransform = new AffineTransform();
    double rotation;

    public ship() {
        sprite_ship = Toolkit.getDefaultToolkit().getImage("ship.gif");
        //ship_engines_green = Toolkit.getDefaultToolkit().getImage("ship_engines_green.gif");
    }

    public void moveDown(Main M){
        y += dy;
        System.out.println("Y axis: "+y);
        System.out.println("X axis: "+x);
    }

public void moveUp(){
        y -= dy;
        System.out.println("Y axis: "+y);
        System.out.println("X axis: "+x);
    }

public void rotateRight(){
    rotation += 5;
    System.out.println("Rotation : "+rotation);
}
public void rotateLeft(){
    rotation -= 5;
    System.out.println("Rotation : "+rotation);
}
    public void paint(Graphics g, Main M){
        int spriteHeight = sprite_ship.getHeight(null);
        int spriteWidth = sprite_ship.getWidth(null);
        Graphics2D g2d=(Graphics2D)g;
        affineTransform = g2d.getTransform();
        g2d.rotate(Math.toRadians(rotation), x+spriteWidth/2, y+spriteHeight/2);
        g2d.drawImage(sprite_ship,x,y,M);
        rotation = 0;
    }
}

much thanks for any suggestions or if anyone can point out something I'm doing that's terribly misguided.

sentences:
Unity3D - Mesh appears black in parts that it shouldn't I have a procedurally-generated mesh that I am generating to use as a terrain. It looks something like this (from above, and it changes slightly every time):

It also looks fine when I view from the z-axis side.

The issue is that when I view it facing the x-axis, it has a black part kind of going through it.

I wouldn't really care about that, but when the player goes into the valley, it seems as if they fall under the black part. They can only see the ground and above them it is all black.

The mesh does have a mesh collider attached, and so the player doesn't fall the way through the mesh - just the "black line". The height of the mesh (on the y-axis) is generated using perlin noise that I multiply by 800 (to increase the waviness), and that is set when I set the vertices. I suspect that this issue has to do with the normals or the uvs not adjusting to the y-axis, but I've messed around with it a lot and nothing seems to help. I currently generate the normals with RecalculateNormals() after I generate the vertices, triangles, and uvs, and calculate the uvs in a for-loop where I take each vertex's x and z axis and divide it by the number of vertices on that axis time the distance between them (to make it between 0 and 1).

sentences:
Libgdx: setting windows's icon When I export my game as runnable .jar file with custom window's icon - it doesn't run. It runs only in debug mode and when I try to launch .jar with the console it says that it cannot load icon file.

Picture of my problem:

sentences: How can I implement a scrolling text ticker? How can I implement a right-to-left scrolling text ticker in libGDX (like stock tickers)?

sentences:
Execute code at specific intervals, only once? I am having an issue with XNA, where I want to execute some code in my Update method, but only at a given interval, and only once. I would like to avoid booleans to check if I've already called it once, if possible.

My code is here:

    if ((gameTime.TotalGameTime.TotalMilliseconds % 500) == 0)
    {
        Caret.Visible = !Caret.Visible;
    }

As you may have guessed, it's for a TextBox control, to animate the caret between invisible and visible states. I just have reason to believe that it is called twice or maybe even 3 times in a single update-call, which is bad, and makes it look unstable and jumpy.

sentences:
Handling buildings in isometric tile based games A simple question, to which i couldn't find a definitive answer - how to manage buildings on a tiled map? Should the building be sliced in to tiles or one big image?

EDIT:
The game is being built from scratch using C++/SDL 2.0, it will be a turn based strategy, something like Fallout 1 & 2 without the hex grid, a simple square grid, where the Y axis is squished by 50%.
Buildings can span multiple tiles, the characters move tile by tile. For now, the terrain is completely flat. Some basic functionality is in place, so I'm aiming to advancing the terrain and levels them selves - adding buildings, gates, cliffs, not sure about the elevation.

sentences:
How to create a bounding box around a Sprite in C++? Hello everyone, I am trying to create a bounding box around a Sprite in my simple Pong game. The bounding box needs to be a simple rectangle around the sprite so that it can act as a collision detector between the ball and paddle.

I have already tried to create the bounding box but it's not quite working as expected.

    float current_x = paddle_right->xPos();
    float current_y = paddle_right->yPos();
    float current_x2 = paddle_left->xPos();
    float current_y2 = paddle_left->yPos();

    float width_x = current_x + 16;
    float width_y = current_y + 150;
    float width_x2 = current_x2 + 16;
    float width_y2 = current_y2 + 150;

    if((x_pos > current_x && x_pos < width_x && y_pos > current_y && y_pos < width_y)||
        (x_pos > current_x2 && x_pos < width_x2 && y_pos > current_y2 && y_pos < width_y2))
    {
        dir_vector.setX(dir_vector.getX() * -1);
    }

The above code is the code I have used to create said bounding box, but like I said, it's simply not working correctly (As in the ball will sometimes go through the Sprite or have an abnormal reaction to it such as bouncing the wrong way).

I hope I have explained this well, if not please ask me which part to explain again. Basically, I just want do create a bounding box around a Sprite (in this case, the Paddle) to which then the ball can collide from.

For reference I am using the AwesomeSauce Game Engine.

sentences:
How to load geometry/object/scene created in Clara.io with Three.js Does anybody know how to load anything created in Clara.io into your Three.js scene?

Clara.io allows export of ThreeJS geometry, object or scene. I tried all those in combination with all THREE loaders (JSONLoader, SceneLoader, GeometryLoader, etc.) without any success (Parse function inside of three.js fails to process json structure).

Structure of exported file from Clara.io looks to be completely different from what Three.js loaders expect. Can this be achieved in any way or is Clara export simply useless at this point?

I am talking three.js v.65 in combination with current version of Clara.io

sentences:
How can I make an object "solid"? In Valve's software Hammer (Counter-Strike Global Offensive SDK Hammer software, for reference), I have created several props that I plan to have players jump on. However, players pass right through this prop.

How can I make it so that a prop is solid, and so that players can't walk right through the prop? Also, the prop is a static prop.

sentences:
Resources to learn XNA for a professional c# developer I'm a .net consultant (mainly c#) for my job, but for a while now, I've been interested in making a game in XNA (as a hobby project).

I've had a "beginner" course in XNA when I was still a student, but I've lost most of the information (plus, it was VERY beginner, not enough to get you really started).

So my question, which resources would be useful for me to learn XNA (books, blogs, websites, tutorials, resource websites - like textures, audio files, etc..)?

I know this is a very open question, but I'm thankful for any information.

sentences:
Shadow mapping too slow and ugly! As many of you are, I am working on a game.

I have just added my first attempt at shadow mapping (standard variation) and quite frankly I am very disappointed.

I am literally squeezing as much out of this approach as possible and it simply not usable.

Its too slow and too ugly to look at!

So what do people do?

I have bumped into something called "Perspective shadow mapping" but I have not got any working examples of this yet and I don't really want to spend a long time working on this only to find that its too slow to use and not all that much better.

So what I am asking for is some feedback on your experiences and how you overcome all the problems with shadow maps.

Some details are:
I have a single light (point light)
Standard first person type game
The light moves (all the time, but slowly)
The draw distance is not very far

If I don't use shadows then the game runs at 500 FPS, and with shadows it drops to 90!

Edit:
As I have said, I have put a lot of effort into this so I have already solved:
Getting the tightest possible near/far
Getting the tightest X/Y (without constant change per frame)
I have no peter panning
No acne

But, due to the fact that my light moves all the time I get constantly (shaking) shadow pixels.

And the only way I am able to make the shadows look crisp/and stop shaking is to make the shadow map ridiculously high resolution. And this then drops the frame rate too much.

I understand all the problem, but what I want to know is what do people rely do to solve the problem. People cant really be using this in games as its just no good.

I am also looking into cascaded Shadow Mapping. That looks to be the solution. What are people experience with this?

sentences:
DX9 How to Apply HLSL Shader with StretchRect Using DirectX 9,I'm trying to run a HLSL pixel shader on video frame data while copying it from one texture buffer to another texture buffer without displaying it. StretchRect at the end is what copies the data from pOffsceenSurface to pTextureSurface, which should pass through the pixel shader. The video data does get passed over and I can read it back, but the shader isn't being applied.

What do I need to do to process the texture through the shader? And does register(S0) get automatically filled, or how do I set the source? The code I have allows configuring register(C0), register(C1), etc. through m_pPixelConstantTable, but not the S registers. Some shaders take S0 and S1 so it needs to be configured somehow.

Here's the code

HRESULT D3D9RenderImpl::SetPixelShader(LPCSTR pPixelShaderName, LPCSTR entryPoint, LPCSTR shaderModel, LPSTR* ppError)
{
    CComPtr<ID3DXBuffer> code;
    CComPtr<ID3DXBuffer> errMsg;

    HR(D3DXCompileShaderFromFile(pPixelShaderName, NULL, NULL, entryPoint, shaderModel, 0, &code, &errMsg, &m_pPixelConstantTable));
    return m_pDevice->CreatePixelShader((DWORD*)code->GetBufferPointer(), &m_pPixelShader);
}

HRESULT D3D9RenderImpl::CreateScene(void)
{
    HR(m_pDevice->Clear(D3DADAPTER_DEFAULT, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0));
    HR(m_pDevice->BeginScene());
    HR(m_pDevice->SetFVF(D3DFVF_CUSTOMVERTEX));
    // when I debug, m_pPixelShader does get set properly)
    HR(m_pDevice->SetPixelShader(m_pPixelShader));
    HR(m_pDevice->SetTexture(0, m_pTexture));
    HR(m_pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2));
    return m_pDevice->EndScene();
}

HRESULT D3D9RenderImpl::Present(void)
{
    HR(m_pDevice->ColorFill(m_pTextureSurface, NULL, D3DCOLOR_ARGB(0xFF, 0, 0, 0)));
    return(m_pDevice->StretchRect(m_pOffsceenSurface, NULL, m_pTextureSurface, NULL, D3DTEXF_LINEAR));
    // This line doesn't seem necessary
    // return m_pDevice->Present(NULL, NULL, NULL, NULL);
}

What's missing?

EDIT: Here's what I'm rendering to

HRESULT D3D9RenderImpl::CreateRenderTarget()
{
    // HR(m_pDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, m_displayMode.Format, D3DPOOL_DEFAULT, &m_pTexture, NULL));
    HR(m_pDevice->CreateTexture(m_videoWidth, m_videoHeight, 1, D3DUSAGE_RENDERTARGET, m_format, D3DPOOL_DEFAULT, &m_pTexture, NULL));
    HR(m_pTexture->GetSurfaceLevel(0, &m_pTextureSurface));
    HR(m_pDevice->CreateVertexBuffer(sizeof(VERTEX) * 4, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &m_pVertexBuffer, NULL));

    VERTEX vertexArray[] =
    {
        { D3DXVECTOR3(0, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(0, 0) },  // top left
        { D3DXVECTOR3(m_videoWidth, 0, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(1, 0) },  // top right
        { D3DXVECTOR3(m_videoWidth, m_videoHeight, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(1, 1) },  // bottom right
        { D3DXVECTOR3(0, m_videoHeight, 0), D3DCOLOR_ARGB(255, 255, 255, 255), D3DXVECTOR2(0, 1) },  // bottom left
    };

    VERTEX *vertices;
    HR(m_pVertexBuffer->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD));

    memcpy(vertices, vertexArray, sizeof(vertexArray));

    HR(m_pVertexBuffer->Unlock());

    return m_pDevice->SetRenderTarget(0, m_pTextureSurface);
}

sentences:
How can I switch the default map to UI in order to pause the game? I've recently set up the new Input System using Player Input component and invoke unity events. I just have one problem; I want to change the default action map to UI whenever I press the defined pause buttons because pausing won't work when the defualt map is set to Player. I want to do this via code and in PauseInput function. I tried using playerInput.SwitchCurrentActionMap but it didn't work for me. Also, I don't use a generated c# script for the player inputs. Any guidance would be appreciated.
Here's my pause menu code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.InputSystem;

public class PauseMenu : MonoBehaviour
{
    public static bool GameIsPaused = false;
    public PlayerInput playerInput;
    public GameObject pauseMenuUI;

    public void OnPause(InputAction.CallbackContext context) {
      if (context.phase == InputActionPhase.Performed) {

          if (GameIsPaused) {
              Resume();
          } else {
             Pause();
          }
     }
}

    public void Resume()
    {
        playerInput.SwitchCurrentActionMap("Player");
        pauseMenuUI.SetActive(false);
        Time.timeScale = 1f;
        GameIsPaused = false;
    }

   public void Pause ()
    {
        playerInput.SwitchCurrentActionMap("UI");
        pauseMenuUI.SetActive(true);
        Time.timeScale = 0f;
        GameIsPaused = true;
    }
}

As you can see, I want to change the default map from Player to UI whenever the pause button is pressed and switch back to Player whenever the button is pressed again (resume); because there can only be one active map at a time.

sentences:
When using Unity 5, is there a way to print/save/identify the last n lines of code that were executed at a specific point? So, here is what I am after. Is there a way to identify which were the last n lines of code that were executed in Unity 5 (with C#) at a given point of the game?

I know I can use Debug.Break() to set break points to help identifying problematic parts of the code. However, when the codes escalate and multiple functions interact, it is sometimes difficult to identify what came immediately before the break point.

Therefore, my question. Is there a way to retrieve the lines of code that were executed for instance before a break point?

sentences: How to get an autotile in Godot 3.1? I wonder if there's a way to get an autotile just like a single tile using a get_autotile() GDScript function or something like that.

sentences:
I want a variable/field to only be declared when a specific condition is true. I used Compiler Directives. Is the code I wrote valid? I want a field I declared (float attackRange) to be only declared when inheriting class set "bool haveLongRangeAttack" is set to true. I wanted to use Compiler Directives for this purpose. Here is the code I wrote;

using UnityEngine;

public abstract class Enemy<T> : MonoBehaviour where T : Enemy<T>
{
    [SerializeField] protected bool haveCloseRangeAttack = false,
                                    haveLongRangeAttack = false;
#if haveLongRangeAttack == true
    [SerializeField] protected float attackRange = 1f;
#endif

    [SerializeField] protected GameObject mainCharacter = null;
    protected GameObject enemy = null;

    protected virtual void ChasePlayer()
    {
        if(haveCloseRangeAttack)
        {
            //...
        }
        else if(haveLongRangeAttack)
        {
            //...
        }
    }
}

I don't know if it is right way to/of do what I want or using Compiler Directives so please review my code and tell me if there is a problem, or if there is a better way.

It was before 6 months when I started writing code, and C was my first language. I am trying to learn new things/concepts and writing at my own style. So there will be another way (maybe more efficient); if there is one, please teach me. I'm working on my own Game Project right now, I'm open to learn new things that will benefit me...

TY for taking time ^.^!

PS:There is no compiler-directives tag in Tags section. Maybe it will be useful to add this tag.

sentences:
Why does my machine render OpenGL using my onboard chipset instead of my graphics card? I'm following an OpenGL tutorial series at opengl-tutorial.org, but have run into a problem:

The following lines:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

cause my glfwCreateWindow() call to return null.

As I understand, this is caused by lack of support for OpenGL 3.3.

Why is my machine trying to render OpenGL 3.3 using my onboard graphics chipset (Intel HD Graphics 3000, which only supports OpenGL 3.1) instead of using my dedicated graphics card (GeForce 520M, which supports OpenGL 4.x)? I think this has something to do with power saving.

Note: I have newly updated nVidia drivers, installed as of yesterday. I know they are working because if I right-click my desktop I get a context menu for nVidia Control Panel.

Running OpenGL Extensions Viewer 4.x also displays that I'm using Intel HD Graphics 3000, supporting OpenGL <= 3.1, which is consistent with my theory regarding power saving.

Regards,

sentences:
Game synchronisation in peer-to-peer online multiplayer game I am developing an online real-time multiplayer game using Google Play Game Service and Cocos2D-X. The game has two players where each player control their own ball.

The each player sends their own ball’s velocity and position to the other connected device. In my game, all the physics calculations are done locally on each devices i.e. ball velocities after physical calculations are calculated locally on each devices.

Issue:

When fast moving ball collides wth the opponent’s ball, there is no change in the movement velocity of the opponent’s ball. (According to real world physics, the fast moving ball should be able to push the opponent’s slowly moving ball.)

Reason:

During my code analysis, I understood that the velocity calculated by the local physics engine are overwritten by the data received from the opponent’s device.

For e.g.

Solution I tried:

To fix the problem, whenever the collision between balls occurs I am creating one of the device as server and other device as client. All the physics calculations occurs on the server device and data is send to the client device.

I have following questions:

Is the solution tried by me is optimal solution to fix the issue?
What other approaches can be tried to fix such type of issue?

I would appreciate any suggestions/thoughts on this topic. Thank you.

sentences:
Is it possible to record video, depth map and 6D pose of any games? I'm not a game developer, but a researcher working on improving video quality in various contexts. For my current problem, I need to collect videos which have both RGB data as well as depth data. Video can be monocular or stereo. However, if there is egomotion, I'll need the camera pose (rotation and translation) as well. Is there any way to record all these information in any kind of games? Games can be on any platform: PC games, mobile games or VR games.
In short, I want to record gameplay but with additional information such as depth map and camera pose.

sentences:
How to pass depth buffer from OGRE to CUDA? I am using OGRE for rendering some objects. At every frame, I would like to pass the resulting depth buffer to CUDA for running some kernels on it and computing a result.

How can I achieve this? How do I get access to depth buffer in OGRE? How do I pass this to CUDA for processing? I do not need to write to the depth buffer in the CUDA kernels, it can be read-only.

sentences:
Unity 4.5 Sprite Packer does not pack images inside Resources folder I'm trying to use the new Sprite Packer tool, but it doesn't work if I put the imagens inside Resouces folder, but inside any other folder it works.

is it a bug?

sentences:
How to create data driven effects/abilities for collectable card game I'm trying to create cards for a ccg/tcg that are completely "data-driven" from an xml/json/external file. I've read multiple articles on this issue already, even here on stack exchange, but i can't figure out how to actually code this. I have a simple example:

My two cards have the following abilities

1) "Increase the value of all adjacent red cards by 1"

2) "Increase the value of this card by the amount of all adjacent red cards"

In my code i have the following functions (pseudo) that i need to accomplish these effects:

Increase(targetCards, byValue) // increases a card's value by another value
FindCards(filter=adjacent) // returns all adjacent cards
FilterCardsBy(filter=isRed) // returns only red cards
Count(targetCards) // counts the number of cards

To create effect 1 i would use the functions like this:

Increase(FilterCards(FindCards(adjacent), isRed), 1);

and to create effect 2 i would use:

Increase(this, Count(FilterCards(FindCards(adjacent), isRed)));

So here's the problem:
I have no clue how i can describe these functions in my external file and also i have no clue how i actually tell my functions to work in this combination to achieve the desired effects.
Maybe i'm misunderstanding the concept here but as far as i understood and described here i can create some pseudo script/code in my external file that then my code can interpret and execute on. But i feel i somehow missing the middle part where i write code to interpret these commands i'm defining in the external file.

Anyone with experience here that can give me some super simple starter ideas on how to takle this. Especially the part where i can combine several functions into one.

sentences:
Generate a HexMap where each tile has a different tile on each edge I’m trying to generate a 7*13 hexmap, with 9 different types of tiles, numbered 0 through 8. I need the map to be randomly generated on each run and it has to be so that each tile has a different numbered tile on each edge.

I’m having trouble with this algorithm. I can generate my map just fine, but there will always be many tiles where they’ll have the same number on multiple sides.

Any tips would be appreciated. Currently, I’m think I’ll have to iterate through the 2d grid, picking my first tile, let’s say 1. And then make sure there is no other 1 spawn in a two block distance. Any better ideas I can use?

Thanks

sentences:
Recorded Voice or Synthesized Speech? I'm interested in adding to my game either recorded human or synthesized speech. I'm interested in what game devs have to say regarding the value of recorded human voice over voice synthesis. Thanks in advance!

Points to consider:

EDIT: First and foremost, the game is meant for kids (i.e. when you see an image of an apple, a voice says "a is for apple") - here it is on Appbrain (currently sans audio...)
I searched the responses for Is it worthwhile recording your own or buying stock sound effects? - I'm basically wondering the same thing but for voice-specific audio.
Do you find value or any benefit in opting for recorded human voice?
What are some good voice synthesis or text-to-speech tools (preferably free)? I'm currently trying out Fruity Loops, which seems to get the job done (I input a phrase and it generates synthesized speech) however some words do not sound as realistic/convincing as others.
The platform is Android (i.e. memory constraints).

sentences:
2D Bounding box for collision detection - alternate shapes I have objects in my game such as clouds and stars.  I have given the bounds for them in rectangle format.

The images are not rectangular, although the collision boxes are.  How can I implement a collision box that is exactly the shape of my character?

I'm suing overlap2D.

sentences:
DirectX11 Using Multiple Shaders I currently have a scenario where I am rendering terrain with a shadow map.  I have two passes, one for the depth buffer to create the shadow map (which is rendered to a texture) and a second that takes the shadow map texture as input and actually shadows the terrain, the terrain gets drawn once for each pass.  Within the second shader I also texture the terrain.

I now want to split the second shader so that shadows and texturing are separate shaders.  How do I go about getting the output from the shadow shader to the texture shader (or vice versa), or do I simply do it in the same way as I have with the shadows (rendering to a texture, passing it as an input).

sentences:
Does abstraction influence performance? Say I have a GameObject class that is being extended by all of the objects in the game that are moving around. (This class provides basic stuff like a sprite, draw method, update method with application of move vector and so on...) I also have a class Asteroid that like I said extends GameObject

Then there are two versions of the game:

Version 1: Somewhere in the game there is a Collection that holds all of the Asteroid-objects. The update Method is something like this:

for(Asteroid a : asteroids)
    a.update(...)

Draw method goes equivalent.

Version 2: I decided to put all of my GameObjects in a single collection, so that all moving stuff is being handled in one single loop like this:

for(GameObject o : gameObjects)
    o.update(...)

Again, draw method goes equivalent.

The problem I am facing with version 2 is that the game loop basically takes twice as long. (The update method as well as the draw method.) I am astonished at the draw method, since in either version there is the exact same amount of object being drawn. So my question is: Does this abstraction in version 2 affect the game's performance in any way? (I can imagine that version 2 requires the JVM to alway cast the GameObject implicitly to it's specific type which it does not have to do when the type is already given like in version one, but I am not sure about that.) (I am using Java with LibGDX if it matters)

sentences:
How do I implement pixel-exact collision server-side? Recently I made a 2D offline game with HTML5 Canvas and JavaScript.  I'm detecting collisions by first checking whether image bounding boxes overlap.  If they do, I check against the bounding boxes, to see if there are any pixels that exist in the same location for both images.

I learned the technique from this tutorial (YouTube).

Now I'm making a multi-player version of the game, in a client-server configuration.  I've decided to have the server handle all physics, including collision.

However, I'm not sure how to implement that. Since the images are drawn client-side, the server cannot access image's data to do the pixel collision tests.  I can make bounding boxes on the server side, but how do I detect pixel collisions?

Tech details: I intend to write the server in node.js, using either CouchDB or MongoDB as my database.

sentences:
What is a lobe, in reference to lighting and graphics I sometimes see references to lobes when talking about lighting, especially with specular lighting, but also with spherical harmonics which doesn't do specular.

Can anyone explain what exactly a lobe is?

sentences:
Simple browser game help As my first "real" project, I'm working on a game that I intend to be single-player, web-based, and primarily in text. I need the ability to save choices the players make, and to have certain variables increase based on those choices. (Like bravery increasing after a heroic choice is made, for example.) There's a very small inventory; not RPG-style elaborate. The big thing about it is the choice aspect; every choice impacts where the player can go/future success or failure in other situations/etc. So I really have to be able to save those. (Choice input was being done by simple buttons, but I'm not married to that.) I'd like the player to be able to close the browser, then come back to it later where they left off- so, a login system, too.

My biggest problem is that I feel like I'm getting jerked left and right on which language(s) to use for this. I started off with Python a few months ago and started getting comfortable in that, but then didn't like how hard it was to integrate it in to a website afterward. (Hard for me, anyway. I might just be stupid, or failing to find the right tutorials on it.) I got a book on Javascript ("The Good Parts"), but found it unhelpful for what I was trying to do and my skill level. Then I got a book on PHP and MySQL ("PHP and MySQL Web Development") and started getting used to that, thinking it would be useful for saving player choices, but now all I see when I google specific questions about mySQL with games is people saying, "You don't want to use MySQL for games." So have I been wasting my time on that?

What language would you use for a single-player web game that was text-based and had to save many player choices? Or was I already going the right direction to start with?

sentences: How to fix problems with connecting VsCode to Omnisharp server? I'm using sourcetree for version controlling for Unity. I'm using VsCode version 1.45.1 and when sourctree is running on pc and I open a script on my Unity project, VsCode can't connect to Omnisharp server. What's the problem? I've recently installed Git on my pc.

sentences: Making holes in 3D objects (Unity) How can I make a hole in an object with Unity 3D? I've something like this object and I want to make a hole in it.

sentences:
Can I Use SetLOD with D3D9Ex? I need to limit the mipmap level loaded onto the device for certain textures, but I'm using a D3D9Ex-based engine, so I can only use D3DPOOL_DEFAULT, not D3DPOOL_MANAGED.

Microsoft's documentation says that I can use SetLOD

  for a managed texture.

Does that mean that I cannot use SetLOD in D3D9Ex?

sentences:
How do I calculate the new Quaternions from translated points? The code below is for a rag-doll using Verlet method, I have the correct points (or joints) positions, I just need the correct Quaternions, otherwise the resulting model looks like in the picture, I'm constraining the body to the bind pose on purpose for testing purposes.

Based on the two points, their position and quaternion, what will the new Quaternion be for each translated point?

struct Point
{
    XMVECTOR position = { 0,0,0 };
    XMVECTOR quaternion = { 0,0,0,-1 };
};

Point p1;
Point p2;

p1.position += { 0.0f,0.3f, 0.1f };
p2.position += { -1.0,0.3f,0.1f };

sentences:
Downsides to automatic UV unwrapping I have seen several software packages that offer auto UV unwrapping as an option.

My question is why would you ever manually UV unwrap if there is an automated tool to do so? Are there any significant downsides to using an automatically generated UV map?

sentences:
Component based architecture - Rendering approach? I'm planning to use a component based architecture for a new 3D game engine I plan to work on, however I don't know how to approach the rendering side of things.

I can see two options here:

Every renderable game object has a RenderComponent, which stores a mesh and OpenGL-specific stuff like VBOs and VAOs. When the time comes to have update() called, it will use OpenGL to render itself.
Every renderable game object has a MeshComponent. When it's time to render, the Renderer would go through a list of all MeshComponents, extract vertex and material information, and render it.

Which option would be most flexible if I want to implement things like post-processing (bloom, motion blur), skyboxes, LOD, blending/transparency or implementing a deferred renderer?

sentences:
Proper updating of GeoClipMaps I have been working on an implementation of gpu-based geo clip maps, but there is a section of the GPU Gems 2 article that I just can't seem to understand, specifically this paragraph, and more precisely the bolded part:

  The choice of grid size n = 2k−1 has the further advantage that the
  finer level is never exactly centered with respect to its parent
  next-coarser level. In other words, it is always offset by 1 grid unit
  either left or right, as well as either top or bottom (see Figure
  2-4), depending on the position of the viewpoint. In fact, it is
  necessary to allow a finer level to shift while its next-coarser level
  stays fixed, and therefore the finer level must sometimes be
  off-center with respect to the next-coarser level. An alternative
  choice of grid size, such as n = 2k−3, would provide the possibility
  for exact centering

Let's take an example image from the article:

My "understanding" of the way the clip maps were updated was that you floor the position of the viewpoint to an int, and as such get the center vertex point. If this is not the same as the previous center point, you update the entire map. Now, this obviously is not the case.  What I am failing to understand is this:

If you look at the image above, if the viewpoint was to move one unit to the right, then the inner ring (the one just around the view point + white center square) would end up getting a 1 unit space on both the left and right side of itself. But there is nothing in the paper that deals with this. What I mean is that it would end up looking like this:(excuse my crummy cut-and-paste editing of the above image):

This is obviously not a valid state. So, would the solution be that a clip ring (layer) can only move in increments of the ring/layer it's contained within? Wouldn't this end up being very restrictive? I feel like I am missing some crucial understanding of parts of the algorithm, but I have been over both this paper and the original paper from 2004 and I just can't see what I am not getting.

sentences:
Game over when both players die I watched the Unity Space Shooter video tutorials and then I have added a second player. I can not seem to get the 'Game Over' when they both die. It will happen when one player dies but not both. Below is my code.

using System.Collections;

public class DestroyByContact : MonoBehaviour
{
  public GameObject explosion;
  public GameObject playerExplosion;
  public GameObject player2Explosion;
  public int scoreValue;

  private bool P1Dead;
  private bool P2Dead;
  private GameController gameController;

  void Start ()
  {
    P1Dead = false;
    P2Dead = false;
    GameObject gameControllerObject = GameObject.FindWithTag ("GameController");

    if (gameControllerObject != null)
      gameController = gameControllerObject.GetComponent < GameController> ();

    if (gameController == null)
      Debug.Log ("Cannot find 'GameController' script");
  }

  void OnTriggerEnter(Collider other)
  {
    if (other.CompareTag ("Boundary") || other.CompareTag ("Enemy"))
      return;

    if (explosion != null)
      Instantiate (explosion, transform.position, transform.rotation);

    if (other.CompareTag ("Player"))
    {
      Instantiate (playerExplosion, other.transform.position, other.transform.rotation);
      P1Dead = true;
    }

    if (other.CompareTag ("Player2"))
    {
      P2Dead = true;
      Instantiate (player2Explosion, other.transform.position, other.transform.rotation);
    }

    if (P1Dead == true & P2Dead == true)
      gameController.GameOver ();

    gameController.AddScore (scoreValue);
    Destroy(gameObject);
    Destroy(other.gameObject);
  }
}

sentences:
In Unity, how can I get trigger enter/exit every frame when I change Time.timeScale? In my game I have a power-up that slows everything down.  I keep the player at regular speed by dividing deltaTime by timeScale.  Everything works perfectly except for OnTriggerStay2D which appears to be affected by the timeScale.

I thought I could just use trigger enter and trigger exit, pushing everything up to the update function that IS running every frame, but those are also slowed down and I'd like to keep things accurate to the player perspective.

So, is there any way to force trigger stay, enter or exit to work in regular time after I've changed Time.timeScale?

sentences:
Rotate object Up/Down/Left/Right in any orientation I'm rendering model at the origin with a fixed camera looking at it positioned on the z axis.

I want to be able to rotate the model up/down and left/right. Currently I have 2 variables, HorizontalRotation and VerticalRotation. When calculating the world matrix I rotate about the Y axis by HorizontalRotation and about the X axis by VerticalRotation.

The ..Rotation variables are controlled by pressing up/down/left/right arrow keys.

The problem I'm having is that the rotations are happening relative to the object.

Lets say it's a model of the world. Pressing Up a bit would let me look at the north pole.
Currently when i press right the earth spins infront of the camera on its axis; I'm still looking at the north pole.

How can i get it so that no matter what rotations are currently applied i can always rotate my model relative to the camera/world axis?

sentences:
With Unity and Mecanim, how do I trigger an effect animation? We have a Mecanim animation. We'd like to play a particle effect on it at a certain frame in the animation.

Do we need to use an AnimationEvent and have it call a function that triggers the effect? Or is there some editor-only way to do it without script?

We're using Unity 5.3.5.

sentences:
Why I can't do a build for Linux? I'm using Unity 5.3.x (free version) on a Windows machine.
I would like to build my simple desktop game either for Windows and Linux, but Linux (and Mac) build is disabled.
Am i missing something ?

Thanks

sentences:
Move Background in AndEngine for a Racing Game I am new to game development and AndEngine. I have small query about racing game. I am going to develop a bike racing game. For bike racing game we will move the background or the player. I am tried with andengine autoparallax background. But I didn't got the correct answer.

I need to do a background  like these screenshots in SpeedMoto.

Can anyone help me to set the background.

sentences:
How do I randomly generate a top-down 2D level with separate sections and is infinite? I've read many other questions/answers about random level generation but most of them deal with either randomly/proceduraly generating 2D levels viewed from the side or 3D levels. What I'm trying to achieve is sort of like you were looking straight down on a Minecraft map. There is no height, but the borders of each "biome" or "section" of the map are random and varied. I already have basic code that can generate a perfectly square level with the same tileset (randomly picking segments from the tileset image), but I've encountered a major issue for wanting the level to be infinite: Beyond a certain point, the tiles' positions become negative on one or both of the axis. The code I use to only draw tiles the player can see relies on taking the tiles position and converting it to the index number that represents it in the array. As you well know, arrays cannot have a negative index. Here is some of my code:

This generates the square (or rectangle) of tiles:

    //Scale is in tiles
    public void Generate(int sX, int sY)
    {
        scaleX = sX;
        scaleY = sY;

        for (int y = 0; y <= scaleY; y++)
        {
            tiles.Add(new List<Tile>());

            for (int x = 0; x <= scaleX; x++)
            {
                tiles[tiles.Count - 1].Add(tileset.randomTile(x * tileset.TileSize, y * tileset.TileSize));
            }
        }
    }

Before I changed the code after realizing an array index couldn't be negative my for loops looked something like this to center the map around (0, 0):

for (int y = -scaleY / 2; y <= scaleY / 2; y++)
for (int x = -scaleX / 2; x <= scaleX / 2; x++)

Here is the code that draws the tiles:

            int startX = (int)Math.Floor((player.Position.X - (graphics.Viewport.Width) - tileset.TileSize) / tileset.TileSize);
        int endX = (int)Math.Ceiling((player.Position.X + (graphics.Viewport.Width) + tileset.TileSize) / tileset.TileSize);
        int startY = (int)Math.Floor((player.Position.Y - (graphics.Viewport.Height) - tileset.TileSize) / tileset.TileSize);
        int endY = (int)Math.Ceiling((player.Position.Y + (graphics.Viewport.Height) + tileset.TileSize) / tileset.TileSize);

        for (int y = startY; y < endY; y++)
        {
            for (int x = startX; x < endX; x++)
            {
                if (x >= 0 && y >= 0 && x <= scaleX && y <= scaleY)
                    tiles[y][x].Draw(spriteBatch);
            }
        }

So to summarize what I'm asking: First, how do I randomly generate a top-down 2D map with different sections (not chunks per se, but areas with different tile sets) and second, how do I get past this negative array index issue?

sentences:
How to rotate HingeJoint2D by code? I am trying to set the rotation of a HingeJoint2D by code, but the 'rotation' property is get-only. I tried setting the limits to my current rotation, but that doesn't work either. What's the proper way of doing it?

bowJoint.limits = new JointAngleLimits2D() { max = rotation, min = rotation };

sentences:
How to hide a sprite on trigger when the player enters the trigger zone? I am making a roof for my 2D top down survival game, and I want to make it so that the roof disappears when the player enters the building, and re-appears when they leave.
Here is the code I've written so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Roof : MonoBehaviour {
    public GameObject roofGameObject;

    void OnTriggerEnter2D(Collider2D collision) {
        roofGameObject.SetActive(false);
    }

    void OnTriggerExit2D(Collider2D collision) {
        roofGameObject.SetActive(true);
    }
}

I got it to work so that, when I go in, the roof it disappears. But when I leave it stays disappeared. How can I fix that?

sentences:
Preventing diagonal movement I was originally fine with diagonal movement but it's clashing with my sprite animation...

    public void keyPressed(KeyEvent e){
    int key = e.getKeyCode();

    switch(key){
        case KeyEvent.VK_W:{
            dir = 3;
            velY = -speed;
            break;
        }
        case KeyEvent.VK_S:{
            dir = 2;
            velY = speed;
            break;
        }
        case KeyEvent.VK_A:{
            dir = 1;
            velX = -speed;
            break;
        }
        case KeyEvent.VK_D:{
            dir  = 0;
            velX = speed;
            break;
        }
    }
}

public void keyReleased(KeyEvent e){
    int key = e.getKeyCode();

    switch(key){
        case KeyEvent.VK_W:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_S:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_A:{
            velX = 0;
            break;
        }
        case KeyEvent.VK_D:{
            velX = 0;
            break;
        }
    }
}

    public void update(){
    y += velY;
    x += velX;
}

I thought that perhaps a switch statement or an if else statement would prevent multiple keys from firing at once, but it's not working out. I even tried synchronizing some methods but still to no avail. Any suggestions? And please ignore the dir variable I use it to find the direction the player is facing.

sentences:
What is the transformation order when using the Transform Class? I am currently using Unity 5.5 for the first time in a project and I've got some problems regarding transformations.

I've got a background in more general 3D graphics meaning that I'm used to manually manage scene graphs and matrix transformation orders.

My greatest problem when moving to Unity, and using their built in Transform Class, is that I can't find any information regarding the transformation order of rotation, localrotation, scaling, localscaling, position and localposition.

I can't find any good information of this and It's driving me slightly mad.

TL;DR: What's the transformation order of the Transform class?

sentences:
How to handle grid snapping when the object is greater than the grid cell width and height? I want to be able to move objects on a grid always by what the grid cell size is, and objects bigger than the grid size should not overlap.

The cube in this GIF below is snapping how I want (1 x 1).

If I then change the size of the object, it doesn't snap to the grid quite how I would like.  It snaps, but overlaps.  I don't want an object to overlap the grid cell.

The snapping code is pretty straight forward and has been posted quite a lot and seems to work fine.

pos.x = Mathf.Round(hit.point.x + (hitNormal.x * objScale.x)) * gridSize;
pos.y = Mathf.Round(hit.point.y + (hitNormal.y * objScale.y)) * gridSize;
pos.z = Mathf.Round(hit.point.z + (hitNormal.z * objScale.z)) * gridSize;

I was thinking that I need to somehow set a pivot  / anchor point, but I wouldn't want that to be one corner of the object, I was thinking somehow I could find the center of the object and work from there so it can snap correctly.  Not sure if this is correct, or how to work that out.

Edit: More code added to show how I am moving objects around currently.

Objects are placed in the world by ray casting.  I don't use any grid array to know the location of objects on the grid.

For placement testing (i.e object inside another) this is handled already but removed that part of the code.  For that I am doing a simple box overlap test which works nicely.

float gridSize = 1f;
Vector3 hitNormal = hit.normal.normalized;
Vector3 localObjScale = transform.localScale;

// - "Determine the minimum grid space this shape will use up"
// Objects will always be whole numbers.  i.e 2w x 1h x 1l (like second GIF)
int cellWidth = Mathf.RoundToInt(localObjScale.x);
int cellsHeight = Mathf.RoundToInt(localObjScale.y);
int cellsLength = Mathf.RoundToInt(localObjScale.z);

Vector3 objScale = localObjScale / 2f; // This sets the pivot to the center
Vector3 pos = Vector3.zero;

// Snap
pos.x = Mathf.Round(hit.point.x + (hitNormal.x * objScale.x)) * gridSize;
pos.y = Mathf.Round(hit.point.y + (hitNormal.y * objScale.y)) * gridSize;
pos.z = Mathf.Round(hit.point.z + (hitNormal.z * objScale.z)) * gridSize;

transform.position = pos;

sentences:
Handling User Input with Simple Hit Test Currently in my project, the way I handle user input events is through the OS Framework, then create a generic object - basically combines all types of input: keyboard, mouse, touch, trackball, etc. all together - this object gets queued and then on update gets processed. The queuing of objects is done on the UI thread - created by the OS - and the processing of the queue on another thread - one that I have generated. I handle the threads by using turn-based concurrency.

My problem is I worry about lag of the input events when there are fast moving objects, and I am curious to see if there are better ways of handling the input events then currently?

My current idea, of handling the simple hit test of fast moving objects with user input, is that I try and use the timestamp generated by the event to work out where everything was at that time, but it seem like a lot of work - probably because the way I have implemented everything on the update side - so is there a better way?

I did think about adding a bulk of data on the generic object creation, but there might be a lag between the creation and the actual event - on Java, I have to go through JNI and the generic object is always created on the native side. So I feel that the timestamp is my best solution. If anyone has any better ideas, it would be great to hear them.

sentences:
Libgdx stage rendering issues I'm using scene2d for the first time, and I can't get anything to draw EXCEPT the stage ui. Say I have my ui on top of my game screen:

uiStage.act():
batch.begin();
gameSprite.draw(batch); //does not show up
uiStage.draw();
batch.end();

How can I render my game, and then render my gui stage on top? Should I use a stage for both the game and the ui?

sentences:
How to Bring the Scene View Camera Controls into Game View I've got a scene with a big sphere in the centre (the Earth) and a lot of smaller spheres around (the stars).

Above is a screengrab in Scene View with the camera in the Front View position.

I really like the controls in Unity's Scene View when moving around the viewport and I was wondering whether it can be brought into the Game View.

How can I do this?

sentences:
Placing tile on second layer results in wrong tile, or changes nearby tiles So I am working on a 2d game and running into strange behavior when trying to add tiles to a tile map.

The first layer seems to work fine but if I add a new layer it will always place the same tile regardless of which tile I choose from the palette. Sometimes placing a tile changes tiles that were already placed elsewhere. Here is a video of the behavior, excerpted as a gif below:

It looks like it might be related to this bug:

UE-72279: Paper2D Tilemap doesn't render tiles correctly when more than one layer is added.

How can I solve this issue, to control the placement of tiles on my second layer?

sentences:
Does converting quaternion to matrix cause a lot of overhead? This is related to rendering creating a model, view, projection matrix for opengl. While matrix are fairly standard there's a lot of talk about using quaternions for rotations but why would u go from quaternions to matrix and back to matrix?

Quaternions might be faster but if you have to switch to matrix and back again doesn't that overhead eat into using just matrix only?

Is the typical workflow for using quaternions with matrix is to let the quaternion handle the rotation then create a 4x4 matrix from that rotation to concat with translation/ scale matrix in the model->view->projection matrix stack?

Does converting quaternion to matrix cause a lot of overhead?

sentences:
How to design enemies pattern in non-bullet-hell shmups in Unity? I am making a top down shooter.

Enemies will come in waves and attack in many different patterns (i.e. wave of 10 enemies flying in a elliptic curves, or a huge boss floating and shooting at you, etc.).

I'm thinking of 2 solutions:

Design paths using an animation tool
Hard-code paths

For the first solution, I think it will be faster to create the paths since I will be able to see them in the tool, but is it performant? There will be hundreds of flying patterns in my game.

I've also heard of BulletML, but looks like it's more for bullet-hell shmups, and there's no visual editor to design the patterns easily.

Are there other solutions to design path patterns for non-bullet-hell shmups which I haven't considered?

What are the pros/cons of each solution?

sentences:
How can I automate high-level user interactions to test correctness of my game? I am trying to automatically simulate the game experience in my programming game. I think Expect is the way to do it because it creates its own tty for the process, becoming independent process of the main process but I want that some key sequence is pressed down in some pattern, such as press the key Z down every minute or press this that with this that pauses, without really expecting any specific file descriptors. Is there some ready programs to automate this kind of high-level debugging?

I have access to obsd and ubuntu.

sentences:
Good book/resource recommendation for HTML5 mobile game development? The problem: I am taking an existing, 5 year old, html based MMORTS game and "HTML5-ing" it, "AJAX-ing" it and most importantly, optimizing for mobile devices like iPhone, android etc. For these devices, the application will be packaged as a downloadable app that is a wrapper for a browser which actually shows the game..

The Question
Looking for a good book, or books, or in-depth articles that would help me learn:

what tools I have in iOS, andriod applications for optimizing an html based game. things like caching of images, etc
what kind of connectivity, or interactivity I can expect between the html/javascript pages and the wrapper - can I play sounds in the wrapper by triggering them from javascript? etc
tip and tricks to optimize html/html5 & Javascript application to run well on mobile devices
ETC :)

Any recommendations would be greatly appreciated!!

sentences:
Storing game data on user end? A thought occurred to me after seeing this question:
Storing data - think character data for an online game - on the user`s computer is definitely less safe (maybe an understatement) than on a server under your control, but...

Is such a mechanism feasible? (while preventing cheating and such, of course...) If yes - why is it not used? Is it just me who hadn't seen it?

Some elaboration and ramblings:

A hypothetical advantage to this would be a need to store VERY little data on the server itself while still being able to handle a HUGE bookkeeping for the character, recording amounts of data you wouldn't dream of while storing the data on your server (think looking back on the exact date of your first attack in a game... sweet, useless, nostalgia :) ).

(Of course, there's a limit to how much you would do this way as well - your user isn't likely to condone a 1GB game save file... or they would... who knows.
Maybe an option for what data to keep could give users the choice between conservative and extensive logging of their adventures?)

Take the following example: I think that an attempt to:

Store a hash of the user's data on the server.
On the next run, request the data from the user`s end.
Hash it.
Compare the hashes.

is bound to fail.

The user could change the data on his end after the verification.
I'm assuming there will always be a 'hole' somewhere even if the programmer utilizes tons of checks throughout the game, verifying every action.

This could very well be a reason for not doing this... just remember I'm asking about feasibility, not practicality.

There are some more considerations, of course:

The user's data being at their hands can be less safe and less available.
They could lose it, have it stolen, forget their flash drive containing the file at home etc etc.

But it could also mean that the server has very little data on it to be compromised - say, if all of the user's data will be in their file, and the server will only be able to verify its authenticity via hashing mechanism and whatnot.

It will also be very easy to back up a server containing so little data.

The mechanism for the user should be a simple encryption/signature of the data file... or is that bound to fail as well?

sentences:
GraphicRaycaster on the child object containing buttons blocks Raycast from the parent object containing GraphicRaycaster. How to solve it? What I'm trying to achieve is to detect clicks on buttons in UI. Here is the tree:
I have a parent object SlotMachineScreen containing GraphicRaycaster with a script detecting clicks attached to it:
if (Input.anyKeyDown)
        {
            //Set up the new Pointer Event
            m_PointerEventData = new PointerEventData(null);
            //Set the Pointer Event Position to that of the mouse position
            m_PointerEventData.position = Input.mousePosition;

            //Create a list of Raycast Results
            List<RaycastResult> results = new List<RaycastResult>();

            //Raycast using the Graphics Raycaster and mouse click position
            m_Raycaster.Raycast(m_PointerEventData, results);
            foreach (RaycastResult result in results)
            {
                Debug.LogWarning("Hit " + result.gameObject.name);
            }
        }

And there are a bunch of child objects with a GraphicRaycaster (red ones) with buttons in it, that I want to detect a click on. But there is no response from my sprit at all when I click on them.
I found one solution so far, but its not what I need: the solution is to move all buttons from child containers to SlotMachineScreen.
Are there any different ways to solve this problem?

sentences:
How is RTS Local Avoidance Done? Currently, I'm simulating physics impact forces for local avoidance of units but this method sometimes pushes units out of formation and has very undesirable effects when units clump up.

For RTS games like Starcraft 2, how is local avoidance done? Are physics simulated or an omnicient controller decides where everything should be? I know this question might be a little broad so I'm asking specifically for how to achieve the local avoidance behaviors of Starcraft 2; though anything that works will be very appreciated.

I'm not looking for any code - just useful resources or explanations of how Starcraft 2 (or similar games) handles local avoidance.

Currently, I have collision detection (with penetration vector), collision forces, and movement by velocity implemented. Every unit is checked against another for a collision - if they collide, the objects are immediately offset by the penetration vector then the collision force is applied. Then another loop moves the objects by their velocities and applies drag to the velocities. The offset mitigates the problem of excessive collision forces applied on clumped units, but units still sometimes shoot out.

The solution I'm looking for needs to satisfy the following requirements (as in Starcraft 2):

Objects musn't overlap; or at least overlaps must be eventually
resolved.
Objects don't push each other away more than necessary so 2 units can stand and move next to each other in a formation.
There should not be any weird behaviors when objects clump towards the same destination.
Can support units of different sizes, and even different convex shapes.

What I've been thinking of so far is instead of detecting for collisions, detect for future collisions so the overlap never happens. Then apply the constraint, making sure the 2 units' velocities don't cause them to overlap. I'm still tinkering with the algorithm for restricting movement beyond the overlap.

sentences:
render trajectory of particle in forcefield using GLSL shader I want to visualize flow of particles in some forcefield e.g. electromagetic, gravitional or potential flow in fluid (streamlines);

I was thinking to use Geometry Shader which would look like this (not tested, just sketch):

#version 330 core
layout (points) in;
layout (line_strip, max_vertices = 64) out;

uniform float dt;

vec3 getForce(in vec3 pos){ /* ... don't care now ... */ }

void main() {
    vec3 pos = gl_in[0].gl_Position;
    for( int i=0; i<64; i++ ){
        pos += getForce(pos) * dt; // it's actually velocity field but who cares
        gl_Position = pos;
        EmitVertex();
    }
    EndPrimitive();
}

However, I read that Geometry shaders are very slow (I did not yet tested). So I wonder if it would be helpful in this situation?

Or would Tesselation shaders or Compute shaders be suitable for this job and achieving better performance?.

background: I have experience with vertex-shaders, fragment-shaders, OpenCL ... but I have never tried geometry-,tesselation- nor compute-shaders.

EDIT: there is my simple example implementation using geometry shader in 2D
https://github.com/ProkopHapala/SimpleSimulationEngine/blob/ca16b6f8d72864a8a572ed2a21ded99c5c2cc3e4/cpp/sketches_SDL/OGL3/test_GeometryShader.cpp

which plots this (for velocity field defined by dipole):

sentences:
Capsule collider triggered unexpectedly I have an object with a capsule collider on its root, with IsTrigger=true (triggered by the player). The trigger works fine, but is also triggered unexpectedly some times when the player walks near the collider, but still way out of its range.

See attached image: the capsule collider limits are wel within the round circle object. On the right you see that the player has triggered the trigger, while it was far away from the collider.

When I run circles around the collider, this will happen sometimes. Location appears to be random and it doesnt happen if the player is further away than say 10 meters.

Anyone else have this issue or can tell me what is causing it?

sentences:
switch between player camera/non-camera positioning Sorry if this sounds ambiguous. But I am writing a traditional top down game.
And normally the player would be centered in the middle while moving the orthographic camera. However, I would like this to be dynamic. Therefore, use player.setPosition(x,y) near screen boundaries but center on player if its far from screen boundary.

This is some sample code:

public void centerCamOnPlayer() {
         camera.position.set(player.getX() + (player.sprite.getOriginX()),
                             player.getY() + (player.sprite.getOriginY()),
                             0);
}

public void update() {
     boolean shouldCenterOnChar = ???;
     if (shouldCenterOnChar) {
         centerCamOnPlayer();
     } else {
         player.setPosition(x,y);
     }
}

Therefore render will call update(). However how do I determine the shouldCenterOnChar?
I tried using frustum.pointInFrustum but its only when the sprite moves completely out of screen. I'm sure there is a better way to switch dynamically. Any one has an idea? Tks!

sentences:
What implications does JIT (javascript/canvas) vs. AOT (Flash) have in terms of browser based game performance? In my experience, even till this day, I still see more of a visual lag in entity movement / animation in JavaScript (Canvas) based games than I do in Flash based games.

Why is this - what exactly is the descrepancy at the most basic level between an JIT vs AOT compiler in the specific scenario of JavaScript vs. Flash.

sentences:
Only send moves for P2P 2 player LAN game? I am making a 2D network game. The concept is simple, a player have to shoot the other player to win. I'd like to improve this game ( add a map, items, monsters, w/e ), but later.

This is my first network programming experience. I have little theorical knowledges about packets, sockets, client/server side, what is dangerous to do client sided, but I've never really used them.

Goals set :

This is a 2 players LAN game, no more no less.
No server. Player 1 starts the game waiting for player 2...
... which leads the game open for reverse engineering or packet editing, but w/e, for this kind of game I prefer simplicity over security.

Pretty basic. For a first network game that will never be shared, I take off problems and will see later.

This is where I am : each player is a square that can move in four directions. The approach :

TCP Packets.
Each movement ( each frame a key is pressed to be accurate ), a packet is sent to the other player with his position.
Packets are received each frames before drawing and updating game elements, in the same thread, with a non-blocking receive() function.

And that's it.

My questions :

Is sending a packet for each moves overkill? Will I have problems with this later?
What kind of problem can I meet? mono-thread + non blocking function will be a problem later, assuming the goals I've set?

sentences:
Have any video game designs used non-uniform random numbers in interesting ways? A variety of video games use uniformly distributed numbers to decide the outcome of an event, such as a "50% chance to hit" almost always means to check if a random floating point number from 0-1 is greater than 0.5. Many games will layer a few of these uniform percentages on top of each other, for instance a D&D hit roll is a uniformly distributed number from 1-20, except that 1 and 20 have special outcomes. To my mind it seems like things like critical hits are added by designers to try and emulate the fact that in reality hitting/missing or winning/losing is not actually a binary outcome.

In many cases the real life amount of "damage" done by an attack would likely be closer to a gaussian/bell curve distribution, which many results in the middle but the occasional very exciting outlier and smooth curve connecting them. Dice games like Settlers of Catan emulate gaussian distributions by adding together multiple independent rolls, but I feel like I've almost never seen this mechanic in video games.

It seems like games like Civilization (Sid Meier talked extensively at GDC about player perception not matching the actual math used in the game) would benefit from results that matched how things work in the real world. Have any video games used a gaussian or otherwise non-uniform distribution of random numbers in interesting ways?

sentences:
Sharing the XNA executable of my game on dropbox I'm currently making a game and I have my artist living in a different city as me.  We share a dropbox folder so that I can see her art, and I thought it should be easy to copy the debug bin folder into the dropbox so that she can see it.  This doesn't work (I can't even run it), so what could I do?

EDIT:

I run the executable in the dropbox folder, and immediately I get the "game.exe" has stopped working.  So obviously I have XNA installed, but my game can't run in this folder.

sentences:
Unreal Engine 4: Help with multithreading and accessing render target images I am working on an application where I need to record images seen from an in-game camera. Initially, the method was to set up a TextureRenderTargetResource from the in-game capture component, and subsequently call ReadPixels to access the frame data and save that data as an image. (code flow below)

bool saveImage() {
  USceneCaptureComponent2D* capture = getCaptureComponent(camera_type, true);
  FTextureRenderTargetResource* RenderResource = capture->TextureTarget->GameThread_GetRenderTargetResource();
  width = capture->TextureTarget->GetSurfaceWidth();
  height = capture->TextureTarget->GetSurfaceHeight();

  TArray<FColor> imageColor;
  imageColor.AddUninitialized(width * height);
  RenderResource->ReadPixels(bmp);
}

This approach was slowing the game thread down significantly, so I am trying to move the screenshot saving procedure to its own thread. My approach now is inspired by the article at https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4. I access the *AActor object from this separate thread and subsequently its camera, and then I call the saveImage() function from the thread: but this is resulting in a crash with no additional information (just "UE4Editor.exe has triggered an exception") at the call to ReadPixels(). So essentially, calling saveImage() and thereby ReadPixels() from the game thread works perfectly, and it fails when I call it from a different thread. Am I doing something wrong in my process here?

sentences:
Displaying an image when ScrollPane item is highlighted I would like to have images displayed when an item in the list is highlighted as a form of a "preview" of the map that is selected. I'm not sure how i would implement this with clickListeners or things of that sort as I am new to libgdx and would like some assistance in making this happen. For example the transition between the images following:

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;

public class LevelSelect implements Screen {

private Stage stage;
private Table table;
private Label heading;
private BitmapFont white, black;
private TextureAtlas atlas;
private Skin skin;
private List<String> list;
private ScrollPane scrollPane;
private TextButton play, back;
private String[] items = new String[] { "UNDECIDED", "\"East Side!!! West Side!!!\"" };

@Override
public void show() {

    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/atlas.pack");
    skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    list = new List<String>(skin);
    list.setItems(items);

    white = new BitmapFont(Gdx.files.internal("font/fd.fnt"), false);
    black = new BitmapFont(Gdx.files.internal("font/fd2.fnt"), false);
    LabelStyle headingStyle = new LabelStyle(black, Color.WHITE);
    heading = new Label("Level Select", headingStyle);
    heading.setFontScale(3);

    scrollPane = new ScrollPane(list, skin);

    play = new TextButton("PLAY", skin);
    back = new TextButton("BACK", skin);
    back.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y)
        {
            ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
        }
    });

    //TEXTURES FOR MAP PREVIEW
    Texture kingdoms_0 = new Texture(Gdx.files.internal("image/mapPreview/kingdoms_0"));
    Image kingdoms_0_pic = new Image(kingdoms_0);
    Texture kingdoms_1 = new Texture(Gdx.files.internal("image/mapPreview/kingdoms_1"));
    Image kingdoms_1_pic = new Image(kingdoms_1);

    table.add(heading).center().colspan(3).row();
    table.add(scrollPane).expandY().left();
    table.add(kingdoms_0_pic).row();
    table.add(play);
    table.add(back);

    stage.addActor(table);
}

@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();

}

@Override
public void resize(int width, int height) {
    stage.getViewport().update(width, height, false);
    table.setFillParent(true);
}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {
    stage.dispose();
    atlas.dispose();
    skin.dispose();
}

}

Help is greatly appreciated!

sentences:
LibGDx android : Show animation on button click I am trying to create an application using libgdx where i need an animation to be played on pressing an image button, i've been able to achieve it using this code

   if(slapBossFlag==true) {
        currentFrame = animation.getKeyFrame(timePassed, true);
            batch.begin();
            timePassed += Gdx.graphics.getDeltaTime();
        Gdx.app.log("time","time is"+timePassed);
            batch.draw(currentFrame, screenWidth / 2 - ((currentFrame.getRegionWidth()) / 2), screenHeight / 2 - ((currentFrame.getRegionHeight()) / 2));
            batch.end();
            slapBossFlag = false;
    }

the problem is the animation goes by too quickly.

i've tried setting timePassed to zero when slapBossFlag is false, and that didnt work.

Can anyone help?

sentences: How can I maintain a contiguous area when generating a tilemap using Wave Function Collapse? I'm using Wave Function Collapse to generate a tilemap, and I'm trying to come up with a way to maintain a contiguous area during generation. As an example: ensuring all "walkable" tiles are contiguous such that no "walkable" tile is blocked off from another. An acceptable outcome would also be ensuring there is a contiguous path between two (or more) designated tiles. I'm thinking there may be some way to determine how likely any given tile is to bisect a contiguous area and integrate that into the entropy calculation, but I'm not sure how I would determine that.

sentences:
What's a good way to check that a player has clicked on an object in a 3D game? I'm programming a 3D game (using C++ and OpenGL), and I have a few 3D objects in the scene, we can say they are boxes for this example. I want to let the player click on those boxes to select them (ie. they might change color) with the typical restriction like if more than one box is located where the user clicked, only the one closest to the camera would get selected.

What would be the best way to do this? The fact that these objects go through several transforms before getting to window coordinates is what makes this a bit tricky.

One approach I thought about was that if the player clicks on the screen, I could normalize the x,y coordinates of mouse click and then transform the bounding box coordinates of the objects into clip-space so that I could compare then to the normalized mouse coordinates. I guess I could then do some sort of ray-box collision test to see if any objects lie as the path of the mouse click. I'm afraid I might be over complicating it. Any better methods out there?

sentences:
AI-possessed Pawn flies off at incredibly high speed immediately after hitting play (UE4) I have a very simple pawn with a Sphere Collision and a child Static Mesh. This pawn is set to be possessed by an AI Controller on spawn and the AI Controller basically sets up the blackboard and runs the behaviour tree. The behaviour tree is set to do nothing. As soon as I hit play in the editor, the pawn falls to the floor and bounces off at speeds almost too fast to see and quickly flies out of the edges of the worldmap and gets deleted.

alt text

In the picture above, the blurred blue thing is the object thats rocketing away.

I've been stuck on this for a very long time, any help is appreciated.

sentences:
How to create more vertexes from within a shader in OpenGL? when rendering voxels in octrees, the only information necessary is the current octree-level, -position and colour/texture.
But one has to send eight vertices to the rendering pipeline in order to render a complete cube and still needs colour/texture.

Is there a better way?

Since geometry-shaders wont be wide-spread for quite some time the "emit_vertex"-method in the geometry-pass wont suffice (or am i wrong? i don't think mesa currently supports geometry-shaders).
Also, afaik, backface-culling is done before the geometry-pass, so that would lead to additional overhead.

My current idea is to send 'dummy vertices' and have the actual drawing data in between but that really shouldn't be the solution.

kind regards

sentences:
Memory leak with glfwSetWindowTitle? I am using GLFW for a game, and I have a function which allows me to set the window title.

    // PROBLEM WITH INCREASING MEMORY USAGE
    void WindowSystem::setTitle( const string & title )
    {

        glfwSetWindowTitle( window, title.c_str() );

    }

This function is called once during every iteration of the main program loop, so that I can have a basic FPS counter. Under Xcode the program memory usage increases faster and faster. If I replace title.c_str() with a literal, the problem does not happen, i.e., the following does not cause the same memory usage growth.

        // DOESN'T CAUSE PROBLEM
        void WindowSystem::setTitle( const string & title )
        {

            glfwSetWindowTitle( window, "Hello world!" );

        }

This where the function is called.

    int SystemControl::update()
    {
        double time = glfwGetTime();
        double timeStep = time - control->lastUpdate;
        control->lastUpdate = time;

        float frameRate = 1.0f / timeStep;

        string windowTitle = std::to_string( frameRate );

        control->windowSystem->setTitle( windowTitle );

        control->physicsSystem->update( timeStep );

        return OK;
    }

The string title is allocated on the stack, and should be freed at the end of update. Could there possibly be a memory leak? I understand that the pointer for c_str() is internally managed, and does not need to be freed.

sentences:
Is there any reason not to save skinning animation data in texture? I have thought about saving animation data in texture. I think I can save shader parameter setting and interpolation cost in CPU, and also enable animated instancing.

But I couldn't find no text mentioning about this, so I think there's some obvious reason people don't do this. Which I'm missing.

Can I know what I missed? Or is this just widely known technique?

sentences:
Who has the rights to the party game Mafia / Werewolf? Who has the rights to the party game Mafia / Werewolf?

Or is it public domain, meaning anyone can do an implementation of the game and release it as a commercial product?

Update 1:
According to this question:
Making a mobile app from a board game. Copyright infringement?

You can't copyright concepts or mechanics. This basically means this should be public domain, right?

sentences:
What's the name of the "Candy Crush" style of game? I'm currently creating an engine trying to auto-play games with a chess board, and I'm writing a report about it now.

However, I found it hard to properly describe it -- for the games like Candy Crush, which has a game board, filled with "candies," and a few rules.. is there a formal classification for it?

Is "board-game" a proper name? What about "rectangle-tile game", or "chessboard-based game?"

sentences:
Sharing VBO with multiple objects and fixed size buffer data I'm just messing around with OpenGL and getting some basic structures in place and my first attempt resulted in each SceneObject class (just contains vertex information right now) having it's own VBO inside it, however I've read that it might be better to share VBOs across multiple objects.

Also, I read that you should avoid resizing a VBO (repeated calls to glBufferData with different size parameters), and instead choose a fixed size for a VBO, and just try a range from the buffer. I don't think changing the size of the buffer data would happen too often, but surely it would be better to only allocate the data you need? Choosing an arbitrary value seems risky.

I'm looking for some advice on working with individual objects in a scene and their associated buffer data.

sentences:
Unity C# Input Buffering So, I've got a fighting game with some pretty tight input windows, and I'd like to buffer the inputs for a few frames.

Basically, if the fighter is in the neutral state, pressing attack should lead into an attack. It uses Input.GetButtonDown("attack") to get the button, and if it detects a press, transitions into attacking state. Now, let's suppose the fighter has just landed, and ends up hitting "attack" a few frames before the land animation ends and he transitions back into neutral. As of right now, nothing would happen, since he's not in the neutral state where the check is, and when he enters the state, the button press is no longer happening.

Is there a way to store inputs for a few frames, so that I can read a button press a few frames back? So, instead of using Input.GetButtonDown("attack"), it'd be something like InputBuffer.KeyBuffered("attack",12) to see if the button was pressed within 12 frames?

The example above is just a bit of a simplification, I know for the above situation I could just use GetButton instead of GetButtonDown, but for a fighting game, you can imagine that the necessary inputs to buffer would get significantly more complicated.

sentences:
From Position/Target to Orientation/Elevation I have an orbit camera class that calculates the camera position from Orientation/Elevation and distance from target. I decided to replace these initial values for the camera instantiation with simply Vector3's position and target. How do I calculate Orientation/Elevation and distance from target from these two vectors?

I only got as far as creating a Matrix (Matrix.LookAt) and decomposing it. The translation that can be used for the distance from target partition is trivial, but what do I do with the Quaternion portion to get the elevation/orientation?

sentences:
Why is Cinemachine Virtual Camera locking my camera position to the Origin? I want the camera to follow a character as he moves around.  So I did the following:

Position the camera behind and slightly above the character.
Add a Cinemachine Brain component to the camera.
Create a GameObject containing a Cinemachine Virtual Camera component.  Set its LookAt and Follow properties to the character to be followed.
Run the game.

I expect for the camera to follow the character, more or less maintaining the relative position and orientation I had set for it. (ie. more or less as if the camera object was parented to it, but smoother.)
If I use the Cinemachine Free Look camera, this is basically how it works, except that it only deals with following and I have to maintain the orientation manually with the mouse.  But if I use Cinemachine Virtual Camera, because I don't want to deal with the free look part of it, for some bizarre reason it locks the position of the GameObject containing the camera to (0, 0, 0)!  And I don't just mean it moves it there; it's stuck there!  If I go into the Inspector and change the position at runtime, it instantly changes back to (0, 0, 0).
What can cause Cinemachine Virtual Camera to do this?  And how can I make it stop?

sentences:
What sort of data should be sent for mouse-based movement in a multiplayer game? I'm new to the Multiplayer Rodeo here so please bear with me...

I am just getting started and I'm trying to figure out how to deal with movement.
I've looked at the question Best way to implement mouse-based movement in MMOG which gives me a pretty good idea, but I'm still struggling with what kind of data should be sent to the server.

If a player is on position [x:0, y:0] and I click with the mouse on [x:40, y:40] to start movement, what information should I send to the server? Should I calculate the position based on velocity on client side and just send the expected location? Or should I send current location and velocity and direction? When the server is updating the clients on the players' whereabouts, should the position be sent only, and the clients expected to interpolate/predict movement, or can the direction sent from the client (instead of just coordinates) be used.

My concern(or confusion) is regarding the ping/lag frequency of data update and use of a predictive algorithm, as I'd like the movement to be smooth even with a high latency, and prevent ability to cheat(though that's not the top priority).

sentences:
Hide building roof & Hide faces/vertices depending on world location I'm currently developing a small game for my own enjoyment and I've ran into a problem. As you probably know many third person games (such as Runescape and XCOM, for example) hide the roofs when you enter a building so that you can still see your character. I'm using lwjgl and my current solution is to use clipping planes to simply stop rendering everything above a certain height when the player is inside of a building, but this gives bad results because if there are other buildings or tall entities nearby they are also not rendered above that plane.

I've thought of some solutions - one of them being to simply hide certain faces/vertices when I'm in certain areas. This could also be applied to other things than just buildings as well. Is this the right way to approach this problem? Or is there a better way to handle this?

PS. I'm not very experienced with openGL (especially shaders), so if the solution requires shader work I might need more detailed descriptions.

sentences:
Jmonkey loading texture from fails I have the following basic code:

public void simpleInitApp() {
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Texture cube1Tex = assetManager.loadTexture(
    "/home/glados/codes/3/assets/Textures/map/oldParchment.jpg");

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", cube1Tex);
    geom.setMaterial(mat);

    rootNode.attachChild(geom);
}

which is supposed to simply attach a texture to the cube loaded from Textures/map/oldParchment.jpg

My resource setup is as following:

running this gives the following error:

com.jme3.asset.AssetNotFoundException: /home/glados/codes/3/assets/Textures/map/oldParchment.jpg (Flipped) (Mipmapped)
    at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:283)
    at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:346)
    at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:356)
    at mygame.Main.simpleInitApp(Main.java:27)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
    at java.lang.Thread.run(Thread.java:744)

Anybody know what I'm doing wrong?

sentences:
What are the specific mathematics, physics, AI and general concepts a programmer should know in order to develop a game engine? Being a programmer of web and DB centered applications, I have knowledge in data structures such as lists, trees, graphs, etc. I honestly use very little of these data structure algorithms in my coding, except for sorting things in plain arrays, as I worked almost entirely with client-oriented frameworks where all the core functionality was built-in. I know C, PHP, Java, HTML, PL/SQL and MySQL. I am currently learning Python.

I want start with game development. I have seen other questions regarding suggestions, tips and approaches to game development for beginners. I understand these point, and am clear with the answers. A few days after posting, I read the article Write Games, Not Engines, and realized I should implement a game before I create a game engine. Still, I have questions.

My aim is to

Improve my core level programming skills, including using data structure algorithms, mathematics and physics concepts.
Implement a good game engine, to indulge myself in core level coding.
To pave my way into the A.I. research field.

What are the specific mathematics, physics, AI and general concepts a programmer should know in order to develop a game engine?

sentences:
Path finding algorithm for (x,y) coordinates in c++ I am trying to code a path finding function in c++ . It should work like that, you supply the start point (x1,y1) and the end point(x2,y2) and it returns a list of points for the shortest path.

Assume that i want to go from the red tile to the blue one, however the grey tiles can not be walked on (like walls) .

sentences: Show procedural map without running the game? Currently I have a script that generates prefabs by code and I'm wondering if I could show a certain "seed" of that map without actually running the game. The reason why is that I often want to tweak things, and when I run the game and alter settings for objects like lights they get reset when I stop running the game and perhaps have some kind of button where I can reset the seed and see another generation of the map.

sentences:
How can I create a title screen demo? I am writing a 2D game in Unity and I want to offer an old-school style title screen demo (such as in Super Mario, etc.) where it shows a brief run through of either one or various levels. How would I accomplish this?

If anyone can either enlighten me or point me to some further reading then it would be very welcome.

sentences:
Resizing the window moves and stretches the texture I have a basic screen with 3 TextureRegions rendered on the screen rendered with this code(Ignore the hardcoded numbers, bad decision I know will be replaced later):

Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 225);
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 150);
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 75);
batch.end();

and it renders like this:

But if I resize the window it becomes like this:

Why does the texture become like that when the window is resized and what are the solutions?

P.S. I am aware of this question and it does not solve my problem

sentences:
Typical Method Of Building Puzzle Levels I am designing a puzzle game for the iphone and was wondering as most puzzle games consist of the player progressing through multiple levels. You see for example Angry Birds has over 100 levels.

Once the basis of the game is made, how do developers typically go about building their levels?

Do they generally build them from scratch each one more or less, or work of their own template or have some other method which they use to tailor these levels?

I imagine building so many levels is a long process, certainly if building each one individually. Do they do this, or have a method which speeds it up once they have their basis?

sentences:
Is it acceptable to buffer no data OpenGL? Correct me if I am wrong, but if you call "glBufferData(...)" upon an existing buffer, it will resize the buffer to whatever data you upload.

Does that mean if I call something like

glBufferData(GL_ARRAY_BUFFER, 0, NULL, GL_DYNAMIC_DRAW);

it will keep the buffer in existence, but it will have size and no data?

In the description of glBufferData, it says it is acceptable to pass NULL as a data parameter, but it mentions nothing of the size parameter.

sentences:
XNA graphics.PreferredBackBufferWidth's new value doesn't immediately change window size I set the width and height of the window in my game constructor, and then pass the graphics manager to a class to check the value. In the game's initialize function, it doesn't seem to recognize the new width and height values, so it uses the default.

Here's relevant code:

Game1.cs Constructor:

graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 1600;
graphics.PreferredBackBufferHeight = 900;
Content.RootDirectory = "Content";
World = new TestWorld(Content, graphics);

Game1.cs Initialize

World.Initialize();

TestWorld Initialize

Debug.WriteLine(Graphics.GraphicsDevice.Viewport.Width);

The TestWorld Initialize outputs the default (800).

I have tried graphics.ApplyChanges(), but it does not resolve the issue.

sentences:
Unity IUnityLifecycleManager already exists I followed this tutorial https://www.youtube.com/watch?v=OElh7wda4Qc in Unity version 2019.3.1f.1 Personal Edition, but I got 6 errors like this in the console, also I updated to version 3.4.4 via the package manager, because it said that the asset store version was not compatible anymore.

  Library\PackageCache\com.unity.ads@3.4.4\Runtime\Monetization\AndroidPlacementContentOperations.cs(55,40): error CS0433: The type 'IUnityLifecycleManager' exists in both 'UnityEngine.Advertisements.Editor, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Advertisements, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null'

This is the code I am using, its the same as the code in the official website, but personalized to my project.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

public class adsController : MonoBehaviour, IUnityAdsListener
{
    public bool testMode = true;
    public Button rewardedAd;

    private string storeID = "3509232";

    private string rewardedVideo = "rewardedVideo";

    private void Start()
    {
        rewardedAd.interactable = Advertisement.IsReady(rewardedVideo);
        rewardedAd.onClick.AddListener(ShowRewardedVideo);

        Advertisement.Initialize(storeID, testMode);
    }

    private void Update()
    {

    }

    private void ShowRewardedVideo()
    {
        Advertisement.Show(rewardedVideo);
    }

    // Implement IUnityAdsListener interface methods:
    public void OnUnityAdsReady(string placementId)
    {
        // If the ready Placement is rewarded, activate the button:
        if (placementId == rewardedVideo)
        {
            rewardedAd.interactable = true;
        }
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // Define conditional logic for each ad completion status:
        if (showResult == ShowResult.Finished)
        {
            // Reward the user for watching the ad to completion.
            Debug.Log("Reward");
        }
        else if (showResult == ShowResult.Skipped)
        {
            // Do not reward the user for skipping the ad.
            Debug.Log("Not Reward");
        }
        else if (showResult == ShowResult.Failed)
        {
            Debug.LogWarning("The ad did not finish due to an error.");
        }
    }

    public void OnUnityAdsDidError(string message)
    {
        // Log the error.
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // Optional actions to take when the end-users triggers an ad.
    }
}

EDIT:
Looks like I forgot a line in the code and reinstalling the unity ads package now it runs but still gives this warning.

  Please consider upgrading to the Packman Distribution of the Unity Ads SDK.  The Asset Store distribution will not longer be supported after Unity 2018.3

sentences:
Unity: Game objects in scene load incrementally and not at the same time I am using Unity in my Android app. When the app opens, I show the user data in the Unity scene. User data contains texts and images.

In order to load this data in the scene, I make a lot of
UnityPlayer.UnitySendMessage(GameObject,Function,Params)
calls to many C# scripts in Unity from Android. Each of these calls performs a specific task like loading an image, creating a text, applying the text font etc.

Problem is that the loading of this data right now looks incremental (if that's the right word). So the text is visible first and after a fraction of a second the image shows. Some text effects show later. This looks ugly.

How can I make all the UI elements load at the same time even if it takes some time? Is there a way to freeze the scene before each game object is ready to be drawn?

sentences:
Point inside a large polygon I am just starting to get into using pyBox2D as I already knew python well and I was wondering if I have 500 points of a large polygon, how would I be able to check if a point lies inside of this polygon. I tried to just make a polygon with 500 vertices but this isn't allowed in pyBox2D as the maximum vertices is 16.

I thought about splitting the polygon into many smaller polygons but I don't full know how to check if the point is inside all of these polygons. Do I need to create a body and add the polygon fixture or can I just use b2PolygonShape and then query the point from the shape?

I have been writing all my code using the github wiki for pyBox2D and they have a section on point querying a shape but I don't know how to implement this in my project.

sentences:
Unity based washing/ cleaning game advice I'm thinking about a way I can create a washing/ cleaning game as part of a project I'm working on within Unity, but given my lack of experience, I'm having trouble knowing where to start.

The goal is to be able to apply an effect of some kind to a Spine based character - which has a default 'idle' animation, and have the touch/ mouse positions remove the parts of the effect according to those positions.

I'm unsure how to go about creating such an effect - would I need to create a 'dirty' version of each sprite image used within the Spine imported character and make parts of it transparent, or would something like a shader be suitable?

While I have a lot of experience with C#, I have little experience with Unity, and having Googled for examples or tutorials or creating something like this, I'm left no better off...

I was hoping for some advice or pointers from the community...

Thanks!
Kieron

sentences:
Do you extend Java, to make games, or can you just use JFrame? I'm starting to create my own side scroller, in Java. I think I've read that, when you create a game in Java, there is something you can extend your class with, like GamePanel.

Is this true, or can you just use JFrame for your Java games?

sentences:
Baked lightmap errors in adjacent polygons Everything seems to work great, but in some parts of my model I get shadows like this

If I look at the light map, it looks bad:

What is the best approach to solve this issue?
Here my light settings:

sentences:
How can I draw crisp per-pixel images with OpenGL ES on Android? I have made many Android applications and games in Java before, however I am very new to OpenGL ES. Using guides online, I have made simple things in OpenGL ES, including a simple triangle and a cube.

I would like to make a 2D game with OpenGL ES, but what I've been doing isn't working quite so well, as the images I draw aren't to scale, and no matter what guide I use, the image is always choppy and not the right size (I'm debugging on my Nexus S).

How can I draw crisp, HD images to the screen with GL ES?

Here is an example of what happens when I try to do it:

And the actual image:

Here is how my texture is created:

//get id
int id = -1;
gl.glGenTextures(1, texture, 0);
id = texture[0];

//get bitmap
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ball);

//parameters
gl.glBindTexture(GL10.GL_TEXTURE_2D, id);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
        GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
        GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
        GL10.GL_REPLACE);

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

//crop image
mCropWorkspace[0] = 0;
mCropWorkspace[1] = height;
mCropWorkspace[2] = width;
mCropWorkspace[3] = -height;
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);

sentences:
Why when rotating object 360 degrees on the x, it rotates once then stops? using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class MeshGenerator : MonoBehaviour
{
    public GameObject meshPrefab;
    public Vector3[] newVertices;
    public Vector2[] newUV;
    public int[] newTriangles;

    private List<Vector3> verticesList = new List<Vector3>();
    private List<Vector2> uvsList = new List<Vector2>();
    private List<int> trianglesList = new List<int>();
    private GameObject go;

    private void Start()
    {
        Mesh meshprefab = meshPrefab.GetComponent<MeshFilter>().sharedMesh;
        newVertices = meshprefab.vertices;
        newTriangles = meshprefab.triangles;

        for (int i = 0; i < newVertices.Length - 2; i++)
        {
            DrawLine(newVertices[i], newVertices[i + 1], Color.red);
            DrawLine(newVertices[i + 1], newVertices[i + 2], Color.red);
            DrawLine(newVertices[i + 2], newVertices[i], Color.red);
        }
    }

    void DrawLine(Vector3 start, Vector3 end, Color color, float duration = 0.2f)
    {
        go = GameObject.Find("Lines");
        GameObject myLine = new GameObject();
        myLine.transform.parent = go.transform;
        myLine.transform.position = start;
        myLine.AddComponent<LineRenderer>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.endColor = color;
        lr.startWidth = 0.05f;
        lr.endWidth = 0.05f;
        lr.useWorldSpace = false;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }

    private void Update()
    {
        var p = go.transform.eulerAngles;
        p.x += 1;
        go.transform.eulerAngles = p;
    }
}

This is the rotation part:

private void Update()
    {
        var p = go.transform.eulerAngles;
        p.x += 1;
        go.transform.eulerAngles = p;
    }

It's rotating 360 degrees once, then it stops rotating but keeps shaking like it's trying to keep rotating but something keeps it from continue.

sentences:
How can I resolve collisions at different speeds, depending on the direction? I have, for all intents and purposes, a Triangle class that objects in my scene can collide with (In actuality, the right side of a parallelogram).

My collision detection and resolution code works fine for the purposes of preventing a gameobject from entering into the space of the Triangle, instead directing the movement along the edge.

The trouble is, the maximum speed along the x and y axis is not equivalent in my game, and moving along the Y axis (up or down) should take twice as long as an equivalent distance along the X axis (left or right).

Unfortunately, these speeds apply to the collision resolution too, and movement along the blue path above progresses twice as fast. What can I do in my collision resolution to make sure that the speedlimit for Y axis movement is obeyed in the latter case?

Collision Resolution for this case below (vecInput and velocity are the position and velocity vectors of the game object):

// y = mx+c
// solve for y. M = 2, x = input's x coord, c = rightYIntercept
lowY =  2*vecInput.x + parag.rightYIntercept ;

...

else
{
    // y = mx+c
    // vecInput.y = 2(x) + RightYIntercept
    // (vecInput.y - RightYIntercept) / 2 = x;

    //if velocity.Y (positive) greater than velocity.X (negative)
    //pushing from bottom, so push right.
    if(velocity.y > -1*velocity.x)
    {
            //change the input vector's x position to match the
            //y position on the shape's edge. Formula for line: Y = MX+C
            // M is 2, C is rightYIntercept, y is the input y, solve for X.
        vecInput = new Vector2((vecInput.y - parag.rightYIntercept)/2, vecInput.y);
        Debug.Log("adjusted rightwards");
    }
    else
    {
        vecInput = new Vector2( vecInput.x, lowY);
            Debug.Log("adjusted downwards");
    }
}

sentences:
How to process particle effect between UI? I'm developing a game with Unity3D. I found that particle effects would penetrate upper hierarchy UI. Can I show the effect when the UI's sibling index bigger then effect's and hide the effect when the UI's sibling index smaller then effect's?

Here is an illustration:

sentences:
How to keep a data structure synchronized over a network? Context

In the game I'm working on (a sort of a point and click graphic adventure), pretty much everything that happens in the game world is controlled by an action manager that is structured a bit like:

So for instance if the result of examining an object should make the character say hello, walk a bit and then sit down, I simply spawn the following code:

var actionGroup = actionManager.CreateGroup();
actionGroup.Add(new TalkAction("Guybrush", "Hello there!");
actionGroup.Add(new WalkAction("Guybrush", new Vector2(300, 300));
actionGroup.Add(new SetAnimationAction("Guybrush", "Sit"));

This creates a new action group (an entire line in the image above) and adds it to the manager. All of the groups are executed in parallel, but actions within each group are chained together so that the second one only starts after the first one finishes. When the last action in a group finishes, the group is destroyed.

Problem

Now I need to replicate this information across a network, so that in a multiplayer session, all players see the same thing. Serializing the individual actions is not the problem. But I'm an absolute beginner when it comes to networking and I have a few questions. I think for the sake of simplicity in this discussion we can abstract the action manager component to being simply:

var actionManager = new List<List<string>>();

How should I proceed to keep the contents of the above data structure syncronized between all players?

Besides the core question, I'm also having a few other concerns related to it (i.e. all possible implications of the same problem above):

If I use a server/client architecture (with one of the players acting as both a server and a client), and one of the clients has spawned a group of actions, should he add them directly to the manager, or only send a request to the server, which in turn will order every client to add that group?
What about packet losses and the like? The game is deterministic, but I'm thinking that any discrepancy in the sequence of actions executed in a client could lead to inconsistent states of the world. How do I safeguard against that sort of problem?
What if I add too many actions at once, won't that cause problems for the connection? Any way to alleviate that?

sentences:
Drawing lines in 3D space When attempting to draw a line in 3D space with D3DPT_LINELIST, then Direct3D gives me an error about an invalid vertex declaration, saying that it cannot be converted to an FVF. I am using the same vertex declaration and shader/stream setup as for my D3DPT_TRIANGLELIST rendering which works absolutely correctly.

How can I use D3DPT_LINELIST to render some lines in 3D space?

Edit: Here's my raw Draw call.

D3DCALL(device->SetStreamSource(1, PerBoneBuffer.get(), 0, sizeof(PerInstanceData)));
D3DCALL(device->SetStreamSourceFreq(1, D3DSTREAMSOURCE_INSTANCEDATA | 1));
D3DCALL(device->SetStreamSource(0, LineVerts, 0, sizeof(D3DXVECTOR3)));
D3DCALL(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA | lines.size()));
D3DCALL(device->SetIndices(LineIndices));
PerInstanceData* data;
std::vector<Wide::Render::Line*> lines_vec(lines.begin(), lines.end());
D3DCALL(PerBoneBuffer->Lock(0, lines.size() * sizeof(PerInstanceData), reinterpret_cast<void**>(&data), D3DLOCK_DISCARD));
std::for_each(lines.begin(), lines.end(), [&](Wide::Render::Line* ptr) {
    data->Color = D3DXColor(ptr->Colour);
    D3DXMATRIXA16 Translate, Scale, Rotate;
    D3DXMatrixTranslation(&Translate, ptr->Start.x, ptr->Start.y, ptr->Start.z);
    D3DXMatrixScaling(&Scale, ptr->Scale, 1, 1);
    D3DXMatrixRotationQuaternion(&Rotate, &D3DQuaternion(ptr->Rotation));
    data->World = Scale * Rotate * Translate;
});
D3DCALL(PerBoneBuffer->Unlock());
D3DCALL(device->DrawIndexedPrimitive(D3DPRIMITIVETYPE::D3DPT_LINELIST, 0, 0, 2, 0, 1));

Here's my vertex declaration:

D3DVERTEXELEMENT9 BasicMeshVertices[] = {
    {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
    {1, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
    {1, 16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1},
    {1, 32, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2},
    {1, 48, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3},
    {1, 64, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
    D3DDECL_END()
};

The LineIndices are just 0, 1 and the LineVerts are just {0,0,0} and {1,0,0}, to represent a unit 3D line along the X axis.

sentences:
UNET spawn dynamically generated object unity Spawning works when all clients are connected, but if a client connects after I spawn all my prefabs there are errors.  I spawn the object before changing its Rigidbody's velocity, which seems to cause the problem. I spawn objects, change them, then the other client joins, and the errors come. these are the errors:

Failed to spawn server object, assetId=953c1c6ecbb84304280d1334ef5dae0b netId=26

I also make changes to variables on other scripts.

All objects have network identities, network transforms, and are spawnable prefabs.

sentences:
Get all images from peristent data path and save them to a Texture2D array So i managed to make a working script that downloads images from firebase in this situation and saves them to Application.persistentDataPath. Now what i would like help in doing is getting all those images "*jpg" and assigning them to a Texture2D array for later use.
So far i have mananged to open one of those images by name and assign it to a single texture.
    public Texture2D image;

 private void Awake()
    {
        string dirname = "levelNature";
        string path = Application.persistentDataPath + "/" + dirname + "/" + "nameofImage.jpg";

        LoadSprite(fileName);

    }

    private void LoadSprite(string path)
    {
        if (string.IsNullOrEmpty(path))
            Debug.Log("null or empty");

        if (File.Exists(path))
        {
            byte[] bytes = File.ReadAllBytes(path);
            Texture2D texture = new Texture2D(1024, 1024, TextureFormat.RGB24, false);
            texture.LoadImage(bytes);
            image = texture;
            Debug.Log("success");
        }
    }

With just one image i can assign it to a texture but since later on in the gameplay i'm using a texture2d array to assign those images to the gameplay , which now are set through the inspector , i would like to load all images in a particular folder to a Texture2D array which later on i will be using to show each image index in a specific level.
I did try it out like this but it isn't successful.
    public Texture2D[] source;

        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + dirname + "/" + "*.jpg");

        source = new Texture2D[fileNames.Length];
        int index = 0;
        foreach (var fileName in fileNames)
        {
            source[index] = LoadSprite(fileName); // i get the error here that it cant convert void to texture2D
            index++;
        }

Hopefully once all images are loaded i could see in that array in the inspector all the images and then use that for the rest of the game. Thank you!

sentences:
Timebased transition from start to end value I'm trying to implement time line objects, the purpose of those would be to issue events at specific times. When and what is specified through objects called units, which is what you attach in the time line.

Got two types of time units, Action and Transit. Action counts to the end of the time unit, then issue whatever event with provided values intact.

My problem is Transit, which, frame by frame, modifies provided value(s) by multiplying time ratio before issuing the event.

I calculate ratio as: (in pseudo code)

ratio = (counter += delta time) / unit end time

My issue is that I keep getting either different results, or unbalanced progress, like adding 90% of the value quick then the last 10% of value at a much slower phase.

I've tried something like (in pseudo code) so far:

delta value = (end value - earlier delta values) * ratio

for each new frame.

Not sure how to put this together, so could really use a few pointers on this. Hope I made myself clear.

PS. I'm doing this in JavaScript, I know JS isn't the most accurate language when it comes to precision numbers, but it should be able to handle something like this.

Thank you in advance.

sentences:
Stop Unity from smoothening out images In Unity, low-resolution images are "smoothened out". Is there a way to keep them pixelated?

For your information, the images that I'll be using are in PNG format.

sentences:
Texture Region drawing issue with LibGDX I am currently moving my old slick2d project to libgdx. I have created a custom AnimationExt class that extends Animation to which I added a draw method. The Animation's frames are actually TextureRegion so I draw current frame TextureRegion. Here is the code, it's pretty simple.

    public class AnimationExt extends Animation {

    float stateTime=0;
    TextureRegion currentFrame=null;
    boolean isStopped=false;

    public void draw(SpriteBatch batch,float x, float y,int originX, int originY, float xscale, float yscale, boolean hMirror, boolean vMirror, float angle, boolean clockwise){
        if(isStopped==false){
            stateTime += Gdx.graphics.getDeltaTime();
            currentFrame=getKeyFrame(stateTime);

        }else{
            currentFrame=getKeyFrame(stateTime);
        }
        batch.draw(currentFrame, x-currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,currentFrame.getRegionWidth(),currentFrame.getRegionHeight());
        }

    public AnimationExt(float frameDuration,
            Array<? extends TextureRegion> keyFrames, int playType) {
        super(frameDuration, keyFrames, playType);
    }
}

This code works well. BUT when I add parameters to the batch.draw method (originX, originY, scaleX, scaleY, angle, clockwise) like this:

batch.draw(currentFrame, x-currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,originX,originY,currentFrame.getRegionWidth(),currentFrame.getRegionHeight(),xscale,yscale,angle,clockwise);

The drawing method goes crazy: it draws the texture rotated to -90 (whereas the angle I entered was 0) and it the width and height are inverted. To fix this I had to do change the code like that :

batch.draw(currentFrame, x+currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,originX,originY,currentFrame.getRegionHeight(),currentFrame.getRegionWidth(),xscale,yscale,90+angle,clockwise);

But I don't want to keep this code as I'm pretty sure it's weird and I want to know why does the drawing method have such a weird behaviour when adding more parameters.
By the way, I'm using the very last nightly builds of 17th June.

sentences:
Two 2D objects in Unity aren't colliding together In Unity 5, I have a player shooting a projectile in aim to hit a boss, and inflict damage upon contact with the projectile. Though for some reason, the projectile and boss aren't colliding with each other.

I've done the following;

Made sure that both the projectile and boss have a BoxCollider 2D and Rigidbody 2D
Made sure that they're on the same Z-Index and on the same layer
Tried to Debug.Log() if there's any collision (there isn't)
Made sure I'm using OnCollisionEnter2D on the boss' health script
Compared the syntax I use with another collision (where the player collides with an object and dies - this works perfectly fine).

However, none of these seem to be working.
This is the boss' health script:

void OnCollisionEnter2D (Collision2D coll)
{
    Debug.Log("COLLIDED");
    bosshealth -= 1;
}

Here is the projectile prefab:

And the boss prefab:

Does anyone have a clue as to why they're not colliding? the projectile just glides over the boss

EDIT: I found a temporary fix! Disabling the Kinematics of the boss allows for both objects to collide, and successfully display a debug message!
Just a problem though; I don't want the boss to freely float around in space. I use the kinematic to ensure it stays put at all times until told to by scripts.

Is there a way to get around not having to disable the kinematics?

EDIT 2: Then again, I am removing the projectiles on impact anyway, so the actual boss doesn't move, but that seems dirty :/

sentences:
What part of my engine should load images and fonts? Right now, I have an AssetLoader interface, which has one implementation per platform. There can only be one instance of it, because it has some state (e.g. the path to the APK on Android).

It has two methods (the game doesn't have sound):

Pixmap loadImage(String path)
Pixmap loadText(String text, String fontFamily, int fontSize)

While that works well enough in practice, I feel this is bad design. In particular, I have two issues with it:

I have to duplicate image and font loading. It's not exactly the same code, because there are different methods used for loading from the file system and loading from a ZIP file, but I could certainly just load a font or an image into memory and return that.
loadText does a bit much at the moment: It loads a font from the disk, renders each glyph of the text onto a pixmap and returns that. More unnecessary code duplication.

What do you think, is this as bad as I think it is? How would you address it?

I don't insist on having a single AssetLoader with one implementation per platform, so please don't hold your suggestion back because it would get rid of that. In fact, I'm not perfectly happy with the beast, but can't think of a nicer approach.

sentences:
DirectX11 Gamma Correction I am writing a game using SharpDX with DirectX11 and I have been reading that it is important to apply gamma correction to my engine in order to perform correct linear lighting calculations.

So I modified the function which loads my diffuse texture maps so that it uses R8G8B8A8_UNorm_SRgb format rather than R8G8B8A8_UNorm.  I then modified my framebuffer format so that it also uses R8G8B8A8_UNorm_SRgb.

It was my understanding that this would use hardware to remove gamma correction from my textures allowing me to perform linear lighting calculations and then reapply gamma correction when rendering the final scene to the frame buffer.

However when I do this the scene looks washed out and too bright.  My next step was to take a look at some gamma calibration charts Gamma Calibration Chart.  When viewing this chart in my browser I get a value of approximately 2.2.

I then loaded this chart into my engine and rendered it to screen.  When using R8G8B8A8_UNorm I get the same value (approximately 2.2) but when using R8G8B8A8_UNorm_SRgb I get a value around 1.2.

It seems like the scene has already been gamma corrected somehow.  Is this the case, what am I missing?

sentences:
OpenGL depth problem I am drawing two cubes, first a red one and then a green one in front of the red one. When I rotate the camera I can see the green cube through the red cube.

I have enabled depth test and I clear depth buffer. I'm using OpenGL 4.4 core profile and a simple diffuse shader by the way.

sentences:
Orthographic Camera Zooming In XNA I am using a spritebatch to render a board. I have created a camera class which can provide me a view and projection matrix. Currently I am supplying the view matrix to my sprite batch when I call begin.

I can get the view matrix to correctly move everything around and do some zooming in and out. My problem is that I want to zoom in on a specific point (for now the center of the screen) but currently zooming just zooms in on the coordinate 0,0.

Here is how I am constructing the view matrix;

        _ViewMatrix =
            Matrix.CreateTranslation(
                new Vector3(
                    (-_Position.X + _Width * _Zoom / 2),
                    (-_Position.Y + _Height * _Zoom / 2),
                    0) ) *
            Matrix.CreateScale(new Vector3(_Zoom, _Zoom, 1));

How could this be altered to make it scale correctly relative to the given point. Later I will probably want to zoom to the mouse position, but if someone has a simple example I'm sure I can work out how to adapt it.

sentences:
How to fake flipping a skeleton in Box2D? Imagine I have a skeleton — that is a set of bodies held together through various constraints and joints — and I want to flip it. Bodies cannot be flipped in Box2D, so how can I fake that?

Here's an example: I have a humanoid skeleton, made out of different Box2D bodies: the head, torso, upper arm, lower leg, etc. These Box2D bodies are held together by joints. Some of the joints have angle constraints, like the ones between the upper and lower arm, which do not allow the 'elbow' to twist unnaturally.

When I turn my character the other way around, I should flip the skeleton and its joints should be flipped as well. How can I achieve that in Box2D?

sentences:
A little bit confused on how to set normals in this case I'm learning how to use VBOs and I'm following up on the tutorial at the bottom of this page.
So I went ahead and created a structure Vertex to hold vertex data.(coordinates and normals).
struct Vertex  {
  GLfloat  x,  y,  z;
  GLfloat nx, ny, nz;
  GLfloat   r, g,  b;
  GLfloat padding[7];
};

For the moment I'm trying to draw a cube.So I created an array with 8 vertices.
My question is how do I set the normals?
When I used immediate rendering, I would just do a glNormal3f and proceeded to draw the vertices for that face.
Now that the normals are defined on a per-vertex basis, and a vertex practically belongs to 3 faces, I'm somewhat confused as what I should do here.
Have I taken a wrong approach on making that structure, or I am missing something else.
I would also like to note that I want to make something more generic, so I don't want it to be limited to just drawing cubes.
Thanks.

sentences:
Trouble with Raylib install on Arch Linux I am learning Raylib game library, but in the "First Person Maze" example the images cannot be found, for example:
`Image imMap = LoadImage("cubicmap.png");`

returns a File not Found by the compiler/linker, it´s the same with the other image. I am using CodeLite IDE, but I don't know how to add assets, right now I have them in a virtual folder named "resources".
Any help would be nice, I have googled the problem but I can't find anything. But now I don't know what's wrong because I have compiled the library with make and make install and also added Raylib package from Arch Linux and I can't even run the My first window example from the site.

sentences:
Get random point on NavMesh async I am trying to spawn some entities on a navmesh at runtime. The entities need to spawn at a random point.

Right now i use the following to get a random point:

public Vector3 GetRandomPointOnMesh()
{
    Vector3 randomDirection = UnityEngine.Random.insideUnitSphere * maxDistance;
    randomDirection += transform.position;
    NavMeshHit hit;
    NavMesh.SamplePosition(randomDirection, out hit, maxDistance, 1);

    if (float.IsInfinity(hit.position.x) || float.IsInfinity(hit.position.y) || float.IsInfinity(hit.position.z))
        return GetRandomPointOnMesh();

    return hit.position;
}

My problem here is, some time that random point inside the sphere is not hitting the navmesh, hence the recursive call until it actually hits the navmesh.

How can i make this piece of code run in the background until there is an actual value returned. Cause this holds up the main thread till a value is obtained.

sentences:
Too fast swipe in Unity game I am letting the user to swipe around in some movement and to see the scene on mobile device.
Facing too fast swipe.
Need to make swipe slower, smother.Using the code:

foreach(Touch touch in Input.touches)
{
    transform.localEulerAngles = new Vector3(
        transform.localEulerAngles.x + touch.deltaPosition.y, transform.localEulerAngles.y + touch.deltaPosition.x, transform.localEulerAngles.z);
}

sentences:
How to sort scores and assign positions based on the scores? I have three game objects each with an individual score. I was wondering how I should go about sorting these scores in ascending order. I want to also give these objects a position based on their score. Any help would be appreciated.

For example:

object1.score = 1300,

object2.score = 3000,

object3.score = 2200

What I'm looking for is:

object1.position = 3,

object2.position = 1,

object3.position = 2

Game Object code:

SGameObject
{
    int cp = 0;
    int lap = 0;
    int score = 0;
    int position = 0;
}

sentences:
Trigger an action only once when a condition is met, not every frame after that I want to avoid check if a particular function is returning true, and perform an action (Set Active) once it does return true for the first time.

Currently my code looks like this:

Update() {
    if ( IsTaskCompleted() ) {
        object.SetActive( true );
    }
}

SetActive gets called every frame after the task is completed. How can I avoid this, and call SetActive only once?

sentences:
Generating triangle indices for marching cubes mesh So I am making a programily generating cave program and I have all the vertices but I have no idea how to solve for the faces of my mesh. My code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MapGen : MonoBehaviour
{
    Mesh mesh;

    int[] triangles;

    public int xSize = 20;
    public int zSize = 20;
    public int ySize = 20;
    [Range(0f, 4.5f)]
    public float SurfaceLevel = 3.5f;
    Vector3[] interest;
    Vector3 old = new Vector3(0, 0, 0);
    public bool ShowAlg = false;
    [Header("Slows down the scene veiw dramaticly when in play mode!")]
    public bool ShowVert = true;

    // Start is called before the first frame update
    void Start()
    {
        mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;

        CreateShape();
        SolveFaces();
        UpdateMesh();
    }
    void CreateShape()
    {
        interest = new Vector3[(xSize + 1) * (zSize + 1) * (ySize + 1)];

        float seed = Random.Range(0.2f, 0.5f);
        Debug.Log(seed);

        for (int x = 0; x <= ySize; x++)
        {
            for (int i = 0, y = 0; y <= zSize; y++)
            {
                for (int z = 0; z <= xSize; z++)
                {
                    float ypn = (Mathf.PerlinNoise(x * seed, z * seed) * 2f);
                    float xpn = (Mathf.PerlinNoise(y * seed, z * seed) * 2f);
                    float zpn = (Mathf.PerlinNoise(x * seed, y * seed) * 2f);

                    if (ypn + xpn + zpn >= SurfaceLevel)
                    {
                        interest[i] = new Vector3(x, y, z);
                    }

                    i++;
                }
            }
        }
    }

    void SolveFaces()
    {
        triangles = new int[xSize * ySize * zSize * 9];

    }
    void UpdateMesh()
    {
        mesh.Clear();

        mesh.vertices = interest;
        mesh.triangles = triangles;

        mesh.RecalculateNormals();
        MeshCollider meshc = gameObject.AddComponent(typeof(MeshCollider)) as MeshCollider;
        meshc.sharedMesh = mesh;

    }
    private void OnDrawGizmos()
    {
        if (interest == null)
            return;
        for (int i = 0; i < interest.Length; i++)
        {
            if (ShowVert == true)
            {
                Gizmos.color = new Color (0.286f, 0.486f, 0.812f);
                Gizmos.DrawSphere(interest[i], 0.2f);
            }
            if(ShowAlg == true)
            {
                Gizmos.color = Color.green;
                Gizmos.DrawLine(old, interest[i]);
                old = interest[i];
            }
        }
    }
}

This script is placed on a empty Game Object with a Mesh Filter, Renderer, and a collider.
Note they do nothing without the faces.
I have set it up so the face array goes on the triangles variable and missing part of the script should go in the SolveFaces() function. Thanks in advance.

sentences:
GLSL shader without a vertex array Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without sending any vertex positions - gl_Position could be set completely procedurally.

That said I'd still need to specify a "t" value per point via vertex attributes.

Is it possible to specify attributes (ie via glVertexAttribPointer) without specifying vertices? Or does the GL need "space" in the buffers for vertices - even if they aren't initialized.

sentences: How can I enable CCD in Bullet Physics? How can I enable Continuous Collision Detection (CCD) in Bullet Physics?

sentences:
How to handle entity path-finding and movement in a large networked world? Considering the image above with tiles split into 32x32 boxes, I have an entity which is marked to 'aggro' nearby players that come close to it. I'd like this monster to ideally chase the player (and continue to chase the player for a while). Currently, my only movement is done my a simple interpolator for remote entities and this works because the gaps between movement updates are rather small.

I can't successfully just tell the client that the monster wants to move to the position he/she is at, as that will cause the entity move much faster than it should (this can probably be solved with using some math for the interpolation co-efficent) but more importantly it does not look realistic and may clip walls! I don't want to simulate the entire movement on the server if it can be avoided... although I guess I could but that still wouldn't solve the clipping issue. I suspect the solution involves some path-finding and sending the client periodic node updates and letting them simulate the movement but I'm unsure.

Thanks!

sentences:
How can I optimise collision checks for a large number of AI units? Let's say I got 100 Orcs in my 3D world and they all aim to kill each other.

That means for every 1 Orc I have to check for collision with the 99 others. That will give me 99^2 which is about 10,000! That many collision checks every update (24-60 times a second) only for the AI will probably use my whole GPU + CPU.

How can I handle such a large number of AI?

How is this is done in games with large numbers of NPCs (e.g. Skyrim, Fallout, Red Dead Dedemption...).

sentences:
UE4 doesnt work with subfolders I am trying to create a file structure for my code in c++classes/Myproject (in UE4 editor). I added a new class and in UE4s "Add C++ Class" dialog box I set the path for the created scripts as MyProject/Source/MyProject/test, test being the subfolder I am trying to create, however when the editor finishes generating the files I get an error saying that it failed to find the files it generated.

...\MyProject\test\SysGen.cpp(4): fatal
error C1083: Cannot open include file: 'test/SysGen.h': No such file
or directory

In visual studio I can see and open the generated scripts, but it fails to compile. What do I need to do for this to work?
here are the files image taken from visual studio:

sentences:
Tile transitions - external vs internal I've been looking at a couple of games and noticed that the transitions between tiles are handled somewhat different.

I was wondering which methods are to be used in different situations and why. I'm currently using internal edges in a top-down game, and it's working out so far. But I don't want to run into problems later on, and have to redo the whole tileset.

I noticed that platforming games mostly use the internal edges, and top-down games mostly use external and hybrid transitions. I can see how these tiles are used to create "depth" in top-down games, where the player apears to be standing in front of a wall for example. But it seems unlikely that such a small feature decides the entire method for tile transitions. You could always alter the bounding box to create the same effect.

sentences:
OpenGL shader program per shape or model I have a program which imports models from .obj files and then draws them with OpenGL. I have a model which contains many shapes (meshes?). Not every shape has texcoords defined inside .obj file (it looks like 1//1 instead of 1/1/1) and I try to use one shader program which depends on texcoords.

What would be the best solution for that problem? Should I use separate programs for shapes that have texcoords and another for shape without texcoords defined?

Maybe there is a way to check if some attributes were passed to shader program?

This is the gist with .obj, .mtl and shader files, maybe that will help you to understand my problem.

sentences:
nvidia SSAO visible errors I am trying to add ssao effect to a visualization application but there are errors in resulting image. I am using code from https://github.com/nvpro-samples/gl_ssao .
Errors occur in rapidly changing lighting near the edges of screen.

Only change to code was to remove basic shading and passing only white from scene.frag shader so the error could be seen more pronounced. I also added obj input to import sponza scene but the error is visible with the included sample scene as well if camera is moved close to object.
As is this implementation only enables viewing objects in relative distance. Moving closer to objects brings up this errors.

What causes this error and is there fix.

sentences:
Parallax Scrolling Road-2D I'm working on a racing game which will have a top view from the back camera. The image below displays a similar example. I am confused about how to achieve the movement of the road if parallax scrolling is used. The road gets narrow as we move forward whereas it is broader closer to the camera. Should I focus on parallax scrolling to achieve this or is there some other technique to work with such games?

p.s. I'm using cocos2d-x as the gaming engine.

sentences:
How to move a 2d sprite to a target location while avoiding obstacles? How can I get a 2d sprite to move to a position clicked on the screen, without bumping into other objects? I'm programming in java using the android API library

I have created a surface view and loaded my sprites as a bitmap object.

sentences:
Delaunay triangulation. Where to start? I'm trying to learn procedural generation technique's. Specifically for dungeons. I started off with a 2D array and I generate my rooms fine. Each room contains wall tiles as seen in the screenshot below.

Right now I use A* to link the rooms together. But this has some paths go straight through other rooms or around rooms. Having done some googling I found this demo which game me the idea of using Delaunay Triangulation to properly connect the rooms without going through already existing connections/rooms.

But how to apply it to my 2D array setup? My initial thinking is that I should think out side of the box (2d array haha) and grab my rooms and create a complete graph from this and then apply the Delaunay Triangulation.

I've never done anything with graphs before. So what I would to know is a) is my thinking correct in creating the graph with all the rooms linked and then to apply the triangulation and b) where should i start?

[small edit]after some more looking around stackoverflow i found this post explaining Graphs more in depth. https://stackoverflow.com/questions/15306040/generate-an-adjacency-matrix-for-a-weighted-graph

sentences: Why do most racing games have tracks that are closed loops? In most racing games (Mario Kart, Sega Rally, F-Zero, etc.), racers typically make some number of laps in a closed circuit.  The most notable exceptions that come to mind are all arcade games, or arguably not even a racing game (Trackmania, OutRun, the Cruis'n series).  Why would a designer want to build tracks as closed loops, and why is it so commonplace?

sentences:
Why integrate over accumulation? I'm starting to learn how to DIY physics, and I have a question about implementing integration at the most basic level (i.e. this is not a  Euler vs. RK4 question).

Nearly every example I come across has some integrate() function which gets the timestep since the last update, and updates the acceleration (and/or velocity and/or position) since the last update.

In the simplest form: position += velocity * deltaTime

However, I don't understand why it's accumulated like this when it could just as easily be gotten by changing a function. For example: getPosition = makeNewFunction() which could return something that has the signature of Time -> Position, and the inner workings of that function are generated via the appropriate mathematical formula.

That way, there is no accumulation... whenever the position needs to be gotten, it calls that function with the current time.

My newbie understanding is that this would also avoid the errors that come from accumulation... so why does this not work, what am I missing?

(fwiw I did put together a basic proof of concept of this idea- though it's also testing a few other things at the same time so it's not the cleanest example: https://github.com/dakom/ball-bounce-frp)

EDIT 1: as mentioned in the comments, it's probably important to point out that I have not learned about changing acceleration yet, or dealing with jerk and other things that require higher-order integration than constant acceleration.

EDIT 2: here is some basic sample code of the idea, and pseudo javascript syntax - note that getKinematicPosition is partially applied so it is returning a new function of just Time -> Position:

I'm sticking to position here but it could be something else, like getVelocity, I guess...

getKinematicPosition = initialVelocity => acceleration => time =>
  ((.5 *acceleration) * (time * time)) + (initialVelocity * time);

getPosition = getKinematicPosition ([0,0,0]) (GRAVITY);

onTick = totalTime => {
   position = getPosition (totalTime);
   onCollision = () => {
     getPosition = changeTheFunction(totalTime);
     //changeTheFunction uses totalTime to base updates from 0
     //it could use getKinematicPosition or something else entirely
   }
}

sentences:
How do I rotate an object back and forth? I want my object to rotate between two angles in relation to speed and it doesn't need to be a smooth rotation, how can I achieve that?

Thank you in advance.

sentences:
How should I balance temporary buffs to make my game fun? As a game developer, I understand many players (usually in RPGs) expect short term buffs to be available to them, such as potions, war cries, drugs, etc.

As a player, I've never understood what fun there is in using them. I think it's because they never seem to be very strong. They usually grant a 10-20% bonus to some attribute, for example -- just enough to turn a rage-quit situation into a merely-annoying one.

Maybe I just don't know how to use them; so how should I approach temporary buffs when balancing them? For the people who enjoy using them, what are they getting out of it? How might I go about confirming if my players agree that the mechanic is fun?

sentences:
Cross platform development tool/platform for the modern indie game developer? I'm a Flash developer, but I think it's time to think of other avenues. Ideally I want to be able to write once but be able to deploy to as many different platforms as possible, so iOS AND Android....Web AND Mobile. Are Html5 game development platforms good enough to create games that run on the web and mobile? or should I go with say Corona for iOS and Android, and use Html5 just for web?

I'm a professional developer so paying out for a decent game dev platform is not an issue, I just want to make sure I'm using the best tools for the job over the next few years.

Only interested in developing 2D games. Might well need physics. Corona definately seems a good option for mobile, but if it's possible to create everything in Html5 even if it's more work I'm wondering if it's worth the time learning that.

sentences:
Confused about calculation of steering force I'm reading Programming Game AI by Example, by Mat Buckland. What I don't understand there is why the individual behaviors return a vector representing change in velocity, but the combined result is treated as a force vector.

Here's the excerpt from the update function:

  Vector2D SteeringForce = m_pSteering->Calculate();

  //Acceleration = Force/Mass
  Vector2D acceleration = SteeringForce / m_dMass;

  //update velocity
  m_vVelocity += acceleration * time_elapsed;

  //make sure vehicle does not exceed maximum velocity
  m_vVelocity.Truncate(m_dMaxSpeed);

  //update the position
  m_vPos += m_vVelocity * time_elapsed;

And m_pSteering->Calculate() returns the weighted sum of different steering "forces", like Seek

Vector2D SteeringBehavior::Seek(Vector2D TargetPos)
{
  Vector2D DesiredVelocity = Vec2DNormalize(TargetPos - m_pVehicle->Pos())
                            * m_pVehicle->MaxSpeed();

  return (DesiredVelocity - m_pVehicle->Velocity());
}

So, how come steering functions like Seek just return change in velocity and don't take mass into account, but still get used as force?

Here's the source code

sentences:
Why are symbols placed in front of UI texts? I've been to play testing sessions from both large and indie studios, and I often see a symbol in front of UI texts during development builds. It most commonly appear in buttons texts, but can also be seen in NPC names and etc.

The symbols are typically a dollar sign ($) or a exclamation sign (!).

A game at Ubisoft for example had exclamation marks in front of every UI text:

!Start
!Load

When someone breaks Skyrim by modding, a dollar sign could be seen as well:

What do these symbols mean / are used for? Placeholder? To be localized? Do the symbols used vary from studio to studio or is there a notation standard of some sort and different symbol mean different things?

Are there any reasons at all for the rest of us to adopt this?

sentences:
Unity is not responding in Ubuntu 18.4 I am running the build Unity executable in ubuntu 18.04 and it may take a while to load the asset. When I wait, I always receive a window telling me "You can choose to wait for a while to let it continue or force the application to completely exit." For a while, Unity will run and it looks like works well.
My question is, what is the impact of this? Why does ubuntu send the message? How to deal with it?

sentences:
How can a BabylonJS FreeCamera be rotated from code? Say I have a FreeCamera in a BabylonJS 3D world. How could I rotate that camera from program code? Or, more specifically, how might I bind camera rotation (not movement, which I know how to bind to WASD) to the arrow keys so that gamers without a mouse would not find it too troublesome to use? Is this even possible?

Thanks in advance!

sentences:
Sparse voxel octree for 3d pathfinding and Manhattan distance I've been learning about using sparse voxel octree for 3d pathfinding based on Daniel Brewer's chapter in Game AI and his talk at GDC 2015.
One aspect that I'm really confused about is exactly what is considered to be a neightbor of a cell in the tree, and whether using Manhattan distance is alright or not. Let's assume that all the cells are of the same size and consider some cell C. How many neightbors will it have - 6, one for each side of the cube, or 27-1=26, all the cubes "touching" our chosen cell at least in one vertex?
It seems the former 6, but I don't see how that doesn't cause problems if we calculate distances between centers of the cells - it induces a manhattan norm, and there's lots of situations where that fails. I have some intuition why it might not be an issue if you do some type of "post processing" on the found path, but it could simply fail quite badly in finding a good path.
Brewer has mentioned using Manhattan distance throughout the talk as well to allow for easier computations, but: 1, it seems like a very problematic thing to me and 2, it seems to me like Manhattan distance is already being used when moving across neightboring cells of same size, which I would assume where the bulk of the expensive computation happens.
//
EDIT: Adding some examples of where it seems to me that Manhattan distance fails:

Green path corresponds to the good paths, red to the wrong paths. Technically the the green paths should be drawn in jagged way, as on the grid you can only move vertically/horizontally, but you can imagine that if we zoomed really close to them, that is really what they look like - it's just not visible from this distance.
sI -> eI is an example of the general issue with something like Dijsktra's - the red path has the same length as the green path in Manhattan distance and could get chosen. It would probably work fine with A* if we use something like euclidean distance for the Heuristic, since it will greedily go as close to the obstacle as possible.
sI -> eII shows the same problem, but fails with A* too.
I can imagine that both of the above are not huge issues - the pathfinding finds a general path which is good enough - when it comes to the agent actually following the path, they could for example set its next "target" as the furthest point on the path it can travel to directly (check a raycast/spherecast), or even do a few raycast checks along the line between the last point it can reach directly and the next one - the blue line in the image. We would set the local "target" to be a point on the blue line that is furthest away from the reachable point.
sII -> eIII doesn't seem like something that can be fixed like I described in the paragraph above. A* will simply find the wrong red path.

sentences:
C++ Mouse picking for ray to plane intersection I'm making a C++/OpenGL application (decidedly without GLM), and I'd like to understand how to create a ray from the camera eye to the mouse pointer, as well as detect an intersection point from the resulting ray onto a flat plane.

I have:
 - Camera position, camera pitch/yaw, camera's Fwd vector
 - mouse coordinates in pixel measurements (which I can convert to -1:+1 screen space)
 - A world system where XY are the horizontal and Z is up
 - A flat plane where Z=0
 - My own matrix class which is basically just a float[16] and accessed (Get()) as a float*
 - Basic matrix multiply function, cross, dot product functions.

I'm still trying to learn 3D math (this project is somewhat of a reason for that), so I'm still somewhat hazy on how to accomplish this.  Most tutorials I can find are Unity tutorials, or involve using an Unproject function from glu or GLM.

I'd hopefully like to understand how to accomplish this manually as I'd like to understand what's happening.  Thank you for any wisdom or guidance.

sentences:
Mixing Perspective and Orthographic Projections? I'm going to start with some background, so jump to my question at the bottom for the TLDR version.

Problem:

In a Japanese 4gamer article (english translation via Chev on Polycount) explaining some of the technology and design behind Guilty Gear Xrd (a highly-stylized, 2.5D, toon-shaded fighting game) they detail some of the challenges concerning the game's development. One of the challenges had to do with the use of an orthographic 2D collision detection system on top of 3D character models that were rendered in perspective. In short, rendering character models through a perspective projection would naturally result in the characters looking wider towards the edges of the camera. As such, at various points on the screen the visual representation of the characters would fail to accurately represent their 'hitboxes' and 'hurtboxes'.

Example 1: Models using perspective projection.

The character model for Player 2 (orange) more closely matches his collision data because of his location towards the center of the screen.

Example 2: Models using orthographic projection.

Using an orthographic projection, characters are accurately aligned with their collision data regardless of position. However, the desired visual effects of perspective are lost.

Their Solution:

The developers at Arc System Works solved this issues by creating a 'partial perspective' projection - a non-uniform mixture of perspective and orthographic (maybe parallel is more accurate) projections. On the horizontal axis, the camera's projection is said to be a '70% orthographic and 30% perspective' hybrid. On the vertical axis, the projection remains 100% perspective.

Example 3: Models using 'hybrid' projection.

Mixing perspective and orthographic horizontally allowed them to preserve collision alignment and visual spacing (an important aspect in competitive fighting games). At the same time, the 'fully perspective' projection on the vertical axis allowed them to achieve extra visual depth when the characters jump.

My Question:

How would one go about achieving this kind of non-uniform, semi-perspective, semi-parallel camera projection?

When I think about this, I can imagine a camera frustum with a wide vertical FoV and a somewhat more narrow (but not necessarily parallel) horizontal FoV. Is this the correct interpretation of what they're describing, or am I visualizing it incorrectly?

Typically how would you generate a projection/modelview matrix like this? Is there a way to ask libraries like OpenGL and Direct3D for non-uniform matrices like these, or is there some way to combine an orthographic matrix and a perspective matrix in a non-uniform way through matrix math?

sentences:
Finding a moving target in a maze I'm making a game that is a bit of a mix of snake and pacman.

Basically, two players go through the maze and each time they pick up a piece of candy, a cube is added to their tail.  If one player touches the other's tail, he steals that piece for himself and the game is over when one player has all the pieces.

Right now they both move randomly unless there's a piece of candy one space away that is not their tail.

I'm trying to find a method/algorithm (preferably a different method for each player) for both players to target/avoid the other player.
Any advice?

sentences:
Particle Turbulence Effect in Babylon.js Is there any way to implement a turbulence effect in a babylon.js Particle System? I know that its possible to use physics engines on mesh objects, but I've not seen any discussion of using them on a babylon particle system.
Might there be a way to bake a particle system as a .vdb and import it if real-time simulation is not an option?

sentences:
Coroutine problem, I don't know what's happening Calling function.

 private const int deathHangTime = 2;
 private void Die()
    {
          Debug.Log("1 " + Time.time);
          StartCoroutine(DelayForTime(deathHangTime));
          Debug.Log("4 " + Time.time);
    }

  Coroutine

IEnumerator DelayForTime(float time)
{
     Debug.Log("2 " + Time.time);
     yield return new WaitForSeconds(time);
     Debug.Log("3 " + Time.time);
}

Why doesn't it wait for 2 seconds?
Why doesn't it print the 3rd Debug line?

sentences:
GetUserWidgetObject returns null I have a widget component inside of my character:

// ABCharacter.h

...
UPROPERTY(VisibleAnywhere, Category = UI)
    class UWidgetComponent* HPBarWidget;
...

// ABCharacter.cpp
...

AABCharacter::AABCharacter()
{
     // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    HPBarWidget = CreateDefaultSubobject<UWidgetComponent>(TEXT("HPBARWIDGET"));
    HPBarWidget->SetupAttachment(GetMesh());
}

I checked HPBarWidget is null and it wasn't:

if (HPBarWidget == nullptr) {
    UE_LOG(ArenaBattle, Error, TEXT("NULL"));
}

HOWEVER, When I try to get the widget object, it said it's null.

if (HPBarWidget->GetUserWidgetObject() == nullptr) {
    UE_LOG(ArenaBattle, Error, TEXT("NULL"));      // it printed NULL
}

What causes this returns null? I can clearly see I have a WidgetComponent that exists in my character's tree, and HPBarWidget wasn't null too.

I struggled this already hours and couldn't find any related issues. What did I wrong?

Using 4.24.3.

sentences:
Game Maker - Shader CGA - how to swap the palette I created a shader that get the actual color of the surface and render it to the closer of a cga palette

I have to change it to swap the palette in 4 colors but I don't know how
secondary, I have to render it dynamic (maybe using an uniform variable)
because it have to change in base of the palette

please help me, thanks

///CGA Shader
varying vec2 v_vTexcoord; //xy
varying vec4 v_vColour; //rgba

#define _ 0.0
#define o (1./3.)
#define b (2./3.)
#define B 1.0

#define check(r,g,b) color=vec4(r,g,b,0.); dist = distance(sample,color); if (dist < bestDistance) {bestDistance = dist; bestColor = color;}

void main(out vec4 v_vColour, in vec2 v_vTexcoord)
{
    float dist;
    float bestDistance = 1000.;
    vec4 color;
    vec4 bestColor;

    vec2 pixel = vec2(320,200)-floor( v_vTexcoord.xy / iResolution.xy * vec2(320,200));
    vec4 sample = texture2D(iChannel0, pixel / vec2(320,200));

    sample += (texture2D(iChannel1, pixel / iChannelResolution[1].xy)-0.5)*0.5;

    // pallete 0

    check(_,_,_);
    check(o,B,o);
    check(B,o,o);
    check(B,B,o);

    vec4 color1 = bestColor;
    bestDistance = 1000.;

    // pallete 1

    check(_,_,_);
    check(o,B,B);
    check(B,o,B);
    check(B,B,B);

    vec4 color2 = bestColor;

    float t = (clamp(sin(iGlobalTime)*4.,-1.,1.)+1.)/2.;

    v_vColour = mix(color2, color1, t);

    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}

sentences: How can I send someone an early version of my game made in clickteam fusion 2.5? I'm currently in the process of making my first game and have a pretty sturdy prototype, but I don't know how to send it out to select people. Any suggestions?

sentences:
World & client listening, use multi-threading or multi-process? My game is based on a client / server architecture where client only sends input and receives server output.

Server has to keep track of the game, updating the world etc. But also listen to clients and their input. The server accepts input for 100ms and then processes all the input,sending the result (the output) back.

What would be the most optimal in terms of performance. Have two processes, one for the game and one for listening to clients for input and sending output back. Or go full multi-threading.

I read on how to communicate between processes and it didn't seem very optimal (Sockets, RMI, file sharing).

sentences:
Map with 20 million tiles makes game run out of memory, how do I avoid it? While loading extra huge maps, the loading method throws out of memory exception where a new instance of map tile is created. I'd like to have whole map processed at least on server app (and on client if possible). How should I solve this problem?

UPD: the question here is how to make the game stop crashing when there's still free memory for it to use. As for splitting map in chunks, it's a good approach, but not what I want in my case.

UPD2: At first I went and assigned a texture to every new instance of tile class and that's what took so much memory (also loading time). Now it takes about four times less space. Thanks to everybody, now I can run huge maps without thinking of breaking them up in chunks just yet.

UPD3: After rewriting the code to see if arrays of tile properties work faster or consume less memory (than said properties in their respective tiles as object properties), I found out that not only it took me a lot of time to try that, it didn't bring any performance improvement, and made the game terribly difficult to debug.

sentences:
Varibles Initialized in Awake are null in other script's Start I have a component gameState Attached to one gameobject called GameState:

public class gameState : MonoBehaviour
    {
        public Context stateMachine;
        private void Awake()
        {
            PlayerGameobject p = GameObject.Find("Player").GetComponent<PlayerGameobject>();
            stateMachine = new Context(new Playing(), p);
        }

On another gameObject I have this component:

public class PlayerGameobject : MonoBehaviour
{
    void Start()
    {

        gameState = GameObject.Find("GameState").GetComponent<gameState>();
    }

}

When I try to use gameState within PlayerGameobject's Update method I find that stateMachine is null.

 if (gameState.stateMachine.CurrentState == "Playing"){}
      //       ^^^^ null

why is statemachine null? I initialized it in awake which should run before start. gameState is not null and other public variables assigned in Editor are not null.

sentences:
How to create Whirlpool/Vortex effect? Im trying to make a Vortex effect on a Circle Body that is a Sensor.
I've been looking for this and all examples i look for are in C++ or Objective C and i dont seem to translate them well.

when my objects collition, it calls beginContact(..) and it sets a flag so that i can call bodyToUpdate.applyForce(...);

 public void beginContact(Contact contact) {
             setColliding(true);
 }

 //updating collition every frame
 public void act(){
     if (colliding) {
        ball.getBody().applyForce(....);

 }

how to calculate the amount of force to apply every frame to make it a vortex?

so i now have the object going straight to the center of the vortex, but no "spin"

public void act() {
    if (colliding) {
        ball.getBody().setLinearVelocity(0, 0);

        ball.getBody().applyForce((portal.getBody().getPosition().x - ball.getBody().getPosition().x) * i,
                (portal.getBody().getPosition().y - ball.getBody().getPosition().y) * i,
                ball.getBody().getPosition().x, ball.getBody().getPosition().y, true);

        i++;
    } else
        i = 10;
}

sentences:
Implementing unlockable items on Android I know this would be a beginners question (some of you might think) but I would like to know different approaches for this.

I have a game with lets say 20 unlockable items, at the main menu I have a button where the user can go to an activity and view the unlockable items. So I would like for it to have a "Locked image" and under it a text telling you what the item is and maybe how to unlock it.

What is the best way of going about this?

And then when the item is unlocked during the game, maybe put a variable in the shared preference and check at the beginning of the activity with the unlockabled items.

Let me know what you guys think. Thanks.

sentences:
Trying to rotate a point around another point and it's not working I am trying to make a function to rotate a point around another point. My maths are very rusty but i did some research and i just dont understand why my function is not working.

public void rotatePoint(int pX,int pY,int angle) {
    int newX = 0, newY = 0;
    int centerX = 400, centerY = 300;

    angle *= Math.PI / 180; // convert angle from deg to rad

    double rotatedX = Math.cos(angle)*(pX-centerX)-Math.sin(angle)*(pY-centerY) + centerX;
    double rotatedY = Math.sin(angle) * (pX-centerX) + Math.cos(angle) * (pY-centerY) + centerY;

    newX = (int)Math.round(rotatedX);
    newY = (int)Math.round(rotatedY);
}

On the image i just provide my original point is in grey. After a rotation of 90 or 180deg i would expect the point to arrive where the green ones are. They arrive where the red points are.

sentences:
How can I change a variable value in specific time duration according to animation clip time length? I will change my question with more details to make it more clear:

In the Assets I created Animator Controller and Animation: Named them both FPSController. FPSController is the object I want to animate it's rotation on the Z from 50 to 0:

Then I opened the Animator window and dragged the Animation into the Animator window:

Then I opened the Animation window and recorded the clip: The rotation on Z is going from 50 to 0 in 7 seconds. I'm rotating the FPSController on the Z from 50 to 0:

This is the Animation part and this is working fine. The FPSController(player) is starting when the Z rotation value is at 50 and slowly move to 0.

Now The game is start when the whole camera is blurry. For this I'm using Post Processing. Next step was to create a profile of the Post Processing called it CC and this profile I dragged in the Hierarchy to the FPSCamera:

In the FPSCamera I dragged to it a script name Post Processing Behaviour and then dragged to the script in the Inspector the CC profile: This way the Post Processing effects affecting the camera view:

So to make it clear: I'm rotating on the Z the FPSController by animation. And on the FPSCamera I'm using the Post Processing for making effects.

This is how the game start. This is the game view screenshot. The game start when everything is blurry and the FPSController(player) is rotating to the right by 50 degrees:

Now the part of the animation of rotating the FPSController by 50 is working fine. While it's rotating the FPSController I want slowly by the same time in this case 7 seconds to change the blurry effect and make the picture clear once the animation end. The property of the  Post Processing CC profile I need to change is the focalLength. By default I start it with the value of 300. And I need in 7 seconds to change it from 300 to 0.

This is the script I ended with so far:
The script is attached to the FPSCamera:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.PostProcessing;

public class DOFControl : MonoBehaviour
{
    public PostProcessingProfile postProcProf;

    public Animator anim;
    private float clipLength;

    private void Start()
    {
        AnimationClip[] clips = anim.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        InvokeRepeating("incrementSpeed", 300, 0.1f);
    }

    void incrementSpeed()
    {
        var dof = postProcProf.depthOfField.settings;
        dof.focalLength -= 1f;
        postProcProf.depthOfField.settings = dof;
    }
}

I'm getting the animation clip time length 7 seconds. But the part with the InvokeRepeating is not working. I want to incrementSpeed the focalLength down from 300 to 0 by 7 seconds. Not sure if using InvokeRepeating is the right way at all.

sentences:
Getting curved-based zooming speed? I am able to get a fairly smooth zooming function going on in my project.

However I'm hoping to achieve a non-linear function.

I've tried using the smoothstep function but it doesn't feel smooth (Could have been an improper implementation of mine).

If anyone can provide any suggestions, that will be greatly appreciated.

An example of what I'm trying to achieve is that of the spectator camera, where it zooms in/out, in Dota2.

using UnityEngine;
using System.Collections;

public class Pan : MonoBehaviour {

    public float zoomSpeed = 20f;
    public float smoothTime = 0.3f;

    private float refSpeed = 0.0f;

    void Update () {

    if(Input.touchCount == 1)
        {
            panUpdate();
        }

    if(Input.touchCount == 2)
        {
            zoomUpdate();
        }

    }

    void panUpdate()
    {

    }

    void zoomUpdate()
    {

        // Store both touches.
        Touch touchZero = Input.GetTouch(0);
        Touch touchOne = Input.GetTouch(1);

        // Find the position in the previous frame of each touch.
        Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
        Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition;

        // Find the magnitude of the vector (the distance) between the touches in each frame.
        float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude;
        float touchDeltaMag = (touchZero.position - touchOne.position).magnitude;

        // Find the difference in the distances between each frame.
        float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag;

//        float into = GetComponent<Camera>().fieldOfView + deltaMagnitudeDiff; //* ZoomSpeed

       // float smoothDiff = Mathf.SmoothDamp(GetComponent<Camera>().fieldOfView, deltaMagnitudeDiff, ref zoomSpeed, smoothTime);

        // Otherwise change the field of view based on the change in distance between the touches.
        GetComponent<Camera>().fieldOfView = Mathf.SmoothDamp(GetComponent<Camera>().fieldOfView, GetComponent<Camera>().fieldOfView += deltaMagnitudeDiff * zoomSpeed, ref refSpeed, smoothTime);

        // Clamp the field of view to make sure it's between 0 and 180.
        GetComponent<Camera>().fieldOfView = Mathf.Clamp(GetComponent<Camera>().fieldOfView, 59.9f, 119.9f);

    }
}

sentences:
How could I make the player's movement more responsive? I am working on an Air Hockey game;
I tried making the movement physics-based, by doing this:
using UnityEngine;

public class Player : MonoBehaviour
{
    private Rigidbody m_Rigidbody;

    private float HorizontalInput;
    private float VerticalInput;

    public float Speed = 1.0f;

    private void Start()
    {
        m_Rigidbody = GetComponent<Rigidbody>();
    }

    private void Update()
    {
        HorizontalInput = Input.GetAxisRaw("Horizontal");
        VerticalInput = Input.GetAxisRaw("Vertical");
    }

    private void FixedUpdate()
    {
        m_Rigidbody.AddForce(new Vector3(VerticalInput * Speed, 0.0f, -HorizontalInput * Speed),ForceMode.VelocityChange);
    }
}

and by adding a PhysicsMaterial to the MeshCollider attached to my player:

The movement should be quick and responsive, but it feels rather sloppy and unresponsive; I also tried using Input.GetAxisRaw(...), but the controls become quite clunky.
How can I improve on this? Is there a go-to way to do this type of movement in Unity?
(I would like the final version of the game to be played on controllers)

sentences:
How would one determine the length of a path? I have a game that requires each player to move along one specified path. I draw the path using Bézier curves. How can I determine the total real (not linear) length of the path and the distance that each player had made? (The distance between the start point and a specified point on the path.)

UPDATE:

The path is represented in a Cartesian plane (2D).

sentences:
Shadertoy getting help moving to glsl I spent some time writing a shader on shadertoy but now, when I try to translate my code to opengl I don't know how to calculate the uv that they describe as like this:

vec2 uv = fragCoord.xy / iResolution.xy;

How can I do that in a typical opengl 330 core fragment shader?

sentences:
GUIText size on 4:3 and 16:9 is different I have a text (guiText) on the screen.

It shows correctly when viewed on 16:9 resolution.

But it scales up when viewed on 4:3 (e.g iPhone4).

I am using following ObjectLabel script to place it on the same position regardless of screen resolution. Which is working fine for 16:9 and 16:10.

Object Label

sentences:
How to reproduce this (parallax?) effect? I'm wondering how to imitate the camera movement like in the gif below. It´s from a Android game.

This game for example (via GIPHY)

Actually, I am not sure if this can be called a parallax effect, but it is the only word I can think of.

My code until now:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateAroundTarget : MonoBehaviour {

public Transform target;    // The object to follow
public Transform background;
public Transform foreground;
public float speedMod = 20.0f;  // Camera speed
public float topMargin = 0.2f;  // Top rotation margin

// The position of the target
private Vector3 point;
// Point if the camera is rotating to the left
private bool toLeft = false;

// Use this for initialization
void Start () {
    point = target.transform.position;
    transform.LookAt (point);
}

// Update is called once per frame
void Update () {

    // The camera is moving to the right until it reaches the top margin, then it changes it movement direction
    if (!toLeft) {
        transform.RotateAround (point, new Vector3 (0f, 1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (1);
        rotateForeground (-1);
        Debug.Log ("Izquierda");
        if (transform.rotation.y >= topMargin) {
            toLeft = true;
        }
    } else {
        transform.RotateAround (point, new Vector3 (0f, -1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (-1);
        rotateForeground (1);
            Debug.Log ("Derecha");
        if (transform.rotation.y <= -topMargin) {
            toLeft = false;
        }
    }
}

// Direction = 1 (left) | -1 (right)
public void rotateBackground(float direction){
    background.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod * 2) * direction, 0));
}

public void rotateForeground(float direction){
    foreground.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod / 2) * direction, 0));
}
}

But what I obtain in Unity Editor is this:
Result in Unity Editor (via GIPHY)

Any suggestion on how to get this?
Any help would be appreciated.

sentences:
Performance and HotSpots Usually, when discussing on performance in games, cache misses and localities come like the real problem. But i feel like videogames are too focus optimization in that way.

For example, the author of this blog entry talks on how essential is a good datastructure to achieve high performance. But out of a situation where you have many entities that will stay on movement almost always, i cannot come with an example where these optimizations can help:

Handling the player inventory is a inherently a complex task. You are not going to iterate every inventory to check whether or not an entity wants to retrieve/add an item from/to its inventory.
Combat is usually intensive and fast, but from the perspective of the cpu, not frequent. Not every entity will be slashing and definitely not every frame.
AI is another good example where you hardly can optimize using big arrays of data. In starcraft linked list were used:

  Linked lists were used extensively in the engine to track units with shared behavior. With twice the number of units of its predecessor — StarCraft had a maximum of 1600, up from 800 in Warcraft 2 — it became essential to optimize the search for units of specific types by keeping them linked together in lists.

So, my question is: Is the cache friendly approach to optimize games wrong or misused?

sentences:
Serialization/Deserialization Solutions for Loading & Playing Audio Files I'm creating a music game in unity, and the first issue I encountered was that I had no way to load music into the game from a file. I tried using a WWW to load the mp3 files, but in my research I came across multiple sources that told me that this method would not work, and I was unable to get it to work in my own practice.
So, I found the Naudio library, which allowed me to convert the MP3 files to an array of floats which I then used AudioClip.SetData() to create an audio clip with. To avoid having to do this conversion every time I wished to load a new song, I thought to then serialize the converted audio data to a binary file which I would then deserialize to create a new audio clip when the song is requested, and that audio clip is then stored in a list for if I need it later during runtime.
This worked for a long time, but now I'm almost ready to ship my game and I'm realizing that the file sizes for these binary files are massive - upwards of 100MB in most cases of a 4 minute song. This is obviously unacceptable considering that the file size of a regular MP3 song of that length is less than a tenth of that.
So, I looked into using a DeflateStream when serializing and my research brought me to the DotNetZip library, which someone recompiled for use with Unity here. However, this did little to remedy my issue because 1) The compressed file sizes were smaller, but not small enough (still around 50MB for a 4-minute song), and 2) The time it takes to serialize the file skyrocketed from 3-5 seconds to upwards of 30 seconds.
Perhaps I'm looking at this problem the wrong way. Can anyone offer me some insight as to how I can load and play mp3 files at runtime?

sentences: Making a licensed game you want to make If I, for example, wanted to make a Spongebob game and was not asked to to do so by the company that owns the character, what would I have to do in order to get the rights to make the game?

sentences:
Problem with Update(GameTime) Methods and Pause implementation I have the pause function implemented and it works correctly in that it dims the player screen and stops updating the gameplay.

The problem is that GameTime continues to increase while it is paused, so my method that checks gameTime versus previousSpawnTime before spawning another enemy gets messed up and if the game is paused too long it is noticeable that the next enemy draws far too early.

Here is my code for the enemy update.

private void UpdateEnemies(GameTime gameTime)
    {
        // Spawn a new enemy every 1.5 seconds
        if (gameTime.TotalGameTime - previousSpawnTime > enemySpawnTime)
        {
            previousSpawnTime = gameTime.TotalGameTime;

            // Add an Enemy
            AddEnemy();
        }
...

I also have other methods that depend on gameTime.  I've tried getting the total pause time and subtracting that from the total game time, but I can't seem to get it to work correctly if that is the way I should go about solving this.

If you need to see any other code let me know.  Thank you.

sentences:
How to keep clicks from menu from interfering with game state? I ran into a problem coding my game in which when I click the play button on the newly implemented menu, it also creates a bullet from my player. The player and the menu both rely on the mouse input. How would I make it so that this doesn't occur? Perhaps how would I delay input from the mouse for a second until after the game starts?

Thank you.

public static boolean pressed = false;

public void mousePressed(MouseEvent e)
{
    int mx = (int) e.getX();
    int my = (int) e.getY();

    if(Game.state == STATE.MENU) {
        if(Menu.playButton.contains(mx, my))
        {
            // Pressed Play Button
            pressed = true;
            Game.setState(Game.STATE.GAME);
        }

        for (int i = 0; i < handler.object.size(); i++)
        {
            GameObject tempObject = handler.object.get(i);

            if(tempObject.getId() == ID.Player && pressed == true)
            {
                handler.addObject(new Bullet(tempObject.getX()+16,
                        tempObject.getY()+24, ID.Bullet, handler, mx, my, game));
                bullets_shot += 1;

            }
        }
    }
}

sentences:
Detect Car Wheel Position? I have an image:

I want to detect wheel empty position dynamically, is it possible?

If not possible please let me know, my work involves PHP/XML/Actionscript where actionscript get image url from xml generated by PHP,

User uploads car image through php admin panel, then passes url to actionscript through XML and actionscript should load image and let him choose the wheel and test on the car.

If you have another solution let me know?

sentences:
Why is interpolation passed into the rendering routine when the position and speed are related to the update routine? I've read this in several well known articles, including this one:

http://www.koonsolo.com/news/dewitters-gameloop/

Under the Interpolation and Prediction subheading is the description of the formula. I'm currently using the suggested game loop from the article (without passing in the interpolation). I get why interpolation is used, but I'm having trouble understanding why it is applied during rendering, and how it relates to my game.

I'm presently using pure tile based movement for 32x32 tiles. So my player moves from tile A to tile B so long as tile B can be occupied, and at a fixed rate of 1 pixel per 10ms. The state is "walking" until the player moves the full 32 pixels, at which point the state is "stopped". This all happens in a standard timer, but all during my update routine. My rendering routine simply takes the player's position and renders it onto the map. There is no "speed" per say in that equation that is accessible. So how would I use interpolation?

sentences:
(UE4) Simulate physics breaks timeline animation I'm using timelines to animate my boat object, which does not have any limbs.  So all I need to accomplish is rotation and a little movement.

However, when the player dies, I need the boat to sink using simulate physics.
When I turn simulate physics on, the timelines stop animating the boat.

The nodes I'm using are GetActorTransform and SetActorRotation

sentences:
How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame.

I am killing my sprite with sword.kill which is removing it from an all_sprites group, so it should disappear right?

Here is where i blit my images:

def draw(self):
        for sprite in self.all_sprites:
            self.screen.blit(sprite.image, self.camera.apply(sprite))
        pg.display.update()

Here is my sword class:

class Sword(pg.sprite.Sprite):
    def __init__(self, game, x, y, entity):
        self.groups = game.all_sprites
        pg.sprite.Sprite.__init__(self, self.groups)
        self.game = game
        self.image = self.game.sword
        #self.image = pg.transform.scale(self.image, (TILESIZE, TILESIZE))
        self.image.set_colorkey(WHITE)
        self.rect = self.image.get_rect()
        self.x = x
        self.y = y
        self.rect.x = x
        self.rect.y = y
        if entity.direction == 'down':
            self.image = pg.transform.rotate(self.image, -90)

        def update(self):
            self.kill()

And here is where I create my sword object:

def get_keys(self):
        self.vx, self.vy = 0, 0
        keys = pg.key.get_pressed()
        if keys[pg.K_LEFT] or keys[pg.K_a]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = -200
            self.direction = 'left'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkleft[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_RIGHT] or keys[pg.K_d]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = 200
            self.direction = 'right'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkright[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_UP] or keys[pg.K_w]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vy = -200
            self.direction = 'up'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkup[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_DOWN] or keys[pg.K_s]:

            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.direction = 'down'
            self.vy = 200
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkdown[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_SPACE]:
            self.attack = True
            if self.direction == 'down':
                print(self.rect.centery)
                self.sword = Sword(self.game, self.rect.centerx-7, self.rect.bottom, self)
        elif self.vx != 0 and self.vy != 0:
            self.vx *= 0.7071
            self.vy *= 0.7071
            self.swing = False
        elif keys[pg.K_t]:
            self.x = 1 * TILESIZE
            self.y = 1 * TILESIZE
            self.swing = False
        elif self.attack and not keys[pg.K_SPACE]:
            self.sword.update()
            self.attack = False

Any help would be appreciated. Thanks!

sentences: Make objects follow a strict path (Xna) I am making a defence game. Naturally, this means that there needs to be objects following a path on the screen. I want to make it a strict path from one point to another to another. I could use an array of vertices, but i need some help. Can someone please show me some code that could help me with this? Thanks.

sentences:
How do you make a ShapeRenderer always full screen on resize? I have:

shapeRenderer.setProjectionMatrix(stage.getViewport().getCamera().combined);

And I tried to do the following in render():

shapeRenderer.rect(0, 0, stage.getViewport().getScreenWidth(), stage.getViewport.getScreenHeight());

Which full-screens the ShapeRenderer when I first run my project, but as soon as I resize the window, the rectangle starts to change size and go off-screen. I'm using a FitViewport on my Stage, is there any way to make the ShapeRenderer always be full screen?

sentences:
Adding an angle variance to a 3d vector I am converting a particle emitter from 2d to 3d.

In the 2d system the original coder used a random angle variance and added it to the angle.  So it would be something like:

thisAngle = emitterAngle + angleVariance * RANDOM_MINUS_1_TO_1();

I want to do the same thing in 3d using an emission vector (vec3) and again an angleVariance.  My specific variance for this particle will still be angleVariance * RANDOM_MINUS_1_TO_1().  But how do I apply that angle a 3d vector so that the new vector could be any value X degrees off of center.  So if the original vector is straight up (0,1,0) the new vector could be off in the X or the Z and still normalized to 1.

Any hints?  I have all the matrix and vector functions at my disposal.

=====

Thanks to nathan I was able to write this code. Not sure if I've over complicated it somewhere. Once I test it I'll checkmark his answer:

    // first pick a random Z from [cos(angleVariance), 1]
    GLfloat varianceZ = [self randomFloatBetween:myCosf(angleVariance) andLargerFloat:1.0];
    // and a random angle for the azimuth
    GLfloat rndA = [self randomFloatBetween:0.0 andLargerFloat:360.0];

    // then calculate the X & Y to make this a vector off of the +Z axis with a max width of angleVariance
    GLfloat varianceX = sqrt(1 - varianceZ*varianceZ) * myCosf(rndA); // my functions input degrees not radians
    GLfloat varianceY = sqrt(1 - varianceZ*varianceZ) * mySinf(rndA);

Up to here the above code works.  It makes a variance angle off center but it is aligned to the +z axis.  The next part is supposed to rotate/transform the angle to my emissionVector angle so it's a variance off of that.  But so far this part isn't working.

    // next find an axis to rotate the point around to put it in line with the emmissionVector
    vec3 rotationAxis = normalizeVec3(crossProduct(vec3Make(0.0, 0.0, 1.0), emissionVector));
    GLfloat rotationAngle = acos(degreesToRadians(emissionVector.z));

    // make a quaternion out of the rotation axis and angle
    vec4 q = quaternionVector(rotationAxis, rotationAngle);
    // turn the quaternion into a matrix
    mat4 rotMat4;
    mat3 rotMat3;
    matrixQuaternion(q, rotMat4);
    getMat3FromMat4(rotMat4, rotMat3);
    // multiply the variance vector by the matrix to get a resulting vector with the variance added
    vector = matrixTransformVec3(rotMat3, vec3Make(varianceX, varianceY, varianceZ));

=====

The above code doesn't appear to be correct. I'm still working on the solution and will fix the above code when I get it working.

sentences: mobile: Is every position in percentages when you support multiple screen sizes (different aspect ratios)? Is every position in percentages when you support different aspect ratios? Or do you do if-else statements for each aspect ratio and put absolute positions? What are the pros and cons of each?

sentences:
Is there a way to balance a binary tree continuously? In my game I have a tree of objects in 3D space, to which new objects are frequently added.

Over time, the binary tree becomes unbalanced which is a big problem for efficiency as the tree can become quite large. It might even be at risk of stack overflows from deep recursion.

At the same time, it is important to keep branches of the tree close together in 3D space. So I can't arbitrarily swap tree nodes around to balance the tree.

Is there an efficient algorithm that will do the following:

Allow efficient additions to the tree (O(log n) max)
Keep the tree approximately balanced as additions are made
Ensure that branches of the tree contain objects that are close to each other in 3D space (i.e. it works at least approximately as a spatial subdivision tree)

sentences:
How can I correctly manage different utility classes between engine and libraries? I'm currently building an engine over SFML and Box2D.

The problem is that each of these use different types for things like Vector2, etc.

So to the question: is it a good idea to replace Box2D and SFML vectors with my own vector class (which is one of my better implementations)? My idea then was to have a separate .lib with all my classes that should be shared between all the projects in the solution.

sentences:
Quaternion Rotation - Clockwise or Counter-Clockwise? when we specify a Quaternion as (axis of rotation, rotation amount), in which 'direction' is the rotation, assuming we are looking down the rotation axis (i.e. camera at the origin, looking along the axis vector)?

Does it depend on the handed-ness of the co-ordinate system?

Or is it actually a moot point / stupid question?

sentences:
Stack based state design for isometric character movement, am I doing it right? I have been reading around about stack-based FSM, and I found it to be perfect for my game. However, when a character moves, it consequently have to face in some direction (and animation of each direction will be different), now the problem that I am facing in my state machine design is the scope of each state.

For example, should I divide the state into MOVE_LEFT, MOVE_RIGHT, MOVE_UP, MOVE_DOWN or should I create one MOVE state with some direction argument in it. Now, the latter seems to be better, however, if I am to trigger direction change, how would I do it for a one-state MOVE? I could directly change the direction argument and manually change the animation sequence, which will destroy the whole purpose of state machine (State machine should change animation sequence OnEnter() state). Else, I would have complicate the state machine into hierarchy of states (Sub-states,etc.), and this seem unconvincing for me.

Or maybe I should implement some type of multiple, simultaneous states ---- Character's State (Jump, Move, Idle, Attack, etc) and Direction's State (Up down left right), then make it works concurrently, and apply stack-based architectue on Character's State only.

sentences:
How to create a minecraft style world that is based of a heightmap For my game I am trying to create a Minecraft style world that is based off a heightmap that I made In Photoshop. I am trying to make the map which is 7km squared where each cube is 1m cubed but I haven't found a way to do it. The heightmap converts to a terrain file(in unity), but my problem is that I can't create the Minecraft look.

what I have done so far looks like this

what i want looks like this

sentences:
How can I let new players effectively compete with long-time players? When new players join my strategy game, they have 3 days of protection from other players attacking them, but that's not enough time to catch up to players who have been playing for longer.

How can I solve this?

I thought of extending the protection time, but if I do that, players will not be able to progress without attacking (gaining more resources for faster progress).

The game is browser-based with a PHP back-end.

sentences:
How can I orient a projectile along its flight path? I have a projectile that is moving around the world (in a ballistics trajectory right now). I am currently keeping track of its position and velocity. I want to draw it oriented to its velocity, so that it is facing the direction it is going. This seemed like as good of a time as any to try to understand quaternions so I was attempting to solve the orientation problem using them.

Here is my drawing code:

var alignmentVector = Vector3.Normalize(velocity);
var rotationAxis = Vector3.Cross(Vector3.Up, alignmentVector);
var rotationAngle = (float)Math.Acos(Vector3.Dot(Vector3.Up, alignmentVector));
var rotationQuat = Quaternion.CreateFromAxisAngle(rotationAxis, rotationAngle);

var transform = Matrix.CreateScale(5.0f) *
                Matrix.CreateFromQuaternion(rotationQuat) *
                Matrix.CreateTranslation(position);

PresentationHelper.Draw(model, transform); //This just draws the model using the transform parameter as the world matrix

This kinda of works, but not really. In fact, I am having a hard time finding the words to describe what is happening with it. It looks like its tracking for a little while then it goes off course and becomes flattened(is that possible????)

Am I on the right track with the quaternions and can my code be fixed? If not what is a good approach to solving it?

sentences: Why the canvas position is affected by screen resolution in Unity? I meet an issue that if I use 1024x768 resolution to run my game, the position(not local position) of the canvas is -1 in z axis. On the other hand, with resolution of 1136x640, the position is -5 in z axis(I never use code or anything to change its position). Is there any reason to cause this issue?

sentences:
When to use GameComponents? I know what it is and I'm using it as a frame counter for example. But when should I use it?

Does it make sense to say "I make all the input handling happen in a gamecomponent"? Is it flexible enough to add and remove fast in runtime? I see I can set the update order and draw order, but I guess to keep track of it an enum should be best like "GamePadInput = 0" or "MessageBox = 100".

Or should I just design simple, for example when I want to determinate if a messagebox is open checking "if (MessageBox.Active)" and then manually updating/drawing?

I'm a bit confused and can't decide what to do. I don't want to start designing the game and see later "oops". Maybe you can help me out :)

sentences:
Feasible to do all game logic on PHP server? For the turn-based browser Flash RPG I'm working on, I'm keeping all player stats in a MySQL database, with PHP as the go-between, for the sake of persistence and to prevent cheating by memory editing. But then it occurred to me that someone could cheat by hacking the client as well by, for example, repeatedly calling the function which adds gold to the database by posting arguments to a PHP page. That means I have to do all logic on the PHP server to prevent that.

Is that a feasible thing to do? My end goal is to have a commercial game that could have a large number of people playing at the same time, and I assume I need to be mindful of the number of operations being performed on the PHP server as well as the number of queries being made to the MySQL database. Although when I look at various web hosting providers that provide PHP and MySQL, none of them seem to mention any limitations on those two things. I'm hoping speed won't be an issue as well. On the free test server I'm using, it takes a couple seconds to get a result back from the database, but you get what you pay for.

sentences:
Map Engine Rendering Broken So I've been making my own tile map engine in LibGDX as the one currently implemented doesn't support collision detection with scaling. So I've come up with my own Layer and Map class and a drawing function for the map. Currently this is what it produces:

Here's the rendering code:

public void draw(SpriteBatch batch) {
    for(Layer layer : layers) {
        for(int x = 0; x < layer.getTileMap().length; x++) {
            for(int y = 0; y < layer.getTileMap()[x].length; y++) {
                batch.draw(layer.getTiles()[layer.getTileMap()[x][y]],
                        xOffset + (x * ((layer.getTileWidth() * scale))), yOffset + (y * ((layer.getTileHeight() * scale))),
                        (layer.getTileWidth() * scale), (layer.getTileHeight() * scale));
            }
        }
    }
}

EDIT: Yes, I'm aware the map looks weird, it's just random textures thrown in from a tile-sheet.

sentences:
Why my canvas isn't showing anything after I put code in the loop for tile map? My canvas stop showing anything when I want to display a tile 25 times. No errors. Here is the code:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
    image.onload = function() {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
    }
  }
}

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;

  this.image.onload=function(){
    var sprite = new StyleSheet(background, 16, 16);
    for (i = 0; i < 25; i++) {
      for (j = 0; j < 25; j++) {
        sprite.draw(background, 30, 30, 36, 36, i * 36, j * 36, 36, 36);
      }
    }
  }
  return this.image;
}

var background = new Loader("https://opengameart.org/sites/default/files/PathAndObjects.png");
console.log(background);

sentences:
Help with a snake like movement I am looking for an algorithm that moves an object at a regular speed in a snake-circular like movement. This movement should look pseudo-random and smooth, later on I am going to add other body parts, but so far this is the essential.

My try so far has consisted in having a random value t that chages each frame:

t= Random.Range(t-20f,t+20f);

and according to it I was employing a direction. The result should be more directions that are smoothly different, so that the movement itself is smooth.

I would score the solution with 7/10, and moreover, it doesn't describe like short circles, but rather larger ones and the negative result is that the object exits the scene quite fast.

What is your algorithm solution? On the internet I found solutions where the player moves the head of the snake, but here the object acts like an autonomous object.

sentences:
Change GUI in Java game I'm making a 2D Server/Client game, I have very little to no problems with the server but now I want to work on the client side code.
I'm thinking about using a JFrame and all the other GUI classes/methods.
My question is how do I change the GUI and all things that are displayed.
For example if the user opens the client I want him to login or register, if they logged in I want the client to display the game. Do I just display the new elements and delete the old or is there a other solution? I don't want to use 2 frames.

sentences:
How can I increase the return from from ads? I made a little Windows Phone game and I want to use AdRotator to show ads in the game. My game has 50 levels. Some levels take 30 seconds, other levels more than 3 minutes to complete them.

Will I make more money with longer levels? Can I get more impressions in longer levels?

My game has a free trial mode, but you have to buy the game if you want the entire content.

How can I increase impressions and get a high eCPM rate?

sentences:
Calculate needed speed and object's position in Unity3d So I'm trying to calculate an object's future position so my enemy can land to it safely. Idea is that using the future position I can calculate the angle and convert it to a direction vector and also using distance I can calculate the speed necessary to reach its target. I'm still kind of stuck with this idea.

Here is code which I'm using at the moment.

// Find the close platform to land
Transform _tmp = GetClosestPlatform(SpawnerNew.Platforms);
// Hard coded time, should be time which enemy should take to reach position
float _constNeededTime = 3f;
// As my game's speed always increasing every frame so I need to calculate it also how it's in future (GameManager.Instance.OverAllSpeedModifier is called 10x times / sec)
float _anticipatedLevelSpeed = GameManager.Instance.CurrentLevelSpeed + (GameManager.Instance.OverAllSpeedModifier * _constNeededTime * 10);
// trying to calculate the future postion of the platform
Vector3 _anticipatedLoc = _tmp.transform.position - new Vector3((_platformSpeed * _anticipatedLevelSpeed) + _constNeededTime, 0f, 0f);
// Calculate angle
float _angle = Mathf.Atan2(transform.position.y - _anticipatedLoc.y, transform.position.x - _anticipatedLoc.x) * 180 / Mathf.PI;
// Convert angle to vector direction
_nearestPlatformDir = new Vector3(Mathf.Cos(_angle * Mathf.PI / 180f), Mathf.Sin(_angle * Mathf.PI / 180f), 0);
// Trying to calculate speed needed to reach platform
_neededSpeed = Vector3.Distance(_anticipatedLoc, transform.position) / _constNeededTime;

sentences:
Algorithm to verify if a shape is inside another I have a rectangular canvas and I need to verify whether a shape is totally inside that canvas or not. The shape can be lines, ellipses, arcs, rectangles and arbitrary polygons.

Does anyone know a lib with this kind of algorithm, preferably in java?

I searched and found just Slick2D, but it has a bug exactly on the method that verify if shape contains another shape.

Just to exemplifly, in the figure only shapes 2, 4, 5, and 7 are inside the canvas.

sentences:
Perspective View using Spritesheets I am creating a Top-View 2D game. However, the only way i can get a good view of the objects, such as houses, trees, is to make the game in orthographic view. The same way games such as Pokemon games in GameBoy Advances used. Until i found out that, GTA 1 and 2 are originally in top-view. Whenever the car (your focus) passes a building, the view of the building changes, specifically, the "Skewness" of the building.

Is it possible to do this using SpriteSheets? or atleast a single image and just dynamically change its attributes? or GTA 2 is already using a 3D game engine.

sentences:
Unreal Engine 4 AI Character Pawn Entirely Unresponsive to Movement Commands I'm new to game development and to Unreal but I cannot for the life of me get my AI character pawn to move at all using any method I know.
I'm developing a 2d Sidescroller game using a Tilemap. I have made sure collision is set up with the map and tiles, the player character can interact with it all just fine, and I made sure to widen the collision thickness of the map so that the navmesh can properly appear (as seen with the green areas).
Nav Mesh loading. AI spawns in the air and falls down so I know he isn't overlapping with the ground

I've disabled and enabled collision for the static mesh cube component in the character pawn, but he still doesn't move.
The goal is to get him to follow the player when he sees him. The pawnsensing trigger works just fine, as I had it print whenever he sees him, and he even properly gets to the point of executing the "follow player" function (the print statement works).
However, using AIMoveTo fails every time. I've tried putting the player as the target, the player's worldLocation as a vector, and even an arbitrary point vector to the right of the AI but AIMoveTo fails every time.
I've deleted and replaced the NavMesh, and I've even tried completely skipping using AIMoveTo and just using Add Movement Input in both the AI Thinking Blueprint and Character Pawn Blueprint but neither make it move. I literally put an Add Movement Input function on the Pawn's event tick but it never moves.
Any suggestions?
Code:
AI Logic event is triggered every tick

Character Pawn Tick (for debugging). Does not cause the Pawn to move

sentences:
Shader graph in Oculus (Screen position) I have created a blur shader graph to blur a material. It works perfectly fine in the scene mode and also in windows application. However it does not work as expected in Oculus VR. That is, the texture in the material shakes/moves with the camera. I am aware that the problem would be with screen position node with tiling and offset since the Oculus works differently. Has anyone faced this issue and found a solution?
EDIT: It is related to rendering issue. Oculus Quest has multi-pass rendering so the left eye works fine but the right eye has issues. Any solution?

sentences:
Linking classes together My game is now getting to the point where I have alot of classes. Currently, I'm linking all those together through my MainGame Gamestate class. So in my MainGame class I have a Camera instance, a World instance, a Player instance etcetera. Now I know this is bad practise, as this is gonna get real dirty real quick.

What is the correct way of 'linking' loads and loads of classes and systems together?

For example:

In my MainGame class I have a GUI (own GUI library) defined called DebugMenu. Now in this menu I have an input field to change my FOV. When I click the button to update the FOV, the ClickButton event i called in the DebugMenu class which is inherited from the GUI class. To change the FOV I have to call camera.setFOV(40). This camera is an instance, so I need to find the instance that the system is using! That instance is declared in the MainGame class.

I'm using Java.

sentences:
How should I render multiple objects in OpenGL? I am just getting my head wrapped around modern OpenGL. Let's say that I would like to draw 10 objects, how would I structure that? Would I call glDrawElements(...) in a for loop 10 times?

void render() {
  shader.bind(); // calls glUseProgram
  bindVAO();     // calls glBindVertexArray

  for(int i = 0; i < 10; i++) {
    glDrawElements(....)
  }

  unbindVAO;
  shader.unbind();
}

sentences:
XNA 4.0: Problem with loading XML content files I'm new to XNA so hopefully my question isn't too silly. I'm trying to load content data from XML.

My XML file is placed in my Content project (the new XNA 4 thing), called "Event1.xml":

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="MyNamespace.Event">  // error on this line
    <name>1</name>
  </Asset>
</XnaContent>

My "Event" class is placed in my main project:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace MyNamespace
{
    public class Event
    {
        public string name;
    }
}

The XML file is being called by my main game class inside the LoadContent() method:

Event temp = Content.Load<Event>("Event1");

And this is the error I'm getting:

There was an error while deserializing intermediate XML. Cannot find type "MyNamespace.Event"

I think the problem is because at the time the XML is being evaluated, the Event class has not been established because one file is in my main project while the other is in my Content project (being a XNA 4.0 project and such).

I have also tried changing the build action of the xml file from compile to content; however the program would then not be able to find the file and would give this other warning:

Project item 'Event1.xml' was not built with the XNA Framework Content Pipeline. Set its Build Action property to Compile to build it.

Any suggestions are appreciated. Thanks.

sentences:
How do I handle loads of (prefab?) objects in Unity2D/3D? I have been looking around for information regarding this process but I was unable to come across anything that would help me out. Basically, in a game where you may have many items or enemies or player objects, how would one go about creating these objects?

Am I supposed to be creating every single one of these objects as a prefab and then load them into the game when needed? Or is it possible to create one object that has references to the different variables needed to create the above objects and then load in from an external source all the necessary information? And then during run time, depending on what object I am looking at, the script will 'create' the object with the information from the external source.

Meaning, if I decide to have 50 different enemies in my game, do I need to make 50 prefabs, one for each enemy? Or just one prefab that loads in data pertaining to the 50 different enemies and then build upon that information?

Thank you!

sentences:
Car Modelling for race game I am taking Computer Graphics course this semester and we have a video game competition. I am making racing game with simulated dynamics. Our professor told us that we don't have to do much of a modelling but since we haven't started the gaming part and since I have free time I want to model the car.

My question is firstly which software do you recommend to design game components? I know Maya right now. Secondly, if I design the car or any other part, what should its polygon count in order to run game smoothly? I can design pretty much everything but I assume that it is hard to design low-poly models.

sentences:
How to compute point in view space from depth? I am trying to implement do some screen space rendering but after looking over the web I still don't find answers to some doubts.

First, I need to compute the point in view space from a value in the depth buffer.

View-space means the camera-space or the clip-space?

I also found that, inverting the projection transformation I can get a point from the depth with a formula like

P(x,y) = [(2x/Vx-1.0)/Fx , (2y/Vy-1.0)/Fy , 1] * z(x,y)

where Vx/Vy are the dimensions of the viewport and Fx/Fy are the focal lengths

I don't understand where does this formula comes from, if I have it correctly the perspective projection formula is different. Can someone explain me this?
A point in view-space is a 3D-point, but why is the third coordinate 1?

sentences:
In Unity, how do get access to animation clips in selected model from EditorWindow? I need to add some animation events or copy them from other models. So I decided to make a EditorWindow. Unfortunately there's not much information about this, and I'm stuck in here.

void OnGUI() {
    GUILayout.Label("Source Object contains Animation Clips", EditorStyles.boldLabel);
    sourceObject = (GameObject) EditorGUILayout.ObjectField(sourceObject, typeof(Object), false);

    if(GUILayout.Button("Copy")) {
        if(sourceObject == null) {
            throw new System.NullReferenceException("Source Object is missing.");
        }

        // Do Copy here

    }
}

What I need to do is:

Extract all animation clips from the selected model(fbx) - it's the source object
Select "AnimationClip" to want to copy. Note that AnimationClip in here is not inside of model, it's seperated AnimationClip that duplicated from original model because basically animation clip from imported model is read-only, so I have to duplicate to update it.

How do I get animation clips from selected fbx model with ObjectField? Any advice will very appreciate it.

sentences:
Moving an object extremely close to the camera at a constant speed makes it visually speed up I have a quad in 3D space (a billboard in the real-world sense) that I want to move close to the camera so the user can inspect it. The quad is defined by the 3D coordinates of its four corners.

To accomplish this I compute target points very close to the camera for each of the corners.

(I use XNA's Viewport.Unproject() method which does something similar to this)

// Top left corner of the screen,
// Z=0.1f means very close to the camera's near plane
var screenPoint = new Vector4(0,0,0.1f,1);
var worldPoint = Vector4.Transform(screenPoint, Matrix.Inverse(ViewMatrix * ProjectionMatrix));
var worldPoint /= worldPoint.W;

These world points that are close to the camera produce a very small quad: which is understandable if we look at this picture:

Here the initial position of the quad is depicted in red and the end position of the quad is depicted in blue.

For each of the corners of the quad I linearly interpolate between the original position and the position near the camera.

this.timer += deltaTime;
var progress = this.timer / 10.0f;
var currentTopLeft = Vector3.Lerp(initialTopLeft, nearTopLeft, progress);

Since I linearly interpolate the quad moves to its new position at a constant speed. I've verified this by ouputting the speed and distance to the console. However, the visual effect is that the quad first hardly moves and then all of a sudden moves very fast to its destination.

I think this is because the quad is being scaled down while moving closer (to fit the near plane) so it will stay relatively the same size on screen for a long time. Only once it comes very close it seems to move. (For example see this answer).

The question I have is: what can I do to make it look like the quad is moving closer at a constant speed?

I was thinking about not interpolating linearly but first move progress very fast and then very slow (Ive tried progress = sqrt(progress) which helped a little). But I'm not sure how I can compute the exact (or near enough) formulate to make this work.

Another idea I had was to bring the quad not so extremely close, but then there is the danger of it clipping with objects in the world.

sentences: Indexing a point outside of a 3D signed distance field I have a 3D signed distance field that is voxelized into a grid, surrounding an object. However, I would like to query the signed distance field to determine the shortest possible distance between points outside of the signed distance field grid, and the mesh itself. Is there any way to determine this distance without increasing the size of the signed distance field? Thank you!

sentences: How can I make custom progress bar in unreal engine? I am trying to make a health bar. I want a masked progress bar so I tried making another progress bar and moving according to the percent of the health in blueprint. But I couldn't find any documentation about it. How can I do it? Or is it possible? It should be like this:

sentences:
Using LibGDX, is it necessary to clip what I'm rendering for efficiency? So I am working on a game, and I've noticed that everything in the world is sent to be rendered. Of course with the camera, only some of the world is rendered.

Does this mean there is there any expense for when I send all those extra vertices to OpenGL that don't show up on screen? Will OpenGL/LibGDX do it automatically?

If I should clip it, is ScissorStack the way to go?

sentences:
LibGDX - how to close game and dispose objects properly can someone tell me how to close game and dispose objects properly? I tried several methods but always have problems. I have ImageButton with ClickListener.

Here's code of listener:

exitListener = new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                getGame().dispose(); // reference to GameClass
                Gdx.app.exit();
                super.clicked(event, x, y);
            }
        };

but something causes problems because I have error:

  buffer not allocated with newUnsafeByteBuffer or already disposed

and logs show that stage.dispose() causes problems.

sentences:
Windows Form code not executing? Ok, I've got a weird one here.  I'm trying to make a basic tile engine using a windows form, but some of my code is just...not happening.  I'll post the chunks in question.

private void MapEditor_Load(object sender, EventArgs e)
    {
        LoadImageList();
        FixScrollBarScales();
        cboCodeValues.Items.Clear();
        cboCodeValues.Items.Add("ENEMY");
        cboCodeValues.Items.Add("CHEST");
        cboCodeValues.Items.Add("NPC");

        for (int x = 0; x < 100; x++)
            cboMapNumber.Items.Add(x.ToString().PadLeft(3, '0'));

        cboMapNumber.SelectedIndex = 0;
        TileMap.EditorMode = true;
        backgroundToolStripMenuItem.Checked = true;
    }

This should be called when the form loads, right?  The code dives into LoadImageList(), which contains:

private void LoadImageList()
    {
        string filepath = Application.StartupPath + @"\Content\Textures\IndoorTileSet.png";
        Bitmap tileSheet = new Bitmap(filepath);
        int tilecount = 0;
        for(int y = 0; y < tileSheet.Height / TileMap.TileHeight; y++)
        {
            for(int x = 0; x < tileSheet.Width / TileMap.TileWidth; x++)
            {
                Bitmap newBitmap = tileSheet.Clone(new System.Drawing.Rectangle(x * TileMap.TileWidth, y * TileMap.TileHeight,
                    TileMap.TileWidth, TileMap.TileHeight), System.Drawing.Imaging.PixelFormat.DontCare);
                imgListTiles.Images.Add(newBitmap);
                string itemName = "";
                if(tilecount == 0)
                    itemName = "Empty";
                if(tilecount == 1)
                    itemName = "Floor";
                listTiles.Items.Add(new ListViewItem(itemName, tilecount++));
            }
        }
    }

The bitmap loads correctly, but then the entire MapEditor_Load method just stops working.  tileCount seems to be a local variable in the debugger, and its value is 0, but the debugger never executes the breakpoint on the line which it is assigned.  I have absolutely no idea why it would do this, and it's driving me nuts.  Any help?
Oh, I put the bitmap load in a try/catch block just to see if it was handling an exception in a weird way, but I had no luck.  It's not throwing an exception.  I began having this problem immediately after replacing my IndoorTileSet with an updated version.

sentences: is it possible to use c# GUI toolbox in an XNA app? I need both reach GUI features of c# toolboxes and fast rendering features of XNA, is there any way to merge these two into one app? or is there any other way? for example some equivalent to c# toolbox in xna?

sentences: How to read a color of a pixel from texture (cocos2d-js)? How to read a color of a pixel at [x,y] from a texture (in cocos2d-js)?

sentences:
Multiple lights shadows I'm trying to achieve multiple lights shadows. Currently my program works using only 1 spotlight as a light source that produces shadows. Well... I want to involve multiple lights to give a more realistic effect to my scene.

However, I'm facing a scenario which is a little bit unclear for me:

The steps I follow to create shadows is

a) Create FBO

b) Render scene from light's perspective using a depth texture attached to my FBO

c) Render the scene normally, using my texture from my FBO as a shadowmap texture in order to be able to sample it and creating finally shadows.
The steps I follow to create multiple shadows is

a) Create FBO1 and FBO2

b) Render scene from 1st light's perspective using a depth texture attached to my FBO1

c) Render the scene normally, using my texture from my FBO1 as a shadowmap texture in order to be able to sample it and creating finally shadows.

d) Render scene from 2nd light's perspective using a depth texture attached to my FBO2

e) Render the scene normally, using my texture from my FBO2 as a shadowmap texture in order to be able to sample it and creating finally shadows.

Now, the step 1) is pretty clear, works fine. When I manage to implement step 2), something happens: the shadows rendered will be the shadows of my last light (depending the order I call rendering methods). So in this case I get shadows only from my 2nd light.

If I reverse the order of calls (this order: a -> d -> e -> b -> c) and render first in my second FBO and then in my first FBO I get the shadows from my first light source. So basically I conclude: my shadows are not working simultaneously.

Is this the correct approach? (I've seen a solution which uses in fragment shader an array of shadowMaps, an array of lightSpace coordinates so this involves multiple uniforms... what do you think about this?)

Thanks

sentences: Issue in using Set Integer (by ref) in Unreal Engine 4.16 blueprint I am trying to set the value of an integer by reference in a macro created in my blueprint script. The macro does a simple conditional check of an integer and increments it if it is less than a max value. I was using one of the maze generating tutorials and the function throws a failed to resolve term Value passed into Target error. I am not sure why it cannot deduce the type of Value. The original tutorial was made in UE 4.6, so could it be due to updates made in UE 4.16? I have attached a screenshot of my blueprint.

sentences:
How do I map a 2D grid to my game object coordinates? I'm using Gameplay3d as a game engine to develop a simple board game, PEG Solitaire.

I've come to the part where I've created a 2D grid for all the movable object, empty locations and also where it's not movable. I'm now trying to somehow map that 2D grid to my actual game coordinates, translations of my pieces. Using Gameplay I can select my objects. What I'm trying to figure out is how to solve this actual problem to map my grid to the actual movement of the game pieces?

I was maybe thinking of using an std::map<char*, int> where "char*" is the NodeID and "int" is the index in the 2D grid list so that I can identify each Node and where they are in my 2D grid.  The problem I'm having now is how can I solve the problem if the user select places on my board that doesn't have moveable piece. Let's say the user clicks on an empty hole on the PEG Solitaire board. How can I map that location to my 2D Grid?

I've created my board model and Sphere using Blender. I can using Gameplay use raypicking and select the differente Sphere Nodes and the whole Board Node. The problem is that I can't pick the individual holes on the Board as Nodes.
I know the center position of each hole on the board. So my solution was to somehow first figure out the Spheres world size maybe translate it to the screen size. When the user then clicks on the screen I can check if the position of x and y is inside the selection area of that hole so to say. I'm probably just wondering away in my own thought. But any detailed help here would be appreciated.

Get object world size and translate to screen size of possible.

The 2D grid looks like this:

0022200
0022200
2222222
2221222
2222222
0022200
0022200

sentences:
Removing inline declarations makes code work. Why? This does not work:

camera = new OrthographicCamera(100, 100 * (Gdx.graphics.getHeight() /Gdx.graphics.getWidth()));

This does:

float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();

camera = new OrthographicCamera(100, 100 * (h/w));

I do not get the difference. One displays fine on my screen, the other remains black.

Why is this? Is there any syntactical reason why this does not work, or is it a bug?

sentences:
Turn a single player game into multiplayer game hobbyist / indie dev here and I was wondering about network programming and making a game capable of multiplayer.

So basically I just haven't touched on network programming yet and really don't know much and have very little experience with coding multiplayer games. So with that in mind I have a project I want to make and I have all the key points pretty much on paper and a clear vision of what I want to make, I am also going to end up recruiting help (for such things as multiplayer capability more than likely as well as other aspects) since this is outside the scope of my ability to do alone.

I do not plan on having this game hosted by a central server I control and am leaning heavily on the side off a type of p2p connection like minecraft / starbound / terraria (I think those are p2p anyway) with that in mind is it extremely important that I code / build the game with multiplayer from the ground up or might I be able to work on other systems first such as game mechanics and the procedural world creation first and might it be easy to basically create a multiplayer system ontop of the game?

I guess the question is kind of broad but what it boils down to is might it be critical to focus on the networking / multiplayer first or is it a safe and(or) common practice to implement it later in development?

sentences:
What are the main reasons to use scripting in games? I'm trying to understand the appeal to scripting in large games.

Is it ease of development by avoiding lower level coding like C++? Thus avoiding the long compile times?

It seems scripting doesn't often have the benefits of rich tools like IDE and debugger and requires an adaptation layer to expose the low level code to the scripting interface.

Is it to keep options for changing story line and game play until later in the process? If so, at some point the scripts must be compiled or encrypted to prevent tampering.

sentences:
Clipping wrong results in C++ DIRECTX 11 Im trying to do some clipping but having some weird results. The triangle is not getting clipped how it should be. Here are some images.
The second image is how it should.

video of what is happen VIDEO OF WHAT IS HAPPENING

What is wrong with my code that is making the triangle wrong way.

CLIPPING ALGORITHM

ClipVertex( const Vector3& end )
{
    float BCend = mPlane.Test(end);
    bool endInside = ( BCend >= 0.0f );

    if (!mFirstVertex)
    {
        // if one of the points is inside
        if ( mStartInside || endInside )
        {
            // if the start is inside, just output it
            if (mStartInside)
                mClipVertices[mNumVertices++] = mStart;

            // if one of them is outside, output clip point
            if ( !(mStartInside && endInside) )
            {
                float t;
                Vector3 output;
                if (endInside)
                {
                    t = BCend/(BCend - mBCStart);
                    output =  end - t*(end - mStart);
                }
                else
                {
                    t = mBCStart/(mBCStart - BCend);
                    output = mStart + t*(end - mStart);
                }
                mClipVertices[mNumVertices++] = output;
            }
        }
    }
    mStart = end;
    mBCStart = BCend;
    mStartInside = endInside;
    mFirstVertex = false;

}

PLANE EQUATION

Plane clipPlane( 1.0f, 0.0f, 0.0f, 0.0f );

In directx 11 in a Left Handed system

sentences:
Do players like holiday events? I remember back when I played runescape, they always had these really interactive holiday events. And players would be squirming all around trying to find where it was. After you would complete it (it was like a mini-quest), you would be rewarded with some kind of item. I thought it was really cool, but if you missed the event you'd be pooped out. And now days, I play simpler games, such as parallel kingdom, and they just have boring items that you can buy for holidays.

Is it worth making holiday events, or could you get by without them?

sentences:
How to revert to MonoDevelop's old "ctrl-tab" behavior? I believe MonoDevelop (bundled with Unity3D) has changed its ctrl-tab and ctrl-shift-tab behavior and I would like to get back to the old behavior, as the new way frustrates my workflow.

Ctrl-tab (and ctrl-shift-tab) previously (and ought to) go to the "last viewed tab", in a similar way to how alt-tab works on Windows. Unfortunately there seems to have been a change and now it goes to the "tab on the left of the current one".

An example of why this is frustrating: quickly looking at a class definition, you hit F12 to load the definition (perhaps in a new tab), and then you want to go back to the code you were working on. Previously you could hit ctrl-tab and you'd be back there. Now you can't do that and you have to actually remember what you were doing, which isn't good for my workflow (read: ailing memory).

I'm not sure when the change happened, or if it's a setting somewhere (I can't find it). I'm running Unity 5.1.2p2 and its bundled MonoDev 4.0.1. Noticed it after a clean install of Windows 10.

How can I fix this to revert to the old behaviour, or is there some other method to jump back to the last viewed tab?

It seems pedantic but it has a major impact on my productivity.

sentences:
Multiplication for MVP matrices: Any benefits to doing so within the vertex shader? I'd like to understand under what circumstances (if any) it is worth doing MVP matrix multiplication inside a vertex shader.

The vertex shader is run once per vertex, and a single mesh typically contains many vertices. All MVP inputs remain the same for each vertex in the vertex batch relating to a given draw call (model). Surely then, you're always better off keeping the multiplications in the client code, such that you pass in the whole MVP precalculated as a uniform? (avoiding redundant ops between individual vertices)

sentences: how to draw a dashed curved line to a point in as3? How can I draw a dashed curved line to a x,y point in as3? Basically I'm creating a game where you have a turret, and I want the arc the turret would fire a projectile along to be displayed as a dashed/dotted line along the arc to wherever the mouse x,y is. Ideally it would use the drawing API, rather than using any bitmap manipulation.

sentences: Simple message box in gdscript / godot I want a single line of code which shows a popup dialog with the words "Hello World!" and an "Ok" button.  (I want something simple for now, I know how to make something more complicated but that would be stupid at this point in development).

sentences: How to simulate wind in 2D For a 2D scenario, I want to have a fan blow at an object and make the object move with the "wind". How can I simulate the wind force blown by the fan?

sentences:
Finding the nearest object, considering obstacles For the purposes of this question, we'll assume it involves a Janitor assigned to clean up trash in a building.  Given that it is a building, it is safe to assume there are one or more rooms, walls, etceteras that act as physical obstacles.

It's time for the janitor to earn his paycheck, and he heads to the nearest piece of trash to clean up.  We can resolve this in two ways:

The cheap way.  Simply do a distance check and head to the nearest.
The expensive way, Path-find to pieces of trash and pick the one with the easiest/shortest route.

Now, (1) is cheap computationally but can give false results.  A piece of trash could be on the other side of a wall but only 3 "squares" away - it'll actually take the janitor a lot more time to get there then say, a piece of trash in the same corridor 5-squares away.

(2) would give more accurate results, but requires a metric-ton more computation.

Are there better approaches to "nearest thing", or would you just have the janitor wander around on a pre-set route that covered "as much as possible" and just have him clean up as he goes?

sentences:
Restrict Up/Down rotation, detect angle upwards/ downwards I have an object using Quaternion.LookRotation() to look at target object, I would like to be able to restrict the rotation by being able to set the range that the object can rotate at, for example from 45 degrees to 180 degrees, this would mean the object does not rotate lower than 45 degrees and does not rotate higher than 180 degrees, currently my code looks like this:

void Start(){
    baseRotation = transform.localEulerAngles;
}
    Vector3 targetPos = Target.position;
    Vector3 dif = targetPos - obj.position;
    dif.z = 0;

    Quaternion lookAngle = Quaternion.LookRotation(dif, obj.up);
    print("angle: "+ Quaternion.Angle(lookAngle, Quaternion.Euler(baseRotation)));
    if (Quaternion.Angle(lookAngle, Quaternion.Euler(baseRotation)) < rangeMax - rangeMin)
    {
        targetR = lookAngle;
    }
        obj.rotation = Quaternion.Lerp(obj.rotation, targetR, Time.deltaTime * 100);
}

However this code makes sure that rotation both upwards and downwards equally does not exceed the same angle, which is not quite what I want, as I said I would like to set the start angle and the end angle. How would I do that? Could you post the code that would give me an idea?

Thanks in advance!

sentences:
XNA - just a few more characters accepted in a SpriteFont I have a SpriteFont in XNA, which has the standard 126 characters that are usable.

However i would like to use the "ಠ" symbol in the game.

So is there anyway of adding just a few more symbols that the spritefont accepts?

Cheers,
Randomman159

sentences:
How to raise funds for game developement Creating a game can be a costfull process, if you are working on it full time with around 4 people for 2 years (buidling from scratch) you need about €400.000 for salaries alone.
(An average medior skilled employee will easily cost €50.000 a year)
(I want to work with skilled people that are available 24/7, not hobby programmers etc. that just do it on the side for fun. I need 100% dedication and motivation)

Is using crowdfunding like kickstarter usefull for small game developers?
Can this really get you the required amount of money?

Most projects on (for eaxmple) kickstarter that are started by well known names in the industry collect a lot of money (sometimes over a million).

As a small team being 'unknown' anyone can start a project, but how can you get enough funding? I don't see myself collecting about €400.000 using sites like kickstarter.
Not even with the best idea in the world, because people simply don't know you and will not invest in anything they don't believe can be accomplished.

I would prefer not to need investors since they will have the biggest share in your company and you need to do what your told by them, thus loosing all sorts of freedom in the development process. Also they will need a some sort of guarantee about how you are planning to earn money with the game, which of course you don't know about at the start.

In the Netherlands it is possible to get funds from the government for this sort of stuff, but that's still a really small portion of what is needed.

So my real question is: what is the best way to gather the required amount of money to start game developing full time?

sentences:
Normal map causing certain faces to get shaded I added a normal map to a MR arch & design material in Max 2012. I have a specular in the reflection color slot and a diffuse in the diffuse slot. As i increase the intensity of the normal map i certain faces get darker and they get really "obvious". Last time i was fiddling with this the exact same thing happened which made me quit normal maps and all. Some UV's are overlapping and the normal map is made with the Nvidia photoshop plugin. My scene just has a daylight system with a MR sun and MR sky.

Does anyone have an idea what is causing this?

As you can see the face gets shadowed as a whole. The face next to it has the same problem on the opposite corner you see the same effect but much less hard.

sentences:
Is It More Efficient To Make Games In Languages I Like? Is it more "efficient" to develop games with languages you're good with and like best rather then the "best" language?

For example: I like C# (It's My First Language) and I'm really good at it and used to how it works. I'm not as good with C++; I'm kinda slow at it because I don't prefer how the systems work, like I think int a[] is not as good as int[] a.

Would it be better to go with what I know best or what's the "best" available?

sentences:
What is the proper name for a 2D voxel? I know pixel might be right, but pixel means something different, especially if a "2D voxel" isn't exactly one pixel (it isn't, in my game).

I've also heard "texel," but that seems to refer to a repeating texture, which this isn't. I guess I'm just getting hung up on words, but is there a proper term for this?

(For an example of the thing I'm referring to, look at Terraria.)

sentences:
Physics Simulation - Pushing an object with user control I'm working on a 2D game engine using C, SDL and OpenGL. Have worked out basic graphics, physics, and broad phase collision detection. I am trying to realistically simulate "pushing" objects around. I have gotten halfway there, but it doesn't feel right. I've implemented the impulse calculation found here to change linear and angular velocity. I want the blocks to have weight to them, and to slow the player down.

Consider this video. The leftmost block is player controlled. This is how my simulation feels right now.

Is there a relevant mathematical formula for this?

sentences:
Organizing scene graph nodes that have multiple parents I am trying to understand how, from an abstract sense, scene graphs should be organized.

Say that in a game, there is a scene where the user is inside a house. The house has four walls, and on one wall there is a painting. There is also a wood stove resting on the ground but with an exhaust pipe that extends up and "through" the ceiling. Also on the floor, there is a table with a pen and a piece of paper on it. How might this particular scene graph be organized?

house/
    wall_1/
    wall_2/
        painting
    wall_3/
    wall_4/
    floor/
        table/
            pen
            paper
        woodstove
    ceiling/

Here's the root of my question: the wood stove connects to both the floor and the ceiling, so which parent node should it be a child of?

sentences:
Applying multiple forces on a particle If I have a particle, say in a polar coordinate grid, and I want to apply multiple vectors to it, how can I calculate where it's final position will be given those vectors?

Ex. Imagine there's a force represented as a vector, that moves the particle a radius magnitude of 8 at an angle of 45°. Another vector that acts on it at the same time, at magnitude 3 at 90°. How would I calculate the final position of the particle?

sentences:
Unity C# Microphone input in Android different than on PC? I'm working on a mobile app inside Unity, in which I need to input and repeat microphone input almost immediately..

I've worked it out and it works great when I play it from within the Unity Editor. I get some very strange behavior though when I try it from my Android phone (Galaxy Note 3)..

So I decided to run some tests and noticed quite different behavior..

Using this sample code:

using UnityEngine;
using System.Collections;

public class testingMicScript : MonoBehaviour {

    void Start () {
        audio.loop = true;
        audio.clip = Microphone.Start (null,true,10,44100);
        while(!(Microphone.GetPosition(null)>0)){}
        audio.Play ();
    }
}

and playing it from withing the Editor it works great, I speak and hear myself back after a few milliseconds. I compile the app and run it from my phone and when I speak I get a very strange echo which goes on until the sound is completely distorted and I get a strange hiss, until audio is completely muted..

Why is that? Is there any particular setting I should go through? Or do I have to change something in my code?

sentences:
How to match user click and the sprite object position in libGDX framework I am using libGDX Java framework for developing a practice game in Eclipse.

My game is in landscape mode and I am using sprite image for game assets. Actually I am trying to follow the Kilobolt Zombie Bird tutorial.

I have set orthographic camera like this:

cam = new OrthographicCamera();
cam.setToOrtho(true, 250, 120);

I have done this because my background texture region is of 250 x 120 px in the sprite image.

So basically my sprite image is small in size and it is getting scaled according to the device but all the computing is done relative to 250 x 140 px like for changing the position of the object I have defined Vector2 position = new Vector2(x, y); and if I write position.x = 260; the sprite will go outside the screen even if my device width is 500px.

Problem:

Now I have to make the moving sprite vanish when someone clicks on it (just imagine zombies moving around and if I click on them they die). So I am using the following code for matching user click coords with the object coords:

int x1 = Gdx.input.getX();
int y1 = Gdx.input.getY();
if(position.x == x1 && position.y == y1){
    // do something that vanish the object clicked
}

The problem is position.x and position.y returns the coords relative to the ortho cam width and height which is 250 x 120 px and the click coords are relative to the device width and height which maybe anything according to the device. Because of this even if I click right on the object the click coords and the object position coords have a huge difference in their values. So I would never get matching values.

Is there any solution for this or am I doing it wrong?

sentences:
What's best to use OTF or TTF? What's the most recommended format should I use for fonts, OTF or TTF or another?

In looking for:

Performance/Efficiency with SDL_ttf library
Free/Open-ness [1]

[1] I'm planning to use GPL3 and Open Font License.

sentences:
How to get a job in the game industry if you live in a country where there are no game companies? You know not everyone of us is living in the US/Europe where there is potentially many more employers/opportunities than other countries, I live in a country where there is literally zero game companies (aside from a couple of companies that make HTML games), but I am sure there are many other people with the same situation, I am making some prototype games that will/might help.

But the real question is there any better way to get noticed (at least get an interview) by international companies, or given you are living far away will diminish their interest in hiring you?

-This question might be considered subjective or even a duplicate, but I feel am addressing an issue that might not have been addressed.

sentences: Sprite/Object/Room limits in GameMaker 8.1? I know about GameMaker Studio’s limitations for sprites, objects, rooms, and other assets (https://help.yoyogames.com/hc/en-us/articles/230407528-GameMaker-Studio-2-Trial-Limitations), but I can’t find anything about if there are similar limitations in GameMaker 8.1, which I also have on my computer. What are the limits for sprite, object, background, and room count in the Lite and Standard versions of GameMaker 8.1, if there are any?

sentences:
How to improve my graphics on HTML5 canvas? I am making my own army fighting simulator. Designer have made an 3D model with Blender and textured it, made animations. I have made sprites from that model and did programming. But the result is not as good as I expected. You can look at armyfight.com/simulator.html (refresh until it loads all images properly if it didn't at first time) and when you maximally maximize, you can see there are units moving. But I want to be them clearly visible, with details, high resolution like in flash-games and also that when they are really small units, would be understandable.

Is it possible on canvas?

Or it is my mistake and I must do somehow more HD sprites? I'm stuck now, and I don't know to improve the graphics..

sentences:
Rendering a raycasting view I am trying to reproduce the raycasting of the game Wolf3D. I read this tutorial, but I am struggling to understand how to code the intersection between the rays and the walls by using angles and pixels.

I have coded something but my approach to the concept seems quite wrong:

void    ray_cast(t_wolf3d *w)
{
    int         wall_hit; // tell us if a ray hits a wall so we can stop the algorithm
    t_ray       ray;    // add the ray if we don't hit a wall
    double      angle_s; // will be a part of the FOV (subsequent column)
    int         rayAdvance = 0;

    int         x; // for each pixels ont the screen

    angle_s = 0.0;
    x = -1;
    while (++x < W_M) //W_M represents the width of the map
    {
        while (angle_s < FOV / 2) // cast rays
        {
            rayAdvance = 0;
            while (++rayAdvance <= (277 / cos(angle_s * M_PI / 180.0))) //comparing distance for every pixels in the ray to the ray distance
            {
                ray.x = w->posx + rayAdvance * cos(angle_s * M_PI / 180.0); // converting degrees to radians inside cosine and sine
                ray.y = w->posy + rayAdvance * sin(angle_s * M_PI / 180.0);
                if (ray.x < w->map->h && ray.y < w->map->h && w->map->board[(int)ray.y][(int)ray.x] != 0)
                {
                    printf("ray.x = %f, ray.y = %f\n, rayAdvance = %d\n", ray.x, ray.y, rayAdvance);
                    wall_hit = 1;
                    break;
                }
            }
            if (wall_hit == 1)
                draw_wall(w, rayAdvance, x);
            angle_s += 30.0 / W_M; // i devided the field of view so i can do the recursion for the other part of FOV
        }
    }
}

sentences:
Unity - Make a Mirror character of player in movement What I want to achieve is :

I have a 3D game - with player in third person - and using cinemachine  Camera - imagine it like PUBG where you can look any where - the direction of the player does not change until the player is moving - the direction of character change in the same direction as camera

I want to make some sort of Shadow character as enemy , it will face the player - and mimic every movement exactly - not harmful

so when the player move forward - the other copy also move toward player - thus blocking his movement

so I want to achieve this using RigidBody - as Physics is needed to solve this puzzle

I tried different approaches- until I got to this code - it works OK - until I change the camera direction and then every thing is not working any more
     public Transform cam ;

    float speed = 10f;    //How fast the player can move
    float turnSpeed = 100;    //How fast the player can rotate

   public Animator animator; //Animation Control
    Rigidbody rigidBody; //Make sure you have a rigidbody

    void Start()
    {
        //Initialize appropriate components
        animator = GetComponent<Animator> ();
        rigidBody = GetComponent<Rigidbody>();
        cam = Camera.main.transform;
    }

    //No need for update function right now, physics work better in Fixed Update

    void FixedUpdate()
    {
        //right is shorthand for (1,0,0) or the x value            forward is short for (0,0,1) or the z value
        Vector3 dir =  (-cam.forward * Input.GetAxis("Vertical"))+ (cam.right * Input.GetAxis("Horizontal")) ;

        dir.y = 0;//Keeps character upright against slight fluctuations

        if (Input.GetAxis("Horizontal") != 0 ||Input.GetAxis("Vertical") != 0)
        {
                                                   //rotate from this /........to this............../.........at this speed
            rigidBody.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (dir), turnSpeed * Time.deltaTime);
            rigidBody.velocity = transform.forward * speed;
            animator.SetFloat ("Blend", 10);//Walk or run Blend works well here
        } else
        {
            rigidBody.velocity = new Vector3(0,0,0).normalized;
            animator.SetFloat ("Blend", 0);//Idle Blend works well here
        }
    }

    }

sentences:
What happens to OpenGL buffer data that isn't used? I have a vertex struct that has 5 glm::vec3 but some of my objects only use 2 or 3 of those members. So I have two questions :

1.) What happens to the large buffer I create, even though I don't use all the data.

Struct Vertex {
          glm::vec3 pos, color, UV, normal, tangent
              };
std::vector<Vertex> vertices; // will store the vertex data
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), vertices.data(), GL_STATIC_DRAW);

That creates a buffer that is larger than needs to be. Is the additional buffer data not send?

2.) If I send empty data to the buffers, is it causing any performance issues?

glVertexPointer(2, 3 , GL_FLOAT, GL_FALSE, size of(Vertex), reinterpret_cast<GLvoid*>(Offsetof(Vertex, unusedData));

Thanks for the information!

sentences:
How to allow free download of a paid game to specific users if I am a game developer, how can I allow some selected users to download it for free? The options I am aware of are the following:

Use the built-in functionalities of play store and iTunes connect. This is not an option for me because they restricts the number of coupons I can create
Use some deep linking framework to unlock paid features for users coming from some specific link. This could be an options, but it can means the need of too many changes to my codebase

Are there any other options than these?

Thank you

sentences:
2d game with 3d js. game engine I'm trying to understand if it's possible to create a game where the player can switch between 2d (strategic/bird view) and 3d (actual gameplay) using only the 3d supported JS/HTML5 game engine, like three.js or babylon.js?

I'm aware that there are few 2d/3d game engines like Godot, Turbulenz and Blend4Web, but still curious if i can do it same good only with a 3d game engine.

Thanks in advance.

sentences:
Read from OpenGL texture to Bitmap in C# I want to read a texture pixels from texture id (associated with some FBO) to bitmap object in opengl (opentk) in c#
But it throws an exception says:

System.AccessViolationException occurred
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=OpenTK

The code:

public Bitmap GetTexture(int AttachmentIndex)
        {
            if (AttachmentIndex > fbo_colorBuffer.Count - 1)
                throw new IndexOutOfRangeException();

            Bitmap bitmap = new Bitmap(width, height);
            BitmapData bits = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            BindToRead(ReadBufferMode.ColorAttachment0 + AttachmentIndex);
            GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.Float, bits.Scan0);
            bitmap.UnlockBits(bits);

            return bitmap;
        }

public void BindToRead(ReadBufferMode Mode)
        {
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, fbo_id);
            GL.ReadBuffer(Mode);
        }

sentences:
Efficient Algorithm for Recording gameplay's objects positions So, I have a game idea in mind, and for that I need to record the game around the player. I'me not talking about recording it as video, but rather recording the scene objects, and their positions within the game, and then render them, giving the player the ability to go back and forth, to stop time and move around.

I've made a prototype with some data structures in C#, since this is going to be the programming language we'll be using in our game, but if we want the player to be able to go back just five minutes back with the data of just 100 NPC's, it takes almost 1GB of RAM.

Right now, I'm just storing a Doubly linked list, each item with the object position. In the game, I'll need to store even more data in each node, so I need something even more ligher. Of course, this algorithm is zero optimized, but still, that is a lot.

The alternatives would be create the NPC's that aren't really important to the game when the user is viewing the past, but I don't really like it very much for the sake of realism.

I wonder if there is a better way to store this?

Thanks in advance,
Scorch

sentences:
How can I disallow the changing of a parent? I want to disable transform.SetParent(Transform) for a particular GameObject.

I am not sure where to start, so it is really difficult to show what I have tried.  Is this even possible?

sentences:
Why can't I import third-party modules I've installed in the python-ogre SDK's interpreter? Background Information

I'm using the python-ogre SDK, located here, under Windows 7.  The SDK seems to have its own interface to the python 2.7 interpreter, judging from the fact that the generic interpreter (the one located in C:\python27) must be present in order for the SDK to function.

If the generic python 2.7 interpreter is not installed, the python-ogre interpreter complains that python27.dll is missing.

In addition, modules seem to be highly compartmentalized.  The python-ogre modules are only available under the python-ogre interpreter, and not the generic python 2.7 interpreter.  The inverse is also true.  Modules installed to the generic python installation are not available to the python-ogre SDK interpreter.

I'm not really sure what's going on here, so general clarifications would be helpful.

The Import Problem

I recently installed PyYAML and it imports successfully in the standerd python 2.7 interpreter.  However, when I try to import it from the python-ogre SDK's interpreter, I get an ImportError:  No module named yaml error.

What gives?

This may be a general python issue, but it does seem to relate directly to the python-ogre SDK.

As usual, I will be happy to provide additional information upon request.
Any advice or help would be greatly appreciated!

OK GOT IT!

I just did a sys.path.append('C:\Python27\lib\site-packages').  Apparently all 3rd party modules are installed to this directory.

Is this safe to do?  Do I risk creating conflicts between python-ogre and regular ol' python?

sentences:
Creating a scrollable area I am trying to create a ListBox where each ListItem is just some text. I can make it so if a ListItem goes off the ListBox's height then don't show it. This is just a simple if statement in my render function checking to see if the ListItem's position is inside the ListBox's rectangle.

I want to improve this by making the ListBox scrollable. So similar to the picture below, I should be able to partially see the ListItem if I start scrolling down until it's fully in view.

How would I go about doing this? I'm thinking I would need some Camera and only render things inside the Camera's rectangle. Though, I do not know how to begin this.

My current code just doesn't render the ListItem if it goes off the ListBox's rectangle:

class ListBox {
  private:
    std::vector<ListItem*> list_items;

  public:
    ListBox();
    ~ListBox();

    void update();
    void render();
}

void ListBox::render() {
  // Loop through list items here
  if(item->rectangle.h + item->rectangle.y <= this->rectangle.h + this->rectangle.y) {
   item->render();
  }
}

Without the if statement, it looks like this:

I want "Test: 8" and "Test: 9" to be hidden inside the white rectangle until I scroll down.

sentences:
How to make specific paths in UE4? I have a project where I have 1 character (playable) and 2 NPC's (AI).

The NPC's are programmed to meet 2 target points.

Below is an image to facilitate understanding:

As you can see, this green path is the full extent of the terrain that both my character and NPC's can walk through.

I know that in order for my character to traverse the full extent of the terrain, it is only necessary to add a nav mesh bound that covers the entire length of the terrain, but doing so the NPC's would cut their path:

CODE NPC'S:

I've made the target variable editable, so I can choose the target in the level editor.

I would like to know the simplest way to make the playable character go all over the terrain and the NPC's to follow the green route.

sentences:
Tower Defense: Sorting Algorithm with multiple weights (enemy AI) I'm writing a sorting algorithm for a tower defense mobile game. As a quick synopsis, I have a "tower" that can shoot at incoming threats that are within X distance from the base of the tower.
Each incoming enemy, will have an associated {distance_from_tower} and {enemy_weight}. The {distance_from_tower} will be a value between 0 and X (X being the max range of the tower). The {enemy_weight} is a valued weight of "how important" it is to target that enemy mob. For example:
Three enemies:
Archer: {distance_from_tower} = 3 , {enemy_weight} = 1
Knight: {distance_from_tower} = 7 , {enemy_weight} = 5
Zombie: {distance_from_tower} = 10 , {enemy_weight} = 3
Currently, I have a simple sorting algorithm that only sorts enemies by their distance from the tower. (So, in the above example, the tower would target: Archer --> Knight --> Zombie)
Which is a "fine" first logical step, but I want my towers targeting to be more robust. I want the sorting to take into account both the {distance_from_tower} AND the {enemy_weight}. (For reference as well, these two values are updated at every Z seconds during the game, so they are constantly being recalculated).
I would like for the tower to be "smarter" and have a more robust sorting mechanism, that takes into account both weights, as said above. That could potentially lead to the tower targeting an enemy mob that is further away because the {enemy_weight} value of that respective enemy mob is of "high priority". (So, in the above example, the inclusion of using both weights could lead to the tower targeting in this order: Knight --> Archer --> Zombie).
I've been digging around for a few possible solutions, such as using a Travelling Salesman approach, Dijkstra's algorithm, or Floyd's algorithm, and I can't figure out the best way to go about sorting using both weights in a manner that makes sense to me. Any intuition or help is greatly appreciated! Thanks!

sentences:
only one tile being drawn xna c# I have been looking at tile engines for the past few days and decided to have a go at my own one for educational purposes. I want to use different textures for the tiles of my map, for example 1 = grass, 2 = sky, 3 = dirt etc.. I am having this problem where the tiles will draw using only one specific texture although I provide multiples. I have been following tutorials here and there and searching online to try and find this problem but to no avail.

In the example below in the LoadContent function I load three different textues into my TileMap object and Console.WriteLine states that there actually are 3 textures loaded into the list.

I was under the impression that the draw method in the TileMap would set the index to the tile ID corresponding to a tile texture and then that specific tile would be drawn on the map in game. for example, index 1 would equal the first texture in the list, index 2 would equal the second texture and so on.
Is this a correct assumption or am I way off?

Also, can you give me any help/pointers on ways to fix this issue of only one texture showing on the screen.

Thank you in advance.

Tile Map

 class TileMap
    {
        private MapCell[,] mapCell;
        public const int TILE_WIDTH = 64;
        public const int TILE_HEIGHT = 64;

    private List<Texture2D> tileList = new List<Texture2D>();

    public TileMap(int[,] exisitingMap)
    {
        //initialise this to a new multidimensional array;
        mapCell = new MapCell[exisitingMap.GetLength(0), exisitingMap.GetLength(1)];
        // x always starts on one
        for (int x = 0; x < mapCell.GetLength(1); x++)
        {
            for (int y = 0; y < mapCell.GetLength(0); y++)
            {
                mapCell[y, x] = new MapCell(exisitingMap[y, x]);
            }
        }
     }

    public void loadTextureFiles(ContentManager content, params string[] fileNames)
    {
        Texture2D tileTexture;
        foreach (string fileName in fileNames)
        {
            tileTexture = content.Load<Texture2D>(fileName);
            tileList.Add(tileTexture);
            Console.WriteLine(tileList.Count + " Tile texture count ");
        }
    }

    public void Draw(SpriteBatch spriteBatch)
    {

        for (int x = 0; x < mapCell.GetLength(1); x++)
        {
            for (int y = 0; y < mapCell.GetLength(0); y++)
            {
                // setting the index to the tile ID
                int index = mapCell[y,x].TileID;
                Texture2D texture = tileList[index];

                spriteBatch.Draw(texture, new Rectangle( x * TILE_WIDTH, y * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT), Color.White);

            }
        }
    }
}

Map Cell

class MapCell
{
    public int TileID { get; set; }

    public MapCell(int tileID)
    {
        tileID = TileID;
    }
}

Game1

TileMap tileMap = new TileMap(new int[,]
    {
        { 0,0,0,0,0,0,0 },
        { 1,1,1,1,1,1,1 },
        { 0,1,1,2,1,1,1 },
        { 0,2,1,3,1,3,0 },
        { 0,3,0,3,0,0,0 },
        { 0,0,0,2,0,0,0 },
        { 0,0,0,1,0,1,0 },
    });

 protected override void LoadContent()
    {
        new SpriteBatch(GraphicsDevice);
        tileMap.loadTextureFiles(Content, "Tiles/Tile1", "Tiles/sky", "Tiles/dirt" );
    }

protected override void Draw(GameTime gameTime)
    {
        spriteBatch.Begin();
        tileMap.Draw(spriteBatch);
        base.Draw(gameTime);

        spriteBatch.End();
    }

sentences:
A* : Partial recalculation when one node *changes* I have implemented an A* library. Its most interesting feature is that it is "interruptible"; for example, you can stop the calculation loop on a game frame, and resume it later on the following frame.

The library works by creating "Nodes". Each node holds information about a cell in a grid: what is the cost to get there, what is the cell's "parent" (from which it is cheaper to get to the cell) etc. This information is stored until manually released; it is available for other uses if needed.

The "bestNode" is a pointer to one of such nodes. When the search starts, it is the "origin", and it gradually changes until the destination is reached.

Now I'd like to use that information to "partially recalculate" the node information when a node changes; the typical example is a door which opens/closes, allowing new paths/cancelling existing paths. Since I have already calculated the path from the origin to the "changed" node, I'd like to conserve that info, instead of re-calculating everything.

So far my thinking is:

function update(location)
  If the modified location is not in a node, return // not affected
  let node = self.nodes[location]
  let parent = node.parent
  delete all nodes that where created after parent
  add parent to the open list
  bestNode = parent
end

So I have two problems:

I don't know how to select the "nodes created after parent". Would a "unique increasing integer", like in a database, be enough?
This looks kind of complicated and clumsy. Is there a simpler way to do it?

Are there any other "partially-re-calculable" A* algorithms out there? I could not find anything on the subject.

Regards!

sentences:
How to use OpenGL functions from multiples thread? I'm writing a small game using OpenGL.

I'm implementing basic networking in this game and I'm facing a problem.

I have a thread in my client socket class that check for available data, when there are data I raise an event like this :

immutable int len = this.m_socket.receive(data);

if(len > 0)
{
    this.m_onDataEvent(data);
}

Then on my game class, I have a function that handle and parse data like this :

switch(msgId)
{
    case ProtocolID.CharacterData:

        // Load terrain with opengl, character model....

Im not able to call opengl functions because my opengl context is created from a different thread.

But I really don't know how I can solve this problem, I tried Google but it's really hard to find a solution.

I'm using D programming language if it can help.

sentences:
Unity polymorphism in editor through a list So I have an ItemDatabase class which basically only has a list of Item

public class ItemDatabase : MonoBehaviour {
    public List<Item> Items = new List<Item>();
}

The Item class looks as follows:

[System.Serializable]
public class Item {

    public string Name;
    public int Id;
    public string Description;

    public Texture2D Icon;
}

Now I have some item types deriving from the Item class, for example Consumable

[System.Serializable]
public class Consumable : Item {
    public int Resore;
}

I next created a gameobject (empty) in my editor and hooked up my ItemDatabase to that object, providing a number of items in the list is no problem but I would like to make sure that - from my editor - I can choose a type of Item to put into the list, as of now, it only lets my add Item and not Consumable because it is a list of Item.

Can I also force the editor not to accept just Item by making it an abstract class?

sentences:
Objects don't instantiate at mouse position I'm trying to get the player to shoot a projectile at the mouse position, however the projectile is shot in weird directions (http://gfycat.com/BothFluidHoneyeater).

Here is relevant part of my code:

var shotSpeed = 1000;
var projectile : Rigidbody;

function Update () {
    var clone : Rigidbody;
    if(Input.GetKeyDown(KeyCode.Mouse0)){
        clone = Instantiate(projectile, transform.position, transform.rotation);
    }
    clone.rigidbody.AddForce(Vector3.forward * shotSpeed);
}

What am I doing wrong?

sentences:
How are methods like Awake, Start, and Update called in Unity? I'm developing with Unity 5 and I know that there are some methods you can use like in the code below:

public class MyGameElement : MonoBehaviour
{
    private void Awake() { }
    private void Start() { }
    private void Update() { }
    private void FixedUpdate() { }
    // and more
}

I know what they do but I find it strange that the methods can be private. However they are not called into my code I've written. Here you've an image with code lens (I use VS 2015 Professional for coding) where you can really see that it has zero references.

The second 'strange' thing for me is that the methods aren't overwritten.

So my question is now is there anything that Unity has implemented into the MonoBehaviour class that the methods can call?

sentences:
How would I create classes for each map tile instead of using a tmx? LibGdx I am making a top down style game using LibGdx that I want to be randomly generated each new game load.

I already have the algorithm to generate the array for what tile should be what.

But i'm stuck on how I should handle the tile classes.

I have this class called Tile

import com.badlogic.gdx.graphics.g2d.Sprite;

public class Tile extends Sprite{ // Should I use sprite??? Seems wrong..

public byte id;

public static Tile[] tiles = new Tile[256];

public static Tile grass = new GrassTile(0);

public Tile(int id) {
    this.id = (byte) id;
    if (tiles[id] != null)
        throw new RuntimeException("Tile Already Exists....");
    tiles[id] = this;
}

}

And I want to have multiple classes that exened this class for each tile. For example this is grass.

import com.badlogic.gdx.graphics.g2d.Sprite;

public class Tile extends Sprite{

public byte id;

public static Tile[] tiles = new Tile[256];

public static Tile grass = new GrassTile(0);

public Tile(int id) {
    this.id = (byte) id;
    if (tiles[id] != null)
        throw new RuntimeException("Tile Already Exists....");
    tiles[id] = this;
}

}

Should these classes be extended off of a sprite? Or some other class from libgdx?

Also These tiles are going to be 16 x 16 that are made up of 4 smaller 8x8 sprites.

sentences:
Trying to understand light on Opengl, how to simulate a realistic sun light? I don't know if I'm doing something wrong or missing anything but I want to simulate sun light, like in a sunny day.

When the object is facing the directional light, it's well lit and there's no problems there. If I go around the object and look at it's back, it's dark. It's not too much dark because I'm using GL_AMBIENT but it's still too dark for a sunny day. If I increase the value, it will never look better because the side of the object facing the light will be too bright.

And there's another annoying issue with the ambient light, when looking at the back of the object, I can't see any shape, only a plain color. Hard to explain, here's some pictures:

Object Front: http://i.stack.imgur.com/YW53X.png
Object Back: http://i.stack.imgur.com/Qufha.png

As you can easily see, the front side looks nice, you can see the shape of that red thing. On the back side, it's plain, you can't see the same shape.

Now, I know that I'm looking at the back of an object and I'm looking in the direction of the light and it should be darker than the front side. But it shouldn't look so plain like this. That's not what we see when going against the sun light looking at some object, we see that the objects form some shape.

How can I have the same (or similar) effect on OpenGL?

My light is currently defined like this:

float posLight0[4] = {-1.0f, 1.0f, 1.0f, 0.0f};
float ambLight0[4] = {0.5f, 0.5f, 0.5f, 0.5f};

glLightfv(GL_LIGHT0, GL_POSITION, posLight0);
glLightfv(GL_LIGHT0, GL_AMBIENT, ambLight0);

sentences:
Unity. Input in function for UI button OnClick I am trying to create multiple selections for some items on my UI. To perform multiple selections of items I want a user to hold left control button. But then I add

if (Input.GetKeyDown(KeyCode.LeftControl)){
/* Logic */
}

It registers in debugger what LeftControl is pressed but it skips all logic in brackets. This function is public and created for UI button.
Is Input and Button.OnClick compatible at all?

sentences:
Recommend a game engine with 2D GUI for a UI-intensive strategy game Yes, this is another recommend game engine request; the 'twist' is I am doing a strategy game and on top of sprites, animation and abstraction of input controls, it has to have GUI support for rather complex controls, such as scroll-bars, select boxes, buttons and such.

I  have tried XNA with various GUI libraries, but the problem is that those libraries was not 'completed'.
 I am just wondering if there are other engines which I can look at?

sentences:
What is GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS? I am a beginner in OpenGL. I am learning about textures in OpenGL. What I don't understand is how to determine how many texture units are in the GPU. I heard someone said that you can see how many texture units by writing the following code.
int total_units;
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &total_units);
std::cout << total_units << '\n';  // the result is 192

Is there 192 texture units in my GPU?  In documentation, it says:

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
params returns one value, the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined. If both the vertex shader and the fragment processing stage access the same texture image unit, then that counts as using two texture image units against this limit. The value must be at least 48. See glActiveTexture.

So I wanted to know how many texture units can be used to access texture maps from the vertex and fragment shaders. So I wrote and run the following code.
int vertex_units, fragment_units;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &vertex_units);
std::cout << vertex_units << "\n";   // the result is 32
glGetInteferv(GL_MAX_TEXTURE_IMAGE_UNITS, &fragment_units);
std::cout << fragment_units << "\n"; // the result is also 32

So 32+32=64. But why does GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS shows me the result of 192? I think I am missing something. What do I need to calculate to get 192?
And also, in OpenGL, why are there only GL_TEXTURE0 to GL_TEXTURE31 macros? I think these macros are for each shaders. Am I right?

sentences: 2D character movement My character moves right and left correctly, I want to know if it is possible to move character forward and backward to collect hearts   (I know that in 2d no z axis I want to know if it is possible or not? )

sentences:
Assign type to an entity in Entity-Component System (super entity - syntactic sugar) I have created ECS framework from scratch using C++.

Everything works fine, but I think my code is not so cute (at #1):-

class RocketComponent{
    Entity mainBodyGraphic;
    Entity topGraphic ;
};
//inside some system (script-like)
void createRocket(){
    Entity mainBodyGraphic = graphicFactory->createCylinder();
    Entity topGraphic = graphicFactory->createCone();
    //^ internally create entity (with graphic component and others),
    //         then attach together
    Pointer<RocketComponent> rocket  = create<RocketComponent>();
    rocket->mainBodyGraphic = mainBodyGraphic;
    rocket->topGraphic = topGraphic;
    //.... other logics ....
}

void showDamage(Entity rocket){
     Pointer<RocketComponent> rocket  = rocket->get<RocketComponent>();
     systemGraphic->setColor(rocket->mainBodyGraphic,RED);   //#1
}

#1 is ugly.
In my dream (Object-oriented style), #1 could be :-

rocket->mainBodyGraphic->setColor(RED);                      //#1

The above line is far easier to read and code.     It is also less error-prone.

The Change (super entity)

I plan to change my code to support it, but I don't want to lose any disadvantage of ECS.
Therefore, I will create super entity.

For example:-

I create a new super Entity class named GEntity (graphic entity).
I provide a converter (operator=()) between Entity and GEntity.
Whenever a function just want Entity, I can pass GEntity instead, and vice versa!
graphicFactory->createCone() and similar functions will return  GEntity instead of Entity.
The field in RocketComponent will be GEntity mainBodyGraphic;.
Entity has no access to game logic like before, but GEntity can access all game logic/system.

Here is my adoption (future plan / promise to myself):-

In GEntity, I can add all syntactic sugar functions e.g. setColor() as much as I want.
I will use GEntity only when logical type of entity is very obvious.
I will also create PEntity = Physic body, because its type is also obvious.
I may also create other types of super entity if its type is very obvious && I want the syntactic-sugar.

Here is the result (change marked with $):-

class RocketComponent{
    GEntity mainBodyGraphic;      //$
    GEntity topGraphic ;          //$
};
void createRocket(){
    GEntity mainBodyGraphic = graphicFactory->createCylinder(); //$
    GEntity topGraphic = graphicFactory->createCone();          //$
    Pointer<RocketComponent> rocket  = create<RocketComponent>();
    rocket->mainBodyGraphic = mainBodyGraphic;
    rocket->topGraphic = topGraphic;
    //.... other logics ....
}
void showDamage(Entity rocket){
     Pointer<RocketComponent> rocket  = rocket->get<RocketComponent>();
     rocket->mainBodyGraphic->setColor(RED);                    //$
}

Concern (my fear)

I feel that I am violating some ECS rules.
I am probably destroying good ECS abstraction and design pattern in favor of my indolence.

I have already refactored some of my code to the new way.
It looks nice and neat.   I think I am biased.

Question

What are disadvantage of this approach?
What are things (potential issue) that I should concern and prevent?
What is the name of this technique/design-pattern (if any)?

sentences:
How to create soft gradient texture I'm currently testing out Unity 3D and one of the things I can not figure out, is how to create textures that are what I would describe as "Soft Gradient".

Here is an image of what I would describe the textures as "Soft Gradient"

If you look at the top of the hexagons (the grass). you can see that its not just one color, its a texture that is a "Soft Gradient".

Currently, this is what I have,

Does anyone have tips or can help my understand how to make my hexagon pillars look similar to the ones in the picture?

sentences:
A* Path Finding Loops Forever For, hours, I've been following these instructions.

public PathFinder(IntegralLocation loc, final int dest_x, final int dest_y) {
    boolean found = false;
    final List<Node> open = new ArrayList<>();
    final List<Node> closed = new ArrayList<>();

    // 1. Add starting node to open list
    open.add(new Node(loc.getX(), loc.getY(), Math.sqrt(Math.pow(dest_x - loc.getX(), 2) + Math.pow(dest_y - loc.getY(), 2))));
    Node current = null;

    final int[] axs = new int[] { -1, 1 };
    final int[] ays = new int[] { -1, 1 };

    while(!open.isEmpty() && !found) {
        // 2a. Select current node
        for(Node n : open) {
            if(current == null) {
                current = n;
            } else {
                if(n.g < current.g) {
                    current = n;
                }
            }
        }

        // 2b. Switch it to the closed list
        open.remove(current);
        closed.add(current);

        // If this is the destination, we've found it
        if(current.x == dest_x && current.y == dest_y) {
            found = true;
        }

        // 2c. Handle surrounding squares
        for(final int ax : axs) {
            for(final int ay : ays) {
                final int x = current.x + ax;
                final int y = current.y + ay;
                if(!isNodeInList(x, y, closed)) {
                    Node n = getNodeFromList(x, y, open);
                    if(n == null) {
                        open.add(new Node(x, y, Math.sqrt(Math.pow(dest_x - x, 2) + Math.pow(dest_y - x, 2))));
                    } else {
                        if(n.g < current.g) {
                            n.setParent(current);
                        }
                    }
                }
            }
        }
    }

    canAccessDestination = found;
    System.out.println("This won't get printed.");

    // Save the actual path
    while (current != null) {
        nodes.add(new Point(current.x, current.y));
        current = current.getParent();
    }
    System.out.println(nodes.size());
    inverse_stage = nodes.size() - 1;
}

The code above is supposed to be an implementation of the A* path finding algorithm but it's an infinite loop.

The loop always ends up stuck at n.setParent(current).

It is assumed, in this implementation that all nodes can be walked over.

I am sure that there is a tiny error somewhere but I can't quite find it.

sentences:
Basic A star implementation tutorial Possible Duplicate:
  Pseudo-code examples of A*?

Hey guys Iam making a TD game and now I am stucked in implementing A star algo. I know there are many 3d party softwares but they are difficult to understand and modify. I want to make own for my game. I need a step wise programming tutorial for implementing A* OR if someone has basic snippet. I am using unity and c#.

sentences: What should a main game loop do? Generally, what are the core things that one should do in the game loop, and what are some things that one shouldn't do in the game loop?

sentences:
How to implement a configurable spring force to SpringJoint2D like SpringJoint does? I'm working in unity 5.3.4f1.

Looking at the SpringJoint2D class I can't seem to find a similar "spring force" as in spring in SpringJoint.

Is there any other way to make a spring stronger in SpringJoint2D?

If not, the only option I see is to inherit the Joint2D parent class and build my own spring joint 2D.

sentences: How to make game scene bigger in 2d platformer? Hi i am current making a 2D platformer game but after i reach an end of screen then it doesn't move forward how to increase the game play screen area so that i will be able to go in vertical direction i am pasting an image of the problem i am new to unity please help me!]1

sentences:
Possible to open Hammer directly from shortcut? I want to open Hammer(for CS:GO) directly from windows shortcut, without the SDK-launch menu. Is this possible? I've only been able to open the SDK launcher from a shortcut.

And, is it possible to open a map directly as well? So, 1 shortcut that opens Hammer, with a specific map inside of Hammer?

If there exist a launch option for this, then I can use that!

sentences:
Unity: detect animation's end I need a way to detect if animation's clip finished playing and then execute a certain code. Here's some script, that I wrote (called in Update):

    if (Input.GetButtonDown ("Fire1") && pc_atttacking == false && PlayerStats.staminaCurrent != 0) {
        pc_atttacking = true;
        pc_anim.SetBool("attack", true);
    }

    if (pc_anim.GetCurrentAnimatorStateInfo (0).IsName ("attack")) {
        pc_atttacking = false;
        pc_anim.SetBool("attack", false);
    }

But it doesn't work as I want; it executes second code too early - when "attack" animation is at slightly more than half of playing position.
I want to execute it when "attack" animation is at last frame.

sentences:
AndEngine Physics: Shape rotating but not updating physics effects I was looking at PhysicsExample from AndEngine's Examples. I made the following change that I added a vertical line shape and created a fixture for it. Then I registered a rotation modifier for that shape. It is rotating properly but not updating its physics properties on rotation means when it is rotating and any physics body hits it, it did not give collision effect. Here is my code:

final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
        final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager);
        final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2, vertexBufferObjectManager);
        final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
        final Rectangle right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
        final Rectangle center1 = new Rectangle((CAMERA_WIDTH/2) - 2, (CAMERA_HEIGHT/2) - 100, 10, 200, vertexBufferObjectManager);
        final Rectangle center2 = new Rectangle((CAMERA_WIDTH/2) - 100, (CAMERA_HEIGHT/2) - 2, 200, 10, vertexBufferObjectManager);

        center1.registerEntityModifier(new LoopEntityModifier(new RotationModifier(2, 0, 360)));

        final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
        PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
        PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
        PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
        PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);
        PhysicsFactory.createBoxBody(this.mPhysicsWorld, center1, BodyType.StaticBody, wallFixtureDef);
        PhysicsFactory.createBoxBody(this.mPhysicsWorld, center2, BodyType.StaticBody, wallFixtureDef);

Although the body give collision effect when it reaches the shapes initial position. I am new to AndEngine. Where I a wrong...???

sentences:
Elegantly exposing properties in Unity inspector There are various game objects in my scene that share some common characteristics, so I created an interface, like so:

public interface IHasLimitedRangeOfMotionAlongZAxis
{
    float MinimumZ { get; }
    float MaximumZ { get; }
}

For certain types that implement this interface, I would like MinimumZ and MaximumZ to be publicly assignable in the Unity inspector. Therefore, I would like to be able to expose these properties in Unity.

I am aware that one approach is to write C# scripts in the Editor folder to implement an ExposePropertyAttribute (see here).

However, this approach is unsatisfactory for two reasons:

My solution is not co-located with my Assets folder. I write my code in a separate solution, and then use pdb2mdb.exe to import my scripts into my Unity scenes. (The reason for doing this is to avail myself of C# language features introduced beyond C# 4.0, which nonetheless target .NET Framework 3.5.)
I shall have to create a custom editor for every single type that implements the interface with publicly assignable properties. This leads to a lot of boilerplate code.

Is there a more elegant approach than adding private backing fields with the SerializeField attribute for all of my public properties?

sentences:
Bullet softbody nodes messed up positions I recently switched from Havok physics to Bullet because I wanted to have soft body collisions, but I don't have any budget to license the (superior?) Havok solution, I couldn't even try those functions out there so it is completely new to me.
I want to create a soft body from an arbitrary mesh and for that I use the soft body helper:

btVector3* btVerts = new btVector3[vertices.size()];
for(int i=0;i<vertices.size();++i)
    btVerts[i] = (btVector3(vertices[i].pos.x,vertices[i].pos.y,vertices[i].pos.z));
const int iCount = indices.size();
const int tCount = iCount/3;
int* btInd = new int[iCount];
for(int i=0;i<iCount;++i){
    btInd[i] = (int)indices[i];
}

btSoftBody* softBody = btSoftBodyHelpers::CreateFromTriMesh(
        ((btSoftRigidDynamicsWorld*)dynamicsWorld)->getWorldInfo()
        ,(btScalar*)btVerts
        ,&btInd[0],tCount
        ,false
    );

Where vertices and indices are vector references coming from my graphics engine. I fill out the mesh with that information and seemingly I can create it without problem. After I step the physics world I connect my BULLET softbody nodes to my vertices in the graphics engine, then updating the vertex buffer.
I get the information from the softbody nodes by their tNodeArray m_nodes this way:

btSoftBody::tNodeArray&   nodes(softBody->m_nodes);

    for(int j=0;j<nodes.size();++j)
    {
        verticesIn[j].pos=XMFLOAT3(nodes[j].m_x.getX(),nodes[j].m_x.getY(),nodes[j].m_x.getZ());
        verticesIn[j].nor=XMFLOAT3(nodes[j].m_n.getX(),nodes[j].m_n.getY(),nodes[j].m_n.getZ());
    }

The problem: However I do not get correct vertex positions and neither correct normals. I am using a simple quad mesh with 4 vertices (the positions):
{ (-1,0,-1), (1,0,-1), (1,0,1), (-1,0,1) }
But if I get values from the softbody's nodes after creation, but before stepping any physics I don't get back my original values from the nodes (the positions):
{ (-1,0,-1), (0,1,0), (-1,0,1), (0,1,0) }
I even noticed the node vertices kind of resemble the originals, just "overlapped" somehow or not sure how can I describe if it is even the case, but it is like the second vector has an extra zero at the beginning and the whole mesh got screwed up.
Could it be something is not right with my loading? Or do I miss something in the concept of soft body physics?
I have studied the bullet soft body sample which is quite informative and they sure load their meshes like I do (the bunny mesh for instance), at least it seems like it. I don't have any idea and got stuck here for a day now. Without connecting to the softbody, my mesh remains correct.

sentences:
Texture coordinates do not map correctly in Direct3D11 game engine I beg your pardon if this question has been already answered elsewhere or if this is the wrong site, but I have a serious issue with rendering textures with Direct3D 11.

Using Cinema 4D R17, I created a simple cube, triangulated all polygons, and UV mapped a texture, as you can see here:

and it renders correctly.

Next, I exported the file to .x because I created a simpler mesh format and .x is ideal for getting vertices, indices, normals, texture coordinates, etc. This conversion is perfect as all data from the source file is successfully transferred to my file (I checked and double checked it).

However, when I upload the file in my game engine, I get the following result:
The cube is being rendered incorrectly where that strange pattern forms.

This is the original .x file (I included only relevant parts):

Mesh CINEMA4D_Mesh {
  8;
  // Cube. These are vertices.
  -0.01;-0.01;-0.01;,
  -0.01;0.01;-0.01;,
  0.01;-0.01;-0.01;,
  0.01;0.01;-0.01;,
  0.01;-0.01;0.01;,
  0.01;0.01;0.01;,
  -0.01;-0.01;0.01;,
  -0.01;0.01;0.01;;

  12;
  // Cube. These are indices.
  3;0,1,3;, // '3;' means that this face contains 3 vertices.
  3;2,3,5;,
  3;4,5,7;,
  3;6,7,1;,
  3;1,7,5;,
  3;6,0,2;,
  3;0,3,2;,
  3;2,5,4;,
  3;4,7,6;,
  3;6,1,0;,
  3;1,5,3;,
  3;6,2,4;;

  MeshNormals {
    8;
    // Cube
    -0.408;-0.408;-0.816;,
    -0.667;0.667;-0.333;,
    0.667;-0.667;-0.333;,
    0.408;0.408;-0.816;,
    0.408;-0.408;0.816;,
    0.667;0.667;0.333;,
    -0.667;-0.667;0.333;,
    -0.408;0.408;0.816;;

    12;
    // Cube
    3;0,1,3;,
    3;2,3,5;,
    3;4,5,7;,
    3;6,7,1;,
    3;1,7,5;,
    3;6,0,2;,
    3;0,3,2;,
    3;2,5,4;,
    3;4,7,6;,
    3;6,1,0;,
    3;1,5,3;,
    3;6,2,4;;

  }
  MeshTextureCoords {
    8;
    // Cube
    1.0;1.0;,
    0.0;1.0;,
    1.0;0.0;,
    1.0;1.0;,
    1.0;1.0;,
    1.0;0.0;,
    0.0;1.0;,
    1.0;0.0;;
  }
  MeshMaterialList {
    2;
    12;
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1;

    Material C4DMAT_NONE {
      1.0;1.0;1.0;1.0;;
      1.0;
      0.0;0.0;0.0;;
      0.0;0.0;0.0;;
    }
    Material C4DMAT_Mat {
      1.0;1.0;1.0;1.0;;
      1.0;
      0.0;0.0;0.0;;
      0.0;0.0;0.0;;
      TextureFilename {
        "tex.bmp";
      }
    }

    {C4DMAT_Mat}
  }
}

I also invert the vtexture coordinate (v = 1 -v). This is the vertex data I extract:

8 // Number of vertices.
-0.01 -0.01 -0.01 -0.01 0.01 -0.01 0.01 -0.01 -0.01 0.01 0.01 -0.01 0.01 -0.01 0.01 0.01 0.01 0.01 -0.01 -0.01 0.01 -0.01 0.01 0.01 // Vertices stored in X, Y, Z.
1 0 0 0 1 1 1 0 1 0 1 1 0 0 1 1  // Texture coordinates stored in U, V.
36 // Indices count.
0 1 3 2 3 5 4 5 7 6 7 1 1 7 5 6 0 2 0 3 2 2 5 4 4 7 6 6 1 0 1 5 3 6 2 4 // Indices.
tex.bmp // Texture file name.

I read that there might be a conflict between texture coordinates of vertices that are shared among different faces and that resolving this would imply not using index buffers.

EDIT: I did what @wondra said (replaced texture coordinates with 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 and it looks better indeed:

I am not sure what is wrong here. Could anybody help me? Thank you.

UPDATE: The Cinema 4D .obj is broken. Use Blender or anything else.

sentences:
UE4 Repeat fail: how to feed text widget unique message on instances I am a noob who has spent many hours looking at similar questions and responses but still failing to get desired result. I am going to be thorough and specific - I'm very keen on walk-throughs with any helpful experts! Thanks in advance.
Backdrop
My level consists (ideally) of the following:

Trigger boxes
Spheres that have 2x-sided texture with media player texture (let's call these "movie globes")
Transparent actors with blinking borders and are clickable ("highlight_inspect")
(I made these with a tutorial on adding post-process stencil depth something or other in order to get a blinking appearance)
Text widget that appears to inform viewer of what they clicked. Variable across unique instances

In simple terms let's say I have 5 trigger boxes with 5 unique (360º video-captured) movies. You step into trigger, sphere appears around the actor and the media texture/movie begins playing on inside of that sphere (I successfully did this), at which point you can pan around and look. I initiate a delay function before the visibility for "highlight inspect" appears, so that the user may spontaneously first look at movie around them before seeing blinking highlights over certain people, things, etc captured/displayed in movie imagery.
Let's say the movie globes are depicting different forest types or different habitats, and the user is meant to learn about "xx oak tree" "yy pine species" "zz herb that provides x benefit" etc. The idea is to have a kind of interactive museum per se.
Some globes might only have one highlight, some might have 4 - the idea is that I can use the "highlight_inspectable" actor object as a click event across these instances but each one returns unique text upon a widget template (saves font/color/style etc)
As if to demonstrate my thick-headedness around this issue of actor objects and instances, I also currently have separate but locationally equivalent triggers for the globe and for the highlight object, mainly because I need different spheres to call different movies in their blueprint... in other words

I have an actor that has a component 'trigger capsule' that toggles visibility of a sphere
i have an actor that has a component 'trigger capsule' that toggles visibility of highlight_inspect mesh object..

I just need a simple way to do all this *sigh/shakes fist/bangs head on wall.
what I'm failing to learn
I've come across "casting" and "blueprint interfaces" and "event dispatchers" and more, and I'm still not grasping those and whether any apply here and how.
I kinda understand that I should be able to make the Text Element in the Widget "variable" and/or bind it to a variable.. but I can't smoothly achieve this.
Thank you for your help, I am posting some images below (in the screenshots the pink cylinder+light is the trigger, and the next screenshot is user's POV standing there after globe materializes and highlight is showing. the sketch up is for more illustration)
ps the second screenshot is actually in next comment
-SS

sentences:
Problem with InverseTransformDirection and non-uniform scale I made the plane to work with mesh vertices
var plane = new Plane(
    hit.transform.InverseTransformDirection(normal),
    hit.transform.InverseTransformPoint(position)
);

If the object has the uniform scale then all looks good

but otherwise the plane normal has weird angle and I don't understand why.

with InverseTransformVector even worser. The angle goes 2 times bigger

Blue line - my plane
Green spheres - plane intersections
white sphere - plane center
Maybe it can be calculated directly with worldToLocalMatrix?
UPDATE:
Okay It is so weird for me. After InverseTransform plane prints in console right normal but has wrong real angle.
There is code to reproduce
Place component to default cube in zero position, rotate it with Y != 0, scale ONE horizontal dimesion. You will see onesided plane.
using UnityEngine;

public class PlaceOnCube : MonoBehaviour
{
    public Vector3 PlaneOrigin = new Vector3(0, 0, 0);
    public Vector3 PlaneNormal = new Vector3(1, 0, 0);

    private void OnDrawGizmos()
    {
        Gizmos.DrawSphere(PlaneOrigin, .03f);

        var plane = new Plane(
               transform.InverseTransformDirection(PlaneNormal),
               transform.InverseTransformPoint(PlaneOrigin)
               );

        ReGeneratePlane(plane);
    }

    private void ReGeneratePlane(Plane plane)
    {
        var meshfilter = transform.GetComponent<MeshFilter>();
        var mesh = meshfilter.mesh;
        var tris = mesh.triangles;
        var verts = mesh.vertices;
        var newTris = new int[36 + 6];
        var newVerts = new Vector3[24 + 4];

        for (int j = 0; j < verts.Length; j++)
            newVerts[j] = verts[j];

        newVerts[24] = plane.ClosestPointOnPlane(new Vector3(-2, -1, 0));
        newVerts[25] = plane.ClosestPointOnPlane(new Vector3(2, -1, 0));
        newVerts[26] = plane.ClosestPointOnPlane(new Vector3(-2, 1, 0));
        newVerts[27] = plane.ClosestPointOnPlane(new Vector3(2, 1, 0));

        for (int j = 0; j < tris.Length; j++)
            newTris[j] = tris[j];

        newTris[36] = 24;
        newTris[37] = 26;
        newTris[38] = 25;
        newTris[39] = 26;
        newTris[40] = 27;
        newTris[41] = 25;

        mesh.vertices = newVerts;
        mesh.triangles = newTris;

        meshfilter.mesh = mesh;
    }
}

sentences:
Synchronizing clients with a server and with each other What is the best way for keeping all clients synchronized with a server and with each other?

Currently, we have two approaches in mind:

When a client sends something to the server, the server immediately sends out messages to all clients, which react immediately.
Introducing some time delay, whereby the server sends out messages to all clients, with the directive, "act upon this at time t.

The second approach seems like it would more likely keep the clients all in better synchronization (since it caters for some degree of lag); but I wonder whether responsiveness would be lost to too high a degree (i.e. the user clicks 'jump' and there is a noticeable gap between pressing the button and actually jumping).

There is also the possibility of having clients calculate their own position (and not wait for servers to say "you have jumped"); but because of the inevitable lag, clients would get very out-of-sync.

Then there's the whole TCP vs. UDP question; because we want it fast, but I'd also hate for the server to say you're in a completely different location than you thought you were.

With all of these competing demands, it all gets very uncertain how we should approach this issue. Which of these approaches (or any other) would be best for keeping clients and server all in sync? Which ones are actually used in the industry?

sentences:
Unity Ads showing test ads I am implementing Unity Ads in my game and for some reason I have the test ads showing up in my production version of my app. I have the advertisements initialized with test ads turned off and I have even gone into my settings on the Unity Ads admin and set it to force test ads to be off. I'm not sure what else to do here.

Here is how I am initializing:

Advertisement.Initialize("myID", false);

sentences:
How to target specific material with Unity VideoPlayer? I've modeled the following tv-monitor:

This monitor has two materials. The "frame" that makes up the monitor, called MonitorFrameMaterial and the black screen material, called MonitorScreenMaterial.

I've added the Video Player to the monitor and would like to play a video "on the screen material".
Here's a screenshot of the inspector:

I've already searched the web for some time to find an answer, but I can't seem to find a way to play the video on the screen. Whenever I add a video now, it actually targets the monitor-frame (probably because it's the first material?).

Is there any way to change this, and if yes, how?
Thanks!

sentences:
SDL_AddTimer + SDL_GL_MakeCurrent not working on Windows I'm messing around with C++, OpenGL and SDL doing a game that should be able to run in Windows and Mac OS X.
I have a problem that only happens on Windows.

Let me describe the scenario.

First I create an OpenGL renderer and get the current context:

this->renderer = SDL_CreateRenderer(this->window, rendererIndex, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
this->context = SDL_GL_GetCurrentContext();

Complete code here

In my scene I add a timer to create some asteroids:

this->timer.Start(INTERVAL_CREATE_ASTEROID, SpaceshipScene::CreateAsteroidTimer, this);

Internally this timer uses SDL_AddTimer and keeps the current window and context for itself:

this->window = SDL_GL_GetCurrentWindow();
this->context = SDL_GL_GetCurrentContext();
this->callback = callback;
this->param = param;
this->timerId = SDL_AddTimer(interval, Timer::ExecuteCallback, this);

When the callback executes I use MakeCurrent to make sure that OpenGL will run in the right context (the window and context from the main thread):

bool hasContext = timer->window != NULL && timer->context != NULL;

if (hasContext) {
    SDL_GL_MakeCurrent(timer->window, timer->context);
}

Uint32 result = timer->callback(interval, timer->param);

if (hasContext) {
    SDL_GL_MakeCurrent(timer->window, NULL);
}

Complete code here

On Mac OS X this code is working perfectly, but on Windows it isn't drawing the asteroids on the window neither throwing any error.

What am I doing wrong?

sentences: In which software do the professional game developers create 3D Model? I am just thinking about beginning game development in xna c#. However, I don't know (and no tutorial teaches) how do professional game developers create a 3D Model/Scene. How can we create a realistic looking model and what is the hardware configuration needed in machine for using such a software?

sentences:
Border around game preview window I'm trying to put my game view and scene view next to each other, but the game window seems to have a border around the actual game view that I can't remove:

In the screenshot above, the game view should be touching the sides. I've tried changing the aspect ratio setting at the top to no avail, increasing the scale works to remove the border but that also zooms in so isn't a correct representation of the game. Does anyone know how I can remove this border?

sentences:
Issue with Texture2D memory leak in Unity I have a simple method that converts RenderTexture data into Texture2D
public static Texture2D RenderTextureToTexture2D(RenderTexture renderTexture, int width, int height,
    TextureFormat textureFormat = TextureFormat.RGB24, bool mipChain = false) {

    Texture2D tex = new Texture2D(width, height, textureFormat, mipChain);
    RenderTexture.active = renderTexture;

    tex.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
    tex.Apply();

    RenderTexture.active = null;
    // Here I want some way to release memory occupied by tex
    // I want to release tex here because i believe everytime this method executes tex is not getting garbage collected and stays in memory
    // Only problem is I cannot release it before, and after returning, it is obvious I cannot do that.
    return tex;
}

The above mentioned method is working exactly as intended. However, if I call this method multiple times, or in update it starts using so much memory

How can I avoid this problem?
Edit
I cannot share the entire code but this is minimal code to reproduce the issue
[SerializeField] private RenderTexture renderTexture;
private Texture2D mTexture;

private void Start() {
    mTexture = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.BGRA32, false);
}

private void Update() {
    mTexture = TextureUtils.RenderTextureToTexture2D(renderTexture, renderTexture.width, renderTexture.height, TextureFormat.BGRA32);

    // Some agora sdk stuff to share the mTexture over the network for screen sharing
}

sentences:
Implementing Camera Zoom in a 2D Engine I'm currently trying to implement camera scaling/zoom in my 2D Engine.
Normally I calculate the Sprite's drawing size and position similar to this pseudo code:

render()
{
    var x = sprite.x;
    var y = sprite.y;
    var sizeX = sprite.width * sprite.scaleX; // width of the sprite on the screen
    var sizeY = sprite.height * sprite.scaleY; // height of the sprite on the screen
}

To implement the scaling i changed the code to this:

class Camera
{
    var scaleX;
    var scaleY;
    var zoom;
    var finalScaleX; // = scaleX * zoom
    var finalScaleY; // = scaleY * zoom
}

render()
{
    var x = sprite.x * Camera.finalScaleX;
    var y = sprite.y * Camera.finalScaleY;
    var sizeX = sprite.width * sprite.scaleX * Camera.finalScaleX;
    var sizeY = sprite.height * sprite.scaleY * Camera.finalScaleY;
}

The problem is that when the zoom is smaller than 1.0 all sprites are moved toward the top-left corner of the screen. This is expected when looking at the code but i want the camera to zoom on the center of the screen.

Any tips on how to do that are welcome. :)

sentences:
I add a straight big plane over terrain(3d). Vibrations are happening when i move camera I have this problem in my OpenGL project but i will show you the same thing over blender3d with video. So I believe that I will better explain the problem. it is just 30 seconds. Take a look.  Youtube LINK
How can i fix these problem ?

sentences:
Lightweight lua objects vs. inheritance Although I did this a couple of times from scratch, still no solution really fits.

I'm using lua for scripting in my games. Lua holds the "prototypes" of the game elements, that are copied to each entity on it's creation. A prototype represents a class of objects ("Soldier with shotgun"). Also, each prototype may hold event hooks (OnDie, OnSpotEnemy, etc). Clearly it's a prototype, not the object that will be handled.

So, each time a hook is executed, I need to create an object to represent the calling entity (and any entities it interacts with) only for the lifetime of a single script execution. What it means is that a instance of the object lives in lua only for the time needed to run this script.

Simple execution of this idea wasn't much work -- I used lightuserdata to hold the C++ pointer to the entity encapsuled in a being class. To access the fields of the C++ object, I overloaded the metatable of being. However, the fact that the fields of the object are handled by a metatable practically breaks any reasonable implementation of inheritance.

I pondered with the usage of normal userdata, but I'm afraid that the dynamic allocation needed to run each script (some of them being ran each tick in the game loop) are going to ruin performance.

Any suggestions? Or maybe a better solution altogether?

sentences:
Odd exception when calling a method in DirectX 11 I am following the "3D game programming with directx 11" book (Frank Luna) and I am trying to render a cube. In the code there is this m_device->CreateBuffer() function which is giving me problems.
The exception I get is:

Device was 0XFFFFFFFFFFFFFFFF
DirectX11 exception in a method which is external to where the CreateDevice() method is called

So I tried to put it in the method where the device is created, and it gives no exception, so I'm wondering if I have to make the m_device something like global or I don't know.
struct Vertex {
        XMFLOAT3 Pos; XMFLOAT4 Color;
    };

 Vertex vertices[] = {
        { XMFLOAT3(-1.0f, -1.0f, -1.0f), XMFLOAT4((const float*)&Colors::White)},
        {XMFLOAT3(-1.0f, +1.0f, -1.0f),  XMFLOAT4((const float*)&Colors::Black)},
        {XMFLOAT3(+1.0f, +1.0f, -1.0f),  XMFLOAT4((const float*)&Colors::Red)},
        {XMFLOAT3(+1.0f, -1.0f, -1.0f),  XMFLOAT4((const float*)&Colors::Green)},
        {XMFLOAT3(-1.0f, -1.0f, +1.0f),  XMFLOAT4((const float*)&Colors::Blue)},
        {XMFLOAT3 (-1.0f, +1.0f, +1.0f), XMFLOAT4((const float*)&Colors::Yellow)},
        {XMFLOAT3 (+1.0f, +1.0f, +1.0f), XMFLOAT4((const float*)&Colors::Cyan)},
        {XMFLOAT3 (+1.0f, -1.0f, +1.0f), XMFLOAT4((const float*)&Colors::Magenta)}
    };
    D3D11_BUFFER_DESC vbd;
    vbd.Usage = D3D11_USAGE_IMMUTABLE;
    vbd.ByteWidth = sizeof(Vertex) * 8;
    vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    vbd.CPUAccessFlags = 0;
    vbd.MiscFlags = 0;
    vbd.StructureByteStride = 0;
    D3D11_SUBRESOURCE_DATA vinitData;
    vinitData.pSysMem = vertices;
    m_device->CreateBuffer(&vbd, &vinitData, &mBoxVB); //exception is here

I repeat the code perfectly works in the method where I called the CreateDevice() method, but doesn't here, in another method of another class.

sentences:
How to use Left Shift to run Unity? So, I need to use LShift to run, but I can't exactly figure out how to do so....
I don't know what to use....
Here my code:
using UnityEngine;
using System.Collections;

// This script moves the character controller forward
// and sideways based on the arrow keys.
// It also jumps when pressing space.
// Make sure to attach a character controller to the same game object.
// It is recommended that you make only one call to Move or SimpleMove per frame.

public class Move : MonoBehaviour
{
    CharacterController characterController;

    public float speed = 6.0f;
    public float jumpSpeed = 8.0f;
    public float gravity = 20.0f;
    public Transform charBody;
    private Vector3 moveDirection = Vector3.zero;
    public float mouseSense = 11f;
    public float runSpeed = 12f;
    public bool isRunning = false;

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

    void Update()
    {
        if (characterController.isGrounded)
        {
            // We are grounded, so recalculate
            // move direction directly from axes

            moveDirection = transform.forward * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;
            moveDirection = transform.right * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;

            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }
        }

        // Apply gravity. Gravity is multiplied by deltaTime twice (once here, and once below
        // when the moveDirection is multiplied by deltaTime). This is because gravity should be applied
        // as an acceleration (ms^-2)
        moveDirection.y -= gravity * Time.deltaTime;

        // Move the controller
        characterController.Move(moveDirection * Time.deltaTime);

        float MOUSEY = Input.GetAxis("Mouse Y") * mouseSense * Time.deltaTime;
        float MOUSEX = Input.GetAxis("Mouse X") * mouseSense * Time.deltaTime;

        charBody.Rotate(Vector3.up * MOUSEX);

    }
}

So, when left shift is clicked I want the speed to change to runSpeed...
Can I please have some help doing so?
Thanks

sentences:
How do I make the host work in UNet? According to the "High Level API" documentation, unless I misread something, a Host "just" runs both as a Server and as a Client, so much that it would require no special support, i.e. it should run out of the box.

When the Server and Client are in separate processes, both work correctly. When a host acts as both the server and client, this is not the case.

When OnServerReady gets called on the Host, the NetworkConnection conn parameter has .hostId==-1, and if I try to call on NetworkServer.AddPlayerForConnection I'll get a warning and an error.

ClientScene::InternalAddPlayer: playerControllerId higher than expected: 0
UnityEngine.Networking.NetworkServer:AddPlayerForConnection(NetworkConnection, GameObject, Int16)
[...]

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Networking.ClientScene.InternalAddPlayer (UnityEngine.Networking.NetworkIdentity view, Int16 playerControllerId) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Runtime/ClientScene.cs:90)
[...]

If I refrain from calling AddPlayerForConnection, then I'll encounter a warning (and no result) as soon as the Host calls a Command:

Trying to send command for non-local player.
UnityEngine.Networking.NetworkBehaviour:SendCommandInternal(NetworkWriter, Int32, String)
[...]

In fact, isLocalPlayer is false.

Am I doing something wrong, is the documentation wrong, or is this a bug?

As requested, some piece of code:

public override void OnServerReady (NetworkConnection conn)
{
    base.OnServerReady(conn);

    Transform spawnPoint = FindObjectOfType<SpawnPoints>().getNextSpawnLocation();

    GameObject controllerGO = instancedElements.SpawnObjectFree(playerPrefab,spawnPoint); // this is basically an Instantiate
    GameObject playerGO = instancedElements.SpawnObjectFree(playerCreaturePrefab,spawnPoint);
    [...]
    NetworkServer.AddPlayerForConnection(conn,controllerGO,0);
    NetworkServer.Spawn(playerGO);
    [...]
}

(I've trimmed it down to remove the non-relevant parts)

sentences:
How can I test if the mouse draw on the active tiles? I want to draw some sprites in a tiledmap where the tiles are active.
I want to draw with the mouse, so how could I compare the position of the mouse, the sprite position and the position of active tiles?
I tried to compare:
sprite.getX, screenX and cell.getTile (). getProperties (). containsKey ("active")
but I can not get the position of the active tiles.

sentences:
Is there a difference between using one large mesh with 100k polygons and using 1000 meshes with 100 polygons each? I'm planning on creating a first-person shooter for mobile. Now I know that fps games usually have a lot of meshes in the scene (trees, buildings, terrains, etc.). So I've been looking at a lot of Unity optimization tips. One thing I've noticed is that they always say "If you have a lot of objects in your scene, then each mesh must have low polygon count".

But how exactly does this help? If I have a lot of houses in my scene and I ensure that each house has very few polygons, wouldn't the total number of polygons in my scene be affecting the performance anyways? Or will my scene be rendered differently now that I've broken up the total polygon count into multiple parts?

sentences:
How can I compile a Direct3D 9 effect from a file? I started working with shaders recently in DirectX9. I noticed that there is a D3DXCompileShaderFromFile function for IDirect3DVertexShader9 and pixel shader. Which compiles the shader and gives you the compiled code so you can put that into a file and then read it.

But is there a way to do it with the ID3DXEffect or is IDirect3DVertexShader9 the only way?

sentences:
Events, Posting vs Queuing I'm implementing a messaging system and I'm wondering about how I should handle events. Should I post them and send them to the appropriate listeners as soon as I receive them, or should I queue them and only dispatch when I am prompted to (most likely by the main game loop)?

Edit: More info

My game is a 2D platformer, so performance isn't going to be very hard to achieve. Considering what Roy T. said, I guess I might as well send out the event as soon as it is posted; there doesn't seem to be a need to queue it (unless I'm missing something, of course).

sentences:
Rotating a cube with arrow keys I have a list of rotations (on a cube in 3d space with the y-Axis pointing upwards, x-Axis pointing righthand and z-Axis pointing towards you) for example

+90 deg around x-Axis followed by
+90 deg around y-Axis followed by
+90 deg around y-Axis followed by
-90 deg around x-Axis

All rotations are only of type (+- 90 deg around x / y). The list can be of any length. My goal is to break it down to only three operations. I can't figure out how to calculate the three arguments xDeg,yDeg,zDeg which i can apply in the same order to rotateX,rotateY,rotateZ to get the same result as applying the complete list one after another to the rotation-functions. i tried to build up a permutation matrix depending on the actual position in the list of rotations when i iterate over it to apply the current deg value of a list item to either xDeg,yDeg,zDeg. I couldn't make ist work.

var gTrans = (function() {

  var perm = [[1,0,0],[0,1,0],[0,0,1]];
  var set = [0,0,0];

  function rotateUp() {
    //set = math.chain(set).add(math.multiply(perm,[-90,0,0])).done();
    //set = math.chain(set).add([-90,0,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[1,0,0],[0,0,1],[0,-1,0]],perm);
    set[0] -= 90;
  }

  function rotateDown() {
    //set = math.chain(set).add(math.multiply(perm,[90,0,0])).done();
    //set = math.chain(set).add([90,0,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[1,0,0],[0,0,-1],[0,1,0]],perm);
    set[0] += 90;
  }

  function rotateLeft() {
    //set = math.chain(set).add(math.multiply(perm,[0,-90,0])).done();
    //set = math.chain(set).add([0,-90,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[0,0,-1],[0,1,0],[1,0,0]],perm);
    set[1] -= 90;
  }

  function rotateRight() {
    //set = math.chain(set).add(math.multiply(perm,[0,90,0])).done();
    //set = math.chain(set).add([0,90,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[0,0,1],[0,1,0],[-1,0,0]],perm);
    set[1] += 90;
  }
})();

The code above is written with javascript, p5js and mathjs libs. Does someone have an idea? I know it's possible to simply multiply the rotation matrices. But i need the angles and the informations if it's 750 deg (not only 750 mod 360 deg).

sentences:
How to achieve this particular screen filter with GLSL? I know this may be a "short" question, but still here it goes.

I would like to know how to achieve a post rendering effect, that looks like the following image from walking dead series:

I will make the art already fitting the style, but what if I want to make the colors more coherent by adding a color filter such as the one in the picture?

Thanks

sentences:
How can a player exist at a location that is not expressly defined? How do video games like Minecraft know how to place characters on an infinitely complex plane? For example, the game knows the character's place up to 10 or more decimal places and can display them at that location, but it only stores the blocks on the integer values. Here are other ways that I have thought about on how to phrase this question, because I know that I'm not being very clear:

How can a player exist at a non-integer location?
How can a player exist at a location that is not expressly defined?
How do non-existent coordinates contain players, even if they don't exist?
How can a game depict a player on coordinates it has not expressly stored?

I understand that the coordinates can be simply saved as doubles, but in order to store all the coordinates that a player could exist on would create a simply enormous file.

sentences:
Game Update in Libgdx In libgdx, the game loop is the render() method. But why is that, and is there a way where I can make an update() method that is called 60 times a second? As in the update() method, I would add the game logic, and leave the rendering to the render method.
Basically, separate methods, and the update() method called 60 times per second using Libgdx with java.

sentences:
Replacement for XNA? Since Microsoft stopped developing XNA I'm wondering what will be the replacement for the XBox 720°.
I've been wondering about this. XNA was THE technologie the XBox, easy and powerfull.

So is Microsoft developing a new technologie or are they going to continue XNA, even if they've said they'd stop.

sentences:
Predicted target location I'm having an issue with calculating the predicted linear angle a projectile needs to move in to intersect a moving enemy ship for my 2D game.

I've tried following the document here, but what I've have come up with is simply awful.

protected Vector2 GetPredictedPosition(float angleToEnemy, ShipCompartment origin, ShipCompartment target)
{
    // Below obviously won't compile (document wants a Vector, not sure how to get that from a single float?)
    Vector2 velocity = target.Thrust - 25f; // Closing velocity (25 is example projectile velocity)
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    // Garbage code, doesn't compile, this method is incorrect
    return target.Position + (target.Thrust * time);
}

I would be grateful if the community can help point out how this is done correctly.

EDIT

Here is my (working) method following the advice given:

protected Vector2 GetPredictedPosition(ShipCompartment origin, ShipCompartment target, Ship enemyShip, Ship firingShip)
{
    Vector2 targetVelocity = enemyShip.Direction * enemyShip.Thrust;
    Vector2 projectileVelocity = firingShip.Direction * 25f;

    Vector2 velocity = targetVelocity - projectileVelocity; // Closing velocity
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    return target.Position + new Vector2(Convert.ToSingle(targetVelocity.X * time), Convert.ToSingle(targetVelocity.Y * time));
}

sentences:
what is the simplest way to get player selection system like checkers in unity 3d c# like lets say the board is a top down grid like if your were in front of an actual checkers board i want to figure out how i would be able to select/deselect a piece then select/deselect a space on the board so that the players piece will move to said place and if another piece is occupying that place already then the said player cant move there

also im new to c# and progrming in general...i have been only doing it for about five months and have been looking at tutorials and all that ... but if some one could paste an example code if possible something simple so that i can dissect it, learn from it, and change it as I see fit.

and if you can explain how the code works that would be really appreciated.

things i need:
some kind of grid/checker board code
player selection/deselection

i would prefer it in c# and the code applicable strictly to unity3ds mono develop although I intend to learn visual studio in the future at the moment i just want something for unity.

lastly please assume that i may be stupid when explaining/writing your example code/ or answer.

sentences:
Making a 2D Game: Figuring out sprite sizes? I'm currently making a 2D game as a school project using Game Maker and its language. My concern however is around the spriting and art...

I can't figure out how to correctly size everything so it shows up correctly on the end product.
I originally used a temporary 32x32 character but it looks very small when I have the "Room Size" in Game Maker set to 720p...

Is this something that I need to change size-wise on Game Maker, such as changing how far in the perspective/camera is, or do I have to set actual dimension rules? I'm unsure of how to do this properly.

sentences:
How can I create a buffer suitable for dynamic updates in SharpDX? I want to set a buffer that is updated every frame but can't figure it out, what i have to do.

The only working thing i have is this:

mdexcription = new BufferDescription(Matrix.SizeInBytes * Matrices.Length, ResourceUsage.Dynamic, BindFlags.VertexBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0);
instanceBuffer = SharpDX.Direct3D11.Buffer.Create(Device, Matrices, mdexcription);

vBB = new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0);
DeviceContext.InputAssembler.SetVertexBuffers(1, vBB);

Draw:

//Change Matrices (Matrix[]) every frame...
instanceBuffer.Dispose();
instanceBuffer = SharpDX.Direct3D11.Buffer.Create(Device, Matrices, mdexcription);

vBB = new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0);
DeviceContext.InputAssembler.SetVertexBuffers(1, vBB);

I guess Dispose() and creating a new buffer is slow and can be done much faster.

I've read about DataStream but i do not know, how to set this up properly.

What steps do i have to do to set up a DataStream to achieve fast every-frame update?

Edit:

Finally got it. I used that:

mdescription = new BufferDescription(Matrix.SizeInBytes * Matrices.Length, ResourceUsage.Dynamic, BindFlags.VertexBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0);
instanceBuffer = SharpDX.Direct3D11.Buffer.Create(Device, Matrices, mdescription);

vBB = new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0);
DeviceContext.InputAssembler.SetVertexBuffers(instSlot, vBB);

Draw:

DataStream stream;
var dataBox = DeviceContext.MapSubresource(instanceBuffer, MapMode.WriteDiscard, SharpDX.Direct3D11.MapFlags.None, out stream);
stream.WriteRange(Matrices);
DeviceContext.UnmapSubresource(instanceBuffer, 0); //to update the data on GPU

stream.Dispose();

sentences:
Blending animations for more character movements I am making a hack n slash 3rd person game, and I want the character movements to be more dynamic not like fighting games where you have a moves list.

I want to animate tons of different animations and have them "Tween" between each other.

I do not want the to use the mouse for controls, I want it to be all keyboard, that way you have up to 10 inputs (All your fingers) to blend and morph animations to create more fluid movements. In the end this will almost be similar to characters typing a phrase or string of keys rather than move forward mouse look click to melee.

My questions are:

Has anyone done this before?
How would someone go about trying to tween?

lets say one for key on the keyboard excluding Tab, Caps, R+Shift, L+Shift, Enter, R+Ctrl, L+Ctrl, L+Alt, R+Alt, Windows Key, and Menu.

So thats all the numbers, letters and punctuation keys. Thats 46 keys gives me a combination of 46P1 = 5502622159812088949850305428800254892961651752960000000000L (used Python), and with a minimum entry value of 2 keypresses shortening to half. This is not humanly possible to create so many inique animations in one lifetime. But I'm guessing there is a reason this hasn't been done already.

Or if I just used 10 basic keys. Maybe ASDF SPACE (RIGHT HAND) 456+0 (LEFT HAND KEYPAD)
it would give me 3,628,800 posible unique animations.

sentences:
Tile based smooth snake movement while making my own Snake implementation I decided to use delta time for smoothing movement on screen. The problem is that before Snake was moving fixed amount of pixels every frame, but now when mulitplying snakeSpeed by timeStep it's no longer aligned to the grid. How can I fix it?

Main game function:

void Run()
{
    while (!gameOver)
    {
        Time = (float)al_get_time() * 1000.0;
        timeStep = Time - lastFrameTime;

        Input();

        if (draw && al_is_event_queue_empty(eventQueue))
        {
            al_clear_to_color(al_map_rgb(255, 255, 255));

            UpdateSnake(&snake, timeStep, direction);
            Draw();
            Logic();

            al_flip_display();
            draw = false;
        }
    }
}

UpdateSnake() function (for now it's only one element moving):

void UpdateSnake(Snake *snake, float timeStep, Position direction)
{
    snake->animationTime += timeStep;

    float f = snake->animationTime * snakeSpeed;

    if (f >= 1.0f)
    {
        snake->animationTime = 0.0f;
        f = 1.0f;
    }

    snake->animationOrigin.x = ((int)snake->position.x / BOARD_CELL) * BOARD_CELL;
    snake->animationOrigin.y = ((int)snake->position.y / BOARD_CELL) * BOARD_CELL;

    if (direction.x == 1)
    {
        snake->animationDestination.x = snake->animationOrigin.x + BOARD_CELL;
        snake->animationDestination.y = snake->animationOrigin.y;
    }

    if (direction.x == -1)
    {
        snake->animationDestination.x = snake->animationOrigin.x - BOARD_CELL;
        snake->animationDestination.y = snake->animationOrigin.y;
    }

    if (direction.y == 1)
    {
        snake->animationDestination.x = snake->animationOrigin.x;
        snake->animationDestination.y = snake->animationOrigin.y + BOARD_CELL;
    }

    if (direction.y == -1)
    {
        snake->animationDestination.x = snake->animationOrigin.x;
        snake->animationDestination.y = snake->animationOrigin.y - BOARD_CELL;
    }

    snake->position.x = Lerp(snake->animationOrigin.x, snake->animationDestination.x, f);
    snake->position.y = Lerp(snake->animationOrigin.y, snake->animationDestination.y, f);

}

sentences:
Möbius effect in Unity This morning I've seen the following animation on Twitter. It is a kind of Möbius strip effect.

It's cool! Isn't it? So I've decided to build something similar using Unity, just for fun. I want to build the effect using just the cameras, as this way we can use it for any rotating scene. The first step has been to create a circle scene and make it rotate:

Note that the camera uses an ortographic projection so perspective does not deform it. This is important so we can merge different views later.

Then I've replaced the main camera by two different ones, located in opposite positions (horizontal and vertical) and rendering to textures. A simple Canvas with two panels (divided vertically) shows the partial result (one camera texture per panel):

I know this is cool, but not perfect yet, as the center of the rendered output shows clearly where a panel finishes and the other one starts. Look at the center of the rendered output above.

The original inspiration video shows no perspective in the center, and I think that is the trick, but I cannot achieve that with an orthographic camera (or I don't know how).

Do you know any approach to distort the camera or something similar, so the cameras are perpendicular in the middle of the scene (and only in the middle)? Are you able to think a solution to dissimulate the joint of both camera views?

As a first approach (dismissed for the moment) I've tried to add another camera, perpendicular to the scene so there is no perspective in that point. Then I render its output in the UI in another panel on top of the previous ones. And it is not too bad, but again the joint is too obvious and now I have two joints instead of one:

sentences:
Is this a good way of separating graphics from game logic? My current architecture for me game engine looks like this, though it is not accurate:

Everything graphics related is done in by GraphicsEngine, and through its components, like Material, Mesh, etc). My problem is that I want to store the pointers in RenderData, but I have to include the Mesh, Material etc header files, which have included glew.

I currently change an objects material using GetRenderer().SetMaterial("xyz"), which sets a string in the renderData, to be processed by the graphics engine; then the correct pointer will be set, if it exists. This is not so modular, because the scene has graphics related files included, like glew. This is a problem.

My only solution is to store indices in RenderData. There wont be a material pointer, but instead, an index where the material is in the GraphicsEngines material store. This way, RenderData is just a "blind" integer and string store, in which the Renderer egy the GraphicsEngine works.

Is this a good solution?

Meshes have VertexData members (position, normal, texture). When I call GraphicEngine.CreateMesh(), passing the MeshName and FileName, where should the file processing go? I use Tiny Obj Loader, and I don't know where I should include it, and call its function.

I call the function from inside GraphicsEngine, then I transform the returned structures to my Mesh's structure, which I pass to the Mesh's constructor. The initialised list will assign it to the corresponding member variable. Inside Mesh, I pass the FileName to the Mesh constructor, and let it handle it all by itself. I think the first solution is better, but I don't really know why.

Maybe using GraphicsEngine to "create" assets is better than GraphicsEngine commanding assets to "be created"; but this is just a personal feeling. Which solution is better?

sentences:
How to flatten out terrain and make better caves with Perlin noise I'm currently using Perlin noise to generate a terrain. This is my actual attempt to create caves. I do get some sort of cave structures but they are small and are always close to the edges of the terrain. Also my terrain looks very irregular I'd like to have a more flat terrain. I've been playing with the values I pass to the Perlin noise function but I can't seem to get something good.

Do you have any pointers or suggestions to my actual approach in order to get something more regular within the Minecraft standards?

sentences:
FBO rendering different result between Galaxy S2 and S3 I'm working on a pong game and have recently set up FBO rendering so that I can apply some post-processing shaders. This proceeds as so:

Bind texture A to framebuffer
Draw balls
Bind texture B to framebuffer
Draw texture A using fade shader on fullscreen quad
Bind screen to framebuffer
Draw texture B using normal textured quad shader

Neither texture A or B are cleared at any point, this way the balls leave trails on screen, see below for the fade shader.

Fade Shader

private final String fragmentShaderCode =
        "precision highp float;" +
        "uniform sampler2D u_Texture;" +
        "varying vec2 v_TexCoordinate;" +
        "vec4 color;" +
        "void main(void)" +
        "{" +
        "   color = texture2D(u_Texture, v_TexCoordinate);" +
        "   color.a *= 0.8;" +
        "   gl_FragColor = color;" +
        "}";

This works fine with the Samsung Galaxy S3/ Note2, but cause a strange effect doesnt work on Galaxy S2 or Note1. See pictures:

Galaxy S3/Note2

Galaxy S2/Note

Can anyone explain the difference?

edit

Folowing VinceFR's comment, we've tried adding the following. When the renderbuffers are initialised they are briefly bound to the framebuffer and set the background to a uniform buffer with:

    GLES20.glClearColor(backgroundColor[0],backgroundColor[1],backgroundColor[2],backgroundColor[3]);
    GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

The result is unchanged on the S3, on the S2 it has improved a certain amount, but problems still exist:

note the 20 in the bottom right corner is supposed to be there.

sentences:
Can you do a stencil glow with native GM:S commands? I am looking to a stencil glow on GM:S with d3d_* functions.

I could not find anything how to access the stencil buffer though.

Is it even possible to access the stencil buffer without using an external .dll?

sentences:
Unity - Plugin 'MFC100U.DLL' is used from several locations: As per subject, I got this error message using Metaio SDK in Unity5. BTW, I'm using Mac, not Windows machine.

Plugin 'MFC100U.DLL' is used from several locations:
 Assets/Plugins/x86_64/MFC100U.DLL would be copied to <PluginPath>/MFC100U.DLL
 Assets/Plugins/x86/MFC100U.DLL would be copied to <PluginPath>/MFC100U.DLL
Plugin 'MSVCP100.DLL' is used from several locations:
 Assets/Plugins/x86/MSVCP100.DLL would be copied to <PluginPath>/MSVCP100.DLL
 Assets/Plugins/x86_64/MSVCP100.DLL would be copied to <PluginPath>/MSVCP100.DLL
Plugin 'pthreadVC2.dll' is used from several locations:
 Assets/Plugins/x86/pthreadVC2.dll would be copied to <PluginPath>/pthreadVC2.dll
 Assets/Plugins/x86_64/pthreadVC2.dll would be copied to <PluginPath>/pthreadVC2.dll
Plugin 'Shore140.dll' is used from several locations:
 Assets/Plugins/x86_64/Shore140.dll would be copied to <PluginPath>/Shore140.dll
 Assets/Plugins/x86/Shore140.dll would be copied to <PluginPath>/Shore140.dll
Plugin 'MSVCR100.DLL' is used from several locations:
 Assets/Plugins/x86/MSVCR100.DLL would be copied to <PluginPath>/MSVCR100.DLL
 Assets/Plugins/x86_64/MSVCR100.DLL would be copied to <PluginPath>/MSVCR100.DLL
Plugin 'metaiosdk.dll' is used from several locations:
 Assets/Plugins/x86/metaiosdk.dll would be copied to <PluginPath>/metaiosdk.dll
 Assets/Plugins/x86_64/metaiosdk.dll would be copied to <PluginPath>/metaiosdk.dll
Please fix plugin settings and try again.

UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

How I can fix this error? Please advice. Thank you.

sentences:
Checking if object passed between two other objects I have a three objects (strikers), lets say red, green and blue.

When I apply force to the green object I want to check if it has passed between red and blue or not. See the image below for an illustration.

Is there any line collider or something for that?

sentences:
How can I solve this SAT direct corner intersection edge case? I have a working SAT implementation, but I am running into a problem where direct collisions at a corner do not work for tiled surfaces. That is, it clips on the surface when going in a certain direction because it gets hung up on one of the tiles, and so, for example, if I walk across a floor while holding both down and left, the player will stop when meeting the next shape because the player will be colliding with the right side rather than with the top of the floor tile.

This illustration shows what I mean:

The top block will translate right first and then up.

I have checked here and here which are helpful, but this does not address what I should do in a situation where I don't have a tile-based world. My usage of the term "tile" before isn't really accurate since what I'm doing here is manually placing square obstacles next to each other, not assigning them spots on a grid.

What can I do to fix this?

sentences:
Sending position to .net server unity I'm working on a multiplayer game, I created a custom C# server using TCPListner.

I can't figure out how to send a players position to the server from the client side. I also couldn't figure out how to broadcast the position received from the client side to the rest of the players. Can someone help me with this?

sentences:
How to test if a level is passable? I am making an classic 2D arcade ball game. There will be 100 levels in this game. And after the 80th level passing the level by doing some arcade stuff will be very difficult.

For example level 100 will be the most difficult level and if I can't pass this level with manual testing (I am not very skillful), how can I know without manual testing if the 100th level can be passed?

(I don't want to make an impossible level. I just want to make a very difficult level.)

sentences:
How to detect and prevent abuse (botting) of online game API? I have been ocassionally working on a game idea in my free time. The gameplay and content renders it to be implemented as a online multiplayer game built with well established web technologies. You should know that it falls into the strategy and simulation genre. That means: No running around with characters or similar but only atomic actions (regarding client-server communication) like "build thing A on location X".

At one point I realized there is a huge problem: having a browser based front end relying on a REST API back end makes it a more than excellent target for bots. While automation is desireable for business it is poison to a game which is about fun. I experienced it first hand in a browser game in the past were the most successful players were bots which subdued everybody.

From my current point of view I do not see any possibility to protect against bots when building a multiplayer online game based on  a REST API. Exception: Making it open source so everybody can host his own instance for private groups or even just oneself (to not get annoyed by jerks with bots).

Is there any way to differenciate between an honest player who just set an alarm for the next possible action and a bot automatically taking every chance on appearance of it? Besides such show stoppers like captchas. If not, I would think about another technology stack which makes it at least much harder to mess with client-server communication (proprietary encrypted binary protocol in a native code client).

Edit: Thank you, your answers are inspiring but also made me realize that specific countermeasures cannot be made by going further into details of the game. However, that would be too much for a question on Stack Exchange. So I just want to point out the most important points:

Players are exploring, developing and managing whenever they want to. Their businesses still run fine when they are offline (it is a peaceful game, no weapons involved). Only expansion and progress need the players action. Those actions are limited by:
time is one of the key resources (like in EVE Online skill training). All processes in game require it. There is no point in being online 24/7. The average player should be successful already with spending not more than an hour every day in one or two sessions (roughly, the concept is still in development).

sentences:
Pygame Fullsreen Display Issue Code:

import pygame
pygame.init()
#
def Main(display,colors):
    clock =pygame.time.Clock()
    #
    surface = pygame.Surface(surface_resolution) # Create main surface
    surface.fill(colors["RED"])
    pygame.draw.rect(surface,colors["GREEN"],pygame.Rect((0,0),(110,110)))
    pygame.draw.rect(surface,colors["BLUE"],pygame.Rect((10,10),(100,100)))
    #
    while True:
        clock.tick(60)
        #
        for event in pygame.event.get(): # Main event loop
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE: # Exit game with Escape key
                    pygame.quit()
                    return
        #
        display.fill(colors["WHITE"]) # Fill the display white
        display.blit(surface,(display.get_size()[0]/2-surface.get_size()[0]/2,display.get_size()[1]/2-surface.get_size()[1]/2)) # Blit main surface on center of display
        #
        pygame.display.flip()
#
if __name__ in "__main__":
    global resolution
    global surface_resolution
    resolution =         (1920,1080) # Resolution of the display
    surface_resolution = (1536,864)  # Resolution actually seen
    #
    #
    display = pygame.display.set_mode(resolution,pygame.FULLSCREEN) # Create fullscreen display
    #
    colors = {                 # Defign colors
        "WHITE":(255,255,255),
        "RED"  :(255,0,0),
        "GREEN":(0,255,0),
        "BLUE" :(0,0,255),
        "BLACK":(0,0,0)
    }
    #
    Main(display,colors) # Run main loop

I have been experimenting with various resolutions in fullscreen Pygame. My new computers native resolution is 1920x1080 as apposed to my old computers resolution of 1366x768, so I started to test resolutions higher than 1366x768. However, when I run pygame with my native resolution, the highest resolution that fits my monitor is 1536x864 with the rest of the primary display off the screen.

This code creates a red surface with a 110x110 rectangle in the upper left corner and blits it to the center of the display. When I set the surfaces size to anything higher than 1536x864, parts of the 110x110 rectangle are cut off, and when I set the display and the surface size to 1366x768, Pygame stretches the display to fill my moniter.

The pygame display docs say that:

  When requesting fullscreen display modes, sometimes an exact match for the requested resolution cannot be made. In these situations pygame will select the closest compatible match. The returned surface will still always match the requested resolution.

However, when I run the following code to get all the available fullscreen resolutions, I see that 1920x1080 is an available resolution.

>>> for mode in pygame.display.list_modes():
        print(mode)
(1920, 1080)
(1680, 1050)
(1600, 900)
(1440, 900)
(1400, 1050)
(1366, 768)
(1360, 768)
(1280, 1024)
(1280, 960)
(1280, 800)
(1280, 768)
(1280, 720)
(1280, 600)
(1152, 864)
(1024, 768)
(800, 600)
(640, 480)
(640, 400)
(512, 384)
(400, 300)
(320, 240)
(320, 200)
>>>

My question is why does this happen, and how can I stop Pygame from stretching the display in this manner? I feel like I'm completely missing the point with this, but I couldn't find anything about this anywhere else.

sentences:
Player moving up, is he jumping or climbing? In a 2D physics-based platformer game that has ladders in it, how do you determine whether the player moving up is caused by a jump or him climbing a ladder, such that you know what animation to play?

And in general, obviously the direction vector is not enought to determine the animation to play: how do you also determine the cause of the movement (so you know the correct sprite to use)?

sentences:
How can I make my units follow predetermined paths? I'm planning my first game and am planning on using the engine set out in Beginning Android Games, as it deals with a load of stuff that is just noise at the moment to me (because I've no real world experience yet).  There's no real time restraint - this is a learning experience more than a real world project, although I would love to be able to release something at the end of this project.

The way the book tells me how to do movement has been very much acceleration and velocity based with other forces thrown in (wind, gravity etc) but it's not covered how I can set a predetermined path for an enemy to follow.  I was thinking that I could use a lookup table to map points for the enemy to head for, and then I'd just need a way of smoothing out the turning so that the motion is fluid.  Is this the correct approach?

I know this is a bit of a vague question, and I would give you some code, but I'm very much in the planning phase at the moment, so I'm just looking for some pointers or things to think about whilst I'm trying to work out how it's all going to hang together.

sentences: Update to the ROAM Large Scale Mesh LOD Method I'm looking to create very large planetary terrain meshes. The most efficient and researched methodology I've seen so far was the ROAM 2.0 Method. However, this was written and published in 2005. Does anyone know of a more up to date method for solving large, detailed mesh LOD transitions?

sentences:
How should I calculate the new angle/direction of my ball hitting a wall? I'm building a Pong game and I am stuck at how the ball should bounce when hitting a  horizontal wall.
I tried a few methods but none seems to work.

So far I have an update method, which is called every 15ms and which does this:

float scale_x = Math.Cos(ball._angle).ToFloat();
float scale_y = Math.Sin(ball._angle).ToFloat();

//speed multiplied by scale_x is our x velocity
float velocity_x = (gameSpeed * scale_x);

//speed multiplied by scale_y is our y velocity
float velocity_y = (gameSpeed * scale_y);

ball._vector.x += velocity_x;
ball._vector.y += velocity_y;

and if the ball hits the horizontal wall

if (ball._vector.y + velocity_y < 0){
    Vector n = new Vector(ball._vector.x, ball._vector.y);
    n.nor();

    float dot = (ball._vector.dot(n));
    ball._vector = ball._vector.add(n.mul((-2 * dot)));
}

I've been using this formula R = 2 * (V dot N) * N - V to calculate the new direction. But I can't seem to get it to work. To be honest, I'm not sure what kind of formula I need. I just need to find the new angle when it hits the wall.

Here is the solution for my game.
first i made velocity_x and y instance variables.

private float velocity_x;
private float velocity_y;

then i sat the start for my direction in my constructor

float scale_x = Math.Cos(ball._angle).ToFloat(); //The x scale is the cosine of the angle
float scale_y = Math.Sin(ball._angle).ToFloat(); //The y scale is the sin of the angle

velocity_x = (gameSpeed * scale_x); //speed multiplied by scale_x is our x velocity
velocity_y = (gameSpeed * scale_y); //speed multiplied by scale_y is our y velocity

Finally in my updateBall method i leave:

ball._vector.x += velocity_x;
ball._vector.y += velocity_y;

sentences:
Quaternion LookAt for camera I am using the following code to rotate entities to look at points.

glm::vec3 forwardVector = glm::normalize(point - position);
float dot = glm::dot(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector);

float rotationAngle = (float)acos(dot);
glm::vec3 rotationAxis = glm::normalize(glm::cross(glm::vec3(0.0f, 0.0f, 1.0f), forwardVector));
rotation = glm::normalize(glm::quat(rotationAxis * rotationAngle));

This works fine for my usual entities. However, when I use this on my Camera entity, I get a black screen. If I flip the subtraction in the first line, so that I take the forward vector to be the direction from the point to my camera's position, then my camera works but naturally my entities rotate to look in the opposite direction of the point.

I compute the transformation matrix for the camera and then take the inverse to be the View Matrix, which I pass to my OpenGL shaders:

glm::mat4 viewMatrix = glm::inverse(
    cameraTransform->GetTransformationMatrix()
);

The orthographic projection matrix is created using glm::ortho.

What's going wrong?

sentences:
Is it possible to use one if statement for each level scene? I'm working on a platform game where you as a player have to collect logs, to keep on all the fires in the level. Each campfire has a timer, which ensures that every x number of seconds the animation of the fire is changed to a numb fire. The timer of a campfire is blocked by the script, when the player has received the fire at 100%. When all fires are 100% you won, if not you lose.

Know I use the following if statement to check if the player has won or lose:

if (Application.loadedLevelName == "Level 0") {

        if (campfireAmount == allCampfireFull) {
            // Do something
            print ("level 1 complete");
            Application.LoadLevel (6);
        }

        if (campfireAmount == allCampfireEmpty) {
            // Do something
            print ("level 1 failed");
            //Application.LoadLevel ("GameOver");
        }

    }

What I searching for is how I can make this if statement useful for each level, whiteout use for each level scene above if statement. Beside that, what I want is that after each level you get a win scene (if possible a reusable scene) and after clicking in that scene on a button, you should go to the next level scene. Is there a way to load the next level, whiteout set a hard number of the rang list of "Build Settings"?

sentences:
Simple Terrain Rendering For some reason I can not find a good example of terrain rendering, as in like "bare bones". Im reading Introduction to game Programming with DX10, and i've seen some other tutorials....but they all are complicated classes with ALOT of stuff thats unnecessary, and tbh just confuses a beginner like me. Like Raserteks tutorials are awesome, but it's SOO much code and classes, it's very difficult to understand the "3d" part when you have so many other classes.

Im just looking for the most BASIC terrain rendering (using a heightmap....or what have you).

It doesn't even have to have a camera or movement control, hell it can just be of one color. Im just trying to understand everything first. Does anyone know where I could find a sample of this? or heck if anyone would be willing to provide a simple sample of their own i'd be mega appreciative.

Dont get me wrong, the Book is great.....and I understand the functions, but the way the classes are put together...it makes it confusing of "what goes where".

edit: I've seen some Direct X 9 terrain demo's/samples....but isn't DX9 like WAYYY different from DX10 (if so thats why I wouldn't want to waste time on it). I could be wrong though.

sentences:
Enabling and Disabling children in Unity I'm trying to create an enable/ disable game objects in Unity.  I used GameObject.SetActiveRecursively but it only works one-way.

I used a collider in which when an object enters the collider.  The game objects become enabled.  When they leave or get to a certain point, they disable.

How would I make this a two way system, making it able to be enabled while inside the collider and disabled when outside the collider?

-- The collider is in the game object who is being disabled and enabled.

According to this information from Unity Answers, the object becomes disabled.  So how would I make the object enabled?

function OnTriggerEnter(other : Collider){
    if(other.tag == "Player"){
        gameObject.SetActiveRecursively(true);

    }
}

function OnTriggerExit(other : Collider){
    if(other.tag == "Player"){
        gameObject.SetActiveRecursively(false);
    }
}

sentences:
Collision detection between image and drawables I'm trying to collide my ball_1 to greengreen drawable. How can I determine the collision?

public  class MainActivity extends Activity  implements Runnable{

    private Imageview ball1

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ball1 = (ImageView) findViewById(R.id.ball_1);
        Drawable gr1 = new Drawable(R.drawable.greengreen)

        public void run() {
            startballanimation();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }//trying to use an if else statement here to collide imageview ball1 to drawable"greengreen"
        }
    }
}

sentences:
Only 1 side is rendered I'm trying to get my .blend object into Unity but for some reason I see it differently in Unity than in Blender.

I was trying to solve the problem and someone said that I have to go to the edit mode, then mesh, then change the normals but that is not working for me.

Here is what I mean:

sentences:
Precision loss when transforming from cartesian to isometric My goal is to display a tile map in isometric projection. This tile map has 25 tiles across and 25 tiles down. Each tile is 32x32. See below for how I'm accomplishing this.

World Space

World Space to Screen Space Rotation (45 degrees)

Using a 2D rotation matrix, I use the following:

double rotation = Math.PI / 4;
double rotatedX = ((tileWorldX * Math.Cos(rotation)) - ((tileWorldY * Math.Sin(rotation)));
double rotatedY = ((tileWorldX * Math.Sin(rotation)) + (tileWorldY * Math.Cos(rotation)));

World Space to Screen Space Scale (Y-axis reduced by 50%)

Here I simply scale down the Y value by a factor of 0.5.

Problem

And it works, kind of. There are some tiny 1px-2px gaps between some of the tiles when rendering. I think there's some precision loss somewhere, or I'm not understanding how to get these tiles to fit together perfectly. I'm not truncating or converting my values to non-decimal types until I absolutely have to (when I pass to the render method, which only takes integers). I'm not sure how to guarantee pixel perfect rendering precision when I'm rotating and scaling on a level of higher precision. Any advice? Do I need to supply for information?

sentences:
Load nextLevel with a button click Can anyone help me someone with this code?

I'd like to go to the next level by clicking a button: example my level name is L1,L2,L3,L4,L5,L6,L7 and when I finish level L1, I want to go to level L2 with the click of a button, and from L5 go to L6 like this.

public class GameLevels : MonoBehaviour {

 public Button Play;
 private int idLevel;
 // Use this for initialization
 void Start ()
 {
     idLevel = PlayerPrefs.GetInt("idLevel");
     Play.interactable = false;
 }
 public void SelectLevel(int i){
     idLevel = i;
     PlayerPrefs.SetInt ("idLevel", idLevel);
     Play.interactable = true;
 }

 public void LoadLevel(string Levels)
 {
     SceneManager.LoadScene (Levels);
 }
 public void Replay()
 {
     SceneManager.LoadScene ("L" + idLevel.ToString ());
 }
 public void loadNextLevel()
 {

 }
}

sentences:
Updates for IOS AppStore Multiplayer Game I am developing a multiplayer game for the web, android and ios. For the web and android i can instantly push out new versions of my game because they support executing remotly loaded code. But with IOS i need to wait for an Apple approval taking about 10 days. I want to push updates more then weekly.

What if my server code changes so the client MUST update? Run an old version of the server code just for IOS? How do other multiplayer devs handle this ?

sentences:
Can I run into legal issues with random names? I'm currently building a game whose NPC's are going to be assigned a random gender and a random name for the right gender. To do this I will be using a "database" of names (actually a text file with  tuples). There would also be a list of last names, which will be added to the first name also randomly.

My question is the following. Suppose one such random name is "George Bush", and this person has been randomly assigned the job of president. As you can see, this could easily be seen as having been "copied" from a real-life person.

The main issue is this. Names will be randomly-generated, yes, but the seed for random-number generation will be constant. In other words, the name of an NPC would be randomly-generated, i.e. I wouldn't choose it, but it would be the same for every player. Could this get me in trouble? We cannot verify all possible names, since the generated number of NPC's could be potentially limitless (new NPC's are being created whenever needed).

sentences:
Rotating coordinate system Lets say that you want to rotate simple cube around fixed point in center.

Is it possible to use such coordinate system, that you need to use only sine and cosine in order to rotate?

I have done some 3d stuff in VHDL, but i screwed whith coordinate system and is not working correct. I need to make rotation that works in at least two axes.

sentences:
How can I achieve dynamic pathfinding in Godot? I am new to Godot and trying to implement dynamic pathfinding on a 2D map which includes both static obstacles and moving units. As I understand it, Godot's NavMesh makes it almost trivial to generate a path through a pre-baked polygon map [1], as with the solid-line path in the below image. However, I want my game to be able to re-plan the path if an enemy (or other obstacle) moves to obstruct it--as with the dotted-line path in the image. Is this possible with built-in Godot functionality? And if so, how?

Alternatively, how would you recommend implementing a custom pathfinding script in Godot? I am comfortable with vanilla A* and I plan to learn GDScript and/or C#, but in my experience (in Python/Pygame), grid-based A* is much too slow to re-check the path every frame.

sentences:
Multi Screen Rendering in Unity My experience with Unity in not that in depth. But I am wondering if it possible in unity to split what is being rendered across multiple screens.

It's hard to explain, so here is an image:

So while the middle screen is fine to render, I want to spread the image all around the player. That is both to the side and, the bottom and top of the player.

Is such a thing possible? Has anyone ever done something similar?

sentences:
Best practices on separating Update and Draw on game loop I've been working on my first HTML5 prototype and I found a good model that uses the regular Update and Draw loop we see in game dev. My question is, where does one end and the other begins?

The question popped when I wanted to rotate and draw an Image, and I kept wondering if the work of changing the tranformation matrix (that I presume would be a bit expensive since it works on the whole pixel array of an image) and calculating the right position do draw it would characterize drawing work, or maybe not, since after that I may need to check for collision or something similar.

Thinkig of it, seems like a silly question, but I would like some advice from more experienced developers. Where does does update ends and draw starts?

Thanks in advance.

sentences:
NavMesh stops working when changing scenes In my game, upon reaching the end of the level, I change scenes to go to the next level. Most of the stuff is maintained from scene to scene using DontDestroyOnLoad, but the environment(floor) is not. So, I tried creating a new level environment in the next scene and baking it, but when the player enters that scene by reaching the end of the previous level, I get a NavMesh error stating that SetDestination can only be called on active agents. Why does this happen? Does the player have to be in the scene when baking occurs? Right now, the player does not natively reside in the scene, but gets loaded to it.

Edit: I created a new project with just the bare essentials for testing and it works as intended. Clearly, something was off with my other code which caused this kind of interference.

sentences:
simple solution for 3d collision detection and response I'm having great difficulty trying to implement collision detection and response in a 3d game

What are some simple solutions someone can use to implement smooth collision and response similar to games like Quake? I can see there are a lot of different ways to do collision and response but that makes it even more confusing, Im not sure which method is the best solution to sit down with.

So I was wondering what is the goto solution for the average programmer? All I have found online are very complicated incomplete mathematical explanations which I have a hard time understanding. Is this really a topic that requires an entire textbook to understand??

Perhaps theres a library ? Ive tried looking into bulllet but it seems to require heavy knowledge of physics. The best solution I have found is in a software called darkbasic, where it somehow handled sliding collision automatically and all the user had to do was desginate which object were to be handled. Was wondering maybe theres something similar to that

sentences:
How to get the result of random item with different possibility? I'm wondering if anyone can guide me with following problem...
Each fruit has different chance to be called out.

Apple - 80%
Orange - 10%
Banana - 10%

Each time a user click on the random image, only 1 fruit will come out with above weight.
I have no idea how I can calcuate to get that result. Pseudo code example is fine for me.

sentences:
OpenGL light calculation I want to add somebasic point lights to my OpenGL application. I read here that I have to caluclate the light in a pre-projection space:

  Lighting can be done in any pre-projection space (e.g., world coordinates or eye coordinates), as long as all the objects and lights are all in that same space.

And here is my problem. My Renderer currently looks something like this:

public void onDrawFrame(GL10 unused)
{
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    Matrix.multiplyMM(camProjection, 0, projection, 0, camera, 0);

    for(int i=0; i < sceneObjects.size(); i++)
    {
        SceneObject object = sceneObjects.get(i);
        object.draw(camProjection);
    }

    // ...
}

As you can see I multiply my projectionMatrix with the viewMatrix and I think that is a good solution because I only have to do this once. To draw I give the PVMatrix to all objects and multiply it with their modelMatrix and then I push the finall MVPMatrix to the shader. This is a problem because I can not calculate the light direction in eye space in the shader because I do not have any pre-projection matrix here. Do I really have to push a MVMatrix to the shader and calculate the normals and so on with it? I think this is really inefficient because I have to do much more matrix multiplications, isn't it? What would you suggest to calculate this efficiently?

sentences:
How can I make tiny sprites larger? I used a 16x16 sprite pack to make a 640x640 map in pygame:

The problem is that everything is extremely tiny. How could I go about making the expected "JRPG" look, like this for instance:

I have tried so far to double the size of the map tiles using pygame.transform.scale(tile,(32,32)) but that makes everything look terrible:

Here is how I am rendering the map:

import pygame
import pytmx
from pytmx.util_pygame import *

class tileRender:
    def __init__(self,filename):
        tm = pytmx.load_pygame(filename)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm

    def render(self,surface):
        ti = self.tmxdata.get_tile_image_by_gid
        for layer in self.tmxdata.visible_layers:
            if isinstance(layer,pytmx.TiledTileLayer):
                for x,y,gid in layer:
                    tile = ti(gid)
                    tile = pygame.transform.scale(tile,(32,32))
                    if tile:
                        surface.blit(tile,(x * self.tmxdata.tilewidth, y * self.tmxdata.tileheight))

    def makemap(self):
        temp_surface = pygame.Surface((self.width,self.height))
        self.render(temp_surface)
        return temp_surface

Is there a way of "zooming in" on the sprites in order to get the expected look?

sentences:
Rectangle collision doesn't work on WP 8 Collision detection is not working correctly when my 64x64 pixel block touches a bigger block. The big(rect2big) block measures 128x128 pixel. The falling block should change it's color to black when it touches another block, but that's not working if it touches the big block. The falling block changes it's color far too late when it touches the big block. You can see that in this video: http://www.vidup.de/v/QFeTK/

What is wrong? Why is collision detection not working correctly when the falling block touches the big block?

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D rect, rectbig;
    Rectangle rect1, rect2, rect2big;
    bool rectcollision = false;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        TargetElapsedTime = TimeSpan.FromTicks(333333);
        InactiveSleepTime = TimeSpan.FromSeconds(1);
        this.graphics.PreferredBackBufferWidth = 480;
        this.graphics.PreferredBackBufferHeight = 800;
        graphics.IsFullScreen = true;
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        rect = Content.Load<Texture2D>("block64");
        rectbig = Content.Load<Texture2D>("block128");
        rect1 = new Rectangle(200, 0, rect.Width, rect.Height);
        rect2 = new Rectangle(200, 200, rect.Width, rect.Height);
        rect2big = new Rectangle(200, 400, rectbig.Width, rectbig.Height);
    }

    protected override void Update(GameTime gameTime)
    {
        rect1 = new Rectangle(rect1.X, (int)(rect1.Y+1.0f), rect.Width, rect.Height);

        if (rect1.Intersects(rect2) || rect1.Intersects(rect2big))
        {
            rectcollision = true;
        }
        else
            rectcollision = false;

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        spriteBatch.Draw(rect, rect2, null, Color.White, 0, new Vector2(rect.Width / 2, rect.Height / 2), SpriteEffects.None, 1);
        spriteBatch.Draw(rectbig, rect2big, null, Color.White, 0, new Vector2(rectbig.Width / 2, rectbig.Height / 2), SpriteEffects.None, 1);
        if (rectcollision == true)
          spriteBatch.Draw(rect, rect1, null, Color.Black, 0, new Vector2(rect.Width / 2, rect.Height / 2), SpriteEffects.None, 1);
        else
            spriteBatch.Draw(rect, rect1, null, Color.White, 0, new Vector2(rect.Width / 2, rect.Height / 2), SpriteEffects.None, 1);
        spriteBatch.End();
        base.Draw(gameTime);
    }
}

sentences:
Unity: Saving scene after using script to change object positions I have a c# script which makes some edits to object positions in the editor. It does this by reading some values from a csv file and then changing the value of transform.position for each gameobject. When I run the script all the objects appear where I want them to be in the editor. However, the editor doesn't seem to recognise any change and when I save and reload the scene the objects have reverted to their previous positions. Any ideas?

Code:

GameObject go = GameObject.Find(values[1]);
Undo.RecordObject(go,"setting at rest");
// Do transforms
float x = float.Parse(p_values[0]);
float y = float.Parse(p_values[1]);
float z = float.Parse(p_values[2]);
Vector3 p = new Vector3(x,y,z);

go.transform.position = p;

Aha I think I see my error, Undo.RecordObject want the specific object that is changing rather than the gameobject. I've edited the code to Undo.RecordObject(go.transform,"setting at rest"); and it now seems to work

sentences:
Unity - Loss of detailed shadows and shading marks on texture seams appearing after lightmap baking I'm attempting to lightmap bake my scene and am running into the following problem -

With the lights set to realtime, the shadows have a nice amount of detail in them and the lighting on the models looks correct. However after a bake, all I end up with is a dull blob shadow underneath everything and nasty shading marks on my meshes, these shading marks are mostly appearing where the seams are on the UVs. The models are .blend files from Blender and 'Generate Lightmap UVs' is checked on the model Inspector panel.

All lights are set to static and 'Baked'

Lights are 3 x spotlights 1 x directional light

All models are set to static

Unity 5.3.3

PC standalone

Materials are using the standard shader with a diffuse and normal map on each.

I have attached screenshots of the problem and all my settings.

This is my first proper attempt at lightmapping, so I'm hoping it's just a simple oversight in my settings that someone more experienced can point out.

If anyone can suggest the cause of the problem, it would be much appreciated.

Thanks in advance

sentences:
Using InputListener touchDown - Unable to jump while pressing direction button Using InputListener attached to images for touchscreen control I initially had the problem of the player being able to continuously jump and fix themselves to the top of the screen by simply holding the jump button.

This was resolved by adding a gdx.input.justTouched() check before calling the jump() method. However, this annoyingly then introduced a new issue of not being able to jump whilst holding a direction button. The direction button first has to be released before the jump will function.

if (player.presentState != Player.State.DEAD && player.presentState != Player.State.WIN) {
            if (controller.isRightPressed() && player.body.getLinearVelocity().x <= 1.75)
                player.body.applyLinearImpulse(new Vector2(0.1f, 0), player.body.getWorldCenter(), true);
            if (controller.isLeftPressed() && player.body.getLinearVelocity().x >= -1.75)
                player.body.applyLinearImpulse(new Vector2(-0.1f, 0), player.body.getWorldCenter(), true);
            if (controller.isUpPressed() && controller.isJumpPressed() && player.presentState != Player.State.FALLING)
                if (Gdx.input.justTouched()){
                    player.superJump();
                }
            if (controller.isDownPressed()){
                player.dive();
            }
            if (controller.isJumpPressed() && player.presentState != Player.State.JUMPING){
                if (Gdx.input.justTouched()) {
                    player.jump();
                }

The jump() method operates under two different state conditions.

If the player is state.ground or state.running, a positive y-impulse is applied.

If the player is state.falling a slight positive y-impulse is applied with linearDampening allowing the player to control the descent as to float/glide down.

This all works perfectly via my keyboard input implementation but not in my touchscreen one.

How to resolve this?

sentences:
How do I remove specfic OptionData from Dropdown? How would I remove one of the elements from the dropdown? For example, how would I remove Sprites? Here is my code:

public Dropdown researchFeatureDropDown;
researchFeatureDropDown.options.Add(new Dropdown.OptionData("Sprites"));
researchFeatureDropDown.options.Add(new Dropdown.OptionData("Scrolling - 2000"));

sentences:
Why do my 3D models look so different when imported into Unity? I am importing an image from Maya into Unity but the shapes look drastically different from one another as well as the color and I am not sure what is causing this how can I fix it?

From maya

From Unity

sentences:
Keeping crosshairs & GUI onscreen - SFML I read this question, but didn't understand the implementation suggestions with SFML on C#.

For example, right now I'm just trying to make sure that the mouse crosshairs stay onscreen constantly. I tried using this code:

        View lastView = this._mainWindow.GetView();
        this._mainWindow.SetView(this._mainWindow.DefaultView);
        this._mainWindow.Draw(crosshair);
        this._mainWindow.SetView(lastView);

After drawing all other sprites and before call this._mainWindow.display(), when beforehand I set crosshair.Position based on its position relative to the window, not the view.
This just keeps the screen locked and prevents screen scrolling. Any suggestions?

sentences:
How to support JS/Python scripting a C++ game engine? I'm currently writing an Entity/Component/System architecture game engine in C++, and I have the beginnings of a lua scripting system in place, which seems to be quite popular, but I feel Javascript or Python would be better.

My requirements are:

Able to bind C++ function calls to the scripting language.
Able to return data to the calling script.
Able to support heavily templated libraries, such as glm (optional, but desirable)
Must be lightweight.
Must have open source license, or similar, with no restrictions on any potential commercial use.

How would I go about doing this, in a similar way to Lua?

sentences: Separate classes communication Lets say I have a key and door. My third class (player) needs to pick up a key and open the doors. How should those objects communicate without making too much dependencies between them?

sentences:
OpenGL Shadow Mapping from directional light I have read this tutorial:
http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/

I wonder, is this the current best technique for generating shadows in an arbitrary 3D scene? Is it the way current modern games implements directional light shadows or are they using some other better way of calculating shadows on the fly?

What I mean is if you know your geometry so good that you know exactly every impact a shadow can have on an objects colors, it must be better to use that information instead of rendering a Shadow map?

For example, if we have a 3D grid world with all perfect cubes at perfect offset (think minecraft) and the directional light if exactly 45 degree in all dimensions, that leave us with a situation where a cube closer to the light will also cast shadow on the entire cubes at position offset -1, -1, -1 from that cube, and so on. The shadows always go diagonal and put other equally sized cubes sides in 1 of three states: all shadow, all light or 50% in shadow.

If we know our geometry so good, then using that information must be much faster than rendering shadow maps right? Even when most of such calculation is done on the CPU instead of the GPU.

sentences:
Generic item collision/reflection in Pong (Flash) I am trying to find a good way to handle ball/paddle collisions/reflections in Pong. I've tried the "naive" approach of just checking x and y coordinates against each other, figuring out where the ball hits on the paddle and how to change reflection, etc, but it seems so tedious to do it this way. I feel like I have to check collisions against the front of the paddle, then the sides, etc.

Is there a good, general way I can check for a collision between the ball and the paddle (be it sides, front, etc), ensure the ball doesn't pass through the paddle, determine where the ball touches the paddle in terms of tangency (if we don't allow the ball to move through the paddle), and determine reflection rules based on that point of tangency?

I've already looked into Corey's Detection Kit but it didn't seem to work for my purposes.

Consider the picture at the bottom of this post. Let's say the red ball is where the ball WANTS to appear based on the speed/frame-based update routine for the ball. Using some routine, it determines there is an intersection because either the sprites overlap or the path of travel overlays the paddle. But I really want to bring the ball back up to where it's actually touching the paddle at tangency. Is there a general way to do this?

http://i.stack.imgur.com/Xo99a.png

sentences:
Get water flow direction vector from water normal vector Im stuck developing an important detail of my game water: Making it flow downwards!
Considering a typical 3D world in wich water tends to go towards gravity g=(0,-1,0) , and having the normal of the water surface n=(x,y,z), how can I calculate, based on that, the water flow direction vector?
As an example, consider this badly-done graph (In 2D, though)

Update: I'm considering a very simplified water surface (Just a plane: No ripples, no waves, no pressure, etc.). If any of those needed to be applied, the answer would depend on more factors than just the normal.

sentences: Snapping of irregular images in iphone puzzle app I am working on puzzle app in which i need to snap irregular shapes as they come in contact of one another as i am new to game development so i dont have any idea how to achieve this functionality in my app.Any suggestion would be highly appreciated.

sentences:
How do I correctly use GetComponent to get the rigidbodies of each element in an array of colliders? I was trying to implement an AddExplosionForce-script that was shown in a Unity live training session a few years back. It has out of date calls to rigidbodies because it uses the old gameobject.rigidbody way of accessing them. I tried doing the standard process of

declare a rigidbody,
link it to a GetComponent<>, and
act on the rigidbody through the resulting variable.

However, as shown below, the rigidbodies I need to interact with are used in a foreach loop that goes through an array of colliders. How do I access the rigidbody of each collider in the array as it is used? (and if that is the wrong approach, please let me know). Will using GetComponent in that way harm performance?

Here is the original script from the video, w/ minor comments. I have left out my botched attempt at fixing it for the sake of brevity.

public class MassExplosionScriptOriginal : MonoBehaviour
{
    public float force;
    public float radius;

    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100))
            {
                Collider[] colliders = Physics.OverlapSphere(hit.point, radius);
                // overlap sphere collects all the colliders that it overlaps
                // with/touches. From  the point you click (hit.point), create a sphere of the
                // given radius (radius),collect all the colliders from the objects overlapped,
                // and then return them with the array colliders.

                foreach (Collider c in colliders) // declare a variable to hold a //collider
                {
                    if (c.rigidbody == null) continue;
                    // the if statement clause says that, if the collider touched //has no rigidbody, then skip it and continue on.

                    c.rigidbody.AddExplosionForce(force, hit.point, radius, 1, ForceMode.Impulse);
                    // Whenever you click, this script will collect all the
                    // colliders and then apply the explosive force to them. It works on everything
                }
            }
        }
    }
}

sentences:
How can I highlight words in a word search puzzle? For days I am struggling to implement the highlighting functionality in game as there is not much tutorial also for this. I did how ever make the cell of the grid change the material color but it looks ugly that's why I prefer to choose this method (see pic).

How can I implement a highlighting method that will work the same on link.

My try:

 private bool first_sel = false;
    private void Update() {
        if (Input.GetMouseButton(0)) {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out pressed)) {
                if (pressed.transform.tag == "cell") {
                    if (!first_sel) {
                        GameObject sel = Instantiate(sel_cell, new Vector3(pressed.transform.position.x,
                            pressed.transform.position.y, pressed.transform.position.z - 0.55f), Quaternion.identity);
                    }

                }
            }
        }

sentences:
What heuristics are used in NavMeshes? What heuristics do programmers use in A* pathfinding for NavMeshes?

NavMesh = Navigation Mesh, its a type of pathfinding that uses meshes instead of waypoints.

sentences:
Creating my own kill cam I plan on creating my own kill cam system for a sandbox tool set.  After thinking about the mechanics of the kill cam itself, however, I'm quite lost.  I'm trying to recreate the ones commonly seen in call of duty games that show, from the view of the killer, the actual killing scene.

My Thoughts:

-I can't just keep in memory when people kill others because I wouldn't know when to start the 'recording process'.  There is on way for me to accurately determine when somebody is 'about' to kill someone.

-My only real idea so far is to have a complete duplicate of everything loaded off to the side copying all the movement from the original world but with a 10 second delay.  That way, all the kill cams would be 10 seconds long and the persons camera would just be moved to the second world of their killer.

My Questions:

Is there already an accepted way to do this?  Does anybody have any good ideas for something like this?  Thanks if you can!

sentences:
Loading levels from .txt or .XML for XNA I'm attemptin to add multiple levels to my pong game. I'd like to simply exchange a few elements with each level, nothing crazy. Just the background texture, the color of the AI paddle (the one on the right side), and the music.

It seems that the best way to go about this is by utilizing the StreamReader to read and write the files from XML. If there is a better, or more efficient alternative way then I'm all for it. In looking over the XNA Starter Platformer Kit provided by MS it seems that they've done it in this manner as well. I'm perplexed by a few things, however, namely parts within the Level class which aren't commented.

/// <summary>
    /// Iterates over every tile in the structure file and loads its
    /// appearance and behavior. This method also validates that the
    /// file is well-formed with a player start point, exit, etc.
    /// </summary>
    /// <param name="fileStream">
    /// A stream containing the tile data.
    /// </param>
    private void LoadTiles(Stream fileStream)
    {
        // Load the level and ensure all of the lines are the same length.
        int width;
        List<string> lines = new List<string>();
        using (StreamReader reader = new StreamReader(fileStream))
        {
            string line = reader.ReadLine();
            width = line.Length;
            while (line != null)
            {
                lines.Add(line);
                if (line.Length != width)
                    throw new Exception(String.Format("The length of line {0} is different from all preceeding lines.", lines.Count));
                line = reader.ReadLine();
            }
        }

What does width = line.Length mean exactly? I mean I know how it reads the line, but  what difference does it make if one line is longer than any of the others?

Finally, their levels are simply text files that look like this:

....................
....................
....................
....................
....................
....................
....................
.........GGG........
.........###........
....................
....GGG.......GGG...
....###.......###...
....................
.1................X.
####################

It can't be that easy..... Can it?

sentences:
Unity>How to make a Box Collider( or any other collider) fits the gameObject perfectly? I have downloaded and imported the Robot Kyle model in Unity 3D...and the problem with me is I want to add a Box or Capsule Collider to it...but I can't fit it perfectly...

So what shall I do?

sentences: 2d game with png sequences slowing on Unity3d We are building a tower defence game,In which enemy movement is done through sprite sheets as well the tower rotation is also done through sprites...every tower and every enemy has its own script attached to it which controle its animation...but when enemies and towers are in greater ammount the games slows down..and become laggy on iphone and unity ..can anyone tell what is the problem with it...

sentences:
Reference counting with resource handles I have implemented a resource handle and resource cache class.  The handle stores an integer id.  The cache stores a vector of objects e.g., Textures.  The handle id acts as an index into the cache asset vector.
I then have a third class which provides methods to get the object(Texture) associated with a given handle.  The class also stores a map of filename, handle for previously loaded objects.
I am trying to add reference counting to the system.  At the moment I store a std::size_t* ref_count in Resource_handle and have the following constructor/destructor/assignment operators:
Resource_handle() : id(0), verifier(0), ref_count(new std::size_t(1)) {}

Resource_handle(const Resource_handle<T>& handle)
: id(handle.id), verifier(handle.verifier), ref_count(handle.ref_count) { ++*ref_count; }

template<typename T>
Resource_handle<T>& Resource_handle<T>::operator=(const Resource_handle<T>& rhs)
{
    ++*rhs.ref_count;
    if (--*ref_count == 0) {
        delete ref_count;
        // reset handle
    }
    id = rhs.id;
    verifier = rhs.verifier;
    return *this;
}

template<typename T>
Resource_handle<T>::~Resource_handle() // reference handling 515 C++ Primer
{
    if (--*ref_count == 0) {
        delete ref_count;
        // unload resource in handle
        // reset handle?
        reset();
    }
}

The above code is not complete but I have two problems I'm aware of so far.

The objects in the Resource_cache vector are not allocated on the heap and Resource_handle has no pointer to them to delete them.

The reference count ref_count is actually counting copies of a particular handle rather than of objects in the cache vector.

How can I resolve these two issues?  I'm wondering if the reference handling should be done in the cache class instead?  However the cache would have no knowledge of how many handles refer to a particular object in its object vector.
Many thanks.
Edit: I did consider std::shared_ptr<T> however research lead me to using handles for the ability to reload resources, easier serialisation and the more lightweight approach.

sentences:
Vector normalization gives very imprecise results When I normalize vectors I receive very strange results. The lengths of the normalized vectors range from 1.0 to almost 1.5. The functions are all written by me, but I just can't find a mistake in my algorithm. When I normalize I just divide all components of the vector by the vector's length.

public double length(){
    return Math.sqrt(x*x + y*y);
}

public void normalize(){
    if(length() > 0){
        x /= length();
        y /= length();
    }
}

Is this supposed to happen? I mean I can see the length ranging from 0.9 to 1.1 at worst, but this is just overwhelming.

Cheers

sentences:
Unity: Change scene by drag How do I change the scene like you do on common android home screens?

I know i could detect if the player swipes to the right and then change the scene but this would not look as smooth as android home screens.

sentences:
tcp multiplayer security/structure I'm creating a real time multiplayer game. Each piece of data needs to be received, but it still needs to be as fast as possible which is why I don't want to use TLS for every request.

Here's what I was thinking:

The player logs in using TLS, and receives a session ID and symmetric key that the server generates

The server stores the player's ip address and symmetric key in the database for future reference

When they start a match, they receive a match ID, and send data to the server including the match ID, their session ID, and any necessary data using a symmetric encryption algorithm

The server takes their IP, finds the symmetric key from the database, and decrypts the message and authenticates the user based on the session ID

If everything checks out, the server accepts the data.

Is this approach plausible/efficient? would it be better for me to store the each player's symmetric key using their IP, or for me to get rid of the IP/symmetric key link table and send the data with the session id not encrypted, and store the key using the session id?

Any answers/comments would be greatly appreciated.

sentences:
MonoGame: Music does not stop playing upon exit of game I use MediaPlayer to play the background music. Sometimes, the music does not stop playing when I exit the game. This is even though I use the following code:

    protected override void OnExiting(Object sender, EventArgs args)
    {
        base.OnExiting(sender, args);

        MediaPlayer.Stop();
    }

What is wrong?

sentences:
What is the most secure way to archive a GKScore to be re-submitted later? I'm looking for the safest way to archive and store a GKScore that needs to be re-submitted to Game Center (say, because the user didn't have a network connection at the time the score was earned).  I would like to archive the GKScore instance in case the app is terminated before it can be successfully re-submitted to Game Center.

My worry is that if it's archived to an instance of NSData and saved in a .plist, it would be easy to manipulate.  Perhaps this worry is unjustified?

NOTE: I posted a similar question on Stack Overflow only to realize that it's better asked here.

sentences:
Unity mesh - delete quads I'm trying to delete quads in unity. The code here creates a procedural grid. Setting the gridSizeX to 5 and gridSizeY to 3, creates a 6 by 4 grid. I want to delete the first row of quads when I click the left mouse button (later will implement a trigger to delete). I have created a DeleteTriangle() method but it doesn't work properly. I would like to delete all the quads in the first row when I first click the left mouse button. When I click again, it should remove the next row and so on. Here is the code I have:
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class Grid : MonoBehaviour
 {
   Mesh mesh;
   Vector3[] vertices;
   int[] triangles;

   public float cellSize = 1;

   public int gridSizeX, gridSizeY;

   void Awake()
   {
     mesh = GetComponent<MeshFilter>().mesh;
   }

   void Start()
   {
    MakeGrid();
    UpdateMesh();
   }

   void Update()
   {
    if (Input.GetMouseButtonDown(0))
      {
        DeleteTriangle(0);
      }
   }

  void MakeGrid()
  {
    //set array sizes
    vertices = new Vector3[gridSizeX * gridSizeY * 4];
    triangles = new int[gridSizeX * gridSizeY * 6];

    //set tracker integers
    int v = 0;
    int t = 0;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 cellOffset = new Vector3(x * cellSize, 0, y * cellSize);

            //populate the vertices and triangles arrays
            vertices[v] = new Vector3(-cellSize, 0, -cellSize) + cellOffset ;
            vertices[v + 1] = new Vector3(-cellSize, 0, cellSize) + cellOffset  ;
            vertices[v + 2] = new Vector3(cellSize, 0, -cellSize) + cellOffset  ;
            vertices[v + 3] = new Vector3(cellSize, 0, cellSize) + cellOffset  ;

            triangles[t] = v;
            triangles[t + 1] = triangles[t + 4] = v + 1;
            triangles[t + 2] = triangles[t + 3] = v + 2;
            triangles[t + 5] = v + 3;

            v += 4;
            t += 6;
         }
      }
    }

   void UpdateMesh()
   {
    mesh.Clear();

    mesh.vertices = vertices;
    mesh.triangles = triangles;
    mesh.RecalculateNormals();
   }

   private void DeleteTriangle(int id)
    {
      Mesh currentMesh = mesh;

      var triangles = currentMesh.triangles.ToList();

      triangles.RemoveAt(id );
      triangles.RemoveAt(id );
      triangles.RemoveAt(id );

      currentMesh.Clear();
      currentMesh.vertices = vertices.ToArray();
      currentMesh.triangles = triangles.ToArray();

      currentMesh.RecalculateNormals();
   }
 }

sentences:
Replace PolygonCollider2D with MeshCollider at runtime I am using a PolygonCollider2D to load in points for a MeshCollider at runtime, but am having issues switching between the two at runtime using good coding practices.

This is a simplified version of the current code:

Awake(){
    PolygonCollider2D polyCollider = this.gameObject.GetComponent<PolygonCollider2D>();
    //save vectors
    Vector3[] v3 = new Vector3[polyCollider.points.Length];
    for (int i = 0; i < polyCollider.points.Length; i++)
    {
        v3[i] = new Vector3(polyCollider .points[i].x, polyCollider .points[i].y, 0);
    }
    //destroy collider
    DestroyImmediate(collider);
    meshCollider = this.gameObject.AddComponent<MeshCollider>();
    meshCollider.sharedMesh.vertices = v3;
}

Other than the bad naming, how can I substitute DestroyImmediate(collider) with Destory(collider) while still having it behave correctly. I would be willing to move the mesh collider declaration to a different function to delay its assignment.

sentences:
Why don't beat 'em ups allow player character sprites to face toward or away from the screen? Most beat 'em up games don't allow player character sprites to face away or towards the screen. For example, in Streets of Rage, when you press up, the character moves up, but it is still facing either left or right, and the same is true when you press down.
Even in modern beat 'em ups, this is the case. What is the reason for this? I used to think this is because the graphics are 2D, so it's harder or more work to get characters to face towards or away from the screen. But even in beat 'em ups that use 3D graphics, this is still the case, like Double Dragon Neon.

sentences:
Protecting the integrity of a game state while minimizing amount of data sent I'm developing a multiplayer game in PHP/jQuery, and naturally have to be wary of any sort of data coming from the client.

At present, I have tables of data representing the map (2D roguelike), monsters, items, and player(s).  Initially, my thought was to simply package it all in a JSON object and send it every game tick, however when actually looking at the data I realized that's quite a large packet to be sending.

So, my question is what is a good approach for minimizing data sent to the client?  Obviously I would need to figure out some way of validating whatever it sends back.  Initially we'd hoped to do some minimal verification on the client-side, but each time we thought of one thing we could do it is immediately invalidated with tools like Firebug.

Kind of an open question I realize, but we want to get this right before we move on with our implementation so we don't have to shoehorn in bugfixes later on.

sentences:
3D Camera control in DCC I'm trying to build a simple world editor and I would like to implement a camera similar to what's used in 3ds Max, Maya or even Unity.

From what I can figure out from Unity, the panning behavior seems to be relatively simple : the camera is moving on the plane defined by the camera position and direction. However, rotation is more complex. Most of the time, the camera is looking at a fixed point on the xz plane and rotating around it. I'm not entirely sure how this point is determined and this is what I'm trying to find out. Also, I've noticed that, after a certain height, the camera fall back to a rotation-only control.

Does anybody implemented something similar to this?

sentences:
HLSL: using "?" operator in Technique section produces branches? I recently found that you can do this:

int AnotherShaderConstant = 0;

float4 PixShader(VSOUT input, uniform bool Direction)
{
    float4 color;
    if (Direction)
        color = GoLeft();
    else
        color = GoRight();

    return color;
}

technique First
{
    PixelShader = compile ps_3_0 PixShader(AnotherShaderConstant == 1 ? true: false);
}

And it will work properly, meaning that you can change a shader constant "AnotherShaderConstant" at CPU level and the pixel shader will change it's behavior. The question is, will such move be equivalent to the following code that clearly produces a branch:

int AnotherShaderConstant = 0;

float4 PixShader(VSOUT input)
{
    float4 color;
    if (AnotherShaderConstant == 1)
        color = GoLeft();
    else
        color = GoRight();

    return color;
}

technique First
{
    PixelShader = compile ps_3_0 PixShader();
}

What I am trying to understand is will I recieve shader optimization similar to those that uniform constants provide, or will my code be bluntly submited to the GPU and executed for each pixel effectively resulting in a branch?

I mean the uber-optimized Microsoft's shaders from XNA's simple effects do the following:

int AnotherShaderConstant = 0;

float4 PixShader1(VSOUT input)
{
    float4 color;
    color = GoLeft();

    return color;
}

float4 PixShader2(VSOUT input)
{
    float4 color;
    color = GoRight();

    return color;
}

PixelShader PixelShaders[2] =
{
    compile ps_3_0 PixShader1();
    compile ps_3_0 PixShader2();
}

technique First
{
    PixelShader = PixelShaders[AnotherShaderConstant];
}

Which means that their shader compiler can react to changes in shader constants, will it react in such situation?

sentences: Why do most 2D platformers start off in the left and progress in the right direction? In almost all 2D platformers I've played, your avatar always starts off on the left side of the world, and continues on to the right. Is there something designers gain by doing this?

sentences:
Game Loop, Deltas. What is wrong? For my Android app this is the gameloop:

public void run(){
    while(true){
        if(frames == 0)
            cTime = System.currentTimeMillis();

        if(System.currentTimeMillis() >= lastUpdate + 5){
            if(gameState == PLAYING)
                updatePhisic();

            updateSprites();
            this.postInvalidate();
            lastUpdate = System.currentTimeMillis();
        }

        /*try{
            Thread.sleep(sleeptime);
        }catch(InterruptedException e){}*/

        if(System.currentTimeMillis() >= cTime + 1000){
            frameRate = frames;
            frames = 0;
        }
        else
            frames++;
    }
}

Please consider this should work for multiple devices.

Testing in some devices:

My phone: 180 FPS
A Smaller phone: 200 FPS
A Tablet: 120 FPS

I'm trying to put it at 60 FPS but the player moves so slow, I don't know how to calculate the Delta for player. I mean that at 180 FPS in my phone works fine, that is the speed that I want. But at 120 FPS in a tablet freezes a bit.

I think that painting the screen 60 times in a second would be enough.

And this freezes sometimes:

if(System.currentTimeMillis() >= lastUpdate + 5)

This does not:

try{
    Thread.sleep(sleeptime);
}catch(InterruptedException e){}

Why?

sentences:
Creating force shields: the most efficient way of deforming/reshaping a simpler convex mesh so it envelopes a complex mesh? So, the best way I can think of how to explain what I need is the following (images used here are just random images found trough google image search).

What I am trying to create during run-time is pretty much the same as a force shield that envelopes a robot or a space ship in many different futuristic types of games.

However, considering that these robots or ships have a shape that is unknown in advance, I don't want to just use a sphere-mesh around the ship or just assign a shield-shader directly to the ship mesh like in the pictures below:

I want to end up with a shield that is formed by a mesh that loosely represents the shape of the ship. Something like what can be seen in the pictures below:

However, I don't need those shields to be concave like in that pictures. It can be a convex mesh.

So far, what I've tried was to generate a sphere or a cylinder around the complex mesh (robot/ship), loop trough each vertex and try to approximate to the complex mesh. However, that is severely inefficient and gives non-smooth results.

Would you happen to have any idea, code sample, tutorial links, article references or anything on how can I proceed to get what I want in an efficient manner? The shields do not have to very detailed in terms of polygons. In fact, the less the better.

I am currently using C#, but I can handle C++ as well. Thanks in advance.

sentences:
Drawing a one pixel wide line in 3D space I'd like to draw a line in 3D space that is always exactly one pixel wide on screen, no matter how far away from the camera it is. (And the same for single points too).

Any hints on how I could do that?

sentences:
Looking for collision detection algorithms for broad and narrow phases between non-convex polyhedrons I have some experiences on particle system simulation (namely DEM - Discrete element method), in which an individual particle with realistic shape (convex and non-convex) is approximated by gluing 3D spheres together (non-overlapping or overlapping), and act like rigid body. The collision detection is performed by the simplest sphere-sphere contact.

Nevertheless, for particle shape representing by polyhedrons, almost all the collision detection algorithms for broad and narrow phases are based on convex polyhedron (e.g. GJK). For non-convex/concave shapes, convex decomposition is required to divide the concave object into many convex components (e.g. V-HACD).

At this point, I really want to know the details on:

  1) how to store the concave objects via many convex components into memory (like BSP tree?);

  2) collision detection and contact forces calculation between
  convex-concave, concave-concave objects.

I have searched quite a few relevant books like "Real-time collision detection" and "3D game engine design", etc,  unfortunately I haven't find any details on this topic yet. Could some veteran game developers give some advice or insight on how to implement collision between concave objects?

Cheers,

David

Update 1:

Seems the physics engines likes Bullet3 and reactPhysics3D are able to simulate collision of non-convex objects. Can someone give some rough idea on how to do this? before I dig into the source codes, since i have only some academic experiences on molecular dynamics / DEM simulations mainly based on 3D spheres.

sentences:
Relative Transformations for Bones I'm using Blender to export my armatures in relative coordinates, and I'm trying to get to absolute coordinates in my engine. For the above example, the childBone's tip is an offset of [-1,0,0], which is relative to the forward direction of the rootBone, not the global X axis. I understand how matrix multiplication works, but I can't quite seem to get there. Could someone break down the exact steps needed to calculate the absolute coordinates? Here's my attempt:

Vector3f rootRoot = new Vector3f(1,1,0);
Vector3f rootTip = new Vector3f(2,1,0);
Vector3f rootTipOffset = Vector3f.sub(rootTip, rootRoot);
float rootLength = rootTipOffset.length();
Quaternion rootRotation = new Quaternion(new Matrix4f().initRotation(rootTipOffset, Vector3f.Y_AXIS));
Matrix4f rootBindPose = new Matrix4f().initTranslation(rootRoot).mult(rootRotation.toRotationMatrix());
//Matrix for the root of the root bone

Matrix4f childOffset = new Matrix4f().initTranslation(rootTipOffset).mult(rootBindPose);

Vector3f childRoot = new Vector3f(0,0,0); //2,1,0
Vector3f childTip = new Vector3f(-1,0,0); //2,2,0
Vector3f childTipOffset = Vector3f.sub(childTip, childRoot);
float childLength = childTipOffset.length();
Quaternion childRotation = new Quaternion(new Matrix4f().initRotation(childTipOffset, childOffset.getRotation().getUp()));
Matrix4f childBindPose = childOffset.mult(new Matrix4f().initTranslation(childRoot).mult(childRotation.toRotationMatrix()));
Matrix4f testMatrix = new Matrix4f().initTranslation(new Vector3f(0,0,childLength)).mult(childOffset);
System.out.println(testMatrix.getTranslation()); //Prints [2, 1, 1]

sentences: Whats the best cross-platform game engine that supports Linux? What is the best cross-platform game engine, being the most commercially supported, there is for free available for development on Linux? I'm planning on creating multiple, non-commercial, fps games to gain real industry experience in C++ game development.

sentences:
Unity / Box2D / Raycasting and Performance Im currently using the Unity Engine and the Box2D Physics Engine.

I have this line of code:

    "RaycastHit2D ray = Physics2D.Raycast(origin, direction, distance);"

Im planning to use this line of code ... like "a lot" times (maybe like 100.000 times per frame)

And I have 3 simple Questions about Raycasting and Performance:

How much does 1 Raycast cost (approximately).
Is the Raycast processed by the CPU now or by the GPU?
Does the number of the BoxColliders affect the cost of the Raycast? (for example:
If I have 1000.000 Tiles on the map which have box Colliders, does one ray has the same performance cost as if i would have 1 single Tile?
And if I have 1000.000 tiles - is the cost millionfold then?

sentences:
Resolving Circle-Circle collision If you have a stationary circle with radius x, and a moving circle with radius y, when a collision is detected, how can you resolve the collision, such that the moving circle stop?

I.e. What would be the 'resolved' position of the moving circle?

sentences:
In a 2d tile based game, what is a good method for scrolling? I am using Direct3D with the D3DXSPRITE wrapper to draw the tiles to the screen. I have a tile class which contains members such as collision and tile type, then i have an array of tiles e.g.

Tile grid[256][256];

Which would be a better method?

-Draw the player in the center of the screen and offset where the map draws.

-Move the player with the camera following.

I was using the first method, but its getting really complicated when you get to the top left edge of the map, and when other players/enemies are on the map and moving at the same time

if i make the camera follow the player, would i have to call spriteBatch->Draw(...) for every single grid tile even though only a few can fit on the screen?

sentences:
ArmA 3 Scripting: Delete vehicle depending on present players I'm fairly new to ArmA 3 scripting, and I'd like to know how to only spawn starting vehicles depending on how many players opt in to the mission. Say, the mission has four slots, but only two people fill them. There would be four vehicles, but two would be deleted on the mission start because those players weren't present. I've tried putting this code in the initialization of each vehicle;

sleep 1; if (isNull unit1) then {deleteVehicle this} else {};

But it only gives me errors when the mission starts.

sentences: Asking the user to place the joystick in the center while calibrating I would like to know why exactly calibration programs (usually?) ask the user to place the joystick in middle, that is: Why isn't moving the handle in a complete circle (usually?) enough to calibrate a joystick?

sentences:
Midpoint Displacement Algorithm This question has come mainly out of sheer desperation, after spending several hours trying to figure out the problem.

If you cast your eyes to the picture above, you should see that my midpoint displacement algorithm algorithm is working (somewhat) successfully; in producing a somewhat coherent noise pattern.

However, it is leaving behind a black dotted grid on the image, and I have no idea why. I can foresee this being an issue in the math, but I just cannot see it; nor was this pointed out in any online resources as a possible issue; so any help will be appreciated as to hunting down this bug.

unsigned char** mdp(unsigned char** base, unsigned base_n, unsigned char r) {
    size_t n = (2 * base_n) - 1;

    unsigned char** map = new unsigned char*[n];
    for (unsigned i = 0; i < n; ++i) map[i] = new unsigned char[n];

    // Resize
    // 1 0 1
    // 0 0 0
    // 1 0 1
    for (size_t i = 0; i < n; i += 2) {
        for (size_t j = !(i % 2 == 0); j < n; j += 2) {
            map[i][j] = base[i / 2][j / 2];
        }
    }

    // Diamond algorithm
    // 0 0 0
    // 0 X 0
    // 0 0 0
    for (size_t i = 1; i < n; i += 2) {
        for (size_t j = 1; j < n; j += 2) {
            unsigned char& map_ij = map[i][j];

            unsigned char a = map[i - 1][j - 1];
            unsigned char b = map[i - 1][j + 1];
            unsigned char c = map[i + 1][j - 1];
            unsigned char d = map[i + 1][j + 1];
            map_ij = (a + b + c + d) / 4;

            unsigned char rv = std::rand() % r;
            if (map_ij + r < 255) map_ij += rv; // EDIT: <-- thanks! the bug! `map_ij + rv`, not `r`
            else map_ij = 255;
        }
    }

    // Square algorithm
    // 0 1 0
    // 1 0 1
    // 0 1 0
    for (size_t i = 0; i < n; ++i) {
        for (size_t j = (i % 2 == 0); j < n; j += 2) {
            unsigned char& map_ij = map[i][j];

            // get surrounding values
            unsigned char a = 0, b = a, c = a, d = a;
            if (i != 0) a = map[i - 1][j];
            if (j != 0) b = map[i][j - 1];
            if (j + 1 != n) c = map[i][j + 1];
            if (i + 1 != n) d = map[i + 1][j];

            // average calculation
            if (i == 0) map_ij = (b + c + d) / 3;
            else if (j == 0) map_ij = (a + c + d) / 3;
            else if (j + 1 == n) map_ij = (a + b + d) / 3;
            else if (i + 1 == n) map_ij = (a + b + c) / 3;
            else map_ij = (a + b + c + d) / 4;

            unsigned char rv = std::rand() % r;
            if (map_ij + r < 255) map_ij += rv;
            else map_ij = 255;
        }

    }

    return map;
}

If you have any tips or resources other than http://www.gameprogrammer.com/fractal.html and http://www.lighthouse3d.com/opengl/terrain/index.php?mpd2 for fractal based terrain generation, I would appreciate them as comments also.

Edit:

This is the new image, as per Fabians suggestion (ty), however it still has some strange quirks, which you should be able to see straight away (small 'dimples' everywhere).

What could be causing this strange behavior? Updated source code: http://www.pastie.org/1924223

Edit:

Many thanks to Fabian in finding the bounds check error, for those interested, here is the current solution as 512x512 png. And current source code (modified by Fabian).

Edit (years later):
Python version https://gist.github.com/dcousens/5573724#file-mdp-py

sentences:
What is the most efficient way to add and remove Slick2D sprites? I'm making a game in Java with Slick2D and I want to create planes which shoots:

int maxBullets = 40;
static int bullet = 0;
Missile missile[] = new Missile[maxBullets];

I want to create/move my missiles in the most efficient way, I would appreciate your advise:

public void shoot() throws SlickException{
    if(bullet<maxBullets){
        if(missile[bullet] != null){
            missile[bullet].resetLocation(plane.getCenterX(), plane.getCenterY(), plane.image.getRotation());
        }else{
            missile[bullet] =
            new Missile("resources/missile.png", plane.getCenterX(), plane.getCenterY(), plane.image.getRotation());
        }
    }else{
        bullet = 0;
        missile[bullet].resetLocation(plane.getCenterX(), plane.getCenterY(), plane.image.getRotation());
    }
    bullet++;
}

I created the method resetLocation in my Missile class in order to avoid loading again the resource. Is it correct?

In the update method I've got this to move all the missiles:

if(bullet > 0 && bullet < maxBullets){
    float hyp = 0.4f * delta;
    if(bullet == 1){
        missile[0].move(hyp);
    }else{
        for(int x = 0; x<bullet; x++){
            missile[x].move(hyp);
        }
    }
}

sentences:
Is game development Subcontracted? I was having a conversation with someone who believed that components of a games code where subcontracted out to programmers in different countries where it would be cheaper, then assembled by the local company.
I understand that people often use pre-built engines but I would think that making the actual game would require people to work closely in the same studio.

I couldn't find much clear information on this when I looked, does anyone know?

sentences:
Assigning function to button in foreach loop causes all buttons to have the same argument value I have a script that generates buttons based on a list of assets. Each button is intended to to add the asset's resource path to a variable called SpawnGlobals.CurrentSelection. When printing the asset resource name of all button within the loop, the different resoruce paths are shown. When printing the value in the select function, the value is always the last item in the asset_register list.

I do not understand why this is happening. Am I using the foreach loop or lambda incorrectly?

void Start () {

    //Add Foundry Assets Here:
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Test Sphere", "sphere_obj"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 01", "BuildingBlock10x10x10_01"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 02", "BuildingBlock10x10x10_02"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 03", "BuildingBlock10x10x10_03"));
    foreach (FoundryAsset asset in SpawnGlobals.asset_register) {
        SpawnGlobals.buttons.Add(Instantiate(button_prefab));
        GameObject current_button = SpawnGlobals.buttons.Last ();
        current_button.transform.SetParent(master.transform, false);

        current_button.GetComponentInChildren<Text>().text = asset.AssetName;

        print (asset.AssetName);
        current_button.GetComponentInChildren<Button>().onClick.AddListener (delegate {
            select(asset.ResourcePath);
        });

    }

}
public void select(string selected)
{
    print (selected);
    SpawnGlobals.CurrentSelection = selected;
}

sentences:
Ambient occlusion: Correct culling after anisotropy correction I've added simple color based ambient occlusion to my game.

First it looked like this (from giawa.com):

The description: "Due to anisotropy, the ambient occlusion shading on the top left is inconsistent with the top right. We need to flip those quads so that they get rendered properly."

So according to that I had to flip some faces in order to fix the issue. I did and then it would look like this:

This is of course because of back face culling, culling the flipped faces.

When I disable culling, it looks like this:

Which is how it's supposed to look. But as you can imagine, that costs a lot of performance because culling is now disabled.

According to the article: http://www.giawa.com/author/giawa/page/10/
"This occurs due to differences in how the GPU linear interpolates across the edge of a triangle versus the body of a triangle. This is called anisotropy, and can be fixed by ‘flipping’ the quad. My final fix was to enable polygon culling, which meant I had to make sure to render my quads in a consistent winding. "

I've searched for this "polygon culling" but could not find anything about that.

I can't just switch between culling modes because all the vertexes are added to a vertex buffer when initializing a chunk. This is so I can render each chunk in one draw call.

I hope anyone knows a way to fix this, thanks in advance.

sentences:
Advantages And Disadvantages Of Resource Serialization A good example is let's say I'm making a pong game. I have a PNG image for the ball and another PNG image for the paddles. Now which would be better, loading the PNG images with a PNG loader, or loading them in a separate program, serializing it, and de-serializing it in the game itself for use?

The reason why this may be good to know is because it seems like game companies (or anyone in the long run) build all of their resources into some sort of file. For example, in the game Fallout: New Vegas the DLCs are loaded as a .ESM file, which includes everything it needs, all the game does is find it, serialize it, and it has the resources. Games like Penumbra: Black Plague take a different approch and add a folder which contains all the textures, sounds, scrips, ect that it needs, but not serialized (it does this with the game itself, and the DLC).

Which is the better approch and why?

sentences:
How to stop a signal from being sent Currently i have three buttons that can be toggled with only one being active at once. When one button is selected by the player it sends a signal to the other two buttons to toggle off. Before the recent Godot update this set up worked fine, but now when the player toggeles a button on, the button thats being turned off now sends its toggeled signal thus turning off the very button the player clicked.

So im looking for a way to block a signal in code to prevent this loop.

Code for reference:

Player button:

func _on_Ally1_Button_toggled(button_pressed,check):
    print("on ally1 toggeled P")
    self.set_pressed(false)

func _on_Ally2_Button_toggled(button_pressed,check):
    print("on ally2 toggeled P")
    self.set_pressed(false)

Ally1 Button:

 func _on_Player_Button_toggled(button_pressed,check):
    print("on player toggeled A1")
    self.set_pressed(false)

 func _on_Ally2_Button_toggled(button_pressed,check):
    print("on ally2 toggeled A1")
    self.set_pressed(false)

Ally2 Button:

 func _on_Player_Button_toggled(button_pressed,check):
    print("on player toggeled A2")
    self.set_pressed(false)

func _on_Ally1_Button_toggled(button_pressed,check):
    print("on ally1 toggeled A2")
    print(check)
    self.set_pressed(false)

The check varible being passed in is how i plan stop the loop i just need a way stop signal.

Thank you in advance for the help.

sentences:
Algorithm to determine all hexagons within an arc from a starting hexagon I have a game engine which handles hexagon based war games and things like LOS, etc, for both flat and tip up hexes. A particular game I'm implementing at the moment, Band of Brothers, has facing for vehicles and, optionally, for infantry.

I've searched the web and have not found any algorithm to handle determining the hexagons that fall within an arc expanding out from a hexagon. Here are some pictures to describe what I'm talking about:

I represent the hexagon locations as offset coordinates, and have the values for all the dimensions of each hexagon and the endpoints of the vertices and center in relation to the overall map stored as doubles. I also convert to cube coordinates for determining distance.

Just looking for ideas or pointers on how I might determine these hexagons.

EDIT: I do not have a rep > 10 so I can't add a picture of offset coordinates. There is a good one here on gamedev though. Here's an ASCII art representation of it. The numbers will be a little different depending on which row is indented:

0,0   1,0   2,0   3,0   4,0
   0,1   1.1   2.1   3.1
0,2   1,2   2,2   3,2   4,2

sentences:
Ray tracing - texture and phong lighting Other questione releated to my ray tracer implementation for iPad.

If I have a polygon that has a texture and a material, how do I calculate the color using Phong lighting model? Is the texture used in substitution of some of the component (diffuse?)? Or if there's a texture I need to just ignore the material and get only the texture color?

sentences:
Why are my target-following objects rotated the wrong way? I writing a script that would make my players reach a target destination. It looks like this so far:

private void MoveTowardsGoal() {
    if (Vector3.Distance (reachGoalTarget.transform.position, transform.position) > 2.0f) {
        rDirection = (reachGoalTarget.transform.position - transform.position).normalized;
        if (rAcceleration < rMaxSpeed) {
            rAcceleration += 0.5f;
        }
        rVelocity = rDirection * Time.deltaTime * rAcceleration;
        transform.Translate (rVelocity,Space.World);
    }
}

It works fine: The objects move towards the destination point. However, I want them to move looking at the target in the forward direction (forward z axis). Currently they move with their x axis facing front.

I tried a simple rotation inside Start() like transform.LookAt(reachGoalTarget.transform). With this, they look in the forward direction but then they completely move off their initial positions by rotating themselves to reach the goal.

What am I doing wrong?

sentences: In-App Billing Library for Android Game I'm trying to add in-app purchases into my Android game and it having some trouble figuring my around the Google Play Billing. Can anyone refer me to a good open source reference for how to do that?

sentences:
How does a game like Minecraft handle block and entity updates? I am not asking how Minecraft loads chunks or generates chunks, I am asking about individual blocks and entities and their behaviours.

Suppose you have a dirt block: dirt block can be converted to a grass block if there is a grass nearby. The game can have thousands of dirt blocks loaded at the same time, each checking if there is grass nearby.

Now add some monster spawners which have to spawn monsters periodically and keep track of how many monsters it spawned.

Then there is your large field of wheat, potatoes, carrots and saplings which the game also has to check and update every so often.

Then you have your furnaces that smelt your ores.

Then add into the mix all of the animals, monsters, villagers and their behaviours and pathfinding.

All of these actions are happening simultaneously and the game somehow keeps running smoothly on a decent computer.

How do the games generally handle this many block updates and entity behaviours? Does the game keep a list/collection of all the "updateable" blocks and just iterates every so often through that list and simply calls the ".update()" method? How are games with many updateable blocks/entities structured? Updating in a separate thread?

There are so many questions... Any clue is appreciated. Thank you.

sentences:
WebGL game won't go into fullscreen mode on iOS devices I have built my game and hosted it on itch.io. it works well on PC browsers and on the mobile Android browser.
The problem appears when I try to launch it on an iOS phone: the game won't go into full screen (it's supposed to go into it automatically). I added a button that's supposed to switch to full screen but it doesn't respond (the button does work on PC and Android though).

sentences:
Limiting Framerate and Input So I have been learning HTML5 canvas recently and ran into a bit of a snag. I created a proof of concept that builds a block based 2d map that you can move a character inside of using arrow keys. This works well because everything is free moving (character moves 1 pixel per frame, so the movement is fluid and looks good).

I am trying to fork off of this code to create another concept that forces grid based movement (like in a typical roguelike). I have updated my movement code to move in chunks equal to tile size.. but the issue is that the refresh rate is so fast that it just seems like the character is moving at super speed.

Here is a snippet of my code that handles animations:

function gameLoop() {
        ctx.clearRect(player.x,player.y,PLAYER_SIZE,PLAYER_SIZE);
        getInput();
        ctx.fillStyle = '#000000';
        player.draw(ctx);
        window.requestAnimationFrame(gameLoop);
}

Is using requestAnimationFrame() for this sort of movement not a good idea? Is it better to just setInterval() for this sort of thing? I found a article via Google that talks about using variables for time, delta, fps, etc to limit the framerate... but Im not sure I understand how to do that in conjunction with requestAnimationFrame(). Should I somehow hold my gameLoop() from hitting requestAnimationFrame() until some time interval is hit? That seems like it would just be a waste because I would need to force a loop of some kind... doesnt seem too elegant

sentences:
What is the package-lock.json file for in Unity? My project contains this file:
Packages/packages-lock.json
And I'm curious about what it's for. It has a bunch of json about my packages in it, but it's not clear to me what goes in the lock file vrs the normal packages file.

sentences:
Playing Video In MonoGame I'm trying to play a video in a monogame project. I've done this in XNA in the past by including the Framework.Video directory and it's very simple. This cannot be done in monogame as Visual Studio 2012 wont accept the XNA directories.

I've not been able to find any other way explained anywhere if you can actually put video in monogame yer and if you can how it's done.

Any ideas?

sentences:
How do I manage textures in memory in OpenGL? I'm writing a game engine which is going very fine. However, I'm now posed with handling textures.

My Engine is in 2D, for simplicity reasons mostly to get a good idea of how to work with OpenGL. I do this in C++, and I have a hierarchical set-up when it comes to classes. There's a base class and some other classes derive from that.

So now I'm onto the part where I want to load up some textures and apply them to polygons. The way my engine works in drawing things is like this:

Load up a tile map file and parse it. The tile map contains all the information like events, lights, passability. All very interesting, not. Except the part where it loads a tileset, as defined by the map.
The parser realises the map uses a tileset, which is stored in resources/tilesets/dungeon_interior_cave1.xml, which contains all the information on what textures are used.
It loads the textures as said by the tileset-XML-file, it gives them an ID and then the SceneManager-class knows how to lay out the tiles and what texture to slap onto each of them. Once this is done, it tosses the instance of the SceneManager to the OpenGL renderer.

This might not be the best explanation of how my engine works, but simply put:

SceneManager loads the file resources/maps/dungeon3Interor.msf (msf being a custom map format (MSF stands for M age S cene F ile ). The MSF file refers to a tilset.
SceneManager loads the tile set at resources/tilesets/dungeon_interior_cave1.mts.
SceneManager loads up all the textures from resources/textures/< path_to_textures >
SceneManager tosses itself to the OpenGL render, and OpenGL renders the whole thing.

I think that's the best I can do at explaining. Know that the SceneManager itself contains no OpenGL code, just paths and information that OpenGL needs to know to render the scene.

What I'm interested in, what is the best practice to handle this, and how to handle OpenGL texture storage. I understand OpenGL keeps the textures in it's texture memory, and that I have to use glGenTextures to allocate a texture and that I then swap betwe--.. I actually have no clue.

What's a good way to keep track of all the textures you loaded into the memory and switch between them in C++, preferably using a class or a set of classes to accomplish this.

sentences:
How can I rotate my character so that he is facing the mouse? I just want to preface this by saying I am very new to pygame.

At the moment I have calculated the angle that I need to apply to my character so he can rotate but I am unsure how to actually make him rotate (I understand the principle of it but not how to code it). I have tried to watch videos and look at other questions on here but I have only seen lots of different solutions that I can't implement into my own code.

I want to make it so that my character faces wherever my mouse is moving.

import pygame
import math
from random import randint

pygame.init()

screen = pygame.display.set_mode((600, 600))
screen_width = 600
screen_height = 600
pygame.display.set_caption("Mousey")
char = pygame.image.load('76011.png')
background = pygame.image.load('pygameback.png')
clock = pygame.time.Clock()

class Player:
    def __init__(self, x, y, width, height):
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        self.velocity = 12.5
        self.original = pygame.image.load('76011.png')
        self.rotated = self.original
        self.rect = self.rotated.get_rect()
        self.angle = 0

    def draw(self, win):
        screen.blit(char, (self.x, self.y))

class Enemy(Player):
    def __init__(self, x, y, width, height):
        Player.__init__(self, x, y, width, height)

    def draw(self, win):
        pygame.draw.rect(win, (0, 255, 0), (jeff.x, jeff.y, jeff.width, jeff.height))

def drawWindow():
    screen.blit(background, (0, 0))
    mag.draw(screen)
    jeff.draw(screen)
    pygame.display.update()

def XOR(a, b):
    if bool(a) != bool(b):
        return True
    return False

mag = Player(300, 300, 60, 60)
jeff = Enemy(180, 180, 60, 60)
run = True
while run:
    clock.tick(40)

    keys = pygame.key.get_pressed()

    for e in pygame.event.get():
        if e.type == pygame.QUIT:
            run = False
        if e.type == pygame.MOUSEBUTTONDOWN:
            mouse_x, mouse_y = pygame.mouse.get_pos()

        if e.type == pygame.MOUSEMOTION:
            mouse_x, mouse_y = pygame.mouse.get_pos()
            rel_x, rel_y = mouse_x - mag.x, mouse_y - mag.y
            angle = math.atan2(rel_y, rel_x)

    if XOR(keys[pygame.K_a], keys[pygame.K_LEFT]) and mag.x > mag.velocity:
        mag.x -= mag.velocity
        right = False
        left = True
    elif XOR(keys[pygame.K_d], keys[pygame.K_RIGHT]) and mag.x < screen_height - mag.width - mag.velocity:
        mag.x += mag.velocity
        right = True
        left = False
    elif XOR(keys[pygame.K_w], keys[pygame.K_UP]) and mag.y > mag.velocity:
        mag.y -= mag.velocity
        right = False
        left = False
    elif XOR(keys[pygame.K_s], keys[pygame.K_DOWN]) and mag.y < screen_height - mag.height - mag.velocity:
        mag.y += mag.velocity
        right = False
        left = False

    drawWindow()

I was also confused about where I need to make the character rotate. By this I mean, do I make a method inside the class that calculates the angle and makes the character rotate OR do I do all the calculations down where they are now?

sentences:
Referencing a Text in Unity Error I am working on trying to add a coin system to my game. I have it setup right now so that when the player hits a coin the score text goes up by 1. I have setup a reference in the script, which is attached to the coin, to the score text in my scene. In the game the player can click a button that will switch between two lanes to avoid enemies. These lanes are infinte and in these lanes is where I put the coins. And when a new lane is created the reference to the text disappears from the coin and teh tect does not change. I am not sure why the reference is disappearing.

Here is the coin script that is on the coin

public int scoreToGive = 1;

public Text coinText;

void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "Player")
    {
        AddScore();
    }
}

public void AddScore()
{
    TheScore.theScore++;
    if(coinText != null)
    {
        coinText.text = TheScore.theScore.ToString();
    }

    Destroy(gameObject);
}

void Update()
{
    coinText.text = GameObject.FindGameObjectWithTag("Ui").ToString();
}

}

Thanks to anyone who can help!

sentences: GLfloat vs GLfixed vs GLint performance in 2017 Some people claim that floats should be used for rendering vertices in modern graphics cards, because graphics cards are optimized for floating-point arithmetic and therefore, integer calculations are often emulated. I would think that most graphics cards have ALUs, and therefore, an efficient way to process integer vertices. So, are floats actually faster than integers on modern graphics cards?

sentences:
How are Volumetric Effects made within games? (e.g. Smoke/Fire) For computer generated volumetric elements such as clouds, fire, and whitewater.

How are they made? Is it just a simple collection of particles [put to pixels] taken from Physics equations or are the like textures?

How are they applied? I would assume not from UV mapping

Derbis, smoke and fire come from the vehicle.

sentences:
How can i change door close/open speed in animator, and how to tell player if the door is close wait/idle until the door will open? In the Animator window of the door i have two states: Door Open and Door Close.
And two parameters type of trigger: open and close.

In the two states Door Open and Door Close between them there are two transitions.
I didn't make any Has Exit Time but i did add in both transitions the triggers as conditions. On the Door Open to Door Close i added the close condition and on the Door Close to Door Open the open condition.

And the script that attached to the door:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]
public class DoorActivatorMecanim : MonoBehaviour
{
    private Animator DoorAnimator;

    void Start()
    {
        DoorAnimator = GetComponent<Animator> ();
    }

    void OnTriggerEnter(Collider col)
    {
        DoorAnimator.SetTrigger("open");
    }

    private void OnTriggerExit(Collider other)
    {
        DoorAnimator.SetTrigger("close");
    }
}

The door have a box collider component.

Now when the player is moving to the door when he get inside the box collider area the OnTriggerEnter is on and the door is open and stay opened until the player is moving out of the box collider area then it's getting to the OnTriggerExit and the door is close.

What i want to do is to control the door open/close speed. When the door open it open in medium speed but when the door is close it's shutting down closing at once very fast like the door is falling and not closing animation.

So i want to add another parameter in the Animator maybe type float and call it speed and somehow to control the close/open speed from the script.
So i added the speed float parameter but not sure how to use it in the script and control the close/open door speed:

And the second problem is if for example the player is running to the door and door open speed is slower then the player speed i want somehow to tell the player that the door is still close so idle until the door is opened when the door is opened then change from idle to walk/run again. But i'm not sure how to detect when the door is close/open and then how to tell it to the player.

Update the script with the speed parameter setting:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]
public class DoorActivatorMecanim : MonoBehaviour
{
    public float doorActivateSpeed = 1f;

    private Animator DoorAnimator;

    void Start()
    {
        DoorAnimator = GetComponent<Animator> ();
    }

    void OnTriggerEnter(Collider col)
    {
        DoorAnimator.SetFloat("speed", doorActivateSpeed);
        DoorAnimator.Play("Door Open");
    }

    private void OnTriggerExit(Collider other)
    {
        DoorAnimator.Play("Door Close");
    }
}

For some reason and i can't explain yet why the speed parameter is working only on the door open making it open slow but the door close is still very fast too fast the door is like falling/shutting down. And both open door and close door states and animation settings are the same in the editor.

Can't figure it out.

sentences:
Yaw Pitch and Roll question Yaw is the object turning as if it is spinning on a lazy suzan (one of those spinning plate things you get in chinese restaurants), pitch is pointing the nose up or down, and roll is as if the object is doing a barrel roll.

My question is, do these directly relate to the x, y and z axes? as in, is yaw x, pitch y and roll z? Because If I orient a 3D plane forward using the direct x coordinate system (where z is forward, x is right and y is up) yaw pitch and roll would correspond to the y, x and z axes respectively.

Are they always defined by the axes or are they coordinate system specific?

sentences:
Fixing the frame rate for SDL2 2D game Working on a 2D game with SDL2, for now on Window, but I'd like to dream and imagine that if I finish it, I could run it on other platforms that SDL2 games can target. A core part of which is GGPO based lockstep netplay. So, I want to fix my framerate (to 60fps).
On Windows, should I use VSync, but then somehow override/ignore it if the refresh rate of the monitor is not 60Hz? Or not use Vsync at all, and handle the fixed frame rate manually in all cases?
It seems in this case, various platform specific hoops need to be jumped through, as SDL_Delay (= Windows Sleep()) is nowhere near accurate enough. Seems I would need to dive out of platform independnce a bit to handle this?

sentences:
Push or Pull Input Data In the Game Logic? In the process of preparing my game for networking I'm adding a layer of seperation between the physical input (mouse/keyboard) and the actual game "engine"/logic. All input that has any relation to the game logic is wrapped inside action objects such as BuildBuildingAction.

I was thinking of having an action processing layer that would determine what to do with the input. This layer could then be set up to either just pass the actions locally to the game engine or send it via sockets to the network server depending on whether the game was single- or multiplayer.

In network games it would make sense that the player's actions should be sent to the server, but should the game logic be pulling (polling?) the data through some sort of interface or should the action processing layer be adding the actions to an input queue in the game logic code?

sentences:
Sorting cube depth correctly with an isometric engine Possible Duplicate:
  How should I sort images in an isometric game so that they appear in the correct order?

I'm starting work on a simple isometric engine. Everything thing is going great at the moment, but I think I've hit an issue everyone hits. I'm having difficulty getting sorting the depth of a cube.

This image shows the default view (character not near a cube)

This image shows the character behind a cube

The issue is here, when the character goes in front of the cube.

Is there a common solution to this? How would i go about it? Would i need to give a depth to EVERY cube, then somehow work out the current tile the character is on then apply the depth to him? I'm using game maker on a mac and I'm happy to upload the project somewhere if you need to check it out.

Thanks for any input.

sentences:
Simple Water surface simulation problems (GDC2008 Matthias Muller- Hello World) Im attempting to implement a simple height field water surface simulation outlined in Matthias Muller's GDC 2008 talk. "http://www.matthiasmueller.info/talks/gdc2008.pdf"

I can't seem to see why it my implementation doesnt work. Could anyone help? Any advice or help would be much appreciated.
The main processing loop is below
The obstruction array is initialized as 1. And the source just adds 0.1f to a point.

void wave()
    {
        for( int i = 0; i<size ; i++)
        {
            height[i] += source[i];
            height[i] *= obstruction[i];
        }

        for (int i = 1 ; i<iwidth-1 ; i++)
        {
            for(int j = 1 ; j < iheight-1 ; j++)
            {

                velocityField[indexFind(i,j)] += (height[indexFind(i-1,j)] +
                                                  height[indexFind(i+1,j)] +
                                                  height[indexFind(i,j-1)] +
                                                  height[indexFind(i,j+1)])/4 - height[indexFind(i,j)];

                velocityField[indexFind(i,j)] *= dampening;

                height[indexFind(i,j)] += velocityField[indexFind(i,j)];

            }

        }
    }

    int indexFind(int x, int y)
    {
        return (x + iwidth*y);
    }

This is what happens (height field rendered as a texture on a plane)

This is the page from the link that outlines the algorithm

sentences:
Application.OpenURL in Unity works in inspector (PC) but not in Android I'm using unity and I've got some simple code that should work but doesn't for some reason and I'm stuck. Basically I am just trying to open up a website through a button click "On Click ()" in an application meant for android but it does not work. The code goes as follows.

public string url;

public void Website()
{
    Application.OpenURL(url);
}

public void Website2(string diffURL)
{
    Application.OpenURL(diffURL);
}

public void Website3()
{
    Application.OpenURL("http://www.google.com/");
}

As you can see I have three different variations of the same "Application.OpenURL" testing on three different buttons and all three do not work. Some more information:

I have paid close attention to format the websites properly with
quotation marks and "http://"
I have already set the "Internet Access" to "require" in the player
settings,
and interestingly enough, they work in the game window when testing,
it is only when I upload the apk to my android device that it does
not work anymore
.

The buttons register I am pressing them as evident by the slight darkening of the button press when I press on my android device but nothing happens. I have seen this question asked around but no solution to my issue has been found. Are any other build settings wrong? Any other thing I should change in Unity? API level or what?(currently 19 on min and highest installed on target)

Is there some settings I should change on my android device to allow this to happen? Because as stated earlier it works when testing through the game window on unity but not on android.

(The function "Website3()" begun to work when I rebuilt the app. No changes were made. "Website1()" and "Website2()" however still do not work on android and they work perfectly fine on unity game window.)

sentences:
I am working on an Quiz game i am trying to get user input from the player in ters of button by adding listeners but i get no touch input when i make click on gameplay, i have added onClick().Here is the code......................
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Level2UI : MonoBehaviour
{
    private List<string> sceneHistory = new List<string>();
    [SerializeField] private Level2Manager gameManager;
   [SerializeField] private TextMeshProUGUI questionText;
   [SerializeField] private List<Button> options;
   [SerializeField] private Color CorrColor, WrongColor, NormalColor;
    private Question question;
    private bool answered;

    // Start is called before the first frame update

    void Awake()
    {
        for(int i = 0; i < options.Count; i++)
        {
            Button localBtn = options[i];
            options[i].GetComponentInChildren<Button>().onClick.AddListener(delegate { ClickedAnswer(localBtn); });
            //   localBtn.onClick.AddListener(delegate { ClickedAnswer(localBtn); });
            Debug.Log("testclick");
      //      btn.onClick.AddListener(ClickedAnswer);

        }
    }
    public void SetQuestion(Question question)
    {
        this.question = question;
        questionText.text = question.questionInfo;

        List<string> answerList = ShuffleList.ShuffleListItems<string>(question.options);
        for(int i=0; i< options.Count; i++)
        {
            options[i].GetComponentInChildren<TextMeshProUGUI>().text = answerList[i];
            Debug.Log("check");
            options[i].name = answerList[i];
            options[i].image.color = NormalColor;
        }
        answered = false;
   //     setButton();
    }

    public void ClickedAnswer(Button btn)
    {

        print("txt");
        if (!answered)
        {
            answered = true;
            bool val = gameManager.Answer(btn.name);

            if (val)
            {
                btn.image.color = CorrColor;
                Debug.Log("test1");
            }
            else
            {
                btn.image.color = WrongColor;
                Debug.Log("test");
            }
        }
    }
    //Call this whenever you want to load a new scene
    //It will add the new scene to the sceneHistory listss
    public void LoadScene(string newScene)
    {
        sceneHistory.Add(newScene);
        SceneManager.LoadScene(newScene);
    }

    //Call this whenever you want to load the previous scene
    //It will remove the current scene from the history and then load the new last scene in the history
    //It will return false if we have not moved between scenes enough to have stored a previous scene in the history
    public bool PreviousScene()
    {
        bool returnValue = false;
        if (sceneHistory.Count >= 2)  //Checking that we have actually switched scenes enough to go back to a previous scene
        {
            returnValue = true;
            sceneHistory.RemoveAt(sceneHistory.Count - 1);
            SceneManager.LoadScene(sceneHistory[sceneHistory.Count - 1]);
        }

        return returnValue;
    }
}

sentences:
ScreenToWorldPoint: How much depth has to be added to screen point? I am developing a 3rd Person Controller.
The hero's chest should be rotated towards a point on the screen.
To determine the point, I use the following code:
var mousePos = Input.mousePosition;
mousePos.z = 10; // Make sure to add some "depth" to the screen point

var aim = Camera.main.ScreenToWorldPoint(mousePos);

Then I rotate the chest like this:
Vector3 v = new Vector3(0, aim.x, 0);
Chest.Rotate(v);

It does work, but it rotates only minimally, and the the direction is inverted:  If the mouse is on the right of the screen, the chest rotates to the left and vice versa.
Also, I'm not sure how to include the model's overall rotation (but I don't know yet if that is necessary).
Does anybody have any idea what I'm doing wrong?
Edit:
When I add more depth to it, it rotates much more:
var mousePos = Input.mousePosition;
mousePos.z = 100; // Make sure to add some "depth" to the screen point

var aim = Camera.main.ScreenToWorldPoint(mousePos);

But I have no idea how much depth is actually needed.
If I add 1000, it rotates like crazy.
So I would like to know how to calculate the amount of depth that should actually be added to the screen point.

sentences: How to use grammars for procedural generation? I am working on a system to procedural generate a house using this article. I am trying to understand how grammars work and are made I have found very little information on the topic online. From my understanding a grammar is like a rule and you can for example recursively iterate through a model and add a part to it based on that rule then repeat that process for each rule. Is this the right idea? If not can you provide a explanation or some resources explaining it? Also can grammars be made simply by using a few if statements to determine where something should be or is there something more special about them? I saw a video explaining how they use grammars to make compilers and parse the code. It looked like they were using a custom format to define the grammars. Is this something related and also is this the same type of grammar? If so what is the purpose of using a grammar in my case of procedural generating a house they seam like they are unrelated for generating the placement of rooms?

sentences:
Why doesn't Unity's OnCollisionEnter give me surface normals, and what's the most reliable way to get them? Unity's on collision event gives you a Collision object that gives you some information about the collision that happened (including a list of ContactPoints with hit normals).

But what you don't get is surface normals for the collider that you hit. Here's a screenshot to illustrate. The red line is from ContactPoint.normal and the blue line is from RaycastHit.normal.

Is this an instance of Unity hiding information to provide a simplified API? Or do standard 3D realtime collision detection techniques just not collect this information?

And for the second part of the question, what's a surefire and relatively efficient way to get a surface normal for a collision?

I know that raycasting gives you surface normals, but it seems I need to do several raycasts to accomplish this for all scenarios (maybe a contact point/normal combination misses the collider on the first cast, or maybe you need to do some average of all the contact points' normals to get the best result).

My current method:

Back up the Collision.contacts[0].point along its hit normal
Raycast down the negated hit normal for float.MaxValue, on Collision.collider
If that fails, repeat steps 1 and 2 with the non-negated normal
If that fails, try steps 1 to 3 with Collision.contacts[1]
Repeat 4 until successful or until all contact points exhausted.
Give up, return Vector3.zero.

This seems to catch everything, but all those raycasts make me queasy, and I'm not sure how to test that this works for enough cases. Is there a better way?

EDIT
If this really is just the way things are with 3D collision, an overview of why in the general case would be just as welcome as something specific to Unity.

sentences:
How do you draw a random irregular polygon in java? (Asteroids) I am coding an Asteroids game in Java. In the real arcade game, asteroids are made of irregular shapes like this:

When I code, I can only set asteroids to 1 or another specific shape, like this:

I want to make all of the asteroids in my game of totally randomly generated shapes, and I am already tired of designing specific shapes of my own. Here is a snippet of my code that generates the asteroid's shape. P.S: The image does not show it, but I am using the Polygon class and constructor which only enables me to input 2 int[]s and a number of sides.

   public void makeShape() {
    int x = (int) this.x;
    int y = (int) this.y;
    this.shape = new Polygon(new int[]{x - 15, x - 30, x - 10, x - 13, x,x + 10, x + 10}, new int[]{y - 30, y - 15, y + 5, y + 30, y + 35, y + 30, y}, 7);
}

I have tried putting all of the variables on Math.random(), but it outputs nothing but a scribble, even if I were using the Polygon class.

sentences: Procedurally generate with different sized cubes I am trying to procedurally generate my world like in Minecraft with tons of blocks. I have watched lots of videos about this but they all use a single fixed size cube. I would like to achieve the same as in Minecraft but with different sized cubed for example. How could this be done? I am using Perlin Noise for generation.

sentences:
Can I make global illumination from directional lights only affect their assigned layers? I have a large space station scene, where there are giant mirrors that are sources of reflected light, and to emulate this, I made directional lights attached to the mirrors with cookies to make them look like the reflections of the sun in the mirrors. I have a few of these mirrors, lighting different parts of the station, and to keep the directional lights in check, I divided up the station into layers, so certain mirrors shine light on only certain sections. This works all well and good for the actual lights, but when I pre-calculate the realtime GI, suddenly parts of the station are getting reflected light from "mirrors" that are nowhere near them!

In other words: How can I make the GI from directional lights respect the layer mask I set on their source lights?? I'd prefer not having the directional lights affect parts of my scene they shouldn't be affecting!

(And if anyone has any better ways of reflecting sunlight onto a large scene via massive mirrors, I'm open to that too.)

sentences:
What exactly makes up a screen in a typical C64 game? I'm trying to figure out the basics of C64 game development past BASIC, and I could use some advice on something very basic, but important: What is all that stuff on the screen actually, and how to draw it?

Take a look at Katakis/Denaris:

There are at least 9 different things on the screen:

The Score bar, with different fonts
The ship itself
A satellite attached to the ship, detachable
Secondary Weapon Projectiles
Primary Weapon Projectiles
Moving objects (can be enemy ships)
The Status bar, featuring an image of the ship, the number of lives and three sections that can fill
The primary weapon charge bar, can fill to the end
A scrolling starfield in the background
(not numbered on the screen) Solid objects like rocks or metal walls that are part of the background

The C64 only supports 8 sprites per horizontal scan line, so I don't think that everything in the middle of the screen can be a sprite? I would assume that anything requiring a collision would be a sprite (since I can get hardware collision detection with sprites), but even then I quickly hit the limit of 8 sprites. Also, my weapons can fire much more than one projectile - my ship, the satellite and 6 bullets would already be 8 sprites on a row (look at about 50 seconds into the video).

Also, which graphics mode would a game like this use? The Programming Handbook lists Bit Map Mode which essentially modifies screen memory directly. Is this the mode I should usually be working in? How would I compose all the non-sprite elements together to get them on screen?

A lot of the stuff in the score and status bar is static ("Area: 01" or the "frame"), so I guess I'll just populate them once when the level starts. Things that need updating - the score, the charge bars at the bottom - would be updated by filling the screen memory with black and then drawing the new score every frame?

Or do I have to draw the entire screen on every frame?

sentences:
Why are the "professional" versions of console SDKs closed to the public? Why are the "professional" versions of console SDKs closed to the public? For example the Xbox Development Kit is available only to certain registered developers. The PS3 has some similar arrangement. Even the pricing is undisclosed.

What is the reason for this secrecy? Also, what additional features do these "professional" SDKs have, in comparison with the free SDKs (like XNA)?

sentences:
Finding collision point of moving projectile/bullet with a cube I am programming a game in the spirit of Wolfenstein 3D (2D grid map, 1 cell = 1 cube) and I wanted to implement shootings. I didn't want the shootings to happen in one frame so, I wanted to see the beams flying everywhere.

So this gets a bit complicated for me to test for impacts. To be fair, I'm not really sure how I'm supposed

This is how I used to do it : I took the position of the beam and checked on the map to see if there is a wall at said position. It works great when the beam is moving very slowly. But when they go extremely fast, naturally, as you would expect, they clip through walls.

Here you can have an idea of what I'm looking for. 2D grid with white cells being air and grey cells being walls. Player is green, beam is red and dotted lines represent the beam on next frames. And orange is the collision

So I'm not exactly sure when and what to test for collisions here, as well as how to find the impact's position. What would be the most optimised way to test for collisions ?

sentences:
3D position of an arbitrary UV coordinate I have a UV map for a 3D mesh that encodes "links" between pairs of UV coordinates. I have previously defined this links (or pairs), one to one. The links are enconded using the function rgb_color(u1, v1) = (u2, v2, 0.0). Therefore, in the fragment shader, given UV coordinates of the current fragment, I can get the UV coordinates of the fragment "linked" with the current one.

What I want to do is to draw this links in the 3D space(i.e. draw a line between the current fragment with texture coordinates (u1, v1) and its "link" texture coordinate (u2,v2). As far as I know this is a hard problem to solve because in the fragment shader you cannot access to the 3D coordinates (u2,v2).

Edit: Notice that the UV map is fragmented, therefore you cannot just draw this lines in the UV domain.

Do you have any idea how to approach this problem?

sentences:
How can I create a "rain drops on camera lense" effect with the HDRP? I did follow this tutorial https://www.youtube.com/watch?v=OG7zyogrUTs&t=115s but I did not made it cause I am using HDRP and they are not using HDRP so the problem is I can't use the normal materials being in HDRP mode help me if there is any way to do so or if there is another good video please.

In picture 1 I want these white particles on camera lens looks like the second picture I want water texture on these white particles.

sentences:
issue with ray/physics collision detection All,

I am trying to pick object using ray collision and bullet physics

I am initializing my projection and view matrix only once, here is the code

projectionMatrix = glm::perspective(90.0f, 4.0f / 3.0f, 0.1f, 100.0f);

float horizontalAngle = 3.14f;
float verticalAngle =0.0f;/// problems here

glm::vec3 direction(
    cos(verticalAngle) * sin(horizontalAngle),
    sin(verticalAngle),
    cos(verticalAngle) * cos(horizontalAngle)
);

glm::vec3 position = glm::vec3( 0.0, 10.0, 32.0 );

glm::vec3 right = glm::vec3(
    sin(horizontalAngle - 3.14f/2.0 ),
    0,
    cos(horizontalAngle - 3.14f/2.0 )
);

// Up vector
glm::vec3 up = glm::cross( right, direction );

viewMatrix =  glm::lookAt(
                            position,           // Camera is here
                            position+direction, // and looks here : at the same position, plus "direction"
                            up                  // Head is up (set to 0,-1,0 to look upside-down)
                       );

See below screenshot with actual object in the world

when I click on red area - it does not pick up object, but when i am click on green one - it does.

SMALL DETAIL:
I've used this tutorial http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-a-physics-library. While I've applying constant change to view and projection matrix throug my mouse move and keys - detection work perfect, but once I've stooping doing it - it does not work.

Can someone help me out what I am doing wrong ?

sentences:
Rotating projectile in direction it is moving I am using a parabola curve to launch my arrows:

public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t)
{
    Func<float, float> f = x => -4 * height * x * x + 4 * height * x;

    var mid = Vector3.Lerp(start, end, t);

    return new Vector3(mid.x, f(t) + Mathf.Lerp(start.y, end.y, t), mid.z);
}

I have a projectile that is a simple capsule scaled down to be long and thin like an arrow. I've tried every way to rotate it I could find online, but there is always something off. In order to follow the curve I need the direction between the last position and the new position, so I have been trying things like:

void ParabolaMovement() //Called in Update()
{
    parabolaAnim += Time.deltaTime;

    parabolaAnim = parabolaAnim % 5;

    Vector3 newPos = MathParabola.Parabola(start, target, 5f, parabolaAnim / 5);
    Vector3 dir = newPos - transform.position;
    transform.LookAt(dir);

    transform.position = newPos;
}

As for what is going wrong, it does not point AT the target, which I udnerstand it can't because nowhere do I specify target pos, which I should, but don't know where. I cannot simply tell it to lookat target, since I want it to lookat the direction it is currently going in the curve, but it also needs to face the target.

sentences:
Quantity of dropped/spawned items in container I'm having trouble figuring out how to spawn more than one item in to a container with a weight limit. What I'm having trouble with is the understanding, rather than what statements to write;

My items are composed of weight, type and foundIn, among other things. My containers are items, with some minor changes. foundIn is an array of strings which match "container" items, and should be either "world", "container-name", or empty ([]). "container" items follow a similar structure, with slight deviance.

Whenever I want to drop an item, I get a pool of items in a foundIn location, make a Math.random check against the commonRate, and if that item is a type = "container", I try to fill the container.

Here is where I have my problem; I can not figure out how to decide if multiple items of the same type should be dropped inside the container, and if so, how many. If I can figure this out, I can have monsters carry their own drops, instead of having to write a whole monster drop-table with levels and oddities.

The following is my code. The last method, dropItem, glues the displayed methods together.

placeExists(place) {
    return this._itemPlaces.indexOf(place) > -1;
}

getItemsOfType(arrayOfTypes, inList) {
    if (!Array.isArray(arrayOfTypes)) throw new Error('Index must be string');
    let pool = this.list;
    if (inList) pool = inList;

    return pool.map((item => {
        if (arrayOfTypes.indexOf(item.type) > -1) {
            return item;
        }
    }));

}

populateContainer(container, pool) {
    let chance = Math.random();
    pool = pool.map(item => {
        let canBeFound = item.foundIn.indexOf(container.name) > -1
                || item.foundIn.indexOf('world') > -1;
        if (item.commonRate >= chance && canBeFound) return item;
    });

    this.getItemsOfType(container.availableTypePool, pool).some(item => {
        if (container.capacity.freeSpace <= 0) return true;
        if (item.commonRate >= Math.random()
                && item.weight <= container.capacity.freeSpace) {
            container.addItem(item);
        }
    });

    return container;
}

getItemsOfPlace(place) {
    return this._LIST.map(item => {
        if (item.isFoundIn(place)) {
            return item;
        }
    })
}

dropItem(fromPlace) {
    if (this.placeExists(fromPlace)) return [];
    let foundItem = [];

    let pool = this.getItemsOfPlace(fromPlace);
    pool.some(item => {
        let chance = Math.random();
        if (chance > item.commonRate) {
            if (item.type == 'container')
                foundItem.push(this.populateContainer(item, pool));
            else
                foundItem.push(item);
            return true;
        }
    });

    return foundItem;
}

// container abstracted method of adding an item

container.addItem = (item = new Item()) {
    if (item instanceof Item === false) throw Error('item needs to be of type Item');
    if (item.type == 'container') throw Error('Yo dawg, I heard you like containers...');

    this._contained.push(item.code);
    this.carryingWeight = +item.weight;
}

How do I decide if I should drop multiple items, and how do I randomly select that amount?

Note that this.list and this._LIST are the same list. For some reason, WebStorm seems to lose track of one or the other when inside certain callbacks, so I switch to avoid losing autocomplete. For reference, this.list is get list() { return this._LIST }, and is obtained from extending a custom List class.

sentences: Problem with modifying dice in another players turn I have the following problem: I want to create a multiplayer game where each player has a turn where he has to roll a lot of dice again and again. But the other players are capable of modifying each single dice with a special action. But since this is a rare action because each player has a limited amount of modifications, I do not want to implement a simple dialog where you have to approve each roll. This would make the game rather sluggish. Any suggestions for the best way to implement a UI which allows to modify every single dice, but makes the game as fast as possible?

sentences: Is it possible to compile an android game for pc desktop? If I have an android game based on java native libraries. Is it to possible to compile into a windows/linux executable without a 3rd party emulator?

sentences:
OpenGL ES draw pre-rendered background onto depth buffer I want to create a scene with 2D pre-rendered background and 3D models for characters (like those classic Final fantasy games).
For the background, I have 2 textures:

one to be displayed, with colors, details...
one to be used as depth buffer (depth value presented as grayscale value maybe)

I want to write a shader program to help me discard all the pixels(frags) which have the depth smaller than current depth.
But then, do the background and the models have to use the same shader?
What value to compare with the depth value?
Is this approach even possible?

sentences:
2D grid based placement (limited to 1 tile in each direction) in Unity I've been trying to get my head around this for hours now, I hope one of you is able to help.

I'm trying to make a small game (2D using sprites) that allows you to place blocks (tiles). That is pretty simple in itself, I use ScreenToWorldPoint and mouse position to place the block (no snapping to grid yet).

Now, what I need to do is ensure that the player places blocks on either side of the block that was just placed, and not just some random place on the screen.

A block is just a 1x1 sprite in this case.

For example. Player placed a single block on the screen:

            can place here
                  |
can place here - [#] - can place here
                  |
            can place here

Player then places another block next to the already placed block:

            can place here
                  |  |
can place here - [#][#] - can place here
                  |  |
            can place here

As you see, there is always room to place 1 block around each block placed (using the word block too much!). This is in 2D space.

So in the end, the player might make this:

                   can place here
                      |  |   |
can place here     - [#] |  [#] - can place here
can place here  - [#][#][#][#][#] - can place here

As you also see here, there is always room for 1 block to be placed around the already placed blocks - obviously not when there's already a block placed next to it.

Hope it makes sense.

I guess what I'm after is just: How would I go about creating a grid around a single game object (2D sprite) - I can then use Ray's to figure out if player has pressed one of the grids around it.

Thanks a lot!

EDIT:

So, I managed to get something working. I made a game object with 4 parents (1x1 sprites: top, right, left, bottom) - clicking on one of these parents, "replaces" (destroys) the object and inserts another tile with 4 parents.

This seems like a really bad implementation, so please suggest alternative ways of doing this.

Screenshot:

Code:

using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour {

    public Transform boatObject;
    public GameObject tile;
    public GameObject boatPlank;

    private Vector2 mousePosition;

    void Start ()
    {
        Vector3 position = new Vector3 (boatObject.transform.position.x, boatObject.transform.position.y, 0);
        GameObject gridTile = Instantiate (tile, position, Quaternion.identity) as GameObject;
        gridTile.transform.SetParent (boatObject.transform);
    }

    void Update ()
    {
        // Mouse button 1
        if (Input.GetMouseButton (0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction);

            if (hit.collider.gameObject.tag == "GridItem")
            {
                Vector3 position = new Vector3 (hit.collider.transform.position.x, hit.collider.transform.position.y, 0);

                GameObject gridTile = Instantiate (tile, position, Quaternion.identity) as GameObject;
                gridTile.GetComponent<SpriteRenderer> ().sortingOrder = 10;
                gridTile.transform.SetParent (boatObject.transform);

                // Destroy the grid item that was clicked
                Destroy (hit.collider.gameObject);

                Debug.Log ("Hit something: " + hit.collider.gameObject.tag);
            }
        }
    }
}

sentences:
Multiple volumetric lights I recently read this GPU GEMS 3 article Volumetric Light Scattering as a Post-Process. I like the idea to add volumetric light property to realtime render i'm working on. Question is will it work for multiple lights? Our renderer uses one render pass per light and uses additive blending to sum incoming light.

I'm mostly convinced that it have to work nice. Do you agree? Maybe there can be problem where light rays crosses each other.

sentences:
How to create a perspective field of view matrix? Hey, hello. I am learning a little of WebGL (OpenGL ES 2.0) through the http://learningwebgl.com tutorials, but it uses a third party library to create the View, Projection and transformation matrices (glutils.js). Well, I don't really like the idea of depending on a non standard library, so I am trying to learn how to create these matrices by myself.

I've already managed to understand most of it, and although I can't really tell why these matrices work if someone asks me, at least I know how to build them when I need to. Now I have my own lib to work with 4x4 matrices. I can create translation, scale, rotation and the lookAt matrix, but, I am having a hard time finding out how to create the perspective matrix. Anyone could help me out?

Here is my lib: http://pastebin.com/csMi9GuC

sentences:
How do I find two points at an angle on opposite sides of a circle? With reference to my previous question:

I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to change that such that I can give it a center point, an angle in degrees, and a length.

If you look at the picture from the other question:

You can sort of discern where the center point is, the x,y of starting/ending locations become the dots based on the length of the gradient.

I assume I would have to:

Take the center location
Apply the angle + length
Gives me my ending x,y
Take the center location
Calculate the reverse angle
Apply the reverse angle + length
Gives me my starting x,y
Plug these starting/ending positions to the answer from the other question.

Am I correct? How would I do those steps?

sentences:
How to add a nice looking muzzle flash to the tip of my guns I am making a top down shooter and would like to add a muzzle flash to the tips of my guns. So I have an idea of what I want to do which would be just a circle that would fade from yellow to white or from white to yellow, don't really know yet. I actually have know clue how to fade in and fade out colors in libgdx so don't know how to do that. I guess I could also pass in a texture that I can color yellow and append that to the tip of the gun but still would like to add a color fade. Of course, these are just my crappy little ideas. Anyone else have a better idea that would look better graphically and if so could you try to describe it in some detail that would be great.

Thanks!

sentences: Displaying normals of a geometry I have a rectangle which is created by 2 triangles and it is in x-z plane, and i have object on it. Now, the normals of two triangles (face normals) are y axis i.e. (0,1,0). I want to display normals of two triangles for which i need two points to draw a line to show normal. Intuitively if i take center of a triangle as one and (0,1,0) as second point of a normal then both of the normals will converge to single point. I dont think it is correct as the normal should be exactly perpendicular to the surface. We can do a trick and take one point as a center and other by increasing y coordinate keeping x and z same, but what if we have curved surface and not a plane board? What about the cylinder made of triangles? How could we display normals as a lines of cylinder? I guess i am missing very basic concept here, please help me to understand it and tell me how to calculate the two points of normal.

sentences:
Allow code after a bugged line to continue without use of try and catch My problem is with C# in unity, but I think the problem can be applied to all coding languages.

For example I have a start function/event that may initiate many things. Some lines of code may issue a bug but I want to allow new lines of code run after that without having to encapsulate every line of code with try and catch. Is there any common solution for this that I'm missing?

sentences:
Implementing getters for a singleton script in unity Ok the title might be a bit confusing but what I want to do is make a getter that returns the class, exactly like unity does with the camera.current.

You should just be able to go class.current and get the running instance of the class but I have no idea how to do this as it would most likely be a static method but how would you return the class form a non static class without some sort of out of class variable? or do you have to make the class static?

sentences:
Camera Control Techniques in Games I am an MPhil student in Computing Science working on the problem of camera control in graphics. Though the literature of camera control dates back to the end of 1980s, the majority of them (up to my knowledge) is mainly academic and rarely used in games.

Now part of my thesis should be dedicated to camera control methods used in games. But the problem is that I have not implemented all the games in the world, so I can't speak about them. But I suppose there are some references that game developers usually use.

Can anybody help me with this? Even if it is from your own experience rather than a book.

sentences:
Linear Gradient with angle forumla EDIT: Ok so the question here is how to you generate a linear gradient along a vector.

Here is the function i'm looking for:

function CreateGradient(x,y, x1,y1,x2,y2) {
    // x and y are the point in our image we are looking to create the  color for in grayscale
    // x1,y1,x2,y2 is the vector in which the linear gradient should run
    // Can be in any language
}

What I have so far (that doesn't work):

var width = 2.0;
var offset = 0;

var convX = ((x / RES) * width - width/2) - offset;
var convY = ((y / RES) * width - width/2) - offset;

var angle = Math.atan(y1-y2, x1-x2);

var rx = Math.cos(angle);
var ry = Math.sin(angle);

var here = convX * rx + convY * ry;
var start = x1 * rx + y1 * ry;
var end = x2 * rx + y2 * ry;

var lerpValue = (start - here) / (start - end);

var val = lerp(0,255,clamp(lerpValue,0.0,1.0));

RES is the total resolution of the picture. val in the value (0-255) which represents the R G and B values of the pixel

Final Edit: I have it now thanks code for the future:

var x1 = 0;
var y1 = 0;
var x2 = 255;
var y2 = 255;

var dx = x2-x1;
var dy = y2-y1;

var rx = x-x1;
var ry = y-y1;

var t = ((rx*dx) +(ry*dy)) / ((dx*dx) + (dy*dy));

return lerp(0,255,t);

sentences:
Pixel Perfect collision detection on rotated bitmaps I have two bitmaps which are being drawn onto a canvas using a matrix

canvas.drawBitmap(bitmap, matrix, paint);

first to work out if I need to check for a collision i am using eucilidean vectors as such

//vector between the bitmaps
float vx = bitmap2.x - bitmap1.x;
float vy = bitmap2.x - bitmap1.x;

//magnitude of the vector between the two bitmaps
float m = Math.sqrt( (vx*vx)+(vy*vy) );

if( m < bitmap1.getDiagonalWidth() + bitmap1.getDiagonalWidth())
{
    //pixel perfect collision detection required
}

Firstly, is this the best way to approach this part of the collision detection?

Secondly once I have found that a collision is possible, do I need to do anything before throwing the bitmaps into a method that runs pixel perfect collision detection? basically, is the issue complicated because of the rotation of the images?

edit* it is possible that the bitmaps will also be scaled by the matrix. i would imagine that this will complicate things further.

sentences:
Recording Xbox controller button presses? I would like to generate some sort of log file of xbox gamepad events while playing an existing game on PC, such as Call of Duty.

I am not developing a game necessarily, I just would like a static file of all button presses recorded during a session of gameplay. I am writing an application that will use this data as input.

Can anyone recommend any software tools that could enable me to do this? Thanks in advance.

I have Mac, Windows, and Ubuntu that I can use.

sentences:
How can I mock Google Play purchases? I would like to know what best practices should I do for testing the functionality when a user buy an item/power-ups via Google Play and purchased with real money?

For example, basically, creating a simple test of purchasing and saving an item stored in the inventory during the game using a game money. (e.g. Gil from Final Fantasy series or Zenny from Tron Bonne for the PlayStation 1) I know how to make money purchase update only via game money when I'm programming in Unity3D or Eclipse w/ LibGDX library.

Now, let say I have to create a program that checks the user if actually purchase a power-up items using real money. Next, the system needs to check for online status. If connected, it will simply go to the Google Play dialog and asks the user if he/she wanted to proceed purchasing of items. If yes and the credit card balance is sufficient, then goes back to the game app and check if the boolean returns true, then item that the user is bought will be saved.

Another example is that the amount of real money will be calculated via programming and if insufficient, the user asks to add more real money value by purchasing it via Google Play. If return true, then, the real money value will be reloaded.

This concept is basically needed for game developers. However, is there a safe way to test the real money purchase test stuff without using a credit card value or something before the actual publishing of the game app in Google Play along with this feature? Is there a tutorial, start-up guide, recommendation or something for this? Please, I would like to know how will I start. Thank you.

sentences:
Is video compositing feasible? I've been considering the idea of a game client that acted as a video compositor, only drawing, by itself, the terrain, the characters... deferring other graphic elements to separate processes. For instance, a health bar would be drawn by a separate process with its own address space and graphics context. Even if the mentioned bar could be drawn from another thread of the main process, or perhaps even from the renderer thread, this model would increase security (I believe it is already done in Chromium), ease development and the introduction of trivial and more complex addons, as well as make the whole game client, with all of its brethren, more balanced across threads/cores.
Please, note that the heavy rendering (i.e. terrain, characters,...) would be drawn from a thread of the main process on the entire window, so it wouldn't have to be composited. The compositor thread would then draw the contents of clients' graphics buffers on top of what the renderer thread drew, in their respective position.
Also, note that this is only a personal project, and that I have never developed a game. My target is Linux with Mesa. As for the IPC part, I had thought about Wayland.

Question(s)

Would compositing, and having multiple graphics contexts, degrade performance seriously?
Is this already done in any game client?

P.S.: I think World of Warcraft also uses addons, although I think they're in Lua and parsed from the main thread, so no compositing happens there.

sentences: Using Burst Compile attribute on methods Can we use BurstCompile attribute without using any Jobs or ECS System in Unity? does adding [BurstCompile] attribute before methods bring us any benefits?

sentences:
How to get translation from view matrix How can I retrieve the camera's world-space position from its view matrix?
The only answers I've seen to this question suggest the translation is in the last row/col but this wouldn't work since the matrix contains [x (dot) right, y (dot) up, z (dot) look]

sentences:
How can I render cloud patterns like in these examples? I have a quick question.

I see in many games, usually in the menu, some moving "clouds" in the background, apparently additive blended into each other, which does a really nice job immersing the player, in my opinion.

A couple of examples that jump to mind right now are the Far Cry 3 main menu background: https://www.youtube.com/watch?v=B5XcMx3GjPA

and the Plague Inc main menu background: https://www.youtube.com/watch?v=RQv60ywrLxU (the first seconds show it)

These cloudy patterns seem like some kind of noise to me, like Perlin or other. So, how would you proceed to achieve that kind of blurred cloud effect with vivid colors?

More specifically, would you pre-generate sets of clouds and include them in the game package? Or generate them on-the-fly? On the CPU as a regular texture or on-draw in the GPU shader program?

I am interested in mastering this kind of visual effect, and as such any help would be appreciated pointing me in the right way. Thanks.

sentences:
Smallest increment for a SpriteBatch depth between 0.0 and 1.0? I experienced some problems with SpriteBatch in XNA when I tried to mix two different SpriteSort modes. (Begin with deferred, end, begin with BackToFront wasn't sorting properly.) I've settled on just giving everything I draw with SpriteBatch a depth value.

To that end, what is the smallest increment I can use on the floating point variable that will be used as the depth parameter without running into rounding problems? The valid values for this float are between 0.0 and 1.0. It is a float, not a double, and the language is C#.

UPDATE:
My testing has shown that 0.008f is the smallest amount I can change my depth value by and be certain the sorting will work. I'm guessing there is something else at play in BasicEffect or SpriteBatch.

What I am trying to use this for is the rendering of my game's map grid. I want to make heavy use of transparency and overlapping to create a specific visual look for the tiles, the doodads, and the characters.

Essentially, I am using a painter's algorithm to draw the tiles in order from the back row to the front. I have them numbered so I know the ordering is correct. The doodads I am trying to draw on top of the map are not appearing when my depth decrementor is set to a low enough number to draw everything I will need. It only works properly in a range where I can only access about 100 unique depths.

UPDATE about SpriteSortMode problems (as requested):

Thus far in my project I have got by just fine using SpriteSortMode.Deferred for everything. I have all of the standard UI components you would expect, windowing, clipping, etc. working.

Now I am attempting to draw my map grid. Like windowing/clipping this requires things to be done in a specific order to look right. The grid tiles draw in a certain order. To accommodate overlapping, doodads/characters draw on top of a tile before the next tile is drawn.

No matter what I did, my doodads/characters would always be drawn under the tiles. Changing the order of draws had no impact. Even drawing all of the tiles and then drawing the doodads resulted in them showing up underneath the tiles. Especially odd was that my UI elements continued to appear above the problem tiles as I scrolled around the map.

I switched to SpriteSortMode.BackToFront and with a high enough depth difference (~0.01) I see things drawing on the grid as expected, but this depth difference is way too high to support every visible tile of the map. I am searching for a better solution than to write code that will End and Begin a new SpriteBatch every time ~100 pieces are drawn.

sentences:
Reacting to rectangle on rectangle collisions I don't know how to react to collisions between two axis aligned rectangles that have x, y, width and height values (x and y are from the centre of the box) to make them simply not overlap.

I figured I'd just make them move away from each other depending on how far they intersect in the opposite direction (left, right, up or down) of where they collided. If I check for collisions only on the x axis or only on the y axis it works fine, but when checking for both collisions crazy stuff happens.

This code executes when the first box collides with the second. It's in lua but feel free to answer in anything that isn't to too counter-intuitive.

if box1.x < box2.x then
    box1.x = box2.x - (box1.width / 2) - (box2.width / 2)
end

if box1.x > box2.x then
    box1.x = box1.x - (box1.x - box2.x - (box1.width / 2) - (box2.width / 2))
end

if box1.y < box2.y then
    box1.y = box2.y - (box1.height / 2) - (box2.height / 2)
end

if box1.y > box2.y then
    box1.y = box1.y - (box1.y - box2.y - (box1.height / 2) - (box2.height / 2))
end

sentences:
Palette reduction to pre-defined palette I'm writing a bunch of GLSL effects for fun, but I can't wrap my head around this. Basically, I want to reduce a texture's palette into a pre-defined set of colors. For example, a post-processing shader would take the FBO result texture and a 1D / 2D texture that would contain the reduced palette (say, 64 colors), and the output would then be sampled based on these.

Something like this in its core:

sampler2D source;
sampler2D palette;

vec4 source = texture2D(...); // Source texture to sample
vec4 palette = texture2D(...); // Palette

vec3 result = /* color from the source converted to the closest value available in palette */;

Any ideas how to do this? And to be more precise, I don't mean palette swapping - the source texture is full-colored result, and this shader would ultimately be a post-processing shader, reducing the amount of colors to the ones that are predefined in the palette texture.

sentences:
Beginner: How do I calculate a vector? I am trying to wrap my head around some concepts in a side project I'm working on. I'm struggling with how I can calculate a vector based on my character movement logic. Here are the relevant details of my character movement:

The character's hit box for collisions (and map position validity) is defined as a rectangle: x,y,w,h
A character can move in 8 directions, let's keep this simple to ignore strafing, call this direction:

Left(x-1), Right(x+1), Up(y-1), Down(y+1)
UpLeft(x-1,y-1), UpRight(x+1,y-1),DownLeft (x-1,y+1), DownRight(x+1,y+1)

The character can be in two moving states, again keeping numbers simple:

Walking 1 x offsets
Running 2 x offsets

When a character is moved the following logic happens:

Create their proposed new hit box by adding an offset to their x & y coordinates based on their direction, call this proposedHitBox
Check if the proposedHitBox is a valid position on the map, if so, then update the character's position to the location defined on the proposedHitBox
If the proposedHitBox is not a valid location on the map it should try to glance the character. This is where I'm having trouble.

Given all this, how do I essentially, calculate a vector of their proposed motion?

Example:

Character is at 10,10.
Character starts running.
Input is DownLeft.
Proposed location is 8,12 (x-(1x2),y+(1x2)).
Proposed location is valid.
Update character position to 8,12.
What calculation defines my vector? How does magnitude come from this? Is that generally stored as Z in a 2D game? So I'd use a Vector3 to store it? How does velocity come into this?

I'd assume my vector is a 45deg angle from current to proposed...?

Edit

Here is a picture of what the walls can look like in the game. The red box being the hit box as discussed above. The character is bound inside the blue polygon (which represents outer walls). Black being inner walls. The way I was doing glancing was overlaying 4x4 tiles across this entire map and then for each tile that the character should glance on I would choose an incoming direction (i.e. DownLeft) and then redirect them to a different direction (i.e. Down) which should make the proposed hit box in a valid position. This is however very tedious as I have to create glances for multiple directions for every tile. I'm looking for hopefully a better way.

I was reading that you could add vectors to each tile but I'm not sure how this works because on some tiles a incoming direction does not always have the same out direction.

sentences:
How to implement translation, scale, rotation gizmos for manipulating 3D object's transforms? I am in the process of developing a basic 3D editor. It uses OpenGL for rendering a 3D world. Right now my scene is just a few boxes of different sizes and I am at the stage where I want to be able to select each box and then move/scale/rotate it to achieve any transform I want.

How can I solve the problem of implementing both the rendering of these tool's gizmos(or handles, or how people usually call them), and also picking them on each axis to perform the change in the transform with my mouse? For clarity:

My research so far suggested the cleanest approach is to have an axis aligned bounding box per arrow in the gizmo and another one per square (the ones that move the object in a plane rather than a single axis) and then cast a ray from the mouse position and see what it collides with. But this is still a bit too abstract for me, I would appreciate further guidance in how this algorithm would go (pseudocode is more than enough)

sentences:
How do I implement group formations in a 3D RTS? I managed to get pathfinding work for a single unit, and I managed to avoid agent-agent collision, but now I need to be able to send a group of agents to some location.

This is my set-up so far:

Waypoint pathfinding
The minimum distance between two nodes is a little bigger than the
biggest bounding sphere radius allowed for an agent.
Agents avoid collisions with other agents by doing some steering behaviour I based on clearpath

So now I need to send my agents somewhere in group. I have read some posts saying that some way to do it is to create a group leader and give the other units offsets to his position.

But then the problem is, what if the group formation cannot be achieved?
e.g. you want to form a rectangle, but at the target position there is a structure nearby which prevents you from creating a rectangle setup.

sentences:
Throttling MonoGame actions (explosions, sounds, etc) I'm trying to find a way to deal with throttling/managing actions that need to happen on a regular (regulated) basis.

Right now, if I want to throttle an "action" in MonoGame I need to setup a "timer".

Let's say I want to spawn a bunch of explosions during the update loop, but I don't want to spam them.  I would setup a variable to track the countdown to the next time I can spawn an explosion, and another variable for the time between:

public override void Update(GameTime gameTime)
{
    // ExplosionTimer is a class variable, defaulted to 0
    // ExplosionTimerMax is a class variable set to something like 1000 milliseconds
    ExplosionTimer += elapsedGameTime;

    if (ExplosionTimer >= ExplosionTimerMax)
    {
        // Perform actions
        ExplosionSound.Play();
        SpawnExplosion();

        // Reset the timer
        ExplosionTimer = 0;
    }

    // Other update code
    ...
}

This is pretty easy to setup and straightforward, but is there a better way?  If I need to setup 5 different timers, that means I need to define 10 variables, increment them all, run checks for their state, and reset them if needed.

sentences:
How to correctly pass multiple light structures to shader stage? I'm having some problems when passing multiple light structures to a shader stage. I'm using an array of point lights that is updated each frame.

This is my code for creating the buffer

D3D11_BUFFER_DESC lbDesc;
lbDesc.ByteWidth            = sizeof( PointLightData ) * NUM_LIGHTS;
lbDesc.Usage                = D3D11_USAGE_DYNAMIC;
lbDesc.BindFlags            = D3D11_BIND_CONSTANT_BUFFER;
lbDesc.CPUAccessFlags       = D3D11_CPU_ACCESS_WRITE;
lbDesc.MiscFlags            = 0;
lbDesc.StructureByteStride  = 0;

hr = mDevice->CreateBuffer( &lbDesc, nullptr, &mLightBuffer );

And this is how I update it

D3D11_MAPPED_SUBRESOURCE mappedResource;
hr = mDeviceContext->Map( mLightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource );

if( SUCCEEDED( hr ) )
{
    memcpy( mappedResource.pData, &mPointLightData[0], sizeof(PointLightData) * NUM_LIGHTS );
    mDeviceContext->Unmap( mLightBuffer, 0 );
}

mPointLightData is declared like this

mPointLightData = new PointLightData[NUM_LIGHTS];

In my shader I declare the light

struct PointLight
{
    float4  positionAndRadius;
    float4  ambient;
    float4  diffuse;
    float4  specular;
    float3  attenuation;
};

cbuffer CB_LIGHT : register(b1)
{
    PointLight  pointLight[2];
};

I can only access the first light object in the buffer successfully. Rendering the second light results in a pitch black scene.

However, if I change the starting address at the mapping stage from &mPointLightData[0]  to  &mPointLightData[1] the second light works but obviously not the first.

So my guess is that I'm doing simething wrong at either the mapping stage or at the creation of the buffer..

Any suggestions? Thank you!

sentences:
Generating lakes and rivers on 2D grid I recently posted a question about how to technically represent a generated terrain similar to the game kingdoms and castles.

I got some great advice and decided to create a 1x1 cube at each coordinate since I will have very small maps, for now 50x50.

I wrote some code to generate terrain,  this is super basic atm and simply instantiates either grass or water tiles depending on the noise value at the coordinate:

public static class Noise
{

    public static float[,] GenerateNoiseMap(int mapWidth, int mapHeight, float scale)
    {
        float[,] noiseMap = new float[mapWidth, mapHeight];

        if (scale <= 0)
            scale = .0001f;

        for (int y = 0; y < mapHeight; y++)
        {
            for (int x = 0; x < mapWidth; x++)
            {
                float sampleX = x / scale;
                float sampleY = y / scale;

                float perlinValue = Mathf.PerlinNoise(sampleX, sampleY);
                noiseMap[x, y] = perlinValue;
            }
        }

        return noiseMap;
    }
}

public class MapGenerator : MonoBehaviour
{
    public int mapWidth;
    public int mapHeight;
    public float noiseScale;

    [Space]
    public GameObject grassTile, waterTile;

    public void GenerateMap()
    {
        float[,] noiseMap = Noise.GenerateNoiseMap(mapWidth, mapHeight, noiseScale);

        for (int x = 0; x < mapWidth; x++)
        {
            for (int y = 0; y < mapHeight; y++)
            {
                if (noiseMap[x,y] >= .3)
                    Instantiate(grassTile, new Vector3(x, 0, y), Quaternion.identity);
                else
                    Instantiate(waterTile, new Vector3(x, -1, y), Quaternion.identity);
            }
        }
    }
}

It generate something like this:

Now this obviously does not look like a realistic landscape. My question is, how do I decide which values should represent water, and which should represent grass, in order to get a landscape that makes sense?

What I would like my landmass to look like something that has lakes and maybe rivers, instead of these random puddles you see in the image above, more something like this:

EDIT:

Setting a higher scale value lead to this:

sentences:
How to structure tic tac toe game loop (or equivalent simple turn based game)? I'm developing the simple Tic Tac Toe game in Java and got stuck on the game loop architecture.

The game must support local, remote and automatic players.
The graphical interface is based on JavaFX.

How can I best structure the game loop so that the game logic is as separate as possible from the graphic interface?

I have thought of two approaches to solve this problem

Approach 1 - wait/notify

The simplest approach I thought of is to develop classes for each type of player (remote, interactive and automatic) and implement the necessary code within the mark (Board) method. The update method iterates the players and for each one executes the mark method.
In the case of the AI, no problem, but in the case of the interactive player I would find myself having to pause the current thread while waiting for input from the graphic interface thread. A solution that does not convince me.

public synchronized void mark(Board board) {
    nextMarkLocation = null;
    try {
        if(nextMarkLocation == null) {
            wait();
        }
    } catch (InterruptedException e) {
        // handling
    }

and

public synchronized void setNextMarkLocation(Location location) {
    nextMarkLocation = location;
    notify();
}

Approach 2 - expose methods

The second approach would be to implement the methods for setting the current player's action in the game class. In this case, at each execution of the update method the routine would be the following (pseudo code):

public void update() {
    var player = getCurrentPlayer();
    var location = player.getNextMarkLocation();
    var symbol = player.getSymbol();
    board.markCell(location, symbol);
    updateCurrentPlayer();
}

The GUI will take care of updating itself according to the update of the match and setting the action for the current player. Here a check should be placed on the GUI owner. If the current player is not the same as the GUI owner, the game must ignore the action.

But the problem would be the reverse: And the automatic players?

Do you have any suggestions? Thanks

sentences:
How should I structure the layout and saving system of my game concept? I am a huge fan of Minecraft and (to an extent) Terraria. I’ve always wanted to make my own version of that type of Creative sandbox game, and recently I’ve been thinking of so many things I could add to it.

The game I’m imagining is a very different style from these two games. It’s 3D, and cartoony to a point but not too cartoony to not be realistic. I’m talking more realistic than Fortnite’s style but I definitely do not want to attempt to make a photo-realistic game.

I want my games world to be more fluid than the worlds of Minecraft and Terraria. I don’t want the player to be necessarily limited to a grid of blocks, though that should maybe be implemented at some points, like when the player is placing pieces of a structure down (blocks).

Generated structures such as trees, rocks, and the terrain I don’t really want to be blocky or constrained to a set grid.

The things that I see players being able to place into the world are things like wood columns to form the base of a house, wall blocks for a house, tables and chairs, doors, and different blocks required to create different items.

I like how the Minecraft and Terraria worlds are generated and saved. It’s simple: each coordinate is a block and that can be stored away very easily. I still haven’t figured out how I can save the type of world I want in my game, though.

So my question is: how should I structure the terrain, structures, and player-placed blocks layout/saving system so that I can save it efficiently and write it relatively simply as well?

Something I’ve thought about: there is a mod for Minecraft called the no cubes mod which essentially removes all the cubes from the game and seamlessly blends blocks together. That might be a good way to make this game since the blocks are still stored the same way but they are not actual blocks, and terrain can be made more realistic through this method.

sentences: How to display an image stored in GPU video memory My platform is Windows PC and C++. I am using an image buffer in GPU video memory via CUDA. Is there any way to directly send the content to GPU for display? Currently, I am getting the content into system memory and then use API function (such as GDI, OpenGL. DirectX) to send it back to GPU for display. I wonder if there is a faster way to do this.

sentences:
How to rotate "stacked sprites" in XNA? I'm working on a simple Sinistar-style shooter in XNA, and I'm constantly running into trouble with transformations.  I feel like I'll get it eventually, but this problem is really bending my mind.

My little ship has two states: idle and engines-firing.  Idle is a single frame, and engines is a few frames that animate. Got all that.  Part 1 of the issue: Instead of using rotated images, I just use XNA's rotation to orient the ship.  Seems to work ok, but I think my origin point is off because it seems to rotate at a point just below the vertical axis of the ship (default orientation is ship's nose pointing up), instead of in the dead center of the ship.  Likewise, when I switch to engines, the sprites are different heights (due to the flames) so the origin of rotation doesn't seem like it would be constant.  Do I need to specify all my frames the same size so as to preserve the origin point?

Second bit: The gun turret sits on top of the ship, as a separate sprite.  With a bit of trial-and-error and calculation, I can get the gun to align on top where I want it.  But then when the ship rotates, it rotates out from under the gun!  Would fixing the first problem adequately cover this one, or is there some trick to getting the gun's position to translate properly?

So:

Do I need to have all my sprite's frame-rectangles be the same dimensions?
Is there a standard technique in XNA for stacking multiple sprites so they act as one unit, including for rotations?

sentences:
Unity Camera - Clamping when Zoom changes? I've got a basic camera I am working on for a 2D game that moves with the player and clamps to the area of the map. To the basics I've introduced a combination of player and eventual height-based zoom sort of Ski Safari or Lunar Lander style.

Zooming, however, changes the clamp positions and allows the land edges to be seen again. How can I fix this in the code, to prevent the edges that should be clamped from being seen when zoom is in effect?

using UnityEngine;

public class CameraController : MonoBehaviour
{
    public int zoomSpeed = 1;
    public int zoomMax = 25;
    public int zoomMin = 50;

    public float tarVelocity;
    public GameObject target;
    public Vector3 offset;

    private Vector3 targetPos;

    private Camera _cam;

    void Start()
    {
        _cam = GetComponent<Camera>();
        targetPos = transform.position;
    }

    void FixedUpdate()
    {
        if (target)
        {
            Vector3 targetDirection = (target.transform.position -   transform.position);
            tarVelocity = targetDirection.magnitude * 5f;
            targetPos = transform.position + (targetDirection.normalized *   tarVelocity * Time.deltaTime);
            transform.position = Vector3.Lerp(transform.position, targetPos + offset, 0.25f);
        }

    }

    void LateUpdate()
    {
        ClampCamera();
        CheckZoom();

        Vector3 posNoZ = transform.position;
        posNoZ.z = -10;

        transform.position = posNoZ;

    }

    private void ClampCamera()
    {
        Vector3 clampMovement = transform.position;

        clampMovement.x = Mathf.Clamp(clampMovement.x, 8f, 112);
        clampMovement.y = Mathf.Clamp(clampMovement.y, 6.6f, 100);

        transform.position = clampMovement;
    }

    private void CheckZoom()
    {
        if (Input.GetAxis("Mouse ScrollWheel") > 0 && Camera.main.orthographicSize > zoomMax)
            Camera.main.orthographicSize -= zoomSpeed;

        if (Input.GetAxis("Mouse ScrollWheel") < 0 && Camera.main.orthographicSize < zoomMin)
            Camera.main.orthographicSize += zoomSpeed;
    }
}

sentences:
Picking a suitable resolution for a modern low-res game? I'm working on a 2D game project right now (using SFML+OpenGL and C++) and I'm trying to figure out how to go about choosing a resolution. I want my game to have a pixel resolution that is around that of classic '16bit' era consoles like the Super Nintendo or Neo Geo. However, I'd also like to have my game fit the 16:9 aspect ratio that most modern PC monitors use. Finally I'd like to be able to include an option for running full screen.

I know that I could create my own low-res 16:9 resolution that is more-or-less around the size of SNES or NeoGeo games. However, the problem seems to be that doing so would leave me with a non-standard resolution that my monitor would not be able to support in fullscreen mode.

For example, if i divide the common 16:9 resolution 1920x1080 by 4, I would get a 16:9 resolution that is relatively close to the resolution used by 16bit era games; 480x270.
That would be fine in a windowed mode, but I don't think that it would be supported in fullscreen mode.

How can I choose a resolution that suits my needs? Can I use something like 480x270? If so, how would I go about getting fullscreen mode to work with such a non-standard resolution? (I'm guessing OpenGL/SFML might have a way of up-scaling...but..)

sentences:
The best way to make collisions I'm making a 2d game, all is working, I have the characters and the map. The player have 6 different weapons and now I'm trying to make the collisions and the life / destruction system.

I have a character that follows the player. I made two triggers for this character and one for the player. When the player approaches, begins to haunt him, and when are near this character stop walking. To do this I programmed a "OntriggerEnter2d" and all is good, but now, I need to do anything similar with the bullets (or not). I tried OntriggerEnter2d and not works as expected, this detects the enter on the first zone of the bigger trigger, and I only need to detect the collision with the "body" of the characters.

Well, the question is, what is the best way to do the collisions between bullets and characters / objects??

Sorry if I explained bad the situation.

sentences:
What would be the optimal order to render something with OpenGL That question mind sound dumb, but let me explain:
I'm writing a 3D rendering engine in C++, and my way of getting something to the screen seems rather unintuitive:

I really hope that my artwork is understandable. To be sure, I'll just explain it again with words.

[class Mesh] Load a raw mesh with vertices, uv coordinates, normals,
etc
[class Model] Creates VBO's off the data from the Mesh
[class Shader] Reads and compiles shader
[class RenderObject] Binds Shader
[class RenderObject] Sets uniforms
[class RenderObject] Binds Model VBO
[class RenderObject] draw call

That would be how I get something drawn on the screen. Is that the proper way of doing so? Is there a more or less standard way of doing this?

sentences: Attach an Animated Texture to a Character in Unity Is it possible to have an animated texture of facial features on a characters face in unity? (I haven't made the game yet, I'm researching).  I would like to achieve a cartoon effect.

sentences:
Start a progress bar when clicking a button This is basically what i am trying to do:

Click first scene->Button
Start A Progress Bar
When the Progress Bar finishes, then...
Second Scene->instantiate my Game object

This is my code:

// First Scene
public class LoadingScreen : MonoBehaviour  //first scene script
{
    public GameObject slidercanvas;

    public void NextScene()
    {

        StartCoroutine(LoadNextLevel());
    }
    IEnumerator LoadNextLevel()
    {
        slidercanvas.SetActive(true);
        Slider s = slidercanvas.GetComponentInChildren<Slider>();
        AsyncOperation sceneLoading =SceneManager.LoadSceneAsync("ScrollGrids");

        while (!sceneLoading.isDone)
        {
            float progress = Mathf.Clamp01(sceneLoading.progress / 0.9f);
            s.value = progress;
            yield return null;

        }
   }

  //second scene

  public class ScrollGridScript : MonoBehaviour
  {
    public static ScrollGridScript Instance;
    public GameObject SpawnPrefab;
    GameObject newobj;
    public GameObject parent;
    Vector3 pos;
    string msgSpeech;
    int counter=0,totalVal;
    public List<GameObject> btns;
   //float progress;

    void Start()
    {
        btns = new List<GameObject>();
        StartCoroutine(Populate());
    }
    void Update()
    {
        if (totalVal==counter)
        {
            for (int i = 0; i < btns.Count; i++)
            {
                btns[i].SetActive(true);
            }
        }

    }
    IEnumerator Populate()
    {
        //code here(encoding jsonurl)
        StartCoroutine(Downloadimage(newobj, msgSpeech,tname));
        totalVal =  data["categorylist"].Count;
    }

    public void OnButtonclick(string imgname)
    {
        effector.Instance.setEffector(imgname);
        Debug.Log("ButtonId" + imgname);
    }

   IEnumerator Downloadimage(GameObject newobj, string imgUrl, string catid)
   {
      UnityWebRequest www = UnityWebRequestTexture.GetTexture(msgSpeech);

      DownloadHandler handle = www.downloadHandler;
      yield return www.SendWebRequest();

      Texture2D texture2d = DownloadHandlerTexture.GetContent(www);

      if (www.isHttpError || www.isNetworkError)
      {
            UnityEngine.Debug.Log("Error while Receiving: " + www.error);
      }
      else
      {
       counter++;
       newobj = (GameObject)Instantiate(SpawnPrefab, pos, Quaternion.identity);
       newobj.transform.SetParent(parent.transform);
       newobj.transform.localPosition = pos;
       newobj.GetComponent<Button>().onClick.AddListener(() =>
       OnButtonclick(catid));
       Image sprite = newobj.transform.GetComponent<Image>();
       sprite.sprite = Sprite.Create(texture2d, new Rect(0, 0, texture2d.width,
       texture2d.height), new Vector2(0, 0)); //fetch the images from the serve
       //and convert it
       newobj.SetActive(false);
       btns.Add(newobj);  // instantiate object store in list
    }
}

And here is the output I see when I run this code:

sentences:
component Initialization in component-based game architectures I'm develping a 2d game (in XNA) and i've gone slightly towards a component-based approach, where i have a main game object (container) that holds different components.

When implementing the needed functionality as components, i'm now faced with an issue -- who should initialize components?

Are components usually passed in initialized into an entity, or some other entity initialized them?

In my current design, i have an issue where the component, when created, requires knowledge regarding an attached entity, however these 2 events may not happen at the same time (component construction, attaching to a game entity).

I am looking for a standard approach or examples of implementations that work, that overcome this issue or present a clear way to resolve it

sentences:
2D day night mapping I'm looking for this kind of effect MINUS the lights and snow (Another problem).

It needs to change depending on the time of year.
Doesn't need snow or city lights.

Now I'm pretty new to shaders (learnt them yesterday in my spare time) but so far I have achieved:

This moves across the screen display light on both sides.

Now I'm completely lost, as to how I can make it seem like a light map I.E. it needs to be more square/sharper (As it's going off the edges) & have the bottom and top times of year.. I though maybe I could pass sphere mesh to the vertex? Or do something with the map-normal. Or maybe use blending with two textures but I've looked around and it looks extremely difficult.

Code I have so far:

Fragment / Pixel shader:

    //attributes from vertex shader
varying vec4 vColor;
varying vec2 vTexCoord;

//our texture samplers
uniform sampler2D u_texture;   //diffuse map
uniform sampler2D u_normals;   //normal map

//values used for shading algorithm...
uniform vec2 Resolution;      //resolution of screen
uniform vec3 LightPos;        //light position, normalized
uniform vec4 LightColor;      //light RGBA -- alpha is intensity
uniform vec4 AmbientColor;    //ambient RGBA -- alpha is intensity
uniform vec3 Falloff;         //attenuation coefficients
uniform float lightX;         //X Position of light. Can also feed Y for times of the year.

void main()
{
    //RGBA of our diffuse color
    vec4 DiffuseColor = texture2D(u_texture, vTexCoord);

    //RGB of our normal map
    vec3 NormalMap = texture2D(u_normals, vTexCoord).rgb;

    int numberOfLights = 3;
    vec3 lightPoses[3];
    vec3 lightDirections[3];
    //LightX goes to 0, then back to 1.
    lightPoses[0] = vec3(lightX - 1.0, LightPos.y, LightPos.z);
    lightPoses[1] = vec3(lightX, LightPos.y, LightPos.z);
    lightPoses[2] = vec3(lightX + 1.0, LightPos.y, LightPos.z);

    //TODO Introduce one extra light for top and bottom. OR Figure out how to squash the Y.
    //TODO Needs to be sharper light.

    vec3 Sum = vec3(0.0);

    //Go though both lights.
    for(int index=0; index < numberOfLights; index++)
    {
        //The delta position of light
        vec3 LightDir = vec3(lightPoses[index].xy - (gl_FragCoord.xy / Resolution.xy), LightPos.z);

        //Correct for aspect ratio
        LightDir.x = LightDir.x * (Resolution.x / Resolution.y);

        //Make it bigger. (smaller the value the bigger.)
        LightDir *= vec3(0.55, 0.4, 1.0);

        //Determine distance (used for attenuation) BEFORE we normalize our LightDir
        float D = length(LightDir);

        //normalize our vectors
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);

        //Pre-multiply light color with intensity
        //Then perform "N dot L" to determine our diffuse term
        vec3 Diffuse = (LightColor.rgb * LightColor.a) * max(dot(N, L), 0.0);

        //pre-multiply ambient color with intensity
        vec3 Ambient = AmbientColor.rgb * AmbientColor.a;
        //Because there are more lights, take off total ambient power.
        Ambient *= vec3(1.0 / float(numberOfLights));

        //Calculate attenuation (The amount of fade the light has.)
        float Attenuation = 1.0 / (Falloff.x + (Falloff.y*D) + (Falloff.z*D*D));

        //the calculation which brings it all together
        vec3 Intensity = Ambient + Diffuse * Attenuation;

        vec3 FinalColor = DiffuseColor.rgb * Intensity;

        Sum += FinalColor;
    }

    gl_FragColor = vec4(Sum, DiffuseColor.a);
}

Vertex Shader:

//combined projection and view matrix
uniform mat4 u_projTrans;

//"in" attributes from our SpriteBatch
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

//"out" varyings to our fragment shader
varying vec4 vColor;
varying vec2 vTexCoord;

void main() {
    vColor = a_color;
    vTexCoord = a_texCoord0;
    gl_Position = u_projTrans * a_position;
}

sentences:
calculating the trajectory of an object in SpriteKit when an impulse is applied to it I want to make a trajectory line of little balls of where the object is going to go after an impulse, sort of like what is in Angry Birds. I did some research and it seems that the physics in spriteKit are calculated just as in real life with si units and other stuff. Using the displacement formula ∆x = Vi∆t + 1/2a∆t^2 i used this formula to set the position of nine balls of where the object will be after the impulse.

This is what I have tried so far:

func calculateTrajectory(mass: CGFloat, force1: CGFloat, force2: CGFloat){

    for i in 0...8{

        var x = CGFloat()
        var y = CGFloat()

        let a1 = CGFloat(force1/mass)//I am taking the force applied to the object and calculating the acceleration from that
        let a2 = CGFloat((force1/mass) - 10)//I am subtracting 10 for y because of the -10m/s/s of gravity
        let t = CGFloat((i/16)^2)//I am taking the number that the ball is in the line and dividing it by 16 so the line can show where the object will be from 0-0.5 secnds

        x = 0.5 * a1 * t
        y = 0.5 * a2 * t

        trajectory.copiedNodes[i].position = CGPoint(x:ball.position.x + x, y: ball.position.y + y)

    }

}

I also use this in touches moved to do a drag back sling shot sort of thing.

calculateTrajectory(mass: (ball.physicsBody?.mass)!, force1: startPositionDrag.x - movedLocation.x, force2: startPositionDrag.y - movedLocation.y)

The force for calculation is the same as impulse that I will use to shoot the ball in touches ended:

ball.physicsBody?.applyImpulse(CGVector(dx:startPositionDrag.x - endPositionDrag.x, dy:startPositionDrag.y - endPositionDrag.y ))

When I calculate this the balls are not close to where the object goes, and when I make the time change for the balls a shorter time amount by dividing i by more, the balls get farther apart even though I am calculating their positions after less time. Is there any way I am doing this wrong? Are my conversions to CGFloat wrong? Please help me.

sentences:
Wrong distance in Depth-buffer I am currently trying to get the Depth Buffer as a texture to use it for edge detection algorithms. Since XNA4 does not allow direct access to the Depth Buffer as texture i have to render it into a texture. The effect i currently use looks like this:

float4x4 World;
float4x4 View;
float4x4 Projection;

struct DEPTH_VS_OUTPUT
{
    float4 Position : POSITION;
    float2 Depth : TEXCOORD;
};

DEPTH_VS_OUTPUT DepthTextureVS(float4 Position : POSITION)
{
    DEPTH_VS_OUTPUT output;

    float4 worldPosition = mul(Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);
    output.Depth = output.Position.zw;

    return output;
}

float4 DepthTexturePS(DEPTH_VS_OUTPUT input) : COLOR0
{
    float4 result;
    result.rgb = input.Depth.x / input.Depth.y;
    result.a = 1.0;
    return result;
}

technique DepthTextureRender
{
    pass P0
    {
        CullMode = NONE;
        ZEnable = TRUE;
        ZWriteEnable = TRUE;
        AlphaBlendEnable = FALSE;

        VertexShader = compile vs_2_0 DepthTextureVS();
        PixelShader = compile ps_2_0 DepthTexturePS();
    }
}

It looks like this:

The cubes in this scene are 1x1x1 the projection matrix is made like this:

var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 16f / 9f, 0.1f, 1000f);

As far as I understood the Depth Buffer concept z/w should give me the distance from the camera position to the pixel as value between 0-1 where 0 would be the Near-plane and 1 the Far-plane but since the cubes in this scene are only about 5 Units away they shouldn't be  white.

sentences:
SDL Player do something for 3 seconds then stop I'll make my player respawn after 1 of his lives is taken, but I want him to be invincible for 2 or 3 seconds and not instadie again because he will be in the way of enemy bullets.

for (int i = 0; i < MAX_BULLETS; i++) if (enemyB[i]) {
    if(globalTime % 2 == 0)
        enemyB[i]->y -= enemyB[i]->dx;
    if (player->alive && (enemyB[i]->x > player->x && enemyB[i]->x < player->x + 97 && enemyB[i]->y == player->y-15))
    {
        if (player->invincible == false) {
            player->life -= 25;
            player->hbSprite++;
        }
        if (player->life <= 0) {
            player->invincible = true;
            player->lives--;
            player->life = 100;
            player->lifeSprite++;
            player->hbSprite = 0;
            if (player->lives <= 0) {
                player->alive = 0;
                player->hbSprite = 4;
                player->lifeSprite = 3;
            }
        }
        removenemyB(i);
    }
}

When I set player->invicible = true he's not taking dmg , but I need him to do that only for 2 or 3 seconds , help pls.

sentences:
Android AndEngine creating a body behind the sprite exactly I am using AndEngine for Android. I created a body, but it is not behind the sprite as I wanted.

                                Body.setTransform(Sprite.getX()/32, Sprite.getY()/32, 0);

This is what I am currently using and this is how it appears.

My body is the white circular borders, and my sprite is the red circle.

and When I remove /32 from the code the body doesn't even appear.

Extra code;

                    FIXTURE_DEF = PhysicsFactory.createFixtureDef(
                            1,     // density
                            0.75f,  // elasticity
                            0.5f, // friction
                            false); // isSensor

the Body

                Body = PhysicsFactory.createCircleBody(this.physicsWorld, Sprite, BodyType.KinematicBody, this.FIXTURE_DEF);
                Body.setUserData("eSprite");
                this.physicsWorld.registerPhysicsConnector(new PhysicsConnector(Sprite, Body, true, true)

my sprite is 65px ..

sentences:
How to create custom 3D "areas" at runtime I've been puzzled for a few days trying to solve this problem, so far with no results.

On a map, currently a Terrain, I'd need to have some "areas" which can be controlled by a specific players. The shape of those areas can arbitrarily change during the course of the game, such as you add a  marker in any point, and the area evolves (like a spline, say) to pass through that point too.

The problem isn't drawing the boundary itself, of course, but having the GameObjects detecting the area they are in.

Currently I have absolutely zero idea on how to make this exactly.

I've thought about a nice approximation, which is splitting the terrain in fixed chunks, and having the player control them "chunk by chunk": every chunk can have its own collider, and that should be easy if not trivial. So the question is how to do it "properly", since I already have this workaround.

sentences:
Weird Error Building TMX Maps I'm getting an error while build a tmx map using MonoGame Extended (see picture). By the looks of it, the importer can't find the tileset, which is weird.

In my Map.tmx file the source for the tileset is ../Tilesets/Tileset.png. The tileset is placed in a Tilesets folder in the content pipeline, and the map lies in a Maps folder, so it should work, but it doesn't? I get the same error if I place the Tileset.png in the same folder as Map.tmx and change source to just Tileset.png.

Any ideas what's causing this and how to fix it?

sentences:
Black lines on sprites I am having the issue as seen below while using a textureAtlas with libgdx. I haven't found anyone else with the issue so I decided to ask here.

Here is an image of the textures in the game screen:

And to prove it's not a texture related issue, here is the spritesheet with the same background color as the game screen has applied:

Any suggestions? sorry for the sloppy write-up I am very preoccupied.

sentences:
Simple 2D vehicle physics - maintaining vehicle length I'm learning OpenGL and trying to make a simple simulation, which involves vehicles (drawn just as a rectangles) moving along predefined path.
I've already read a few tutorials about designing a simple 2d car physics and tried to code something from a scratch.

Basically, I want to use a simplification so called a bicycle model - we assume that the car has just two wheels - one at the front in the middle to steer, and one at the back in the middle that cannot steer.

Moreover, the 'front wheel' is also a vehicle's current position. (possition is at front, not in the middle as usual).

It looks like this:

mainAxis[0] is the front wheel, mainAxis[1] is the back wheel

In most cases like described here or here, wheel movement is based on steer angle, which is fine when dealing with vehicle controlled by user input, but in my case I think I already have the direction of current front wheel movement - next node on the path.

This is how my movement function looks like for now: (I rewrote it in pseudo-code to simplify)

I know it does not involve factors like steering forces, friction or speed reduction before turning. I'd like to make vehicle position to update properly first.

// _deltaTime - time between frames
// velocity - vehicle speed (scalar value)

void updatePosition(double _deltaTime)
{
    //Front wheel is moving in direction of current target, while back wheel is moving along the 'previous' vehicle direction

    Vector2 oldPosition = currentPosition;

    Vector2 newPosition = currentPosition + normalize(currentTarget - currentPosition) * velocity * _deltaTime);

    currentPosition = newPosition;
    mainAxis[0] = currentPosition;

    mainAxis[1] += normalize(oldPosition - mainAxis[1]) * _deltaTime * velocity;

}

The vehicle turns fine, front wheel position is correct, however it doesn't maintain the baseline (vehicle length), that is, the distance between the front and rear wheel.

Turning looks more less like this:

(red rectangle is a vehicle, with mainAxis marked as black line and current velocity to target as white line)

I struggle to find a correct way to calculate wheels movement in a realistic way, i.e with preserving the car length (which is predefined).

Perhaps I should calculate back wheel movement reduction or move front wheel further...

Thank you in advance for any assistance

sentences:
Circle to Circle collision - bad accuracy Circle1 (blue) is moving and its X and Y bounds are the screen (meaning it bounces off the walls).

Circle2 (black) is stationary. Circle1(blue) is supposed to bounce off of Circle2 without intersecting, regardless of the collision point. As you can see on the image below, the blue circle bounces off properly only at the blue arrow spots, otherwise(red arrows), blue ball goes INSIDE the black circle, gets stuck in there for a second and then gets out.

I have no idea why this is happening. Please take a look at my code and help me out.
Thanks.

public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X); //velocity
                    circle.setLayoutY(circle.getLayoutY() + Y); //velocity

// Bounce off the walls (working perfectly)
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

//THE PROBLEM IS HERE

//Collision between circle1 and circle2 (stationary black circle.
                    double dx = circle.getLayoutX() - circle2.getLayoutX();
                    double dy = circle.getLayoutY() - circle2.getLayoutY();
                    double radii = circle.getRadius() + circle2.getRadius();

                    if ( (dx * dx) + (dy * dy) <= radii * radii) {
                        X = X * -1; //X gets inverted to change direction

                    }

 //The code below is working perfectly.
                    // If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                        //circle.setLayoutY(circle.getLayoutY() - 50); - Wasn't working. Had to create X and Y to fix the problem.

                    }
                    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }
                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

P.S. Apologies for the amazing paint skills :D

sentences:
How can I get a cone shape of arbitrary size in an hex board? I'm implementing engine tools for my hex board game and this one is becoming messy. I want to get a list of all the positions that a cone of size N would have, given "caster" origin X,Y and origin in X0, Y0 taking direction into account. So far I have been able to get a size one cone using a "simple pattern" approach, but it doesn't translate well for N-sized cones.

This is the original cone

and the code

public PositionArray getArcAdjacents(int originx, int originy, int targetx, int targety,
        int range) {
    final FloatPair direction = this.getDirectionVector(originx, originy, targetx, targety);
    final PositionArray highlights = new PositionArray(gameMap);
    highlights.add(new Pair(targetx, targety));
    int offset = 0;
    if ((targetx % 2) == 0) {
        offset = 1;
    }
    if (direction.x > 0) {
        if (direction.y >= 0) {
            highlights.add(new Pair(targetx - 1, (targety + 1) - offset));
            highlights.add(new Pair(targetx, targety - 1));
        } else {
            highlights.add(new Pair(targetx, targety + 1));
            highlights.add(new Pair(targetx - 1, targety - offset));
        }
    } else if (direction.x < 0) {
        if (direction.y >= 0) {
            highlights.add(new Pair(targetx + 1, (targety + 1) - offset));
            highlights.add(new Pair(targetx, targety - 1));
        } else {
            highlights.add(new Pair(targetx + 1, targety - offset));
            highlights.add(new Pair(targetx, targety + 1));
        }
    } else {
        if (direction.y > 0) {
            highlights.add(new Pair(targetx + 1, targety - offset));
            highlights.add(new Pair(targetx - 1, targety - offset));
        } else if (direction.y < 0) {
            highlights.add(new Pair(targetx + 1, (targety + 1) - offset));
            highlights.add(new Pair(targetx - 1, (targety + 1) - offset));
        }
    }
    return highlights;
}

sentences:
How do I implement a field of vision for AI entities? I am considering how to implement a field of vision system for my AI entities, but am not sure on the order of steps to take. The thought process that I had was to use a combination of radial distance and dot product.

Keeping in mind that this is a 3D environment (meaning that all vectors have 3 components), and I will be using quaternions for the orientation of all entities.

What order should I do these in? and is my logic accurate?

Dot product: Taking the position of the playerObject, and the position of the AIEntity create a vector, and then take the orientation quaternion, and convert that to a vector of fixed length, and perform the dot product between them (testing for a specific range of values) to see if it is within a given arc.

Radius test: Simple 3D radius to determine distance.

I know for sure that a dot product test should be quite simple (3 subtractions, 3 multiplications, 2 additions, and however many operation to turn a quaternion into a vector), but arriving at the orientation vector I have no direct idea (if this process could be explained it would be of great help, I know I would have to multiply by the needed magnitude after normalizing), and radius test is also simple (3 subtractions, 3 additions, and 4 multiplications) both of these would still include a boolean tests, but which order would reduce faster?

My first guess would be to be the dot product, and then the radius test; As the dot product would be outside of bounds if the player is outside of the arc or to far away, and the radius test would only fail if the object is to far away. I understand that both tests can give false positives, but for some reason I feel that the dot product test would give fewer.

sentences:
Unity Android Orientation Bug in Auto Rotate I am currently looking for a workaround, or fix, for a Unity bug.

I want to be able to auto-rotate my game, while respecting the Android system settings.

Currently, if you set your Unity Orientation Mode to "Auto Rotation", your application will automatically change its orientation based on the physical's device orientation.  In iOS, if you disable the Screen Rotation in device settings, the auto rotation stops as intended.  In Android, even if you lock your screen orientation, the application will continue to auto rotate.  This is a major bug.

Does anyone know of a workaround, so that my android application will be able to auto-rotate, while still respecting the device system settings?

You can easily reproduce this bug by creating a blank project, setting the orientation mode to "auto rotation" and running it on an android device.

sentences:
Unity: Change Text with Time (Text Flashes) I am trying to display instructions within the Unity game. The idea is to have the instructions appear over time. For example, "instruction 1" then wait 5 seconds and show "instruction 2" instead of instruction 1 (on the same spot, in this case, I am changing the "message" variable in the code to change the instructions). This code does change the instructions but the problem is that it does it in a haphazard fashion. It appears that "instruction 1" is replaced with "instruction 2" and then it reverts back to "instruction 1" within a second and then back to "instruction 2" so instead of just 1-appearing->1-disappearing->2-appearing->etc in a smooth fashion, it does this weird flashing thing before proceeding to the next instruction. How could I fix this?

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Growing : MonoBehaviour {

    public Text instructions;
    public string message;

    void Start () {
         instructions.text = message;
    }

    void Update () {

         Instructions();

         //other code to begin moving a game object
    }

    IEnumerator Instructions() {
        //run instructions
        message = "GET READY FOR YOUR FOCUSED BREATHING EXERCISE";
        yield return new WaitForSecondsRealtime(5);
        message = "MAKE SURE YOUR BODY IS COMFORTABLE";
        yield return new WaitForSecondsRealtime(5);
    }

sentences:
How to seamlessly handle multiple procedural 2D levels in Unity3D? I have a dungeon generating algorithm, but I would like to generate X levels, which are all connected somehow.

I have a few approaches, but all of them has problems and questions, and I wonder how i.e. Diablo II handles them so seamlessly.

1. Approach: Upon leaving a level, generate the next one on the fly.

This would be the easiest, but would result in a relatively long loading screen everytime the player enters a new level.
So generating the levels should be at the beginning of a new game, thus the next level will just have to be loaded, which is much faster. In theory not even a loading screen is necessary.

2. Approach: Generate every level at the beginning of a new game and store them.

Okay, now levels just have to be loaded, which could be done under half a second. No loading screen is necessary, maybe just a fade out-fade in.
How do I store them?

Make custom files (i.e. scriptable objects) for them, or is there a simpler way?

3. Approach: Generate and load every level at the beginning.

Zero loading time, because everything is already generated and loaded into the tilemap.
But how do I guarantee that levels don't collide, and the player can't see level Y from level X if there are lots of levels?
And wouldn't it affect the performance? Because everything is loaded all the time. Yes, renderers, rigidbodies, scripts, etc can be turned off, improving the performance a lot... but still... this seems wrong.

What is the best way to solve this problem?

sentences:
how does collaboration in unity work? i've been working on a 2d game for a bit now, almost all assets made but when ive tried to collaborate everything was quite glitched out, edits weren't saved, nothing was working at all. im not sure quite what the problem was because we were both on the latest version.

maybe i got to something wrong, or did something wrong im not sure. this was a few months ago now and ive been busy but i want to come back to this project. should i start over?

sentences:
What are heterogeneous coordinate systems and reasons for using them? The book I'm following for a computer graphics course only talks about homogeneous  coordinate systems.

But today, our teacher asked:

  What are the reasons for using heterogeneous coordinate systems?

I cannot find anything about this topic.

sentences:
How to program dynamic touch events that scale according to device? When using openGL to build a UI for my prototype I find that that I am still required to use pixels to capture touch events. To make matters worse the Android Docs make this subject slightly confusing. http://developer.android.com/guide/practices/screens_support.html specifically states:

  You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

Yet

MotionEvent event = new MotionEvent();
event.getX();

returns pixels when used to locate the touchscreen event.
http://developer.android.com/reference/android/view/MotionEvent.html#getX()

To make matters even more confusing,

public final float getRawX ()

  Added in API level 1
  Returns the original raw X coordinate of this event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

Seems to imply that there are alterations being made to adjust for the window and views when using

event.getX()

My last bit of confusion comes in when trying to tie both of these concepts together. I see all the moving parts I am just unable to make them connect.

How to convert openGL vertices into terms that work with pixels or dp.
How to program for dynamic touch events using MotionEvent when pixel location will change by scale according to device density.

sentences:
Instantiate an object and translate it randomly My goal through this code in C # is that each time the player presses the Q I create a cube at a fixed position given by another object, then begin translating it in a random direction. ie.

first press: a cube is created at the spawn point and moves away in direction 1
second press: a cube is created at the spawn point and moves away in direction 2
third press: a cube is created at the spawn point and moves away in direction 3

I don't understand why the code below does not work:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class spawn_random_trajet : MonoBehaviour {

    public GameObject Spawn, Spawn2;
    public Transform origineSpawn;
    public float moveSpeed=5f;

    void Update () {
        if (Input.GetKeyDown (KeyCode.Q)) {
            int random_trajet_x = Random.Range (-10,10);
            int random_trajet_y = Random.Range (-10,10);
            int random_trajet_z = Random.Range (-10,10);

            Spawn2 = Instantiate(
                 Spawn,
                 origineSpawn.position,
                 origineSpawn.rotation
            ) as GameObject;

            transform.Translate (
                 random_trajet_x*Time.deltaTime*moveSpeed,
                 random_trajet_y*Time.deltaTime*moveSpeed,
                 random_trajet_z*Time.deltaTime*moveSpeed
            );
        }
    }
}

sentences:
How to run code selectively only when a specific trigger collider has been hit I have 2 objects both with trigger colliders. The first object has only 1 trigger collider (imagine this to be a sword).

The second object (a person) has multiple colliders. One is a non-trigger collider (used for collision detection for walls, ground) and then multiple trigger colliders on different parts of the body (the purpose is for hurt box).

Now when the sword hits the person, I want to only process code for those trigger colliders and to be able to detect which of those trigger colliders got hit (arm, leg, etc.).

But the event only exposes a parameter hit for the other collider:

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.layer == LayerMask.NameToLayer(Constants.LAYER_HITBOX_PLAYER))
    {
        // Run code here
    }
}

I want to run code only when certain trigger collider are hit, like for example, when the head is hit, or the body, etc. How do I get this info to be able to run conditional code on this method?

sentences:
Translate position from 3D camera to 2D camera Currently I have 2 cameras, one for viewing the 3D objects (Perspective), and the other camera to view 2D objects (Orthographic).
(Also, the view of the camera never intercepts each other.)

I am trying to display a 2D object based on the position of a 3D object, like so:

What I have is the respective 2D and 3D Camera, as well as the Vector3 position of the 3D GameObject.

What I have tried:

public Vector2 Convert3DPositionTo2DPosition(Camera camera3D, Vector3 position3D, Camera camera2D) {
    var tempPos = camera3D.WorldToViewportPoint(position3D);

    return camera2D.ViewportToWorldPoint(tempPos);
}

The only problem is that the returned position is not completely aligned with the 3D position.
Which results in this kind of results:

Also, I have made sure that both the 3D and 2D object have their pivot point are set correctly in the center, but it still does not work as intended.

(I am currently using Unity 2019.1.14f1)

sentences: In OpenGL, how can I discover the depth range of a depth buffer? I am doing a GL multi-pass rendering app for iOS. The first pass renders to a depth buffer texture. The second pass uses the values in the depth buffer to control the application of a fragment shader. I want to rescale the values in the depth buffer to something useful but before I can do that I need to know the depth value range of the depth buffer values. How do I do this?

sentences:
Java - Loading background music into memory I am currently developing a game with Java, with a soundtrack consisting of ten tracks in .ogg format, 1-2 MB in size each. To be able to switch between these tracks quickly and easily in the game, before the game starts, I load all of them into memory by creating ten Clip classes. Unfortunately, but understandably, pre-loading these tracks increases the application's CPU usage from about 61 MB to 340 MB.

Since I'm only ever playing one track at a time, I could make it so that only one Clip is ever in memory, and is destroyed when the track needs to change. This means, though, that I'll have to hang the game up on loading the Clip when this happens, or do this on a different thread during a few seconds of undesirable silence.

Is there a smarter, more conventional way to handle large BGM files, or do I just have to pick my poison?

sentences:
Why does exporting to FBX in 3dmax loses simulated animation I made a cloth simulation (wind blowing a cloth). When I export it to FXB and the animation box is ticked on export menu it seems ok (no error in longs). When I reload it to Unity. or 3DMAX again. The wind animation is lost. How can I fix that?

Thanks

sentences:
Instancing mirrored geometry I'm rendering mirrored geometry by flipping it's world matrix. Before rendering mirrored geometry I set CULL_FRONT rasterizer state (for normal geometry it's CULL_BACK). This works perfectly.

However, I've started implementing instancing and would like to instance mirrored and not mirrored geometry together. What's optimal way to do it?

So far I've considered:

CULL_NONE, but it has huge impact on shading performance
Geometry shader to flip triangles, but GS is generally slow

Is there any other option? I've found SV_IsFrontFace, but there's not much documentation about it. I would like to tell GPU in VS: Hey, this triangle should be flipped.

sentences:
Alpha blend 3D png texture in XNA I'm trying to draw a partly transparent texture a plane, but the problem is that it's incorrectly displaying what is behind that texture.

Pseudo code:

vertices1
basiceffect1
// The vertices of vertices1 are located BEHIND vertices2

vertices2
basiceffect2
// The vertices of vertices2 are located IN FRONT vertices1

GraphicsDevice.Clear(Blue);
PrimitiveBatch.Begin();

//if I draw like this:
PrimitiveBatch.Draw(vertices1, trianglestrip, basiceffect1)
PrimitiveBatch.Draw(vertices2, trianglestrip, basiceffect2)
//Everything gets draw correctly, I can see the texture of vertices2 trough
//the transparent parts of vertices1

//but if I draw like this:
PrimitiveBatch.Draw(vertices2, trianglestrip, basiceffect2)
PrimitiveBatch.Draw(vertices1, trianglestrip, basiceffect1)
//I cannot see the texture of vertices1 in behind the texture of vertices2
//Instead, the texture vertices2 gets drawn, and the transparent parts are blue
//The clear color

PrimitiveBatch.Draw(vertice
PrimitiveBatch.End();

My question is, Why does the order in which I call draw matter?

Edit: Added screenshots

It's like there is no Z buffering at all.
this is done with:
GraphicsDevice.DepthStencilState  = DepthStencilState.DepthRead;
I've tried other settings but they don't help

Edit:
I think I have to somehow set the BlendState of the graphic card in some way so that the textures behind other textures get rendered.

sentences:
How to instantiate new GameObject at position of old GameObject onAnimationComplete I have a GameObject that is a Farmer that plants Seeds. The Seeds will animate into Plants. Once that animation is complete, I'd like to replace my Seed with a Plant. This happens hundreds of times per game at arbitrary positions. I've tried this as something I built off of this question: Unity: detect animation's end

public class SeedScript : StateMachineBehaviour {
[SerializeField] private GameObject seed;
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    Destroy(this);
    animator.GetComponent<TreeScript>().GrowTree(seed);
    Instantiate (tree, this.position,  this.rotation);
}

}

Obviously, this doesn't work at all. Doesn't even compile.

I've also looked at these co-routines: https://answers.unity.com/questions/981948/statemachinebehaviour-startcoroutine.html but again, I need to get position data from the animating object.

Yes, I could just merge my Seed and Plant classes together, let's pretend I cannot do that and MUST instantiate some arbitrary new object at the position of another object on some animation completion.

sentences:
How to "place" object in a 3d world without overlapping them ? I would like to place object  in a 3d world "like minecraft player can do".

What I'm trying to do is to allow the user to place objects, without overlapping them (like in minecraft you can do).

So if the player try to place an object partially over another, my  game automatically "move and place" the object in the allowed position.

What can be the right approach ?

sentences:
Web games are being played less by the year, is this only on PC, or also on Mobile? I just came from reading the NewZoo 2016 global game market report. The last time I read it, I noticed that the web game's segment was less than the years before (it was 5% in 2016, 6% in 2015, 9% in 2014, and 10% in 2013)

But these are all for users who accessed games using their PCs not mobile phones. And if you've been following the current trends of game portal websites, you'll notice that they are moving to mobile. Both Kongregate and Miniclip, two very big gaming portals, have started publishing games on the two major app stores. They (and the larger part of web game publishers) will usually reject any HTML game doesn't support mobile. So they are definitely aware of this trend.

So now my questions is: what are the stats when it comes to web games on mobile?
 Does anyone know any resource that has stats on this?

sentences: When should rendering be performed during a frame? When working with OpenGL or DirectX, should draw calls be done all at once, at the end of the update loop, or is it better to have draw calls occur during the update loop rather than just at the end?

sentences:
Detecting extremely fast joystick button presses? Is it usually possible for the player to press and release a button within a single frame, so that the game engine doesn't have time to detect it?

How do programmers usually handle this situation?  Is it even necessary to handle it?

While testing, I was able to press and release a button within about 14 or 15 milliseconds (over 1 click/frame).  I was not, however, able to do this while holding the joystick normally, and the press-release cycle would have to start at almost the exact time the frame starts.

Specifically, I am asking about GLFW's joystick input capabilities.

I am currently using GLFW to make a game, and I've noticed that keyboard and mouse have callback functions, while joysticks do not.  Also, it does not appear to be possible to enable "sticky keys" for a joystick.  (I have only recently started using GLFW, so please correct me if I am wrong, as having either of those would solve the problem.)

Although I am asking about GLFW, answers related to any library/engine/language are welcome.

sentences:
Updating game objects already placed in scene I have about 20 game objects placed in certain positions in my scene.  I then realized i need to attach two additional game objects to each one of these as children.

Is there a simple way of doing this?  I really don't want to remove them all update the prefab and then place them back.

Is there a way that i can add the two children to the prefab and all 20-something objects in the scene will also be updated?

sentences:
Deleting Objects Before Export from Maya Causes .PSK to Crash UDK on Import I'm using Maya 2008 Complete and 03/11 build of UDK as well as 07/10 build (haven't got around to installing newer version on other computer). I am using ActorX to export.

I have a character that I have rigged and animated (I'm not using UDK rigs).

Here was my process:

Early on in the process, I had other objects skinned to the character's skeleton.
I hid those objects while weighting the character
I decided later that I wanted to delete them.
I tested my .psk in both UDK builds with those objects hidden and noticed that they still showed up (in UDK)
So, I went back into Maya, detached the skin on those objects and deleted history, then deleted them.
I then re-exported my .psk and now when I try and import, udk crashes.

Here are my input/output connections for one of the objects before detaching the skin.

http://i.stack.imgur.com/hoDdv.jpg

Here is my log:

0002.77] Log: >>>>>>>>>>>>>> Initial startup: 2.77s <<<<<<<<<<<<<<<
[0002.81] Cmd: MODE MAPEXT=udk
[0002.87] SourceControl: Source Control disabled in GAMEEditorUserSettings.ini.  [SourceControl] has Disabled=False
[0005.61] Log: TIMER ALL OF INIT : [5.028131]
[0070.42] Log: FactoryCreateBinary: SkeletalMesh with SkeletalMeshFactory (0 0 Z:\websterProject2\EXPORTTESTING\SK_snailMesh01.PSK)
[0070.42] Log:  * Skeletal skin VPoints            : 812
[0070.42] Log:  * Skeletal skin VVertices          : 1166
[0070.42] Log:  * Skeletal skin VTriangles         : 1596
[0070.42] Log:  * Skeletal skin VMaterials         : 1
[0070.42] Log:  * Skeletal skin VBones             : 73
[0070.42] Log:  * Skeletal skin VRawBoneInfluences : 1520
[0070.42] Log:  * Skeletal skin VertexColors          : 0
[0070.42] Log:  * Skeletal skin Num Tex Coords    : 1
[0070.42] Log:  Mesh material not found among currently loaded ones: lambert3SG
[0070.42] Log: Bones digested - 73  Depth of hierarchy - 15
[0070.49] Critical: appError called: Assertion failed: Wedges.Num() == WedgeInfluenceIndices.Num() [File:c:\depot\UnrealEngine3\Development\Src\Engine\Src\UnSkeletalTools.cpp] [Line: 301]
Stack: Address = 0x402228f9 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x40924bb1 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412bfbc8 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x401a178d (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412964a4 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x412823a4 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\UDK.exe]
Address = 0x983633   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x983d73   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x983e30   (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_vc_custom_64.dll]
Address = 0x800a34c6 (filename not found) [in C:\UDK\UDK-2010-07\Binaries\Win64\wxmsw28u_core_vc_custom_64.dll]
Address = 0x800aec65 (filename not found) [in C

I would like to know why deleting these objects is causing the .psk to crash on import and how I can fix it.

Thanks very much for your time.

sentences:
Event/Trigger System Architecture The Plan

I am up to write write an own Trigger/Event System, an event engine or how you call it. I would like to achive something similar to Blizzard's most level editors, like Starcraft 1-2, Warcraft level editors.
They are all kind of event/trigger based, you can set actions, conditions which actually control the gameplay itself. What do you think, what would be the best architecture for this event/trigger system?

The Architecture

I thought it would look something like this:

EventManager - would handle the events, checking if the conditions
meet for any event,
                  and calls the event if so.
EventHolder - would hold the list of the events.
EventEntity - would have an ID, the actions' ID and the params for
them.

Every entity, enemies, player and other stuff would have an ID in the world, which would help to get the entity itself and fire a trigger on it.
Obviously, there would be finit and pre-set BASIC actions, but that would be stored by the current project itself. The project could pass the EventSet (list of EventEntity) to the EventHolder. Thus this whole event/trigger system would be very flexible, and could compile it as a DLL for use in future projects.
Do you have any better solution for this? Or some pro tips that I could use? Would really appreciate any help! Thanks!

Edit:
This picture shows it quite well:

Edit2:
I have wrote a raw architecture of a possible "engine", but it is missing some MAIN points:

{Initializing}

//in order
[Game]--set event list--[EventManager]--requests list of EventEntity--[Game]--sends list of EventEntity--[EventManager]

{EventManager loop}

[EventManager]--checks if any of the events meet in an EventEntity
[EventManager]--if any meets--[EventManager]--checks if all of the conditions are meeting in the EventEntity
[EventManager]--if all meets--[EventManager]--fires actions of the EventEntity

{Architecture of the Models}

[EventEntity] contains
- [List of Event Models]
- [List of Condition Models]
- [List of Action Models]

[EventModel] contains
//quite similar to the ConditionModel, an event only should fire, aka check the conditions and
//fire the actions, if these special conditions, happenings, events are fired
//like a unit dies, player reaches a specific position, etc.

[ConditionModel] contains
//model must simulate AND, OR logic statements
//model must simulate IF statements

[ActionModel] contains
- [List of Targets]
- [List of Action IDs] //One action per Target, a specific Target can be listed more than once in the [List of Targets]
//something is missing

Trying to write the "system" as standalone as possible, it must not depend on any project's source. Thus I think the best would be to seperate the data from the architecture, could store the event, condition and action datas in another DLL unit, and could read from that.

sentences:
How to make sure an object NEVER passes through an edge collider (2D)? In my top down perspective game, I have a ball that bounces off of walls. The ball should behave in a way where it will always bounce off in a 90 degree angle. The ball can only move up, down, left and right and the walls are slanted so that they should always (theoretically) bounce a ball up, down, left or right.

On the ball object, I have a small circle collider 2D and a Rigidbody 2D attached, the walls have a single edge collider 2D attached. Approximately one time out of twelve times, the ball will simply pass through the edge collider, so it's not consistent.

How can I make sure that the ball always registers the collision?

Here's my setup:

The script I use to move the ball:

void Update () {
    switch (direction)
    {
        case 'u':
            transform.Translate(0f, ballSpeed * Time.deltaTime, 0f);
            break;
        case 'd':
            transform.Translate(0f, ballSpeed * -1 * Time.deltaTime, 0f);
            break;
        case 'l':
            transform.Translate(ballSpeed * -1 * Time.deltaTime, 0f, 0f);
            break;
        case 'r':
            transform.Translate(ballSpeed * Time.deltaTime, 0f, 0f);
            break;
    }
}

Additional info:
 - every wall is it's own object with it's own edge collider.
 - the ball always hits the center of the wall because I center the ball object using the center of the wall it touches. Note: I had issues with the ball passing through walls even before I implemented the centering.

sentences:
How can I stop the next screen from briefly displaying at the start of a CCTransitionFadeTR? I am testing transitions in cocos2d, and am running into a problem.

I have a MainMenu screen which contains a button.  The idea is that clicking on the button will trigger a CCTransitionFadeTR transition to a WhackMain screen where there is a CCLabelTTF which displays "Hello World".

But when I press the button and start the transition, the WhackMain screen appears at full opacity for a moment before the transition from MainMenu to WhackMain begins.  The transition appears to be working correctly, apart from WhackMain being visible for a moment before the transition begins.

How can I keep this from happening?

Here is my code, if it will help identify the problem:

MainMenu.m:

#import "MainMenu.h"
#import "WhackMain.h"

@implementation MainMenu

+(CCScene *) scene1 {
// 'scene' is an autorelease object.
CCScene *scene1 = [CCScene node];

// 'layer' is an autorelease object.
MainMenu *layer1 = [MainMenu node];

// add layer as a child to scene
[scene1 addChild: layer1];

// return the scene
return scene1;
}

-(id) init {
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    CGSize winSize = [[CCDirector sharedDirector] winSize];

    // Create a label for display purposes
    _label = [[CCLabelTTF labelWithString:@"Last button: None"
                               dimensions:CGSizeMake(320, 50) alignment:UITextAlignmentCenter
                                 fontName:@"Arial" fontSize:32.0] retain];
    _label.position = ccp(winSize.width/2,
                          winSize.height-(_label.contentSize.height/2));
    [self addChild:_label];

    // Standard method to create a button
    CCMenuItem *starMenuItem = [CCMenuItemImage
                                itemFromNormalImage:@"ButtonStar.png" selectedImage:@"ButtonStarSel.png"
                                target:self selector:@selector(starButtonTapped:)];

    // position the label on the center of the screen
    starMenuItem.position =  ccp( winSize.width /2 , winSize.height/2 );

    CCMenu *starMenu = [CCMenu menuWithItems:starMenuItem, nil];
    starMenu.position = CGPointZero;
    [self addChild:starMenu];
}
return self;
}

- (void)starButtonTapped:(id)sender {
  [_label setString:@"Last button: *"];
  [[CCDirector sharedDirector] replaceScene:[CCTransitionFadeTR
                                           transitionWithDuration:2 scene:[WhackMain scene2]]];
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc {
[super dealloc];
}

@end

WhackMenu.m:

#import "WhackMain.h"
#import "MainMenu.h"

@implementation WhackMain

+(CCScene *) scene2 {
// 'scene' is an autorelease object.
CCScene *scene2 = [CCScene node];

// 'layer' is an autorelease object.
WhackMain *layer2 = [WhackMain node];

// add layer as a child to scene
[scene2 addChild: layer2];

// return the scene
return scene2;
}

-(id) init {
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // create and initialize a Label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

    // ask director the the window size
    CGSize size = [[CCDirector sharedDirector] winSize];

    // position the label on the center of the screen
    label.position =  ccp( size.width /2 , size.height/2 );

    // add the label as a child to this Layer
    [self addChild: label];
}
return self;
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc {
[super dealloc];
 }

@end

sentences:
Converting shader to ShaderGraph Is there a way to convert the below piece of shader code to shader graph?
I am not sure how to find float2(i, i) in shader graph.
fixed4 frag (v2f input) : SV_Target
            {
                float2 res = _MainTex_TexelSize.xy;
                float i = _offset;

                fixed4 col;
                col.rgb = tex2D( _MainTex, input.uv ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( i, i ) * res ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( i, -i ) * res ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( -i, i ) * res ).rgb;
                col.rgb += tex2D( _MainTex, input.uv + float2( -i, -i ) * res ).rgb;
                col.rgb /= 5.0f;

                return col;
            }

sentences:
How can I cancel a contact in a b2ContactListener? To know when contacts happen we can derive from b2ContactListener and implement our own solution which is great. I'm wondering is there anyway we can cancel a contact, that is to say when we hit begin contact we call a function or do something to destroy the contact before it has a chance to be resolved?

My game logic relies on setting any number of collision groups (which are basically integers). Collision groups can have settings to interact with one another, for example collision group 41 and 13 may be set to never collide while group 41 and 56 will collide. Some groups which are set not to collide are still meant to generate an OnContact callback (but will obviously never get to end contact).

sentences:
Get GameObject to bounce of colliders I am making a Atari Breakout game with unitys 2d tools and I need to get the ball to bounce of colliders in the scene. If you havent played the game before how it works is if the ball hits the wall at 45 degrees it will bounce of the wall at the same angle (diagram bellow)

How can I get the ball to move at a continues speed and when it hits a collider to bounce back the way the image shows?

sentences:
How do I size my map in blender so it will be the right size in unity? I am working on a fps game but I cant get the size right of my map in blender, every time I export it to a .fbx file (unity won't work if it is a .blend file) it is a super small plane floor in unity the player controller is 10 as big as the map.
I don't know what to do.

sentences:
How do I make so when user moves the camera it doesn't go beyond the scene borders in Unity3D? How do i make so when i move my camera, it doesn't go beyond the border of the canvas while playing. This is the script i use to make the camera move:

        if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved)
    {
        Vector2 touchDeltaPosition = Input.GetTouch (0).deltaPosition;
        transform.Translate (+touchDeltaPosition.x * speed, +touchDeltaPosition.y * speed, 0);
    }

sentences:
Slick2D Isometric TiledMap Rendering Problem I created a Tiled Map using the Tiled Map Editor. In the Editor it looks like this:

Desired State

In my java program it looks like this:

Actual State

My java code is:

public class Game extends BasicGame {

    private TiledMap map;

    public static void main(String[] args) throws SlickException {
        AppGameContainer app = new AppGameContainer(new Game());

        app.setDisplayMode(800, 600, false);
        app.setShowFPS(true);
        app.start();
    }

    public Game() {
        super("Test");
    }

    @Override
    public void render(GameContainer arg0, Graphics arg1) throws SlickException {
        map.render(300, 200);
    }

    @Override
    public void init(GameContainer arg0) throws SlickException {
        map = new TiledMap("res/unbenannt.tmx"); //path is valid!
    }

    @Override
    public void update(GameContainer gc, int arg1) throws SlickException {

    }
}

The orientation of the map is isometric. I'm working under Linux Mint, Java 6, eclipse with the latest Slick2D and LWJGL Library.

Did I forget anything? Why am I getting such a weird looking map rendering?

sentences:
TiledMap renders but gets duplicated when I move the camera I've created a map (TMX file) using Tiled, imported it and it shows great but when I move the camera, it duplicates itself and the whole screen flickers.
In Tiled, I didn't use a spritesheet but rather a collection of images as they have different sizes.

See attached image:

Here is my game class:

public class MyGdxGame extends ApplicationAdapter {

    private IsometricTiledMapRenderer renderer;
    private OrthographicCamera camera;
    private TiledMap map;
    private Vector2 dragOld, dragNew;

    @Override
    public void create() {

        map = new TmxMapLoader().load("isometric_map.tmx");
        renderer = new IsometricTiledMapRenderer(map);

        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);

        Gdx.input.setInputProcessor(new InputAdapter() {
            public boolean touchDown(int screenX, int screenY, int pointer, int button) {
                if (button == Input.Buttons.LEFT) {
                    dragNew = new Vector2(Gdx.input.getX(), Gdx.input.getY());
                    dragOld = dragNew;
                    return true;
                }

                return false;
            }
        });
    }

    @Override
    public void render() {
        super.render();

        camera.update();

        renderer.setView(camera);
        renderer.render();

        if (Gdx.input.isTouched()) {
            dragNew = new Vector2(Gdx.input.getX(), Gdx.input.getY());
            if (dragOld != null && !dragNew.equals(dragOld)) {
                camera.translate(((int) dragOld.x - dragNew.x), ((int) dragNew.y - dragOld.y)); //Translate by subtracting the vectors
                camera.update();
                dragOld = dragNew; //Drag old becomes drag new.
            }
        }
    }

    @Override
    public void resize(int width, int height) {
        super.resize(width, height);

        camera.viewportWidth = width;
        camera.viewportHeight = height;
        camera.update();
    }

    @Override
    public void dispose() {
        super.dispose();

        map.dispose();
    }
}

What am I missing?

sentences:
How do I sense when the player collides with a door in a GameController script? I want to be able to sense when the player collides with a door from my GameController script. The player is a public GameObject and doors are tagged as such. Here is psuedo code for what I'm looking for:

public class GameController : MonoBehaviour
{
   public GameObject player;

   void Update()
   {
      if(player collides with game object tagged "Door")
         do something
   }
}

sentences:
How to profile CPU and GPU performance if I have a monster PC? I'm going to upgrade my PC soon. I'm worried that I will no longer spot performance losses in my game because of the better specs.

I can check memory usage easily, but how do I check and debug CPU and GPU usage? I used to rely on the framerate, but I guess that it is not accurate.

sentences: What do I need to legally use copyrighted music in my game? I asked the singer of a song I am using, and he agreed to me using his music, provided I credit him. Do I need anything else, such as an agreement or signature?

sentences:
Normals in my skinned model are not animated I have a blender skinned mode with animation. Normals look like they are messed up. This is how it looks in Unity3D before and after animation.

As you can see, my model should be lit up just like the cube next to it. When I apply Armature modifier in blender, my model looses animation and its locked in particular position, but the light on that model works.

My question is: The normals are set as they would be for a static model, not for a animation. Why are normals not animated ?

sentences:
Navigate UI with Dpad from Xbox controller on Mac [Unity]? So, according to some documentation I found, the Xbox controller on Mac does not return Dpad presses as vertical/horizontal axes:

As you can see, the Dpad is only recognized as buttons 5, 6, 7, and 8, and not as horizontal/vertical axes. For my character's movement, I just created code that returns 1 or -1 for axis depending on the button pressed. It works perfectly fine. But then I found another problem: UI navigation.

I can't navigate my menus with the Dpad on Mac because the the EventSystem is expecting navigation via horizontal/vertical axes, which the Dpad is not providing.

Is there any way I can turn these Dpad button presses into real horizontal/vertical axes in Unity's Input system? Or is there something else I can do to make UI navigation happen on a Mac, with the Dpad?

sentences:
I'm rotating an object on two axes, so why does it keep twisting around the third axis? I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can refer users to when this comes up - with lots of animated examples! :)

Let's say we're making a first-person camera. The basic idea is it should yaw to look left & right, and pitch to look up & down. So we write a bit of code like this (using Unity as an example):

void Update() {
    float speed = lookSpeed * Time.deltaTime;

    // Yaw around the y axis using the player's horizontal input.
    transform.Rotate(0f, Input.GetAxis("Horizontal") * speed, 0f);

    // Pitch around the x axis using the player's vertical input.
    transform.Rotate(-Input.GetAxis("Vertical") * speed,  0f, 0f);
}

or maybe

// Construct a quaternion or a matrix representing incremental camera rotation.
Quaternion rotation = Quaternion.Euler(
                        -Input.GetAxis("Vertical") * speed,
                         Input.GetAxis("Horizontal") * speed,
                         0);

// Fold this change into the camera's current rotation.
transform.rotation *= rotation;

And it mostly works, but over time the view starts to get crooked. The camera seems to be turning on its roll axis (z) even though we only told it to rotate on the x and y!

This can also happen if we're trying to manipulate an object in front of the camera - say it's a globe we want to turn to look around:

The same problem - after a while the North pole starts to wander away to the left or right. We're giving input on two axes but we're getting this confusing rotation on a third. And it happens whether we apply all our rotations around the object's local axes or the world's global axes.

In many engines you'll also see this in the inspector - rotate the object in the world, and suddenly numbers change on an axis we didn't even touch!

So, is this an engine bug? How do we tell the program we don't want it adding extra rotation?

Does it have something to do with Euler angles? Should I use Quaternions or Rotation Matrices or Basis Vectors instead?

sentences:
Could not establish connection with local server process when opening or making Unity project Whenever i try to either create or open a Unity project, I get faced with this error.

Does Unity need a proxy server, because I dont have one. (If so, how do I get one?) And
apparently I need to add some environment variables, (HTTP_PROXY, HTTPS_PROXY and
UNITY_NOPROXY=localhost,127.0.0.1) what values do i add to these?

Unity Package Manager Diagnostics (v0.1.5)

Ran 7 checks

1 succeeded

6 failed

❌ UPM registry reachable (FAIL)
Make an HTTP request to the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Ping UPM registry (FAIL)
Measure the latency of the UPM package registry API

    No successful pings could be made in 0.062 seconds (30 failed)

❌ Ping UPM download (FAIL)
Measure the latency of the UPM package download endpoint

    No successful pings could be made in 0.039 seconds (30 failed)

❌ UPM registry download speed (FAIL)
Test the Internet connection using the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Speedtest.net (FAIL)
Test the Internet connection using Speedtest.net

    Connection error. This could be because a proxy is misconfigured.

✅ HTTP proxy environment variables (PASS)
Detect whether proxy-related environment variables are set (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, UNITY_PROXYSERVER, UNITY_NOPROXY)

    Proxy support has been configured through the following environment variables:
    HTTPS_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    HTTP_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    UNITY_NOPROXY = C:\Program Files\Unity Hub\Unity Hub.exe

❌ UPM health check (FAIL)
Start the UPM process and call its health endpoint

    Server started but did not respond to health requests:
    Error: Invalid protocol: c:

How do I fix this?

sentences:
Structure for attacking in RPG I'm going over different ways to implement attacking in a "dungeon crawler".

What I have kind of abstracted out...

There are 2 kinds of people, The Player, and the enemies, these are both living creatures.

Living Creature will the the superclass for all living entitie's in the game(NPC is still a little murky...

Player and Enemy both use weapons, even it is only a fist.

I have decided that creating a Attack, on the weapon superclass, may be the best way to implement.

LivingCreature.Weapon.Attack(LivingCreature) will be the implementation.

This means no player attacks anything, the weapon itself will be the attacker. My question is, are there any negative side effects to this that I am not seeing. I have looked through some different design structures of games, and I haven't seen this exact implementation, and wasn't sure why.

To clarify-

Should Player have knowledge of how attacks works, or should the weapon know how attacks work.

sentences:
FindNextValidTechnique fails My effect file compiles successfully, but FindNextValidTechnique fails.

Technique part of the shader:

technique Diffuse
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VertexShaderMain();
        PixelShader = compile ps_2_0 PixelShaderMain();
    }
}

I try to get the first valid technique after compilation:

pEffect->FindNextValidTechnique(NULL, pValidTechnique);

This returns some minus value which doesn't go along with D3D_OK.

I've used other flags than D3DCREATE_HARDWARE_VERTEXPROCESSING to test, but no result with them either.

UPDATE

I've read in documentation that, "Applying Compiler Flags or Assembler Flags to the incorrect API will fail shader validation.", but I'm not sure this applies to the compile time validation or afterwards. I have no problem in compile.

I compile with these flags:

D3DXSHADER_DEBUG |
D3DXSHADER_NO_PRESHADER |
D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT |
D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT

sentences:
Creating and joining a multiplayer game over a LAN I'm trying to create and join a multiplayer game that has been created from a custom UDK installation.

It works correctly when two (or more) instances of the game are created on the same computer and are connected over localhost by running the following commands:

udk.exe server map_name
udk.exe 127.0.0.1

The problem comes when trying to connect to the game server over a LAN (with the command udk.exe server_ip_address); the clients are unable to connect and the default map is loaded. The server log reports a client disconnection from the computer trying to connect. The client log reports the error, Error: Can't start an online game that hasn't been created.

Both computers are able to ping each other, as well as both having their firewalls disabled. Many combinations of the command-line arguments for starting the server have been tried. Creating an installer from the server machine and installing a fresh copy of the game on the client has also been tried.

Any solutions on how to solve this issue would be appreciated.

sentences: Do I really need to "learn" C# for XNA if I know Java? I want to start developing in XNA. As of now, I do not know C#, but I would consider myself "good" at Java. I have looked at some C# code and it looks almost identical to Java. After looking at Java and C# Comparison, it looks like they are basically the same. Obviously some function names are going to be different, but I think I can handle it. Now if I want to learn game development in XNA, do I really need to "learn" and master C#, or can I just jump right in and learn along the way? I should also mention, I also know  PHP which looks very similar.

sentences:
My money will only save for one game run I am trying to make a money system my problem is that the money value only saves for 1 game run then the value returns to 0.
Here is my code. What should I do.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Money : variables {

    public Text cash;

    // Use this for initialization
    void Start () {

        if (counter < 9 && counter > 1)
        {
            money = money + 2;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 10 && counter < 20)
        {
            money = money + 5;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }

        else if (counter > 21 && counter < 30)
        {
            money = money + 15;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 31 && counter < 40)
        {
            money = money + 25;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 41 && counter < 70)
        {
            money = money + 50;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 71 && counter < 100)
        {
            money = money + 75;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 101 && counter < 200)
        {
            money = money + 100;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);
        }
        else if (counter > 201)
        {
            money = money + 150;
            PlayerPrefs.GetInt("money", money);
            PlayerPrefs.SetInt("money", money);

        }

        cash.text = "Credits: " + PlayerPrefs.GetInt("money", money);
    }
}

sentences:
Particle effect in sprite I want to create a particle effect when my player sprite collide with my star sprite. How can I add a particleSystem in the sprite and not in a image?
Also, I wish if it could wait for the animation for some miliseconds, and then remove the star sprite.

This is my code:

- (BOOL)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair starCollision:
    (CCNode *)star playerCollision:(CCNode *)_player {
    NSLog(@"----------Colisao---------");

    //update score
    score += 1;
    [scorelabel setString: [NSString stringWithFormat:@"score: %d",score]];
    NSLog(@"score %d", score);

    CCParticleSystem *particleSystem = [[CCParticleSpiral alloc] initWithTotalParticles:1000];

    [self addChild:particleSystem];
    //[particleSystem release];
    //[particleSystem setTexture:[[CCTextureCache  sharedTextureCache] addImage:@"star.png"];

    //remove stars
    [star removeFromParent];
    return YES;
}

sentences:
Update and merge Unity coordinate systems multiplayer - Hololens Project Summary

Creating a multiplayer HoloLens app that allows players to spawn and move objects around the local space they share.

Problem

I am able to connect to the other HoloLens and see the other player in the correct location but, for some reason the objects that I spawn I offset. I determined that the offset was based off of where the application started off. When developing in HoloLens the device always starts at (0,0,0). However, once the client has connected to the host and imported their world anchor the client's coordinate system is never updated event though the anchor is in the same physical location. This creates a problem because if the client is offset by 180 degrees everything that the host does is offset by the same amount when moving an object if that makes sense.

Moving toward a solution

After doing a lot of research I found this pertaining to sharing and HoloLens:

  "After a GameObject is locked via the LockObject call, it will have a WorldAnchor which will keep it in the same physical position in the world, but it may be at a different location in the Unity coordinate space than other users."

I found this on Microsoft's website here

https://developer.microsoft.com/en-us/windows/mixed-reality/shared_experiences_in_unity

Question

So obviously my question is basically, is there a way to update the x,y,z coordinates of (0,0,0) during runtime?

sentences:
Creating chat bubble using 9-patch and Glyphlayout I'm trying to create a chat bubble using 9patch as my background and text in the front.It is not drawing anything and I am unable to find the mistake in my code.

PS: I've taken some help from prev answers to write this code

Here is my code

 public void render(SpriteBatch sb) {

        chatBubble.drawSpeech(str,(int)Gdx.graphics.getWidth()/2,(int)Gdx.graphics.getHeight()/2,sb);

}

and ChatBubble class is given below:

public class ChatBubble {

    private NinePatch ninePatch;
    private Texture bubble;

    private Random rand = new Random();

    BitmapFont font = new BitmapFont();

   public ChatBubble() {

        bubble = new Texture("bubble.png");
        ninePatch = new NinePatch(new TextureRegion(bubble, 1, 1, bubble.getWidth() - 2, bubble.getHeight() - 2), 10, 10, 10, 10);

    }
    int textBoxBuffer = 5; // Allow for box to surround the text
    int textBoxWidth = 80; // the default width of the textbox
    public void drawSpeech(String str, int x, int y,SpriteBatch sb){
        sb.begin();
        GlyphLayout layout = new GlyphLayout(font,str, Color.BLACK, textBoxWidth , Align.left, true);
        ninePatch.draw(sb,x - textBoxBuffer, y - textBoxBuffer,
                layout.width + textBoxBuffer, layout.height + textBoxBuffer);
        font.draw(sb, layout, x, y);
        sb.end();
    }

}

sentences:
Make 2d sprite move in unity At the moment I have a movement script which moves my player in Bothe directions but it only faces 1 way -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour
{
    public float moveSpeed = 5f;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Jump();
        Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
        transform.position += movement * Time.deltaTime * moveSpeed;
    }

    void Jump()
    {
        if (Input.GetButtonDown("Jump"))
        {
            gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
        }
    }

}

How can I make the sprite face the other way when I move west not east?

sentences: How can I implement gravity? How can I implement gravity? Not for a particular language, just pseudocode...

sentences:
Format for storing quest data Are there any format for storing quest data that can be processed independently by third-party tools? I don't want to code quests in code, because it will be hard to update and extend them, so I just thinking about generic system that allows to submit to a task, track its stages and rules necessary to fulfill some quest conditions and completion of a quest by player.

Basically, I'd like a simple text file for the start, so that errors in description can be easily edited and committed to repository. But I also want to be able run complex queries against quest DB, such as - "for which quests this quest is prerequisite" or "in which quests this component is used" or "what quests are available for a given environment". So the structure of the field in the format is important. I can of course invent my own, but it would save me a lot of hours to start with something workable.

Is there something generic like that?

sentences:
Lua Unknown error when typing something in Zerobrane studio IDE What is this weird error that I am getting when I typing something in the Zerobrane studio IDE? It crashes my IDE. But The game project compiles and runs fine.

When I turn off "Autocomplete Identifiers" from Edit menu, then the error doesn't come up.

Also, I searched entire google and facebook for some help or solution but no luck at all.

sentences:
How to render IDirect3DSurface9 in my window? I have some code that captures the screen and save data into a surface.

g_pDirect3D_Device->GetFrontBufferData(0, pSurface);

All is ok, now I want to display pSurface in my window. I want to have the image in my whole window.

Is it possible, or should I use a texture?

sentences:
Adding 'swerve' to a direction I'm not much of a maths expert, so this is probably quite straight forward. I was playing a soccer flash game where you take free kicks. You provide Power, Swerve and Direction. I'm reading up on vectors and such so I can use the direction and power information to shoot the ball with the correct velocity.

What I don't understand is how the 'Swerve' information is used. What formula connects the Swerve information with the Direction and Power? This is all assuming a 2D environment.

sentences:
Using gl3w and Win32 api, without glut I'm still a beginner, the example on skaslev's site require us to use glut as an interface to create a window.

For some reason, I'm required to create a window purely with Win32 api, but I am not sure of how to integrate it together with gl3w.c

Is there a guide or tutorial on how to do that? I've been searching for hours, seems out of luck :(

sentences:
JBox2D - how to get vertex positions? I've created a triangle for jbox2d...

public void createTri(){

    PolygonDef shape = new PolygonDef();

    shape.density = 2.0f;

    shape.friction = 0.8f;
    shape.restitution = 0.3f;
    shape.addVertex( new Vec2(35/RATE,35/RATE) );
    shape.addVertex( new Vec2(65/RATE,35/RATE) );
    shape.addVertex( new Vec2(45/RATE,55/RATE) );

    BodyDef bodyDef = new BodyDef();
    bodyDef.position.set(50/RATE, 50/RATE);
    bodyT= world.createBody(bodyDef);
    bodyT.createShape(shape);
    bodyT.setMassFromShapes();
}

... but when drawing it on canvas, how to I get position of all the vertexes?

with bodyT.getPosition().x and .y I can get only the center spot.

Thanks!

sentences:
Decoupling Input from Update/Physics Movement in a Game Engine I have some troubles figuring out how to decouple the input handling from the physics part (includes movement).

My Game loop looks like this

while GAMEISRUNNING
    HandleInput()
    Update()
    Render()

From what I have found on the internet I can do something like this in the HandleInput method

HandleInput()
{
    if A key is pressed
        MOVEFORWARD = true
    ...
}

and then in the Update I can just check the boolean flags and update properly. The problem is that my Update method uses the Physics Engine to iterate over the entities and call their Integrate method. This means that I cannot just adjust the position because the integrate method is the same for all the entities.

Integrate(float deltaTime)
{
    #position and velocity are vectors
    position += velocity * deltaTime
}

Where can i actually perform the update to movement in this scenario? I was thinking that in the global Update method I can iterate over all the entities before the physics engine and adjust their velocities. That means that every GameObject will have GameObjectUpdate method and there I can  adjust the velocities accordingly. This means that the global Update method will iterate over all the entities twice. Generally O(n) is pretty good, but I am not sure if this is the optimal way to do it.

sentences:
How do I record scripted rotation changes in animation file? I can create an animation file by clicking "Animation", then selecting a gameobject, then press record and then change bone rotations in the Inspector.
The animation window will be notified about the bone rotation changes and add this to the animation file like this:

This works fine as long as the Inspector is used to change the bone rotations.
Bone rotations done by a script are not recorded.
Is there a trick to record these bone rotations via script anyways?
For example using something like (pseudo-code) this? ->
rShoulder.rotation.dirty = true;

For your interest, I have attached the script that I use to rotate the bones and which are not recorded. This script works perfectly fine, but it doesn't trigger animation changes:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyPlayer : MonoBehaviour
{
    public Transform Target;

    private void OnGUI()
    {
        if (GUI.Button(new Rect(0, 70, 50, 30), "Transfer rotations to other model with same rig"))
        {
            List<Transform> nTheseTransforms = new List<Transform>();
            Helpers.GetAllChildren(this.transform, ref nTheseTransforms);

            List<Transform> nTargetTransforms = new List<Transform>();
            Helpers.GetAllChildren(Target, ref nTargetTransforms);

            foreach (Transform nThisTransform in nTheseTransforms)
            {
                foreach (Transform nTargetTransform in nTargetTransforms)
                {
                    if (nThisTransform.name == nTargetTransform.name)
                    {
                        nTargetTransform.localRotation = nThisTransform.localRotation;
                        break;
                    }
                }
            }
        }
    }
    public static void GetAllChildren(Transform parent, ref List<Transform> transforms)
    {
        foreach (Transform t in parent)
        {
            transforms.Add(t);
            GetAllChildren(t, ref transforms);
        }
    }

}

sentences:
Maya keyframe animation to unity Sorry guys! I am super new to this, and I'm trying to teach myself Unity. I have a very small knowledge of Maya from a 3d modeling course I took a year ago in college, and have made a very simple object and animated it using keyframes (2 keyframes to be exact) in maya, but I can't seem to figure out how to get that animation into Unity.

I've been playing around with this for hours now, and all the tutorials and such I find online are for really complex objects like people, and they have joints and stuff going on. Are joints required for an animation to work in Unity?

I've saved my maya file into my assets folder, but I don't see any animations in the import settings in Unity.

Here is my object:

And it animates to this position:

sentences:
DirectWrite and Set Character Spacing - Trouble using extended DW functionality I'm having a hard time grasping the problem getting the newer/extended functions in dwrite_1.h to work with my existing code and hope that someone here can shed some light.
This is my existing set up...
 // HEADER
IDWriteFactory* pDWriteFactory_ = nullptr;
IDWriteTextFormat* pTextFormat_ = nullptr;
IDWriteTextLayout* pTextLayout_ = nullptr;
IDWriteTextRenderer* pTextRenderer_ = nullptr;

//CPP File in my PrepareText() Fcuntion.
hr = pDWriteFactory_->CreateTextLayout(
    str.c_str(),
    str.size(),
    pTextFormat_,
    gfx.GetWindowWidth(),
    gfx.GetWindowHeight(),
    &pTextLayout_);

I would like to be able to use the IDWriteTextLayout1::SetCharacterSpacing function outlined here :
MSDN Link
However if I change my IDWriteTextLayout* to be IDWriteTextLayout1* I get an error as  pDWriteFactory_ cannot be initialised with an IDWriteTextLayout1 as an argument. This error occurs if I change IDWriteFactory* to an IDWriteFactory1* also.
What am I missing? Many thanks!

sentences:
Why is there high performance hit with many meshes? I am currently reading upon Geometry Instancing, as I want to render a lot of animatable objects on the screen.

However I have come to a more fundamental question first: Why do I even need to use it?

Consider this setup:

A plane as the base of the game world
On top of that a lot of tiles, which can be destructable with the use of a Physics Engine.
A camera which you can control with WASD + mouse for direction.

Now I do understand that there definately must be a performance hit at some point. I thought it would occur when sending all object data (vertices) to the GPU.

However the performance hit remains to be there, at every single frame it renders, what is actually happening in the background? Considering nothing at my scene is changing at all, it even happens when I do not move the camera at all.

I have no clue what exactly is going on and would definately want to read up more about it before starting to fix an issue that I do not understand, thus making the fix also harder to understand. I do know however that the fix (Geometry Instancing) works by sending the vertex data only once per multiple of objects based on that same vertex. So somehow it would have to do with the amount of vertices, yet I don't see what is going on?

Also: I am using the Ogre3D engine, so any specific answers/tips to that engine would also be welcome.

Regards.

sentences:
Align Object With Triangle I currently am trying to figure out how rotate an object so it's aligned with a triangle along the Z Axis. I have the world matrix of the object and a triangle, which has it's 3 points and the normal. My goal is to try and get the y axis of the object to face the same as the triangle's face normal.

Currently, what I have works on normals that are facing the positive y, however if it's facing downward (<0) the the object will rotate the until it's is facing the opposite direction as the triangle's normal.

Here's what I'm doing:

compWorld.GetYAxis( axis );
result = axis.Cross( triColWith->vNormal );
compWorld.Rotate( D3DXToDegree( result.x ), 0, D3DXToDegree( result.z ) );

I would like to thank you in advance for any help you could provide me. If anything needs more explanation, feel free to ask.

sentences:
Mesh-level acceleration structures for collision detection when mesh instances can be rotated, scaled and/or resized Short version: in the mid-phase or narrow-phase of collision-detection, does any acceleration structure organizing the mesh's vertices (e.g. AABB-trees, Octrees, Quadtrees) work for the mesh's instances that are re-scaled, re-sizes and/or rotated?

Long version: suppose a concave mesh composed of a very high number of triangles (e.g. 200k) and for which I cannot use convex decomposition in order to perform collision detection. The most efficient solution usually employed would be to organize the vertices of the mesh using acceleration structures to quickly prune which parts of the mesh are likely to have been collided with.

However, that mesh is used for generating instantiated copies - and each of these can have different size, rotation and/or scale at any of the X,Y,Z axis. Would any acceleration-structures work since the instances can be re-scaled, rotated and resized? Suggestions, tips, academic references, are all appreciated.

sentences: Job based on development Are there any companies that offer jobs based on games or app development by an individual in his profile, with out any certificate from any institution ?

sentences:
OpenGL ES 2 shaders for drawing buildings and roads like Google Maps does I'm trying to create a shader that'll give me an effect similar to what buildings and roads look like on 3D Google Maps. You can see the effect interactively if you enable WebGL at maps.google.com, and I also found a couple of screenshots that illustrate what I'm trying to achieve:

Thing I noticed:

There's some kind of transparency thing going on with the roads/ground and the buildings, but not between the buildings themselves. It might be that they're rendering the ground and roads after the buildings with the right blend functions to achieve that effect.
If you look closely, you'll see parts of the building profiles have an outline. The roads also have nice clean outlines. There are a lot of techniques for outlining things with shaders... but I'm curious to find out what might have been used in this case considering mobile hardware and a large number of entities with outlines (roads and buildings)
I'm assuming that for the lighting, some sort of simple diffuse per-vertex shader is being used for the buildings though I could be wrong.

I'm especially curious about the 'look' they achieved with buildings (clean, precise outlines/shading). It reminds me a little of what you'd see when designing stuff with CAD applications like SolidWorks:

I'd appreciate any advice on achieving this kind of look with ES 2 shaders.

sentences:
Load SpriteFont in XNA I'm planning on my game using multiple backgrounds so I'm trying to use spritefonts to draw the text. Every time I load my spritefont I get a error.

Line1 = content.Load<SpriteFont>("Courier New");
Line2 = content.Load<SpriteFont>("Courier New");

This is the error I get.

Error loading "Courier New". File not found.

Although this was the font listed on the official microsoft website http://msdn.microsoft.com/en-us/library/bb447673.aspx.

sentences: Fixed camera rotate to follow character I have  a camera in a fixed position in the middle of a field, and I would like to rotate the camera to follow the character as it moves around. There is no point lower than the camera, but I would like it to follow vertically as well. Given the point/euler angle of the camera, and the point of the character, what math could I use to implement this?

sentences:
Dirty 2D map rendering I keep hearing people talk about "dirty rendering" when it comes to map rendering for HTML5. I've Googled and searched the GameDev about it but there isn't much about it.

What exactly is it?
How to implement it properly?

sentences:
Why are character-classes used in game design? We had a long discussion in my company about character-classes. We are building a skill based game where you will eventually need to select 8 to enter a battle. I am a fan of classless systems, I have always felt that they are created to extend your gameplay hours in a fake way.

We reached a few conclusions:

Classes are there to prevent "best build" scenario where everyone plays with optimal (Personally I feel that this is a weak case, You should be able to design a system where there is no win combination without classes)
Classes create variety by offering different style of play (I agree with this but if you have the freedom to combine different skills you can actually create your own class)
Classes make choosing style of play easier to players. Most of the times players play the same type of character in different games. (Damage Dealer, Healer, Thief/Assassin etc.) (For me this makes most sense from all the arguments from above, but why force people to only part of the skills when you could offer them as templates)

Why are character-classes used in game design? Do you agree with the above points? Yes or no, why do you think like that?

sentences:
xna 2.5d gravity system i currently developing a game using the xna API.

now the game i am developing is 2.5d.

by 2.5d i mean the character or object can move left and right and a up and down(not just by jumping) that it would look like there is depth to the level.

try to think something like little fighter 2 where you can also walk up and down.

now i need to develop a gravity system,so far i used the idea that i draw a shadow on the ground of the level,and it follows the object or character and when the character jumps,he moves parabolic like in the real world(using very simple physics).

the gravity system detects landing if the position of it's shadow is the position of the character( or the position of the character is below the position of the shadow). is there a better way to simulate gravity in this 2.5d approach?

sentences:
Maya depth buffer plus OpenGL depth buffer I am trying to write an plugin for Maya, using -among other things- OpenGL. Everything works fine so far, but the final Maya scenario is not taking into account the OpenGL depth buffer (or OpenGL is not taking into account the Maya depth). Hence, OpenGL things always appear "over" the Maya native objects.

I looked at the Maya's documentation and I found out that you can get Maya's depth may through MStatus M3dView::readDepthMap function, which basically returns a float array with Maya's depth.

I am now in a situation where I have two float arrays, one with OpenGL depth's and another with Maya's depth, and I believe I should combine them both somehow to get a final render in Maya that would respect both depth maps.

So, the question is, is there anyway to "add" depth information into OpenGL's renderbuffer / depthbuffer? Or... I am trying a completely wrong approach and there's a much nicer and better way to do this?

Thanks a lot!

sentences:
Android, apply a pixelshader on a canvas Can an opengl pixelshader be applied on a Canvas?

I want to render a bitmap on a canvas, then apply a pixelshader to get, for example, a blur effect. Is this possible?

I don't want to simulate the blur effect by creating a new bitmap and then blur this from java code because i'd like to be able to re-use the shaders in openGL apps too.

sentences: What middle tier and backend libraries exist for handling player matching and out of game information? Are there any libraries or frameworks readily available that handle player metrics, rankings, matching, tournaments, etc? Anything for managing the player community? (Please don't say DotNetNuke)

sentences:
How to add highlights or descriptions to the Unity Editor interface Is there a way to develop a Unity learning program that runs within the Unity Editor?

For example, I want to create something like a highlight or a description on the Unity UI.

sentences:
How to await async operations / coroutines? I'm looking for a generic / reusable way to wait for coroutines and asynchronous operations to finish in Unity 5, similiar to C#5's await keyword.

The simplest way I can think of is something like this:

 public class SomeUtility {
     public bool IsDoingSomething { get; private set; }

     public IEnumerator DoSomethingAsync() {
         IsDoingSomething = true;
         yield return new WaitForSeconds(2);
         IsDoingSomething = false;
     }
 }

and then in another coroutine:

 while(!someUtilityInstance.IsDoingSomething)
     yield return null;

However this is not very nice because it clutters the code with while statements, is not reusable (needs instances and dedicated classes even for simple utility functions!) and a lot of singleton or static stuff where it's not even needed.

The closest I found is using Unity's AsyncOperation. This here works very nicely:

public static IEnumerator Await(this AsyncOperation operation) {
    while(!operation.isDone)
        yield return operation;
}

yield return SceneManager.LoadLevelAsync("blaaaah").Await();

However.. the problem is: How to create an AsyncOperation? A few services, for examples SceneManager are using it, but the documentation completely lacks anything about creating custom operations or wrapping existing coroutines etc.

So, is there a way to create a simple, generic and resuable "await" for custom coroutines?

sentences:
How to specify colour in a single 32 bit value I'm writing my first game using OpenGL 2 ES (for Android), and I've currently got a particle engine and some player sprites running successfully.  I'm using 4 floats for the colour of each particle which seems like total overkill.  It makes sense that I should be able to use a single 32 bit int (or perhaps a single float) to hold the colours (perhaps in RGBA format) which would presumably save a lot of unnecessary loading/copying/processing,  but I'm struggling to understand how I could do this.

I guess that I would need to change the shaders to take the relevant format, and also i'd need to change the way I load the color shader attribute.  My fragment shader has:

varying vec4 v_Color;
gl_FragColor = v_Color * texture2D(u_TextureUnit, gl_PointCoord);

and the attribute (passed into the fragment shader from the vertex shader) is set up with:

glVertexAttribPointer(aColourLocation, COLOUR_COMPONENT_COUNT, GL_FLOAT, false, BYTES_PER_VERTEX, floatBuffer);

I've searched the documentation for what I should change vec4 and GL_FLOAT to, and what/how I'd multiply the colour with the texture, and have tried a few things but with no success.

sentences:
How can I efficiently form terrain from a large number of cubes in XNA? I have a project with a floor built from with small cubes (100x100 of them).
If I exceed that size, the performance of my game suffers. How can I efficiently draw a larger number of identical models?

Here's how I'm currently drawing the ground:

    //Function to draw my ground ( 100 X 100 X 1)
    public void DrawGround(GameTime gameTime)
    {
        // Copy any parent transforms.
        Matrix[] transforms = new Matrix[this.model.Bones.Count];
        this.model.CopyAbsoluteBoneTransformsTo(transforms);

        //loop 1 cube high
        for (int a = 0; a < 1; a++)
        {
            //loop 100 along cube
            for (int b = 0; b < 100; b++)
            {
                //loop 100 cubic wide
                for (int c = 0; c < 100; c++)
                {
                    // Draw the model. A model can have multiple meshes, so loop.
                    foreach (ModelMesh mesh in this.model.Meshes)
                    {
                        // This is where the mesh orientation is set, as well
                        // as our camera and projection.
                        foreach (BasicEffect effect in mesh.Effects)
                        {
                            effect.EnableDefaultLighting();
                            effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(this.position);
                            effect.View = this.view;
                            effect.Projection = this.projection;

                        }

                        // Draw the mesh, using the effects set above.
                        mesh.Draw();
                    }
                }
            }
        }
    }

I think it is better to use the a vertex buffer, but I have not found a tutorial for that I want to do. Can you explain how I can do this?

sentences:
XNA: Non-overlapping shadows I want to create an effect similar to the following in XNA / MonoGame:

There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the shadows merge without darkening their overlapping region!

My current approach was the following:

Render all required shadow objects using a DepthStencilState and a AlphaTestEffect.
Then, render a single-pixel semitransparent black texture over the entire screen using another DepthStencilState to display shadows.

However, it didn't work as expected: the shadow objects get rendered to the target, and the stencil buffer seems unaffected.

Here's what I want:

A way to render a sprite to Stencil Buffer only, with absolutely no visible modifications to the target.
A way to render a semitransparent texture using the stencil buffer.

Stencil states and effects are initialized as follows:

StencilCreator = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Always,
    StencilPass = StencilOperation.Replace,
    ReferenceStencil = 1
};

StencilRenderer = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Equal,
    ReferenceStencil = 1,
    StencilPass = StencilOperation.Keep
};

var projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
var halfPixel = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

AlphaEffect = new AlphaTestEffect(GraphicsDevice)
{
    DiffuseColor = Color.White.ToVector3(),
    AlphaFunction = CompareFunction.Greater,
    ReferenceAlpha = 0,
    World = Matrix.Identity,
    View = Matrix.Identity,
    Projection = halfPixel * projection
};

MaskingTexture = new Texture2D(GameEngine.GraphicsDevice, 1, 1);
MaskingTexture.SetData(new[] { new Color(0f, 0f, 0f, 0.3f) });

What am I doing wrong?

sentences:
LibGDX collision with rectangle and circle I have 2 objects, A and B, both are classes with only values, so positions and dimensions are only values (float posX,posY).

I have a render class which render A and B with shapeRenderer; A is rendered as a rectangle and B as a circle, how could check if there is a collision ?

edit:  I have a rectangle coming from up, when it hits the circle I have to stop the game

sentences:
Conservation of energy of a bouncy ball in Unity3d My problem is that in the project I have a ball with a physicMaterial where:

Dynamic Friction and Static Friction both are 0
Bounciness = 1
Friction Combine is set to Multiply
Bounce Combine is set to Maximum

This ball has a rigid body attached in which:

mass = 1
drag  and angular drag both are 0
useGravity = true

There are some cubes which create a boundary for the ball to bounce inside.
The ball bounces in a closed boundary. The problem is overtime its top velocity keeps on increasing and after sometime it gets out of the boundary.

I want the velocity of this ball to NOT exceed a provided maxVelocity. Here i am sharing my project through google drive  bounceProblem.unitypackage

sentences:
Unreal Engine - Scaleform - How do I capture a button click event? I'm new to Unreal Development.

In a nutshell, how do I create a button, install it in a basic game, and capture the button click event?

sentences:
Problems about oriented bounding boxes collision detection I get a question for the following code which detects if two OOBs collide by SAT. The OBBs struct is also listed below.

struct OBB {
Point c; // OBB center point
Vector u[3]; // Local x-, y-, and z-axes
Vector e;  // Positive halfwidth extents of OBB along each axis
}

int TestOBBOBB(OBB &a, OBB &b)
{
float ra, rb;
Matrix33 R, AbsR;
// Compute rotation matrix expressing b in a’s coordinate frame
for(inti=0;i<3;i++)
   for(intj=0;j<3;j++)
      R[i][j] = Dot(a.u[i], b.u[j]);
//Compute translation vector t
Vector t = b.c - a.c;
// Bring translation into a’s coordinate frame
t = Vector(Dot(t, a.u[0]), Dot(t, a.u[2]), Dot(t, a.u[2]));

// Compute common subexpressions. Add in an epsilon term to
// counteract arithmetic errors when two edges are parallel and
// their cross product is (near) null (see text for details)
for(inti=0;i<3;i++)
    for(intj=0;j<3;j++)
        AbsR[i][j] = Abs(R[i][j]) + EPSILON;

// Test axes L=A0,L=A1,L=A2
for(inti=0;i<3;i++) {
    ra = a.e[i];
    rb = b.e[0] * AbsR[i][0] + b.e[1] * AbsR[i][1] + b.e[2] * AbsR[i][2];
    if (Abs(t[i]) > ra + rb) return 0;
}

// Test axes L=B0,L=B1,L=B2
for(inti=0;i<3;i++) {
    ra = a.e[0] * AbsR[0][i] + a.e[1] * AbsR[1][i] + a.e[2] * AbsR[2][i];
    rb = b.e[i];
    if (Abs(t[0] * R[0][i] + t[1] * R[1][i] + t[2] * R[2][i]) > ra + rb) return 0;
}

// Test axis L=A0xB0
ra = a.e[1] * AbsR[2][0] + a.e[2] * AbsR[1][0];
rb = b.e[1] * AbsR[0][2] + b.e[2] * AbsR[0][1];
if (Abs(t[2] * R[1][0] - t[1] * R[2][0]) > ra + rb) return 0;

//reset code are omitted

For the part "Test axes L=A0,L=A1,L=A2",
why do we multiply each b.e[i] by the component from each axis in a's coordinate frame then add the result together?
I know this part want to project the half positive extents onto each axis in a's coordinate frame, but it should do the dot product with the b.e vector and the projected axis, am I wrong?
(that is b.e[0] * AbsR[0][i] + b.e[1] * AbsR[1][i] + b.e[2] * AbsR[2][i])

For the part "Test axes L=B0,L=B1,L=B2",
It seems a.e vector is multiplied by each axis in a's coordinate frame, why don't transform the a.e vector into the b's coordinate frame since they are not at the same coordinate frame?

For the part "Test axis L=A0xB0",
Why can we get ra and rb values by that arithmetic operation?
What does Abs(t[2] * R[1][0] - t[1] * R[2][0] mean?

sentences:
Finding vector from a vertex to a plane I am trying to implement Dual Contouring, following serveral sources, mainly http://www.sandboxie.com/misc/isosurf/isosurfaces.html
but now I want to implement finding the feature point as explained in this post https://gamedev.stackexchange.com/a/83757/49583

It begins with

  The QEF you are minimizing is simply the total distance to each of the planes that are defined by the intersection point/normal pairs for that cell.

I do have the intersection point, which is just the edge vertices averaged by their densities.
I got the normal by averaging the normal of the edge vertices.
I do it like this :

        //calculate normals by gradient of surface, d(x,y,z) = density function, d0 = density at p0, d1 = density at p1
        Vector3 n0 = new Vector3(d((int)(p0.x+1),   (int)p0.y,      (int)p0.z       ).Value - d0,
                                 d((int)p0.x,       (int)(p0.y+1),  (int)p0.z       ).Value - d0,
                                 d((int)p0.x,       (int)p0.y,      (int)(p0.z+1)   ).Value - d0);
        Vector3 n1 = new Vector3(d((int)(p1.x+1),   (int)p1.y,      (int)p1.z       ).Value - d1,
                                 d((int)p1.x,       (int)(p1.y+1),  (int)p1.z       ).Value - d1,
                                 d((int)p1.x,       (int)p1.y,      (int)(p1.z+1)   ).Value - d1);

        this.normal = Vector3.Lerp(n0,n1,m);

My plane is this :

Vector4 plane = new Vector4(edge.normal.x, edge.normal.y, edge.normal.z, Vector3.Dot(edge.point, edge.normal));

And I have a vertex at (x,y,z),

  Basically, you start the vertex in the centre of the cell. Then you average all the vectors taken from the vertex to each plane and move the vertex along that resultant...

How do I get the vector from the plane to the vertex?

sentences:
Can browser based games be developed without JS/Flash? I have absolutely no knowledge about game development, and for 2 years I have been a web application developer (in PHP & JS).

I'd like to learn game development, and I'd also like to free myself from PHP and Javascript and learn some game related concepts in C/C++/C# (whatever is required for game development).

Can browser-based games be developed in a language like C/C++/C#/Python and not using Javascript or Flash? Additionally, would these be superior (in terms of graphics and browser compatibility,support) to games developed using Javascript/HTML5?

EDIT:

By browser based games I'm looking at this.
Java/Python/C++ which among these would provide a better support for browser game dev (interms of compatibility, graphics)?

sentences:
Java2D Shooting in a line tangent to mouse coordinates I am making a top down shooter in Java and I need to be able to shoot in a line tangent to the mouse coordinates. In other words I need to be able to click my mouse and have a projectile spawn from my player, then move its position in a straight line in the direction of where I clicked. I have tried this already and I have failed miserably, and after looking into it for a while I haven't found a good answer. The code is pasted below, any ideas on what I'm doing wrong?

The mouse angle is calculated like this:

mouseAngle = (float) Math.toDegrees((float) Math.atan2(e.getY() - Player.getY(), e.getX() - Player.getX()));

 VectorMath class

package vector;

public class VectorMath {

    public VectorMath() {

    }

    public static void copyVector(Vector2f v1, Vector2f v2){
        v1.setX(v2.getX());
        v1.setY(v2.getY());
    }

    public static void printVector(Vector2f v){
        System.out.println("x: " + v.getX() + " y: " + v.getY());
    }

}

 Projectile Class

package projectile;

import java.awt.Color;
import java.awt.Graphics2D;

import player.Mouse;
import player.Player;
import vector.Vector2f;
import vector.VectorMath;

public class Bullet {

    private Vector2f pos = new Vector2f(0, 0);
    private float x,y, xVel, yVel, moveSpeed = 0.1f, dX, dY;;
    private float mouseAngle;

    public Bullet(Vector2f pos) {
        VectorMath.copyVector(this.pos, pos);
        VectorMath.printVector(this.pos);
        x = Player.getX();
        y = Player.getY();
        mouseAngle = Mouse.getMouseAngle();
    }

    public void update(){
        xVel = pos.getX() + (((float)Math.cos(mouseAngle)) / moveSpeed);
        yVel = pos.getY() + (((float)Math.sin(mouseAngle)) / moveSpeed);

        dX = x + xVel;
        dY = y + yVel;

        x = dX;
        y = dY;

    }

    public void render(Graphics2D g2){
        g2.setColor(Color.green);
        g2.fillRect((int)x, (int)y, 10, 10);
    }

}

sentences:
Transforming a 2D Grid in 3D Space Hi everyone,

I'm trying to implement a 2D Grid in a simple 3D Editor. Here are some debug-rays I already implemented:

Everything is working as intended as long as the object is not rotated.
For demonstration purpose the box is aligned with the grid center (the purple box).

(I can move the object along the grid without changing the grid location):

Now if I rotate the large white cube I want the grid to rotate as well.

Here is the problem: I dont want the origin of the grid to change it's relativ location. The grid location of the green line should still align with the upper left corner of the large white box.

And I just cannot figure out the offset I have to translate the grid :(

Here is what I've tried:
Calculate the difference between the two collision points (Yellow and Green) and use this as offset but on rotation the offset is too large and the grid is shifting.

Here is the data I have available:

Vector3 Origin = new Vector3();
Vector3 GridPlaneNormal = new Vector3(0, 0, 1);
Plane GridPlane = new Plane(Origin, GridPlaneNormal);
Plane objectPlane = /*.... (it's the plane of the cubes front)*/

Vector3 GridNormalInDirectionOfObject = Vector3.TransformNormal(GridPlaneNormal, Matrix.RotationQuaternion(Object.RotationQuaternion));

float angle = GridPlaneNormal.SignedAngle(GridNormalInDirectionOfObject, GridPlane.Normal);
Vector3 rotationAxis = Vector3.Normalize(Vector3.Cross(GridPlane.Normal, objectPlane.Normal));

Please help me! :)

sentences:
Diamond shaped selection on a staggered iso map I have a staggered isometric tile map and want to do a selection that aligns with the diamond shape of the tiles.

This is what I mean:

So I got two points on screen and their map cell coordinates. How do I iterate over all tiles that are within the selection?

What I got to help with this is a method that gets the neighboring tiles.

sentences:
What can I do to get audio into my game legally? If making a game of my own, what should or what can I do to get audio in game? I understand that just going on the internet, and finding random tracks and putting in my game may raise a whole load of legal issues, but is there any "good" way to get audio in the game?

Basically, if making a game, would it be better to create your own music (regardless of experience) in house, or hire someone outside to do it?

Also, if I want to use music out on the internet, what steps should I take to use that music?

sentences:
Boolean change when clicking the left mouse button (not working) I want to change a boolean when I click the left mouse button, but it doesn't work as expected. I use this method:

if (m.LeftButton == ButtonState.Released && m_Old.LeftButton == ButtonState.Pressed)
{
   if (second)
   {
      second = false; // Boolean changes
   } else
   {
      second = true; // Boolean changes
   }
}

I need a way to tell the code that I only want one change. When I click the left mousebutton, the second boolean changes constantly. The reason for this is that the code keeps executing until m_Old (the old mousestate) is updated. (m & m_Old must be different for this code to run)

An example (when I click the left mouse button once| these are the results for the second boolean):

My mouse update code:

// Mouse stuff
oldMouse = mouse;
mouse = Mouse.GetState();

sentences:
Blender mesh mirroring screws up normals when importing in Unity My issue is as follows:

I've modeled a robot in Blender 2.6. It's a mech-like biped or if you prefer, it kindda looks like a chicken. Since it's symmetrical on the XZ plane, I've decided to mirror some of its parts instead of re-modeling them. Problem is, those mirrored meshes look fine in Blender (faces all show up properly and light falls on them as it should) but in Unity faces and lighting on those very same mirrored meshes is wrong. What also stumps me is the fact that even if I flip normals in Blender, I still get bad results in Unity for those meshes (though now I get different bad results than before).

Here's the details:

Here's a Blender screen shot of the robot. I've took 2 pictures and slightly rotated the camera around so the geometry in question can be clearly seen:

Now, the selected cog-wheel-like piece is the mirrored mesh obtained from mirroring the other cog-wheel on the other (far) side of the robot torso. The back-face culling is turned of here, so it's actually showing the faces as dictated by their normals. As you can see it looks ok, faces are orientated correctly and light falls on it ok (as it does on the original cog-wheel from which it was mirrored).

Now if I export this as fbx using the following settings:

and then import it into Unity, it looks all screwy:

It looks like the normals are in the wrong direction. This is already very strange, because, while in Blender, the original cog-wheel and its mirrored counter part both had normals facing one way, when importing this in Unity, the original cog-wheel still looks ok (like in Blender) but the mirrored one now has normals inverted.

First thing I've tried is to go "ok, so I'll flip normals in Blender for the mirrored cog-wheel and then it'll display ok in Unity and that's that". So I went back to Blender, flipped the normals on that mesh, so now it looks bad in Blender:

and then re-exported as fbx with the same settings as before, and re-imported into Unity. Sure enough the cog-wheel now looks ok in Unity, in the sense where the faces show up properly, but if you look closely you'll notice that light and shadows are now wrong:

Now in Unity, even though the light comes from the back of the robot, the cog-wheel in question acts as if light was coming from some-where else, its faces which should be in shadow are lit up, and those that should be lit up are dark.

Here's some things I've tried and which didn't do anything:

in Blender I tried mirroring the mesh in 2 ways: first by using the scale to -1 trick, then by using the mirroring tool (select mesh, hit crtl-m, select mirror axis), both ways yield the exact same result
in Unity I've tried playing around with the prefab import settings like "normals: import/calculate", "tangents: import/calculate"
I've also tired not exporting as fbx manually from Blender, but just dropping the .blend file in the assets folder inside the Unity project

So, my question is: is there a way to actually mirror a mesh in Blender and then have it imported in Unity so that it displays properly (as it does in Blender)? If yes, how?

Thank you, and please excuse the TL;DR style.

sentences:
Best way to separate display and game logic (threads) What is the best way to separate render and game logic threads?

I'd like to make logic-heavy game (ai, machine learning, and network) in which world updates 50-60 times per second.

I want to separate rendering so it will not waste logic's thread power.

I'm planning to use c++ with boost.

sentences: Finding physical gamejams I'm interested in participating in some gamejams and was hoping to be able to attend one in person. Is there a way I could search for gamejams in the general Dallas area?

sentences:
Why is Minecraft's default resolution (seemingly) non-standard? Background: I'm writing some articles on Minecraft in an attempt to introduce 10-year olds to development through modding. I know very little about the game itself, though :)

I'm trying to understand why Minecraft appears to run in an "odd" default resolution. Grabbing a screenshot, I think it's rendering at 550x310 but that doesn't seem to match any of the "common" aspect ratios (although it's close to 16:9), nor is it evenly divisible by 16, which appears to be what the texture packs use.

Is it actually running at 550x310 in its default windowed mode? If not, what is the resolution?
Depending on the answer to the first question, why isn't it using one of the standard aspect ratios? I'm not familiar with OpenGL programming either so perhaps there is a common resolution close to what I'm guessing at that would make perfect sense.

sentences:
What algorithm to use for predictive collision detection in multivariate systems? In the collision system for my game I basically have two kinds of things, boxes, defined thusly:

struct Box2I
{
    uint32_t x, y, width, height;
};

and quads, which are used for terrain:

struct Quad
{
     const uint32_t left, right;
     const float slope_top, intercept_top;
     const float slope_bottom, intercept_bottom;
     bool solid;
};

The boxes can collide with the quads, but the boxes can't collide with each other, and colliding quads has no meaning.

Anyway, I'm having trouble with the collision, the collision function should return a number between 0.0 and 1.0, where 0.0 is the time of the last frame, 1.0 is the time of the next frame--and -1 for no collision.  But I can't find a way to do this.

Mostly I can find algorithms for systems such as colliding circles, where they move but the scale doesn't change, or points, etc. But I'm having trouble finding anything beyond the general scheme of:

broad phase checks
?????
binary/interpolation search for collision time

And I'm just not sure what goes in 2, because I frequently find things on the  separating axis theorem, but that can't be #2 because objects would sometimes tunnel.  The other general idea I've come across is casting rays from each of the corners of the box, but again, I can see that sometimes allowing tunneling.

What's the general technique that's typically used here?

sentences:
Implementing attack animation in four direction movement The way the program is supposed to run is basically, a character can be running/idle and if spacebar is pressed, all movement stops and movement controls are locked through the bool "canMove". The integer shockwave is a 1-4, directly correlating to the direction 1-4 (1 = north, 2 = east, 3 = south, 4 = west). Then, the animation plays and when it is over the controls are unlocked and you can move freely.

The problem I have encountered is, I can find no way to specifically tell when the animation is ending inside of a blend tree. I cannot find a way to allow the animation to play, and then continue to unlock the controls.

Since this site won't let me post more than three links, I will have to describe the animator window. Basically I have four idle states (N, E, S, W). Each motion is a blend tree, and each state is connected with a transition purely based off of int direction.

This is where I tried adding another motion to the blend tree called shockwave, based on threshold speed (-1). This worked up until the point that I realized I would not be able to add anymore attacks or states, and that I could not tell when the animation had finished in order to unlock the controls.

void Update (){

    if (Input.GetKey (KeyCode.Space)){

        canMove = false;
        direction = animator.GetInteger ("Direction");
        animator.SetFloat ("Speed", 0.0f);

        if (direction == 1){
            animator.SetInteger("Shockwave", 1);
            animator.SetFloat ("Speed", -1.0f);

            //find a way to detect that the attack animation is done.
            //continue and allow movement
            canMove = true;

                }
            }

        else if (direction == 2){
            animator.SetInteger ("Shockwave", 2);
            //if(!anim.IsPlaying ("character_shockwave_2")){
                //canMove = true;
            //}
        }
        else if (direction == 3){
            animator.SetInteger ("Shockwave", 3);
            //if(!anim.IsPlaying("character_shockwave_3")){
            //  canMove = true;
            //}
        }
        else if (direction == 4){
            animator.SetInteger ("Shockwave", 4);
            //if(!anim.IsPlaying("character_shockwave_4")){
                //canMove = true;
            //}
        }

Attempted solutions:

I have tried to use waitforseconds(x), and just wait for the attack animation to finish, and then after that amount of seconds I would set the canMove bool to true. For whatever reason, I cannot get this to work.

I have also tried to directly find if the animation is done playing through a few different ways, but I learned that the blend tree does not allow this.

The only solution I have thought might work is actually manually playing all animations through code alone. (Would require re writing the entire program).

If any further code is needed, I can supply it.

sentences:
How can I export a .FBX file from Unity3D at runtime? I want to export an object as a .fbx at runtime in Unity3D.

I've made a C# script to export a mesh filter or skinned mesh renderer to a .obj file at runtime, but I want the animation and skin support that only .fbx supports.

After some research, using the Autodesk FBX SDK or some other external .dll seems like my best option. How do I call Autodesk's FBX SDK at runtime? Is there another external .dlls I could use for this?

Another option could possibly be to write the mesh information as a text file, then convert to .fbx to export.

sentences:
WinAPI window taking 50% of CPU when idle I'm currently working on a game that creates a window using WindowsAPI.  However, at the moment the process is taking up 50% of my CPU.  All I am doing is creating the window and looping using the code found below:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    MSG message = {0};
    WNDCLASSEX wcl = {0};

    wcl.cbSize = sizeof(wcl);
    wcl.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
    wcl.lpfnWndProc = WindowProc;
    wcl.cbClsExtra = 0;
    wcl.cbWndExtra = 0;
    wcl.hInstance = hInstance = hInstance;
    wcl.hIcon = LoadIcon(0, IDI_APPLICATION);
    wcl.hCursor = LoadCursor(0, IDC_ARROW);
    wcl.hbrBackground = 0;
    wcl.lpszMenuName = 0;
    wcl.lpszClassName = "GL2WindowClass";
    wcl.hIconSm = 0;

    if (!RegisterClassEx(&wcl))
        return 0;

    hWnd = CreateAppWindow(wcl, "Application");

    if (hWnd)
    {
        if (Init())
        {
            ShowWindow(hWnd, nShowCmd);
            UpdateWindow(hWnd);

            while (true)
            {
                while (PeekMessage(&message, 0, 0, 0, PM_REMOVE))
                {
                    if (message.message == WM_QUIT)
                        break;

                    TranslateMessage(&message);
                    DispatchMessage(&message);
                }

                if (message.message == WM_QUIT)
                    break;

               if (hasFocus)
            {
                elapsedTime = GetElapsedTimeInSeconds();
                lastEarth += elapsedTime;
                lastUpdate += elapsedTime;
                lastFrame += elapsedTime;
                lastParticle += elapsedTime;

                if(lastUpdate >= (1.0f / 100.0f))
                {
                    Update(lastUpdate);
                    lastUpdate = 0;
                }
                if(lastFrame >= (1.0f / 60.0f))
                {
                    UpdateFrameRate(lastFrame);
                    lastFrame = 0;
                    Render();
                    SwapBuffers(hDC);
                }
                if(lastEarth >= (1.0f / 10.0f))
                {
                    UpdateEarthAnimation();
                    lastEarth = 0;
                }
                if(lastParticle >= (1.0f / 30.0f))
                {
                    particleManager->rightBooster->Update();
                    particleManager->rightBoosterSmoke->Update();
                    particleManager->leftBooster->Update();
                    particleManager->leftBoosterSmoke->Update();

                    particleManager->breakUp->Update();
                    lastParticle = 0;
                }
            }
            else
            {
                WaitMessage();
            }
            }
        }

        Cleanup();
        UnregisterClass(wcl.lpszClassName, hInstance);
    }

    return static_cast<int>(message.wParam);
}

So even when I am not drawing anything when the window has focus it still takes up 50%.  I don't understand how this is taking up so much system resources.

Am I doing something wrong?

Any help would be much appreciated, thank you!

sentences: Why is clip space always referred to as "homogeneous clip space"? I've noticed in almost everything I've read so far that the term "clip space" is prepended with the word "homogeneous". Now I understand that it roughly means "all the same", but I don't understand why there is the express need to say "homogeneous clip space". When is clip space not homogeneous and why do we need to differentiate? And for that matter, what exactly does it mean that we're calling it "homogeneous clip space"? Homogenous in relation to what? In what way are the vertices "all the same"?

sentences: What's a good way of implementing traits/promotions/buffs? I basically need something that modifies existing code without the need to go back and change it. So for instance, if I have a game where the player or NPS can eat food to gain health back, and eating a banana gives five health, how can I make a trait that will make the banana gives ten health instead of five without going back into the original code that makes the banana award five health? Thanks.

sentences:
Xaudio2 XAPO Effects I've been working with XAudio2. After looking at the samples, example code, and sparse documentation available from Microsoft and the MSDN, I've found that there aren't any easy-to-find resources on creating and using XAPO effects, nor any XAPO effects produced by third parties that I can download and/or buy.

What it looks like is that if I create an app that uses XAPO effects, I'll have to create them all myself because there's no community of existing applications like there is with technologies like Apple's AU or Steinberg's VST. Is this true, or are there others using XAudio2 and XAPO and I just haven't found them?

Is there a place to ask programmer-support-related questions about XAudio2 and related technologies (or is this the best destination)? The best I've found so far are the XNA forums, which are game-specific and sparsely populated in the audio area.

sentences:
With a Texture Atlas that has 128x128 tiles, how can I use that in Unity3D? So I've got a working texture atlas that has tiles fitting 128x128. However, I can't quite figure out how to use them. I know it's probably got something to do with

    TileRenderer.material.SetTextureScale("_MainTex", new Vector2(0.25f, 0.25f));
    TileRenderer.material.SetTextureOffset("_MainTex", new Vector2(0 * 0.25f,0));

but I'm not sure where to take it from there. Can anyone offer some advice? The size of the image is 1024x128 if that helps, which I think it might.

sentences:
How to balance experience gain in an RPG I am currently developing an RPG game with a classic experience-points and levelup mechanic. The player kills monsters, gains experience points, levels up when they collect enough and become stronger.

How do I balance the amount of Exp points necessary for reaching each level and the amount of Exp awarded by each monster on each level?

sentences: MonoGame WP custom vertex decleration How do I go about implementing and using a custom vertex deceleration in monogame for windows phone 8. I want to be able to store a position, a colour and a normal?

sentences:
Default color for 3D scene I have webgl 3D scene with background image and few shapes with textures.
I want to add some lines and other shapes and apply on them default color which not affect the shapes with textures.
How can I do this?
this is what I have now:

gl.clearColor(0.0, 0.0, 0.0, 0.0); //alpha=0 for background img
gl.enable(gl.DEPTH_TEST);

sentences:
What client front-end options can I use to make a Facebook game? I have been requested to make a port of an iOS game for Facebook.

The game itself is fairly simple, it is a puzzle game using a 2d array for a grid with XML passed from a server for loading objects onto the the grid, to create levels.
The game will ask questions at stages which will be passed to my server and stored for research purposes.

I have looked into both Flash and HTML5/js both of which I have little to no experience in (I'm experienced in Java/C#/Ruby + Rails).

Javascript seems like a nightmare from what I have read, even looking into javascript game engines, but at least it is free.

My backend will most likely be rails for handling server logic.

Is javascript for programming games really a problem for simple games on Facebook?
Are js game engines worth using? Does anyone have any experience with them?
Would prevention of cheating be possible with a js/rails game, do server side checks work?*
Are there any alternatives for a front end for someone with C#/Java/Ruby background?**

I've never seen any Unity or Java apps on Facebook (I don't use it much) and as this is a research project is for my university, I would like to avoid licensing issues.

sentences:
calculating the weights for direction vectors to a target I have an entity that is allowed to move in a fixed amount of directions. Let's call a the angle between two directions. r is the length of each direction vector. Now the entity wants to head from its current position (x1,y1) to a target (x2,y2) in one of the fixed directions. Instead of getting the direction that the entity should head into, I want to get a weight for all directions that is based on how close the entity gets to the target with that direction, so that I can combine those weights with other things like avoiding some direction for example.

I thought about calculating the distance from the new positions to the target and then use the closest distance (the one in which the entity heads in the direction directly to the target) to get a weighting from 1 to zero for the other directions.

Now I was wondering if there is some other way to get the weights without having to calculate the distance for each direction. Maybe there is some sort of relation between the angle from the ideal direction and the distance that could be used to calculate the weights instead? So far I've figured out that at least there is no no linear relation between the angle and the distance.

Here is an image to hopefully clear things up a bit:

sentences:
Cocos2D: Box2D body that is movable by one type of object but not another I'm in the process of creating a simple platform game using Cocos2D 2.0 and Box2D. I'm trying to create a kind of crate object that cannot be moved by the player, but that can be moved by an elephant object. When the player runs up to the crate, it should stop him dead in his tracks (as if he is running into a static Box2D body). If the elephant runs into it it should get knocked out of the way (as if the elephant was running into a dynamic Box2D body of much smaller mass/density). I can't use collision bitmask because of course I want collision to occur in both cases, I just want that collision to result in different things depending on which type of object is hitting the crate.

Anyone have a hint as to how to make this work?

Thanks in advance!

sentences:
Rendering different materials in a voxel terrain Each voxel datapoint in my terrain model is made up of two properties: density and material type.  Each is stored as an unsigned integer value (but the density is interpreted as a decimal value between 0 and 1).  The density values are used to generate a mesh with the marching cubes algorithm.

My current idea for rendering these different materials on the terrain mesh is to store eleven extra attributes in each vertex:  six material values corresponding to the materials of the voxels that the vertices lie between, three decimal values that correspond to the interpolation each vertex has between each voxel, and two decimal values that are used to determine where the fragment lies on the triangle.

The material and interpolation attributes are the exact same for each vertex in the triangle.  The fragment shader samples each texture that corresponds to each material and then uses the aforementioned couple of decimal values to interpolate between these samples and obtain the final textured color of the fragment.

It should work fine, but it seems like a big memory hog.  I won't be able to reuse vertices in the mesh with indexing, and each vertex will have a lot of data associated with it.  It also seems pretty slow.  What are some ways to improve or replace this technique for drawing materials on a voxel terrain mesh?

sentences:
Invoking a common method after a button press I want to implement a common method that handles several numeric values and performs and action based on those values. So I have buttons with specific methods to change this values without affecting the rest. However I want to link them all to a final method that runs right after the press of a button, so this way the game will change only when the player chooses to change it and changes according to the players decisions. How can I implement this in my script?
Most of my methods are like this:

public void "ButtonIDGoesHere" (int "SpecificVariable"){
//Add, Sub, Multiply, etc.

}

What can I add so that it goes to a common method right after it executes its instructions?

sentences:
Finding rotation quaternion from orthonormal basis? Given three 3D unit vectors \$a\$, \$b\$, \$c\$ such that:

\$a \times b = c\$

\$b \times c = a\$

\$c \times a = b\$

(ie \$a, b, c\$ form an orthonormal basis)

How do we calculate a unit quarternion \$q\$ such that the sandwidch product (ie rotation) of \$q\$ on (1,0,0) is \$a\$, (0,1,0) is \$b\$ and (0,0,1) is \$c\$ ?

sentences:
XNA - Obtaining depth from the scene's render target? Possible Duplicate:
  Depth buffer and render target

I'm currently rendering my scene to a render target so it can be used for rendering methods such as post processing and order independent transparency.

rtScene = new RenderTarget2D(
            GraphicsDevice,
            GraphicsDevice.PresentationParameters.BackBufferWidth,
            GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,
            DepthFormat.Depth24Stencil8,        // Requires a depth format for objects to be drawn correctly (e.g. wireframe model surrounding model)
            0,
            RenderTargetUsage.PreserveContents
            );

I am required to use RenderTargetUsage.PreserveContents so that the same render target can be rendered to multiple times, once for each of the draw methods below.

DrawBackground
DrawDeferred
DrawForward
DrawTransparent

The problem is that DrawTransparent requires a copy of the scene's depth as a texture.

Is there any way to obtain this from the scene render target above (rtScene)?

I can't have more than one render target with RenderTargetUsage.PreserveContents as this causes problems on hardware such as the XBOX 360, so rendering the depth to a separate render target at the same time as I render the scene isn't possible as far as I can tell.

Would I be able to get around this problem by "Ping-Ponging" two render targets (using the more compatible RenderTargetUsage.DiscardContents) and using the result for the depth texture?

sentences:
What method replaces GL_SELECT for box selection? Last 2 weeks I started working on a box selection that selects shapes using GL_SELECT and I just got it working finally.

When looking up resources online, there is a significant number of posts that say GL_SELECT is deprecated in OpenGL 3.0, but there is no mention of what had replace that function.

I learnt OpenGL 1.2 in back in college 2 years back but checking wikipedia now, I realise we already have OpenGL 4.0 but I am unaware of what I need to do to keep myself up to date.

So, in the meantime, what would be the latest preferred method for box selection?

EDIT: I found http://www.khronos.org/files/opengl-quick-reference-card.pdf on page 5 this card still lists glRenderMode(GL_SELECT) as part of the OpenGL 3.2 reference.

sentences:
AddListener will not listen to onClick event Based on this question on the Unity forum, I've made this code to instantiate a button and add an onClick event.

// Setting some other component properties right of the prefab.

shopTurretItem.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(() => {
    UnityEngine.Debug.Log("Click");
});

Instantiate(shopTurretItem, transform);

The variabele shopTurretItem is my prefab type of UnityEngine.GameObject.

The problem is that the log Click will never be shown. If I add breakpoints on the first code line, the compiler will stop the code. If I place it into the closure, it'll never be hit if I click on that button.

This is the inspector of my prefab shopTurretItem.

What's wrong with this code?

sentences:
JFrame launcher stays open when I'm finished with it I have written a launcher that prompts the user for their name then starts the game when they hit enter. The launcher looks like this:

But when the user hits enter, this happens:

The launcher stays open.

This is the relevant code in the launcher class:

    public void actionPerformed(ActionEvent evt) {
        String text = textField.getText();
        System.out.println(text);
        entered=true;
        Game game = new Game();
        game.start(text);
    }

    public void Launch() {
        //Create and set up the window.

        JFrame frame = new JFrame("Login");
     // maximize the jframe here
        frame.setSize(800,600);
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Add contents to the window.
        frame.add(new Launcher());
        //Display the window.
        frame.pack();
        frame.setVisible(true);
        while(entered==true){}
    }

And this is for the main method in the game:

    public static void main(String[] argv) {
        Launcher launcher = new Launcher();
        launcher.Launch();
    }

So how would I go about closing the launcher when the user has no use for it?

I am using a JFrame for the launcher and Lwjgl for the actual game window.

sentences:
108 kb - size of most in-game activation passes, skins, etc... Any idea Why? I have been playing xbox 360 for a while now and whenever there is a pass, character/weapon skin or even multiplayer access code that needs downloading, the file size is usually 108 kb, no matter the game/application. I've tried googling around and have not come across anything useful. Could someone explain or even speculate why that happens?
I ask out of curiosity :)
Possibly, this question may belong in a different forum - if so, please advise which. :)

sentences:
Scripted Motion Paths (?) (XNA) Ok, so the title isn't the greatest because this is a lot more general.
Say I want to have the player be able to hit A and have their ship model roll to the right, and shift to the right of the screen, while the camera stays centered. Would I do that through programming (ie. set waypoints for the model and keep the camera focus still) or do it through animation ( so the ship model actually rolls and moves right, and just play those frames)(I actually don't know how to do this kind of 3D animation yet, haven't looked into it. Adding it to my To Do List)

This is a really vague question I know, I'll try and answer any questions.

Thanks,
Peter

sentences:
Sprites are sometimes blurry in Flash I am playing around with drawing an SVG sprite (imported in through [Embed]). Depending on the coordinates of the image, sometimes it appears more crisp than others.

The following image shows how at different locations is it rendered differently:

(Image link - You may have to download and zoom in with an image editor to see it)

You'll notice that the middle sprite is more blurry than the ones on the sides. Does anyone know why this is? Any help would be appreciated.

sentences: Find asset labels at runtime Unity allows me to add multiple labels to my assets in the editor (the little blue luggage tag in the corner of the inspector). I can use the Asset Database to find all assets with a certain tag from the editor, but can I do the same thing at runtime? Maybe if the assets are in the resources folder?

sentences:
SDL_LoadBMP into glTexImage2D results in scewed colors I read up on this but i can not find the error.
Some suggest switching the format from RBA to RGBA but the surface data says it is 3 byte data.

Here are snippets and results of my source.

Loading the Image:

std::string bmpname = filename + ".bmp";

SDL_Surface * surface = SDL_LoadBMP(bmpname.c_str());
if (surface)
{
    glGenTextures(1, &m_texture_name);
    glBindTexture(GL_TEXTURE_2D, m_texture_name);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    GLenum mode;

    switch (surface->format->BytesPerPixel)
    {
    case 3: mode = GL_RGB; break;
    case 4: mode = GL_RGBA; break;
    default:
        BOOST_LOG_TRIVIAL(trace) << "" << *this << " failed recognize byteformat '" << bmpname << "'.";
        break;
    }

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0, mode, GL_UNSIGNED_BYTE, surface->pixels);
    SDL_FreeSurface(surface);
}
else
{
    BOOST_LOG_TRIVIAL(trace) << "" << *this << " failed to load '" << bmpname << "'.";
}

Output on the left, texture on the right:

Shaders:

//Vertex Shader
#version 120
attribute vec3 position_ATTRIB;
attribute vec2 texcoords_ATTRIB;
varying vec2 texcoords;
void main()
{
    texcoords = texcoords_ATTRIB;
    gl_Position = vec4(position_ATTRIB, 1.0);
}

//Fragment Shader
#version 120
uniform sampler2D diffuse;
varying vec2 texcoords;
void main()
{
    gl_FragColor = texture2D(diffuse, texcoords);
}

What is going on here, why is the color palette blueish?

sentences:
Have body resume constant velocity after collision I want to have a body move at a constant velocity, but react to collisions.

My example game is a train, I want it to move at 1 meter a second. If an obstacle appears on the tracks, I want it to react by smashing through it (which will normally slow it down). But when the obstacle is cleared, I want the train to accelerate back to 1 m/s and continue on.

It seems like the applyLinearImpulse() and applyLinearForce() methods are the place to start, but those are one-shot methods.

Thanks

sentences:
Server related questions and it is available options? i went thru a lot pages here searching for information about the "server side" of a multiplayer game, while i did found some information they were not exactly what i was looking for.

What is the best available options
for the server communication ?
Is it worthed to handle a game server with website requests for a mmo or should not even be consider at all ?
Are you aware of any good material
regarding the same in C# for a
headstart on the subject ?
When should i consider creating multiple servers for example "monsters servers, world drop data and the such" or what should i consider for this (i've seen that some very popular games out there use this sort of thing such as a server for monsters, lineage for example) ?

  Currently i am developing a 2D game
  using Tiled and C# for single player
  but i would like to further turn it
  into a mmo game but i am very unsure
  of what a server would look like for
  this ... Any further knowledge or
  personal experience you could provide
  related to the server aspect and
  options i would appreciate.

  As i said above it is a 2D with
  multiple maps where the user goes
  around as their level grows, each map
  which is not a town has monsters
  spawning and despawning when killed by
  players, players can move around on
  the possible spaces, once a player
  hits the border of the map at defined
  locations it will take them to the
  next map...

  Since i am doing it on a 800x600 size
  i guess i will need to limit the
  players per server (or something like
  world's or whatever term is used for
  it..) so it does not over populate the
  screen with players ...

if my question or english at any point is not good please wrap your comment and i will try to rework it to best fit the community of if you can edit it and correct what you feel like should be changed, please go ahead...

sentences:
HLSL How to flip geometry horizontally I want to flip my asymmetric 3d model horizontally in the vertex shader alongside an arbitrary plane parallel to the YZ plane. This should switch everything for the model from the left hand side to the right hand side (like flipping it in Photoshop). Doing it in pixel shader would be a huge computational cost (extra RT, more fullscreen samples...), so it must be done in the vertex shader.
Once more: this is NOT reflection, i need to flip THE WHOLE MODEL.

I thought I could simply do the following:

Turn off culling.
Run the following code in the vertex shader:

input.Position = mul(input.Position, World);

// World[3][0] holds x value of the model's pivot in the World.
if (input.Position.x <= World[3][0])
    input.Position.x += World[3][0] - input.Position.x;
else
    input.Position.x -= input.Position.x - World[3][0];

...

The model is never drawn. Where am I wrong? I presume that messes up the index buffer. Can something be done about it?

P.S. it's INSANELY HARD to format code here.

Thanks to Panda I found my problem. SOLUTION:

// Do thins before anything else in the vertex shader.
Position.x *= -1;   // To invert alongside the object's YZ plane.

sentences:
How can I check for Shader Model 3 support? Currently I am working on a 3D visualization app. A requirement of my app is that host's graphics card supports Shader Model 3. How can I check for Shader Model 3 support?

I know that these versions are supposed to support these models:

DirectX 8.0 - Shader Model 1.0 & 1.1
DirectX 8.0a - Shader Model 1.3
DirectX 8.1 - Shader Model 1.4
DirectX 9.0 - Shader Model 2.0
DirectX 9.0a - Shader Model 2.0a
DirectX 9.0b - Shader Model 2.0b
DirectX 9.0c - Shader Model 3.0
DirectX 10.0* - Shader Model 4.0
DirectX 10.1* - Shader Model 4.1
DirectX 11.0* - Shader Model 5.0

But some graphic hardware doesn't support Shader Model 3.0 even with the proper DirectX version. So I want to determine it by checking the hardware not just the DirectX version.

sentences:
Handling User Input Based on the Current Game State currently i'm developing a 2D game in my spare time and i'm confused on how to handle the input from the player.

Currently my game uses the state design pattern, each game state is a different object such as Inventory, Playing, Paused etc. All of these states implement an interface called State that have a Render and Input method that is called on whatever the "Current state" is in the game engine.

So my question is would you use multiple key listeners or key bindings, one for each state since the input the player will do differs dramatically between the different game states or would you use one key listener or keybinding somehow? Is there a best practice for this?

Thanks.

sentences:
How is a Game Manager supposed to be constructed? I'm a beginner developing games on Unity3D and now that I've become a little bit familiar with GameManagers I've been wondering about certain aspects.

How do you contruct a GameManager in the most efficient way? Since it's an entity that persists through scene loads, it has to be tweaked to reset some values on level load because it doesn't do that by itself.

I'm making a 2D platformer, so when a new level is loaded (or the current level is restarted) the GameManager has to dynamically find references to the objects it handles. And because each level cannot be identical to the next, should I have code in the GameManager to find references to the specific GameObjects and values depending on the level? I'm thinking something like this:

public class GameManager : MonoBehaviour {

  //Values and core methods etc

  void OnLevelWasLoaded(int level) {
    if (level == 1) {
      //Find references and set values for level 1
    }
    if (level == 2) {
      //Find references and set values for level 2
    }
  }
}

Or should I have a separate GameManager for values, game states and events and an in-between script for handling the GameObject references? I just want to learn this right. I'm worrying that if I dump "everything" in the GameManager, it becomes too big and inefficient.

Speaking of which, is it OK for the GameManager to also handle the UI/HUD? Or should there be a separate UIManager dedicated for this task?

sentences:
box2d and constant movement i'm developing a game with a top down view, the players body is a circle. To move the character you need to tap on the screen and it moves to the spot.

To achieve this i'm saving the coordinate of the touch and call a method every frame which applies linear velocity to the body with a vector of the direction the body should go

_body->SetLinearVelocity(b2Vec2((a.x - currPos.x)/SPEED_RATIO,(size.height - a.y - currPos.y)/SPEED_RATIO));
//click position - current position, screen height - click position (since the y axis is flipped, (0,0) is in the bottom left ) - current position = vector of the direction we want to go

now the problem with this is that the body slows down until it finally stops when getting closer to the point we want it to go, since the closer we are to that point the lenght of the vector gets smaller. Besides that i've read that it's bad practice to set linear velocity in box2d and i should use apply force instead, but that way the forces would add up and overshoot the target where it's supposed to stop.

So what i'm asking is how to move a box2d body to a coordinate in constant speed.

sentences:
Help with Collision of spawned object(postion fixed) with objects that there are translating on screen Hey guys I am creating a game using Corona SDK and so coding it in Lua.
So there are 2 separate functions,

To translate the hit objects and change their color when they are tapped
The link below is the code I am using to for the first function
http://developer.anscamobile.com/sample-code/fishies
Spawn objects that will hit the translating objects on collision. Alos on collision the spawned object disappears and the translating object bears a color(indicating the collision). In addition the size of this spawned object is dependent on i/p volume level. The function I have written is as follows:

--VOICE INPUT CODE
local r = media.newRecording()
r:startRecording()
r:startTuner()

--local function newBar()
--    local bar = display.newLine( 0, 0, 1, 0 )
--    bar:setColor( 0, 55, 100, 20 )
--    bar.width = 5
--    bar.y=400
--    bar.x=20
--    return bar
--end

local c1 = display.newImage("str-minion-small.png")
c1.isVisible=false
local c2 = display.newImage("str-minion-mid.png")
c2.isVisible=false
local c3 = display.newImage("str-minion-big.png")
c3.isVisible=false

--SPAWNING
local function spawnDisk( event )
    local phase = event.phase

    local volumeBar = display.newLine( 0, 0, 1, 0 )
    volumeBar.y =  400
    volumeBar.x = 20
    --volumeBar.isVisible=false

    local v = 20*math.log(r:getTunerVolume())
    local MINTHRESH = 30
    local LEFTMARGIN = 20
    local v2 = MINTHRESH + math.max (v, -MINTHRESH)
    v2 = (display.contentWidth - 1 * LEFTMARGIN ) * v2 / MINTHRESH
    volumeBar.xScale =  math.max ( 20, v2 )

    local l = volumeBar.xScale
    local cnt1 = 0
    local cnt2 = 0
    local cnt3 = 0
    local ONE =1
    local val = event.numTaps
    --local px=event.x
    --local py=event.y

    if "ended" == phase then
        --audio.play( popSound )
        --myLabel.isVisible = false

        if l > 50 and l <=150 then
            --c1:setFillColor(10,105,0)
            --c1.isVisible=false
            c1.x=math.random( 10, 450 )
            c1.y=math.random( 10, 300 )
            physics.addBody( c1, { density=1, radius=10.0 } )
            c1.isVisible=true
            cnt1= cnt1+ ONE
            return c1

        elseif l > 100 and l <=250 then
            --c2:setFillColor(200,10,0)
            c2.x=math.random( 10, 450 )
            c2.y=math.random( 10, 300 )
            physics.addBody( c2, { density=2, radius=9000.0 } )
            c2.isVisible=true
            cnt2= cnt2+ ONE
            return c2

        elseif l >=250 then
            c3.x=math.random( 40, 450 )
            c3.y=math.random( 40, 300 )
            physics.addBody( c3, { density=2, radius=7000.0 , bounce=0.0 } )
            c3.isVisible=true
            cnt3= cnt3+ ONE
            return c3
        end
    end
end

buzzR:addEventListener( "touch", spawnDisk ) -- touch the screen to create disks

Now both functions work fine independently but there is no collision happening. Its almost as if the translating object and the spawn object are on different layers. The translating object passes through the spawn object freely.

Can anyone please tell me how to resolve this problem. And how can I get them to collide.

Its my first attempt at game development, that too for a mobile platform so would appreciate all help. Also if I have not been specific do let me know. I'll try to frame the query better :).

Thanks in advance.

sentences:
Cell Lighting Propagation Problem I have in place a cell-based lighting system that works basically like this: (Not my actual code)

    //Light moves up
    for (int x = 0; x < width; x += 1)
    {
        for (int y = 0; y < height; y += 1)
        {
            light[x,y] = light[x,y+1] - amount;
        }
    }

    //Light moves down
    for (int x = width; x < 0; x -= 1)
    {
        for (int y = height; y < 0; y -= 1)
        {
            light[x,y] = light[x,y-1] - amount;
        }
    }

    //Light moves left
    for (int x = 0; x < width; x += 1)
    {
        for (int y = 0; y < height; y += 1)
        {
            light[x,y] = light[x+1,y] - amount;
        }
    }

    //Light moves right
    for (int x = width; x < 0; x -= 1)
    {
        for (int y = height; y < 0; y -= 1)
        {
            light[x,y] = light[x-1,y] - amount;
        }
    }

The variable amount is determined in each for() loop by if there is a block at x,y.

This should make it so that light darkens faster if there is a block at the position, but the light shows up looking like this:

Light shine out sides oddly

Light is in a tunnel, as you can see the top and bottom blocks are solid but they are not being lit up

Verical tunnel, but it seems to work correctly

Up and down dont seem to work quite right

I should also mention that changing the order of the passes changes in which direction the light propagates incorrectly. For example, if I change the order from up,down,left,right as shown above to left,right,up,down, the light is spread correctly in a horizontal tunnel and incorrectly in a vertical tunnel.

SO MY QUESTION IS: What is wrong with my code that creates this obvious miscalculation?

If you need to see more code or explanation or screenshots, I'll be happy to provide.

sentences:
Looking for a market price algorithm for a turn based game I am new at game development and am now facing the problem for a market price algorithm in a turn based game.
What I try to achieve:

the market starts with fixed bidding and asking prices for one piece of goods. To keep it simple the minimum value is 1, the maximum 20
if the user buys/sells the same goods in too large quantities in a certain amount of turns, the prices should rise/drop; simple supply and demand logic. The maximum amount of a goods per transaction is 100
if the user doesn't trade that good for a few turns, it should adjust the price in the other direction
there are certain type of goods that can be "easily" produced by the player and are thus sold and some that are harder to get by and are usually bought.
the market can sell each good infinitely and would also buy everything, so it has no stock to take into account.

What I tried and didn't work:

if the accumulated quantity of bought/sold good reaches 500 (I use negative values for buying) the price rises or drops by 1 respectively
to factor the turns into it, I thought I just reduce the accumulated value by 10 each turn and then adjust the price if it reaches 0 again. This has one big flaw, as you can easily cheat by just selling a small amount, wait a few turns and the price will rise; repeat until the price reaches the maximum of 20.

Any simple ideas on how to fix this?
ps. I hope this is an appropriate question to ask here

sentences:
Don't message systems slow down game engines? I am wondering, aren´t messaging systems slowing the speed of engines down? I mean, lets say that I want to zoom in my camera, without messaging I would do something like:

_camera->zoomIn(0.005f);

But with messaging, I have to broadcast the message (to the bus for example)

Data data;
data.float = 0.005f;
MessageBus::sendMessage(CAMERA_ZOOM_IN,&data);

Then iterate through all systems (all systems that can possibly handle the message) and at the end, when it arrives to my camera system, I have a handling function that calls proper method based on the message type.

eventFunctions[CAMERA_ZOOM_IN](data);

That means it needs some additional time to "do stuff" and also harder implementation. (imagine for different data types I also need some static casts etc.)

So, will it affect the actual speed of my engine?

sentences: Can I use a 3d plane for a 2d game? I am developing a 2d isometric game and I was wondering if I can use a 3d plane for a 2d game.

sentences:
How do I use Android's adaptive icons in Unity? As of API 26, Android uses something called adaptive icons.

When targeting API 25 and lower, my app's icon looks fine:

But when targeting API 26+, it shows up in a white circle like so:

How can I target API 26+ while utilizing Android's adaptive icons?
What if I want to target API 26+, but not use Android's adaptive
icons?

sentences:
XNA How do I detect if my mouse if hovering over a specific sprite? How do I detect if my mouse if hovering over a specific sprite?

For example I'm making a custom button and I want to check if my mouse is hovering over it so I can make animations.

sentences:
Reconstructing 3D Rotation from 8 byte - Assistence required I am currently trying to load 3D models and animations into a program. The file format has no public description, so I am decoding them piece by piece. (I'm studying computer science and it's for educational purposes)

My problem is to restore 3 dimensional rotation from the skeleton files as the rotation is stored in 8 bytes only and I can't figure out how that data represents rotation around 3 axis. This is a sample skeleton with 11 joints:

                                   float |    float |    float             Bytes (hexadecimal values)
Joint  0: Parent: -1 Position: ( 0.000000|  0.000000|  0.000000) Rotation: 00 40 00 40 00 C0 00 C0
Joint  1: Parent:  0 Position: ( 3.042923| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint  2: Parent:  0 Position: ( 3.803955| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint  3: Parent:  0 Position: ( 4.482897| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint  4: Parent:  1 Position: ( 0.824744| -0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  5: Parent:  2 Position: ( 0.694988| -0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  6: Parent:  3 Position: ( 0.509095| -0.000000| -0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  7: Parent:  4 Position: ( 0.609431|  0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  8: Parent:  5 Position: ( 0.609431|  0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  9: Parent:  6 Position: ( 0.609431|  0.000000| -0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 10: Parent:  7 Position: ( 0.842106|  0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F

which should form roughly this shape:

3-6-9
|
|2-5-8
||
||1-4-7-10
|||
 0

But as you can see, the joints only extend in the 1st dimension (excluding 1, 2 and 3 which do extend a little in the 3rd dimension) so the coordinates have to be relative to the parent (which makes perfectly sense in terms of a skeleton).

My problem is to figure out how the rotation is stored in the 8 bytes per joint.

Short example: joints 1, 2 and 3 have to store a 90° rotation for the skeleton to work ..
I allready did some research for different representations, but none can store arbitrary rotations around 3 axis in only 8 bytes, usually it takes double the space (4 floats) ..

sentences:
How do I cover a plane in a bumpy foam material effect? I need to fill a weapon bag with foam material.

This is what it should look lik:

The material in the upper part of the bag looks like this:

I'm using HDRP.

How could I do this?

Thank you!

Edit: I have played around with Parallax Occlusion mapping, and I got this result.

Edit2: I am not sure if I use the Pixel Displacement as it has been suggested to me.

Also, I'm not sure if I use it the correct way:

I have created a Height map and put it into the Height map slot.
This doesn't create any effect.
I have to put the same map into the Base map slot in order to see the effect.
If I put a black image into the Base map slot or if I choose Black as the Base color, no effect is visible.

I don't understand why this is so. I think even if my Base map is black, the Shader has pixels that it can move.

This is my height map:

Edit 3: It was suggested that I should use a normal map. This doesn't look at all what I expected. The normal map was created from the Height map using an online tool:

By Philipp's answer I found out that the normal map alone is not enough.

sentences:
Moving object through nodes in Quadtree I'm working on my own quadtree for use in games for physics (collision detection to be exact) but am unable to move an object from one node to another node.

What I'm doing is if some object is to be moved, I'm deleting it from its old position and adding a new object (with same property, such as width and height) to the new position. Is my approach correct or is there any other optimized process to do same?

The problem I'm facing is that if I move an object from node 0 to node 3 (both node being children of, for ex., root node) the root node container(I'm using std::vector) gets the object but it is not updated in the node 3's container.

Any solution to my problem? Though would be happy to try some other method too.

Thanks.

sentences:
Unity's Android Notification system works on my Xiaomi, but on a Huawei every notification has an "Unknown" status? When my app starts I check whether there is a notification or not

if there isn't I create one via SendNotification(...)
if there is, I check their status:

var status = CheckScheduledNotificationStatus(notificationId);
On my Xiaomi their status is Scheduled, so I update them:

SendNotificationWithExplicitID(...)

But on a Huwaei it's always Unknown, in that case I create a new:

SendNotification(...)
And replace the old ID in the PlayerPrefs.
But on the next startup it's unknown again.

Maybe I should use SendNotificationWithExplicitID(...) as well when the status is Unknown so I can keep the ID?

Here is the code:

var notification = CreateNotification(jsonWrapper.Name, fireTime, title, text);
if (PlayerPrefs.HasKey(jsonWrapper.Name))
{
    var notificationId = PlayerPrefs.GetInt(jsonWrapper.Name);
    var status = AndroidNotificationCenter.CheckScheduledNotificationStatus(notificationId);
    if (status == NotificationStatus.Scheduled)
    {
        AndroidNotificationCenter.SendNotificationWithExplicitID(notification, "default", notificationId);
        Logger.Log($"Updated a notification: {jsonWrapper.Name} at {fireTime}.");
    }
    else if (status == NotificationStatus.Unknown)
    {
        var id = AndroidNotificationCenter.SendNotification(notification, "default");
        PlayerPrefs.SetInt(jsonWrapper.Name, id);
        PlayerPrefs.Save();
        Logger.Log($"UnknownStatus | Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
    }
}
else
{
    var id = AndroidNotificationCenter.SendNotification(notification, "default");
    PlayerPrefs.SetInt(jsonWrapper.Name, id);
    PlayerPrefs.Save();
    Logger.Log($"Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
}

sentences:
How to decide the budget as independent game developer? I'm currently try to make a business plan and was just wondering, how you guys decide the budget for outsourcing tasks. Is there a kind of a reference point? Or does the client decide this mostly by himself, what he want for his work?
I speaking specially about tasks like:

translation (en->xxx)
character artwork
tiles/background artwork
sprites
music (BGM/SE)
voice synchronization

Naturally it depends really a lot about content size and requirements - but have any here a generally idea about the neccessary budget for tasks like this?
Any link or ressource to this topic would be highly appreciated.
Thank you guys,

Edit: Already thank you, for the great answers!
Specially I mean also things like: How do you compromise with graphics artists and what kind of "contract" do you use. In which frame I can imagine the payment for i.e. a drawn character artwork or a standard sprite sheet with a few animations? Any experiences? I haven't really an idea, what to offer an artist for such tasks...

sentences:
What is the difference between genre and game mechanics? In some local vacancies I read something like "a genre = match3", or like "a game mechanics = adventure". I thought, a game mechanics is match3, or any sequences of operations that do something to solve something. A verb. For example, to connect three candies of one color in a line.

And genre is just a structure about what elements should be in a story. Like in "The Hero with a Thousand Faces". For example, an adventurer + an artifact + a map (or any key) to find it + competitor (or a let) = adventure.

Am I wrong?

sentences:
Glow effect shader for mesh generated at runtime I'm using the leap motion-paint module and i would like the ribbons that are generated at runtime to have a glow effect, I tried editing the existing shader by adding a glow property but the colors did not change. I'm not experienced with shaders so any help would be much appreciated.

EDIT: I tried adding post-processing effects for bloom & glows, all the objects have a glow effect except the ones i'm generating at runtime..

 Shader "LeapMotion/TubeShader" {

Properties{
    _Color("Tint", Color) = (1,1,1,1)
    _Glossiness("Smoothness", Range(0,1)) = 0.5
    _Metallic("Metallic", Range(0,1)) = 0.0
     _Glow("Intensity", Range(0, 3)) = 1
  }
  SubShader{
    Tags { "RenderType" = "Opaque" "Glowable"="True"}
    LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0

struct Input {
  float4 color : COLOR;
};

half _Glossiness;
half _Metallic;
fixed4 _Color;
half _Glow;

void surf(Input IN, inout SurfaceOutputStandard o) {
  o.Albedo = (_Color* _Glow * IN.color).rgb * ;
  o.Metallic = _Metallic;
  o.Smoothness = _Glossiness;
}
ENDCG

}
  FallBack "Diffuse"
}

sentences:
Perlin noise example the same on CPU as GPU? I am looking for an example site with a Perlin Noise implementation in both CPU and GPU, that generates somewhat the same results in those two places.

I see many CPU implementations of Perlin Noise, but they don't match up with the GPU implementations that I found.

The reason I need this is for physics. The map is generated with Perlin Noise on the GPU in 2D, but this also means that to do physics, I must have a CPU version of the algorithm that generates the same results.

sentences:
How to access Lit shader properties through code? Currently i'm using HDRP in my project, so i have a question.
How can i access Lit shader properties through code ? Or where i can see names of variables in this shader ?

For example:

sentences:
How do I best remove an entity from my game loop when it is dead? Ok so I have a big list of all my entities which I loop through and update. In AS3 I can store this as an Array (dynamic length, untyped), a Vector (typed) or a linked list (not native). At the moment I'm using Array but I plan to change to Vector or linked list if it is faster.

Anyway, my question, when an Entity is destroyed, how should I remove it from the list? I could null its position, splice it out or just set a flag on it to say "skip over me, I'm dead." I'm pooling my entities, so an Entity that is dead is quite likely to be alive again at some point. For each type of collection what is my best strategy, and which combination of collection type and removal method will work best?

sentences:
Are closing window and destroying DirectX11.1 independent? I have a project with DirectX support.
In this program uses two threads.
One is a dedicated message loop and the second is executing DirectX API's.
The question is about ending such program.
The WM_CLOSE sends asynchronous command, that stops rendering and exits DirectX loop too. After that it destroys the window.
Everything works fine. The question is, is this algorithm OK?
Should the window's thread or the DirectX thread be synchronized (dependent)?

sentences:
Percentages for different platform generation I have a level manager, which creates levels and levels create platforms.

Levels can contain a variety of platforms.

I dont really understand how I can say:

  I want a 10% of one platform being made, 30% chance of another, and 70% chance for anotgher and so on...

At the moment I have a method that looks like this:

   private void creationManager(float moveChance, float breakableChance, float superJumpChance)

I'm not sure how I can use these values and probabaility to determine which type of paltform is created.

Any ideas?

sentences:
3rd person game with rigid body Im making a 3rd person 3D game. I have a little capsule shaped player controlled drone at the moment that moves on a flat surface. Y axis is locked. The Game object contains a script and then the child objects which are the actual body parts. If i attach a rigidbidy to the root object i get crazy results. The drone collides with something and starts to spin and then forward becomes some upward direction.

Somehow i would like to be able to use the pysics collision and ragdoll effects but still be able to maintain the keyboard movement. I guess that id have to animate the drone getting back up again when fallen.

Movement code

    void CheckForKeys ()
{
    if (Input.GetKey(KeyCode.W)) {
        transform.Translate(Vector3.forward * Time.deltaTime * walkingSpeed);
    }

    if (Input.GetKey(KeyCode.S)) {
        transform.Translate(Vector3.back * Time.deltaTime * walkingSpeed);
    }

    if (Input.GetKey(KeyCode.A)) {
        transform.Rotate(Vector3.up * Time.deltaTime * rotatingSpeed);
    }

    if (Input.GetKey(KeyCode.D)) {
        transform.Rotate(Vector3.down * Time.deltaTime * rotatingSpeed);

sentences:
How can I optimize coroutines? I have a script which has a Queue datastructure (code below). This queue holds more than 100 Actions. So currently my script does a yield return null after every Dequeue, which means that one Dequeue() call is executed every frame.

private static readonly Queue<Action> DataQueue = new Queue<Action>();
private bool _isHandlingQueue; // Helper bool to check if Coroutine is active

private IEnumerator HandleQueue()
{
    _isHandlingQueue = true;

    while (DataQueue.Count > 0)
    {
        DataQueue.Dequeue().Invoke();
        yield return null;
    }

    _isHandlingQueue = false;

    yield return null;
}

I'm trying to achieve that multiple Dequeue and Invoke actions take place in the same frame. One Dequeue and Invoke takes between x and y ms, this varies depending on the Action itself.

Example: Lets say the Queue has 100 entries and the game runs at 60 frames per second (minimum). One iteration (Dequeue + Invoke) in the while loop takes about 5 ms in this example. Here is the thing: In this case it is essentially waiting for 11.67 ms for the next frame (16.67 ms each frame at 60fps). I don't want the system to wait, but use the remaining 11.67 ms to Dequeue and Invoke 2 more Actions, so it only waits for 1.67ms each frame. In this ideal case the Queue get's cleared in 34 frames instead of 100 frames.

All help to point me in the right direction is appreciated!

sentences:
Random 100x100 map using all levels from 1 to 100 I'm developing a game where players walk though a 100x100 grid of different rooms.
Each room has a level associated with it starting from lvl 1 to lvl 100.
The map is divided into 10x10 areas and in the middle of each area there's a 2x2 "castle" which players must conquer in order to access next levels castles (so if players start off at lvl 1 they need to conquer the lvl 1 castle before being able to enter lvl 2 castles).
Each room in a castle (2x2 area in the middle of each 10x10 area) has the same level and there must be a castle for each level from 1 to 100.
As for now I was generating the whole map "statically" and use the matrix blur to interpolate room levels between castles.
What I would like to achieve is having a seeded function f(x,y) that returns the level of the room at position (x,y) without pre-defining the matrix.
I checked out Perlin Noise functions, but it doesn't guarantee each level between 1 and 100 is taken nor the right position of the "castles".

The image above is the starting point of the game map, lower levels of green represent lower room levels, the blue squares in the center are the castles. This image is then blurred preserving just the castles level.
Players can move around the map and will meet harder challenges in higher level rooms. The goal is reaching level 100 by spotting and conquering each castle in sequence.

sentences:
How do you create images that work for multiple resolutions? I'm currently doing some game development and I've been curious about this situation for many years.

Let's say your game has two resolutions: 640x480 and 800x600 (using small numbers just for simplicity). I have an image that I want to, no matter, take up 1/4 of the screen. For 640x480 resolution, it would be 320x240; while 800x600 resolution, it would be 400x300. There's a few ways I think of that this could be accomplished:

Make the image 320x240 and scale it up on the larger resolution (will look pixelated)
Make the image 400x300 and scale it down on the smaller resolution (loss of detail)
Create two separate images for each resolution (size bloat)

Just for 4:3 aspect ration, you probably have 5-6 resolutions that are commonly found in more professional games; plus additional ones for 16:10 and 16:9. Creating separate assets for each aspect ratio makes sense, but doing it for each resolution sounds like overkill and a huge size jump.

How do developers normally handle this sort of situation?

Thanks!

UPDATE: This information would be used for a 2D platformer.

Part of the reason that I'm interested in this is trying to keep a "level playing field" for all players no matter what resolution they are at. I don't want the 800x600 resolution player to be able to see more of the level than the 640x480 player can.

Additionally, since I really have no graphics experience, I'm not sure how much the resolution changes would affect the integrity of the images.

sentences:
Registering and (more importantly) Unregistering with Message Server I've finally implemented an extendable message class and messageServer class.  The message class dynamically assigns a unique static ID to each derived message type (ex.  ObjectCreatedMessage might be assigned id = 1).  The actual message data is a member of the derived class.

Messages can be pushed to MessageServer class by upcasting to MessageBase*.

Systems (or anything) can subscribe to Message Server by passing a std::function to:

typedef std::function<void(MessageBase*)> Callback;
void registerCallback(int messageType, Callback callback);

When MessageServer is processing messages, it pops a message off the queue, checks the message type, then sends the message to each callback function registered to that type.

My Questions are:

Is this efficient?
How could I implement an "unregister" function?  std::functions can't be compared by equality.
What is a smart way to handle the callback failing? (perhaps the registered object went out of scope so the function pointer is undefined)

sentences: What is the purpose of these purple images in these sprite files of Super Mario Maker? I was looking at the Wii U's Super Mario Maker Sprites and noted that all of them have purple images that each correspond to one of the animation frames (see below). What could they have been used for? Why not simply using the finished colored ones?

sentences:
FPS Character Controller movement - Any value in reverse engineering movement formulas? From what I know character movement in popular FPS games tend to be non-linear, but the easing curves change between games as each has its own signature formula.

Typically I imagine the physics engine would provide the feel by adding acceleration, deceleration and attrition.

Most basic games have a simple linear start-stop movement.

Is there any value in reverse engineering the "signature" formulas for these games, or are these openly known and available to everyone?

Also if these are well known where can I read upon the different implementations by these AAA FPS games?

sentences:
Unable to create suitable graphics device? I've been following the Eye of the Dragon tutorial, which is basicly a guide to making a 2D RPG game, obviously.

I recently finished the tutorial about making pop up screens in the menu and changed the screen to load as a full screen.

Whenever I try and load the game it just goes black and my mouse sits there. I cannot change out of it other then with CtrlAltDel. Once i do that it says No suitable graphics card found, unable to create graphics device.

I read somewhere about XNA not allowing more then one screen when any one of them is full screen. but it wasnt very informative. Anyone have any ideas whats going on and/or how to fix this?

Just incase if this helps this is the code for the graphics device:

public Game1()
{
    graphics = new GraphicsDeviceManager(this);
    graphics.PreferredBackBufferWidth = 900;
    graphics.PreferredBackBufferHeight = 768;
    graphics.IsFullScreen = true;
    this.Window.Title = "Eyes of the Dragon";
    Content.RootDirectory = "Content";
}

sentences:
Slick2D noClassDefFoundError for StateBasedGame I'm trying to write a 2D game using slick2D, and I thought I set everything up correctly, but I'm getting this error:

Error: Could not find or load main class javagame.Main_Game
Caused by: java.lang.NoClassDefFoundError: org/newdawn/slick/state/StateBasedGame

My Main_Game class is the class with my main function and it extends StateBasedGame. I can't find this error or how to fix it when I try to search for it.

sentences:
Do you think it's Possible to go from C++ Straight to 3D (skipping 2D) Do you think it's possible to go straight from Experienced C++ programming (5 or so years) straight into learning DirectX 3d?

I mean....i'd be starting with the basics, im more interested in setting up Demos (like getting a good water demo and such) than actually doing a full fledged game.

Do you think this is possible?

sentences:
Rendering overlapping normal map textures to a 2d scene efficiently I am using modern OpenGL to render a 2D non grid/tiled world map.  I've generated some simple normal map textures to render over the base world map to provide terrain elevation/detail shading.  Terrain is not tiled (triangulated from noise), so the majority of these terrain elevation features can overlap. This is good as it gives a more continuous appearance to mountains etc.
However the normal map shader needs to sample the base terrain color and apply the lighting value to it before returning the output color.  So I can't render two overlapping normal textures without the second 'cutting out' the first where they overlap (the second texture render cannot see the output of the first).
My solution to this was to use a 3 pass render to texture via FBO.  I attempt to divide the normal textures destination locations into 3 non overlapping groups and render 1 group in each pass.  This works to a point, but of course where a texture overlaps more than 3 neighbours  the cut out problem remains.
I could just increase the number of passes/groups to 4, 5, 6... and perhaps this will resolve most cut out issues.  While this would probably still provide reasonable performance on my system I am guessing there is a limit where integrated graphics cards may struggle.
Is there an alternative solution for this that could scale better to lower end systems?  Or is perhaps even a 5 or 6 pass full-screen render viable on even integrated graphics these days?
Note:
The first render pass draws the entire 2D scene (minus terrain shading) and is obviously the slowest, but it happens only once.  The remaining passes make a screen size copy of the previous pass to a second texture (rendering to a screen sized quad) and then render normal textures to this copy using the first texture as input. Adding more passes would only repeat the screen sized texture copy and normal texture rendering.

sentences: UML Class Diagrams for 2D platformer Games? I have to develop a small arcade game in C++ for a college assignment using a 2D Game Engine my teacher coded. What would be the best way to make a UML class diagram for it? It's very basic stuff but I feel like I don't have the experience to make proper decisions on how to organize the classes. Seeing some examples of Class Diagrams from like Super Mario or any platformer would be perfect. For example would it be better to make a "Level" class where I load the bitmaps and handle the collisions, and then call this one in the main class, or just load my level stuff directly from my main class? Thanks in advance!

sentences:
Rotate camera with quaternion around axis going through the origin I am trying to implement my own third person camera using quaternions in DirectX. I first wanted to check that the camera rotates as expected so I started to rotate it around the world y-axis (0,1,0) and then x-axis (1,0,0) and it worked fine. But when rotating around the axis (1,1,0) the effect is not what I expected. Here is a description of what I do.

The scene is composed by a cube of side 2, centered at the world origin. The camera is originally placed at (0,0,-10), looking at the origin (0,0,0) and has the up vector (0,1,0). To test the rotation, at each frame I increase the angle of rotation theta by a constant amount dTheta. I build my quaternion from the axis of rotation (1,1,0) and the angle theta, transform the quaternion to its 3-by-3 matrix form and multiply both the position vector and up vector. I call the D3DXMatrixLookAtLH function to build the view matrix with the new position, the lookAt point (the origin of the world frame) and the new up vector.

What I get is my cube rotating in a very strange way (well, I know it is the camera that is rotating, but you know what I mean, everything is relative). Moreover it seems the distance between the cube and the camera changing because, as the cube rotates, its size oscillates.

I can put some code if someone asks but I first wanted to check there is no mistake in my approach. Thanks.

sentences:
Gaussian blur not working correctly So pretty much I tried to add a gaussian blur to something I am making and it is acting oddly. The setup is like:

[All framebuffers are cleared to rgba(0,0,0,0), normal blend enabled]
Draw some solid black objects to Framebuffer 0
Apply horizontal gaussian pass from Framebuffer 0 to Framebuffer 1 (this works fine)
Apply vertical gaussian pass from Framebuffer 1 to backbuffer
[original black objects removed here, does not affect the process at all]

It seems like a standard gaussian layout, but the problem happens with the final view (presumably the vertical pass). It appears that the vertical gaussian pass dampened the previous horizontal one, making it a lot thinner (and making the box shadow effect I was going for look weird):

(note on the right image on one of the center rectangles for example, the top and bottom are blurred like they should but the sides aren't)

I just cant figure out why the vertical blur factor is at least 2x the horizontal one. I feel like this is because of something to due with alpha because the horizontal pass displays like it should until the second step happens. One final note, this still happens if I flip the horiz/vert order, it just happens on the other axis. I honestly can't figure this out so any help would be nice. Also for more info, heres the fragment shader I use (all the data passed to it is correct):

in vec2 ftexpos;

uniform sampler2D inputtex;
uniform vec2 vector;

float[15] gaussianraito = float[15](
    0.023089,
    0.034587,
    0.048689,
    0.064408,
    0.080066,
    0.093531,
    0.102673,
    0.105915,
    0.102673,
    0.093531,
    0.080066,
    0.064408,
    0.048689,
    0.034587,
    0.023089
);

void main() {
    vec4 sum = vec4(0.0);

    for (int i = -7; i < 7; i++) {
        sum += texture(inputtex, vec2(ftexpos.x + i * vector.x, ftexpos.y + i * vector.y)) * gaussianraito[i + 7];
    }

    gl_FragColor = sum;
}

sentences:
Are there legality issues using a company's name in a game? I'm working on an RPG of sorts where the character has a "day job" that determines how much money they make each time the day cycles and other things like that.

Are there any legality issues with using the names of companies like "Barnes & Noble" or even "Apple"?

sentences:
Working with 3D Noise I am using a simplex 2D noise to generate my worlds so far.  This however was never the plan and has the downside that I basically can only generate a heightmap.  Instead I want to aim for floating islands scattered in the sky, but I fail to see how I can utilize 3D noise properly for this.

Based on a simplex 3D noise function I am currently generating noise like this:

float
sc_perlin_noise3_ex(const sc_perlin_t *perlin, float x, float y,
                    float z, int octaves, float persistence,
                    float base_frequency, float base_amp,
                    float lacunarity)
{
    int i;
    float freq = base_frequency;
    float amp = base_amp;
    float max = 1.0f;
    float total = 1.0f;

    for (i = 0; i < octaves; i++) {
        total += sc_perlin_noise3(perlin, x * freq, y * freq, z * freq) * amp;
        max += amp;
        freq *= lacunarity;
        amp *= persistence;
    }
    return total / max;
}

Problems start there: first of all I think I got octaves wrong, at least the outcome is very unpredictable.  Persistence would be a value smaller 1 that removes the effect of the higher octaves.

Secondly however I have a general problem understanding how 3D noise works.  From my understanding a value < -1 could mean air, a value > 1 would be solid and 0 is the thin line between them (the surface).  First of all however I get a lot more values below zero than above zero, so I had to flip those two around.  That seems odd, do I have the math wrong?

The actual problem however is that I cannot locate "islands" properly.  Say I have a container of 256^3 in size and I want to have one large island in there with maybe up to three smaller islands in there I have to ensure that:

no island is cut off at the edges
that I only get two even sized islands in my block
I have some better control of the actual appearance of my island.  For instance it would be nice if it had an actual flat-ish surface where I can put a heighmap on top of that for mountains etc.

Based on that I have the feeling I am on the completely wrong track here.  Can anyone give me some pointers on where to head now?

Generally speaking I would like to have something that looks like this: floating island

sentences:
Data structure for random outcome from a hit probability table The basic idea of a hit-table is carried over from pen & paper role playing games. You roll a die or a number of dice representing your ability to attack an opponent. Your opponents defense is relative to your ability to attack: if you can roll higher than their defensive ability, then you hit them; if not, you miss.

Games started out with simple implementations and mechanics got more complicated as (e.g.) later editions of the rulebooks were published and players/customers desired a more realistic combat experience.

So conceptually, a hit table may look something like this:

Roll    Outcome
1-5     Miss
5-15    Dodge
16-20   Parry
21-80   Hit
81-100  Critical Hit

World of Warcraft calls this an attack table, but I haven't found a good resource which discusses a good data structure for this. The best implementation I have come up with so far is a linear traversal of an ordered list of the relative outcomes, which makes the decision algorithm O(n), where n is the number of possible outcomes.
The psuedo-code for this comes out to be:

var result = randome.next(0, hittable.maxvalue)
foreach outcome in hittable
    if result < outcome.max_value
        return outcome

// Reached the end of the table without finding an outcome
// Probably an error here, but let's fake it
return hittable.last

A typical combat in (most) modern games has many, many attacks that go to the hit-table for determination, as well as many possible outcomes. It is not hard to imagine this lookup becoming a serious bottleneck in terms of processing time. I remember the algorithm of a bucket sort from my Comp. Sci. coursework and have been enamored with the idea of finding a datastructure which would allow for a O(1) lookup of random number values. What would such a datastructure look like?

I can imagine how it could work with a one-liner query in SQL, but something tells me that would be adding a whole lot of overhead for a not-true O(1) solution.

SELECT name FROM hittable
WHERE hittable.min_roll < RAND() AND RAND() < hittable.max_roll

This is just a notion that popped into my head because "it's a hitTABLE, so why not store it in a table". Note: the above query also would not work because the two calls to rand would return random numbers.

Edit: MMORPGS have also implemented something similar for Loot Tables, which determines what you get from winning a battle (by looting the corpse of the defeated foe). This is complicated by having multiple potential outcomes for each random result, e.g.

Roll    Outcome
1-5     Nothing
5-15    Some Gold
16-20   An Item
21-80   Some Gold and An Item
81-100  Lots of Gold and TWO Items

In a game the size of World of Warcraft, you could have thousands of players looting the same monster in any given second, so again a strong argument can be made for finding the very fastest way to perform lookups of this manner.

sentences:
How to select coordinate position within uv texture in a shader - Unity first of all I'm sorry for asking noob-ish question. This is my fifth day trying to make a shader in Unity.

I'm trying to select an area within my UV image as shown below

and here's how it looks like on the mesh

Basically I'm only selecting the red from the UV and apply it to the mesh. I encountered no problem when trying to select from the RGB, but when i try to use the XYZ for the coordinate position, it turns out that the value of x and r is the same, so is y and g, and z and b.

My question is, how to select by the coordinate position in the UV texture?

Thanks.

here's my code :

    Shader "Custom/ASK RGB" {
    Properties {
        _tex ("Tex", 2D) = "white" {}
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _tex;

        struct Input {
            float2 uv2_tex : TEXCOORD1;
            float4 pos : TEXCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // my variable used to store the UV texture mentioned
            half4 tex = tex2D (_tex, IN.uv2_tex.xy);

            // my attempt to use position which doesn't work
            half4 texPos = half4(IN.pos);

            half4 tryUV = tex2D(_tex, IN.uv2_tex.xy);

            tex.a = 1 - tex.b - tex.r - tex.g;

            tryUV.a = tex.r;

            o.Albedo = tryUV.rgb * tryUV.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
How to prevent players from using save/load tactics in Roguelike games? Players can achieve the expected results through continuous saving and loading in rogue-like games.

I am try to reduce this method as much as possible, but don't want to keep players from trial and error at all, which makes the game more difficult.

Anybody could give me some advice in this respect?

sentences: Creating map files for a 3D game I've created plenty of 2D games and now that I've gotten my hands dirty working with 3D in opengl I want to start a game. The issue is I don't know how I can store all the map data. Not only the terrain but the textures and objects in the world, lighting, what's intractable etc. it seems that it'll get way to big if I don't have an efficient system for storing and loading maps. So what methods or articles can you guys suggest on this?

sentences:
How can I support both multiple resolutions and multiple orientations in a game? I am writing a mobile Android and iOS game.  This game is similar to Doodle Jump, but without scrolling.  In my game I display a background image that should cover the entire screen.  On top of that I draw some 32x32 tile images that make up the platforms.  I have three control buttons that are displayed at the bottom of the screen. The score is displayed at the top of the screen.

I am trying to ensure that this game will work on any resolution and can be rotated from landscape to portrait mode and vice versa. The player should be able to change orientations without losing sight of any platforms.

I have found several methods for doing this, however they only seem to work if you lock the orientation or skew the images.

Scaling the content
Won't work because it will skew images too much and look unprofessional.
Scaling the content and keeping the aspect ratio via letterboxing
The black bars that this introduces can become overwhelming.  For example, if I rotate a 960x640 resolution device to portrait, the new resolution will be 640x960.  When I tried implementing this, it gave me horrible results.

Portrait:

Landscape:

Scaling the x,y axis with separate values

scaling factor (on x-axis) = screen width in pixels / target width in pixels
scaling factor (on y-axis) = screen height in pixels / target height in pixels

This method changes the bounds of the coordinate system, which I am trying to avoid.
Using a virtual viewport
I like this idea, however it still doesn't seem to work with orientation changes.  The variation of aspect ratios seems to be to large when you try this approach for landscape and portrait.

Some good links I found on the topic can be found here
http://blog.gemserk.com/2013/01/22/our-solution-to-handle-multiple-screen-sizes-in-android-part-one/
http://v-play.net/doc/vplay-different-screen-sizes/#approaches-for-content-scaling

I have also thought about only stretching the background image and recalculating the new positions for everything else (player and platforms) when the orientation changes.  However, I'm not sure how this would affect collision detection and jumping in real-time.  I would rather solve this with a different technique if possible.

It seems like most people just lock their game in one orientation.  I am trying to avoid this, if possible.

The bottom line is that all of the methods I listed look to only solve the resolution issue if you lock the orientation.  Is there a way I can support both orientations?

sentences:
Problem designing my pseudo-3D game with SFML I am designing the game so the objects I create (Character, Enemy, Enemycast...) can inherit all from

Collider
SpineDrawable // Sprite // AnimatedSprite
D2D // D3D

Both D2D and D3D inherit from virtual sf::Drawable. D3D also is supossed to apport the functionality of an additional axis. When the object is drawed in screen, the object is scaled and repositioned in (X, Y) with some calculations.

Collider inherits from D3D, because all my colliders are going to have 3 axis, and it creates its own AABB box from D3D interface -to be implemented by the graph type Sprite//SpineDr...-.

I am trying to have two vectors to hold all my graphics, std::vector<D2D*> and std::vector<D3D*>, because the D3D ones will need to be sorted depending on their float z.

The problem arise because D2D///D3D classes inherit virtual sf::Drawable, and I am using my class Sprite inheriting from sf::Sprite, which inherit sf::Drawable as non-virtual function from in Sprite.hpp of SFML.

So I got two questions

Must I rewrite my sprite function in lower level, so it can inherit sf::Drawable as virtual?
I think my design is poor. Which alternatives are there instead of creating two separated lists of sf::Drawable/s to order the ones which have 3 axis?

sentences:
How will the velocities of two moving objects change once they collide? I'm making a small game where things can fly around and collide. Things like boxes and so on. For each object, I have an array of all forces acting upon it, I have it's mass, it's position and it's velocity in both directions (a 2D vector). I know how to detect collision between them, but I just don't know how to react.

I used to calculate their orientation towards each other, it they were on top one another, I would just negate their y speed (v.y = -v.y), and if they were next to each other on the x axis I would negate their x speed (v.x = -v.x).

Now, this isn't very realistic, so, how do I do it? All objects are rectangles represented by [x, y, w, h] vectors.

Objects can't rotate.

sentences:
Show a range grid movement as3 How do I show range of grid movement in AS3? When player controls a character and chooses "move" options, the grid of movement will be displayed as 3 grid of X, 4 grid of Y (Both sides, + and -). So, it will be like this:

In the image above, movement grid displayed in blue color. But, how do i display a range grid movement like that?

sentences:
How do I prevent loop that moves character to run twice? (Javascript) I managed to make a simple loop to move my character, onmousedown I move the character diagonally to where the user clicked. It's working but my problem is that I don't know how to prevent more loops to start over the first if the user clicks more than once.

Right now if you click more than once the character moves faster and faster since more loops are running at the same time.

This is the loop:

(function move() {
    if(cframes<frames) {
    cframes = cframes+1;
        character.style.left=parseInt(character.style.left)+pxsecx;
        character.style.top=parseInt(character.style.top)+pxsecy;
        setTimeout(move, 20);
}
})()
}

How do I prevent this loop from starting if it already has? or stop it and start another?
Thanks

sentences:
Unity fails to effectively split spritesheet I'm very new to game development and I find it very difficult to split the spritesheets available at opengameart.org. All of them are kind of jumbled together without any fixed grid.
The resource I learned from always used neatly assembled sprite sheets and Unity would have no trouble in automatically splitting them. But almost all are randomly placed and Unity cannot split them.
For example:

And below is the automatic splitting in unity:

How do you guys get the sprites from such spritesheets in unity? Some guidance would be appreciated.
Thank you

sentences:
What version of Marching Cubes bring "ambiguities" I am reading Eric Lengel’s paper about the Transvoxel algorithm.

In an early part describing the classical Marching Cubes (3.1.1), he talks about ambiguous cases. From what I understand, these can result from grouping the cases into “equivalence classes”.

However, in the Marching Cubes paper I read (is this the one he is referring to ?), there does not seem to be any grouping done, and each of the 256 cases produces its own triangulation. For example, taking the case of Lengyel’s figure 3.2 (on page 12 of the first document), the left cube has index 189 (vertices 0 2 3 4 5 7) and the right cube index 24 (vertices 3 and 4), which gives non “equivalent” triangulations: 4 triangles for the left cube, and 2 for the right cube.

To phrase this as a question: are there different versions of Marching Cubes, and could Lengyel be referring to a different one than Paul Bourke's ?

sentences:
Adding tolerance to a point in polygon test I've been using this method which was taken from Game Coding Complete to detect whether a point is inside of a polygon. It works in almost every case, but is failing on a few edge cases, and I can't figure out the reason.

For example, given a polygon with vertices at (0,0) (0,100) and (100,100), the algorithm is returning:

True for any point strictly inside the polygon
False for any of the vertices
False for (0, 50) which lies on one of the edges of the polygon
True (?) for (50,50) which is also on one of the edges of the polygon

I'd actually like to relax the algorithm so that it returns true in all of these cases. In other words, it should return true for points that are strictly inside, for the vertices themselves, and for points on the edges of the polygon.

If possible I'd also like to give it enough tolerance so that it always tend towards "true" in face of floating point fluctuations. For example, I have another method, that given a line segment and a point, returns the closest location on the line segment to the given point.

Currently, given any point outside the polygon and one of its edges, there are cases where the result is categorized as being inside by the method above, while other points are considered outside. I'd like to give it enough tolerance so that it always returns true in this situation.

The way I've currently solved the problem is an hack, which consists of using an external library to inflate the polygon by a few pixels, and performing the tests on the inflated polygon, but I'd really like to replace this with a proper solution.

sentences:
Can I use memcpy() with XMMATRIX? I.e. can I do this:

XMMATRIX dxMat;
Matrix myMat;
std::memcpy(&myMat, &dxMat, sizeof(XMMATRIX));
std::memcpy(&dxMat, &myMat, sizeof(XMMATRIX));

Matrix is my own class which contains 16 contiguous float variables (only). Also can I do the same with my vector class (4 floats) and XMVECTOR?

In other words, is XMMATRIX a POD?

sentences:
Redux-like storage in GD Some background

I've come from the world of web development. And it's a real trending in web to keep whole app's state in single global store (see Redux, discussion about it's benefits).

Basically the main idea it makes the state management more
predictable.

Question

I have no ideas how Redux-like architecture would fit for a game development.
My main fears it's about usage with main loop inside game and of course about performance.

Did anyone use Redux-like store in GD, or it's a common anti-pattern?

Thanks for opinions.

P.S. It's not really matter, but I use libGDX.

sentences:
Essentials for building a RTS I was wondering if anyone had any links to good reads or books in regards to things to think about when developing a RTS game, I would have been reading things like this and this but would like to read more into it.

Also I have development experience and soon would like to start building the skeleton myself but if anyone has any additional articles about the process (not in programming, but more on planning) that would be great help.

sentences:
LibGdx - Move sprite in the direction of other sprite I'm kind new to LibGdx and I'm still learning. I'm working on a small game project to learn this nice framework. However, I'm having some issues with my game. My game is a top down shooter. There is a human character(space marine) that has to shoot an alien, which will be always moving in his direction until it  dies. My code doesn't have any bullets yet.I was able to make the shooter rotate in the direction of the cursor, as well, the alien rotate in the direction of the shooter, but I can't make the alien move in his direction. I'm pretty sure that my method that does that is completely wrong. I've tried a lot to fix it , but I can't get it fixed ! I appreciate your attention guys !
You can find the full code of the main class here:
 https://github.com/Igor-Lopes/LibGdx/blob/master/Splash.java#L125

public void moveAlien() {
    float mX = 0;
    float mY = 0;
    int velocity = 50;
    vAlien = new Vector2(-1 * (float) Math.sin(Alienbody.getAngle()) * velocity,
            (float) Math.cos(Alienbody.getAngle() * velocity));

    mX = (float) Math.cos(Math.toRadians(spacemarine.getRotation()));
    mY = (float) Math.sin(Math.toRadians(spacemarine.getRotation()));

    vAlien.x = mX;
    vAlien.y = mY;
    if (vAlien.len() > 0) {
        vAlien = vAlien.nor();
    }
    vAlien.x = vAlien.x * velocity;
    vAlien.y = vAlien.y * velocity;
    vAlien.x += vAlien.x * Gdx.graphics.getDeltaTime();
    vAlien.y += vAlien.x * Gdx.graphics.getDeltaTime();
}

public float rotateMarine() {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = Gdx.input.getX();
    mouseY = 677 - Gdx.input.getY();
    angle = (float) Math.toDegrees(Math.atan2(mouseX - spacemarine.getX(),
            mouseY - spacemarine.getY()));
    if (angle < 0)
        angle += 360;
    spacemarine.setRotation(angle * -1);
    return angle;
}

public float rotateAlien(Sprite s, float posX, float posY) {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = posX;
    mouseY = posY;
    angle = (float) Math.toDegrees(Math.atan2(mouseX - s.getX(), mouseY - s.getY()));
    if (angle < 0)
        angle += 360;
    s.setRotation(angle * -1);
    return angle;
}

@Override
public void render(float delta) {
    float angle;
    moveAlien();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    angle = rotateMarine();
    rotateAlien(alien, spacemarine.getX(),
            spacemarine.getY());
    if (Gdx.input.isKeyPressed(Input.Keys.W) == true
            && spacemarine.getY() < 560) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() + 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.S) == true
            && spacemarine.getY() > 0) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() - 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.D) == true
            && spacemarine.getX() < 920) {
        Marinebody.setTransform(spacemarine.getX() + 4, spacemarine.getY(),
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.A) == true
            & spacemarine.getX() > 8) {
        Marinebody.setTransform(spacemarine.getX() - 4, spacemarine.getY(),
                angle);
    }
    alien.setPosition(Alienbody.getPosition().x, Alienbody.getPosition().y);
    spacemarine.setPosition(Marinebody.getPosition().x, Marinebody.getPosition().y);
    batch.begin();
    spacemarine.draw(batch);
    alien.draw(batch);
    batch.end();
    // stage.act();
    // stage.draw();
}

sentences:
How do I pass textures into a fragment shader in Slick? I've written a shader that uses three different textures, tex0, tex1, and tex2. I can load it into Slick and successfully display it, but I can't figure out how to set the three different textures. Whichever texture I last load or set is the one used for all three.

My code:

if (sp == null) {
    try {
        sp = ShaderProgram.loadProgram("passthrough.vert", "planet.frag");
        planet = TextureLoader.getTexture("png", new FileInputStream("earth.png"));
        clouds = TextureLoader.getTexture("png", new FileInputStream("clouds.png"));
        lights = TextureLoader.getTexture("png", new FileInputStream("lights.png"));
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }
}

sp.bind();

// Attempt to set tex0-tex2. This fails and just sets everything to tex2.
glUniform1i(sp.getUniform1i("tex0"), 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, planet.getTextureID());

glUniform1i(sp.getUniform1i("tex1"), 1);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, clouds.getTextureID());

glUniform1i(sp.getUniform1i("tex2"), 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, lights.getTextureID());

sp.setUniform1f("time", tick * 0.03f);
sp.setUniform2f("resolution", 400f, 400f);

// Render a quad. This works, except that the textures are all the same.
glBegin(GL_QUADS);
glVertex2i(0, 0);
glVertex2i(0, 400);
glVertex2i(400, 400);
glVertex2i(400, 0);
glEnd();

sentences:
Game state management techniques? First off, I'm not referring to scene management; I'm defining game state loosely as any sort of state in a game which has implications about whether or not user input should be enabled, or if certain actors should be temporarily disabled, etc.

As a concrete example, let's say it's a game of the classic Battlechess.  After I make a move to take another player's piece, a short battle sequence plays.  During this sequence, the player shouldn't be allowed to move pieces.  So how would you track this sort of state transition?  A finite state machine?  A simple boolean check?  It seems the latter would only work well for a game with very few state changes of this sort.

I can think of a lot of straightforward ways of handling this using finite state machines, but I can also see them quickly getting out of hand.  I'm just curious if there's a more elegant way to keep track of game states/transitions.

sentences:
Why would typeof(T) kill performance? TLDR: using typeof(T) twice; assigning the value to a variable and reusing that = uber fast (30FPS), actually calling typeof(T) twice = derped (5FPS). Why?

I have a simple entity/component system; my basic entity had an array of IComponents, and methods like HasComponent<T> and GetComponent<T>. These just iterate over the arrays and return the first matching item (this.components.Any(c => c is T)).

Turns out a performance bottleneck I experience with 100k components "in memory" (albeit most off-screen) is actually these two methods. With a few components, no problem (30FPS+). With 100k components, just sprites, I get around 5FPS.

So I figured, why not use a Dictionary<Type, IComponent> instead? It'll be faster, right?

Right?!

Wrong. First, a complexity: I have a SpriteComponent class, and a SpriteSheetComponent component class (knows about frames, animation, etc.). To simplify everything, SpriteSheetComponent derives from SpriteComponent. This makes drawing, ordering, etc. simpler, because of the is-a relationship.

Second, querying for components became more complex; if I ask HasComponent<SpriteComponent>, and you have a SpriteSheetComponent, you should return true, right?

So the way I handle that is:

return this.components.Keys.Any(t => t == typeof(T) || t.IsSubclassOf(typeof(T)));

Ditto for fetching the element, except I use First instead of Any.

Anyway, I noticed that the performance actually degraded. What's even more surprising is that this fixed the performance issue:

var tType = typeof(T);
return this.components.Keys.Any(t => t == tType || t.IsSubclassOf(tType));

The only difference is that I'm checking typeof(T) once and reusing that. This fixed my FPS up to 30ish, hurrah.

But this is definitely a "lolwut" moment for me. Is typeof(T) really that slow? And in this case, it's shredding my performance with just one extra call?

sentences:
Why do I need offset on my camera? So I've been away from Unity and game development in general for a bit, so I'm working through Unity's UFO Tutorial and had a question about the camera set up. I don't understand why you need the offset for it? It follows the Player object directly it seems, and they use a Vector3? But it's a 2D game, so why not just use a Vector2? I was experimenting with the code just to see if I could figure it out, so I removed the offset variable completely but then when I ran the game it just showed a blank space in the game view. Any body who can help me understand this?

public class CompleteCameraController : MonoBehaviour
{
    public GameObject player; //Public variable to store a reference to the player game object
    private Vector3 offset; //Private variable to store the offset distance between the player and camera

    // Use this for initialization
    void Start ()
    {
        //Calculate and store the offset value by getting the distance between
        // the player's position and camera's position.
        offset = transform.position - player.transform.position;
    }

    // LateUpdate is called after Update each frame
    void LateUpdate ()
    {
        // Set the position of the camera's transform to be the same as
        // the player's, but offset by the calculated offset distance.
        transform.position = player.transform.position + offset;
    }
}

sentences:
Why aren't my pieces rotating on my chess board in Java? I am developing chess game in Java using the Netbeans IDE. Instead of rotating the whole board at each move, I thought of changing position of the pieces themselves, while the board remains same. All my pieces and squares are JLabels and are in a JLayeredPane, with pieces being in top layer. All the squares are part of a JLabel array named labels and same for white and black pieces.

WinitialLocation and BinitialLocation are Point Arrays for initial positions of white and black pieces.

But running the following code in mouseReleased() event of the pieces, only the piece which we moved changes place, the rest remain at their position.

Can anybody help me, Please?

void reLocate() {
     for(int i = 0; i < 6; i++ )
     {
        for(int j=0, n=labels.length; j<n;j++)
        {
            if(labels[j].getLocation().equals(WinitialLocation[i]))
               wPieces[i].setLocation(labels[63-j].getLocation());

            if(labels[j].getLocation().equals(BinitialLocation[i]))
               bPieces[i].setLocation(labels[63-j].getLocation());
        }

        layer.moveToFront(wPieces[i]);
        layer.moveToFront(bPieces[i]);
    }
}

sentences:
How to draw a Minecraft-like world with Open GL I recently completed the this Open GL tutorial. The tutorial shows how to set up a window and shaders, and teaches you how to draw a single cube in the middle of the screen, which all makes sense to me (I think).

I'd like to make just a simple flat world made of cubes like Minecraft, but I have no idea how to turn my single giant cube into a bunch of smaller cubes, or how to get the smaller cubes to be arranged in the proper way.

Mostly what doesn't make sense to me is the coordinate system being from 1 to -1 and trying to draw a bunch of cubes in that space. Is there a way to adjust that coordinate space to be more world-like, where each unit of coordinate space is roughly equivalent to a meter or something?

sentences:
Enemy fire every few seconds Hi I'm trying to get my enemy to fire once every few seconds, I tried using a Coroutine but due to me essentially calling the Coroutine through the update method, the Coroutine is repeating every frame update and spamming the shoot key. What is a solution for this?

void Update () {
        Shoot ();
}

public void Shoot(){

        StartCoroutine ("ShootContinuous");

}

public IEnumerator ShootContinuous() {
    yield return new WaitForSeconds (1);
    anim.SetTrigger("Shoot");
    Instantiate (Bullet, firePoint.position, firePoint.rotation);
    isShooting = true;
    yield return new WaitForSeconds (1);
    anim.SetTrigger("NoShoot");
    isShooting = false;

}

sentences:
How can I improve the performance of handling many objects to draw in XNA? I have a 2D engine that uses XNA 4.0. I have an issue with handling many objects.
In my engine, I only draw visible sprites, and ignore sprites outside of the current viewport. It works, so far. I also use a RenderTarget to minimize the amount of sprite batch being called, to draw the base.

I also need to draw buildable objects, and the worst case is that there is a list with 10,000 - 20,000 objects. I need to iterate through them, to find the visible buildable objects, as well. This really affects my frame rate, especially when the viewport changes.

I could decrease the zoom level, to minimize the amount of base tiles, but the list of objects keeps the same. Using smaller texture sizes could help, but then I´m also losing detail.

How could I improve the performance?

sentences:
Road network geometry in Unity: one big mesh or a bunch of smaller meshes? I'm in the beginning stages of building a road system in Unity. It'll be your basic SimCity style road construction, with building and destroying roads done on the fly at runtime. When doing thing, given the fact that geometry will be so often added and destroyed, should I keep a separate mesh for each segment of road, or should I maintain one big road mesh for the whole scene and add and remove vertices to it when roads are modified? In larger road networks would there be any performance difference between the two? I'm not so familiar with this sort of optimization in Unity, so any help is appreciated.

So basically, many small meshes or one big mesh? Does it matter?

sentences:
Are there any distinct advantages to the ZBrush proprietary formats? I apologize if this is off-topic here, but this is the best match I could find on Stack Exchange and I feel I can get some objective analyses.
So, I'm a long time Blender user and a major FOSS proponent, but it's never because I've had anything against charging for software if it provides a unique service. (For a programmer, that would crazy.) I'm considering purchasing a month or two of ZBrush, as it works very well in compatibility layers these days and could be integrated into my workflow. Additionally, FLOSS hasn't overtaken it in every area quite yet, so I imagine there's some serious dedication from their finite engineering team.
However, there are a few practices of the company that concern me a bit, not because I know that they're abused, but because they're very abusable. The proprietary format is one of them. If I open up a program like Blender, GIMP, Photoshop, and so on, I can usually use a generic image as a map or alpha brush; but ZBrush insists on using its own proprietary and undocumented container.
Is there an advantage that it offers, which an open format would not? Is there something clever about it that I'm not seeing yet? Maybe some kind of lossless compression? Compared to a multilayer format like OpenEXR, is there a function to this format aside from market desperation? I am willing to pay $40 a month for quality software, but only if it isn't for something as mild as arbitrary compatibility issues.
In summary, for a guy who renders headless and runs FFmpeg from the terminal—as nature intended—are there any objective advantages to ZBrush for me? Or is it ultimately more of a beginner thing?

sentences:
Is C# viable for a real-time game server? Most of the question is in the title.

Basically, I'm starting to develop a 2D multiplayer action game. The client is (probably) going to be in XNA, and I thought I'd ask here about whether it's a good idea to use C# for server side development as well.

I guess the fact that the language is managed is not something problematic as Java is being used in even MMO game servers (correct me if I'm wrong), so are there any reasons to avoid C# for this purpose? I need it to be fast and responsive, to communicate over TCP, to chat with an SQL server. And if there is no reason to avoid C#, how would I deploy such a web server, would it be a .NET EXE running on the server machine?

sentences:
Rotating object around a rotating one? I am developing a solar system animation in Unity3D. Planets rotates around sun. But ı have an issue simulating satellites like Moon. Moon should be rotating around world normally and moon should be rotating around World. Since World is rotating around Sun , i am having trouble about calculating  true rotation for moon. I don't want to use rotateAround() since it is deprecated. I need to make this done using Rotate().

this is my planetScript

public class planetScript : MonoBehaviour {

    public GameObject target;//target is Sun for World, World for Moon etc

    public float rotateRatioCenter;//1 degree for World
    private float rotateSpeedTarget;

    public float rotateRatioAround;//365 for World
    private float rotateSpeedAround;

    public float counter = 0;
    void Start () {
    }

    // Update is called once per frame
    void Update () {

     rotateSpeedTarget = rotateRatioCenter * gameMasterScript.rotateAroundCenterRatio;//  rotateRatioCenter * 1 ,
     rotateSpeedAround = rotateSpeedTarget * rotateRatioAround;
     float yRotate = transform.eulerAngles.y;

     transform.Rotate(Vector3.up, rotateSpeedAround);

     rotateAroundTarget();
    }

    void rotateAroundTarget()//this is the method should be optimized
    {
        Quaternion quaRot = Quaternion.Euler(0, rotateSpeedTarget, 0);
        transform.position = quaRot * (transform.position - target.transform.position) + target.transform.position;
    }
}

gameView

sentences:
Keeping object a fixed distance from the ground, buggy behavior I'm trying to make a script that will keep my object exactly 1 meter from the ground. So far I've got the following code :
    using UnityEngine;
    using System.Collections;

public class HoverScript : MonoBehaviour {

    public Transform target;
    public float hoverDistance;
    void Start ()
    {

    }

    void Update ()
    {

    }

    void FixedUpdate ()
    {
        if (Physics.Raycast(transform.position, Vector3.down, hoverDistance))
        {
            RaycastHit hitInfo;
            Physics.Raycast(transform.position, Vector3.down, out hitInfo, hoverDistance);
            float correction = hoverDistance-hitInfo.distance;
            //Debug.Log(correction);
            //Debug.Log(target.position);
            target.position = new Vector3(target.position.x, target.position.y+correction, target.position.z);
            //Debug.Log(target.position);

        }
    }
}

Basically, if the raycast hits, then it finds the distance of the hit. If it's .9 and the hoverDistance is 1, it would push the object up by .1, and keep checking every update. It seems like it would work, but I get this result : http://www.gfycat.com/IllfatedMediocreAquaticleech

In case the link goes down, basically the object falls like normal because of gravity until the distance is reached, then it slows down dramatically and slowly sinks into the ground.

The objects are set up like this

gameObject(has hover script, rigidbody, the camera following script)
 |
 ----> mesh(just a mesh, mesh renderer, and collider)

The target of the script is the parent gameObject.

Any ideas why this script isn't working?

sentences:
Quit from Unity to native iOS app I'm working on iOS application which is going to include a few unity games.
And I investigate an opportunity to exit from the Unity game to the native iOS app with games list.
I know that the Unity provides methods Application.Quit() and Application.Unload()

I haven't try but I'm not sure that Application.Unload() is correct ways to exit from unity to the native iOS app.

sentences:
Ensuring a Recursive method completes in one update tick? OK so I have a method that calls itself as this was the only way I could think to get the behaviour I needed. Its a tetris clone i am making and this method is for checking for full lines across X axis.

    void CheckForFullLine(int starting_Y)
{
    for (int y = starting_Y; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (!frozenCells[x, y].isFilled)
            {
                CheckForFullLine(starting_Y + 1);
                return;
            }

            if (x == CELL_COUNT_X - 1)
            {
                tetrisLinesThisTick++;
                Debug.Log("lines this tick: " + tetrisLinesThisTick + "on tick: " + tick);
                ClearLine(y);
            }
        }
    }
}

but when i test the game, most of the time (more than 9/10 times) when you get multiple lines, the debug log says we only got 1 line in that 'tick'.

Here is the update method where at the top I set tetrisLinesPerTick to 0 at the start of each frame.

    private void Update()
{
    tick++;
    // reset the tetris-lines this tick value:
    tetrisLinesThisTick = 0;

    ClearScreen();
    CheckForFullLine(0);
    HandleMovementAndBlockCreation();
    DrawFallingPiece();
    DrawFrozenBricks();
}

For example if I get 2 lines in one go, I get the debug log saying '...linesPerTick 1' twice in quick succession.

Strangely , occasionaly  I do get the 2 or even 3 lines and it says the correct amount, but this is rare and i don't know how i  reproduce that yet.

Another very strange thing (the relevant code might not be here for this part..) ...quite rarely one of the frozen blocks will turn grey after falling, then I can still 'use' it in game to make more lines, but it doesnt disappear like the others, then make a couple more lines using this grey block and it disappears as normal :S  (well just in case you feel like helping me with this part, he is more code :P):

    void ClearLine(int line)
{
    // TODO: Add score

    // remove complete line
    for (int x = 0; x < frozenCells.GetLength(0); x++)
    {
        frozenCells[x, line].isFilled = false;
    }

    //shift all lines down        // todo: figure out if its a multi-line tetris to give better scores...
    for (int y = line; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (frozenCells[x, y].isFilled)
            {
                if (y > 0)
                {
                    frozenCells[x, y].isFilled = false;
                    frozenCells[x, y - 1].isFilled = true;
                }
            }
        }
    }

}

For some reason, I feel it may be the recursive method i made  and the fact that 'linesPerTick' value is getting set back to zero prior to the other lines being removed (in the same move), is what is causing my problem but i could be completely wrong about it!

The whole project is just one .cs file and a block texture i made in GIMP, I could paste the whole script here if you want to try it please let me know. Cheers for any help!

sentences:
Black Area in skybox in opengl Hi I am using opengl and I am having a problem if I go further from the skybox with the camera I get black areas, a smaller radius of the skybox will make the camera too close to the object to stay inside the skybox and increasing it obviously doesn't help.
:

Here is the code for the skybox:

  glEnable(GL_TEXTURE_2D);
    glPushMatrix();
    qobj = gluNewQuadric();
    glTranslated(50,0,0);
    glBindTexture(GL_TEXTURE_2D, underwater);
    gluQuadricTexture(qobj,true);
    gluQuadricNormals(qobj,GL_SMOOTH);
    gluSphere(qobj,100,100,100);
    glPopMatrix();

sentences: Shadow mapping: what is the light looking at? I'm all set to set up shadow mapping in my 3d engine but there is one thing I am struggling to understand. The scene needs to be rendered from the light's point of view so I simply first move my camera to the light's position but then I need to find out which direction the light is looking. Since its a point light its not shining in any particular direction. How do I figure out what the orientation for the light point of view is?

sentences:
LibGDX FrameBuffer no Transparency when drawing I try to draw severeal Sprites to a FrameBuffer. The Sprites are PNGs with transparency. When I draw them directly to the screen it's fine. But when I draw on the FrameBuffer and then draw the resulting texture on the screen the transparent parts are cut out and the glBackground shines through. Any idea how to solve this?

Here is how I do it:

FrameBuffer fbo = new FrameBuffer(Format.RGBA8888, width, height, false);
Sprite fboTexture = new Sprite(frameBufferObject.getColorBufferTexture());
fboTexture.flip(false, true);

fbo.begin();
batch.begin();
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.draw(sprite1, 0,0);
batch.draw(sprite2, 0,0);
batch.draw(sprite3, 0,0);
batch.end();
fbo.end();

batch.begin();
batch.draw(fboTexture, 0,0);
batch.end();

sentences:
How to add lighting to a 2D Tile-based game in JavaFX? I'm making a 2D roguelike tile-based game with Java and JavaFX.  I'm currently working on adding lighting and darkness to the dungeon, but whenever I try running it, it takes a very long time to load, and it eventually gives an out of memory error.

Here is Lighting.java:

package sample;

import static sample.World.worlds;

public class Lighting {
    public static void calculateLighting(int wn, int skyLighting) {
        Block[][][] world = worlds[wn];
        for (int z = 0; z < worlds[Player.cw][0][0].length; z++) {
            for (int y = 0; y < worlds[Player.cw][0].length; y++) {
                for (int x = 0; x < worlds[Player.cw].length; x++) {
                    Block b = world[x][y][z];
                    b.light = skyLighting;
                    if (b.embID == 1) { //test if a block has a torch attached to it
                        for (int distance = 0; distance <= 15; distance++) {
                            for (int x1 = x - distance; x1 < x + distance; x1++) {
                                for (int y1 = y - distance; y1 < y + distance; y1++) {
                                    for (int z1 = 0; z1 < worlds[Player.cw][0][0].length; z1++) {
                                        try {
                                            world[x1][y1][z1].light += 1;
                                        } catch (ArrayIndexOutOfBoundsException ignored) {

                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        for (int z = 0; z < worlds[Player.cw][0][0].length; z++) {
            for (int y = 0; y < worlds[Player.cw][0].length; y++) {
                for (int x = 0; x < worlds[Player.cw].length; x++) {
                    Block b = world[x][y][z];
                    if (b.light > 15) {
                        b.light = 15;

                        //If your number X falls between A and B, and you would like Y to fall between C and D, you can apply the following linear transform:
                        //Y = (X-A)/(B-A) * (D-C) + C
                        //https://stackoverflow.com/questions/345187/math-mapping-numbers
                        //(worlds[Player.cw][x][y][z].light-0)/(15-0) * (1-0.5) + 0.5
                        if (b.sprite != null) {
                            b.sprite = ImgManip.darken(b.sprite, (worlds[Player.cw][x][y][z].light) / (15d) * (1 - 0.5) + 0.5);
                        }
                    }
                }
            }
        }
    }
}

What this is doing is that it first finds torches in the world, and then increases the brightness of each block around it, depending on how far away the torch is.  Then, it takes each block's sprite and makes it darker with the darken() method.  This is what is causing it to take so long. When I just comment that out, it performs just fine, but the lighting isn't there.

Here is the darken() method:

public static Image darken(Image image, double amount) {
        PixelReader pixelReader = image.getPixelReader();
        WritableImage writableImage =
                new WritableImage(
                        (int)image.getWidth(),
                        (int)image.getHeight());
        PixelWriter pixelWriter = writableImage.getPixelWriter();

        for(int y=0; y<image.getHeight(); y++){
            for(int x=0; x<image.getWidth(); x++){
                Color color = pixelReader.getColor(x, y);

                color = color.deriveColor(0,-amount/2d,-amount,0);

                pixelWriter.setColor(x, y, color);
            }
        }
        return writableImage;
    }
```

sentences:
Animation reset in libgdx i have an issue that i hope it's easy to resolve.
I'm playing various animations in my libgdx-created game.

For a particular animation, i need that to play in loop mode but only if a particular condition is true. Simple this far.

What i need is to "reset" the animation (i mean restart from sprite n°1) when the condition become true again after the animation stopped.
I know that i can simply dispose the actual animation and create another one every time the condition is true, but this seems a complicated way to resolve this..

How do i change the value of the index used by that animation? Is it possible?
Do i have to create a class that extends the Animation class from libgdx library?

sentences:
Tips on a Turn Based Strategy AI I have been working on a game for a while now, and it is going to be a TBS(Turn based strategy) in space.

And now I have come to the point where I am creating an AI for the game. I have no experience when it comes to designing AI's, the first one I ever made was based on random int's and getting the target out of an array.(not exactly a real AI)

On this topic I have a few questions:

How can an AI assess what is the best move to do next? Several units can move every turn.
How does a common AI consider what to do?(Example: Civilization, StarDrive 2, and similar)
How do I manage all the possible outcomes and the moves the AI can/should do?

sentences: How do you make the first person object the main camera? How can a first person object character be made to be the primary viewing camera in unityscript? Do I remove the main camera? or just turn one or the other on/off?

sentences: Unity: "inconsistent line endings" dialog shows up ever time I open VS with unity Everytime I open a script file from unity with visual studio this dialog shows up about normalizing the line endings? What does this mean? I click Yes every time but still can't get rid of it. It only happens when I open a file from unity.

sentences:
Spawn rates and variable time steps How would I work a spawning algorithm into a sim engine with variable time steps?

If each engine step is, say, 1/30 of a second and I have some event occur with a 0.001 probability each step, how do I translate this to an engine with a variable time step? At the end of 1 second I could have nothing spawned or (in a very unlikely event) I could have as many as 30 spawned.

Now if the engine hasn't done an update for a full second, how can my spawner simulate the same behaviour and probabilites? What if my steps are much smaller, say 1/100 or 1/1000 of a second?

What algorithms can I use?

sentences:
Sprite erasing text in Pygame I'm making a Pong clone in which the user can press the 'p' button to pause/unpause the game. When the user presses the 'p' button the word 'PAUSE' is drawn to the screen and when he presses again the word is erased. My problem is this:

As you can see, the ball sprite is erasing the text. Any clue on why this is happening? Here is the code for the main stuff.

sentences:
Rotate Box Sprite With Circle Body I want to rotate my rectangular sprite with circle body.
The problem is the body doest not attached to the centre of the sprite. This was the default behaviour of the body and sprite.

But I want that circle body attached in the bottom of the rectangle and when rotation happen at that time rectangular sprite always attached with the body at the bottom and during simulation it change its angle and position according to this only.

I try to write question in words if I don't able to understand you then know me then I post a picture of my problem here.

Although I know that cocos2d has setAnchorPoint method available so similar task become easily but what about my engine that right now I was using - AndEngine. So be relevant to this game platform.

Also thanks in advance for efforts you take.

sentences:
Can I output a text file on build with build details in it? We have an issue with organizing our builds. They get copied around and moved so much that it's hard to keep track of what is the newest.

I would like to output a simple text file to the build root (same level as exe) that contains info like the build date and time, platform, etc.

Is this possible from within Unity?  Right now we have no automated build process (CI/CD).

edit: I found onPreprocessBuild() but unfortunately one of our main projects still uses Unity 5.3.6f1, so this will not work. Is there an alternative?

sentences:
How to rotate an object around world aligned axes? I have a Vector3 which has an euler angle for each axis.

Usually, when I want to create a rotation matrix I will use functions such as D3DXMatrixRotationX passing the respective angle from my rotation vector above and multiply the matrices (ZXY) to create the overall rotation matrix which is used to form the complete object transformation matrix.

However, this method will produce a set of rotations in object space. That is, passing a vector of (90, 0, 90) into my method will create a rotation in world space effectively of (90, 90, 0).

Is there a way to always ensure each component of my rotation vector results in a rotation around the respective world space aligned axes?

EDIT:

This is an animation of what is currently happening - I want a way to rotate around the blue axes, not the red.

EDIT 2:

Just to note I am not looking for a solution involving Euler angles, but simply a way in which I can represent a transformation of multiple rotations around the world axes.

sentences:
IEnumerator Loop not Drawing Changes to Transform.position So, I'm working on an IEnumerator() that is called to spawn objects in a fountain style (kinda flying up and out and landing at a random spot nearby).  I feel like I had this working for a hot minute, but I don't know what I've done to screw it up.  It's POSSIBLE that it was only working when it was a void() instead, but I need to function to be a coroutine (or otherwise run on something other than the main thread).

So, I have this.  It works, except you only see the spawned objects after they've landed and the function has exited.

public IEnumerator ThrowFountain()
{
    System.Random rnd = new
    System.Random(System.Guid.NewGuid().GetHashCode());
    GameObject _go = Transform.Instantiate(go, t.position, Quaternion.identity);

    _go.transform.parent = t.parent.transform;
    _go.transform.position = t.position + new Vector3(0.0f, 1.5f, 0.0f);
    float trajectoryHeight = rnd.Next(3,6);
    bool closeEnough = false;

    Vector3 startVec = _go.transform.position;
    Vector3 newVec = new Vector3 (t.position.x + rnd.Next(-6,6), t.position.y, t.position.z + rnd.Next(-6,6));

    float distance = Vector3.Distance(startVec, newVec);
    float startTime = Time.timeSinceLevelLoad;
    float evalTime = startTime;

    while (!closeEnough)
    {
        float distCovered = (evalTime - startTime) * speed;
        float fracJourney = distCovered / distance;
        Vector3 currPos = Vector3.Lerp(startVec, newVec, fracJourney);
        currPos.y += trajectoryHeight * Mathf.Sin(Mathf.Clamp01(distCovered) * Mathf.PI);

        _go.transform.position = currPos;
        closeEnough = V3Close(currPos, newVec, 1.0f);
        Debug.Log("Time: " + Time.time.ToString());
        evalTime += Time.deltaTime;
    }

    yield return new WaitForEndOfFrame();
}

V3Close() just returns a bool so long as none of the vectors of the object and it's target are more than 1.0f apart.  That part seems to be working as well.  Not sure if maybe the IEnumerator loop won't draw the object (because it's not on the main thread or for some other reason)?

sentences:
Rotating plane to be parallel to given normal via change of basis I have two planes and their respective normals. I would like to rotate the second plane, planeB, so that it is parallel to the first, planeA.

To do this, I am using a change of basis to rotate each vector of planeB. To create the new axes, I do the following:

cAxis = planeA.normal;
aAxis = planeA.normal parallel to yAxis ? then xAxis else yAxis;
bAxis = aAxis cross cAxis

I create a rotation matrix from these new axes as such:

| aAxis.x  aAxis.y  aAxis.z |
| bAxis.x  bAxis.y  bAxis.z |
| cAxis.x  cAxis.y  cAxis.z |

I then multiply each vector of planeB by the rotation matrix to get their new coordinates. I think that this is the correct method for rotating the plane, but I don't believe the new axes that I am creating are correct. The results are correct when planeA's normal is parallel to the z axis, but not otherwise. Is there a standard formula for creating the new axes?

sentences:
Press button event instead of onClick() in Unity I want to add a nitro in my arcade game and i want to detect press UI button instead of click. unfortunately only onClick() event is available for UI button

what kind of options do I have ?

Thank you

sentences:
MonoGame game running slowly Through development I've been running my 2D game (Monogame 3.6) on my windows laptop, which has some crummy integrated graphics card and an i5. Now I try my game on my gaming PC, which has a GTX 970 and also an i5 (a slightly better one), and the game runs slow as hell.

I'm at a complete and total loss here. Here's what I've tried to speed up the game, and it's still hovering around maybe 15 FPS:

Reducing the game from 3 or 4 spritebatch blocks to a single one
Removing ALL shader uniform changes, so that it only sets up the shader uniforms once and never changes them
Commenting out 100% of particle rendering code.
Removing my extra render target that I used for post process fx.

After all of this, making it about as simple as a Hello World renderer, and it's still dog slow. I'm dumbfounded. Codetrack profiler says 80% of my cpu time is inside of a function called DoDraw which seems to be XNA framework code. So I'm sure it's not the update logic, or sheer number of things rendering, etc. The time anything is taking pales in comparison to DoDraw. The stack looks like this:

Tick
DoDraw
Present
PlatformPresent

But I don't really understand what it's doing and why it's taking so long. Any tips, knowledge of rendering quirks, profiling tips, etc, anything appreciated.

sentences:
How to display all the previous strings except the current strings from the list? I would like to create some sort of log to display previous strings for my game, but I still cannot figure out how to properly displaying them. I am using a button to run this method every time player clicks it.

public void AddLog()
{
    foreach (string logEvent in DisplayDialogueList)
    {
        logTextList.text = logText;
        logText += logEvent;
        logText += "\n\n";
    }
}

This method supposed to be displaying all the previous strings that has been displayed before inside DisplayDialogueList but I can't limit the displays only for the previous strings, and it will always display all the strings from the list.

I have tried the .Skip method to detect the current index of the list that are currently being displayed but it does not refresh the list, meaning if I loop to skip the first index from the list, it will always skips the first index even the current index to be displayed is second index and so on.

I also having trouble to skip the last index on the list since C# Unity does not support .SkipLast.

Any help would be appreciated.

EDIT:
Sorry for the confusion, this is how I managed to distinguish which is the current string to be displayed, it runs on button click

public void Display()
{
    //Checks to see which element from the list has the same index number as the current index
    if((index == textIndex) && !(DisplayDialogueList.Count <= index))
    {
        //Displays the string from the list that has passed the argument above
        textList.text = DisplayDialogueList[textIndex];
        index +=1;
        textIndex = index;
    }
}

Everytime the button is clicked, the index number will be increased, so it will matches with the string with the same index from the list and displays it.

UPDATE:
Ok I managed to skip the current displayed index and last index (thanks to the answer below) but this happens apparently

The Hello, my name is Mira text is in the first index of the list. How do I make sure that text won't be displayed again after the back button is clicked, which run the AddLog()?

The updated code is below:

if(!(index > DisplayDialogueList.Count))
    {
        firstIndex = DisplayDialogueList.First();
        lastIndex = DisplayDialogueList.Last();
        foreach (string logEvent in DisplayDialogueList)
        {
            if(logEvent != lastIndex && !(firstIndex == currentIndex))
            {
                logTextList.text = logText;
                logText += logEvent;
                logText += "\n\n";
            }
        }
    }

sentences:
Determining Rectangle-Circle Collision Point I'm developing a 2D game engine currently. I stuck on determining position of a rectangle that collides with a circle when its speed is added to its position. Rectangles have only x axis speed.

On picture rectangles are same. Left sided rectangles x,y,width and height values are known. Second rectangle should be next position. Circles radius, x and y values are known also. (x and y values are top left position of an object). I need to find second position of rectangle.

Edit: I can detect collision perfectly. But I need its new position.

sentences:
How can I lerp between two numbers setting the lerp time each 0.3f seconds? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlendShapesController : MonoBehaviour
{
    private SkinnedMeshRenderer bodySkinnedMeshRenderer;
    private bool randomizeNumbers = true;

    // Start is called before the first frame update
    void Start()
    {
        bodySkinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
        StartCoroutine(RandomNumbers());
    }

    // Update is called once per frame
    void Update()
    {
        if(randomizeNumbers == true)
        {
            StartCoroutine(RandomNumbers());

            randomizeNumbers = false;
        }
    }

    IEnumerator RandomNumbers()
    {
        int rand = Random.Range(0, 23);
        bodySkinnedMeshRenderer.SetBlendShapeWeight(0, rand);

        yield return new WaitForSeconds(0.3f);

        randomizeNumbers = true;
    }
}

Now I'm using a random number betwen 0 and 23 every 0.3f seconds.
I want to change it so it will lerp in the SetBlendShapeWeight at index 0 but instead rand it will lerp from 0 to 23 then from 23 to 0 when done stop waiting seconds.
So the time or speed should be set for the lerp and according to that how much time to wait.
For example if the lerp will take 5 seconds from 0 to 23 and then back from 23 to 0 then after 5 seconds start the Coroutine again.
The idea is to make some kind of mouth talk fake/cheat. So I want to mouth to be open/close smooth between 0 and 23 and then 23 to 0 before starting the new Coroutine and to be able to decide how much time it will take to make the lerp from 0 to 23 and 23 to 0.
In the screenshot when the blendshape of the mouth is set to 0 the mouth is open at 23 or 27 the mouth is closed.  So I want to simulate mouth talking between this range of numbers for example each 0.3f make the mouth close/open then after 0.3f again mouth close/open and so on.

sentences:
HTML5 Game (Canvas) - UI Techniques? I'm in the process of building a JavaScript / HTML5 game (using Canvas) for mobile (Android / iPhone/ WebOS) with PhoneGap. I'm currently trying to design out how the UI and playing board should be built and how they should interact but I'm not sure what the best solution is. Here's what I can think of -

Build the UI right into the canvas using things like drawImage and fillText
Build parts of the UI outside of the canvas using regular DOM objects and then float a div over the canvas when UI elements need to overlap the playing board canvas.
Are there any other possible techniques I can use for building the game UI that I haven't thought of? Also, which of these would be considered the "standard" way (I know HTML5 games are not very popular so there probably isn't a "standard" way yet)? And finally, which way would YOU recommend / use?

Many thanks in advance!

sentences:
How should I go about learning XNA? I want to start learning how to make games in XNA, but I have no idea where to start! If someone could advise me on what pieces of software I need and some good books or tutorials to look at, that would be most helpful.

As for my current coding knowledge, I have some good experience with Javascript (in conjunction with HTML5 canvas). I'm pretty sure I would also need to learn C# to code with XNA, so keep that in mind.

sentences:
ID3D10Device::RSSetState to be called every frame? I am trying to create a ID3D10RasterizerState with direct3D10, and then call

ID3D10Device::RSSetState()
with the proper information. However, whenever the window get rescaled, or when the app goes fullscreen, the rasterizerstate seems to reset to the default state. I have tried to set the state with WM_SIZE messages, but awkwardly, nothing seems to happen...

It works properly when I call RSSetState() every frame, but that seems highly inefficient.

Does anyone know a solution to this? It seems to be poorly documented on msdn.

Code:

bool TestGameApp::InitGame()
{
    D3D10_RASTERIZER_DESC desc;
    desc.AntialiasedLineEnable = TRUE;
    desc.CullMode = D3D10_CULL_NONE;
    desc.DepthBias = 0;
    desc.DepthBiasClamp = 0.0f;
    desc.FillMode = D3D10_FILL_SOLID;
    desc.FrontCounterClockwise = false;
    desc.MultisampleEnable = true;
    desc.ScissorEnable = FALSE;
    desc.SlopeScaledDepthBias = 0.0f;

    m_pD3DDevice->CreateRasterizerState(&desc,m_pRSState);
    m_pD3DDevice->RSSetState(m_pRSState);

    //...more code
}

WndProc:

switch( message )
{
    case WM_SIZE:
    {
        m_pD3DDevice->RSSetState(m_pRSState);
        break;
    }
}

sentences:
Referencing individual cells of a tilemap and changing texture I have a tilemap and am trying to proceduraly generate islands on it by changing the texture of the tiles and marking it as land ( I want to do this without texture atlas for now). How do you change the texture of an individual tile and how do you mark the tile to distinguish it from other tiles within map as land . I have tried to do this but for some reason even though I reference an individual tile all tiles are changing textures.

private static TiledMapTileLayer baseLayer;
private static TextureRegion landTextureReg;
private static Texture landTexture;
private static TiledMapTile landTile;

public static TiledMap generateMap(){
landTexture = new Texture(Gdx.files.internal("hex_land_trans.png"));
landTextureReg = new TextureRegion(landTexture);
TiledMap map = new TmxMapLoader().load("ocean_hex_map.tmx");
baseLayer = (TiledMapTileLayer)map.getLayers().get(0);
baseLayer.getCell(1, 1).getTile().setTextureRegion(landTextureReg);
return map;
}

sentences:
Slick & LWJGL Flickering Problem I have an flickering problem with rendering tiles.
    Rendering Method.

int tileSize = TileManager.tileSize;

    for(int y = 0 ; y < mapHeight ; y++){
        for(int x = 0 ; x < mapWidth ; x++){
            TileManager.tiles[tileIDs[y][x]].render(x * tileSize + xOffset, y * tileSize + yOffset, g);
        }
    }

TileManager

public static Tile[] tiles = new Tile[256];

public static final int tileSize = 32;

public static void loadTiles(String path){

    Image tileSet = GeneralUtils.getImage(path);

    int row = (int)Math.floor(tileSet.getWidth() / tileSize);
    int col = (int)Math.floor(tileSet.getHeight() / tileSize);

    for(int y = 0 ; y < col ; y++){
        for(int x = 0 ; x < row ; x++){
            tiles[x + y * row] = new Tile(tileSet.getSubImage(x * tileSize, y * tileSize, tileSize, tileSize));
        }
    }

}

Finally Tile

private Image tileImage;

public Tile(Image tileImage){
    this.tileImage = tileImage;
}

public void render(int xPix, int yPix, Graphics g){
    g.drawImage(tileImage, xPix, yPix);
}

If i render like this there is no flickering. I couldnt understand why ?

img = new Image("Res/blabla.png");
----------------------------------------------------
int tileSize = TileManager.tileSize;

    for(int y = 0 ; y < mapHeight ; y++){
        for(int x = 0 ; x < mapWidth ; x++){
            g.drawImage(img, x * tileSize + xOffset, y * tileSize + yOffset);
        }
    }

sentences:
Love2D STI library not drawing map at all (black screen) I'm trying to use a pretty standard map with the Simple Tiled Implementation module for Love2D, but no matter what I try, I can't get it to display anything but a black screen. Here's my current code (keybindings in an effort to see if the map has just been placed offscreen):

local sti = require "sti"
local mapPos = { x = 0, y = 0 }

function love.load()
   map = sti("maps/map1.lua")
end

function love.update(dt)
   if love.keyboard.isDown("w") or love.keyboard.isDown("up") then
      mapPos.y = mapPos.y - 5
   end

   -- Move player down
   if love.keyboard.isDown("s") or love.keyboard.isDown("down") then
      mapPos.y = mapPos.y + 5
   end

   -- Move player left
   if love.keyboard.isDown("a") or love.keyboard.isDown("left") then
      mapPos.x = mapPos.x - 5
   end

   -- Move player right
   if love.keyboard.isDown("d") or love.keyboard.isDown("right") then
      mapPos.x = mapPos.x + 5
   end
   map:update(dt)
end

function love.draw()
   -- Transform world
   love.graphics.translate(-mapPos.x, -mapPos.y)

   -- Draw world
   map:draw()
end

However, even a more basic attempt (copied from the STI tutorial linked from the README on the Github page) doesn't work, again giving a black screen:

-- Include Simple Tiled Implementation into project
local sti = require "sti"

function love.load()
    -- Load map file
    map = sti("map.lua")
end

function love.update(dt)
    -- Update world
    map:update(dt)
end

function love.draw()
    -- Draw world
    map:draw()
end

My directory structure is basically just main.lua, an assets folder, and a maps folder. The maps folder contains the Tiled tile set and the Tiled .tmx maps and the lua exported maps.

I'm on Mac OSX, using Love2D version 0.10.2.

Am I missing something? Thanks.

sentences:
How to create a reasonable AI? I'm creating a logic game based on Fox and Hounds game. The player plays the fox and AI plays the hounds. (as far as I can see) I managed to make the AI perfect, so it never loses. Leaving it as such would not be much fun for human players.

Now, I have to dumb-down the AI so human can win, but I'm not sure how. The current AI logic is based on pattern-matching - if I introduce random moves which make the board go out of pattern space the AI would most probably play dumb until the end of the game.

Any ideas how to dumb down the AI in such way that is does not go from "genius" to "completely dumb" in a single move?

sentences:
Libgdx Sprite is not drawn when generated inside another class I´ve built a gameloop where I generate new items depending on the elapsed time and want to place them somewhere on the screen. I use some randomness for the color and coordinates. For better design I want the sprites of these items to be generated by classes that contain additional information on these items. But I figured out that when doing so my sprites won´t be drawn. Sprites that are generated explictly inside my loop are perfectly drawn.

This is my current gameloop

public void loopGame(float delta) {

    Gdx.gl.glClearColor(255, 255, 255, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    timer.addDelta(delta);

    Gdx.app.debug("Bubbles", "Time: " + String.valueOf(this.timer.getCurrentTime()));

    batch.begin();

    Sprite freeBubble = new Sprite(new Texture(Gdx.files.internal("data/img/bubble_black.png")));
    freeBubble.setPosition(200, 200);
    freeBubble.draw(batch);

    Bubble newBubble = this.bubbleFlask.createNewBubble(timer.getCurrentTime());
    if (newBubble != null) {
        bubbles.add(newBubble);
        Gdx.app.debug("Bubbles", "Created new bubble!");
        Gdx.app.debug("Bubbles", "Attributes: " + newBubble);
    }

    // draw all bubbles
    for (Bubble bubble : bubbles) {
        Gdx.app.debug("Bubbles", "Drawing bubble");
        Sprite bubbleSprite = bubble.buildSprite();
        bubbleSprite.draw(batch);
    }

    batch.end();

}

The freebubble is perfectly drawn. this.bubbleFlask generates bubbles the way it is supposed to but those bubbles are not drawn inside the for loop. Debugging messages show me that the loop works as it should.

So you might guess that bubble.buildSprite() is broken. Here is this method:

public Sprite buildSprite() {
    Sprite sprite = new Sprite();
    sprite.setTexture(new Texture(Gdx.files.internal("data/img/bubble_black.png")));
    sprite.setPosition(300f, 300f);
    return sprite;
}

For the sake of demonstration I placed the same texture file here.

What am I missing here?

sentences:
How to make prefabs independent? I'm working on a Unity's Project and I want to modify a prefab, more precisely I want to change the texture of a prefab. The problem is that my modification is applied also to other prefabs. I read on the documentation how each of the buttons labeled Select, Revert and Apply works, and what I understood is that the modification should update only the selected prefab.

Here is the Prefabs' Manual which I read.

What am I missing?

PS: I'm not the author of the project, I have to apply some modifications only.

sentences:
What are "affordances" in game design? I keep hearing the word "affordance" in terms of game design, most recently in the movie Indie Game: Life After. I also vaguely remember it from a UX class in undergrad. But I have no idea what it means.

What is an affordance in the context of game design?

sentences:
How can I rotate a camera on the X and lookat target and once looking at the target to stop slowly the rotation? This is a screenshot showing the camera position.
I want it to rotate slowly smooth to the left and once looking at the soldier to stop rotating.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;

    // Use this for initialization
    void Start ()
    {

    }

    // Update is called once per frame
    void Update ()
    {

    }
}

The script is attached to a empty gameobject.
What I want to do is once the camera stopped rotating and looking at the soldier to make the soldier start moving to the right and camera should follow the soldier rotating and keep follow the soldier moving.

The main idea is to create a cut scene. The camera is position at this point just to display the cut scene.

To make the first rotation to the target I tried this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;
    Quaternion targetRotation;

    // Use this for initialization
    void Start ()
    {
        targetRotation = target.rotation;
    }

    // Update is called once per frame
    void Update ()
    {
        Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * speed);
    }
}

But the camera is not rotating at all.

This is screenshot of the Hierarchy and Inspector:

The script is attached to GameObject: SoldierNaviFight
The camera that I want to move is the child of SoldierNaviFight: SoldierNaviFightCamera

UPDATE:

This will rotate the camera but it's rotating it to the right instead to the left to the soldier. Not sure why:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;
    Quaternion targetRotation;

    // Use this for initialization
    void Start ()
    {
        targetRotation = target.rotation;
    }

    // Update is called once per frame
    void Update ()
    {
        fightCam.transform.rotation = Quaternion.RotateTowards(fightCam.transform.rotation, targetRotation, Time.deltaTime * speed);
    }
}

sentences:
Collision Detection Game Design and Architecture I've reading some articles about collision detection. My question here is about ideas on the design for it.

Baically I have a C++ game that has a main loop with entities with an update method. Based on keyboard input, these characters updates their positions.

My question is not about how to detect collisions, it's about getting ideas in which is the best way to implement this.
The game has a main character but also enemies that have to collide between them, so I'm not sure where to make all the iterations for checking collisions and if the right way is to check everything against everything.

Thanks in advance.

sentences:
Implementing Achievement System in Javascript I understand that for more complex achievements, specific code can't be avoided, but for simple ones like (player clicked 100 times) or (player earned 30 bajillion cookies) or (player played for 1 hour) it should be as simple as abstracting the achievements to something like a list of properties/values and having some event handler.

My problem is that since I'm using Javascript and there's no really clean way to do pointers, how am I supposed to create an achievement class that can be iterated through procedurally?

Ideally I'd like something like this:

Achievement class:

function Achievement(name, property, value, text, points){
  this.name = name;
  this.property = property;
  this.value = value;
  this.text = text;
}

And then I'd add an achievement like so:

achievements.push(new Achievement("Clicktastic", &numClicks, 1000, "You clicked 1000 times!");

And have some kind of function bound to a Window.setInterval that was constantly looping through all achievements and for these simple types doing something like:

for (var i = 0; i < achievements.length; i++){
  if (*achievements[i].property >= achievements[i].value){
    //deal with earning achievement
  }
}

I'm just using some C style pointer/dereferencing notation here.

Basic idea is that I'm not sure how to create a generic achievement that can arbitrarily care about specific properties without pointers.

sentences:
z ordering in directx11 Hi recently i am trying to implement z ordering system into my directx framework.
So every object will have z order property(int), and this value will have higher priority than depth checking for rendering.
the current idea is from these three my assumptions that

depth check happens after vertex shader
value of SV_POSITION is used for depth checking
modifying z component of the value of SV_POSITION doesn't affect anything except in depth checking, because it is in projection space.

so after calculating projection position(local pos * WVP mat), i did projective dividision(it seems to make problem) and modified only z component corresponding orders that i want to draw with.

This is brief Vertex shader code

VS_OUTPUT output;

output.pos = mul(WVPMat, input.pos); // projection pos
output.pos /= output.pos.w;
output.pos.z -= renderPriority;

return output;

And !!! it kinds of works !!! but when i get my camera closer to any object,
it weird thing happens

it doesn't make any this weird thing unless projective division.
i am just curious why it happens instead of knowing another alternative way for z ordering.
but any further advices and informations would be really appreciated.

sentences:
Problem with "only assignment, call, etc." while i was trying to make my 2D character not jump in the air using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class move2d : MonoBehaviour
{
    public float moveSpeed = 5f;
    public bool isGrounded = false;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Jump();
        Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
        transform.position += movement * Time.deltaTime * moveSpeed;
    }

    void Jump()
    {
        if (Input.GetButtonDown ("Jump") && isGrounded == true) {
            gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
        }

    }
}

and another file for stopping my character from jumping in the air

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Grounded : MonoBehaviour
{
    GameObject Character1;
    // Start is called before the first frame update
    void Start()
    {
        Character1 = gameObject.transform.parent.gameObject;
    }

    // Update is called once per frame
    void Update()
    {

    }

    private void OnCollisionEnter2D(Collision2D collision) {
        if (collision.collider.tag == "Ground")
        {
            Character1.GetComponent<move2d>().isGrounded == true;
        }
    }

    private void OnCollisionExit2D(Collision2D collision) {
        if (collision.collider.tag == "Ground")
        {
            Character1.GetComponent<move2d>().isGrounded == false;
        }
    }
}

sentences:
Other procedural material generators for Unity? In the new version of Unity 3.4, unity announced that they would now support procedural materials (which is awesome, by the way). While I was researching it, I found this in the manual:

  Allegorithmic's Substance Designer can be used to create Procedural Materials, but there are other applications (3D modeling apps, for example) that incorporate the Substance technology and work just as well with Unity.

I don't have Allegorithmic's substance designer and don't plan on buying it soon. What other applications or 3D modeling apps can make procedural materials that work in Unity?

Edit: I found that Allegorithmic has a program called Player. But it is on Windows only. I'm on mac.

sentences:
Measure elapsed gpu time of draw call I'm rendering to a texture via DrawIndexedPrimitive (SharpDx). In some specific situations, the framerate drops significantly when doing this render. The framerate can be improved by rendering to a smaller texture.

I want to gracefully degrade the quality of the graphics performance at runtime by measuring the impact of this particular pass and rendering to a smaller texture if the framerate would be impacted by this pass. Later, when the impact of this pass is smaller I want to restore the larger texture size.

Is there some way to measure at runtime the impact of a particular draw on the gpu? It's ok if the results of the measurement are delayed to the next frame.

sentences:
Basic Use of ApplyImpulse I am trying to apply a force to a bunch of b2_dynamicBodys, but it seems to only work for a random number of items and then stops with an error.

     //create some items to move
     bodyDef.type = b2Body.b2_dynamicBody;
     for(var i = 0; i < 5; ++i) {
        fixDef.shape = new b2PolygonShape;
        fixDef.shape.SetAsBox(1,1);
        fixDef.friction = 1;
        fixDef.restitution = .1;
        bodyDef.position.x = Math.random() * 10;
        bodyDef.position.y = Math.random() * 10;
        bodyDef.linearDamping=1;
        bodyDef.angularDamping=.8;
        itemsArray.push(world.CreateBody(bodyDef).CreateFixture(fixDef));  // store for later
     }

then i try to apply a force later with:

angle = 20;
for (var xIdx=0; xIdx<itemArray.length; xIdx++) {
    itemsArray[xIdx].GetBody().ApplyImpulse(new b2Vec2(50*Math.cos(angle*Math.PI/180),50*Math.sin(angle*Math.PI/180)););
}

the error I receive is

TypeError: 'undefined' is not an object (evaluating 'c.x')

Is there something wrong with saving the items for later use when I am creating them?  Does anyone know what is causing this.

sentences:
Weapon Sway Script messes up weapon rotation So I'm in the process of learning Unity 5 and scripting in it. One thing I wanted to give a try was to make a simple weapon sway script like you see in games such as battlefield or csgo. After a bit of documentation I finally got a script going (see below).

using UnityEngine;
using System.Collections;

public class WeaponSway : MonoBehaviour {

    float mouseX;
    float mouseY;
    float movementX;
    float movementY;
    float smooth = 3;
    public float speed;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

        mouseX = Input.GetAxis("Mouse X");
        mouseY = Input.GetAxis("Mouse Y");

        movementX = mouseX * Time.deltaTime * speed;
        movementY = mouseY * Time.deltaTime * speed;

        Quaternion final = Quaternion.Euler(defaultposition.x * movementX, defaultposition.y * movementY, 0);
        transform.localRotation = Quaternion.Slerp(transform.localRotation,final,Time.deltaTime*smooth);

    }
}

However, for some reason the simple model of the weapon I'm using changes rotation and the weapon doesn't sway like intended. I can't see the problem in the script.

Here is a gif of what is happening: http://imgur.com/zi6w6Om

sentences:
How do I check if a surface is sloping? I'm implementing gravity over a 3D terrain and I'm struggling with how to check if surface "under your feet" is flat or sloping.

I read some tutorials but gravity is always considered along a single axis.

How do I proceed?

sentences:
Player wont rotate properly So Small problem. I'm able to rotate my camera around my player AND rotate the player when the camera moves around it, but the controls don't seem to move with it. Example: W moves forward. If I look right then W should move forward in that direction. It doesn't, instead it will go left (the forward as it was before).

[SerializeField] GameObject GameCamera;

private void PlayerRotateWithCamera()
    {
        Quaternion CharacterRotation = GameCamera.transform.rotation;

        transform.rotation = CharacterRotation;
    }

private void FixedUpdate()
{
    PlayerRotateWithCamera();
    MovePlayer();
}

I only think the player is rotating cause it looks like it is, but if you look at the move tool the axis dont seem to move with the Player

Just in case my movement isn't getting along with the rotation:

private void MovePlayer()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");

        // more realistic ball movement
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I also have Tool handle rotation set to global because it's a ball, and well, those axis obvious go crazy while rolling around.

Any help at all would really be appreciated!

sentences: How to fill a rectangle with tilable texture in XNA? So, question in the title. I don't know how to create infinite seamless background.

sentences:
How should I handle functions, where two classes have equal use? I'm working on a few features for a strategy engine I'm making. I'm trying to figure out the best spots to separate the components, as either option will provide the same amount of coupling, with the same effectiveness.

For example, all players have a Damage component, a Player component, and a HealthBar component:

abstract class Damage
{
    protected abstract void sendDamage(Player targetPlayer, int rawDamage);
    public abstract int calculateRawDamage(Attack attackUsed);
    public abstract void receiveDamage(int rawDamage);
}

class Player
{
    List<Armor> equippedArmor;
    List<Buffs> currentBuffs;
    public Damage damageComponent;
    public List<HealthBars> healthBarComponents;
}

abstract class HealthBar //can be inherited for mana or health bar
{
    protected Color color;
    public float percent; //0.0 - 1.0
}

When a player receives damage, I need to show a red number floating up from their head, indicating the amount of damage. This can either be implemented in HealthBar, or in Damage. It fits damage better, but then healing works in the same way, and wouldn't be called from damage. I could abstract damage into something like ChangeValue, which would change mana, health, etc in any direction, or I could use the abstract HealthBar class to show this number being changed.

I'm trying to think of a general rule that would solve this and other problems, where two classes use the same function equally. This is an oversimplified version of my classes, but it makes more sense this way.

How should I handle functions, where two classes have equal use?

sentences:
Gdx.input.setInputProcessor(stage) doesn't work I have an image and I want to make clickable this image. I have already done this a lot of times, but this time doesn't work. Probably because the image is from a class which extends Image:

public class BitmapFontGenerale extends Image
{

BitmapFont bitmapFont;
String scritta;
private float x;
private float y;

public BitmapFontGenerale(BitmapFont bitmapFont1, String string, float scale)
{
    bitmapFont = bitmapFont1;
    bitmapFont.setColor(Color.BLACK);
    bitmapFont.getData().setScale(scale);
    scritta = string;
}

@Override
public void draw(Batch batch, float parentAlpha)
{
    bitmapFont.draw(batch,scritta,x,y);
}

public void setX(float x)
{
    this.x = x;
}

public void setY(float y)
{
    this.y = y;
}

public float getX()
{
    return x;
}

public float getY()
{
    return y;
}

}

This is the code which I used to set the input:

image.addListener(new ClickListener()
{
    @Override
    public void clicked (InputEvent event, float x, float y)
    {
       Gdx.app.log("CLICKED ", "CLICKED");
    }
});
stage.add(image);
Gdx.input.setInputProcessor(stage);

This code works if image is from Image class and not if it's from a class which extends Image. Note: I need to extend Image class. What's the problem?

sentences:
Single Array Texture, multiple wrap modes I have a array texture of which I would like some of its sub-images have wrap modes of GL_REPEAT and others to be GL_CLAMP_TO_EDGE.
From my research, I haven't found a clear answer. It appears Sampler Objects may be what I'm looking for, however I'm unsure as to how to go about implementing this.
As current I have a sampler class which looks like this:
class TextureSampler {
public:
    unsigned int id;

    TextureSampler();
    TextureSampler(unsigned int wrapS, unsigned int wrapT, unsigned int filterMin, unsigned int filterMag);
    ~TextureSampler();

    void bind(unsigned int textureId);
    void unbind(unsigned int textureId);
};

As you can expect the constructor simply sets all the wrap and filter parameters.
I bind with this glBindSampler(textureId, id);. The textureId being that from glGenTextures() and the id from glGenSamplers().
Now when it comes to my implementation, I've created two samplers, one for repeating wrap mode and another for edge clamping. This is where things are a bit murky. I've got two samplers, one texture array... it doesn't seem possible to bind both samplers at the same time and yet how do I access both types in the fragment shader? Google has not been much help and I've read parts of the ARB_sampler_objects extension to see if it had useful information and it seemed to say ...

Should sampler objects be made visible to the shading language.
This is left for a future extension.

I am using GL 4.3, so this is extension is not built-in, however that quote leaves me wondering if I've approached this all wrong. What is the correct approach to this? Is this possible with a single texture array?

sentences:
What scripting language should I choose for my game? In what cases are what scripting languages better than others?

All answers are appreciated, please provide a description, and describe in what cases the language excels in.

sentences:
How to generate fixed amount of health points in every interval when the data is in database? Most of the common example of that in the game is stamina regeneration to control the activity of the players. For example, genshin impact, they have something called resin system, and it regenerates 1 resin in every 8 minutes until the amount maxed out.
What is the algorithm for that? In my case it's hp.
My situation:
The players' data is saved in the database.
I am creating a text-based rpg game using discord bot, and the programming language I am using is python.
Here is what I had thought:

when freeing the data from the memory, save the date and time of when the hp became less than max
amount to the database.
when the data is in the memory, while hp is not full add fixed amount of hp in
every interval.
when querying the data from database, update the hp, calculate from the saved date and time,
interval, and fixed amount of hp.

Thanks in advance.

sentences:
How to implement friction in a physics engine based on "Advanced Character Physics" I have implemented a physics engine based on the concepts in the classic text Advanced Character Physics by Thomas Jakobsen. Friction is only discussed very briefly in the article and Jakobsen himself notes how "other and better friction models than this could and should be implemented."

Generally how could one implement a believable friction model on top of the concepts from the mentioned article? And how could the found friction be translated into rotation on a circle?

I do not want this question to be about my specific implementation but about how to combine Jakobsens ideas with a great friction system more generally. But here is a live demo showing the current state of my engine which does not handle friction in any way: http://jsfiddle.net/Z7ECB/embedded/result/

Below is a picture showing and example on how collision detection could work in an engine based in the paper. In the Verlet integration the current and previous position is always stored. Based on these a new position is calculated. In every frame I calculate the distance between the circles and the lines. If this distance is less than a circles radius a collision has occurred and the circle is projected perpendicular out of the  offending line according to the size of the overlap (offset on the picture).

Velocity is implicit due to Verlet integration so changing position also changes the velocity. What I need to do know is to somehow determine the amount of friction on the circle and move it backwards parallel to the line in order to reduce its speed.

sentences:
Texture Mapping to procedurally generated geometry How can I calculate texture coordinates of such geometry?

The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like geometry in the bottom of image) and red dots are generated procedurally depends on degree of smoothness given.

sentences:
90% CPU on Profile Editor: Throttle mainMessageLoop I have a big problem in my Unity game, in almost every scène of my game, my editor is laggy, when I record Porfile Editor / deep profile editor, here is the result:

I have no idea what is this throttle MainMessageLoop, what can I do ?
Thanks you !

sentences:
Android Density Independent Pixel Drawables Resource Folder I'm trying to get to grips with DIP in Android (using Eclipse). I'm writing a little game with OpenGL ES 2.0. Could I get some guidance and tips on what I'm not understanding/doing right.

From what I understand I need to make different sizes of the same image so that they appear correctly on different devices. This is because each device has a different aspect ratio and a 1cm by 1cm sprite on one screen might not be 1cm by cm on another screen.

I read here that I need to place my sprite images in the res/drawables folders. I did this, but when I try to reference the resource using:

    mySpriteTexture = new Texture(context, R.mysprite);

the R class fails to find the .png. I have tried cleaning, rebuilding etc., and tried variations like R.res.mysprite. Although I don't see the point in trying R.res.drawables-XXX as according to the article Android is meant to pick the correct images on running...

I think it must be something to do with the XML manifest? But I have no clue. Any help would be welcome.

sentences: Oculus Integration on Unity 5.1.2 not showing Oculus Lenses (like two black boxes) when debugging/editor I added Oculus Utilities for Unity 5.1.2, created a simple scene, added OVRCharacterController prefab, it works fine like normal fps controller but as far as I know, it should show something like 2 separate display screen on monitor with that black distortion outline frame. I have no hmd. The runtime is running, and OVR service is also running. It is set to extended mode. One thing to note here is that there is no Oculus setting option in player settings.

sentences:
Can I take a finished game based on a licence to the holding company? Ok so I went through 11 pages on here and have done a decent amount of Google searching, but found nothing specific to my question. I'm working on a game based on a movie. For the purpose of this I'm going to use a different movie as my example. Let’s say I'm making a game based on "Driving Miss Daisy" (because why not?).

Now I've seen plenty of questions about taking an "idea" to a company (both game and rights holders) and trying to get funding but I have no reputation and this is a side project at this point so that's probably not a good idea. But let’s say I work on my "Driving Miss Daisy" game for a year or so and at some point call it "finished". It has good art, co-op, a campaign, and achievements (because, why not?) all made 100% by me and me alone. Does anyone know the process or the likelihood of me going to Warner Bros. and their games division with some kind of deal splitting profits if they allow the release or help with it etc etc.

Even if I hear "There’s no way, ‘Driving Miss Daisy: the Game’, while awesome, will never see the light of day", I'll probably keep working. I just wanted an idea of what kind of outcome could come from this and this is a different situation than I've generally seen asked. Like I said, most are about getting money for the development itself or trying to re-release old games that have been abandoned.

Thank you to anyone who might have information about this.

sentences:
Marching squares: Finding multiple contours within one source field? Principally, this is a follow-up-question to a problem from a few weeks ago, even though this is about the algorithm in general without application to my actual problem.

The algorithm basically searches through all lines in the picture, starting from the top left of it, until it finds a pixel that is a border. In pseudo-C++:

int start = 0;
for(int i=0; i<amount_of_pixels; ++i)
{
   if(pixels[i] == border)
   {
      start = i;
      break;
   }
}

When it finds one, it starts the marching squares algorithm and finds the contour to whatever object the pixel belongs to.

Let's say I have something like this:

Where everything except the color white is a border.

And have found the contour points of the first blob:

For the general algorithm it's over. It found a contour and has done its job. How can I move on to the other two blobs to find their contours as well?

sentences:
GameLoop architecture for local multiplayer I'm writing a game for Android to which I want to add a mulitplayer mode (local multiplayer via WiFi/Bluetooth, not online multiplayer via server). I stored the exchange-code between the client devices and the host device in th methods getInput() and pushInput(). I'm currently using a single-threaded gameLoop like this in my singleplayer mode:

public void mainLoopIteration(Canvas c, float deltaTime){
    compute(deltaTime);
    render(c);
    ...
}

My question is which of the following ways is the better implementation of the multiplayer "add-ons":

Adding exchange-calls to mainLoopIteration():

public void mainLoopIteration(Canvas c, float deltaTime){
    pushInput();
    getInput();
    compute(deltaTime);
    render(c);
    ...
}

creating a second thread that handles all the exchange stuff:

public void run(){
    while(mainLoopIsRunning){
        pushInput();
        getInput();
        //???Thread.sleep(...);
    }

}

Which solution you'd suggest or maybe do you suggest a completely other way?

Thx and regards Lisa

sentences:
counting coins after a certain time I am beginner in unity .
and now i am trying to write my first game.
the game is includes appear random coins in random place on the screen , after passing a certain amount of time.(one coin will be appear and then after for example 2 seconds it will be destroyed and the other coins will be appear in another place ).
there is a  counter  which calculate the  number of click on coins which appear in scene and counting number  of clicks on screen The coin is a prefab .Now i need to count the number of coins that will be disappear after certain amount of time.
can someone help me how i can write the code.

sentences:
Is there no UI culling for unity? I don't understand, am I missing something?
I have hundreds of moving images on screen that only need to render and do their logic/physics when they are in the canvas.
Otherwise they can just deactivate to save on performance and there is a very big fps difference when they are deactivated vs activated outside the canvas.
RectMask2D on the canvas does barely anything.
Checking the bounds for hundreds of UI elements seems like madness.
So what are you supposed to do?

sentences:
Hemicube algorithm d3d9 or d3d11, float valued colors The hemicube algorithm renders the scene to 5 sides of a half-cube, from the perspective of each polygon.

Assume you place the hemicube around me and render to the 5 sides.  The idea is, we can see exactly how much of each other polygon in the scene I see, and so determine the amount of light I receive from those respective polygons.

The way I did this before was using DWORD colors, and assign a different (integer) color to each poly, called its id.  This allows for 16M colors using DWORDS.  It worked fine with the fixed function pipeline, because I was able to choose D3DDECLTYPE_D3DCOLOR in the vertex declaration, render to texture, and tally up the polygon coverage counts.

Now that I've switched over to shaders, I can't seem to make DWORD colors work anymore.  All that works is 3x 32-bit float-type colors (I am using Cg, so float4's.)

Is there a way to force D3D9 or D3D11 to use integer colors in a shader, and if not, how can I guarantee the colors I choose as "ids" for the respective polygons will end up being distinct colors in the texture I render to?

sentences:
How can I detect collision between two objects I have some code that when I click on an object with my mouse it will change it to another object. I'm using this code to change an object into a shattered version I made of it for destruction purposes. How could I change the mouse down function into a function that would activate when the object is touched by another object ?

using UnityEngine;
using System.Collections;

public class Destruction : MonoBehaviour
{
    public GameObject destructionPiece;

    void OnMouseDown()
    {
        Instantiate (destructionPiece, transform.position, transform.rotation);
        Destroy(gameObject);
    }
}

sentences:
create a simple tilemap programatically i am working on a tile roguelike
i got some of the basics working using this tutorial
http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d

but i want to be able to create a map programatically instead of using the tiled editor

just add a NSArray of sprites/tiles to my CCLayer derived class or something, or should i make use of the CCTMXTiledMap class?

can anyone gimme some hints about how to do this? or know of a tutorial or sample code somewhere?

thanks a lot

sentences:
Do you need special permission to personify companies as characters? in the Hyperdimension Neptunia series a number of human characters are personifications of games companies ie.

Compa = Compile Heart
Red = Red Entertainment
Tekken = Namco
Falcom = Nihon Falcom
Cave = CAVE Interactive
IF (Iffy) = Idea Factory
Nippon Ichi-chan/Nisa = Nippon Ichi Software/Nippon Ichi Software America

I am wondering if the creators of Hyperdimension Neptunia had to get special permission/licences from companies to personify them in the game? (ie. a developer personifying Valve or Square in their own game)

sentences:
Unity ads issue - null reference error I'm trying to add unity ads to my game. In my game there are three panels - startgame, ingame and gameover. Once the game starts, only the startgame panel is active and once you tap on the screen, the ingame panel gets actived and startgame panel is deactivated. In the ingame panel I have added a button to show ads (once an ad is ready) so that after watching the ad, user can receive 100 additional points. Here is my admanager script:
string GooglePlay_ID = "123456";
bool test_mode = true;
string myPlacementId = "rewardedVideo";

public Button inGameAdBtn;

void Start()
{
  inGameAdBtn = GetComponent<Button>();
  inGameAdBtn.interactable = Advertisement.IsReady(myPlacementId);
  if (inGameAdBtn) inGameAdBtn.onClick.AddListener(ShowRewardedVideo);

  Advertisement.AddListener(this);
  Advertisement.Initialize(GooglePlay_ID, test_mode);
}

public void ShowRewardedVideo()
{
    Advertisement.Show(myPlacementId);
}

public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{

    if (showResult == ShowResult.Finished)
    {
        GameManager.instance.GetPoints();
    }

else if (showResult == ShowResult.Skipped)
    {

    }

    else if (showResult == ShowResult.Failed)
    {
        Debug.LogWarning("The ad did not finish due to an error.");
    }
}

public void OnUnityAdsReady(string placementId)
{
    // If the ready Placement is rewarded, show the ad:
    if (placementId == myPlacementId)
    {
        inGameAdBtn.interactable = true;
    }
}

public void OnUnityAdsDidError(string message)
{
    // Log the error.
}

public void OnUnityAdsDidStart(string placementId)
{
    // Optional actions to take when the end-users triggers an ad.
}

When I hit play, I get an error in the console saying - NullReferenceException: Object reference not set to an instance of an object. When I click on it, it takes to this line of code "inGameAdBtn.interactable = Advertisement.IsReady(myPlacementId);".
I believe this is because once the game starts, the ingame panel is inactive and the admanager script is looking for the inGameAdBtn (which is in the ingame panel). Is there any way to resolve this issue?
EDIT
I have added a screenshot of the game. This is after I hit play, the first panel that is activated is the StartPanel and once I tap on the screen, the next panel will activate (InGamePanel) and the StartPanel will deactivate. The inGameAds button is in the InGamePanel which is currently inactive.

sentences:
How to load .max files to Panda3D Possible Duplicate:
  How to convert .max files to .egg on linux

Is there a way to load .max files directly to Panda3D engine? I am running Panda3D on linux so converting them using 3ds max is bit difficult.
Or at least is there a work around this problem?

sentences:
Game Logic - Tree Based Game Design I'm trying to write an easy to use and extremely modifiable game engine in C++. I was thinking about using a tree to store game data. All objects would inherit a from the Node class and would have parents and children. For example to access an object you could make a request the tree for game.workspace.player or game.devices.controller. I've seen this done in other games and it seems to work well.

Is this worth implementing? Would it affect the performance of my engine? -- I'm just looking for the best way to organize game data. Any critique or insight is greatly welcomed!

sentences:
android: How to apply pinch zoom and pan to 2D GLSurfaceView I want to apply pinch zoom and panning effect on GLSurfaceView. It is Image editor, so It would not be 3D object. I tried to implement using these following links:
https://groups.google.com/forum/#!topic/android-developers/EVNRDNInVRU

Want to apply pinch and zoom to GLSurfaceView(3d Object)
http://www.learnopengles.com/android-lesson-one-getting-started/

These all are links for 3D object rendering. I can not use ImageView as I need to work out with OpenGL so, had to implement it on GLSurfaceView.

Suggest me or any reference links are there for such implementation.
**I need it for 2D only.

I am able to do both now, but where I am getting problem is to set the pivot point while panning can any one help me to set the translation respective to pivot point?

Matrix.setIdentityM(mScaleMatrix, 0);
        Matrix.scaleM(mScaleMatrix, 0, scaleX, scaleY, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mScaleMatrix, 0);
Matrix.setIdentityM(mTranslateMatrix, 0);
        Matrix.translateM(mTranslateMatrix, 0, deltaX, deltaY, 0);
Matrix.multiplyMM(mProjectionMatrix, 0, mProjectionMatrix, 0,
                    mTranslateMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

sentences:
generating random block-based worlds with 3D noise I want to create a 3D block-based infinite world.

For any block, I want to be able to compute its block type.

3D perlin noise is the usual building block of such a world.  If you ask the 3D noise function the value for a 3D point, it'll give you a value between -1 and 1.

How do you turn this number into a block type?

I want blocks on the surface to be turf, and different minerals to have different probabilities based on depth.  I want sprawling caves and caverns and lava flows but not small ones.  And so on.

So how do you turn noise into block types into a coherent subterranean world?  Particularly how do you make things like coal appear in seams and crystals only appear in caves and any other rules that can be invented that make the type of a block dependent upon its neighbours?

And how to do this efficiently, in an oracle function rather than by having to create large 3D arrays to store the decided outcomes of some terraforming?

sentences:
How to create a reliable Installation Package for Windows in seconds? I am looking a reliable way to create an Installation Package for a Unity 3D Video Game.

I have just tried NSIS (Nullsoft Scriptable Install System)
But the default user interface (of the final result) appear too much old.

If you have a better method (based on script) please give an advice!

sentences:
Problem with scrolling background in one OpenGL loop I have 960x3000 map image in png and I'm scrolling it in a loop like this (it's called in 60 FPS loop):

glPushMatrix();
    glBindTexture( GL_TEXTURE_2D, mapTex[iBgImg]);
    glBegin(GL_QUADS);
    double mtstart = 0.0f - fBgVPos/(double)BgSize;
    double mtend = mtstart + mtsize;
    glTexCoord2d(0.0, mtstart); glVertex2f(fBgX, TOP_MARGIN);
    glTexCoord2d(1.0, mtstart); glVertex2f(fBgX + MAP_WIDTH, TOP_MARGIN);
    glTexCoord2d(1.0, mtend); glVertex2f(fBgX + MAP_WIDTH, BOTTOM_MARGIN);
    glTexCoord2d(0.0, mtend); glVertex2f(fBgX, BOTTOM_MARGIN);
    glEnd();
glPopMatrix();

unfortunately it isn't smooth when the game is in windowed mode. However, it is smooth in full screen mode. I'm using GLFW for windows. Maybe there is something wrong with my method? Is there anything better? Or could this be hardware problem?

Edit:
Window is created using

 glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
 glfwOpenWindowHint(GLFW_REFRESH_RATE, 60);

and main loop is using glfwSwapInterval(1) to ensure 60 FPS;

sentences:
Wrong FPS calculations in GLFW game In my game loop,

m_currentFrameTimestamp = glfwGetTime(); // Get the current timestamp
if ((m_currentFrameTimestamp - m_lastFPSDisplayTimestamp) >= 0.25) { // If 1/4 of a second
                                                         // passed, update the FPS counter
    double renderTime = m_currentFrameTimestamp - m_lastFrameTimestamp; // Frame time
    m_fps = (unsigned int)round(1 / renderTime); // FPS
    std::string title = "MyGame ["s;
    title += std::to_string(m_fps);
    title += " FPS]"s;
    glfwSetWindowTitle(m_window, title.c_str()); // The title
    m_lastFPSDisplayTime = m_currentFrameTime; // Reset the FPS update timer
}
m_lastFrameTime = m_currentFrameTime; // Reset the frame time timer

calculates the FPS from the frame time and displays it in the window title. However, with just this and glClear() above, the FPS displayed in the title is very unstable (with each FPS update, it changes from 46 FPS to 87 FPS and back), even though back in the initialization step, I enabled VSync, and my display's frequency is 60 Hz. Furthermore, using Fraps, I found out that the program actually runs at a stable 60 FPS. So, what's the problem with my FPS calculation code (more specifically, why is glfwGetTime() producing inaccurate results - my code, being way too simple, just can't be wrong, it's a very simple calculation that cannot give errors of any kind)?

sentences:
Which memory is used in D3D12 resources? According to MSDN there are three types of memory in D3D12, commited resources, placed resources and reserved resources. I do not understand where they are. Are they in RAM? Are they in VRAM? Are they memory mapped somehow so they are both in RAM and VRAM at (approximately?) the same time?

Realised I might have misunderstood memory mapped memory, perhaps it is just an abstraction for sending things over PCIe, not something that goes to RAM and then somewhere else.

sentences:
Using Threads to create GameObjects I have this game client which connects to the server and sends requests and getting responses.

I have created a separate thread for listening to the server. Based on the response from the server, I want make GameObjects.

But the problem is, the server response is taken into my game using a separate thread. And as far as I know, we cannot create game objects in unity in any other thread than Main Thread.

How to create game objects based on the server response?

I am new to c# and unity. Sorry if this is a silly question. I did some research on the topic and I couldn't find and answer. There were posts saying to use coroutines; but I can't quite understand them.

sentences:
Game physics of tearing apart For a game I'm programming I'm looking for a kind of realistic mechanic for simulating the tearing apart of objects. Let me explain:
I have a given point p in a 2-dimensional space (possible later also more dimensions so a solution should be scalable, which i assume is not the problem) and I have a number of forces f1, f2, ..., fn acting on this point p. So normally this point moves over time according to the combination of this forces. But now I'm looking for a kind of realistic mechanic that if forces vary strongly the point/objects gets split up in two points/objects that move in different directions.
Here a simple visual example:

three "similar" forces resulting in one single force (the point will move according to this single vector)

three forces that "tear" the point apart and result in two vectors (point will be split up in two new points that move according two the respective vector)
I amuse we need two give the point some kind of inner force, that defines how easy it is to tear the point apart?
By kind of realistic I mean something that doesn't need to be extremely realistic according to the real world physics but something that would fell kind of real in a video game. So an additional benefit would be that it can be easily computed.

sentences:
Locomotion-system with irregular IK Im having some trouble with locomtions (Unity3D asset) IK feet placement. I wouldn't call it "very bad", but it definitely isn't as smooth as the Locomotion System Examples.

The strangest behavior (that is probably linked to the problem) are the rendered foot markers that "guess" where the characters next step will be. In the demo, they are smooth and stable. However, in my project, they keep flickering, as if Locomotion changed its "guess" every frame, and sometimes, the automatic defined step is too close to the previous step, or sometimes, too distant, creating a very irregular pattern.

The configuration is (apparently)Identical to the human example in the demo, so I guessing the problem is my model and/or animation. Problem is, I can't figure out was it is =S

Has anyone experienced the same problem? I uploaded a video of the bug to help interpreting the issue (excuse the HORRIBLE quality, I was in a hurry).

sentences:
How do I differentiate between the two Vive motion controllers? I am working with a Vive Pre (devkit) and I have most everything working the way I want it to. However I am wondering how do I refer to or even know which motion controller is which? From what I can tell the headset is ALWAYS assigned first into a list, and the others are seemingly randomly assigned.

So how do I differentiate between the two or refer to one separately?

sentences: How is 2D lighting implemented? I am wondering what the best way to approach a "lighting" effect in 2D games is. For instance, if my main character is glowing, what techniques can I use to complete the visual effect of the character glowing when it is near other objects which would be affected by the light?

sentences: how to make the capsule move during anims I'm trying to make a cartwheel/ dodge to the side in ue4 but when the animation plays it moves out of the capsule and slides back. Is there a way to make the capsule move with the character in the animation.

sentences:
Canvas not filling up the whole screen in Unity 5 I am trying to make my canvas auto resize to any screen size. These are my canvas scalar settings:

UI mode: change with screen size

match height and width

reference resolution: 600x800

I looked up in various tutorials where they say to set it to "change with screen size" and "match height and width" so I did that but still it's not fitting. The weird thing is that it fits horizontally but not vertically.

screenshot: https://s15.postimg.org/ue99zehkr/Screenshot_20161207_132731.png

sentences:
Turn a spaceship at a max rate Using the following to turn a spaceship in a C# FarseerPhysics simulation.

 var turnPower = _Inventory.EngineTurnPower * time;
 body.ApplyTorque(turnPower);

If the user keeps holding in the turn key the ship will go into a superspeed turn och chaos were it eventually is impossible to tell which direction it is facing.

What would be some good way of limiting the turn speed that the user can cause, without limiting the simulation itself.

sentences:
Pac-Man - Public Domain? I've googled this and haven't come up with anything. Can I create a Pac-Man game and not get in trouble with?

Like can I sell it, and be able to make money without having to pay someone else royalties?

sentences:
Unity: How to apply bloom to only some objects in the scene? In my game I want to apply bloom, from the standard assets, to only a few objects in the scene. To do that, I set up 2 cameras at the same position and orientation, one with the bloom component and the other without. Then I put the blooming objects on a "Bloom" layer, set the blooming camera to only render objects on this layer, and the main camera to render everything else.

Then I noticed that, if the main camera has a depth lower than the bloom camera, then the bloom camera will apply bloom to everything in the scene. I guess that's because the bloom effect works on everything rendered up to the point the script is executed.

So I made sure that the bloom camera has the lowest depth and clears with a solid color. Main camera does not clear. However, now I lose the illuminated pixels around the blooming objects. I guess they are overwritten by the main camera, since the blooming camera probably did not give them any depth.

Here's a simple scene to illustrate the problem:

Currently the game looks like this:

If I swap the configuration of the 2 cameras (Main camera: lower depth, clear with solid color; Bloom camera: higher depth, don't clear), the game looks like this (exaggerated for demonstration):

What I want is the yellow object to look like that in the last image, and the purple object to look like that in the second last image. How?

Because of company policies, I am limited to Unity 5.4.1f1, and cannot use anything not made by Unity in the Asset Store.

sentences:
Animate sprite/texture position with VBO I'm currently worlking on a renderer for my projects and I want animate a sprite on screen. I've got a spritesheet but I don't know what is the the best way to update the texture coordinates for each vertex.

Update vertices then update vertex buffer. (Heavy ?)
Send to the shader my texture coordinates (It is possible ?)
Don't use VBO ?

By the way, I've got this structure :
Object class with Geometry (Faces + Vertex + Buffer) and Material (Shader + other stuff ) properties, it is a good structure ?

Thanks!

sentences:
Integrating Unity physics with Entitas I've used Entitas a bit and it appeared to me as a great way of creating clean, modular code. I've seen few examples of games created with this framework, and most of them were puzzles, TD's, simple RPG's, etc. Those made me come to think, that ECS like that is not suitable for games making big use of Unity built-in physics engine. Rigidbody in this case is part of View layer, but it would affect for example "position" component, so we can't say they are really separated. Unity Physics also works at it's own pace, so there is not really a chance for independent Component-System based simulation.

Are there any generally accepted solutions, or if I don't wan't to write my own physics engine, I should give up Entitas?

sentences:
Are there any disadvantages of using Distance Squared checks rather than Distance? I use distance squared checks for basically all my distance (vector3 length) checking, due to the performance increase from not incurring a square root (like in plain length checks).

From the looks of it, squared distance checks work fine in every situation:

if x^2 < y^2, then x < y, even when 0 < (x or y) < 1

I am not considering situations where x or y is less than 0, as distance and distance-squared is always going to be positive.

Since this works, it looks like distance checks are never ever needed, but I have a nagging feeling that i'm missing something. Will this still hold up in accuracy-critical situations?

sentences:
What's the URL of the video showing an EA representative talking about game programming? The video shows an EA representative talking about how a programmer can get into the industry by showing some demos (in fact, he shows a physics demo presented by a candidate who wanted a job at EA). The demo shown depicts kind of a ragtime doll made of yellow cobblestones.

I don't remember if I watched on YouTube or Vimeo and I frankly cannot find it after a few hours of work. I just remember the fact that it was taken at a GDC or a SIGGRAPH convention.

Thanks in advance. I'm really frustrated because I'd love to show this video to some fellow developers (coders).

sentences:
What forms of non-interactive RPG battle systems exist? I am interested in systems that allow players to develop a battle plan or setup strategy for the party or characters prior to entering battle. During the battle the player either cannot input commands or can choose not to.

Rule Based
In this system the player can setup a list of rules in the form of [Condition -> Action] that are then ordered by priority.

Gambits in Final Fantasy XII
Tactics in Dragon Age Origin & II

sentences:
How are flow fields different from potential fields? I've heard of of both flow fields and potential fields for pathfinding in games. They sound similar, but I never see them mentioned in the same contexts. Places that mention one never mention the other, as if they're completely unrelated.

How are they different? Why would I choose one over the other?

sentences:
Pixel-perfect rendering to a rendertarget with a fullscreen quad I have some trouble rendering a bunch of values to a rendertarget. The values never end up in the exact range I want them to. Basically I use a fullscreen quad and a pixel shader to render to my rendertarget texture and then intend to use the texture coordinates as basis for some calculations in the shader. The texture coordinates of the quad range from (0,0) in the top left to (1,1) in the bottom right corner... the problem is, after interpolation, these values don't arrive at the pixel shader as such.

An example:
I render to a 4x4 texture and the shader in this case simply outputs the texture coordinates (u,v) in the red and green channels:

return float4(texCoord.rg, 0, 1);

What I want to get out of it is a texture where the pixel in the top left is RGB (0,0,0) and thus black, the pixel in the top right is RGB (255,0,0) and thus a bright red and the pixel in the bottom left is RGB (0,255,0) - a bright green.

However, instead I get this here on the right:

(straight quad rendering, no correction)

The top left pixel is black, but I only get a relatively dark red and dark green in the other corners. Their RGB values are (191,0,0) and (0,191,0). I strongly suspect it has to do with the sampling locations of the quad: the top left pixel correctly samples the top left corner of the quad and gets (0,0) as UV coordinates, but the the other corner pixels don't sample from the other corners of the quad. I have illustrated this in the left image with the blue box representing the quad and the white dots the upper sampling coordinates.

Now I know about the half pixel offset you should apply to your coordinates when rendering screen-aligned quads in Direct3D9. Let's see what kind of result I get from this:

(quad rendered with DX9's half pixel offset)

Red and green have gotten brighter but still aren't correct: 223 is the maximum I get on the red or green color channel. But now, I don't even have pure black anymore, but instead a dark, yellowish gray with RGB(32,32,0)!

What I actually need would be this kind of rendering:

(target render, reduced quad size)

It looks like I have to move the right and the bottom border of my quad exactly one pixel up and to the left, compared to the first figure. Then the right column and the bottom row of pixels all should correctly get the UV coordinates right from the border of the quad:

VertexPositionTexture[] quad = new VertexPositionTexture[]
{
    new VertexPositionTexture(new Vector3(-1.0f,  1.0f, 1f), new Vector2(0,0)),
    new VertexPositionTexture(new Vector3(1.0f - pixelSize.X,  1.0f, 1f), new Vector2(1,0)),
    new VertexPositionTexture(new Vector3(-1.0f, -1.0f + pixelSize.Y, 1f), new Vector2(0,1)),
    new VertexPositionTexture(new Vector3(1.0f - pixelSize.X, -1.0f + pixelSize.Y, 1f), new Vector2(1,1)),
};

However this didn't quite work out and caused the bottom and right pixels to not render at all. I suppose these pixels' centers aren't covered by the quad anymore and thus won't get processed by the shader. If I change the pixelSize calculation by some tiny amount to make the quad a tiny amount bigger it kinda works... at least on a 4x4 texture. It doesn't work on smaller textures and I fear it subtly distorts the even distribution of uv values on bigger textures as well:

Vector2 pixelSize = new Vector2((2f / textureWidth) - 0.001f, (2f / textureHeight) - 0.001f);

(I modified the pixelSize calculation by 0.001f - for smaller textures, e.g. 1D lookup tables, this doesn't work and I have to increase it to 0.01f or something bigger)

Of course this is a trivial example and I could do this calculation much more easily on the CPU without having to worry about mapping UVs to pixel centers... still, there has to be a way to actually render a full, complete [0,1] range to pixels on a rendertarget!?

sentences: Dependency setup between libGDX projects in Eclipse IDE For my game I'd like to create another project that extends the functionality of libGDX and since it will be an independent project it could be easily reusable. How can I achieve this in Eclipse IDE? Do I have to use any building tools like Ant or Maven? I'd prefer not using them but I also don't want that the libgdx.jar file to get in the final jar twice. Do I have to create a full libGDX project (with gdx-setup-ui) for the extension project or is it enough to create a simpe Java Project and add the libGDX library?

sentences:
Representing 3D World Space with 2D Tiles How can I represent 3D world space with 2D tiles? I do not mean isometric, which is visually represent 3D objects in 2D space.

Let's say there's some height map, and each 2D tile (X, Y) represents a coordinate on the top of the map - so the Y is generated automatically, X stays the same and the tile's Y is the 3D Z component. Is it the right way to transform 2D coordinate to a 3D coordinate (again, on top of the terrain)?

Also - is it possible to implement water effect this way?

I'd like to read any articles/tutorials/opinions on this subject and how to implement it.

Thanks!

sentences:
How do you "branch" a Unity project How do you branch a unity project?
Suppose you have Game Project A, and say there is variant A' that requires a large convoluted plugin. But the idea is also that you want to keep developing this without the plugin getting in the way, for the other variants - say A and A'' - that don't require it.

sentences:
Weird error with opengl in Android using Libgdx : "EGL_BAD_ATTRIBUTE" I am having a weird error when uploading my game in the phones.

E/Adreno200-EGL(5128): qeglDrvAPI_eglGetConfigAttrib:484>: EGL_BAD_ATTRIBUTE

I am uploading the textures with AssetManager.

I am using OpenGL 1.0.

It begans to upload the textures, but when it is about to finish uploading them, it finishes unexpectedly without any message in logcat.

Any ideas what is happening?

When I updated my xperia ray to ics it began having this problem

And when it loads, and I navigate through screens I get this in logcat

<qgl2DrvAPI_glClear:33>: GL_INVALID_VALUE

This is my line using the clear

this.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

The type of gl is GL10

Although the first error occurs when it is loading :/

Here is my logcat output

sentences: How to force XNA to render model very far away as a light dot? Making a space strategy game focusing on commanding a large fleet, with 1000+ ships per side.(I'm new in XNA 3D...below is a test screenshot. The ships will be scaled down another 2-5 times) When a unit is too far away, it's not rendered anymore.(obviously...when people get killed, they die) are there any way (as fast as possible) to force XNA to render the model into a 1-pixel dot if it's too far/smaller than 1 pixel? (I'm thinking about dynamic scaling, but that will probably drag down the performance severely)

sentences:
How to prevent object from moving when it's mesh/collider is being updated? So I a made a script that lets the player grab a vertex, move it, and then update the mesh. To help prevent the player from trying to clip it through other objects I made it so the mesh/collider is constantly being updated. It works however there is an issue where it keeps falling into itself. So I tried updating the constraints to prevent this but it doesn't seem to help anything.

Visualization...

With the mesh being updated after the LMB is released: http://gifyu.com/images/withnocollisionprevetnion.gif (SE doesn't like non-imgur links apparently and they are too big for imgur).

With the mesh being updated in real time: http://gifyu.com/images/withcollisionprevetnion.gif

Also here is a gif showing how constraints on the RB don't solve the problem
 (I've tried freezing on different axes but those still cause issues too): http://gifyu.com/images/constprob.gif

So basically what can I do to prevent the object from moving when it's mesh/collider is being updated?

sentences:
A view and projection matrix oddity? I have a bit of a dilemma ...
So i setup my scene how I want it with some bits in it and now I want to move all my camera related code in to a camera class however doing so is proving to be a pain in my ass.

So in my game code (my main game class) I have ...

    protected override void Initialize()
    {
        model = new TerrainModel();
        base.Initialize();

        // Load known core components
        camera = new Camera(this, cameraPosition, new Vector3(10, 10, 10));
    }

Then in update ...

    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            this.Exit();

        camera.Update();

        base.Update(gameTime);
    }

Then in draw ...

    protected override void Draw(GameTime gameTime)
    {
        cubeEffect.View = Matrix.CreateLookAt(cameraPosition, new Vector3(10, 10, 10), Vector3.Up);
        cubeEffect.View = camera.View;

        cubeEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 1.0f, 1000.0f);
        cubeEffect.Projection = camera.Projection;
    }

It's these draw lines that have me confused.
If i use the first pair (the lines that create the matrices there and then) it all works.

If I use the second pair (pulling the same thing from my camera class) it doesn't and i get a blank screen.

I'm only rendering a single model so there's a chance it could be pointing in the wrong direction but it seems to have done what i expect when i put breakpoints in and look at the variables.

So what have i done wrong?

Here's my camera class ...

public class Camera
{
    #region fields

    Matrix viewMatrix;
    Matrix projectionMatrix;
    Viewport viewPort;
    BoundingFrustum cameraViewableBounds;
    Vector3 currentTarget;
    Vector3 cameraPosition;

    #endregion

    #region Properties

    public Matrix Projection { get { return projectionMatrix; } }
    public Matrix View { get { return viewMatrix; } }
    public Viewport ViewPort { get { return viewPort; } }

    public Vector3 Position
    {
        get { return cameraPosition; }
        set
        {
            cameraPosition = value;
            Update();
        }
    }

    public Vector3 TargetPosition { get { return currentTarget; } }

    public bool CanSee(BoundingBox ObjectBounds)
    {
        if (cameraViewableBounds.Contains(ObjectBounds) != ContainmentType.Disjoint)
            return true;

        return false;
    }

    #endregion

    public Camera(Game game, Vector3 startingPosition, Vector3 startingTarget)
    {
        cameraPosition = startingPosition;

        // creates a new view matrix
        LookAt(startingTarget);

        viewPort = game.GraphicsDevice.Viewport;

        // Set the Projection matrix which defines how we see the scene (Field of view)
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 0, 1, 10000);
    }

    #region Camera state updating

    public void Update()
    {
        viewMatrix = Matrix.CreateLookAt(cameraPosition, TargetPosition, Vector3.Up);
        cameraViewableBounds = new BoundingFrustum(viewMatrix * projectionMatrix);
    }

    public void LookAt(Vector3 target)
    {
        currentTarget = target;
        viewMatrix = Matrix.CreateLookAt(Position, TargetPosition, Vector3.Up);
    }

    #endregion
}

}

I'm sure this is something crazy simple that i've missed ... i just can't see it.

NOTE:
I have omitted a lot of code here to try and simplify my question but I'm pretty sure the rest of my code is fine because it works unless I use this new camera class, however I can provide more if its needed.

sentences:
Do I need the 'w' component in my Vector class? Assume you're writing matrix code that handles rotation, translation etc for 3d space.

Now the transformation matrices have to be 4x4 to fit the translation component in.

However, you don't actually need to store a w component in the vector do you?

Even in perspective division, you can simply compute and store w outside of the vector, and perspective divide before returning from the method.

For example:

// post multiply vec2=matrix*vector
Vector operator*( const Matrix & a, const Vector& v )
{
  Vector r ;
  // do matrix mult
  r.x = a._11*v.x + a._12*v.y ...

  real w = a._41*v.x + a._42*v.y ...

  // perspective divide
  r /= w ;

  return r ;
}

Is there a point in storing w in the Vector class?

sentences:
Writing via content pipeline in Xbox game project I'm creating an Xbox application and I have this problem with the content pipeline. Loading .xnb files is not a problem but I can't seem to find any helpful tutorials on writing via the content pipeline. I want to write an XML whenever the user presses a custom made "save" button. I've searched the web for "saving game sate" etc. but so far I haven't found a solution for my case.

So, summarized: is there a way to write data (in XML format) via the content pipeline, if my Save() method is called?

Cheerz

sentences:
Unity: transform.LookAt(target) not "looking at" target? I have been troubleshooting a prefab for several hours and am out of ideas. It concerns a method that I thought I was comfortable with, transform.LookAt(target).  I have this prefab:

As you can see, I verified that the registration points for the eyes are at the center of mass; I also verified that they rotate correctly for the X, Y and Z axes. That yellow ball you see is the target object and IS NOT inside the prefab.

I have tried two means to get the eyes to look at the target. The first is this script, and it caused the eyes to dart 90 degrees counter-clockwise about the y axis (which is very wrong). I applied this script to both eyes. Check it out:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookAt : MonoBehaviour
{
    public Transform target = null;

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(target);
    }
}

And please, before you think it: Yes, I remembered to set the target object in the editor. You can see the eyes pointing to the side instead of the target:

I found this other script on the Unity documentation that didn't work at first, but then I changed "Rotation" to "LocalRotation", saw that I was close, reversed the "relativePos" vector, and it worked--but only about the y axis:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookAt : MonoBehaviour
{
    public Transform target = null;

    // Update is called once per frame
    void Update()
    {
        Vector3 relativePos = transform.position - target.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, Vector3.up;
        transform.localRotation = rotation;

    }
}

You can see here that it works in the XY plane at eye level, but take my word for it when I say the eyes cannot look up or down if I move the ball up or down:

How can I fix this so that the eyes always look at the target I need it to?
Thank you sincerely for your time.

EDIT: I fixed it by this sloppy additional rotation, but there has to be a better way:

void Update()
    {
        //transform.LookAt(target);

        Vector3 relativePos =  target.position - transform.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, new Vector3(0,1,0));
        transform.rotation = rotation*Quaternion.Euler(0,90,0);
    }

sentences:
How to visualize objects in darkness Below I've an image of my current scene, and two images of what I want to achieve. Now the question is, how can I visualize objects in low light, as you can see the current scene isn't that attractive however the pic from kentucky route zero is soul capturing, so what should I do? Any type of guidance will be appreciated c:

Current Scene:

Required Output:

sentences:
OpenGL ES 2.0 gluUnProject I've spent more time than I should trying to get my ray picking program working. I'm pretty convinced my math is solid with respect to line plane intersection, but I believe the problem lies with the changing of the mouse screen touch into 3D world space.

Heres my code:

    public void passTouchEvents(MotionEvent e){

        int[] viewport = {0,0,viewportWidth,viewportHeight};
        float x = e.getX(), y = viewportHeight - e.getY();

        float[] pos1 = new float[4];
        float[] pos2 = new float[4];
        GLU.gluUnProject(   x, y, 0.0f,
                            mViewMatrix, 0,
                            mProjectionMatrix, 0,
                            viewport, 0,
                            pos1, 0);

        GLU.gluUnProject(   x, y, 1.0f,
                            mViewMatrix, 0,
                            mProjectionMatrix, 0,
                            viewport, 0,
                            pos2, 0);
    }

Just as a reference I've tried transforming the coordinates 0,0,0 and got an offset.  It would be appreciated if you would answer using OpenGL ES 2.0 code.

sentences:
Instantiate GameObjects and change Material when it hits on the ground There is a code for instantiate cube into the list and change a  Material of each clone when it hits on the ground
The following code works but not in Real-Time. Update function works like a Start function for a Foreach method
How to get a value of  item.transform.position.y in the Update function Real-Time?
public GameObject cubePrefab;
public Material RedMat;
public float GroudLevel = 0.5f;

void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
         List<GameObject> cloneList = new List<GameObject>();
         //instantiate clones into the list
         for (int i = 0; i < 10; i++)
         {
            var clone = Instantiate (cubePrefab,new Vector3(Random.Range(-3f, 3f),
            Random.Range(4f, 10.5f),Random.Range(-3f, 3f)), Quaternion.identity);
            cloneList.Add(clone);
         }

         //if clone is grounded change a Material for each clone
         foreach (var item in cloneList)
         {
            //Debug.Log(item.transform.position.y);

            //check if clone is on the ground
            if(item.transform.position.y < GroudLevel)
            {
             item.GetComponent<Renderer>().material = RedMat;
            }

        }

    }
}

There is a screenshot for a GroudLevel = 7

sentences:
How to detect unknown forces on pool re-used rigidbody? I have a ragdoll which performs dying quite well when it is initialized. But when the same prefab object is re-used by being pooled and recycled, it jerks violently when die. As if some forces were left on the rigidbodies when the mesh is disabled.

My code goes through the rigidbodies in the ragdoll and sets isKinematic when the enemy is alive and does his usual animations, but turns isKinematic false when the enemy dies so that ragdoll can take over.
From there the pool's lifetime kicks in giving the corpse sometime to be a ragdoll, then the whole gameobject is disabled and pooled.
When a new enemy is to generated the pool is asked for one and it is provided. The enemy enters the game normally and performs it's animations correctly.
This is where the problem occurs, when the enemy is killed a second time it "jerks" upward as if collapsing in on itself.

The only thing I could think of it that there are some forces left on the mesh when disabled and they activate again when the ragdoll is enabled through death.
So I went through all rigidbodies and do:

rigidbody.angularVelocity = Vector3.zero;
rigidbody.velocity = Vector3.zero;

But this doesn't also work, so I'm not sure if it's remnant forces or even if there's such a thing.

What else could be effecting the gameobject to cause a sudden jerk in the ragdoll, which supposedly doesn't have any forces applied on it's inception?

sentences:
Cannot explicitly hide variable member even using "new" keyword See the answer by me, this problem is pretty much my own mistakes of miss understandings.

So, here is my problem.

I have parent class called CameraBehaviour derived from MonoBehaviour

public class CameraBehaviour : MonoBehaviour
{
    public MinMax CameraViewRange;

    private Single CalculateViewRange() { ... }
}

and have two class ActionCamera2D and ActionCamera3D derived from CameraBehaviour

public class ActionCamera2D : CameraBehaviour
{
    [MinMaxRange (2f, 5f)]
    public new MinMax CameraViewRange = new MinMax(2f, 5f);
}

public class ActionCamera3D : CameraBehaviour
{
    [MinMaxRange(20f, 50f)]
    public new MinMax CameraViewRange = new MinMax(20f, 50f);
}

as you can see, both the script has CameraViewRange with new keyword and has different MinMaxRange attribute attached on each script, so the limit is will be vary between this script but still using the same CalculateViewRange calculation as the parent script.

But it turns out to be not possible, in Unity at least, raising an error:

The same field name is serialized multiple times in the class or its parent class.
This is not supported: Base(MonoBehaviour) CameraViewRange

MinMaxRange is a custom written attribute for property drawer.
MinMax is a custom struct that store min and max value.

  So, how can I overcome / deal with this problem ?
  No, you can't, it's the C# design pattern to prevent that.

  Is my code pattern here is wrong ?
  Yes.

  Is there any workaround or better solutions for this ?
  See the answer by me.

  Or is this the C# and Unity limitations ?
  It's just the C# and Unity Inspector design pattern.

thanks

sentences:
When to get input state: multiple times or one time in a static class? Let's say I have these classes:

Player

Here I want to make the player jump:

  current_state_ = Keyboard.GetState();
  if ((current_state_.IsKeyDown(Keys.Space) || current_state_.IsKeyDown(Keys.Up))
       Jump();

Intro scene
GameOver scene

Here I just want to give the possibility to skip those scenes:

  current_state_ = Keyboard.GetState();
  if ((current_state_.IsKeyDown(Keys.Space) || current_state_.IsKeyDown(Keys.Up))
       SkipScene();

My question is what is usual done:

"Asking" for input in every class, or make a static class that asks for input every update, and then you get that value?

public static class InputHandler
{
    private static KeyboardState current_state_;

    public static bool IsSpacePressed()
    {
        return current_key_.IsKeyDown(Keys.Space);
    }

    // Others

    // To be called in game's main loop
    public static void Update(GameTime gametime)
    {
        current_key_ = Keyboard.GetState();
    }
}

I'm worried about that because I thought (don't know if it is correct!) that maybe it is wrong to ask multiple times per update for input.

sentences:
Animation won't play unless movement key is held down In Game Maker I am creating a 2D RPG and combat is a part of it. I have some animations that will play when the left or right mouse button is pressed (Depending on if you want ranged or melee attacks) but when a movement key (for example, D) is not pressed the animation won't play. Only when that key is pressed will the animation play, which is annoying as it ruins the fluid nature of the game. I'll post the code for pressing D and pressing RMB down (not A orLMB` because the code is identical, just reversed).

RMB:

if mouse_check_button(mb_right)
{
  if cusdirection = 0
  {
    if inair = true
    {
      //Do Nothing
    }
    else
    {
      hspeed = 0
      sprite_index = spr_qa_atk_bow_right
    }
  }
}

D:

if keyboard_check(ord("D"))
{
  hspeed = -5
  cusdirection = 0
  if inair = false
  {
    sprite_index = spr_qa_walk_right
  }
  else
  {
    sprite_index = spr_qa_inair_right
  }
}

sentences:
Game Loop and Animation states/frames I just wanna be straighforward. I read a dozen of articles talking about game loop, components, modules, structures, time control, etc...

But, in the end I'm still somewhat confused of how animation actually takes place in the game flow...

Explicitly: Each time the render() assumes command It may render (say) a player sprite (in 2D game). The player "animations" would be expanded in a spritesheet (?) and player object may hold it's state and frame. Say "running" frame 'n'. So the render will render that sprite.

Is that it?

If so, how should I control the actual frame when using a time based game loop (for fps control)?

How do I sinc that with the update variables (x and y position) of the player itself. That will mean that the character will "slide" until next frame (in a walking sequence)...?

Comments, pseudo-codes and maybe a link to a more deep-in article concerning these issue is appreciated... ;)

Thx,

sentences:
Better quality texture when zooming Is there any way to have better quality textures ?

I thought that creating huge textures will improve their quality in game, that's why I draw textures with 0.25f or 0.5f scale.

I understand that computer can't display 4 pixels in 1 screen pixel, but how people do to have beautiful sprites while zooming ? even on smartphones...

Hope you can help me.

sentences:
Turn based Android game using google play games services I want to develop a turn-based,multiplayer android game.Its very similar to chess.Is it possible to make entire game just by using google play games services(GPGS) ? ie, creating a game between 2 players,managing player moves,changing game states in database, all this can be done using GPGS?
Also,is google-app-engine anyhow related to this ?

sentences: Any ad network for XNA games on the PC platform? There's a lot of press about the ad controls included on the new 7 phone, but I'm looking for candidates for the PC platform.

sentences:
Path Finding for an Arena based map in 3D using NavMesh I have a 3D arena map (consider a small island surrounded by water on all sides) for a multiplayer Tank fight game.
The moveable areas are marked using a Navigation Mesh made by the Arena designer.

My question is what would be the best way for navigation in such an environment ?
Specially considering the case when there is a Bridge at the center of the arena and you could walk under it or even above it ?

If suppose the enemy is standing at the top of the Bridge and my AI is at one of the edges of the map ? How can it know whether the enemy is above or below the bridge and how can it navigate till it ?

sentences:
How do I combine multiple squares into one Tetris block? I am learning Phaser by making a simple game—Tetris. I'm having difficulties:

Can I use simple rectangles as tetrominoes or they should be sprites? I don't know how make the figure's block from simple rectangles and apply physics to it.
How I can join 4 separate squares into one tetromino?

sentences:
Is anyone else having problems launching UE4 4.23.1 on OS X 10.12? So I recently switched machines from Windows to OS X (I still have the Windows machine but it's not available to me sometimes so I wanted to keep going while it's processing some other stuff).
UE4 installs fine on my machine but I never actually get it to initialise the engine. Even if I start directly from the .uproject file it doesn't do anything.

Has anyone else had a similar experience and how did you solve the problem?

PS. I verified the 4.23.1 Version already so that's all good.

Edit:
I went to the engine directory and set all flags to 777. So permission is no longer an issue. Problem persists though.

sentences:
How do I play a particle system when moving? I have a car that I move with a Physics-based movement (AddForce(), AddTorque(), etc...) and I have a simple particle system attached behind the car as follows:

I'd like to play this ParticleSystem whenever the car moves; I tried checking if the car's rigidbody's velocity was greater than 0:

if(m_Rigidbody.velocity.z > 0)
   m_ParticleSystem.Play();

if(m_Rigidbody.velocity.z == 0 && m_ParticleSystem.isPlaying) // velocity.z == 0 is unreliable, verified with Debug.Log
   m_ParticleSystem.Stop();

I then tried using Input:

if(Input.GetAxis("Vertical") > 0) // the car is moving along the positive z axis
    m_ParticleSystem.Play();
if(Input.GetAxis("Vertical") == 0 && m_ParticleSystem.isPlaying)
    m_ParticleSystem.Stop();

These two methods don't work, I'm probably making assumptions on how Rigidbody.velocity behaves (when you stop the car for example, it becomes negative, so the particle system would keep playing until it reaches 0);

sentences:
How can I connect multiple explorable regions into one large map? I am planning a 2-D science fiction game involving spaceships. A major thing that I am having trouble figuring out is how to create a 2-d array of smaller maps that the player can explore.

My inspiration is the Flash game Starfighter: Disputed Galaxy:

The map here is composed of a 2-D array containing smaller maps called sectors.  Each sector is connected to surrounding sectors, such that when the player moves to the edge of a sector, they go to the next.

For example, if I was in sector [05][01] and I move up until I cross the edge, I am taken to sector [06][01], then I go to the right, crossing the right edge of the sector, I am now taken to sector [06][02].

However, if I am at a sector like [0][5] and attempt to go down, It will not allow me to cross the edge line of the sector. In other words, a huge map made out of smaller maps.

I'd like to know how to implement those transitions. How do I programmatically determine which sector to move to (or not allow movement) when crossing over a boundary?

sentences:
Stop schedule on gameOver I have 2 events running through time in my game. I want that when gameover starts, this events stops running

This is my code:

- (void)onEnter
{
   [super onEnter];
   [self schedule:@selector(addStars:) interval:1.5];
   [self schedule:@selector(addBoxes:) interval:2.5];

}

-(void)gameOver
{

 //stop schedule addStars
 //stop schedule addBoxes

 }

sentences: Game Maker Studio: How to make Player Circular Movement I want to make a player move in circular but not that he move automatic but manual. Similar like in the game Zero Refelx.

sentences:
OpenGL convert mouse position to world coordinates without gluUnproject in Python? EDIT: I changed the bottom left to -1,-1 and the top right to 1,1, and while I can draw objects within this range, I cannot map the mouse x,y to the world space.
I have been trying to learn OpenGL and my current goal is to move a circle on mouse drag. I have created the circle, but I cannot seem to be able to map my mouse coordinates to the world coordinates using glOrtho. I also set the initial window position to 100, 100, I don't know if that is relevant to the issue though.
For reference this is my init code:
def init():
    # select clearing color
    glClearColor(0.0, 0.0, 0.0, 0.0)

    # initialize viewing values
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)

I know that the glOrtho takes the left, right, bottom, top, near and far values, but when I try to convert to world space coordinates from mouse position(since I only need the x and y so I can calculate distance from the circle's origin) I end up with coordinates in the range 0.0 - 1.25, which makes no sense to me at all, because it should be 0.0 - 1.0.
This is my glutMotionFunc:
def click(x, y):
    global current_circle

    nx = float(x * SCREEN_SIZE / SCREEN_SIZE)
    ny = float(y * SCREEN_SIZE / SCREEN_SIZE)

    print("Mouse click", nx, ny)

    for circle in circles:
        print("Circle center", circle.cx, circle.cy)
        if (np.square(nx - circle.cx) + np.square(ny - circle.cy)) <= np.square(circle.r * (SCREEN_SIZE / 10)):
            current_circle = circle
            current_circle.set_position(nx, ny)

            glutPostRedisplay()

Also, why is my window 300x300 when it should be 250x250? I don't set the window size anywhere but the above init function.

sentences:
Reinhard tone mapping and color space I found two ways of doing tone mapping (first, second):

//Ld - this part of the code is the same for both versions
float lum = dot(rgb, vec3(0.2126f, 0.7152f, 0.0722f));
float L = (scale / averageLum) * lum;
float Ld = (L * (1.0 + L / lumwhite2)) / (1.0 + L);
//first
vec3 xyY = RGBtoxyY(rgb);
xyY.z *= Ld;
rgb = xyYtoRGB(xyY);
//second
rgb = (rgb / lum) * Ld;

For an example pixel data above equations produces different results. Which way is correct ?

sentences:
Unity blue sprite always showing on top regardless of order I have 3 SpriteRenderer

SpriteRenderer - Green Sprite
SpriteRenderer - Blue Sprite
SpriteRenderer - Brown Sprite

The problem is that the blue sprite always shows on top of the others. I even tried to keep the SpriteRenderer in the same order and change the images but no matter which SpriteRenderer I put the blue image into it always shows on top.

I have the sorting layer set to 0 for all 3 and I cannot change them because I will have to change so many other objects in the game.

sentences:
Advance efficient water physics simulation Summary: I am looking at creating a large(ish) ocean which multiple ships will be present in doing their own thing. I want the ocean to be a life like as possible but without compromising too much on rendering speeds.

A Little more detail: I am using Unity to create the game in and ultimately I will need to be able to release the game as a web player to there lies my limitations of the water simulation.
For the actual simulation of the ocean I will need it to be able to react to the ships movement and vice-versa. The end product of the simulation I want to be able to look like this simulation of a ship in water (if possible) to be done efficiently. http://youtu.be/H4ACKAUU3O0?t=3m51s

I have started reading up on other information and looked at the other similar questions to mine:
1) Water/Ocean simulation and physics
  - I have read this question fully, am looking at not using wind as said in this question but will use this as a reference when creating the final product. (I would like to add to the information from that question with the answers on this question.)

2) Resources of realistic water simulation?
  - I have started going through the tutorials that the answer linked to and so far they seem good but do not look like they will answer my question.

The water will have splashes in reaction to the objects in the water (particle effects I believe) and small waves will come off the objects in the water e.g. ripples. Also if you are a smart cookie that wants to be awesome you should include in your answer about putting a shader on the water.

Also since the ships will be moving all at independent speeds and traveling through the sea, for efficiency I don't want to just make the water massive so is there a way to only render/simulate the water within a certain radius from each of the ships?

What I am looking for in an answer:

I would like to know the what tricks for making this type of simulation light-weight can be used for these types of water simulations and specifically in unity.
What limitations will I encounter when creating this and why they are limitations
The basic work flow of creating something like this step by step. (e.g. step 1: to make the object that will be in the water)
Are there any open source projects for these types of simulations?

sentences:
Why is OpenGL using 100% CPU shortly after start up when wglSwapIntervalEXT is enabled? I have a game which uses SFML, which in turn uses OpenGL.

When I run the game, it will use 100% CPU for (usually) about 24 seconds, and then immediately falls down to normal usage. I can't figure out what's going on during these 24 seconds. In some cases, it stays at 100% CPU usage forever, but it usually stops after 24 seconds.

I've attempted to profile it, but the most information I can get is that the time is all being spent in my OpenGL driver. Aside from this, I can't see any useful information. It's also unable to tell me who the caller of the offending OpenGL code is; instead, it just tells me that the caller is an 'Unknown Frame' called by main.

One interesting thing I've noticed is that although it's using 100% CPU, it has no negative effect on my game. It runs without any FPS loss or slow down. This makes me think that the problem may be in the code that's enforcing vsync.

Has anyone encountered this? Any ideas what it might be, or how I can go about figuring it out?

Also, to clarify, the game is single-threaded. The thread using 100% CPU is my game thread, not one of the background threads created by OpenGL.

EDIT : The problem is, in fact, vsync. It's enforced using OpenGL's wglSwapIntervalEXT function. If I disable it and use sleeps to limit my frame rate, CPU usage stays low. I still don't understand why it's behaving like this when vsync is enabled, though.

sentences: Is it possible to show vertex information in tables in VS2012 like in PIX? In PIX I was able to watch the objects' vertex data at different stages in tables, like before vertex shader, between vertex and pixel shaders, and so on. Can you see this in Visual Studio 2012 graphics debugger? I mean, you can see the data as a list of sorts, but it's impossible to get a good overview of that if you have more than like 3 vertices.

sentences:
Stats for testing a renderer I've been writing an OpenGL renderer as a learning process for the past few weeks. Now I wanted to test my renderer against some known numbers, for instance:

How many vertices/tris should it be able to render at 60 fps (rough estimate?)
How many draw calls before it is expected to drops the fps?
etc?

This is all assuming simple shaders (one that outputs a single texture) and a reasonable video card (3~4 yrs old).

sentences:
What's the difference between using hardware-accelerated APIs and the OS's drawing API? On Windows, I can do drawing with the OS API without OpenGL or D3D. The code I am writing will make calls to a device driver and tell the GPU what to do regardless, right?

How is using OpenGL different exactly? Do these libraries have code that will interact with the GPU differently than just the Windows API does?

sentences:
Does glScissor affect stencil and depth buffer operations? I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil and depth buffers?

For example:

glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_STENCIL_TEST);

glScissor(X,Y,W,H);

// Is this color mask set only for the scissor area?
glColorMask(TRUE,TRUE,TRUE,TRUE);
// Does this stencil function only work within the scissor area?
glstencilfunc(GL_ALWAYS);
// Does the stencil function only work within scissor area?
glstencilop(GL_KEEP,GL_KEEP,GL_KEEP);
// Is this depth  mask set only for the scissor area?
glDepthMask(GL_TRUE);
// Does this depth function only work within the scissor area?
glDepthFunc(GL_ALWAYS);

sentences:
How do you prepare for feature creep? How can I prepare for feature creep during preproduction?

Feature creep is when you are in the production phase and decide "It would be cool if this were a feature!" That adds n hours to the development time which were not accounted for, and unless you are Blizzard, do not have the time for. You cannot anticipate it being a cool feature during preproduction, because the feature is only discovered during production.

What can I do during preproduction to account for or prevent or prepare for feature creep?

Should I allow feature creep and cut less desired features? Or will this create a problems since the architecture is not designed for the new features? Should I say no features unless they fit into the existing architecture?

I know this is a broad question, but I hope it doesn't get closed as such. This is a major issue in game development, and should be considered.

sentences:
Strange depth map projection I'm trying to implement depth-only SSAO and for that, I render a depth map into a texture and pass it to my SSAO shader which then uses it.

The problem is that when I try to output the depth map values from SSAO fragment shader (for testing purpose), I get something really weird.

Here is the result :

And, here is how it normally looks rendered before giving it to the SSAO shader :

The depth buffer seems OK, so I guess it comes from a transformation done in the SSAO shader.

Here are the shaders (I'm using the bgfx library, but the shader language is very similar to GLSL):

Here is the way I output the depth from my SSAO for testing :

//Vertex Shader
$input a_position, a_texcoord0
$output v_texcoord0

#include "../common/common.sh"

void main()
{
    gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
    v_texcoord0 = a_texcoord0;
}

//Fragment Shader
$input v_texcoord0

#include "../common/common.sh"

SAMPLER2D(s_depth, 0);

float readDepth( in vec2 coord )
{
#if BGFX_SHADER_LANGUAGE_HLSL
    float z = texture2D( s_depth, coord );
#else
    float z = texture2D( s_depth, coord ) * 2.0 - 1.0;
#endif // BGFX_SHADER_LANGUAGE_HLSL

    return z;
}

void main()
{
    float depth = readDepth( v_texcoord0 );
    ...
    //Some computation
    ...
    gl_FragColor = vec4(vec3_splat(depth), 1);
}

And here the shader for storing the depth into a texture :

//Vertex Shader
$input a_position
#include "../common/common.sh"

void main()
{
    gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
}

//Fragment Shader

void main()
{
    gl_FragColor = gl_FragCoord.z/gl_FragCoord.w;
}

My guess is that I may be projecting the depth texture in a wrong way.

Thanks in advance for any help.

sentences:
Using Part of prefab as script parameter I'm trying add a weapon to Eithan - the third person character. So I want to take his hand, which is part of the prefab Eithan (the weapon location) and use it in the my Player.cs script to Instantiate the weapon.
I created a parameter in the script for the hand: [SerializeField] GameObject weaponSocket; and I tried to Instantiate the weapon like this like this: Instantiate(weaponPrefab, weaponSocket.Transform);, but I just cant drag the hand to the parameter.
Anyone knows how to do this correctly?
Thank you!
Images: Player script: https://imgur.com/RcvKeXN
Trying to drag the left hand to the parameter (indicated by red arrows): https://imgur.com/RB63c9d

sentences: How do I make a natural-looking map from some Voronoi regions? I'm using Voronoi regions to create a map for my game, much like this. However, the lines are too straight and perfect. How do I make the borders more natural looking? As in, less like US state borders and more like international borders in Europe or Asia.

sentences:
How would I translate screen coordinates to Isometric coordinates? I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8);
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

sentences:
Why are there aliasing artifacts with my text? I am using a World Space Canvas, with a UI Text on it, using the Outline script, to produce the following text. I'm noticing a number of strange artifacts on the text, as seen below. Note for instance the yellow/black blog next to Tortuga, and the a in Tortuga not looking correct. There are others as well.

The same artifacts appear in my Scene view, so it leads me to suspect that it might be something Unity is doing that is odd. I've tried removing the outline, but I still see artifacts. Here is the text settings:

And here is the Canvas, which is the parent of the text:

Any idea how to remove these compression type artifacts? Thanks!

EDIT A few things tried:

Removed outline: See photo below.
Using an imported font with a high font size (64) set.
Changing the font size from low (1) to high(50) in the Text window.
Set all scaling to 1.

sentences:
How to calculate the exit speed of ball bouncing off a solid surface Hey all, I am working on a simple game to include some rigid body dynamics, involving placing (moving & rotating) some springs to bounce a falling ball into a target area.

My problem is correctly calculating the exit velocity of the ball after it hits the spring surface (Vexit, Ve for short)

Assume the following:
Initial ball velocity vector at point of impact is known (Vimpact, Vi for short)
Surface orientation vector is known (Vsurface, Vs for short)
Bounce coefficient (Bc for short) of ball after hitting surface is constant (for example |Ve| = 1.2 x |Vi|)

My algorithm is as follows:
-get surface normal vector, Vn
-get Vi inverse (reversing both x,y components to get reversed direction vector)
-get normalised Vi inverse, call this Vin
-get angle between Vin & Vn, by arccos(Vin . Vn). Let this be angle A
-rotate Vin by (2A) degrees to get normalised exit vector Ven
-Ve = Ven . Bc

Now as far as I can tell, this would work well. However, I am unable to know on whether to perform the rotation step in clock-wise, or anti-clock-wise motion; since the angle i get is always positive

What do you all think of this algorithm anyways?
Can anyone help me out on how to figure out the rotation direction?
Anyone have a better (faster,simpler,more accurate, etc) algorithm to use?

Thanks a lot!

sentences:
Object moving by adding force to Rigidbody bouncing off where ground objects met I have a object that moving by adding force to rigidbody. With just big flat plane, it works fine but with connected small planes, sometimes(actually not sometimes, a lot) the object bouncing off or rotating to another direction where the planes are met. Planes are placed well, there's no gaps between the planes.

Here's the picture for understanding:

Now next image shows that object was rotated in left direction(I was just keep pressing forward and it just keep push forward).

I tried with more mass values, like 30000-50000, still happens. I don't know why this is happening, where should I check to solve this problem?

Any advice will very appreciate it.

P.S. I forgot to mention it, object using Box Collider.

sentences:
How to correctly combine scoreboard data? I need a help with a scoreboard I am making. Here's the scoreboard I want to achieve:

I actually have 4 tables and each tables has its own scoreboard but for this question only one table matters.

Here's how I am creating this kind of scoreboard:

if (gametable_no == 1)
{
    for (int i = 0; i < tzPlayInfo.Instance.bc_gametable_history_list.Count; i++)
    {
        newString[0] += tzPlayInfo.Instance.bc_gametable_history_list[i].r;
        newString[0] += ",";
    }
    string[] groupedString = newString[0].Split(',');

    foreach (string allchars in groupedString)
    {
        int x = 0;
        int y = 0;

        GameObject o = Instantiate(prefab_big_road[0]) as GameObject;
        o.transform.SetParent(pos_big_road[0]);
        o.transform.localScale = Vector3.one;
        o.transform.localPosition = new Vector3(2.0f, -5.0f, 0f);
        o.transform.localPosition = new Vector3(o.transform.localPosition.x + x,
            o.transform.localPosition.y + y, o.transform.localPosition.z);

        if (allchars.Contains(playerwinnopairboth))
        {
            o.GetComponent<UISprite>().spriteName = "layout_player_bigline-01";
            NGUITools.SetActive(o, true);
        }
        if (allchars.Contains(bankerwinnopairboth))
        {
            o.GetComponent<UISprite>().spriteName = "layout_banker_bigline-01";
            NGUITools.SetActive(o, true);
        }
        if (allchars.Contains(tienopairboth))
        {
            o.GetComponent<UISprite>().spriteName = "layout_tie_bigline-01";
            NGUITools.SetActive(o, true);
        }
    }
}

The result I get with this code is this:

Here's what the data I use to generate the table looks like:

Gametable 1 history : P  ,P  ,P  ,B   ,B P,P P,TBP

So I need a way to know if the character is changing in the gametable 1 history data.

Here's the expected scoreboard output with the data above:

If the value is not changing like P  ,P  ,P then the position should only increment on the y-axis. If the next value is different like B   , then it will move on the x-axis.

So, how would I implement this?

sentences:
How can I prevent rigid bodies from moving through each other using Unity's built-in physics? I'm trying to create a game where objects can be dragged, but I'm having trouble with the physics. With rigid bodies that have similar masses, they sometimes push through each other when dragged and cause unwanted movements. Here is a demo.

I'd like to do this using only Unity 3D's built-in physics.

In the demo, you can use the mouse to click and drag objects. The cylinders all have box colliders and masses of 10000. They also have various constraints depending on their orientation (none can rotate, and all are constrained in x or y). The sphere has a mass of 1, a sphere collider and a z constraint.

The sphere and cylinders interact well. However dragging the cylinders across one another causes intersection. I do not want this!

The cylinders have interpolate set to 'Interpolate' and collision detection set to 'Continuous'. I have thrown the 'DontGoThroughThings' script onto all the cylinders, but it doesn't seem to do anything. As for setting the velocity of the rigidbodies, I have used both of these following lines with basically the same result:

rb.AddForce(speed * diff * Time.deltaTime - rb.velocity, ForceMode.VelocityChange);
//rb.velocity = speed * diff * Time.deltaTime;

Without writing my own collision detection code, I'm out of ideas. Is there a simple setting or something I've missed?

With the context explained, here's a more precise question: "How can I get the cylinders in my demo to not move through each other?"

sentences:
Why can't I load an image with a relative path in SDL2 on Linux? When loading a texture in SDL2 the general procedure is this:

SDL_Texture* texture = IMG_LoadTexture(renderer, "resources/images/image.png);

However this doesn't work and I have to supply the WHOLE path to the specific image. The code that I have to use is:

SDL_Texture* texture = IMG_LoadTexture(renderer, "/home/user/programs/game/resources/images/image.png);

This issue doesn't occur in a Windows Mingw32 environment.

Any suggestion on how to fix this issue?

sentences:
Things that make a game more interesting for kids What makes a game more interesting or fun to play for children ages 8 to 14+?

Does the age of the consumer play an important role in his/her interest in the game?

What can I put in a game to make it more fun, educational, and interesting to play?

sentences:
Unity - Exporting and Importing Terrains To provide modding support via Unity editor, I need to export terrains in editor and load the exported terrain in runtime.

Is this possible by any manner?

sentences:
Rotation about a point in OpenGL ES 2 (Android) I'm trying to implement rotation about a point (the origin) using quaternions. My camera is at (0, 0, 3). I'm applying all the operations to the view matrix. Basically my rotation is at the moment not about the origin, but about the camera position. Here's what I'm trying to do:

public void rotate(float phi, float theta) {
        Quaternion phiRot = new Quaternion(0, 1, 0, (float)Math.toRadians(phi/2));
        Quaternion thetaRot = new Quaternion(1, 0, 0, (float)Math.toRadians(theta/2));

        Quaternion temp = thetaRot.mul(phiRot);

        camera.translate(0, 0, -3);
        camera.multiply(temp.toMatrix());
        camera.translate(0, 0, 3);
}

where

public void translate(float x, float y, float z) {
    Matrix.translateM(mViewMatrix, 0, x, y, z);
}

public void multiply(float[] matrix) {
    Matrix.multiplyMM(mViewMatrix, 0, matrix, 0, mViewMatrix, 0);
}

Any idea what I'm doing wrong?

EDIT: Solution that seems to work. Based off Milos' answer.

public void rotate(float phi, float theta) {
    Quaternion phiRot = new Quaternion(0, 1, 0, (float)Math.toRadians(phi/2));
    Quaternion thetaRot = new Quaternion(1, 0, 0, (float)Math.toRadians(theta/2));

    Quaternion temp = thetaRot.mul(phiRot);
    float[] rotate = temp.toMatrix();
    float transMinus[] = new float[16];
    float transPlus[] = new float[16];
    Matrix.setIdentityM(transMinus, 0);
    Matrix.setIdentityM(transPlus, 0);
    Matrix.translateM(transMinus, 0, 0, 0, -3);
    Matrix.translateM(transPlus, 0, 0, 0, 3);

    Matrix.multiplyMM(rotate, 0, transMinus, 0, rotate, 0);
    Matrix.multiplyMM(rotate, 0, rotate, 0, transPlus, 0);

    camera.multiply(rotate);
}

sentences:
How camera works in 2d platformer in level transitions I want to know how Camera works in game of Celeste.

Currently what I have is, camera follows the player using interpolation:
cameraPosition = cameraPosition + (playerPosition - cameraPosition) * 0.1;

and I clamp the camera position to the edge of the world size:
cameraPosition = mu.clamp(cameraPosition - [160, 90], 0, worldSize);

I subtract [160, 90] to center the camera.
This works OK. But is that all there is to it.
Specifically, how does the camera work between room transitions.
I might drop room transitions, and just do a black screen transition between levels, but I've heard there is camera triggers that offset the camera relative to player position, and what other tricks are used?

sentences:
How powerful is modern hardware for complex, intensive 2D graphics? I am embarking on a massive (image quality, file size, high frame count) project. I am still working on the basic engine, but have a big question that I would like answered before I begin testing. (It requires a lot of work to test, and possibly fail and have to recreate all sprite sheets, so an answer can help me save weeks of work if I'm wrong.)

The game is entirely in 2D, with 2.5D view. I want to eventually have 40 animations, which all have to be animated in 8 directions. I want each direction/animation to have its own sprite sheet. This equates to hundreds of spritesheets and thousands of files.

Before the obvious solution "Degrade quality for file size!" I would like to take every step possible to prevent degradation of quality, animation frame count, and image size.

Before my solution, one character was 350MB in ram (LOL!) but that was fixed quickly down to 10-20MB per whole character. That is...if I were to load ALL (40) animations in ALL directions (8). So if I were to load 320 sprite sheets into memory, it was going to be a ridiculously large amount per character in ram.

MY QUESTION IS THIS:

How much (of total sprite sheets) should I have loaded into memory at any given point?

Can I get away with loading ONLY the CURRENT spritesheet (Direction + Animation) into memory? Is modern hardware fast enough to constantly swap textures on the fly?

Players could, at any moment, change direction. This would change the entire spritesheet.
Same for animation. So within a split second, the game would have to load a specific new spritesheet, unload the old one (or unload it eventually), and render all within a split second. This would have to be done once for every character, anytime they animate or change directions in a real time game.

Fortunately, the amount of characters on screen at once will be limited by the fact the game is 2D, but I'd prefer to be able to cram in the maximum amount without performance issues on a mediocre computer.

Is texture swapping, file loading, instant rendering from HDD and memory-- all so fast with modern hardware that I wont even need to worry about ANY of this?

I just dont want to work on all of these spritesheets (from thousands of images I already have) only to find out my performance will be horrible and have to redo all spritesheets. Even to test, since I have a layering equipment system, is a time consuming task for spritesheet creation. That is, until I find a solution to process those faster (automation, i do it manually currently, using a program)

sentences:
Animation inside a .obj file? Ok, so yesterday I understood that "rigging (bone and joints)" are things that are use inside a 3D animation software like maya. By that I mean that those bones and joints are not inside the .obj file but only inside the software to help you animate the model.

My plan was to create my own voxel model using my own editor, then load it up into maya to animate it and then put it inside Unity to use the animation but from what I understand, its impossible to put multiple frame inside a file to use the pre-made animation inside a software like Unity.

Does that mean that I will have to load my voxel model inside unity and animate it using the Unity Animation Engine ?

sentences:
Infinite terrain generation performance: one big heightmap or several smaller heightmap? I'm generating a procedural terrain using (a home-made fBm based on) Perlin noise as heightmap. To make the terrain infinite, I redraw part of it while the camera moves.

There are two alternatives:

either have several (say 9) heightmap-textures and rotate them while the camera moves;
or have only one heightmap (say 9 times bigger) and redraw only part of it as necessary.

Note:

The two approaches redraw exactly the same amount of pixels each time.

But:

in the first case, I must bind 3 small textures and entirely redraw them to redraw a line of my grid;
in the second case, I bind the whole bigger texture and redraw only a line inside it.

Question: Should I expect one to be faster than the other? Does glBindTexture has higher cost for larger texture?

sentences: How do you unzip a Texture2D from image or string from txt from a zip file using SharpZipLib How do you unzip a Texture2D from image or string from a txt file - contained in a zip file - using SharpZipLib or System.IO.Compression?

sentences:
Implementing an existing (but out of print) game electronically One of my favorite games is the old Avalon Hill class, PanzerBlitz.

I would like to implement it electronically, and have a couple questions related to that:

Would I be in legal trouble if I do this? (note - this is not for sale or distribution)
How would I go about implementing the hex grid and piece database most effectively (each piece has a variety of 'factors' (movement, carryability, attack, defense, unit type)?

The game play and mechanics are already well-defined in the written rules - so I'm not writing the game from scratch - just programming it to follow the board game.

sentences:
Performance of pixel shaders vs. SpriteBatch: XNA Precondition: I read this question/answer about using shaders, or spritebatch, to render and mark a sprite.

I need to do something like that. I also have a 2D lighting PoC which I need to write. The way it will work will basically be something like:

Draw all the sprites
Draw lighting gradients to create a lighting texture
Multiply/add the lighting texture to achieve different effects

(I use multiple passes of add/multiply the lighting texture to achieve different effects.)

My question is really about a generalization: can I say with certainty that pixel shaders are always faster than adding/multiplying textures to the SpriteBatch? Or that adding/multiplying is always faster? Or if it's not generalizable, how do I decide which approach to take, given that I can probably code either of them?

(If it matters, I'm using MonoGame 3.0 beta for Windows games)

sentences:
Average height of any point in a shape Super quick intro. I am making a terrain generator (With a MC exporter mostly to debug). For the islands I am creating a map with points, and create a Voronoi diagram from it. Each intersection (Where lines of the shapes meet) has a different height, depending on the distance to the coast. The coast itself is elevation=0.

However, whatever I try, I keep getting weird heightmaps. (I can't link more than two images, so I will explain). You can clearly see the difference between each site, yet they are slightly sloped.

In-game this looks like this:

The red blocks that stick out is the height of the intersection.
Sites are created by references to the intersections, since they have IDs.

The code I am using at the moment:

Point p = new Point(x, 1, z);

        double[] distances = new double[points.length];
        double[] percentages = new double[points.length];
        double[] elevations = new double[points.length];

        int max = 0;
        for(int i=0; i<points.length; i++)
            if(parent.getIntersections().fromIndex(points[i]).getElevation() > max)
                max = (int)parent.getIntersections().fromIndex(points[i]).getElevation();

        double totaldist = 0;
        for(int i=0; i<points.length; i++) {
            distances[i] = parent.getIntersections().fromIndex(points[i]).getLocation().surfaceDist(p);
            totaldist+=distances[i];
        }

        for(int i=0; i<points.length; i++){
            percentages[i] = (distances[i] / totaldist);
        }

        for(int i=0; i<points.length; i++)
            elevations[i] = (percentages[i] * (parent.getIntersections().fromIndex(points[i]).getElevation()));

        double heightTemp = 0;
        for(int i=0; i<elevations.length; i++)
            heightTemp += elevations[i];
        heightTemp = max-heightTemp+max;

        int height = (int) heightTemp - 3 + parent.getConfig().getSeaLevel() ;
        height = (height>255 ? 255 : height);

The code's quite weird and unorganized since I pretty much tried anything I could come up with.
"points" is an array containing the reference IDs to the correct intersections
"parent.getIntersections().fromIndex(int index)" is the way to retrieve an intersection from the index/reference id.
"p" is the point to get the altitude/elevation from.
"Intersection.getElevation()" returns the elevation (Anything above sea level).

Sorry if this is real vague, I have no clue on how to explain this properly.

sentences:
Component/Entity-based design + Behavior Trees => how to integrate? For my current project I implemented a component/entity-based system, basically following most of the best-practice there is in this rather undefined area.

So I got (slightly extended) Entities, which are basically an int ID, a human-readable Name, a std::map of components and a long "type indicator" which is used to show what components are present (I have an power of two enum for all the components types and whenever a component is added to the Entity, I automatically alter that long via bitwise operations, compare this answer).

Then there are the Components, also rather simple: int ID, enum as component type, parent Entity pointer and a std::map of all properties this component holds.

Lastly some Systems/Managers that handle the actual logic processing. They first check if the currently processed Entity has a matching long "type indicator" = all necessary components for that system are present. It then accesses some properties if needed and either directly calls some functions in the respective component or send some messages (via a message dispatcher).

Bottom-line: Until here, a rather standard event-driven component/entity-based system combined with a data-driven approach (compare, components do not have hard-coded data variables, but instead a generic map, as (some) components/archetypes of components will later be read from files with the option to add additional data, that is not part of the actual component code.

Now I would like to also introduce Behavior Trees (based on AiGameDev BTSK) into that project, but I am not sure if and how they should be linked to the already existing components or how to integrate those design in general.

Several related ideas/points/questions come to mind:

My BTs will be read from files (again). I currently have a hard time seeing how I would however best make the connection between an BT Action in that tree and the actual coding in my application. Should I build up some sort of map between the action names used in the BT files and a function pointer to the actual logic implementation? What is the usual approach to solve that?
I assume that I will have to create BTs for all my different Entity types (so for each game-logic/AI-relevant combination of components as indicated by my multiple times mentioned long "type indicator"). As a result it doesn't make sense to put the BT Action implementations in the components as most likely many components will be involved per action, does it?
So should the BT Action logic sit in a/multiple separate systems (to whose methods the map from idea #1 points to)? The system would then check per my long "type indicator" whether the Entity for which the BT is currently checked and that was told to execute a certain action (= method in the system) is actually allowed to do so (= has the necessary components). But then, if not (because for example the BT creator did overlook a specific situation, where a necessary component might not be attached to the Entity at runtime anymore), nothing would happen.

Questions:

Are there proven concepts for that kind of integration?
What is your take on my 3 points above?
Any other things that come to mind, also regarding my component/entity-based design in general?

sentences:
Calculating correct normal direction from multi-variable function I am working with a plane model which I am offsetting the vertices on the up axis to look like waves by using the function:

Sin(vertex.x * frequency) * amplitude + Cos(vertex.y * frequency) * amplitude

Previously, I did this with a single variable and was able to confirm my normal directions were correct by getting the derivative, taking the tangent direction from that, and getting the perpendicular direction to the tangent in order to get my normal direction. I then just flipped them so they were facing the right way.

Now that I have added in the second, y, variable I have tried to take a similar approach. Where I take the two partial derivatives, get the tangent direction for each, get the normal for each from that, and then add the normals together to get my final normal direction. However, it seems that the results I am getting are different from those of the Unity calculation, which is correct.

Here is an image comparing my results to the correct Unity calculation:

Does anyone know where about I am going wrong in my calculation? I think it may be related to where and when I am normalizing, but I have tested out a bunch of different options and can't seem to get it to look correct and am now questioning if perhaps my method for combining the two normals is wrong. Thanks for any input. Below is a snippet of the code I am using to do this.

offsetAmount = Mathf.Sin(vertices[i].x * _Frequency) * _Amplitude + Mathf.Cos(vertices[i].y * _Frequency) * _Amplitude;

private void DifferentiateNormals()
{
    // Loop through every normal and calculate it manually
    for (int i = 0; i < vertices.Length; i++)
    {
        // The derivative is also an equation for the slope of a tangent line
        float offsetAmountDerivative = Mathf.Cos(_Frequency * vertices[i].x) * (_Frequency * _Amplitude);
        float offsetAmountDerivative2 = Mathf.Sin(_Frequency * vertices[i].y) * -(_Frequency * _Amplitude);

        // Rise / Run => Rise is the derivative function, run is 1
        Vector2 tangent = new Vector2(1, offsetAmountDerivative);
        tangent.Normalize();
        Vector2 tangent2 = new Vector2(1, offsetAmountDerivative2);
        tangent2.Normalize();

        // The perpendicular of tangent direction (x,y) is (y,-x)
        Vector3 normal = new Vector3(tangent.y, 0, -tangent.x);
        normal.Normalize();
        Vector3 normal2 = new Vector3(tangent2.y, 0, -tangent2.x);
        normal2.Normalize();
        // Flip the normals to be the correct direction (up)
        normal = -normal;
        normal2 = -normal2;

        Vector3 finalNormal = normal + normal2;
        //Vector3 finalNormal = new Vector3(_Amplitude * _Frequency * Mathf.Cos(_Frequency * vertices[i].x), -(_Amplitude * _Frequency) * Mathf.Sin(_Frequency * vertices[i].y), -1);
        finalNormal.Normalize();
        //finalNormal = -finalNormal;

        if (direction == ModelUpDirection.Y_Up)
        {
            // Works for Unity Plane
            normals[i] = new Vector3(finalNormal.x, finalNormal.z, 0.0f);
        }
        else if (direction == ModelUpDirection.Z_Up)
        {
            // Works for 100x100 Plane
            normals[i] = new Vector3(finalNormal.x, 0.0f, finalNormal.z);
        }
    }
    mesh.normals = normals;
}

sentences:
Unreal Engine: saving in-game images to disk without blocking game thread I am working on an Unreal based open-source UAV simulation (Microsoft AirSim) where I am trying to capture and save images from a camera that's attached to the drone. The image underneath gives an idea of how the game looks like. The rightmost view on the bottom is the actual view from the camera, the other two are just processed versions of the same image.

Right now the way it's set up in this way: There's a camera asset, which is read through the code as a capture component. The three views in the screenshot are linked to this capture component. The views are streamed without any problem as the drone is flown around in-game. But when it comes to recording screenshots, the current code sets up a TextureRenderTargetResource from this capture component, and subsequently calls ReadPixels and saves that data as an image (please see below for code flow). Using ReadPixels() as it is, is blocking the game thread directly and slowing down the whole game by a lot: drops from ~120 FPS to less than 10 FPS when I start recording.

bool saveImage() {
  USceneCaptureComponent2D* capture = getCaptureComponent(camera_type, true);
  FTextureRenderTargetResource* RenderResource = capture->TextureTarget->GameThread_GetRenderTargetResource();
  width = capture->TextureTarget->GetSurfaceWidth();
  height = capture->TextureTarget->GetSurfaceHeight();

  TArray<FColor> imageColor;
  imageColor.AddUninitialized(width * height);
  RenderResource->ReadPixels(bmp);
}

Looking at this article, it seems evident that ReadPixels() "will block the game thread until the rendering thread has caught up". The article contains sample code for a 'non-blocking' method of reading pixels (through removal of FlushRenderingCommands() and using a RenderCommandFence flag to determine when the task is done), but it doesn't significantly improve the performance: the rate at which images are saved is slightly higher, but the game thread still runs at about only 20 FPS, thus making it really hard to control the UAV. Are there any more efficient asynchronous methods that can achieve what I am trying to do, perhaps, say, in a separate thread? I am also a little confused as to why the code has no trouble streaming those images on-screen as fast as possible, but saving the images seems way more complicated. It's fine even if the images are saved to disk only at 15 Hz or so, as long as it doesn't interfere with the game's native FPS too much.

sentences:
How can I test on a device I don't have? I received a report that my application fails to run on a specific device (smartphone).

However, not only I don't have access to that device, but they're also quite rare, and I'm not going to buy one just to fix this problem.

Unfortunately, it is imperative that I support that device, as it is a requirement to get published on a store I need to publish on.

Do you guys have any ideas on what can you do when you need to test on a device you don't and can't have?

sentences:
Which opcodes are faster at the CPU level? In every programming language there are sets of opcodes that are recommended over others. I've tried to list them here, in order of speed.

Bitwise
Integer Addition / Subtraction
Integer Multiplication / Division
Comparison
Control flow
Float Addition / Subtraction
Float Multiplication / Division

Where you need high-performance code, C++ can be hand optimized in assembly, to use SIMD instructions or more efficient control flow, data types, etc. So I'm trying to understand if the data type (int32 / float32 / float64) or the operation used (*, +, &) affects performance at the CPU level.

Is a single multiply slower on the CPU than an addition?
In MCU theory you learn that speed of opcodes is determined by the number of CPU cycles it takes to execute. So does it mean that multiply takes 4 cycles and add takes 2?
Exactly what are the speed characteristics of the basic math and control flow opcodes?
If two opcodes take the same number of cycles to execute, then both can be used interchangeably without any performance gain / loss?
Any other technical details you can share regarding x86 CPU performance is appreciated

sentences:
Creating a 3D mushroom cloud Hi I am trying to create a mushroom cloud animation for my strategy game. Something like this. I have been looking at info for creating explosions in general, and the way to go seems to be using 2D sprites and billboarding. However, I don't think this will work in my case as mushroom clouds have a specific orientation, and I am using an arcball camera as my game takes place on a globe.

I've thought about using some kind of particle system, but it seems pretty complicated to make as opposed to using a sprite sheet.

What would be the best way to create a nice looking mushroom cloud?

sentences:
Logic For Puzzle Game - How do I do it? What is the game all about?

It's a puzzle game. I am using AndEngine to build it on Android platform (currently). I have divided the game into various World, with each World containing various Levels.

What is the Issue?

The purpose of the game is to drag-and-drop the broken pieces into the "drop" area (a.k.a. holder) and form the circle. I've developed the basic 2 levels of the game. This is the third level. Where there are 3 pieces as different objects. I've to drop all 3 pieces into the drop. The issue is how do I know that all the broken pieces have filled the holder? I'm using AndEngine for the first time and have very little idea how this can be done.
Tapping on any broken object would rotate it by 90 degrees. So there can be 4 possible solutions for each of them).

Also, the logic should hold true for any shape, any number of broken pieces, any number of holders.

Below is a picture of level 3. There are 3 pieces named 1, 2 and 3 at different positions. All the pieces must be placed inside the circle.

Ideas that I've thought about

We've thought to solve this using:

Area of the holder is filled -> But how do I programmatically do that?
Take center coordinates of each broken piece and find the distance from the center of the circle. Verify this in all the 4 conditions (all 4 rotations by 90 degree each). -> I'm trying to figure this out.
See if all the broken pieces are used in the holder area -> What if there are more than one holder?

Any technical help or any references would be really great.

sentences: Build / Destroy function design & security checks I'm working on a browser based strategy game. For the moment I'm working on the build/destroy functions and I have a couple of questions about this. The main question is do you have advice on how I can pass the buildingId and townId to the page where I call the build function? Any advices about the checking I should have in the build / destroy function?

sentences:
What are some good books which detail the fundamentals of graphics processing? The best book on the nitty gritty of graphics that I've found is Computer Graphics: Principles and Practice http://www.amazon.com/Computer-Graphics-Principles-James-Foley/dp/0201121107

However, as this was written in the early 90s, it is a little out of date.

Are there some similar books which go over the more recent developments?

sentences:
Unity 2D rigging parts order Hello I have some 2d character in sprite I've rigged to use in Unity 2D.Something like this, with separate body parts.
 Although I've used weights and geometry, these body parts are supposed to move independent of each other, so there is no stretching/blending (or whatever you call it) of the shapes/body parts. Now I've created the rig successfully, I realize that these body parts are no at the order I want, meaning some parts are overlapping others in the wrong order. How should I fix that?

sentences:
How can I create a "night sky" effect in OpenGL? I am creating a game using OpenGL and I want to render the effect of a night sky with a few stars in it.

I want to have a shiny black effect in the sky so that it looks good. Could some one help in how to proceed through it or give a link to a good tutorial?

sentences:
Unity Failed to create decoder for ScreenSelector.png My game works fine in the editor, but when I build and run the build the view is zoomed in, my tilemap is missing, and the camera follows a gameobject it should not.

How it should look and how it looks

I checked the logs and this is the error I am served:

  Failed to create decoder for 'C:/Users/Hamuel The First/Documents/Jetplatformer/Builds/Builds_Data/ScreenSelector.png': 0x80070002

Further Investigation shows that ScreenSelector.png is absent from the path stated in the error. I cannot find anything that says what ScreenSelector.png is, or does. I am using the post processing stack by unity.

Any help would be much appreciated!

sentences:
How to weld nearby mesh collider vertices together to erase seams in Unity? I'm using Unity 2020.3.2f1 and I have a very commonly seen problem. I have a Spherecollider which I am using for a physics game, and geometry that uses BoxColliders or MeshColliders. Everything is nice until I get to the seams of one of these objects, and then my ball loves to do inane things like come to a complete stop across a seam or bounce high into the air when striking one. These seams are very tiny as you can see in the image below.

So, I've tried basically every workaround in the physics engine and rigidbody options for my ball (continuous, changing timestep, etc), and none of them completely erase the issue. I suspect that unless I marry all the colliders together, decimating points within some tolerance of each other into one, I will always have this problem at least in some cases, which isn't acceptable for my project.
So I'm wondering how I would work with this data. How do I access the MeshCollider data of each object in the scene? If I join them into a "master mesh" how does it expect to be constructed (quads from vertices or something)? Is there a performance aspect to worry about, having one giant collider versus many tiny ones? I imagine it screws with pruning colliders in the collision detection portion.

sentences:
How can I architecture the cards and boards of this board game? I want to create a board game (at least it's structure and engine, not the graphics), and since It's the first time I do this I don't know where to start.

It's a turn based strategy card game where cards that act differently, some are placed and moved on the board, some are placed but don't move, and some are played from the hand but not placed on the board.

Well, I don't know how to translate this to code. I thought that I should have a interface for the Cards, but since there are various types of cards that act very differently it doesn't make sense . Then I thought that there should be a class for each Player which stores which of his cards are played, which are left etc.. Something like this:

public Class Player
{
 private List<Card> PlayableCards;
 private List<Card> OutOfGameCards;
}

But there's a fixed amount of cards of each type, so its useless to have a List<T> (besides as I said I don't think I'll have a Card class).
Then How should I approach this? Having the cards as individual variables? It doesn't sound right.

The next thing is the Board, it's formed by 8x8 squares where the cards are placed. How do I identify each placed card with a card in the code?

Maybe something like this:

public Class GameBoard
{
 private Square[][] SquareGrid;
}

If I do it this way its easy to separate each square and access it by it's position (SquareGrid[3][4]=3x4). But do I store which card is in each Square? Or do I store in which square is each card? After that there's a "special zone" outside this board and everything gets more messy.

sentences:
HTML5 collision with images Can anyone please help me out with a small test game I'm creating. I'm basically creating this game to learn a few things about HTML5 and so far it's all been good. I've been able to create a canvas with a air balloon that can fly and drops to the bottom when it's not. Now I want the air balloon to be able to stop on another image, which I've called "level1". If someone could perhaps have a look at it, view the source and suggest how I would do this, I would appreciate it.

Or perhaps using images isn't the most efficient way to create a level. If it isn't then please say. Thanks again. :)

Here's the game.

sentences:
What perspective is suitable for sharing a screen across a table? I'm thinking about a 2 player 2D arena game for a mobile phone, but I have the obvious problem of gripping. To avoid this, I think it shouldn't be a problem to play one in front of the other with touchscreen controls. The problem is, of course, the perspective of the sprites in the screen so they look okay to both players.

I'm thinking fully orthogonal perspective, but it hurts visibility a lot, specially if using human sprites viewed from the top of the head. Is there any example of a game that did this right?

sentences: Unity 2019.3 HDRI SkyBox I am trying to create an HDRI SkyBox out of 6 textures but after I create the cubemap with Assets → Legacy → Cubemap and drag it in the HDRI Sky I get an all white environment. Is this a problem with the textures or maybe I am missing some setting?

sentences:
How manage multiple images in Unity? I'm new in Unity and creating a game. So I have a class PicManager in which I have to load my images(sprites) from assets into a List and then use them in my game. What is the proper way to load multiple images from a folder in Assets?

I know, that I can use  Sprite[] sprites = Resources.LoadAll<Sprite>(texture.name);
But this article of Unity says not to use Resource folder.

sentences:
How to debug framerate drops with VBOs, OpenGL I'm working on an experimental app to test how VBOs perform when rendering a minecraft-like world. If the performance is better than what I use now I'll update my actual game. Based on what everyone says, VBOs should totally be the right direction, but it's really hard making that become a reality.

I've finally gotten to a point where I've replicated culling block faces, I'm properly using the buffer IDs to render and not building the VBO every frame - there's no a ton of performance tweaking left aside from:

Using an indexed system so I can send fewer vertices
Using a ByteBuffer for my color/texture values instead of floats (I need to find a good way, right now everything is interleaved)
I could take block face culling a little further because in the test app, they don't check across chunks for solid blocks.

My primary issue is that for some reason, when I render 15x16 chunks (16x16x16 blocks per chunk in my test app) the performance and rendering is great. Movement is fluid, 60fps.

At 16x16 chunks, performance drops to like 5fps. I've run profiling like VisualVM and see no unusual differences in the speeds/memory of the code between the two states. It's odd how the addition of one extra row of chunks can take performance down so  much - there must be some specific threshold I cross.

How can I better debug what's happening? Where should I be looking? There are no console errors.

This test app is open source so you can look at the code:

World
Chunk
Rendering

Update I've updated my actual game with the VBO work I've been doing in this test app and the performance of the 10x10 grid of chunks (16x16x128) was so horrid that my system took minutes to allow me to kill the app. I'll certainly spend some time adjusting things and making sure that it's performance-tuned for my app, but wow - still not seeing how VBOs are all they're cracked up to be.

sentences:
"Clone" a RenderTarget2D? I see that some XNA resources implement ICloneable (namely the Effect class) but textures don't. I have encountered a situation where I need to make a complete copy of a RenderTarget2D texture and use it as inputs for two separate rendering effects. One effect will change the contents of the RenderTarget2D so I can't pass it to the other effect, which is why I need two copies.

Can you "clone" or deep copy a RenderTarget2D in an easy way? My current work around is that I wrote a copy function that sets a new render target, uses a simple effect to just re-draw the contents of the target to be copied to into a quad and return the new render target. But seems like a lot of work around simply to create a copy.

sentences:
Frustum culling with a single large object I am helping to optimize performance in a mobile game. The artists who built a particular scene added a wall around the scene. The wall is a single mesh with 100k triangles. Because it goes around the entire scene, at least some of the wall is visible from all angles and is always being rendered.

While running the game in the Editor with the Statistics panel enabled, I can see that hiding the GameObject containing the wall always reduces the current number of tris by 100k regardless of how much of the wall is actually visible. Does this mean that the entire wall is always getting rendered, rather than only the triangles that are actually in front of the camera?

Obviously the artists need to reduce the overall polygon count of the wall, but I'm wondering if they should also break it into several separate pieces so that the entire wall doesn't need to be rendered at once.

sentences:
What programming languages would be used to make an Apple App like Angry Birds or Cut the Rope? I'm currently working in the Multimedia industry and although I'm better at design then development. I have knowledge of HTML, CSS, very basic jQuery, Actionscript.

What programming Languages would you need to know?

What else would you need to know to develop an application?

I am assuming you would need to know xcode and Objective-C?

sentences:
Libgdx InputListenner not working I've added an InputListener to my libgdx actor and I've added the actor to the stage. The stage (and all of its actors) gets drawn just fine.

The problem is my actor doesn't seem to be receiving keyboard inputs as nothing happens when I press keys.

@Override
public void show() {
 stage = new Stage();
 player = new Player();
 player.setPosition(600, 600);
 stage.setKeyboardFocus(player);
 player.addListener(new InputListener(){
   @Override
   public boolean keyDown(InputEvent event, int keyCode) {
    System.out.println("Key Down");
    return true;
   }
 });
 stage.addActor(player);
}

sentences:
Would I need to delete unused assets from my Unity packaged build? I'm going to make a release for my Unity game.

Does Unity include unused assets in build output? Would removing unused assets from a project reduce build size/Time?

I want to know if Unity packages all the assets to my build (which I would need to delete), or if Unity packages only the assets that are actually used in the game.

sentences:
Timing - use individual timer for every task or global timer? I'm writing a game, where a player controls a spaceship.
It regenerates energy over time. So I need to make a little timer that adds certain amount of energy to the pool per second.
My enemies also shoot at me, activate different abilities. I figured I can use separate timers for these too.
But I see how this can quickly go out of hand, since I have different engines with different energy regeneration rates - will I need to replace the timer every time?
Or if I have different energy - I have to manually track all the timers and set them anew.

I thought, maybe I can use some global singleton method that can handle all the timing in my game? It can update everything in the game, and when something new happens (like new enemy spawning) I can just send my singleton information about that object and it will handle all the timing for it?

Is this a good approach? Can I read up something about this somewhere?
Maybe you have some experience with this?

sentences:
Target Lower API Level than Package or Plug-In Requirements I am working on a project that I want to use local mobile notifications for Android using Unity as game engine. I want to reach as much as users I can, so I want to target API level 16 for the lowest Android API level. As expected, when targeting Android API level 16 for a build, build fails with that error:

  Execution failed for task ':processReleaseManifest'.   Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:androidnotifications-release:] C:\Users\Tumay Varel.gradle\caches\transforms-2\files-2.1\71d39d4badfde5815e850866bcf079c9\AndroidManifest.xml as the library might be using APIs not available in 16
       Suggestion: use a compatible library with a minSdk of at most 16,
           or increase this project's minSdk version to at least 19,
           or use tools:overrideLibrary="com.unity.androidnotifications" to force usage (may lead to runtime failures)

In documentation , it is explicitly saying that the package supports Android 4.4 (API 19) and higher API levels. I can handle this problem by targeting lowest API level 19, however I want to ask: Is there a way to use this package or any other package or any plug-in  for required and higher API levels while not using for lower API levels than requirement at the same project?

sentences:
How can I manage an animated UI from ActionScript? I'm trying to code a game of Poker in AS3, using Flash Professional CS5 (although I try to keep as little code as possible in the .fla).

When a player bets, for example, I need to be able to show an animation of some chips sliding into the center of the screen. After that happens, the AI decides what to do, and another animation of their chips occurs. Then a menu pops up so the player can choose their own next action. And so on.

I started writing a UIBet interface with bet(amount) and raise(amount) methods and so on, that you would implement with a class extending MovieClip and fill in the methods with gotoAndPlays to various animations. But if I just have code that calls these graphics object like so:

playerUIBet.bet()
aiUIBet.bet()
menu.prompt()

Then, if I understand Flash correctly, what'll happen is that the code will finish executing, and then all of those animations will happen simultaneously.

How can I get these animations to happen sequentially? What if I want to insert pauses between them? Some kind of solution like this? What's the best way to do this in AS3?

sentences:
Can you use well known buildings in your game? Is it legal to reference a real city in your game and use the same architecture of well known shops and buildings?

For example, I'm sure you can't create an exact 3D model of McDonalds, put it in your game, and sell it. However, is it possible to use the same architecture, but different name? and even use the same colors, just as long as the name and logos are not used?
Or would there be the possibility of getting in trouble for creating something in the "likeness".

sentences:
Why is anti aliasing not being applied to my 2D objects in Unity? I am drawing 2D objects in Unity.  Some of these objects are drawn using the standard sprite method that is built into Unity.  Others are computed as distance functions in a shader.

In both cases I can't get Unity to apply anti aliasing despite the setting being set.

Is there an extra step that I am missing that is required to get anti aliasing to work properly?

Would it be better to implement my own form of AA in a shader?

sentences:
How to make mobile movement using CharacterController How can i change my movement for mobile i think left and right gonna work but i don't know what should i do for jump

private void Update()
{

    vector = Vector3.zero;

    if (characterController.isGrounded)
    {
        /*verticalVelocity = -gravity * Time.deltaTime*/;
        verticalVelocity = -0.5f;

        if (Input.GetKeyDown(KeyCode.V))
        {
            verticalVelocity = jump;
        }
    }
    else
    {
        verticalVelocity -= gravity * Time.deltaTime;
    }

    vector.x = Input.GetAxisRaw("Horizontal") * speed;
    if (Input.GetMouseButton(0))
    {
        if (Input.mousePosition.x > Screen.width / 2)
            vector.x = speed;
        else
            vector.x = -speed;
    }
    vector.y = verticalVelocity;
    vector.z = speed;

    characterController.Move(vector * Time.deltaTime);
}

I solved the problem this way

if (characterController.isGrounded)
    {

        verticalVelocity = -0.5f;

        if (Input.GetMouseButton(0))
        {
            if (Input.mousePosition.y > Screen.height / 2)
            {
                verticalVelocity = jump;
            }
            else
            {
                verticalVelocity = -jump;
            }
        }
    }
    else
    {
        verticalVelocity -= gravity * Time.deltaTime;
    }

    vector.x = Input.GetAxisRaw("Horizontal") * speed;
    if (Input.GetMouseButton(0))
    {
        if(Input.mousePosition.y < Screen.height / 2)
        {
            if (Input.mousePosition.x > Screen.width / 2)
                vector.x = speed;
            else
            {
                vector.x = -speed;
            }
        }
    }

sentences:
Unity character vibrates during idle animation My player character vibrates in his idle pose for some reason. He has 3 animations (IdleState, WalkState, RunState) and the latter 2 run smoothly, but when I don't provide directional inputs and he enters his idle state, he looks like he had 100 espresso shots!

43 second video demo here: https://youtu.be/QuHPrkjx-T4

I am not using a blend tree for the moment and the animation used for IdleState was exported with only a single frame (frame 1) from Blender. Unity's FBX import panel has the animation listed as playing from frame 0 to 1.  I have tried many different configurations for this animation in the importer, including looping, not looping, matching pose, setting animation length to 0.  None of that fixed the jitters (the latter nullified the animation). I have restructured my scripts but have not found a solution for this yet.

My character uses 2 scripts, one to control movement, and another to control animation.

This one controls movement:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour {

    private float charSpeed;
    public float walkSpeed;
    private float runSpeed;
    public float jumpForce;
    public CharacterController controller;
    public float gravityScale;
    private Rigidbody rb;

    public static Vector3 moveDirection;

    // Start is called before the first frame update
    void Start() {
        controller = GetComponent<CharacterController>();
        rb = GetComponent<Rigidbody>();
        charSpeed = walkSpeed;
        runSpeed = walkSpeed * 2;

    }

    // Update is called once per frame
    void Update() {

        if (Input.GetButton("Fire3"))
        {
            charSpeed = runSpeed;
        }
        else {
            charSpeed = walkSpeed;
             }

        // Declare movement vector
        moveDirection = new Vector3(Input.GetAxis("Horizontal") * charSpeed,
            moveDirection.y,
            Input.GetAxis("Vertical") * charSpeed);

        // Set y-axis movement conditions (jumping, grounded, free-fall)
        if (Input.GetButton("Jump") && controller.isGrounded){
            moveDirection.y = jumpForce;
        }
        else if (!controller.isGrounded)
        {
            moveDirection.y = moveDirection.y + Physics.gravity.y * gravityScale * Time.deltaTime;
        }
        else
        {
            moveDirection.y = 0;
        }

        // rotated 45 deg to align controls to camera instead of world space:
        Vector3 rotated = Quaternion.Euler(0,-45,0) * moveDirection;
        controller.Move(rotated * Time.deltaTime);

        Vector3 lookDir = new Vector3(rotated.x, 0, rotated.z);

        if (lookDir != Vector3.zero)
        {
            transform.rotation = Quaternion.LookRotation(lookDir);
        }
    }
}

...and this one plays the animations:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class CharacterAnimator : MonoBehaviour
{

    private Rigidbody rb;
    Animator animator;

    void Start()
    {
        rb = GetComponent<Rigidbody>();
        animator = GetComponent<Animator>();

    }

    void FixedUpdate() // was Update(), no change
    {
        if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0)
        {
            animator.Play("IdleState");
        }
        else
        {
            if (Input.GetButton("Fire3"))
            {
                animator.Play("RunState");
            }
            else
            {
                animator.Play("WalkState");
            }
        }
    }
}

What is causing this jittery idle state bug?

sentences:
Unity3D: Download multiple files and implement a callback IEnumerator GetFileRequest(List<String> urlList, Action<List<UnityWebRequest>> callback)
{
    List<UnityWebRequest> reqList = new List<UnityWebRequest>();
    for (int i = 0; i < urlList.Count; i++)
    {
        using (UnityWebRequest req = UnityWebRequest.Get(urlList[i]))
        {
            req.downloadHandler = new DownloadHandlerFile(GetFilePath(urlList[i]));
            reqList.Add(req);
        }
    }
        yield return reqList;

    callback(reqList);
}

I'm using this code, all files get downloaded, but they seem to be corrupted ( I guess it's not completely downloaded). How do I complete the download without files getting corrupted?

sentences:
How to avoid subpixel values in a resolution independent 2D game with orthographic projection? I'm trying to do resolution independent rendering of moving sprites in a 2D game. My plan is work in a fixed coordinate system in my world (for example 960x540) and use orthographic projection to scale that up or down to fit the viewport. I do letterboxing to handle different aspect ratios.

According to most tutorials, I am free to use whatever dimensions I like for the view frustum, but I found that in many cases that leads to the problem that I end up using subpixel values on the viewport. For example a vertex at (62,62) in a coordinate system of 960 x 540 ends up at (51.6666667,51.6666667) on a viewport with the dimensions 800 x 450.

I noticed two kinds of problems with that:

the texture sampling changes all the time for objects that are in motion depending on where the vertices are in relation to a pixels center
my objects get stretched horizontally or vertically by a pixel from time to time due to rounding

What is the best practice to avoid this (while maintaining resolution independence in terms of movement speeds and so on)? And where would be the best place to do address this? Before passing the vertices to the shaders or inside the vertex shader?

sentences:
How to reduce a rectangle without problems? I'm developing an asteroids' game and I'm needing to reduce the rectangle of the spacecraft because when I use the method intersect() of Rect class to detect a collision with an asteroid they are far.

Here is a part my game:

As you can see, if the red rectangle of the spacecraft intersects with the red rectangle of the asteroid the game will detect a collision.

My problem it's that there is a big space in the bottom and the top part of the spacecraft which can confuse the player.

To solve it, I'm trying to modify the rect values of top and bottom but when i do this the image dissapear of the canvas.

sentences:
Managing left and right direction buttons being pressed at the same time I am currently programming a Tetris clone. In Tetris, there is a system being used called DAS, or Delayed Auto Shift. It works similarly to the keyboard auto-repeat used in Windows. For example, if you press left, the block immediately jumps one Column to the left. Then a certain amount of time goes by till it jumps a second time, and the following jumps move at a constant rate. I have this implemented as moveHorizontal(boolean moveRight), and can call it with a boolean that determines the direction the movement is going in.

However my main problem is handling the left and right direction buttons at the same time. More specifically, the state where you hold down one button, while pressing another button. The more recently pressed button should overwrite the old one, and the DAS should be reset once it switches directions. I feel like I can't really get a grasp on how to implement this kind of logic.

How do I logically change the state so as to correctly respond to the user input as I have described?

I hope I explained the problem in enough detail. If I didn't, please let me know, so I can provide more information.

sentences:
OpenGL Fragment Shader simulate LCD slow response time I have a very simple OpenGL view rendering 2 triangles with a single texture applied. The minimum setup for rendering a 2d game.

What i do is redraw the texture for every frame and easily get 60fps.

I would like to add an effect simulating LCD slow response by outputting pixels that are the average between the current and the previous frame.

The pseudo code of fragment shader would look like this

varying vec2 v_TexCoordinate;
uniform sampler2D u_Texture;

void main() {
    gl_FragColor   = (texture2D(u_Texture, v_TexCoordinate) + PIXEL_PREVIOUS_FRAME) / 2;
    PIXEL_PREVIOUS_FRAME = gl_FragColor;
};

Well, i think shaders can't keep a persistent variable like PIXEL_PREVIOUS_FRAME, then i really don't know how to tackle this problem.

Any suggestion?

sentences:
Detect when any part of a collider leaves a trigger zone on Unity 3D I've searched all over for a simple solution on this, and found posts as old as 2011, with a bunch of hackish ways to badly work this out.

I want to detect when ANY part of a collider leaves a trigger area.

Some solutions I found and why they won't work on my case:

Using onTriggerExit will only trigger when the collider is COMPLETELY out of the trigger area, making it not ideal for boundaries of maps.

Calculating using bounds may work, but a bit complex when using a polygon collider with convex shapes.

I'm new to Unity and I'd guess this would be a pretty simple, default behaviour for many games.. Really surprised me that I found zero good answers for this on the web (both in stack exchange and Unity forums). Any help would be appreciated.

sentences:
Memory allocation patterns used in game development I have been researching creating my own allocator methods (that will support things such as a memory pool and profiling), however, as I continue my research I have been looking for how this was done in game development.

What memory allocation technique could I use, and why is it a good technique?

sentences:
How to make only-head rotation in UE4? I've made a character, attached a camera to it and setted input. But now i want only character's head to rotate with mouse, but not a whole character (player capsule rotates with Q and E keys). I tried to attach camera to head socket, but it doesn't work (i think it's a wrong way). How can i do it on C++? Thank you!

P.S.
I know, that it's a stange idea (control like this will be uncomfortable probably), but it's my work-task and i find it very intersting.

sentences: Abstraction for player, NPC's, and monsters I am trying to come up with a good abstract term for my players, NPC's and monsters. They can all have stats and inventory. so they all can function in the same way. But some could be humanoids, some are monsters and whatnot. Are there any standard abstract terms that game devs tend to use.

sentences:
Should I distribute shaders in a compiled form or in plain text? Having an application that uses shaders that have been wrote in GLSL, what is the best strategy for the distribution in the real world and for the desktop and mobile?

I'm aiming to distribute this in a binary form or as plain serialized text, i would like a good suggestion on this.

sentences: How can I run a .jar file with XNA? Could someone help me to develop a method to run any .jar file (with parameters) from in C# with XNA?

sentences:
8 ball pool scratch card effect logic how to replicate this type of scratch card effect in Unity3D considering its for mobile.

https://youtu.be/6wLWu1BefXs

Two cases
1. Clear part of screen where user touches.
2. How to trigger rewards after certain amount of image get reveal?

sentences:
Normal mapping soft question: What could this be? So I'm trying to implement tangent space normal mapping. I bind the uniforms, load the attributes, set the shaders, and out comes this:

This happens on the sides only, and not when in direct light. I'm pretty sure it's matrix related, but could it be I'm mapping the tangent values incorrectly? Has anyone seen something like this before? Or have a hunch what it could be?

UV screenshot, it's a cube, turned into a sphere, and each side is separated. The final object shows no seams on the top or bottom, but rather on each side.

Update: When I order the tangents according to UVs, I get a much cleaner result, but some areas/sides still get an inverted normal. I'm not sure why this is, or how to fix it. It happens on each side, so it is as if the sides get inverted normals.

sentences:
How do I use images with copyright in my game? Our game requires to show images from movies, cartoon characters, etc. but we don't know how we can include them.

We have seen that games like QuizUp and other guess the pic like games have images from Disney characters, Pokemon or company logos, etc.

How does it work? Is this usage considered fair use?

sentences: How can obtain the relative orientation between two quaternions? How do I obtain the relative orientation given two orientations (represented by quaternions q0 and q1)?

sentences:
Planar mapping/projecting UV coordinates from normal I've got set of vertices, and would like to calculate their UV coordinates by projecting them by a given normal. Similar to what "planar mapping" does in 3ds max.

Another way of looking at it is that I want to flatten the vertex positions from a given normal direction, so that I can simply use their X & Y (or X & Z depending on your preference) coordinates as UV coordinates.

I'm thinking it's a simple matter of a mathematical Vector function, basically rotating vertex positions along the normal, but I can't figure out the math behind it. I'm using C# and XNA, so I've got Vector3, Matrix and Quaternions. Preferably as cheap as possible.

Any help?

sentences:
OpenGL quake 3 shader file for objects (for trees) I decided to add to my game few trees, I already quake 3 model loader (md3) its for characters and method for texture drawing is store in *.ini file. I found a package of trees in MD3 and I have no problem with loading model alone, but there is a *.shader file and i have no idea how to load it to draw texture properly.

Tree pack: http://www.custommapmakers.org/wiki/index.php/Models:GR_Trees_set

I do not have to use exactly this format, I can write another loader, but trees in *.obj or
.3ds look even harder

sentences:
Blender animation's curled fingers are splayed-out when played in Unity I have exported my character into Unity and all the animations came with it. At first, I thought I was good to go but then I made a jogging animation. In blender the hands are gripped like this:

When this animation is exported to Unity the hands are no longer gripped and look like this:

Here are some more pictures showing the settings I have on my animation first in Blender:

Next in Unity:

So far I have tried:
Checking if the animations were updated in Unity (They were),
Reimporting the Unity model,
Looking through the animation properties in Blender,
Looking through the animation properties in Unity
I've been stuck on this for a few days now and I would appreciate some help as this is getting quite frustrating.

sentences:
how to create a curve movement of slider in unity I am trying to create a curved (not circular) movement of slider. Here is my demo images for reference:

I have watched some tutorial but those are for circle images. I want to make this movement along the arrow images below car. Also if this can be done with just images without using slider that will be ok too. I just this done the simpler and easy way.

sentences:
Unity3d generating a file in iOS and saving it on a linux machine I've done a little research and don't know if the following is possible.

At the moment I have created a small application in Unity that generates an XML file. This file will be used to help set up my game. It's done in Unity due to it being cross platform with no need to re-write a single line of code. Eventually this will run on an iPad.

However, my game will be running on a linux computer and I need to pass over the XML file to the computer that will be running the final game (please don't ask why I'm doing that, it's something I need to do). So what I want to know is the following:

Can I generate my XML file on an iPad and have that XML file be saved, and transmitted to a linux machine, without the need to manually copy the file over. If so, how is this possible?

sentences:
Unity - Mathf.Lerp() didn't work as expected? I want to rotate an object 360 degrees so this is what I did:
xRotation = Mathf.Lerp(0, 360, Time.fixedDeltaTime * lerpTime)
and then I used Quaternion.Lerp() to rotate the Object so:
targetRotation = Quaternion.Euler(initialRotation.x + xRotation, initialRotation.y, initialRotation.z);
transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, Time.fixedDeltaTime * lerpTime);

But it didn't work as expected, the xRotation didn't go from 0 to 360, it just changed from 0 to 9 (instantly), and that's it, it never changed.
This is my full code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class QuaternionExpirement : MonoBehaviour
{

    [SerializeField] [Range(5, 10)] float lerpTime;
    Vector3 initialRotation;
    bool mousePress, readyToRotate;
    float xRotation;

    private void Awake()
    {
        initialRotation = Vector3.zero;
        mousePress = false;
        readyToRotate = false;
        xRotation = 0;
    }

    private void Update()
    {
        mousePress = Input.GetMouseButtonDown(0);
    }

    private void FixedUpdate()
    {
        if (mousePress)
        {
            initialRotation = transform.eulerAngles;
            readyToRotate = true;
        }

        if (readyToRotate)
        {
            xRotation = Mathf.Lerp(0, 360, Time.fixedDeltaTime * lerpTime);
            Quaternion targetRotation = Quaternion.Euler(initialRotation.x + xRotation, initialRotation.y, initialRotation.z);
            transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, Time.fixedDeltaTime * lerpTime);

            if (xRotation >= 360)
            {
                readyToRotate = false;
            }
        }
    }

}

sentences:
Looking for XNA patterns Hello mature game developers. Im just started with XNA, but i got solid expirence with C#.
I wonder is there any common code patterns for XNA games?

Like should i make classes wich handle draw and update separatly, like draw model and world  data model? Or should i try to put as much code as possible in Game1 ?

Im totaly lost in project structure building. Thx for any answers.

sentences:
Handling collision with LWJGL rectangles I'm testing collision with other rectangles so I can implement it into my current project. The problem is the rectangle starts at the right x and y, but I'm not sure where exactly they are. I'm pretty sure they're starting from the x and y point and the height is going either up and down. My current ortho makes the y axis start from the bottom of the screen but I'm not sure how their rectangle calculates. How can I improve this class so for each side the bottom rectangle touches, it turns a certain color to identify collision.

public class a {

    static int playerX = 400;
    static int playerY = 400;

    static int enemyX = 100;
    static int enemyY = 100;

    public static void main(String[] args) {
        try {
            Display.setDisplayMode(new DisplayMode(640, 480));
            Display.setTitle("collision");
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
            Display.destroy();
            System.exit(1);
        }

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, 640, 0, 480, 1, -1);
        glMatrixMode(GL_MODELVIEW);

        Rectangle rl = new Rectangle(playerX, playerY, 10, 20);

        Rectangle r2 = new Rectangle(enemyX, enemyY, 200, 10);

        float c2 = 0;//color

        while (!Display.isCloseRequested()) {
            glClear(GL_COLOR_BUFFER_BIT);
            rl.setX(playerX);
            rl.setY(playerY);

            r2.setX(enemyX);
            r2.setY(enemyY);

            if(rl.intersects(r2))
            {
                c2 = 1f;
            } else if(!rl.intersects(r2))
            {
                c2 = 0f;
            }

            if(Keyboard.isKeyDown(Keyboard.KEY_A))
                playerX -= 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_D))
                playerX += 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_W))
                playerY += 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_S))
                playerY -= 1;

            System.out.println(playerY-100);

            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

            glColor3f(0, 1, 0);

            //PLAYER

            //l
            glBegin(GL_QUADS);
            glVertex2f(playerX, playerY     -10      );
            glVertex2f(playerX + 10, playerY    -10  );
            glVertex2f(playerX + 10, playerY - 100    );
            glVertex2f(playerX, playerY      - 100    );
            glEnd();
            //r
            glBegin(GL_QUADS);
            glVertex2f(playerX + 100, playerY   -10           );
            glVertex2f(playerX + 110, playerY        -10      );
            glVertex2f(playerX + 110, playerY - 100            );
            glVertex2f(playerX + 100, playerY      - 100       );
            glEnd();
            //top
            glBegin(GL_QUADS);
            glVertex2f(playerX + 10, playerY     -9               );
            glVertex2f(playerX + 100, playerY       -9       );
            glVertex2f(playerX + 100, playerY - 20          );
            glVertex2f(playerX + 10, playerY      - 20           );
            glEnd();
            //bot
            glBegin(GL_QUADS);
            glVertex2f(playerX + 10, playerY          -90          );
            glVertex2f(playerX + 100, playerY    -90          );
            glVertex2f(playerX + 100, playerY - 101        );
            glVertex2f(playerX + 10, playerY      - 101         );
            glEnd();

            glColor3f(c2, 1, 0);
            //ENEMY
            glBegin(GL_QUADS);
            glVertex2f(enemyX, enemyY);
            glVertex2f(enemyX + 200, enemyY);
            glVertex2f(enemyX + 200, enemyY - 10);
            glVertex2f(enemyX, enemyY - 10);
            glEnd();

            Display.update();
            Display.sync(60);
        }
        Display.destroy();
        System.exit(0);
    }

}

I just made it so OpenGL set its position to the rectangle instead of the rectangle to OpenGL.

sentences:
Textures loading too large on smaller monitors I have an XNA game, and when i run the game the textures load all good on my computer and on my tv and they're all bring drawn in the right position. But on my laptop, which screen is smaller then both my othe computers monitor and my tv screen, all the textures are being drawn way to large. Example: i have a background which is just grass, and a stone path, and the image size is 1920x1080. It loads fine and is centered on my other computer and TV, but on my laptop, its drawn way too big and where the center should be is in about the bottom right corner of the laptop screen. Is it possible to edit the code to make it resize better on smaller screens, or is it just my laptop and my laptop's screen size is messed up. I believe that my laptop is in the 16:9 aspect ratio.

Update 1

I have noticed that the textures load fine when the window is not in full screen, but in full screen the textures have problems. How should i change this Draw Method to fix this problem, and draw this in the right spot in a full screen 1920x1080 window?

spriteBatch.Draw(backgroundTexture, Vector.Zero, Color.White);

(keep in mind the backgroundTexture is 1920x1080)

sentences:
How could I get rid of these shared_ptr/weak_ptr in this entity-component architecture? We've built an entity-component architecture that works ok for our needs, but it has something that bugs me a bit from a software engineering point of view.

We use std::shared_ptr and std::weak_ptr for the Components: the Entity owns the component through an std::shared_ptr, while the ComponentManager and other Components refer to the component through a non-owning std::weak_ptr.

The issue is that the components are not actually shared, and they should not be shared either. They're owned by a single entity. Having an std::shared_ptr there suggests that anyone can take a copy of the shared_ptr and own it too.

Here is a diagram of how the classes are organized:

Entity:

real owner of the components through shared_ptr
does not know which components it holds

ComponentManager:

we call update() on the ComponentManager, which in turn calls update() on every component it knows about
there is one instance per type of component; we've done it like this to have control over which components get updated first (e.g. CmpRigidBody updates the CmpMatrixTransform, and from which the CmpGfx is then updated)
unofficial owners of the components through weak_ptrs; it's "unofficial" because it's through them that the components are updated
weak_ptrs are stored in a vector
once the (single) shared_ptr goes out of scope (e.g. when the entity gets deleted), a custom deleter tells the ComponentManager to remove the weak_ptr from the vector (this also adds confusion to this architecture)

Component and derived:

holds the core of the information and performs the main operations of the component
can reference other components through weak_ptr (hooked up at initialization, for now)

I strongly believe in using the right tool for the job, and although this architecture works, I'm curious to see if there are alternatives that would remove the confusion introduced by the shared_ptrs.

Maybe this is pertinent:

The amount of entities and components is relatively low, so we won't gain much by making efforts to keep them close together (the rendering and the physics simulation are taking most of our frame time).
We use this approach because of the re-usability offered by the components and entities from project to project.
The project is single-threaded.
The action takes place in the Component, not in the ComponentManager (i.e. it's a entity-component architecture, not an entity-component-system archiecture), so the Component needs access to other Components if they still exist, and these can be removed at any time.

I could use a kind of handle system through the ComponentManager and query the appropriate one every time I need an access to a Component, but this adds a dependency... (Maybe that's the price to pay..?!)

Do I have other options?

sentences:
Why is the Tilemap not fitting the screen? I have a background image which I made it in tiled map editor of width 40tiles and height of 8tiles.When I run the game the tilemap bounces with the player and I can see the black portion of the screen.The game screen width and height is 320 by 256.Here is the problem
Play class

sentences:
Deferred rendering and gaussian blur - artifacts I compute Gaussian blur in two passes (horizontally and vertically). Shaders look like this:

Horizontal blur - fragment shader:

#version 420
layout (location = 0) out vec4 outColor;
in vec2 texCoord;
float PixOffset[5] = float[](0.0,1.0,2.0,3.0,4.0);
float Weight[5] = float[]( 0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 );
float scale = 4.0;

uniform sampler2D texture0;
uniform vec2 screenSize;

void main(void)
{
    float dx = 1.0 / screenSize.x;
    vec4 sum = texture(texture0, texCoord) * Weight[0];
    for( int i = 1; i < 5; i++ )
    {
        sum += texture(texture0, texCoord  + vec2(PixOffset[i], 0.0) * scale * dx ) * Weight[i];
        sum += texture(texture0, texCoord - vec2(PixOffset[i], 0.0) * scale * dx ) * Weight[i];
    }
    outColor = sum;
}

I use deferred rendering and the following
screens shows a diffuse material texture after blurring. I simplified a render loop for the sake of clarity(only one render target - a diffuse material).

A render loop - first case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, render to a temporary texture (full screen quad)
read a temporary texture, horizontal blur, render to a temporary texture (full screen quad)
read a temporary texture, vertical blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, render to the default framebuffer (full screen quad)

The final image has artifacts(flickering pixels). Some of them are placed between two  triangles which create the full screen quad.

A render loop - second case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, render to a temporary texture (full screen quad)
read a temporary texture, horizontal blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, vertical blur, render to the default framebuffer (full screen quad)

Some artifacts may appear between triangles:

A render loop - third case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, horizontal blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, vertical blur, render to the default framebuffer (full screen quad)

The final image doesn't contain artifacts.

How to fix that ? The above code is simplified but normally the first case(render loop order) is most useful, for example: I want to blur a glow texture and use it when shading.

sentences:
Trying to understand the range of Improved Perlin noise I've been implementing Improved Perlin Noise for a small library I'm writing. Everything was hunky dory when it was just in the 3rd dimension, but I recently expanded to the 1st, 2nd, and 4th dimension, which is where things started get weird.

I originally thought that the range of Improved Perlin was +-1.0. When I implemented the 1st dimension version, I noticed that the unmodified range was +-0.5, ie, you had to multiply the result by 2, but figured nothing of it. 2nd dimension worked just like 3rd, with both working within the +-1.0 range. Then when I got to 4th, I ran a large number of samples and saw that I was getting results outside the -1.0 to +1.0 range.

I started Googling, and apparently the +-1.0 range is a common misconception? The solution I've read in a couple places, which is +-1/2(sqrt(N)), where N is the number of dimensions, implies the following ranges for dimensions 1 through 4:

0.5, ~0.71, ~0.87, 1, respectively

However, the only version I have which matches this is the 1st dimension, which as I said, works out to +-0.5 before multiplying by 2. For dimensions 2 and 3, I get +-1.0 without any need to modify the result, and for the 4th dimension, I believe my results are actually in the range of the 6th dimension according to that solution.

The following is my code:
https://pastebin.com/CpAi3PUF
And for those who aren't familiar, it's Cython, so yes, a weird Frankenstein of Python and C.

I use the following code to test the ranges of each dimension: https://pastebin.com/yUpw1Z00
Since my method involves just running tons of random inputs over and over, I did run this test a few times to make sure the results are consistent, which they are, and here is an example of the output:

DIM1 - Minimum: -0.999999999999943 | Maximum: 0.9999999999871175 | Average: 0.0003455999808678627
DIM2 - Minimum: -0.9999515602331069 | Maximum: 0.999900249691747 | Average: -0.00011840974404335401
DIM3 - Minimum: -0.9932063986908607 | Maximum: 0.9931959744642007 | Average: -0.00010701170753012655
DIM4 - Minimum: -1.0576886515898196 | Maximum: 1.123720946368049 | Average: 0.00022555631399532482

You can clearly see that as my code is written, dimensions 1 through 3 have a limit of +1.0, and then with the 4So clearly there is some contradiction between the alleged result ranges, and the code I'm implementing. The 3rd and 4th dimensions were implemented straight from Perlin's own example code.

3rd Dimension: https://mrl.nyu.edu/~perlin/noise/

4th dimension: https://mrl.nyu.edu/~perlin/noise/ImprovedNoise4D.java

The only major changes I've made to the implementation are in the grad functions, where I use what is essentially a switch case, rather than Perlin's fancy pants (but extremely expensive) bitshifting method. But afaik doing so is functionally equivalent.

Can anyone provide some insight as to what is going on? What is causing the difference between the supposed expected ranges, and my actual results? And what can I do to get the 4th dimension "in shape", like how modifying the 1st dimension is required?

Thanks so much for any help.

sentences:
ConcurrentDictionary as a main container for game objects? I wonder if it is wise to use ConcurrentDictionary as a main container in a game? That is it will be used to:

update every object inside it in a parallel.Foreach loop;
add (but not remove) objects inside it in a parallel.Foreach loop (sometimes while updating);
retreive data from the dictionary with a Linq query/ simply by index in sometimes a parallel loop, but mostly in the main thread;
remove data from it in a parallel loop (but NOT when updating objects) <- this step can be done in the main thread.

What could be the disadvantages of this list compared to HashSet (we are using the latter now, but we are only reading from it in parallel - when updating models). What lists are used in big engines?

sentences:
Android OpenGL ES RENDERMODE_WHEN_DIRTY implementation I am trying to understand RENDERMODE_WHEN_DIRTY so that I could save battery life wherever possible.. I made this sample application so that GlSurfaceView is updated with random color only when the random number temp is greater than 50... If the value of temp is less than 50, I want it to retain the last random color.. But in this code sample, it is not retaining it but making the screen go black forever!

Basically I want to know if my implementation of RENDERMODE_WHEN_DIRTY correct...

package com.blob.blob;

import java.util.Random;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.Renderer;
import android.os.Bundle;
import android.util.Log;

public class OpenGLActivity extends Activity implements Renderer
{
    GLSurfaceView glView;
    Random rand ;
    @Override
    public void onCreate(Bundle s)
    {
        super.onCreate(s);
        glView = new GLSurfaceView(this);
        glView.setRenderer(this);
        glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
        rand = new Random();
        setContentView(glView);

    }

    public void onDrawFrame(GL10 gl)
    {
        int temp = rand.nextInt(100);

        if(temp > 50)
        {
        glView.requestRender();

        gl.glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        }

    }

    public void onSurfaceChanged(GL10 gl, int width, int height) {

        Log.d("OpenglTest", "Surface Changed");
    }

    public void onSurfaceCreated(GL10 gl, EGLConfig config) {

        Log.d("OpenglTest", "Surface Created");
    }

    public void onPause()
    {

        super.onPause();
        glView.onPause();

    }

    public void onResume()
    {
        super.onResume();
        glView.onResume();
    }
}

sentences:
How to avoid rows on screen when cutting spritesheet tiles? I'm having a problem with my spritesheet, I generate a map but when I zoom in on it I can observe these lines as in the image below:

When I used the tiles each in their separate image, that did not happen, how do I avoid this case?

I'm drawing like this, the problem happens when I give a "ctx.scale":

ctx.drawImage(
    imgSolos.img,
    (imgSolos.width * resultSolo), // resultSolo is current frame in the spritesheet
    0,
    32,
    32,
    x,
    y,
    imgSolos.width,
    imgSolos.height
);

sentences:
Manipulating an animation towards a target object (ie. The hand and arm lean towards the target) I am trying to make a boxing game just for fun (I dont expect the end product to be anything decent lol) . I have my boxers in the ring and they are animated quite well so far, with Idle, and punch Left and Right. They also rotate so they are always looking at each other.

What I want to do is give the punch some aim towards the head. I will give the punch a set amount which it can move from the standard animation and move the hand bone in the direction of the targets head object. But I don't know how to do this :S

So far i have used dragged the 3 animation files into Mecanim and coded it to do the animations when a button is pressed.

Is there a way to manipulate the animation in this way? (ie. actually make the arm reach towards the target object )

sentences:
Literature about Open World Games, Freedom to Choose I'm doing a diploma thesis about the development of games with freedom to choose or open world.

Topics will be i.e. development issues in programming and the design itself, mechanics etc.

For that I need literature and lot's of it. Do you have any suggestions?

sentences:
Faking a 3D object to decrease number of polygons I'm making a game in unity and I'm building a fence in blender but I want it to be as low poly as possible. My original design was too high poly so I thought, what if I could simply use a cube with some cleverly arranged textures. Like so:

You can see the edges are all looking good but the inside sections are not, i.e there's nothing there... so does anyone know if it's possible to fake those faces that would make it look as though it were a complete mesh. Here's what I'm tring to achieve:

sentences:
How can I render geometry represented in a 64-bit floating point environment? In this video about Star Citizen, right at the 12:30 mark on the timeline you can see the player zooming in on a space station who's location is clearly out of the limit of 32-bit floating point numbers. As I understand it, in this game they're using 64-bit floating point precision for location calculations.

I'd like to implement something similar: an environment where objects are represented with 64-bit floating point precision, but which can still be rendered on 32-bit GPUs.

I do not understand how Star Citizen is able to render it in correct proportion with 32-bit GPUs since I've read that most GPUs run like 3x slower in double precision mode.

In other words how should I pass vertex positions and other rendering data accurately to the underlying rendering hardware? What should I do to the data to render it in 32 bit space? Or should I just use double precision GPUs?

sentences:
Adding underwater shadow to 2D top down boat I have a boat/hovercraft sprite in my game. It's topdown 2D view, but it's actually a 3D scene, for better lighting and other effects.
I want to add a buoyancy effect, so that the hovercraft floats with the waves and has a little margin for going under water, like a real boat. So when idle or when going off a ramp, when landing in the water it will kinda "bounce" a bit under and then back up.
But the problem is: the water and boat sprites are on top of each other (because it's 2D). See this picture:

So it can not go underwater, because then the water will be on top. But I still want those edges of the vehicle to be a bit darker as it floats. I already have an effect that changes the Y value to make it float up and down. But now the edges have to become a bit darker to show they go underwater.

I kinda have this idea to add a 3D capsule and make it move up and down through the sprite to simulate this:

So as the boat and the capsule go down with each wave, it could mask the sprite, and the visible part (marked with black lines in the image below) could be made darker. To simulate the "under water" effect. Later I will also add foam and stuff, but the first problem is the underwater part. So how could I mask my sprite inside this capsule, and more importantly, make the "outsides" (so the parts of the sprite not touching the capsule darker? Any help would be greatly appreciated! :)

sentences:
Character bounces/stutters down hills I'm using Unity3D (not 4) and I'm experiencing a bit of a problem with character movement. I'm using a capsule as a First Person player with a camera attached to it. In this capsule is the stock ThirdPersonController script (with the animation parts removed). I know it's not conventional, but it's not the problem in this case.

The problem is when my character goes down hills, running or walking, it bounces down. It's as if it's going horizontally, then realising it's not grounded and then falling. It works fine going uphill but the downhill is driving me crazy.

One solution that may be possible is raycasting, I know what it is but I have no clue on how to use it.

sentences:
Linking one uniform variable to many shaders Let's say, that I have 3 programs, and in each of those programs there is a view matrix uniform, which should be the same in all those programs.

Right now, when my camera moves, I need to re-upload the modified matrix to every program separately. Is it possible to create some kind of global uniforms which are constant for all programs linked to it, so I could just upload the matrix once?

I tried creating a globalUniforms object which looked kinda like this:

var globalUniforms = {
    program: {},
    // (...)
    vMatrixUniform: null,
    // (...)
    initialize: function() {
        vMatrixUniform = gl.getUniformLocation(this.program, 'uVMatrix');
    }
};

So I could just link it to proper programs like this: program.vMatrixUniform = globalUniforms.vMatrixUniform;, and then pass the matrix like this:

if (camera.isDirty.viewMatrix !== false) { camera.isDirty.viewMatrix = false;
    gl.uniformMatrix4fv(globalUniforms.vMatrixUniform, false, camera.viewMatrix.element);
}

but unfortunately it throws an error:

  Uncaught exception: gl.INVALID_VALUE was caused by call to:
  getUniformLocation called from line 272, column 2 in () in mysite/js/mesh.js:
      vMatrixUniform = gl.getUniformLocation(this.program, 'uVMatrix');

Summing up: is there a more efficient way of managing shaders which follows my logic?

sentences:
connecting multiple anti-aliased lines together I implemented/copied the wu line algorithm from pseudo-code on wiki-pedia and other places.

When drawing a sine wave it breaks down at the point where the line changes from y dominant to x dominant (or vice versa). (I did not copy the endpoint code because it looks terrible and I do not need them for my purposes. )

Does anyone know a solution for this issue?  If not I will modify the algorithm myself to get it to work.  I am just curious if someone else has run into this and knows exactly how to fix it.  Is it possible to implement without the lines being globally aware of each other?  Or is this why drawing API's implement moveto and lineto functions?

The pseudo code

sentences:
What units does Sprite Kit use for physics? I'm developing a simple ball game in Sprite Kit. I need to predict the ball's trajectory, so I went back to my physics book for the equations for acceleration, time, speed and space.

The problem is that Sprite Kit documentation does not declare the units of measurement of the properties of physics bodies, so it's hard to calculate the needed values.

Based on my experiments/research I suppose that:

gravity is expressed in m/s/s  (m/s^2)
since gravity is a CGVector, all CGVectors are expressed in m/s/s (m/s^2)
velocity (instant speed) is m/s

Then I realized a simple scene where a ball is falling:

Gravity: CGVector(0,1.2);
Height: 218.009499 pixels
Time: 0.302499747
Then acceleration should be:   2*Height / Time^2 = 1441.3863 pixels/s/s
And gravity of 1.2m/s/s corresponds to 1441.3863 in a world measured in pixels

Someone says the internal PTM (pixel to meter ratio) is 150.

Any hints?

sentences:
How to find connected groups in a 2D grid of tiles Firstly, my English is very bad, sorry for this. That's why I showed my problem with a picture.

Block[,] sameTiles = new Block[
  WorldController.Instance.World.Width,
  WorldController.Instance.World.Height];

sameTiles keeps the same side-by-side green blocks. My problem is, I need to detect and separate the shapes made of connected blocks so I can access each shape separately. For example, putting each group on a layer of a 3D array:

Block[,,] differentTiles = new Block[
  100,
  WorldController.Instance.World.Width,
  WorldController.Instance.World.Height];

(100 connected shapes are supported at max)

Block[
  ShapeNumber,
  X Coord,
  Y Cood].

Here is my picture, I need to search this array and detect the four shapes of connected green blocks, storing them separately. Picture:

sentences:
Matte reflection effect in Unity? I'm trying to achieve that kind of scene but in real time using Unity.

It's basically composed of some primitives, a skybox, and a plane. I'm intrigued on how to do this effect in particular:

The plane acts like a mirror, but tainted and matte (and it appears to be less blurry at the bottom of the buildings... but I'm not quite sure). I have found some shaders to create mirrors in Unity but nothing about the matte effect like in this picture. Could you guide me on how to achieve this kind of effect (knowing that I'm pretty lame when it comes to write shaders but I want to learn).

Thanks.

sentences:
OpenGL: Transformations I'm not sure if I correctly understand 3D transformations in OpenGL. Let's assume I'm using the typical matrix stack.

It seems like you move the world X units over, drop in a bag of verts (a mesh) and move the world back by popping the matrix off the stack, then you repeat the process to place another model?

Say I wanted to place a model at (10, 0, 0) and another at (0, 10, 0). I think I would...

PUSH move(10,0,0);
DRAW model A;
POP;
PUSH move(0,10,0);
DRAW model B;
POP;

Some questions come to mind, like for example what does loading an identity matrix do in the stack?

Am I right to assume that these operations in effect move the world around, then you draw the mesh at 0,0,0 in world space when you've moved the world to your liking?

Or is it the other way around, does GL "apply" the matrix stack to your mesh as you draw it?

Thanks, -Cody

sentences:
Proper way to handle Movement/Animation/AI functions of an AI character in Unity3D My team is currently building a 2D game in Unity and we've run into some workflow/script organization blockades for many of our game's characters.

For example, we're not sure what the standard method of encapsulating/organizing a character's movement, animation, and more complex AI code is so that things don't become a behemoth mess.

Originally, we had all a character's code in one file -- movement, animation, and AI decision-making code. Needless to say, this became messy really quickly and horrendous to debug.

Then, we redesigned it so that there were three scripts on the character: a movementHandler, animationHandler, and AIHandler. These scripts would communicate to each other, but encapsulate their own functions. This worked better than before, but also grew to a point where it was a bit messy organizationally and debugging is becoming a nightmare again.

We're interested in knowing how people typically organize their scripts. Is there a way people know to organize these code sections so that they're more scalable and don't become headaches to manage once the project grows and grows?

sentences:
Record video and sound from device camera and show it as a texture I need to record and show video from a real camera device in iOS/Unity and show that video as a texture in RawImage (Image of what I want)

What I have tried so far:

Unity WebCamTexture API: It shows the camera in a texture but it has two problems! It does not record audio and does not have an API to save video!
Camera Capture Plugin: I bought this plugin but unfortunately it does not have the feature to show video in a texture; it just opens the camera device's application.
EverPlay plugin: I tried this plugin and it seems that it just creates a video from the screen and not the camera
Unity Video Capture API: There is also this API for recording video with sound but unfortunately it is part of Windows Mixed Reality and does not support iOS
Using Objective C: I tried to write the video recording section directly in Objective C, I did it but I could not find a way to embed that in the Unity scene -- I'm not sure it's even possible! (
what I tried)

I appreciate any other solutions that can help.

sentences:
Building triangle adjacency data Given a list of triangle indices, how exactly does one go about converting that to a list of indices with adjacency for a geometry shader?

Note that we're strictly talking about indices here - vertices are present, but we're going to focus solely on indices, because we can use them to match duplicate vertices without having to get into floating-point comparisons and epsilons - that work has already been done.

I know that for any given triangle in the list, indices {0, 1}, {1, 2} and {2, 0} (or {n, n+1}, {n+1, n+2}, {n+2, n} if you prefer) of it form it's edges; the index list is well-formed and respects winding order correctly.

I know that for any given such edge, we can search the entire list for another triangle that uses two of those indices, and the third index of that triangle is the one to use for completing the adjacent triangle for that edge.

I know that in the adjacency list each original triangle is represented by 6 indices, the original indices go into slots 0, 2, 4; the new indices to complete the adjacency go into slots 1, 3, 5.  The index to complete for edge {0, 1} goes into slot 1, the index to complete for edge {1, 2} goes into slot 3, the index to complete for edge {2, 1} goes into slot 5.

What have I tried?

I've tried brute-forcing it, and yes, that will work, but I'm after a more elegant approach.

I've tried Eric Lengyel's edge list builder, but (1) it doesn't seem to respect the original triangle order, (2) it doesn't seem to respect winding order, (3) it's as clear as mud where to go next after you've built the edge list, and (4) I've a suspicion of sample code that has such obvious glaring errors as "triangleIndex" versus "faceIndex" - did the author even compile the code, never mind run it to verify it?

So -- any suggestions or pointers from here on?

sentences:
Why is 90 FPS recommended for Virtual Reality games? Origin of the question
I have recently finished an internship at a (small) game development company which is working on a Virtual Reality game that is also used in medical rehabilitation. From what I have heard and read online, you generally want to achieve at least 90 FPS in a VR game because otherwise the player can get motion sickness or dizzyness, etc.
I am aware that not everyone is getting sick but from what I have read, you still want to aim for that 90 FPS to be sure, although I am unable to find the exact reason for this number. (it feels like an industry standard)
Questions
"Why is 90 FPS an industry standard when developing a VR game?" and "Why can people get sick when playing on lower frame rates?"
When searching online, I keep reading about 'studies' that show that people will be more likely to feel sick or dizzy when playing a VR game below 90 FPS but I never see the actual reason (source) as to why that is.
I can only make assumptions based on what I know already but I would like to know the exact reason (or as much of a reason as possible) and hopefully a source as to why 90 FPS is chosen (and not 80 or 100) and what causes some people to become sick from lower framerates.
sidenote: I am referring to VR games for devices as the 'Vive', 'Rift', etc. (as there are also VR Simulations for pilots, etc. which also have elements such as simulated movement that can impact sickness)

sentences:
Raycaster calculation question I am following this tutorial https://lodev.org/cgtutor/raycasting.html

  When deriving deltaDistX geometrically you get, with Pythagoras, the formula "sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX))", but this can be simplified to abs(1 / rayDirX). [thanks to Artem for spotting this simplification]
  Similarly, deltaDistY is "sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY))" which can be simplified to abs(1 / rayDirY).
  The variable perpWallDist will be used later to calculate the length of the ray.

In the calculation that involves Pythagoras, why is a "+1" involved? I thought the equation was a^2+b^2=c^2? I feel dense... Also, I do not understand how the simplification to abs(1/rayDirX) works.

sentences:
How do I change a shape without affecting the rest of the screen? I have drawn a shape like this in OpenGL:

 glColor4f(red,green,blue);
        glBegin(GL_QUADS);
            glVertex2f(x1,y1);
            glVertex2f(x2,y2);
            glVertex2f(x3,y3);
            glVertex2f(x4,y4);
        glEnd();
glFlush();

and I want change one the vertices like

glVertex2f(x_delta,y_delta);

But how do I redraw the shape without altering the other components of the screen?

sentences:
Artifacts on crosshair in game view with FXAA I have a transparent grid texture that I am displaying on a quad using the URP's built in unlit/Transparent Shader. The intersections render as desired in the scene view, but have artifacting in the game view (even after play is pressed).
Scene View:
As you can see, the scene view renders clean intersections

Game View:
The intersections display some artifacting. (This screenshot was taking after zooming in the game view panel, but the artifacts are still visible at 100% zoom)

Note: I do not think that this is related to PNG transparency. I have written a custom procedural grid shader that exhibits similar artifacting in the game view:

The problem seems to be due to my enabling FXAA, which is smoothing the sharp corners. Disabling FXAA immediately solves the problem.
However, this is somewhat of an inconvenient solution, because anti-aliasing is nice to have enabled. Is there a way to make the artifacts disappear without disabling AA completely?
How do I configure the URP/anti-aliasing to render my grid texture as it does in the scene view? I have tried changing the compression level and the filtering algorithm, to no avail.

sentences:
Actions abstraction in Goal Oriented AI I am back with another question about Goal Oriented AIs.

To explain my problem, I will use a specific example.

In my game, population nodes are spawned on a world map, and important characters called "Migration leaders" can spawn, take in migrants, lead them to a good spot, and then establish a new population node there and finally despawn as they have served their one-time purpose.

What I want to achieve is having only one action called "MoveToTarget" which has no pre-conditions apart from having a target location, and has the effect of setting the fact "Reached target location" to true, which itself is the precondition for other actions. Not sure this is the right way to structure that in the GOAP but that's not exactly my problem, at least I do not think so.

My problem is that, since you can't work with actions that take in an argument, I have little notion of how the AI should determine the location which it will move to when the "MoveToTarget" action triggers, for the following reasons :

Depending on the character type and generally what is happening, each character will think differently about where they're interested in going. Furthermore, what happens when I have to interrupt the AI's "plan" for some reason ? The original target location for, say, transporting migrants is lost !
I do not which to make different actions like "MoveToMigrationTarget" because then I'll have to make many MANY more actions, like "MoveToCombatTarget" or "MoveToRessources" and I do not think that will work as that will make me have to keep a "Migration target", a "Combat target".. in memory even for characters that have nothing to do with either of those.

So my question exactly is, where is the AI supposed to do the "practical thinking" in a GOAP ? The Actions themselves must be abstract, and can't take in any argument so I have to somehow have target location(s) in memory and have the GOAP planner know which target corresponds to which action.

I could also extend that question to basically any action that need a specific target / object to work.

sentences:
Extra sprite spawning when the enemies are redrawn SFML I am making a game in sfml and at the moment when all of the enemies die. They are set to respawn however when this is happening they are respawning with one extra sprite than before.

The code for loading in the sprites is

unsigned int orcNumber = 5;
for (int i = 0; i < orcNumber; i++)
{
    SpriteVector.push_back(ogreSprite);
    SpriteVector[i].setPosition(spawnPointX[i], spawnPointY[i]);
}

The code for removing the enemies if they are offscreen or shot is similar to below using erase.

for (unsigned j = 0; j < SpriteVector.size(); j++)
{
    if (this->SpriteVector[j].getPosition().x < 0 - 80 )
    {
        //this succesfully removes the object from the vector
        SpriteVector.erase(SpriteVector.begin() + j);
        std::cout << "Container size..." << SpriteVector.size() << "\n";
    }
}

The statement for redrawing them is:

unsigned int orcNumberRespawn = 5;
if (SpriteVector.size() <= 1)
{
    for (int i = 0; i < orcNumberRespawn; i++)
    {
        SpriteVector.push_back(ogreSprite);
        SpriteVector[i].setPosition(spawnPointX[i], spawnPointY[i]);
    }
}

window.draw(SpriteVector[i]);

Can anyone identify why when the sprites need to be redrawn it draws with + 1 sprite everytime?

sentences:
How can I detect handedness of normal maps in a shader? I've implemented normal maps into my game renderer using the formulas by Christian Schuler.

It works OK with most normal maps but some not so much since in some the Y component (green) is reversed. Apparently there is no real standard here and Maya does it one way and Max does it the other way.

I'd like to be able to look at a normal map's values and somehow determine which scheme is being used, if that's possible.

Also, though I have not actually seen any, some normal maps appear to use only two channels and the third channel is left blank and calculated at runtime. Ideally I would be able to detect those, too. I figure maybe the Z channel is all zeros? I am not sure that would save any space though so maybe it is some other scheme.

Seems like an obvious desire, but I don't see any references to this. but then, maybe it's not really possible.

sentences:
Network Message Registering message handler Problem I have a confusion about when and where to use NetworkServer.RegisterHandler() and NetworkManager.singleton.client.RegisterHandler()? And also I am getting Unknown message ID 1002 error.

I have a message class

public class NetworkMsgHandler : NetworkBehaviour {

public const short movement_msg = 1002;

public class BulletMovementMsg : MessageBase {

    public string objectName;
    public Vector3 objectPosition;
    public Quaternion objectRotation;
    public float time;
}

}

I have ServerRelay which has ServerOnly authority has Script ServerRelay for registering Message Handler on Server.

public class NetworkServerRelay : NetworkMsgHandler {
private void Start()
{
    if(isServer)
    {
        RegisterNetworkMessages();
    }
}

private void RegisterNetworkMessages()
{
    NetworkServer.RegisterHandler(movement_msg, OnReceivePlayerMovementMessage);
}

private void OnReceivePlayerMovementMessage(NetworkMessage _message)
{

    BulletMovementMsg _msg = _message.ReadMessage<BulletMovementMsg>();
    NetworkServer.SendToAll(movement_msg, _msg);
}

}

Then I have Bullet GameObject it has script Projectile which is sending movement message this class is derived from NetworkMsgHandler.

public class NetworkProjectile : NetworkMsgHandler {

private void Start() {

    if (localPlayerAuthority) {

        canSendNetworkMovement = false;
        RegisterNetworkMsg();
    }
    else {

        isLerpingPosition = false;
        isLerpingRotation = false;

        realPosition = transform.position;
        realRotation = transform.rotation;
    }
}

private void RegisterNetworkMsg() {

    NetworkManager.singleton.client.RegisterHandler(movement_msg, OnReceiveMovementMsg);
}

private void OnReceiveMovementMsg(NetworkMessage networkMessage) {

    Debug.Log("Message received");
    BulletMovementMsg msg = networkMessage.ReadMessage<BulletMovementMsg>();

    if(msg.objectName != transform.name) {

        ProjectileManager.Instance.SpawnedBullets[msg.objectName].GetComponent<NetworkProjectile>().ReceiveMovementMsg(msg.objectPosition, msg.objectRotation, msg.time);
    }
}

public void ReceiveMovementMsg(Vector3 position, Quaternion rotation, float _timeToLerp) {

    //lerping between position
}

private void Update() {

        if(!canSendNetworkMovement) {

            canSendNetworkMovement = true;
            StartCoroutine(StartNetworkSendCoolDown());
        }
}

private IEnumerator StartNetworkSendCoolDown() {

    timeBetweenMovementStart = Time.time;
    yield return new WaitForSeconds((1 / networkSendRate));
    SendNetworkMovement();
}

public void SendNetworkMovement() {

    timeBetweenMovementEnd = Time.time;
    SendMovementMsg(bulletID, transform.position,transform.rotation, (timeBetweenMovementEnd - timeBetweenMovementStart));
    canSendNetworkMovement = false;
}

public void SendMovementMsg(string _bulletID, Vector3 position, Quaternion rotation, float timeToLerp) {

    BulletMovementMsg _msg = new BulletMovementMsg() {

        objectRotation = rotation,
        objectPosition = position,
        objectName = bulletID,
        time = timeToLerp
    };

    NetworkManager.singleton.client.Send(movement_msg, _msg);
}

}

So whenever a bullet spawns it generates an error on client side saying Unknown message ID 1002 connId:1
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

sentences:
How to handle animations? I am coding a simple 2D engine to be used with HTML5. I already have classes such as Picture, Scene, Camera and Renderer, but now I need to work on Animations.

Picture is basocally a wrapper for a normal image object, with it's own draw method, but this is unrelated, I'm interested in how animation in 2D games is usually done.

What I planned to do, is to have the Animation class as well act like a wrapper for a few image objects, and then have methods such as getCurrentImage, next and animate (which would use intervals to quickly change the current image). I meant to feed the animation a couple of PNG's at inicialisation.

Is quickly swapping PNG images acceptable for 2D animation? Are there some standard ways of doing this, or are there flaws in my ways?

sentences:
How to send an int array and struct via ENet? I've been using the ENet library for networking and so far it's been working ok. I have established a connection between my client and server. On the client side all it does is send all user input to the server. On the server side I have an array int map[24][24] that stores all of the map tiles. I also have a struct for each player. After I get all of the user input, do all the calculations, and update the map, how would I send the map back to the client? Right now the function I've been using supports sending chars. Would I convert my int array and struct objects to char and send them? How should I accomplish this, also should I send the map and player structs in one packet, or send each in a separate packet? This is my first to experimenting with multiplayer so I apologize if this is a simple mistake or stupid question.

This is my function for sending packets:

void send_packet(int channel, char pack[11]) {
    ENetPacket *packet = enet_packet_create(pack, strlen (pack) + 1, ENET_PACKET_FLAG_RELIABLE);
    enet_peer_send(peer, channel, packet);
    enet_host_flush(host);
}

sentences:
client/server Silverlight turn based game - domain model question I am making multiplayer (2 players) Minesweeper like the one that's available on MS Live Messenger.

Client side is going to be silverlight, server side will be MVC Application. Client (the one who is waiting for his turn) will poll server every X seconds to get current state, the other client (who's turn it is will post his click to server and than roles will reverse)

Now my question is: should domain model classes be the same for client and server side?
I mean you need Minefield class on both sides, but while server-side class will have rules and logic, client-side will be more or less a data holder.

sentences:
Trouble with speed and vectors I'm working on adding bullets to my game.  Right now I can shoot bullets in the direction that I would like from a ship by getting the ship's angle:

int speed = 5;
int dx = -(cos(degreesToRadians(ship.angle)) * speed); // rate of change in the x direction
int dy = -(sin(degreesToRadians(ship.angle)) * speed); // rate of change in the y direction

bulletPosition.addX(dx); // addX(dx) is simply bulletPosition.x += dx
bulletPosition.addY(dy);

The ship is pretty much the exact same thing, except I use the += operator:

int dx += -(cos(degreesToRadians(angle)) * 0.15)
int dy += -(sin(degreesToRadians(angle)) * 0.15);

shipPosition.addX(dx);
shipPosition.addY(dy);

I would like to be able to add the ship's velocity to the bullet's velocity, but I'm a little confused as to how should get the speed from the ship's vector.  I thought that adding the ship's dx to the bullet's dx like int dx = -(cos(degreesToRadians(ship.angle)) * speed * dx) would work because I'm adding the rate of change of the ship to the rate of change of the bullet, but that doesn't work.  So here's the final question: How can I get the speed of my ship and apply it to my bullet's speed?

Thanks in advance for all help :)

sentences: How can I create a mesh with Blender which changes mid game? Take a situation where on the first half the player fights an enemy and after a cutscene, the player cuts off the hand of the enemy. How can I show him without his hand after this moment (when modeling it with the hands in Blender in a single skeletal mesh)? Do I have to make another skeletal mesh but without the hand? Similar to how in Assassin's Creed Origins where at the end of the snake quest after the cutscene Bayek losses his ring finger and remains without it all game. But in my case, the entire hand is removed.

sentences:
Unity engine memory usage issue - taking up more than it should I'm making a 2D game that consists mostly of sprites. As a lot of them were too large in file size, I swapped them into meshes with unlit materials without textures. Now, The problem is that Unity by default, just opening a blank scene, uses 20 MB of texture memory according to the profiler.

So I checked instantiating 100 of my sprites (294 kb each), where the profiler showed 100MB used.

After that I had only those meshes in the scene, still 100 pieces, vertex count 124 each, tri count 47.
The memory usage was still around 100 MB, texture usage 20 MB

Lastly I instantiated 100-100, so the sprites and meshes together.
I got around 106 MB used memory.

This is my used memory with the sprites:

And this is my used memory with the meshes.

Now, as far as I know the meshes should rock in terms of memory as they are low res and have no textures attached.
Could someone tell me what's going on, why are my meshes worse than using sprites? And how to sort this out?

sentences:
Raycast is not restricting by other layer collider I have converted my project to URP and suddenly I found the situation where my Raycast code even is working beneath the collider (other layer colliders):
if (DisplayMessage.Click && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1000f, layermask))

I corss check the signature of raycast it is fine and the collider it self. Is there any changes in URP? Here is the way i am setting the layer:
int layermask => LayerMask.GetMask("Interact");

Scenario: In my scene, I have a plane (Default Layer) and a cube(Interact layer). The cube is beneath the Plane. But my camera Detecting the cube on mouse pointer and bypassing the Floor. The raycast should acctually not work if there any object of the desired layer.

sentences:
Unity: How to import a SINGLE animation for an existing character? The Holy Grail of animation solutions (for me). Right now, if I want to append a new animation for an existing character, I don't immediately know what to do. I assume I need to bring the same FBX into the Assets folder with the new animation, copy the animation, drag that onto my previous prefab, and delete the new FBX.  But that is such a pain!

I already have a VERY complicated animation tree that is executed via a script and some animation events. How can I quickly save and import a new animation into Unity, made with Blender?

sentences:
Problem generating multiple shadow maps in a loop I've successfully implemented shadow mapping for a specific direction as you can see in the image below:

Now I want to do omnidirectional shadow mapping but without using a cube map.

My first step was to turn my frame buffer object to an array of frame buffer objects and the same with my texture map (so I can get 6 shadow maps, one for every direction). This is the plan, but I'm stuck much earlier.
Replacing my variable framebufferFBO with framebufferFBO[0] and my texture variable depthMap with depthmap[0] the program runs exactly the same ( as expected ) .
However, when I try to do the following, and I mean only the following, as I'm already in the debugging phase , all I get is a black image .

for (int i = 0; i < 2; i++) {
    glGenTextures(1, &depthMap[i]);
    glBindTexture(GL_TEXTURE_2D, depthMap[i]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadow_width, shadow_height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO[i]);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap[i], 0);
    glDrawBuffer(GL_NONE);
    glReadBuffer(GL_NONE);
    glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

The only change is that it goes on for 2 loops. If I just do one loop my first shadow map works fine. If I leave it as it is the map you see in the first picture gets ruined.

So what is wrong with this loop? Am I doing something that is not allowed?

Edit: It seems that the problem is glDrawBuffer(GL_NONE).If it's not executed in the second loop, my first shadow map is still fine.

sentences:
OnTriggerEnter works...sometimes I was working on a small game in which you shoot projectiles towards various targets, now I decide to use OnTriggerEnter instead of OnCollisionEnter because OnCollisionEnter adds a slight force to the target during collision and I don't want that(btw, if anyone knows how to fix that, it'd be great), so I had to use OnTriggerEnter instead.

So the problem is that my code works just fine when the target is still or static. But when the target is in motion, sometimes the projectile works just fine as wanted(damages the target and disables itself afterwards) and other times, the projectile literally just moves through the target without causing any damage.

I say "sometimes" because this happens completely randomly.

Here's is my code:

public int m_DamageAmount;
public int speed;

private Rigidbody m_Rigidbody;

private void Awake()
{
    m_Rigidbody = GetComponent<Rigidbody>();
}

private void FixedUpdate()
{
    m_Rigidbody.AddForce(transform.forward * speed, ForceMode.Impulse);
}

private void OnTriggerEnter(Collider other)
{
    if (other.gameObject.layer == LayerMask.NameToLayer("Enemy"))
    {
        ObjectHolders._ImpactFX.Play();
        ObjectHolders._ImpactFX.transform.position = other.transform.position;

        EnemyBrain enemy = other.GetComponent<EnemyBrain>();
        if (enemy != null)
            enemy.Damage(m_DamageAmount);

        gameObject.SetActive(false);
    }
}

Here are other things I've tried:

1) I have changed both the target and the projectile's movements from transform to rigidbody.

2) I have tried changing my game time's Fixed Timestep value from 0.02 to 0.1.

These things did not have any visual effects on it.

sentences:
ANSI C Video Game Item System I am looking to program my own little Role Playing Game using...

ANSI C or "standard C", (NOT C++) as my programming language
The SDL2 development library

I have got a very basic and simple type of game up and going,
(I am learning ANSI C as I develop this hobby game).

I want to implement an item system to the game, so I have been looking through the internet for advice, but it seems like the closest I can get are solutions to C++, Java and other object oriented languages. I can't seem to find a good implementation in C, other than THIS guide, so I thought I could post this question specifically for ANSI C both for me and for others that might be looking to achieve the same goal.

My attack plan is to create a struct to lay out a blue print of what an item is, much like a class in an OOP language. Then, perhaps create an array that defines objects of this type and fills in the details for each item.

This is what I have so far:

#ifndef ITEMS_H_INCLUDED
#define ITEMS_H_INCLUDED

/* Create a structure that represent an item.
   @see https://www.tutorialspoint.com/cprogramming/c_structures.htm */
typedef struct Item {
    //Unique ID to be used as a reference to the item.
    unsigned int id;

    //Name of the item.
    char name[20];

    //Brief description about the item.
    char description[50];

    //Defines the category of the item; equipment, consumable, etc...
    unsigned char type;

    //Used for equipment; defines the strength of the weapon/armor.
    unsigned char stats[4];

    //The X and Y coordinates of the starting point of the sprite.
    unsigned int sprite[2];
}item;

#endif // ITEMS_H_INCLUDED

The id-attribute will be used to spawn the item in different locations, such as...

In the player's inventory
In a store
On the floor to be picked up

I'm looking to hard code the item DATA in the source file, but I'm also open for solutions like reading item information from a file, and such.

sentences: Move an object towards a point relative to its position I am attempting to move an object a set distance in a direction relative to the objects current position. In other words I want the object to move to whatever point is 144 pixels below the object, and then stop moving. How can I do this?

sentences:
Sphere to plane collision never rearching resting contact I have been trying to have a sphere to plane eventually lead to the sphere coming to a resting contact, but my sphere will end up always bouncing forever. It will bounce correctly for the first few times, but eventually it will just be in a constant state of a very small bounce. I have tried to exhaust every article I can find but I don't see where I am going wrong here. Does anyone see the issue? I have attempted to put as much information into this post so I apologize if it is a bit long.

I first attempt to see if there is resting contact, collision, no collision or if the sphere and plane will collide

Vector3 forces = (sphereTotalForces + sphereVelocity);
float denom = Vec3Dot(&plane->GetNormal(), &forces);

if(sphereVelocity.GetMagnitude() > 0 && dist <= sphereRadius + .0013f) {
    crCollisionResult.enCollisionState = RESTING_CONTACT;
    crCollisionResult.vCollisionNormal = plane->GetNormal();
    return crCollisionResult;
}
else if(fabs(dist) + 0.001f <= sphere->GetRadius()) {
    crCollisionResult.enCollisionState = COLLISION_HAS;
    return crCollisionResult;
}
else if(denom * dist > 0.0f) {
    crCollisionResult.enCollisionState = COLLISION_NO;
    return crCollisionResult;
}

where

sphereRadius  = 1
denom = -9.98206139
dist = 2.34482479

Since none of those are true I will then attempt to calculate when the collision will happen

    F32 fIntersectionTime = (sphere->GetRadius() - dist) / denom;
    F32 r;
    if(dist > 0.0f)
        r = sphere->GetRadius();
    else
        r = -sphere->GetRadius();

    Vector3 collision = spherePosition + fIntersectionTime * rigidBodySphere->GetVelocity() - r * plane->GetNormal();
    crCollisionResult.fCollisionTime = fIntersectionTime;
    crCollisionResult.vCollisionNormal = plane->GetNormal();
    crCollisionResult.vAdjustedPosition = collision;

The intersection time will be calculated to be 0.00334050134 , which is less than the fElapsedTime of 0.00703109941. As a result, I will update my sphere using the intersection time as the delta (so fElapsedTime here will be 0.00334050134)

    mAcceleration = mTotalForces / mMass;
    mVelocity += mAcceleration * fElapsedTime;
    Vector3 translation = (mVelocity * fElapsedTime);

    mTransform->Translate(translation.x, translation.y, translation.z);

    mTotalForces = Vector3(0.0f, 0.0f, 0.0f);

where

mTotalForces = (0, -10, 0)
mMass = 22

After I update there sphere with its new position, I will then calculate the new velocity of it being reflected

        Vector3 vSurfaceNormalized;
        Vec3Normalize(&vSurfaceNormalized, &crCollisionResult.vCollisionNormal);

        Vector3 vIncomingVelocity = pSphere->GetVelocity();
        F32 fIDotN = Vec3Dot(&vIncomingVelocity, &vSurfaceNormalized);

        Vector3 vReflectedVelocity = vIncomingVelocity - ((1.0f+pSphere->GetCoefficientOfRestitution()) * vSurfaceNormalized * fIDotN);
        pSphere->SetVelocity(vReflectedVelocity);

where

pSphere->mCoefficientOfRestitution = .85
vIncomingVelocity = (0, -5.30, 0)
mNormal = (0, 1, 0)
fIDotN = -5.30350208
vReflectedVelocity = (0, 4.50797653)

sentences:
How can I check for key releases between keyReleased callbacks? Slick2D's Input class has a isKeyPressed() method that returns a boolean value according to whether the specified key has been pressed.  I want to check if a key has been released in the same fashion.

I looked into adding a KeyListener to the input object, and overriding the keyReleased() method.  However, because I am currently handling input in the update() method of my BasicGame, this would fracture my code by handling input in two different places, which I'd like to avoid.

sentences:
How to create a view looking down the sight of the gun I am in the midst of creating an FPS game using XNA.  I am using the camera class from the First Person camera demo from dhpoware.com, and everything is working great.  What I'd like to implement is the ability to press the right mouse click and then the view changes so that you look down the gun, like the following image:

I have searched and searched but haven't found anything that will help me out, or at least point me in the right direction.  Can anyone help?

sentences:
How to implement toroidal mapping in SDL? I am making an Asteroids clone in SDL2. I think the kind of world asteroids takes place in is called toroidal map. I'm refering to the fact that the edges of the world are connected so when you exit from one side, you appear at the opposite.

My first approach was with SDL_DrawRect(), but I don't know how to "break" the rectangle in order for it to appear in two (or more) sides at once. I faked the effect by creating another rectangle, like a shadow, when the original rectangle was touching an edge. It worked somehow, but I wanted the real deal: render the diferent parts of the rectangle in different edges.

My second approach is creating the rectangle by SDL_FPoints in a std::vector, like this:

struct SpaceObject {
  std::vector<SDL_FPoint> shape_;
  // more members
  void generateSquareShape(const SDL_FPoint& where);
  void move(float delta_time, const SDL_Point& screen_size);
  void render(SDL_Renderer& renderer) const;
  void warpCoordinates(SDL_FPoint& point, const SDL_Point& screen_size);
  // more functions
};

The shape is generated once with generateSquareShape(). It just sets the appropiate coordinates to each SDL_FPoint.
The movement function is just applying deltas to each point:

void SpaceObject::move(float delta_time, const SDL_Point& screen_size) {
  for (auto& point: shape_) {
    point.x += delta_.x * delta_time;
    point.y += delta_.y * delta_time;
    warpCoordinates(point, screen_size);
  }
}

Render is more of the same, another vector travesal:

void SpaceObject::render(SDL_Renderer& renderer) const {
  for (const auto& point: shape_) {
    SDL_RenderDrawPointF(&renderer, point.x, point.y);
  }
}

The warpCoordinates() is called at every move to check if a point must go to another side:

void SpaceObject::warpCoordinates(SDL_FPoint& point, const SDL_Point& screen_size) {
  if (point.x < 0) {
    point.x = screen_size.x + point.x;
  } else if (point.x > screen_size.x - 1u) {
    point.x = point.x - screen_size.x;
  }

  if (point.y < 0) {
    point.y = screen_size.y + point.y;
  } else if (point.y > screen_size.y - 1u) {
    point.y = point.y - screen_size.y;
  }
}

All in all it accomplishes with the effect nicely, but I think it performs poorly (at least in my laptop i5 2,6ghz, 6gb RAM, win10) and it hasn't collision detection yet.
One optimization I think is moving and rendering on the same function so it only loops through the points vector once, but I think that breaks the one function, one job, doesn't it?

So, is there anything I'm missing to improve performance? A faster algorithm to implement this toroidal world? Maybe a most suitable SDL class to work with? Or some C++ technique I'm not using and I should? Thanks in advance, any help appreciated.

Using win10, SDL2.0.12, and the latest visualC++ compiler.

sentences:
SharpDX: best practice for multiple RenderForms? I have an XNA app, but I really need to add multiple render windows, which XNA doesn't do.  I'm looking at SharpDX (both for multi-window support and for DX11 / Metro / many other reasons).  I decided to hack up the SharpDX DX11 MultiCubeTexture sample to see if I could make it work.

My changes are pretty trivial.  The original sample had:

[STAThread]
private static void Main()
{
    var form = new RenderForm("SharpDX - MiniCubeTexture Direct3D11 Sample");
    ...

I changed this to:

        struct RenderFormWithActions
        {
            internal readonly RenderForm Form;
            // should just be Action but it's not in System namespace?!
            internal readonly Action RenderAction;
            internal readonly Action DisposeAction;
            internal RenderFormWithActions(RenderForm form, Action renderAction, Action disposeAction)
            {
                Form = form;
                RenderAction = renderAction;
                DisposeAction = disposeAction;
            }
        }

        [STAThread]
        private static void Main()
        {
            // hackity hack
            new Thread(new ThreadStart(() =>
            {
                RenderFormWithActions form1 = CreateRenderForm();
                RenderLoop.Run(form1.Form, () => form1.RenderAction(0));
                form1.DisposeAction(0);
            })).Start();
            new Thread(new ThreadStart(() =>
            {
                RenderFormWithActions form2 = CreateRenderForm();
                RenderLoop.Run(form2.Form, () => form2.RenderAction(0));
                form2.DisposeAction(0);
            })).Start();
        }

        private static RenderFormWithActions CreateRenderForm()
        {
            var form = new RenderForm("SharpDX - MiniCubeTexture Direct3D11 Sample");
            ...

Basically, I split out all the Main() code into a separate method which creates a RenderForm and two delegates (a render delegate, and a dispose delegate), and bundles them all together into a struct.  I call this method twice, each time from a separate, new thread.  Then I just have one RenderLoop on each new thread.

I was thinking this wouldn't work because of the [STAThread] declaration -- I thought I would need to create the RenderForm on the main (STA) thread, and run only a single RenderLoop on that thread.  Fortunately, it seems I was wrong.  This works quite well -- if you drag one of the forms around, it stops rendering while being dragged, but starts again when you drop it; and the other form keeps chugging away.

My questions are pretty basic:

Is this a reasonable approach, or is there some lurking threading issue that might make trouble?
My code simply duplicates all the setup code -- it makes a duplicate SwapChain, Device, Texture2D, vertex buffer, everything.  I don't have a problem with this level of duplication -- my app is not intensive enough to suffer resource issues -- but nonetheless, is there a better practice?  Is there any good reference for which DirectX structures can safely be shared, and which can't?
It appears that RenderLoop.Run calls the render delegate in a tight loop.  Is there any standard way to limit the frame rate of RenderLoop.Run, if you don't want a 400FPS app eating 100% of your CPU?  Should I just Thread.Sleep(30) in the render delegate?

(I asked on the sharpdx.org forums as well, but Alexandre is on vacation for two weeks, and my sister wants me to do a performance with my app at her wedding in three and a half weeks, so I'm mighty incented here!  http://robjsoftware.org for details of what I'm building....)

sentences:
how to reference a variable in an anothere script i have a object which sets pickedup = true on collision
public class IDCARD : MonoBehaviour
    {
    private bool pickedup = false;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    private void OnCollisionEnter(Collision collision)
    {
       print("k");
        pickedup = true;
        Destroy(gameObject);
    }
}

now i want exit script in an another object to check if pickedup == true on collison
now what can i do pls  give a brief explanation  with a names i have given
i have written your code. but i think there is some issues

sentences:
How do I determine if I'm allowed to use an asset from the web in my game? I need to incorporate other people's work into my game project. I must admit (with a little embarassment) that I am almost completely ignorant about copyright. I only have a vague idea of what it is, what it protects, or what it means when I see Ⓡ or © or ™. Since English is not my native language, reading all those Wikipedia pages full of legal jargon only gave me an headache.

I'm looking for images (sprites, backgrounds, UI elements mostly) and sound. I intend to publish the game (Google Play and Flash/HTML5 game websites, maybe the iPhone App Store). I don't plan to "sell" it directly, but I do intend to insert ads and/or in-app purchases.

I will most likely need to edit the content before including it in my game. Probably just scaling/rotating, but the greater degree of freedom I have, the better.

So, what should I look for, to be sure I have the rights to use the media I find the way I need to (like "royalty free" or "copyright free")? In which cases do I have to ask for "permission" to use that media, and how? Like, send the owner of the site an e-mail?

sentences:
How should I manage events in XNA on the Windows Phone 7 without impacting performance? It's best-practice to not to create lots of short-lived temporary objects the heap as it'll eventually force a garbage collection during game-play.

It is best to create short lived value objects.

Where does this leave us with event handlers?  My game object fires events quite frequently, so I don't want to create new MyThingDidSomethingEventArgs every time.

What's the alternative.  What do you use?

sentences:
Saving Unity Custom Inspector state to a text / save file? For the basic values I know how to do it like:

Item name (Simple string value)
Amount (Simple int value)
isNormalDrop (Simple bool value)

The problem is saving the Reflection variable (The script part near the bottom) which is of type 'UnityEngine.Object' and the GameObject variable how would I do this?

sentences:
LibGDX Box2DLights shadow offset problem on bodies Hello I just started to use LibGDX, and it's awesome.
I looked at the Box2DLights library, and started to learn how the lighting work here.

I got something up:

(source: gyazo.com)

As you can see, it works, but the shadow of the sprite goes over itself, and doesn't start in the right place.

Why is it doing this? is it possible to set offsets?

This is how I initialize them:

    this.texture = new Texture("sprites/water.png");
    this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    this.camera.setToOrtho(false);
    this.renderer = new SpriteBatch();

    this.map = new TileMap(20, 20);
    this.map.generateAllSame(new Texture("sprites/sprite.png"));

    this.world = new World(new Vector2(), true);

    this.createBodies();

    RayHandler.setGammaCorrection(true);
    RayHandler.useDiffuseLight(true);
    this.ray = new RayHandler(this.world);
    this.ray.setAmbientLight(0.2f, 0.2f, 0.2f, 0.1f);
    this.ray.setCulling(true);
    this.ray.pointAtLight(50, 0);
    this.ray.setBlurNum(1);
    camera.update(true);
    this.spriteLight = new PointLight(ray, 128);
    this.spriteLight.setDistance(500f);
    this.spriteLight.setPosition(150, 150);

    this.spriteLight.setColor(new Color(0.5f, 0.8f, 0.7f, 1f));
    this.spriteLight.setSoftnessLength(0);
    this.spriteLight.setSoft(true);

public void createBodies() {
    CircleShape chain = new CircleShape();
    chain.setRadius(10);

    FixtureDef def = new FixtureDef();
    def.restitution = 0.8f;
    def.friction = 0.01f;
    def.shape = chain;
    def.density = 1f;

    BodyDef body = new BodyDef();
    body.type = BodyType.DynamicBody;

    for (int i = 0; i < 3; i++) {
        body.position.x = 40 + MathUtils.random(500);
        body.position.y = 40 + MathUtils.random(500);

        Body box = this.world.createBody(body);
        box.createFixture(def);
        this.bodies.add(box);
    }
    chain.dispose();
}

And my rendering:

public void render() {
    handleInput();
    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.setProjectionMatrix(camera.combined);

    renderer.disableBlending();
    renderer.begin();
    this.map.render(renderer);
    renderer.draw(texture, 50, 50);

    renderer.enableBlending();

    for (Body body : this.bodies) {
        Vector2 pos = body.getPosition();
        renderer.draw(texture, pos.x + amount, pos.y);
    }
    renderer.end();

    ray.setCombinedMatrix(camera.combined, camera.position.x, camera.position.y,
            camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom);

    ray.update();
    ray.render();

}

What did I do wrong?

sentences:
add random walls with an array in 3D xna 4 I'm trying to add walls to my 3D game. I created a wall entity and added model array

public Walls()
{
  modelArray = new Model[10];
}

public void Initialize(ContentManager contentManager)
{
  for (int i = 0; i < modelArray.Length; i++)
  {
    rnd = new Random();
    sidesWall = rnd.Next(-4, 4);
    forwardWall = rnd.Next(-8, 0);
    modelArray[i] = contentManager.Load<Model>("wall");
  }
}

Draw method:

public void Draw(Camera camera)
{
  foreach (Model m in modelArray)
  {
    foreach (ModelMesh mesh in m.Meshes)
    {
      foreach (BasicEffect effect in mesh.Effects)
      {
        effect.EnableDefaultLighting();
        effect.PreferPerPixelLighting = true;
        effect.World = GetWorldMatrix();
        effect.View = camera.ViewMatrix;
        effect.Projection = camera.ProjectionMatrix;
      }

      mesh.Draw();
    }
  }
}

It doesn't work and it shows only one wall.

How can I make it work?

sentences:
XNA 4.0 thick triangle strip to fix aliasing issues upon rotation My triangle strip based lines are disappearing intermittently when I rotate my camera around the X axis.

I was advised that this is due to aliasing issues and that "At a certain angle when its edge is facing the camera your strip will disappear." So, I was told to give the strip some thickness.

Can someone tell me the best way to do this? Would it be to draw two strips directly on top of each other? This doesn't seem to solve the problem but perhaps I am doing it wrong.

sentences:
How to make a catapult work with physics and colliders? This should be my final question regarding getting a catapult to throw something in unity. On my last question, someone suggested starting with something simpler (which I apologize for not doing earlier). It worked, so in my test project I put some shapes together to roughly approximate my catapult to see if it could throw something.

here's the code on arm rotation parent(which I made so that the arm rotated like a catapult arm)
if (Input.GetKey(KeyCode.Space))
        {
            _rigidbody.AddTorque(new Vector3(0,0,1));
        }

This version rotated and pushed the ball along with it,but it didn't throw it very much. Weird things started to happen when I increased the z magnitude of the torque vector(to 5). Here are my physics settings

Arm rotation parent

rigidbody with interpolate on, frozen every way except z rotation

ball guide

kinematic rigidbody with interpolate on
mesh collider with its shape

floor

default cube box collider
kinematic rigidbody with interpolate on

cube(this is the arm connecting the cup to the center)

default box collider for cubes
kinematic rigidbody with interpolate on

ball

sphere collider
gravity rigidbody with interpolate on

When I spin the arm, the ball almost completely passes through the floor, barely affected by it. On the next rotation, it does the same thing. here's a gif of what it does:

How do I get the cup of the catapult to interact more accurately and completely with the ball? I increased the physics fps to 100 to see what would happen, and that didn't fix it. Let me know if you need more info, thanks!

sentences:
Abstract Java game objects for Jython I want to create an abstraction layer between my Jython Script objects and my Game Objects. I am not making the all of the engine in Jython. Most of my game logic is in Java. I just want to expose high level functionality. I am thinking of using these classes.

Jython Object is created using a Jython class and a Java interface that is coerced into java.
Abstracted Object and Abstraced Map are objects with get() functions that limit the exposure of the underlying Game Map and Game Object.
Game Object and Game Map are the underlying Java objects. They are wrapper classes for a component based system.
Action Factory provide functionality to Jython Object. My game is a turn based tactic, so any change in the game board is done by a set of generic actions (move, damage, apply buff, etc).

This is the first time I have tried to implement a scripting system. The goal is be able to design objects and abilities in Jython. Also create a modding system. I have read several places that creating an abstraction layer is a good idea. I am just not sure how to do it.

sentences:
How can I make background elements wrap around the screen? I'm looking to make my clouds wrap around the screen in my game (like the picture).

Right now it just continues off the screen. The current movement code is:

Cloud.center = CGPointMake(Cloud.center.x +0.032, Cloud.center.y)

sentences:
Running Slick2d outside of the IDE I am looking for advice how to solve an exception I am getting,

I've looked around and seen people get the same error but most people whom had it seems to run on old graphics drivers and once they fixed that it seemed to work for most people.

I doubt that's the reason causing it for me since I have the latest nVidia drivers and the game runs well from the IDE. I also did create a jar of the game before I implemented Slick2d and that ran without exceptions.

I used to get another exception, that it couldn't find the right natives for lwjgl so I removed the natives from the build and made a fat jar with jarsplice and added them during that process and that's when I ended up at this point.

I've tried and tried for days and it's probably something really stupid and easy to fix but I havn't built a lot of project to be ran from outside Eclipse so any help would be greatly appreciated.

Some basic info on my rig:

OS: Windows 7: Enterprise

CPU: Intel Core i7-2600K

GPU: nVidia GTX 980

RAM: 8192MB (forgot the brand and make, it's old lol)

sentences:
How can I to get an animation to be triggered by proximity of a mesh actor (an object)? So I'm making my first build in Unreal 4 using Blueprint. The "game" calls for the player character to grab a particular object (a static mesh actor) and bring it close to a door that will slide open if detects the item near.
I have the door slide animation and a trigger volume around the door but I can't get it to work with the mesh actor I want. So far I've managed to get it to open with by pressing a keyboard key while being inside the trigger volume. I believe the volume trigger can detect any actor that is within its border, right?
What nodes could I use to make this work?
UPDATE: Thanks to @Stephen I tried using the cast node solution but I still can't get it to work
If it helps, I've added an updated screenshot of my blueprint.
Cheers!

sentences:
How can I translate a game object towards a position? I am instantiating my game objects (spheres) through scripts. I want my spheres to move from one location to another. but I don't know how to do this. Update is called once per frame. Is that what I should use? I am using the free version of Unity; I don't want to use special plugins.

How do I move these game objects from one location to another, over time?

sentences:
How to make a model parts glow one after the another I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first part still remains.

public GameObject pons;
public GameObject frontallobe1;

void Update () {
    Invoke("PonsGlow",2);
    Invoke("frontalLobe1Glow",4);
}
void PonsGlow()
{
    pons.renderer.material.color=Color.red;
}
void frontalLobe1Glow()
{
    frontallobe1.renderer.material.color=Color.red;
}

sentences:
When should I set a texture as a shader resource in order to read it? I'm writing a Direct3D 11 HLSL shader with SharpDX. What I want to do is write the depth to a texture in one pass and read it in the next one. After declaring the texture, do I have to set the depth texture and the shader resource view per frame, or just once when attaching?

this.depthStencilShaderResourceVariable = this.effect.GetVariableByName("DepthTexture").AsShaderResource();
this.depthStencilShaderResourceVariable.SetResource(this.depthTextureShaderResourceView);

sentences:
Where are all the tutorials for libGDX? I've searched online for help and tutorials on LibGDX but I couldn't really find any, except and the wiki for asking questions on stackexchange. Besides the source (demos) and wiki, is there any other tutorials online that's hidden or indirect?

From what I read, there isn't much documentation for LibGDX, so there's only two options I see

Give up move to a different framework.
Ask people a lot of questions.

sentences:
How can I scale a color component by Time.deltaTime and still fit it into a byte? I am confused about this issue, and I can't find why I get this and how to fix it properly from  the Google searches I've tried.

This is a short version of my code:

     byte redtarget = 70;
     byte greentarget = 222;
     byte bluetarget = 255;
     byte opacitytarget = 1;
     byte redcurrent = 0;
     byte greencurrent = 0;
     byte bluecurrent = 0;
     void OnMouseOver() {
        redcurrent = redcurrent + redtarget * Time.deltaTime;
        greencurrent = greencurrent + greentarget * Time.deltaTime;
        bluecurrent = bluecurrent + bluetarget * Time.deltaTime;
    if(redcurrent >= redtarget) {
        redcurrent = redtarget;
    }
    if(greencurrent >= greentarget) {
        greencurrent = greentarget;
    }
    if(bluecurrent >= bluetarget) {
        bluecurrent = bluetarget;
    }
    theobject.GetComponent<Renderer>().material.SetColor("_EmissionColor",new Color32(redcurrent,greencurrent,bluecurrent,opacitytarget)) ;
     }

Please ignore the other errors that could have been introduced when I copy + pasted it to here.

And this is the error I get:

As you see the error, "cannot implicit convert type float to byte", the problem is caused by Time.deltaTime that returns a float value, and I need a byte due to Color32.

Is there any way to turn Time.deltaTime to byte? Or should I use another type of color that use floating point numbers?

I'm a beginner with Unity so I'm sorry if this has already been asked somewhere; as I said, I can't find it on the Internet.

sentences:
Unity Inspector | Displaying min and max variables on a single line In a C# Unity script, how can I add fields that will be displayed in the Unity Inspector with min and max values on a single line? (like it is done for the Particle System, where you can choose Between Two Constants)

WHAT I HAVE | Separate lines for min and max:

public class MyTest : MonoBehaviour {
    [SerializeField] float projectileRateMin = 1f;
    [SerializeField] float projectileRateMax = 3f;
}

WHAT I WOULD LIKE: Single line with both min and max:

Another example is Vector2, which also gets displayed in the Inspector on one line. I did look at the Vector2 code and tried to copy and rename the relevant parts of the Vector2 struct to my own version, but it didn't show up in the Inspector at all.

sentences:
Skeleton bone in incorrect spot in-game yet, blender rig, skeleton mesh and physics asset are all correct and behave properly I've made a custom character and rigged it in blender. Then exported/imported into ue4. It behaves properly in the PHAT and the skeleton mesh looks fine and it all behaves properly in the simulations.
In the BP and in-game the physics all behave fine except 1 single bone rises above the rest and appears to "flip" the root bone for unknown reasons. Almost like all the sudden the root does a 180 and then one specific bone attached rises as a result, not sure if it rises and that flips the root or the root is flipping for some unknown reason.
What I don't understand is why everything is fine until it is in-game/bp. Maybe I'm misunderstanding how physics work with skeleton mesh?

I've been banging my head on the wall trying to figure out phat, skeletons and how physics work in ue4 for about a month now and there is basically 0 docs/tutorials on this. As much as I love being stuck on this problem forever if anyone has an idea on what is going wrong that'd be great.

sentences:
How can I extend this graphics code to draw more vectors of vertices? I want to include the drawing of other vectors of vertices in the following code, in a number of places it seems easy enough to simply add or multiply size()s of the two vectors, for instance in the first check. But then it gets a bit fuzzy simply because of a lack of understanding.

Should I add them together to create a bigger buffer description and copy everything together? Or should I do it all separately?

Basically how would I extend this code to include more vectors of vertices?

if (temporary2DVerts.size() > 0)
{
    // create the vertex buffer and store the pointer into pBuffer, which is created globally
    D3D10_BUFFER_DESC bd;
    bd.Usage = D3D10_USAGE_DYNAMIC;
    bd.ByteWidth = sizeof(VERTEX) * temporary2DVerts.size();// this breaks the create buffer line : temp2DVerts.size();
    bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
    bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
    bd.MiscFlags = 0;

    device->CreateBuffer(&bd, NULL, &pBuffer);

    void* pVoid;    // the void pointer

    pBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the vertex buffer
    memcpy(pVoid, &temporary2DVerts[0], sizeof(temporary2DVerts[0]) * temporary2DVerts.size());
    pBuffer->Unmap();

    // select which input layout we are using
    device->IASetInputLayout(screenVertexLayout);

    // select which primtive type we are using
    device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);

    // select which vertex buffer to display
    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    device->IASetVertexBuffers(0, 1, &pBuffer, &stride, &offset);

    // apply the appropriate pass
    screenPass->Apply(0);

    // draw the vertex buffer to the back buffer
    device->Draw(temporary2DVerts.size(), 0);

    temporary2DVerts.clear();
}

EDIT - just to be clearer - there are 4 vectors of vertices. two that don't change and two that constantly change. permanent 2D and permanent 3D and a temporary version of both. This is so the permanent ones can just be loaded in and are always drawn, and the temporary ones  only get drawn for a frame. This way I can create moving lines for debugging, like line of sight cones etc.

EDIT - the naive approach would be to duplicate this code 4 times for each vector, but surely there is a better way? I don't think this is a hard thing to do, but trying to do it has exposed a basic gap in my knowledge about what some of these lines of code do. should I just populate one big list from all the vectors and push that through?

some need to be drawn with different passes, and some don't need to be changed each frame. for example, the permanent ones can just stay on the gpu. right?

sentences:
What's a simple way of sending game data between phones? Using windows phones I need to send small amounts of data between phones in a turn based game. It's only a few bytes of data and does not need to be real time, something like in wordfeud or similar. There could be 2-4 players in one game and one players actions need to be sent to the other ones.

What would be the simplest way to manage this?

If it would be possible to easily extend to other platforms with monogame that would be nice but not a requirement right now (guess I'll cross that bridge when I come to it).

My initial hope was that this would be possible using some online service like scoreloop or openXlive that could handle all the online stuff (leaderboards, communications, social etc) but I haven't found one that can do it all.

sentences:
Assistive Machine Learning for Scene Creation A few years ago, I have seen a talk about assistive ML tools in game development. I think was from
Ubisoft La Forge, but could be wrong.
In the video it was demonstrated, how an „AI“ understood the relationship of objects in a room and it was possible to give it simple commands like „clean the room“ and everything was put in its place, like books in the shelf, chess pieces on the board and so on. But it was also possible to ask to make the room look used by a child to change the scene accordingly.
The problem is, I can‘t find the video anymore and neither do I remember the name of the tool or the creator. Any idea how it was called and what‘s the state of it?

sentences:
Unity - How to make grass details look good from top-down I have an issue with the terrain details. Since it only draws a single plane per texture, it looks quite crappy with a angled top-down camera, for example for an RTS camera.

Is there some way around this, I know one solution people use is to angle the grass towards the camera a bit, but that isnt possible with the terrain details painter.

The issue is circled in red:

If there is no solution to this, are there some techniques I can use to make some interesting-looking grass for an RTS camera?

sentences:
In XNA 4, how can I access SpriteBatch's transformMatrix in my shader? I would like to use a custom effect with a regular XNA SpriteBatch. I have a 2D camera which computes a transform matrix, so I need my shader to take this into account.

I have put a world matrix property into my shader:

float4x4 World;

However, it does not get set by SpriteBatch:

spriteBatch.Begin(spriteSortMode, blendState, samplerState,
    depthStencilState, rasterizerState, effect, camera.WorldToScreen);

Everything is rendered properly if I set it manually in the draw loop:

effect.Parameters["World"].SetValue(camera.WorldToScreen);

How can I set up my shader parameters to make SpriteBatch set them up correctly?

sentences:
Collision box to slow I've made the collision box for my player (and other blocks) and I'm now testing gravity and collision on the player. What I saw was that my collisionbox is updating slower than my player is moving.

It's not visual if he's just moving, but you can clearly see it when he's falling at a certain speed. (and it causes problems with the collision because the box updates slower)

This is for updating my collision box (and player):

public override void Update(GameTime gameTime, Rectangle clientBounds)
{
    // collision box for player
    if (left)
    {
        collisionRect = new Rectangle((int)position.X + 10, (int)position.Y + 14, frameSize.X + 2, frameSize.Y + 20);
    }
    else
    {
        collisionRect = new Rectangle((int)position.X + 8, (int)position.Y + 14, frameSize.X + 2, frameSize.Y + 20);
    }
    // for player
    position += direction
}

This is for updating my player:

public override Vector2 direction
{
    get
    {
        Vector2 inputDirection = Vector2.Zero;
        keyboard = Keyboard.GetState();

        if ((keyboard.IsKeyDown(Keys.Left)) || (keyboard.IsKeyDown(Keys.A)))
        {
            moving = true;
            walking = true;
            inputDirection.X -= 1;
            running = false;
            left = true;

            if (keyboard.IsKeyDown(Keys.LeftShift))
            {
                speed = speedMultiplier;
                inputDirection.X -= 1;
                running = true;
            }
        }

        if ((keyboard.IsKeyDown(Keys.Right)) || (keyboard.IsKeyDown(Keys.D)))
        {
            moving = true;
            walking = true;
            inputDirection.X += 1;
            running = false;
            left = false;

            if (keyboard.IsKeyDown(Keys.LeftShift))
            {
                speed = speedMultiplier;
                inputDirection.X += 1;
                running = true;
            }
        }

        if (!(keyboard.IsKeyDown(Keys.Right)) && !(keyboard.IsKeyDown(Keys.D)) && !(keyboard.IsKeyDown(Keys.Left)) && !(keyboard.IsKeyDown(Keys.A)))
        {
            moving = false;
            walking = false;
        }

        if (stopping)
        {
            inputDirection.X = 0;
        }

        if (falling)
        {
            inputDirection.Y += 1f;

        } else
        {
            inputDirection.Y = 0;
        }

        return inputDirection * speed;

    }
}

Or do I also need to use a get; for my collisionbox instead of updating it in Update()?

sentences:
Setting shader by script? I make s shader file and drop it on object with material. I wrote this script to run shader when press Space button. All is good except that script not load shader when run the game !! I have to do it manually only !

public Material _shader;
public float timer = 0;

// Start is called before the first frame update
void Start()
{

    _shader = gameObject.GetComponent<Material>(); // Not setting shader !!
    _shader.SetFloat("Vector1_F92326F1", timer);

}

// Update is called once per frame
void Update()
{

    if (Input.GetKeyDown(KeyCode.Space))
    {
        timer += 0.1f;
        _shader.SetFloat("Vector1_F92326F1", timer);
    }

}

sentences:
UnrealScript access variable in one class from another? So there are some similar questions out there but the responses often say that you should use 'new' or 'spawn', but I'm working with the playercontroller don't want to make a new playercontroller.  Maybe this isn't the right way to be doing this but I want to view the state of a variable in the playercontroller that will change fairly often from my HUD.  Is there a way to do this?

playercontroller class

var bool bYeaNo;

exec function change() {
  bYeaNo= !bYeaNo;
}

defaultproperties
{
  bYeaNo = false
}

HUD class

event PostRender() {
  Super.PostRender();
}

function DrawHUD() {
  Super.DrawHUD();
  Canvas.SetDrawColor(0, 0, 0);
  Canvas.SetPos(25, 25);

  if (bYeaNo) { //this is wrong so what would make this work?
    Canvas.DrawText("Yea");
  } else {
    Canvas.DrawText("No");
  }
}

sentences:
Is there any guarantee about the graphical output of different GPUs in DirectX? Let's say that I run the same game in two different computers with different GPUs.
If for example they are both certified for DirectX 10. Is there a guarantee that the output for a given program (game)  is going to be the same regardless the manufacturer or model of the GPU? I am assuming the configurable settings are exactly the same in both cases.

I heard that it is not the case for DirectX 9 and older, but that it is true for DirectX 10. If someone could provide a source confirming or denying it, it would be great.
Also what is the guarantee offered. Will the output be exactly the same or just perceptually the same to the human eye?

sentences:
Unity - warning: animations neck and head have scale I always get this warning if I import my model to unity:

Clip 'soldier_idle' has import animation warnings that might lower retargeting quality:

Note: Activate translation DOF on avatar to improve retargeting quality:

    'neck' has scale animation that will be discared.

    'head' has scale animation that will be discared.

Even though there are in fact no scale animations on the bones neck and head as you can see in my blender dopesheet.

So why is this warning showing?

sentences:
Algorithm for potential fields Rather than computing potential fields in a grid and performing a lookup for them, I've decided to query the potential fields at a given point in 3D space by simply querying all the objects in a sphere of a given size- after this, I decide that their contribution to the final target is minimal and not worth computing.

However, after this, my efforts seem to be falling a bit short. Everything that I've tried results in either absolutely no effect whatsoever, or the units endlessly jerk around in circles.

I have the target position given by A*, and the direction I need to be facing in to face that target.

Right now, I'm running with this:

float total_distance = 0;
auto units = Units.collision(Physics::Sphere(unit->GetPosition(), range));
std::for_each(units.begin(), units.end(), [&](Unit* u) {
if (u == unit)
    return;
if (Math::Length(u->GetPosition() - unit->GetPosition()) > range)
    return;
total_distance += Math::Length(unit->GetPosition() - u->GetPosition());
});
std::for_each(units.begin(), units.end(), [&](Unit* u) {
    if (u == unit)
        return;
    if (Math::Length(u->GetPosition() - unit->GetPosition()) > range)
        return;
    auto relative_vector = unit->GetPosition() - u->GetPosition();
    auto heading = Math::Normalize(relative_vector);
    auto scaled_heading = heading * ((total_distance - Math::Length(relative_vector)) / total_distance);
    target_heading += scaled_heading;
    if (target.x != target.x)
        __debugbreak();
});
target_heading = Math::Normalize(target_heading);

If anybody can suggest a superior algorithm, I'd be interested in hearing about it.

sentences:
What kind of shader is this? Cube World uses a pretty good looking shader, I especially like the shading of the characters:

Is this soft shading? I'd like to achieve this effect in Unity 3D Free, but since the free version doesn't support dynamic shadows, guess I have to code it myself, so an article on this or the algorithm would be great.

sentences:
How to position a 3D crosshair on an objects face and set its angles **outward** from objects face? What I have right now, is a ray tracer for my cursor on my canvas, when I click on the object, it gets the vector of my selection in the 3D space on the object I had my mouse on.

The ray tracer returns a point which is a Vector3, so I set my crosshairs (line) position to point, only issue is, I need my crosshair to be pointing outward from my object like so: (example)

This is where my issue lies... I need to get the direction of the face that my ray tracer intersected, but I cant figure out how. I can get the direction of the object itself no problem,but I dont want that, I want my crosshair to lie flat on the face that its positioned on.

This is it incorrectly positioned on the side of my model:

So the line thats pointing outward from the cross, should point outward from the face and the cross be flat on the surface I clicked.

This is the code Im using now:

line.position.copy(intersects[0].point);
var mx = new THREE.Matrix4().lookAt(intersects[0].point,new THREE.Vector3(0,0,0), intersects[0].normal);
var qt = new THREE.Quaternion().setFromRotationMatrix(mx);
line.rotation.copy(qt);

Update

I've tried another approach as seen here but Im still haing trouble getting it to flatten out on the mesh:

var mat = intersects[0].object.matrixWorld;
    mat.setPosition(new THREE.Vector3(0, 0, 0));
    var globalNormal = intersects[0].face.normal.clone().applyMatrix4(mat).normalize();
    var lookAtTagret = new THREE.Vector3().addVectors(intersects[0].point.clone(), globalNormal);
    line.lookAt(lookAtTagret);
    var cPos = new THREE.Vector3().addVectors(intersects[0].point, globalNormal.multiplyScalar(0.05))
    line.position.copy(cPos)

sentences:
Create a rectangle struct to be rotated and have a .Intersects() function In my XNA program, I am trying to swing a sword. The sword starts at an angle of 180 degrees, then rotates (clockwise) to an angle of 90 degrees.

The Rectangle struct that XNA provides,

Rectangle mAttackBox = new Rectangle(int x, int y, int width, int height);

However, this struct has two problems:

Holds position and size in Integers, not Floats
Cannot be rotated

I was hoping someone could help me in either telling me that i'm wrong and the Rectangle can be used for both these methods, or can lead me down the right path for rotating a rectangle.

I know how to create a Struct. I believe that I can make methods like classes. I can determine the 4 vertices of a 2D rectangle by calculating out the x,y of the other 3 given the length, width.
I'm sure theres a Matrix class I can use to multiply each point against a Rotation matrix.

But once i have my 4 vertices, I got two other problems:

How do I test other rectangles against it? How does .Intersects() work for the rectangle struct?
Is this even the fastest way to do it? I'd be constantly doing matrix multiplication, wouldnt that slow things down?

sentences: Do I need an Indie Studio Name? I've recently been making a mobile game which I'm going to publish to Google Play. Google Play requires a Developer Name. Most Google Play Developer use their game studio name like Gameloft, Supercell, etc. But some indies use their names as the developer name like Scott Cowthon, FNAF Developer. I was wondering what are the advantages and disadvantages of each type to me as the only developer of my game?

sentences:
Where in code to for collision? In object class? Mainline code? Making a simple game in Love 2D framework where if I click on an object then it disappears.

Do I check to see if I've clicked the enemy inside a function in the enemy object? Or just in my main.lua? Currently I have this code in my main.lua:

function love.mousepressed(x, y, button)
   if button == "l" then
      for i,b in ipairs(bugs) do
         if b:isClicked(x, y) then
            table.remove(bugs, i)
         end
      end
   end
end

Is there a standard design pattern on where this code should belong?

sentences:
Cannot decide between using a MessageBus and entities for events in my ECS game For example, let's say that the player walks into an enemy and in response, a chain of events should occur (such as: his score goes up, the enemy dies, a cinematic starts, etc.)
I see two "proper" ways of accomplishing this:
Method 1:
There exists a global message bus in the game. Any system can emit events to it, and any other system can listen for some events from it. For example, the system handling the players score would look like this:
messageBus.listen("playerhitsenemy", e => {
  score += e.monsterType;
});

and the collision system may look like this:
messageBus.emit("playerhitsenemy", { monsterType: 5 });

Similarly, other systems can listen for the same event, such that when something happens, the CPU immediately moves from processing the current system to the other system processing this event. That is, the emit call is basically just a list of callbacks that are immediately invoked and sent the message.
Method 2:
The second method, instead, is to encode events / messages as entities themselves. That is, when an event occurs (such as the player hitting something in the collision detection system), this would happen:
let newEntity = new Entity();
newEntity.components.push(new MessageComponent());
newEntity.components.push(new MessagePlayerHitsEnemyComponent(5));
entityAdmin.spawnNewEntitiy(newEntity);

That is, a new "message" entity is created, and it is given the generic Message component and the concrete event component type as well, MessagePlayerHitsEnemy.
Then, all systems interested in these messages would have something like this in their execute function:
for (let entity of entityAdmin.query(MessagePlayerHitsEnemyComponent) {
  let monsterType = entity.getComponent<MessagePlayerHitsEnemyComponent>();

  score += monsterType;
}

And then at the end of the frame there would be a system whose responsibility was deleting all messages, like so:
for (let entity of entityAdmin.query(MessageComponent) {
  entityAdmin.remove(entity);
}

I cannot decide which is better. The first method seems simpler and probably more efficient in Javascript, considering it's just immediately invoking all the requested functions. However, the second one seems more "correct", in each system is iteratively processed. That is, first the collision system runs in its entirety, then the scoring system, etc. There is no "jumping around" from system to system during execution. Each system processes everything in its entirety, and then the second system processes everything it's interested in, etc.
So, in essence, the first method seems simpler and more efficient, while the latter method seems more "correct", pure, verbose, debuggable, and extendable. Which one should I pick?

sentences:
isometric background that covers the viewport The technique I use now is a loop with an innerloop that draws images on a canvas element, but it looks like a rotated square.

This is a nice example that covers the whole viewport.

I have read something vague about clickthrough maps? What kind of techniques are there that are most efficient with mobile devices and javascript?

Edit

I other words, howto create a grid, in HTML5 that looks like the picture above, where you can place elements on. ( in the picture, it is the garden ) If it's not isometric, what is it and can it be created in html5. What I use now, creates a repititive background.

function draw() {

    c.clearRect(0, 0, canvas.width, canvas.height);

    for (var row = 0; row < 10; row++) {
        for (var col = 0; col < 10; col++) {

            var tilePositionX = (row - col) * tile.height;

            // Center the grid horizontally
            tilePositionX += (canvas.width / 2) - (tile.width / 2);

            var tilePositionY = (row + col) * (tile.height / 2);

            if (tileMap[row] != null && tileMap[row][col] != null) {
                tilePositionY -= tileMap[row][col].height - tile.height;
                tilePositionX -= (tileMap[row][col].width / 2) - (tile.width / 2);

                if (!(tileMap[row][col] instanceof BuildingPortion)) {
                    c.drawImage(tileMap[row][col].texture, Math.round(tilePositionX), Math.round(tilePositionY), tileMap[row][col].width, tileMap[row][col].height);
                }
            } else {
                c.drawImage(tile, Math.round(tilePositionX), Math.round(tilePositionY), tile.width, tile.height);
            }
        }
    }
}
}

thanks

sentences:
Multiple render targets: Output target format performance questions This is probably API independent (more dependent on hardware implementation), but just in case, I'm using OpenGL.

The question is restricted to PC hardware.

I have a couple of questions concerning the output textures that are being rendered to (e.g. in gbuffer geometry pass)

Is there a (noticeable, measurable) performance penalty of using different formats for the
different output textures? e.g. RGB8 (unsigned byte) (8 bits for each component) for diffuse color, RGBA8 (unsigned byte) for specular color + roughness, RGB16F for normals?
Is it worth it to pack smaller component data into larger types just so I can have equal render targets (and fewer of them in number)? E.g. just having two RGBA16F render targets, packing diffuse + specular + roughness into the first, and normals and other stuff into the second render target using bitmasking?
Are there output texture data types/formats that I should avoid entirely?

sentences:
Does CharacterController benefit from adding lerp? Does CharacterController benefit from adding lerp?

as in this script.

mouse = Input.GetAxis("Mouse X");
current = Mathf.Lerp(current, mouse, Time.deltaTime * 10);
transform.Rotate(0, current * 600 * Time.deltaTime, 0);

I was using,

transform.Rotate(0, mouse * 18, 0);

But read into the idea of lerp and wrote that.

sentences:
Applications of calculus? I understand that basic calculus is applicable to game development, particularly physics.  Problem is, I'm not entirely sure how.  So, what can I use it for?  I'm most concerned about what's on the AP tests, as I hear I won't need much more than that;

AP Calculus - AB

I'm particularly interested in hearing examples in terms of gameplay elements.

sentences:
Are TestFlight apps the same as the finished product? This may be an obvious question, but to me it is a little unclear. I built an app using PhoneGap. While testing with PhoneGap Desktop and the associated app it was pretty obvious that this was just a testing environment. For example, any check to see if it was an iOS device would return false even though the app was up and running  on my iPhone. Also there were some strange positioning issues between what I saw in the browser vs. what I saw on the app.

So, I finished building the app and packed it and uploaded it as a beta app sent via TestFlight to my phone. I was pleased to see I was now passing the iOS checks and some positioning errors were gone. I am curious if I can conclude for sure if I fix any issues to where it looks good in the testflight app it will look good with the real published app or if testflight too uses some sort of test-web-wrapper?

tl:dr; I'm going to guess and check my positioning via the TestFlight App, if it looks good there will it look good in the wild?

sentences:
How can I fix my combo system? I'm working on my combo system and I keep getting this weird problem. It's a pretty basic setup: when the player hits the attack button it changes the character's current action to "attack", if the player hits an enemy then an int (f) is set to the next combo number, after the attack finishes the character's current action turns to "standing" and an if statement makes the combo int equal to f.

So basically it reads like this:

switch (action)
{
    case "attack":
        if (combo == 0)
        {
            if (enemy.Hit(playerSquare))
            {
                f = 1;
            }
            else
            {
                f = 0;
            }
            if (animationDone)
            {
                action = "stand";
            }
        }
        else if (combo == 1)
        {
            same
        }
        else if (combo == 2)
        {
            same
        }
        break;
}

if (action != "attack")
{
    combo = f;
}

My setup works, however, if I press the attack button too quickly it either doesn't add to the combo int (keeping it at the same number as before) or adds to it twice (depending on whether or not I slow it's update rate.) I'm sure there's probably an easy way to fix this and I'm not seeing it or maybe there's a better way to do this that I haven't considered yet, so I'm hoping you guys can help out. Any suggestions?

sentences:
Distance travelled by gameObject and behavior depend on device's performance? The distance travelled by my gameObject and behavior depend on my device's performance. If the device is slow for example, it takes longer to accomplish a specific task, thus travels at a smaller speed, smaller distance etc. and doesn't end up where it's supposed to. How can I fix this?

Here's the code:

variable1 -= variable2 * Time.deltaTime;
transform.position += new Vector3 (13, variable1 * Time.deltaTime, 0);

sentences:
How can I get width and height of grouped objects in Unity3D Is it possible to get height and width of grouped objects like this?

I tried boxcollider2d.bounds and renderer.bounds. Each shapes in the group has collider component.

Is it possible?

sentences:
C# XNA Making a TextBox Appear to input the X and Y coordinates Okay I'm trying to find a way to not have to hard code in my values for the x and y coordinates. so far I have hard coded these in when you press certain numbers on num-pad it'll move the camera to that area.

        if(Keyboard.GetState().IsKeyDown(Keys.NumPad1))
        {
            x = 100;
                y = 100;
            spritePosition = new Vector2(x,y);
        }
        if (Keyboard.GetState().IsKeyDown(Keys.NumPad2))
        {
            x = 200;
            y = 200;
            spritePosition = new Vector2(x, y);
        }
        if (Keyboard.GetState().IsKeyDown(Keys.NumPad3))
        {
            x = 300;
            y = 300;
            spritePosition = new Vector2(x, y);
        }

What I'm trying to accomplish is to make a textbox or to be able to input x and y coordinates whilst the application is running

        if (Keyboard.GetState().IsKeyDown(Keys.Enter))
        {
            x = 100;
            y = 100;
            spritePosition = new Vector2(x, y);
        }

so have something like this but allow the user to change the coordinate values whilst the application is running, when the user presses Enter, of course Console.WriteLine and Readline do not work, so I was wondering how to implement this sort of changes to make it work.

sentences:
How do I compute the point of a triangle-ray intersection? I have a line (the direction vector of the player) and a triangle representing the face of a model (so composed of 3 points).

I can't find the mathematical operation to check if that vector is intersecting with this triangle, and how far from the player...

sentences:
Pattern for modular ScriptableObject-Database? Lets say we want to store game data inside of scriptableObjects and we have plenty of them... So we need to find a way to store them efficiently in a modular way.

What pattern could we use to code a scriptableObject database for providing a substainable base for our game data- scriptableObjects?

And are there any patterns or structures for extending our game data - scriptableObjects in order to construct them modular and flexible aswell ?

sentences:
How to dispose in Newest Java/LibGDX ApplicationListener? What I'm wondering:

How do you dispose of textures / spritebatches and the things you normally need to dispose of now?

Why I'm asking:

Because theirs no automatic dispose() function upon creation of the Main libGDX class. I don't remember details but there used to of been an @override dispose

I don't want a memory leak or whatever it's called when you don't dispose.

sentences:
Enemy collision detection with movie clips I have created multiple movieclips with animations within them.  It is an obstacle avoidance game and I cannot seem to be able to get my enemies to contact my playableCharacter. The enemies I have created are each embedded on certain levels of my game. I have created an array, enemiesArray to have each of my enemies placed within it. Here is the code for that:

//step 1: make sure array exists
if(enemiesArray!=null && enemiesArray.length!=0)
{
    //step 2: check all enemies against villain
    for(var i:int = 0;i < enemiesArray.length; i++)
    {
        //step 3: check for collision
        if(villain.hitTestObject(enemiesArray[i]))
        {
            //step 4: do stuff
            trace("HIT!");
            removeChild(enemiesArray[i]);
            enemiesArray.splice(i,1);

            removeChild(villain);
            villain = null;
        }
    }
}

What I am unsure of is whether or not my enemiesArray is actually holding the movieclips I have suggested. If it was, this code would be tracing back a "HIT" for every time I ran into an enemy and would kill my character. It is not doing that however.

I am thinking I have to push my movieclips into my array but I don't know how to do that or where for that matter.

Any and all help would be much appreciated.

sentences:
How to create high quality and fast portal effect? EDIT:
So I've gotten the portal visual effect working with no performance hit, and I've got the physics set up of objects with rigidbodies moving through portals seamlessly, and objects with character controllers moving through it seamlessly. The only thing I'm trying to figure out now is blending two camera views to get the proper first person transition effect. Any ideas on how I'd blend those two? I'm thinking something using a depth only shader, or the normalized viewport rect. My main problem is calculating that in real time, and with angles.

So I've been working on creating a portal effect in Unity3D. Obviously I've taken Valve's Portal as a great influence to programming this. Currently I'm simply using a camera's rendertexture to get the graphical effect across, and then some code to do the rest. The problem is at 2048x2048 it looks as high quality as Portal's, but causes heavy FPS loss. To solve this I'd either have to lower the texture quality or the number of times I update the texture.

Valve has accomplished a high quality portal effect without causing high frame rate loss. How can I do the same? Does anybody have any good ideas for rendering to a high resolution texture without causing frame loss?

I'm considering making my own code for rendering to textures rather then using Unity's built in system, it's doable but would definitely be a hassle. So any thoughts, ideas, or suggestions are highly appreciated.

sentences:
DX11 How to guarantee rendering order using Deferred Context? What techniques are used to guarantee rendering order (back to front) when you have more than one deferred context?

My original idea was to manually remap the Command Lists, but it seems like this is not possible.

Do games just render all Alpha objects using the immediate context (to guarantee order)?

Thanks!

sentences:
How to build repetition into a game that won't ruin the experience I am building an Educational technology (Edtech) game that attempts to follow the format of an adventure RPG while teaching foreign languages.

Obviously, EdTech games must actually teach, which requires repetition for mastery. Especially foreign languages which requires a lot of practice to master. But, the game's goal is for the story line and game world to be immersive to the point the player is hooked in. Repetition often destroys the immersive aspect and linearity of a story.

What are some strategies to ensure the necessary repetition is happening such that a student retains the information, but also has fun playing along with the story? Are there any?

sentences:
Correct method for choosing the user's video cards? My game uses DirectX 10, and I'm having a problem where users are reporting that my game isn't picking up on their graphics card. Instead it prefers to run on their integrated Intel card, ruining performance. It's possible that this is related to Windows 8. It could also be related to mobile cards.

Until now, I've been creating the DirectX 10 device with no adapter specified (as I've seen in all the examples/demos so far), to allow DirectX to choose its own adapter. Apparently I'm going to have to change that.

I already have a function which runs through all of the available adapters, and chooses the one with the highest amount of dedicated memory. That works great for correcting the problem, but is it correct in general?

Unfortunately, I cannot rely on the card having valid video output (i.e: a monitor hooked up) as the machines affected by this problem report no outputs for the desired card.

What algorithm can I use to properly choose which adapter to use with DirectX?

sentences:
Maze algorithm with field counter I am new to algorithms but currently creating a little game with the need for some.

I have a 2d grid/board with a start and a finish field. Between those two fields are several platforms which can be entered. Each platform has a counter on it. When going on a platform the counter is decreased by one. If the counter reaches zero the platform is gone. The goal is to go to the finish field AND destroy every platform field. A little exmaple:

0 1 0
1 2 1
1 0 F
S 0 0

S being the Start field and F being the finish field the right path would be going UP, UP, RIGHT, UP, DOWN, RIGHT, DOWN.

All I could find so far were algorithms getting paths for mazes without counter. Do you have any tips for a algorithm that can decide, if the current maze if solvable or not and maybe even get the correct path?

Thanks in advance!

sentences:
What's wrong with my animation trigger script? So I am making an RPG and I am setting up the player. I am trying to trigger an attack animation by pressing a button. I wrote this down and I get an error that says "Expressions in statements must only be executed for their side-effects". I don't know what that means, but it is an error that won't let me play the game without fixing it. I'm not sure where to go from here. How would I fix the error? EDIT: I'm not using Mecanim, nor am I planning on using it.

This is the script. It is in JavaScript (Unity3D).

#pragma strict

var anim: AnimationClip;

function Start()
{
    animation["Sword Slash"].layer = 4;
    animation["Sword Slash"].wrapMode.Once;
}

function Update ()
{

    if (Input.GetKeyDown ("c"))
    {
        animation.Play("Sword Slash");
    }
}

sentences:
The farther I move my character, the more its projectiles fire in the wrong direction I'm making a top down shooter, and the movement is working fine.
However, I'm having trouble getting my Fire function to work correctly. When I run the game, it kind of fires in the right direction, but the more I move, the more off the shooting becomes. Anyone have any idea why?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    private float _horizontalInput = 0;
    private float _verticalInput = 0;

    public int movementSpeed = 2;
    public int rotationSpeed = 2;

    Rigidbody2D rb2d;

    float coolDown = 0;

    public Rigidbody2D bulletPrefab;
    public float attackSpeed = 0.5f;
    public float bulletSpeed = 500;
    public float yValue = 1f; // Used to make it look like it's shot from the gun itself (offset)
    public float xValue = 1f; // Same as above

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void FixedUpdate()
    {

        MovePlayer();
        RotatePlayer();
    }

    void Update()
    {
        GetPlayerInput();

        // Determines if the player can fire
        if (Time.time >= coolDown)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                Fire();
            }
        }
    }

    private void GetPlayerInput()
    {
        _horizontalInput = Input.GetAxisRaw("Horizontal");
        _verticalInput = Input.GetAxisRaw("Vertical");

    }

    public void MovePlayer()
    {
        rb2d.velocity = transform.right * Mathf.Clamp01(_verticalInput) * movementSpeed;
    }

    private void RotatePlayer()
    {
        float rotation = -_horizontalInput * rotationSpeed;
        transform.Rotate(Vector3.forward * rotation);
    }

    private void Fire()
    {
        Rigidbody2D bPrefab = Instantiate(bulletPrefab, new Vector3(transform.position.x + xValue, transform.position.y + yValue, transform.position.z), transform.rotation) as Rigidbody2D;

        bPrefab.GetComponent<Rigidbody2D>().AddForce(transform.position * bulletSpeed);
        coolDown = Time.time + attackSpeed;
    }
}

sentences:
How to allow other games to communicate with my Lua scripts? I am planning some small games that will all rely on a single system of Lua scripts to manage some unified data about:

Some achievements that are common to each game.
The player's progress in completing the achievements.

Players would need to have these three parts on their system to play:

This small set of three unifying Lua scripts.
A single data file containing a list of challenges and the status of the player's progress in completing each.
At least one of the small games.

The three Lua scripts manage the player's progress data file:

One script tells the game which challenge the player needs to complete next.
Another script updates the data file with information about the player's progress.
A final script calculates statistical information about the player's progress. A game can check use this script and decide which of this information it will show to the players.

So far, I am having the games execute the Lua scripts and using stdout to communicate information between the games and Lua scripts placed in a bin directory, which seems to work well on Linux, but I need a solution that works equally on Windows, OS X, and mobile devices and that will not be a challenge for players to install. Is this a more preferred method?

Other developers using different programming languages should be able to easily connect their games to this system.
Everything is stored locally, nothing uses the Internet.

sentences:
How to draw a rectangle with a border pixel over a camera/viewport? With this code I intended to visually delimit the complete view of the circuit and the two controlled cars:

draw_rectangle(0,0,1279,719,true);
draw_rectangle(0,720,639,1079,true);
draw_rectangle(640,720,1279,1079,true);

It turns out that only the complete view of the circuit that is drawn directly in the room is correctly delimited (observe the black line of a thick pixel):

Where there should be the rectangle strokes (red line, not necessarily at this thickness):

This happens because of this camera/viewport:

I believe the rectangle is being drawn under the camera/viewport.

What do I need to do to make this rectangle draw over the camera/viewport?

sentences:
Sprite sizing in Unity I have a visual design created in Photoshop which is 1440 pixels wide and 3118 pixels heigh. I need to import the assets in Unity and achieve the same layout that's done in Photoshop. I tried playing with the Pixels per Unit setting for the sprites but didn't have any success getting the same sizing I see in Photoshop.
What I'm trying to do is, get the same horizontal layout in Unity and calculate the vertical layout manually and scale the sprites based on mobile device screen resolution.
What's the calculation method to achieve this?

UPDATE:This is what I've done so far:

Design resolution is: 1440x3118

Camera ortographic size = 8

This makes 1 unit = 390 pixels

A 100 pixel heigh sprite in Photoshop has 0.25 units in Unity

Pixel per unit should be 195 in Unity to achieve the same sizes in Unity (390 / 2 taking camera ortographic size into consideration)

Is this calculation correct? The output seems somewhat ok to me but I haven't tried this on various devices.

sentences:
WebGL frame rate slows down after triggering javascript event I am using Unity WebGL to host my game on a flask server and trying to throw a warning to the user whenever he tries to navigate away from the tab or mistakenly click browser's back button. Each time after the event is triggered (whenever I try to navigate away) the game slows down with a huge drop in frame rate (navigation has to be performed after the game has been loaded properly by showing the unity logo and other stuffs). Here is the script that I am using to trigger the event:

<script>
    window.addEventListener("beforeunload", function (e)
        {
            var confirmationMessage = "\o/";

            e.returnValue = confirmationMessage;
            return confirmationMessage;
        });
 </script>

What is the work-around of this problem and why the game slows down completely?

sentences:
Is there an IDE that can simplify the process of creating a game matchmaking website? Yes, I'm an old guy. And I'm well versed in "C" and have written several games which I have been selling on the web for a number of years. And now, I would like to adapt one of my games to be "online". Sounds simple. I'm sure I can use the thousands of lines of "C" code that I've already written. Right?

So my initial investigation begins. First, I think I'll need a server program that lives on a dedicated server (or a VPS probably) that talks to a bunch of client applications that live on individual devices around the world. I can certainly handle that! (I think to myself). I'll break up my existing game into two pieces, a client piece that is just the game displays and buttons, and a server piece that does everything else. Piece of cake, right?

But that means that the "server piece" must be executed on a remote machine somewhere and run 24/7. Can I do that? [apparently, that question is so basic, so uneducated, and so lame, that nobody has ever posed it before. Because hours of Googling does not yield an answer. Fine. I'll assume I can do that and move on.]

I'll need a "game room", which to me means a website where you log in and then go to a lobby of some kind where you can setup your preferences, see if any of your friends are connected, and create or join games. Should be easy, but it's not. No way. Can I do all this with my local website builder? (which happens to be 90 Second Website Builder, a nice product, btw). It turns out, I can not. I can start with that, but must modify each page, so I can interact with my sql database. So I begin making each page a "PHP" page and dynamically modifying the HTML code with PHP code.

I'm already starting to get a headache.

Because the resulting web pages looked terrible, I began looking at using JQuery. I want to user a JQuery dialog on my website to display a list of friends and allow the user to select one to invite to the game. [google search for "how to populate a JQuery dialog from a sql database" yields nothing but more confusion.]

Javascript? Java? HTML? XML? HTML5? PHP? JQuery? Flash? Sockets? Forms? CSS? Learning about each one of these, and how they interact with each other and/or depend on each other is too much for my feeble old brain.

Can anyone simplify this process for me? Is there an IDE that will help me do all this without having to go back to college for a few years?

Thanks,
Scott

sentences: What language do you program in Lumberyard? I've looked through the FAQ on amazons site and all they mention is C++/Lua for the web service stuff. Can i assume it's C++ for the game content itself or something else (the visual script editor doesn't count)?

sentences:
What happened to sprite::setSize in SFML2? I'm porting one of my old projects to sfml 2.0, and I had a background that I scaled using

sprite.setSize(windowWidth, windowHeight)

Now, it seems like setSize has ben removed in 2.0, and I'm wondering what the intended replacement is.

I know there is a setScale function, and that I could do something like:

auto size = sprite.getTexture()->getSize();
sprite.setScale(float(windowWidth)/size.x, float(windowHeight)/size.y);

but I think this is really ugly and clunky, is there another way to do it?

sentences:
Is the STL efficient enough for mobile devices? When it comes to mobile game development on iOS and Android NDK, some developers write their own C++ containers, while others claim that STL is more than adequate for mobile game development (For example, the author of iPhone 3D Programming uses STL rather than Objective-C in his examples. His defense is that STL is no slower than Objective-C).

Then there are also mobile developers who abandon C++ entirely and develop games entirely (or mostly) in the C language (C89/C90).

What are the benefits and drawbacks of each approach?

sentences:
How does one go about building Alien Swarm? Valve just released Alien Swarm on steam, along with all the source code. I would love to build a version of it on my own machine and play a little bit with the code.

Has anyone here tried to build it yet? Is it easy enough to just build and run it?

Thanks.

sentences:
OpenGL ES 2.0. Sprite Sheet Animation I've found a bunch of tutorials on how to make this work on Open GL 1 & 1.1 but I can't find it for 2.0.

I would work it out by loading the texture and use a matrix on the vertex shader to move through the sprite sheet.

I'm looking for the most efficient way to do it. I've read that when you do the thing I'm proposing you are constantly changing the VBO's and that that is not good.

Edit:
Been doing some research myself. Came upon this two Updating Texture and referring to the one before PBO's. I can't use PBO's since i'm using ES version of OpenGL so I suppose the best way is to make FBO's but, what I still don't get, is if I should create a Sprite atlas/batch and make a FBO/loadtexture for each frame of if I should load every frame into the buffer and change just de texture directions.

sentences:
Rendering Textured Terrain With SharpDX Toolkit So i recently moved from XNA to SharpDX Toolkit and started with some basics. The 2d part was easy since nearly nothing has changed but im really struggeling with the 3d part. For example i wanted to render a heightmap based on riemers terrain tutorial however came along the following issue:

I have a little map (or terrain) class that contains the index and vertex arrays as buffer like so:

private SharpDX.Toolkit.Graphics.Buffer<VertexPositionNormalTexture> _mesh;
private SharpDX.Toolkit.Graphics.Buffer _indexBuffer;
private readonly static VertexInputLayout InputLayout = VertexInputLayout.New<VertexPositionNormalTexture>(0); // copied from the basic geometry

this get filled in propertly and render fine with VertexPositionColor.
rendered the common XNA way:

//set effect parameters and resources
foreach (EffectPass pass in _effect.CurrentTechnique.Passes) {
    pass.Apply();

    //Globals.DefaultGraphicsDevice.SetRasterizerState(CullNone);

    Globals.DefaultGraphicsDevice.SetVertexBuffer(0, _mesh);

    // Setup the Vertex Buffer Input layout
    Globals.DefaultGraphicsDevice.SetVertexInputLayout(InputLayout);

    // Setup the index Buffer
    Globals.DefaultGraphicsDevice.SetIndexBuffer(_indexBuffer, true);

    // Finally Draw this mesh
    Globals.DefaultGraphicsDevice.DrawIndexed(PrimitiveType.TriangleList, _indexBuffer.ElementCount);
}

Now with my own half converted half remade shader i get

a) a black terrain or

b) HRESULT: [0x80070057] (wrong parameter)

and i cant figure out why (most likely since i never done much with 3d shaders)

the shader:

struct VertexShaderInput {
    float4 Position     : SV_Position;
    float3 Normal       : NORMAL;
    float2 TextureCoords: TEXCOORD0;
};

struct VertexShaderOutput {
    float4 Position     : SV_Position;
    //float4 VPosition      : SV_Position; //im not used to SV_Position and SV_Target so this could be the main problem
    float LightingFactor: TEXCOORD0;
    float2 TextureCoords: TEXCOORD1;
};

struct PixelShaderOutput {
    float4 Color        : SV_Target;
};

//------- Constants --------
float4x4 xView;
float4x4 xProjection;
float4x4 xWorld;
float3 xLightDirection;
float xAmbient;

Texture2D xTexture;
sampler TextureSampler = sampler_state {
    texture = <xTexture>;
    magfilter = LINEAR;
    minfilter = LINEAR;
    mipfilter = LINEAR;
    AddressU = mirror;
    AddressV = mirror;
};

VertexShaderOutput TexturedVS(VertexShaderInput VSin) {
    VertexShaderOutput Output = (VertexShaderOutput)0;
    float4x4 preViewProjection = mul(xView, xProjection);
    float4x4 preWorldViewProjection = mul(xWorld, preViewProjection);

    Output.Position = mul(VSin.Position, preWorldViewProjection);
    Output.TextureCoords = VSin.TextureCoords;

    float3 Normal = normalize(mul(normalize(VSin.Normal), xWorld));
    Output.LightingFactor = dot(Normal, -xLightDirection);

    return Output;
}

PixelShaderOutput TexturedPS(VertexShaderOutput PSIn) {
    PixelShaderOutput Output = (PixelShaderOutput)0;

    Output.Color = xTexture.Sample(TextureSampler, PSIn.TextureCoords);
    Output.Color.rgb *= saturate(PSIn.LightingFactor) + xAmbient;

    return Output;
}

technique Textured {
    pass p0 {
        Profile = 9.1;
        AlphaBlendEnable = false;
        CullMode = None;
        PixelShader = TexturedPS;
        VertexShader = TexturedVS;
    }
}

im thankfull for any help

(Disclaimer: i moved this from stackoverflow to here since i think it was missplaced and didn't got any attention)

sentences:
Tile map collision C++, SFML My problem with the collision here is more to do with how to decide which tile the player is in. Each quad of the map is 16 pixels squared (Vertex array), and the player moves in 1 pixel jumps. Because of this I cannot think of a way to decide which quad the player is in.

I am not sure if I am just missing something, but does anyone have an idea of how to do this?

sentences: Where to purchase multitrack music loops? I've seen other questions about where to find royalty-free music available for purchase. But most of these tend to provide a single audio file with every instrument track already blended and mixed together. I'm more interested in the dynamic music route, and would want to download a bundle of audio files (one for bass, one for kick, etc) and in my game I can just bring them in and out based off of what's going on. When things are quiet just have the bass line repeating and when things get chaotic the full piece is going. Obviously each track would need to be on the same beat and designed to work well with each other part. Is there any place that such multitrack loops could purchased? Thanks.

sentences:
How can I change the parents rotation so the childs rotation is looking at a specific direction I have a child object which is always having different positions and rotations (thats my VR Headsets Eye-Gameobject)
I cannot modify the position and rotation of that.

I want to set my view to a certain "startposition" and "startrotation" so the player always has the same view at the start of the game.

The childs local position is always set to some values.
So I cannot unparent it.
If I unparent it, I change his position.

now..

It works with the position.

Parent.transform.position =  2 * ParentStartPostion - Eye.localPosition;

^
This line of code here sets my parent object so that my Gameobject: "eye-camera" is where i want it to be.

For the rotation part, i would do following:

Eye.parent = null; //unparent the eye to the world
Parent.transform.position = Eye.position; //set my Parent to the same position as Eye
Eye.parent = transform; //parent it back. Local Eye should be 0.0.0 now.
Parent.transform.rotation = Quaternion.LookRotation(StartForward, StartUp); // i can rotate the at the direction I want it.

But after I unparent my Eye the position of the local(which is also global) is set to a different value.
And after I parent it back, its set to the old value again.

Eye.parent = null; //unparent my eye to the world - Eye moves anyway because its movend by SteamVR
Parent.transform.position = Eye.position; //set my Parent to the same position as Eye (works)
Eye.parent = transform; //parent it back. Local Eye moves back where it was and there is a distance between parent and eye again.
Parent.transform.rotation = Quaternion.LookRotation(StartForward, StartUp); // the rotation changing my eyes position because its parented. Also the rotation is wrong.

And now i dont know anymore how to solve this problem.

so... i painted my problem in paint for better understanding:

sentences:
Creating Smooth Corners when Converting 2D Polylines to 3D Models Part of my game takes SVG polylines (which are just basically a set of x,y coordinates that define a multi-segment line) and converts them into 3D 'paths' (ie. a line created as a set of faces all pointing 'up').

I was wondering if there was a standard algorithm I should consider for how to smooth the corners of the lines when there is a change of direction. I don't want to turn the whole path into a smooth curve - I just want to smooth out the corners where the line turns sharply.

What I'd love is an algorithm that - given two vectors (V1 & V2) and a line thickness (T) - returns the best two 2d coordinates to use as the corner vertices so that the I don't have to add any additional polygons to the line, and that both of the incoming lines keep their thickness.

Is this wishful thinking, or is there something like this out there?

Thanks.

sentences:
Prevent Reavers from dealing splash damage to friendly and allied units Just for fun I made some games in the Starcraft Broodwar map editor (scdraft2.0).

I notice that in my map Reavers deal damage to friendly and allied units as well as to neutral units. It's a cat and mouse map so when friendly units kill your teammates it's not fun.

Is there any way to prevent this?

sentences:
What is a systematic process for choosing a mobile game engine? I am looking for a systematic process or methodology for choosing a mobile game engine for a mobile game project.

Intuition tells me that it should be similar in principle to choosing any off-the-shelf product (requirements, evaluation, short-list, trial, etc).

Any suggested processes?

sentences:
What's the best way to track game phases? I'm currently writing an IRC bot in Ruby to play some kind of strategy game (it doesn't matter which), but I'm hesitating between several solutions to implement a phases system the "best" way.

The system: The game has several days; the first day some phases occur to give the players their jobs and so on, but they never occur again, so phases are sometimes conditional.

What's more, when a certain condition is met, e.g. an important player dies, a phase may be started before the next one. Phases may be added by the job system; jobs are each defined in a single file and they can define their own phases and logic.

My ideas:

The game is handled by a class in which I can store an instance variable to remember the actual phase and handle all of the logic in the code. I don't think this is the best idea.
Use a phases hash to store the next phase and other parameters and methods to handle each change.

Is there a better way? I don't think those I came up with are very flexible.

sentences:
What is the shortcut to rename stuff in Unity on Linux? I am using Unity on Ubuntu 16.04 and I can't rename objects or assets using the F2 key as I could when I was using Windows.

What is the shortcut on Linux then?

sentences:
How do I run an iPhone GameSalad App on an iOS Device? I have made a simple game application with GameSalad . It runs fine in the iPhone simulator after loading the GameSalad Viewer but doesn't work in the device as it gives a code signing error. If I change the IPA according to the device then the GameSalad Viewer crashes and the app does not run.

Does anyone have a solution for this?

sentences:
Networking in Flash games. Socket or Stratus? Working on a prototype for a Flash game that will use networking communication. It would be better to use Peer 2 Peer connection, since it will be a multiplayer game.

Has anyone used Stratus or tried to make a multiplayer game via the built in socket?

The game will be a turn based game, similar speed to poker but if I could get faster turns that would be great.

sentences:
LibGDX - Level management on a level-based game I'm new to LibGDX and android development in general and am trying to do a puzzle game. Being a level-based game, i'm trying to make it so in every level a certain number of blocks (just rectangular sprites) appear in a certain position / rotation, like in the image linked below:

https://i.gyazo.com/52e6c71e1f05ab4529e0fec9d4f80bd7.png

I've doodled some levels already but i'm really not sure about how to make the blocks's rearrangement over the levels.
How exactly should one manage this? As the position of the blocks won't be random i was thinking about reading from files the information from every level (x, y, rotation, colors, etc. for every block) but to do that i would have to manually organize every level's blocks properties information (to then save), and, considering it would have atleast 100+ levels, it would take too long... Other than that, i could have them as plain assets but having an asset for every single level doesnt't look like an efficient solution either. Do you have any tips, please?

sentences:
How do I make a 2D World Political map in unreal engine 4? Can someone explain the basics of making a 2D World map in unreal engine 4 (e.g. similar to the ones used in Plague inc., age of civilizations, etc.)

I've seen it being done in unity, but couldn't find any similar content in unreal engine 4...

Thank you.

sentences:
Call a BlueprintImplementableEvent from c++ in unreal editor? I created a custom actor:

BPTest.h:

#include "GameFramework/Actor.h"
#include "BPTest.generated.h"

UCLASS(Blueprintable, BlueprintType)
class ABPTest : public AActor
{
    GENERATED_BODY()

public:
    ABPTest();

    virtual void BeginPlay() override;

    UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Custom event"))
    void CustomEvent(float Value);
    void CustomEvent_Implementation(float Value);
};

BPTest.cpp:

#include "ProBuilderPrivatePCH.h"
#include "BPTest.h"

ABPTest::ABPTest()
{
    PrimaryActorTick.bCanEverTick = true;
}

void ABPTest::BeginPlay()
{
    Super::BeginPlay();
    CustomEvent(0.f);
}

void ABPTest::CustomEvent_Implementation(float Value)
{
    UE_LOG(LogTemp, Warning, TEXT("CustomEvent_Implementation: %f"), Value);
}

I then created a blueprint from this actor class.

I added an instance of this blueprint actor in my level.

I would like to call this custom event from c++ in the editor, not when the game is started.

I tried this in a custom editor mode (extending FEdMode):

bool FProBuilderEdMode::InputKey(FEditorViewportClient *ViewportClient, FViewport *Viewport, FKey Key, EInputEvent Event)
{
    for (TActorIterator<ABPTest> ActorIterator(GWorld); ActorIterator; ++ActorIterator)
    {
        ActorIterator->CustomEvent(1.f);
    }
    return FEdMode::InputKey(ViewportClient, Viewport, Key, Event);
}

but it does not work. I assume the game has to be started (hit play) in order for the blueprint event to be taken into account. Is my assumption correct?

How can I call a blueprint function from c++ when the game is not started (Is it even possible)?
I have seen UObject::CallFunctionByNameWithArguments but it seems dirty.

sentences:
JavaFX import 3D models I want to import some 3d models to my javaFX application.

In javaFX I can create rectangles, traingles, circles, pentagons.
Those figures can be filled with color or filled with image.
They are called nodes. Nodes can be added to group and be visible ( nodes also can be rotated, scaled and translated ).

I want to import 3d model and it to be as a node, so I could add model to a group and rotate, scale and translate.

How can I achieve this?

sentences:
Can open source games be published on Steam? Many free and open source software licenses have conditions in them that ban bundling it with proprietary modules, although, in case of the GPL at least, there are some exceptions for drivers and necessary libraries.

Can open source games be published on Steam without violating the licenses?

I know there are some free software available on Steam, such as Blender (using the GNU General Public License), the Godot engine (using the MIT license), and SuperTuxKart (which is currently in Steam Greenlight).

What permissive license is best for publishing on Steam?

sentences:
Pong AI - Raycasting I've been focusing on other games recently but it annoyed me that I skipped the AI part of making my pong game a 1 player game too. I have found out how to RayCast but am struggling with being able to make a path to predict where the ball will end up on the computer side. I have managed to get the first ray to work but in the second if-statement from the code below, it's somehow a loop. If anyone is able to help me, I would be extremely grateful!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RaycastTest : MonoBehaviour {

private Rigidbody2D rb2d;
private RaycastHit2D hit;
private Vector2 predictedCollision;
private Vector2 collisionPoint;
private int numberOfCollisions;

void Start () {
    rb2d = GetComponent<Rigidbody2D> ();
    numberOfCollisions = 0;
}

void FixedUpdate () {
    //Directions of the ball (normalized)
    Vector3 forward3 = new Vector3 (rb2d.velocity.normalized.x, rb2d.velocity.normalized.y, 0) * 20;
    Vector2 forward2 = new Vector2 (rb2d.velocity.normalized.x, rb2d.velocity.normalized.y);

    // If the ball has just hit the player paddle
    if (BallMovement.isOnPath == true) {
        if (numberOfCollisions == 0) {
            //make sure we have the correct initial collision point from another script
            collisionPoint = BallMovement.collisionPoint;

            //draw and cast a ray to detect the next point of collision
            Debug.DrawRay (collisionPoint, forward3, Color.red, 20f);
            hit = Physics2D.Raycast (collisionPoint, forward2, Mathf.Infinity);
            //print the name of the object that has been hit
            print (hit.collider.name);

            //change the initial collision point to the new one
            collisionPoint = new Vector2 (hit.point.x, hit.point.y);
            print (collisionPoint);

            //add on to the number of collisions
            numberOfCollisions += 1;
            print (numberOfCollisions);
        }

        //if we still haven't reached the HitArea we need to do another bounce
        if (hit.collider.name != "HitArea") {

            //make sure we get the velocity after impact and reverse the direction of the y velocity.
            forward2 = new Vector2(rb2d.velocity.normalized.x, rb2d.velocity.normalized.y * -1f);
            forward3 = new Vector3 (rb2d.velocity.normalized.x, rb2d.velocity.normalized.y * -1f, 0) * 20;

            //draw and cast a ray to detect the next point of collision
            hit = Physics2D.Raycast(collisionPoint, forward2, Mathf.Infinity);
            Debug.DrawRay(collisionPoint, forward3, Color.red, 20f);

            //change the initial collision point to the new one
            collisionPoint = hit.point;
            print (collisionPoint);

            //add on to the number of collisions
            numberOfCollisions += 1;
        }

        //If we've hit the HitArea, we reset everything so it stops looping and we've got our predicted point of collision on the computer side.
        if (hit.collider.name == "HitArea") {
            predictedCollision = hit.point;
            numberOfCollisions = 0;
            BallMovement.isOnPath = false;
        }
    }
}

}

sentences: How can I run my XNA demo straight from a CD? I was told by a company that better than putting an installer on a CD would be allowing the user to run the demo directly from the CD. Is this even possible when the demo might require things such as the XNA framework to run? Are they actually wrong and an installer is in fact necessary for the dependencies?

sentences:
Libgdx fix small objects on android devices I'm having issues with optimizing my game for android.
I've basically created a simple menu with two buttons (see pictures below)!
The size of the window is 720x480px ( in the Desktop Launcher ). My Problem is now the following: On my PC everything looks fine, but when launching my game on an android device, everything is "zoomed out" too much! This is obviously caused by the resolution (1440 x 2560 pixels). My question is now: How do I "scale" the screen correctly, so that it look identical with the desktop version?

Desktop

Android

CODE: http://pastebin.com/HtMfd4Jz

sentences:
How to flip 2d skinned quadruped character? just would like to know is flipping 2d skinned character with one of scale axis good way for left or right movement(flipping direction and animation)?
Normal direction would change.(UPDATED)
for example i have a 2d skinned dog, and i wanna dog move left when i press left with same animation as right direction.
or is there any better way?
Thanks.

sentences:
Displaying pixels on a canvas at 60 hertz I'm (new to SO and) attempting to code an "emulator" for an 8-bit CPU I am making with a friend.
I have only ever used Java to make simple GUIs with Swing, and from reading similar questions it seems to me that using repaint() and Graphics2D to display 60fps is not the way to go.

From my attempts at using a custom JComponent to draw, I couldn't agree more. Despite calling screenComponent.repaint() 60 times per second, Java was only updating the screen around 2 times per second, whereas the video memory byte array (stores pixel data) that was also updated 60 times per second (before calling repaint) did change every frame.

So my question is: what can I use to display my one-dimension pixel array (using y * width + x to get pixels at a coordinate) and update it at 60fps?

What I need to be able to do:

draw each individual pixel with a set color
-draw text with a font and size (the computer I am emulating has a toggle able text-only graphics mode)
efficiency is not a huge concern since the main purpose of this is to test assembly programs that will later run on the physical CPU, but it needs to update the screen at 60 Hertz and run CPU clock cycles at least at 1 kilohertz
scale up the canvas as the cpu only displays at 78 by 128 pixels (I did this in swing by using g2d.fillRect to display pixels and multiplying the arguments by a screen size multiplier integer)
not 3D

sentences:
How to Steer a Moving Object Away From Another Object(s) I'm working with C# in Unity, and I'm making a top-down space shooter game in which there are many different AI-controlled ships flying around. The problem is that these ships often fly on top of one another in passing, and sometimes even will fly the same route on top of one another if given the same waypoint. I want to add a system to steer my AI ships away from each other as well as other obstacles so that instead of overlapping one another when flying the same path they will fly side-by-side, and will also try to avoid things that pass in front of them.

My current system essentially works like this: The AI looks at all of the current objectives, points of interests, etc, and decides where it wants to be on the map (a coordinate). The AI then sends an input direction to the ship, which then applies acceleration in that direction and changes the velocity. Therefore, any solution to alter my ship's pathing would need to alter this input direction somehow.

So my first idea was to check if there are any obstacles (ships, asteroids, structures, etc) within a radius of the ship, increasing this radius based on the ship's velocity (higher velocity = larger "view" radius):

Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, ship.velocity.magnitude);

If there is something nearby, calculate the direction to that collision, then calculate the opposite direction and scale it to the reciprocal, which also has the added effect of making the aversion stronger the shorter the distance to the collision is:

foreach (Collider2D hit in hits)
{

    if (hit.gameObject == gameObject) continue; // exclude self from the search

    Vector2 v = hit.ClosestPoint(transform.position) - (Vector2)transform.position;
    v = (1 / v.magnitude) * -v.normalized;

I would perform this for every nearby obstacle and add all of these together to get the avoidance vector:

    avoidanceVector += v;
    continue;
}

Then I add the total avoidance vector to the AI's input direction and normalize the result:

inputDirection += avoidanceVector;
inputDirection.Normalize();

However, when i add this avoidance vector to my input direction, my ships exhibit a strange behavior where sometimes they will simply stop moving completely. commenting out the line where i add them together stops this behavior.

I'm really not sure what could be going wrong here, but I think it has to do with my approach altogether. Can anyone help me figure out a clean, simple way to make my ships steer away from other objects?

sentences:
Unreal 4 why does reducing scalability take so long to compile? I have almost nothing in my scene--in fact, I reduced my scalability settings from "High" to "Medium" before even loading my level layout--and doing this has crashed the program multiple times. It didn't crash this time, but it is telling me it is compiling over 5000 shaders (!) and my objects' materials are not showing up in the viewport.

1) that is a ton of shaders, what shaders are these? I only made like 8 shaders.

2) What is making this take so long? it is taking forever, over 10 minutes already.

3) Is this normal?

sentences:
How can I use remote playtesters? I'm working on a website for asynchronous two-player games (mostly board games); as part of the site's development I'm hoping to use it to playtest new games I design. The good news is that this offers a much larger pool of playtesters; the bad news is that they'll be remote, so I have no easy way of gauging reactions or of directly watching them play. Obviously I can get a lot of useful information just by extracting metric data (e.g. How many moves games take, who wins more often, average margins of victory, etc.), but I'm wondering how much I can go beyond this too:

What data particularly should I be looking to extract from completed (or even in-progress) games?
What are effective means of collecting information from the participants themselves rather than just the games?  In particular, will surveying players (e.g. with email or web forms) do me any good?
What sort of essential information should I only expect to be able to garner from ‘local’ playtests?

sentences:
How to convert linear lerp to non-linear using animation curve? I have some code I run when I fell a tree in my game. Basically it picks a random direction and then falls. However atm it linear and doesnt look very realistic. What Id want is for it to start slow, then speed up the more it's fallen.

I've been experimenting with animation curves but none of the material I can find works with my code:

public void FellTree()
{
    // pick a random point on the circle to match the up vector
    Vector2 pointOnCircle = UnityEngine.Random.insideUnitCircle * transform.localScale.y;

    // find the fall point, assuming the pivot of the object is at the bottom
    Vector3 fallPoint = transform.position +
        pointOnCircle.x * transform.right +
        pointOnCircle.y * transform.forward;

    // find the target up vector
    Vector3 updatedUpVector = Vector3.Normalize(fallPoint - transform.position);

    // Start the coroutine to tilt the up vector to the desired target
    StartCoroutine(UpdateUpVector(updatedUpVector, 1, 0.001f));
}

IEnumerator UpdateUpVector(Vector3 upVector, float speed, float threshold = 0.001f)
{
    // the target vector and up vector would get closer to each other until the threshold is hit
    while (Vector3.Distance(upVector, transform.up) > threshold)
    {
        transform.up = Vector3.Lerp(transform.up, upVector, speed * Time.deltaTime);
        yield return new WaitForEndOfFrame();
    }
}

Using animationCurve.Evaluate(float t) in the lerp should be what I need to do, but not working. How can I add an animation curve to my lerp?

sentences:
Can I detect collision on specific collider? I'm a beginner with Unity and I'm developing my very first 2D game. My game character needs to have an automatic right/left movement but I'm struggling with the colliders on the walls (I made a tilemap object and set a collision for each wall on it). I need my character to detect the collision on the Right wall and turn to the left but I just can't find a way to name (I don't even know if you can do this) and detect a specific collider/collision so I can make an if statement on the player script.

How can I detect a specific collision/collider and refer this on my player script?

Here is the code I'm using for it (it isn't working):

void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.collider.gameObject.name == "Right Facing Wall")
    {
        runForwards = false;
    }
    else if (collision.collider.gameObject.name == "Left Facing Wall")
    {
        runForwards = true;
    }
}

sentences:
Expiring timed actions a good idea? We have an online game where players sometimes have to wait a while (say 30 minutes) before a process they intiated completes. This encourages them to come back later. An example of this is growing crops in Farmville or basically any action in the Sims Play4Free.

Now, however, there is the idea to let these processes expire, so if the player doesn't 'reap' them in time (e.g. within 4 hours) they are aborted. I'm a bit sceptical about this. How will this make players come back more often? Is not the reward of reaping the process enough for that? Can we expect players to fit their daily schedule around our game, maybe even set the alarm clock at night? Won't this just cause players to give up on starting these processes in the first place?

I realise this may be too subjective for this site, so I'll end with a concrete question: Do (m)any other online free-to-play games employ this technique?

sentences:
Nested transform.position in Unity The following code works  so good , but it is so long.

How can I use a for loop to write a short script for any number of prefabs?

public GameObject prefab1;
public GameObject prefab2;
public GameObject prefab3;
float timCounter = 0f;

void FixedUpdate()
{
  timCounter += Time.deltaTime;

  float[]  r = {3,2,1};
  float[]  f = {3,2,1};

  //motion on a circle

  float x = r[0] * Mathf.Cos(f[0] * timCounter);
  float y = r[0] * Mathf.Sin(f[0] * timCounter);

  float x1 = r[1] * Mathf.Cos(f[1] * timCounter);
  float y1 = r[1] * Mathf.Sin(f[1] * timCounter);

  float x2 = r[2] * Mathf.Cos(f[2] * timCounter);
  float y2 = r[2] * Mathf.Sin(f[2] * timCounter);

  float z = 0;

  //position of a any prefab_n = position of prefab_(n-1) + Vector3(x,y,z)

  prefab1.transform.position = new Vector3(x,y,z);

  prefab2.transform.position = prefab1.transform.position + new
  Vector3(x1,y1,z);

  prefab3.transform.position = prefab2.transform.position + new
  Vector3(x2,y2,z);
 }

sentences:
How to integrate game logic in game engines Recently I'm working on a 2d game engine example in .Net with C#. My main problem is that I can't figure out how I should include the game logic within the game. Currently I have a base engine which is a set of classes that they are running sub-systems like Render, Sound, Input and Core functionality. There is an editor which helps the user to add resources, build levels, write scripts and other stuffs.

I came up with an idea to use Reflection and CSharpCodeProvider from my editor to compile the written code. This way I can get an executable of my product too. This way is quite well but I would like to know what's really the solution and architecture to do this.

My engine's role is 2d platform. The scripting language is C# right now because I can't consist any other embeddable language for now. The game needs compilation and CSharpCodeProvider is the only way for me to do it meantime.

sentences:
What is causing my 3rd person camera to lose rotation on the z axis? I've been working on a 3rd person camera on unity for a couple weeks, but I've pretty much hit a wall, specifically to do with my camera's rotation. When I rotate it on its x and y axis it won't have a problem, but when it gets to the z axis (180 degree's on the x axis), it loses the ability to rotate at all. This is the code I've been using:

void Start()
{
    //controlls camera relevent to player position
    offset = new Vector3(Player.position.x - 3.0f, Player.position.y + 2.0f, 0);
    offset = transform.position - Player.position;
    localtoworldY = transform.TransformPoint(Vector3.left);

}

void Update()
{
    //need to give proper rotation of the camera around the player
    offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
    offset = Quaternion.AngleAxis(Input.GetAxis("Mouse Y") * turnSpeed, localtoworldY) * offset;
    transform.rotation = Quaternion.LookRotation(offset, Vector3.up);

    transform.position = Player.position + offset;
    transform.LookAt(Player.position);

    print(transform.rotation);

    // If the y axis go to 6.4 positive, it should stop but not stop working, same as if the camera hits a mesh or terrain.

    // If the camera changes in any direction regardless of x or y axis,player should be able to move relative to
    // the direction that the player is pressing (IE when the player press left, the Homicida malorum will move left regardless of
    // the angle of the camera).

}

}
Any advice or an explanation as to why this is happening would be much appreciated.

sentences:
Double buffering on HTML5 Canvas game? My simple canvas game seems to work fine on Chrome and FF on Mac/Linux. I haven't had chance to test it on smart phones or Windows environments yet. It doesn't use double buffering but I have seen some JS Canvas examples using it.

When is the use of the double buffering recommended?
Does it make difference only for specific browsers?
Is there a significant performance hit?

Thanks!

sentences:
How to increase the acceleration of an object on the Y axis? So far I am able to make the character fall at a constant rate but I am unsure how to make the character accelerate while falling.

When the character is falling I have a line of code as such:

position.y -= 7f;

How can I change my implementation such that the character falls faster over time?

sentences:
Instantiated prefabs dont trigger ontriggerEnter while prefabs created not on runtime, do I am new to unity and trying to make a bouble trouble game. I have enemy prefabs with BoxCollider with is triggered checked. I also have a shooting script. when I am trying to instantiate the enemy prefabs on runtime, they dont seem to trigger the OnTriggerEnter function, but if I am placing an Enemy prefab not ingame, it does trigger the funtion. I have no idea why.
The on run-time instantiate:
public class CreateBalls : MonoBehaviour
{
    public Rigidbody prefab;
    public Transform position1;

    void Awake()
    {

        for (int i = 0; i < 1; i++)
        {
            float random = Random.Range(-45.08f, 44.41f);
            Vector3 vec = new Vector3(random, position1.position.y, position1.position.z);
            Rigidbody ball= Instantiate(prefab, vec, position1.rotation) as Rigidbody;

        }
    }
}

The funtion not being called:
public class DestroyBalls : MonoBehaviour
{
    public Rigidbody potion;
    public Transform posToSpawn;

    private void OnTriggerEnter(Collider other)
    {
        if (this.gameObject.tag == "Enemy"&& other.gameObject.tag=="Bullet")
        {
           //a code not relevent
        }
    }
}

Any idea of why the funtion isnt being called? the bullets are tagged "Bullet" and the Enemies are tagged "Enemy"

Update:
The funtion is triggered when colliding with another Enemy tagged, but not being trigged after collision with anyother tagged object
Also, I have another component on the Enemy Prefab, which also instantiates enemies on run-time and these trigger the function perfectly fine. very wierd.
the code:
public Rigidbody ballToSpawn;
    public Transform spawnPoint;

    private void OnTriggerEnter(Collider other)
    {
        if (this.gameObject.tag == "Enemy" && other.gameObject.tag == "Bullet")
        {
            if (this.gameObject.GetComponent<Size>().size > 1)
            {
                Rigidbody small;

                for (int i = 0,y=-1 ; i < 2; i++,y+=2)
                {
                    Vector3 vec = new Vector3(spawnPoint.position.x+y, spawnPoint.position.y, spawnPoint.position.z);
                    small = Instantiate(ballToSpawn, vec, spawnPoint.rotation) as Rigidbody;
                    small.gameObject.transform.localScale = new Vector3(1, 1, 0);
                    small.gameObject.GetComponent<AutoMoveForBall>().GoToX = this.gameObject.GetComponent<AutoMoveForBall>().GoToX;
                    small.gameObject.GetComponent<AutoMoveForBall>().GoToY = this.gameObject.GetComponent<AutoMoveForBall>().GoToY;
                    small.gameObject.GetComponent<Size>().size = this.gameObject.GetComponent<Size>().size - 1;
                }
            }
        }
    }

sentences:
Correcting imported animation to avoid hand going through the face of character I've imported an animation from Mixamo called standing draw bow.
When I use it with my character in Unity the hand goes through the face of my character.
Is there a way to move hand a little outside the face of the character using Blender or Unity?  Or am I required to make up the animation myself?
I tried modifying parameters Mixamo offers but doesn't resolve the problem.
I actually tryed to solve the problem with IK by adding a Multi-Parent constraint ( cause i didn't manage to have multi-postion constraint to work ) and tried to move lowerarm_r Bone a little bit off the face of the character but it only did force the bow to stay in the position and rotation of the "Target" while being buggy in certain keyframes. my aim is to force that bone to not rotate more than certain degree to not go through the face while executing the animation. I believe the problem is coming from the fact that animation is made for normal head character not big head ones.

sentences:
How can I de-rig & delete the skeleton while keeping the mesh? There is this 3D model one can download here and  then import to 3DS Max with XNALara importer. (Side note: XNALara is also known as XnaPosingStudio)

Now this model already comes with a skeleton which is rigged. But if I want to rig the mesh to a different skeleton I need to delete the current skeleton correct?

When I have tried to delete the skeleton before the mesh got deleted with it.

So what I need to do is de-rig the skeleton from the mesh and then delete the skeleton, but how do I de-rig? Does anyone here know how? It's not a CAT rig.

sentences:
Detect which key was pressed last each frame Why hello there, im developing a 2D game using XNA.
My character movment is currently based on the keyboard state.
Example (in the right order):

if (state.IsKeyDown(Keys.W))
    {
          //Do stuff
    }
else if (state.IsKeyDown(Keys.D))
    {
          //Do Stuff
    }
else if (state.IsKeyDown(Keys.A))
    {
          //Do Stuff
    }
else if (state.IsKeyDown(Keys.S))
    {
          //Do Stuff
    }

That way I am able to deny diagonal movment. So my problem is, if "W" is pressed, meaning the character is moving up, And a frame after that while W is still pressed and I press "S" for example, It will keep moving up. I've been looking for a solution for a while and didn't come up with anything good enough.
What I need help with is ideas about how to detect if a different key was pressed after W (because it is the first one to check, it doesn't check the others), while denying diagonal movment.
Any help would be sincerely appreciated, Thanks in advance.

sentences:
How to develop a real-time game server for html5 web app? I'm contemplating a graduate project proposal of developing a rather complex HTML5 game that requires real-time server communication. The premise of the actual game play is simple: 10 players battle it out with one another. Many pieces of information will be tracked, such as: player health, each players X/Y position on the screen, items in inventory, etc. The server structure for all of these potential changes, however, is not so simple.

My goal is to develop a scalable environment that can theoretically maintain 50,000 concurrent players in 5,000 separate game instances while all running reliably with less than 1 second latency. My comfort skill set is mostly in web technologies. For a small scale app, I would use PHP/MySQL. But for an app this large, I am confident HTTP requests will not be even a short term solution.

I don't really know how to approach this situation.

Should I develop my own server, if so, what language should I use? I do not want to use NODE.JS. Is Python viable?
Is a single, high-performance server capable of maintaining this type of
load, or will I need to look into developing a cloud/cluster?
What type of database read/write would be optimal for this situation? How would I scale beyond 50,000 players? How would this scale with a cloud/cluster?

sentences:
Modifying Brackeys Unity Inventory Tutorial for Stackable Items? I followed this tutorial: https://www.youtube.com/watch?v=w6_fetj9PIw
and the one after it, and it works fine, but now I'm in a situation where I want to be able to stack my items up. I saw there was a thread on the brackeys forums about this a few years(!!) ago, but the files aren't available and I saw people were having issues with it anyway. Can anyone think of a way to modify it and preferably allow for easy loading/saving as well down the road (though absolutely not necessary, I can go down that rabbit hole later), or alternatively point to a different tutorial that would do so? Thanks in advance!

Here's the link to the scripts, I only went up to video 6 so there might be some new stuff in there but it should at least help!
https://github.com/Brackeys/RPG-Tutorial/tree/master/Finished%20Project/Assets/Scripts/Inventory

(note: I added a variable to the item script that keeps track of how many items of that type the player has, but the problem is that when I add a new item to the inventory it keeps adding it to a new slot and messing up the counter because I'm unsure where to check if the item already has a slot in the inventory and what to do about it.)

sentences:
Continous Movement and Gravity Switch With 1 button I have a sphere with a rigidbody on it, and it moves to the right continously as I need it, but as it moves I want the space bar to be able to switch the gravity (so it either rides on the ceiling or on the floor), as it moves along to the right.

Please help, have been googling consistently for the past 3 hours.

Here is the code I have so far:

public class movement : MonoBehaviour {

    public float movementSpeed = 10;
    private bool haspressed;

    void Start()
    {
    }

    void FixedUpdate()
    {

        transform.Translate(Vector3.down * movementSpeed * Time.deltaTime);

        if (Input.GetKeyDown ("space") && haspressed == true) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = false;
        } else if (Input.GetKeyDown ("space") && haspressed == false) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = true;
        }
    }
}

Thank you sooo much!

sentences:
Which is better a computer science degree or a Software engineer degree? I'm asking here so since you all have experience in or around game programming, that's what I want to do, and I’m trying to find as many options as I can before my senior year, which is next year. So do you have any opinions on the matter of which would give me a better education in programming?

Please no talking about anything other than the two degrees because I know of game programming degrees out there but I like to see which of these would provide the best alternate choice.

sentences:
Decomposing a collision grid into a set of boxes I'm looking for a decent algorithm to decompose a collision grid (e.g. bool[w,h])...

...into a non-overlapping set of boxes (e.g. List<Rectangle>).

The solution does not have to be the best all the time, as long as it is simplified enough (otherwise I would just create one box per tile).

sentences:
Where to save enemy positions in C++? I'm wondering how and where to save the positions my enemies should spawn.

My idea was to use a struct such as:

struct enemy{
    int x,y,type;
}

And save an array of it in a .dat with fwrite() but I'm not sure if it's a good idea.

I want to know how it's commonly done. Also I recently asked a question about events and was answered something about scripting languages like Lua, is this related to the enemy positions too? Could I create a file in a scripting language with them?

sentences: What is XNA's GameTime used for? I'm developing a game using fixed time step, and so far I haven't been using XNA's GameTime class in my code.  What uses does the class have, and should I definitely use it in my game, or can I ignore it?

sentences:
Basic knowledge for 2d gaming and images? Can anybody refer me some pdf or ebook that i should follow for basic 2d programming and  texture ,shaders and other gaming elements details in depth.By which i can easily get through the 2d game programming.

Thanks,
Balraj.

sentences:
Coarse Collision Detection in highly dynamic environment I'm currently working a 3D space game with A LOT of dynamic objects that are all moving (there is pretty much no static environment). I have the collision detection and resolution working just fine, but I am now trying to optimize the collision detection (which is currently O(N2) -- linear search). I thought about multiple options, a bounding volume hierarchy, a Binary Spatial Partitioning tree, an Octree or a Grid. I however need some help with deciding what's best for my situation. A grid seems unfeasible simply due to the space requirements and cache coherence problems.

Since everything is so dynamic however, it seems to be that trees aren't ideal either, since they would have to be completely rebuilt every frame. I must admit I never implemented a physics engine that required spatial partitioning, do I indeed need to rebuild the tree every frame (assuming that everything is constantly moving) or can I update the trees after integrating?

Advice is much appreciated - to give some more background: You're flying a space ship in an asteroid field, and there are lots and lots of asteroids and some enemy ships, all of which shoot bullets.

EDIT:
I came across the "Sweep an Prune" algorithm, which seems like the right thing for my purposes. It appears like the right mixture of fast building of the data structures involved and detailed enough partitioning. This is the best resource I can find.

If anyone has any suggestions whether or not I'm going in the right direction, please let me know.

sentences:
Calculate an AABB for bone animated model I have a model that has its initial bounding box calculated by finding the maximum and minimum on the x, y and z axes. Producing a correct result like so:

The vertices are then stored in a VBO and only altered with matrices for rotation and bone animation. Currently the bounds are not updated when the model is altered. So the animated and rotated model has bounds like so:

(Maybe it's hard to tell, but the bounds are the same as before, and don't accurately represent the rotated/animated model)

So my question is, how can I calculate the bounding box using the armature matrices and rotation/translation matrices for each model? Keep in mind the modified vertex data is not available because those calculations are performed on the GPU in the shader.

The end result I want is to have an accurate AABB the represents the animated model for picking/basic collision checks.

sentences:
Player animation mismatches its movement input I am using the code below to have the character's directional movement match its movement animations but when the player model has a non-zero y-axis rotation, the animations become mismatched.

Code:

    moveVector = new Vector3 (movX, 0, movZ).normalized * (movementSpeed * (1 - pInv.totalMass/20)) * (1 + bonusSpeed);

    animBector = pBody.transform.rotation * moveVector;
    moveVector = gameObject.transform.rotation * moveVector;

    pAnim.SetFloat ("moveSpeed", movementSpeed/2);
    pAnim.SetFloat ("Vertical", animBector.normalized.z);
    pAnim.SetFloat ("Horizontal", animBector.normalized.x);

Note that pBody is the mesh body of the playerObject and is a child of gameObject. The gameObject does not rotate since this is a top-down project & the moveVector = gameObject.transform.rotation * moveVector; part ensures the player moves towards its respective parts of the screen on pressing a directional button.

e.g.
forward input while facing North will display a forward animation;
forward+right input while facing North East will display a sideways (or strafe) animation, the correct one should be a forward animation.

sentences:
Cocos2dx - Touch not recognized on Android I'm having trouble with a touch listener not picking up touch events on android, but doing fine in windows (mouse input). I've got a Node listening for touches (not a Layer), but from what I've been seeing around it seems having it on a Layer isn't a requirement anymore?

Setup

void DodgePlayerController::setupPlayerInput()
{
    CCLOG("DodgePlayerController::setupPlayerInput()");
    if (myPawn)
    {
        Pellet* myPellet = dynamic_cast<Pellet*>(myPawn);
        if (myPellet)
        {
            CCLOG("DodgePlayerController::setupPlayerInput() !!2!!");
            //setup the player input and events (should build some sort of player controller)
            auto listener = EventListenerTouchAllAtOnce::create();
            listener->onTouchesBegan = CC_CALLBACK_2(Pellet::setTargetPosition, myPellet);
            listener->onTouchesMoved = CC_CALLBACK_2(Pellet::setTargetPosition, myPellet);
            listener->onTouchesEnded = CC_CALLBACK_2(Pellet::clearTargetPosition, myPellet);
            listener->onTouchesCancelled = CC_CALLBACK_2(Pellet::clearTargetPosition, myPellet);

            auto dispatcher = getEventDispatcher();
            dispatcher->addEventListenerWithSceneGraphPriority(listener, this);
        }
    }
}

When logging on Android, I'm getting through both CCLOG messages correctly (I have a 'disablePlayerInput()' which isn't being called, so the listener shouldn't be removed). This all works fine in the windows application, but when I load it in Android the touches aren't picked up (Pellet::setTargetPosition also has a log message which doesn't get thrown in android).

Anyone know what I might be missing?

sentences:
Vehicle physics with skid How would I go about creating vehicle physics for a car that can loose traction? I want it to seem like the driver has a flat foot, so when you press the gas, they cars driving (rear) wheels loose traction, and makes it somewhat hard to control. I would also like to be able to do doughnuts and "drift" around corners.

I would also need to know how much "skid" is happening, so I can add a proportional amount of smoke and tire marks.

Assume a 2d, top-down style car game.

Thanks

sentences:
Projecting grid textures to select parts of the terrain (Unity) So I'm trying to be smart and not use 500+ some tile prefabs to make a grid, and so far the back-end portion has gone swimmingly. I initially used a dedicated mesh to represent the grid, but as I'm now opting for 3D terrain (and not tilemapping), I figured that was a lot of unnecessary vertices - especially if I want to have the grid conform to the terrain.

My shader inexperience, on the other hand, is causing me to stop and overthink this.

Using FE as inspiration, I'm thinking about projecting the transparent grid texture onto a base terrain layer.

If I wanted parts of the terrain to not be covered by the grid (such as the water area in the picture), would I simply use the world coordinates to tell the shader don't do anything there?

The most confusing part for me, however, is how to go about highlighting tiles. I want movement and attack tiles to also be 'painted' onto the terrain in specific colors, but obviously they only affect an even smaller portion than the terrain than the grid.

Would I simply be using the same shader to grab world coordinates once again and more or less start/stop overlaying the movement/attack texture over the grid/terrain? And if I'm really being efficient, those textures belong to the same png and I just use UV's to switch between them like a sprite sheet?
Is this even a good practice for shaders in the first place? Redrawing and adding textures to only parts of a material? Should I be redrawing and updating the whole texture instead?

I guess I get thrown off because I'm only familiar with a 1:1 mesh to material design, so the so the thought of a single mesh but multiple textures on discrete parts that may or may not overlap makes somewhat sense on paper -- but implementation in Unity is just above me atm.

Thanks!

sentences:
How can I fix problems caused by "ForceMode2D.Force"? I'm making a 2D platformer with Unity. I used transform.position for movement but it caused some problems like vibration, so I decided to use AddForce.ForceMode2D.Force instead. Since this uses mass for moving the player, it makes the player either so heavy and hard to control (even when the mass is 1) or so quick and fast.  I tried changing the mass and speed but I haven't found the setting that makes a smooth movement. Also, the jumping has a problem. The player will be suspended in the air for a few seconds after the jumping. I'm just looking for a way  to make AddForcesmoother and solve these problems.
Here's my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    [SerializeField] private float jumpSpeed;

    public float maxSpeed = 5f;
    public float maxAcceleration = 50f;
    public float maxDeceleration = 100f;

    [SerializeField] private LayerMask ground;
    private PlayerActionControls playerActionControls;
    private Rigidbody2D rb;
    private PolygonCollider2D pol;
    private Animator animator;
    private Vector2 movementInput;

    private void Awake()
    {
        playerActionControls = new PlayerActionControls();
        rb = GetComponent<Rigidbody2D>();
        pol = GetComponent<PolygonCollider2D>();
        animator = GetComponent<Animator>();
    }

    private void OnEnable()
    {

        playerActionControls.Enable();

    }

    private void OnDisable()
    {

        playerActionControls.Disable();
    }

    void Start()
    {
        playerActionControls.Land.Jump.performed += ctx => Jump(ctx.ReadValue<float>());

    }

    private void Jump(float val)
    {
        if (val == 1 && IsGrounded())
        {
            rb.AddForce(new Vector2(0, jumpSpeed), ForceMode2D.Impulse);

        }
    }
    private bool IsGrounded()
    {

        Vector2 topLeftPoint = transform.position;
        topLeftPoint.x -= pol.bounds.extents.x;
        topLeftPoint.y += pol.bounds.extents.y;

        Vector2 bottomRightPoint = transform.position;
        bottomRightPoint.x += pol.bounds.extents.x;
        bottomRightPoint.y -= pol.bounds.extents.y;

        return Physics2D.OverlapArea(topLeftPoint, bottomRightPoint, ground);
    }
    void FixedUpdate()
    {

     Vector2 movementInput = playerActionControls.Land.Move.ReadValue<Vector2>();

     movementInput = Vector2.ClampMagnitude(movementInput, 1f);
     Vector2 desiredVelocity = movementInput * maxSpeed;
     AccelerateTo(desiredVelocity);

    var scale = transform.localScale;
    if(scale.x * rb.velocity.x < 0) {
        scale.x *= -1;
        transform.localScale = scale;
    }

    void AccelerateTo(Vector2 DesiredVelocity) {

    var deltaV = desiredVelocity - rb.velocity;
    var acceleration = deltaV / Time.deltaTime;

    float limit = maxAcceleration;
    if (Vector3.Dot(rb.velocity, desiredVelocity) <= 0f)
        limit = maxDeceleration;
    acceleration = Vector2.ClampMagnitude(acceleration, limit);

    Vector2 force = rb.mass * acceleration;
    rb.AddForce(force);
   }
 }
}

sentences:
Using Standard Asset RBFP Controller for Universal Windows Platform I was using the rigidbodyfirstperson controller, and it stopped working when I changed the build settings to UWP. Any body know the reason for this or how to solve it? Thanks...

Rik

sentences:
Does SDL2 completely encapsulates Direct3D and OpenGL? I'm starting to study game development but the concepts of how the SDL2 lib works are still a bit blurry to me.
I get that both Direct3D and OpenGL are two sides of the same coin. They both are used to draw vectors in the screen and are used as a graphics hardware abstraction layer.
From what I read about the SDL2 lib it seems to be a multi-purpose library that encapsulates some functionalities as user input, threading, networking, window creation, and so on [and also "graphics hardware via OpenGL and Direct3D"].
Now the questions:

The SDL2 webpage states that it provides access to "graphics hardware via OpenGL and Direct3D". What exactly that means?
If I'm making a 3D game do I need to decide beforehand which graphics API I want to use (Direct3D or OpenGL) and use it alongside with the SDL2? If not, does SDL2 completely encapsulates the graphics API so I could easily deploy my game targeting Direct3D or OpenGL without adapting too much code for each one?
In the case SDL2 does not completely abstract the graphics API, what texts and terms should I search to learn how to implement such an abstraction layer using SDL2? I want to be able to easily build for Direct3D and OpenGL.

Thanks very much!

sentences:
Consistent Space Gravity Simulation I have done some reading into this subject but haven't been able to come to a conclusion that I'm really satisfied with so far, so here is the situation. I have a game set in space, its top down and essentially 2D as far as physics is concerned and it revolves around the gravitational interaction between planets and black holes. I'm using Unity, so I have the ability apply forces to bodies. However, I have to do all the gravity calculations myself... This is where I get stuck.

Now it's not the maths that I'm having trouble with, maths I can do, its general game "feel" that is the sticking point. Originally I tried Newtons standard gravitational equations but I found that to a general user they produce unexpected behaviour. If you place two different mass planets on either side of a central black hole, both the same distance away, they will reach the central black hole at the same time (which "feels" odd). I also played around with more primitive implementations that just manipulate distance and mass in different ways but I always ended up with the same issue; as the planets im using undergo dramatic shifts in mass over the course of the game, the effect of the black holes always starts off being overly erratic (at low body masses) and then moves to being overly sluggish (at high masses) giving the game a very inconsistent feel at the moment.

Has anyone run into the same issue here and come out with a good way of simulating gravity in space? Does anyone know of examples of where this has been done before? What are some things that I may have overlooked or may want to take into consideration in the calculations?  Remember that realism isn't the main concern here, its game "feel".

I'm open to any and all suggestions here so don't hesitate to put forward any sort of crazy answers!

sentences:
Move to specified coords - libgdx and java So I am making my bullets go to a point and travel further. Only its acting really really weird. Its like its thinking that the 0,0 location is at the top left instead of the bottom left.

This is the code:

float speed = 100;

    Vector2 direction;
    Vector2 thisPos = new Vector2(getX(), getY());
    Vector2 mousePos;

    public Bullet(){
        super();
        setSprite(sprite);
        setX(0); setY(0);
        float dx = Gdx.input.getX() - getX();
        float dy = Gdx.input.getY() - getY();
        mousePos = new Vector2(Gdx.input.getX(), Gdx.input.getY());
        direction = new Vector2(dx, dy);
        //sprite.setRotation(direction.angle(thisPos));
        direction.nor();
    }

    public void update(){
        Vector2 dirAd = new Vector2(direction);
        thisPos.x += dirAd.x * speed * Gdx.graphics.getDeltaTime();
        thisPos.y += dirAd.y * speed * Gdx.graphics.getDeltaTime();
        setPosition(thisPos.x, thisPos.y);
        super.update();
    }

I hope someone can help me what I did wrong with this.

sentences:
networking - how to deal with serverside packet arrival delay? Let's assume each client sends a packet every 0.05 seconds. (rate = 20)
Server update tickrate is 60 and it sends data back to client every 1 / 30 seconds.
Now client A has 50ms ping time and it sent each data at [A]5, [B]5.05, [C]5.10 second.
But due to some networking issue, server received each data at [A]5.05(good), [B]5.10(good), [C]5.18(bad! it delayed 0.03 seconds.)
When server get the packet [A] at 5.05 seconds, since each packet contains client data(like commands) for 0.05 seconds, it updates the entity based on this [A] packet for 0.05 seconds. after that, server time is now 5.10. and the next packet, [B] is already arrived so server just can keep updating.
At 5.15, now server has to update the entity with next packet, which is C, but there's no packet! Server has to wait for 0.03 seconds till next packet will be arrived. now, server is behind 0.03 seconds from client. sync failed.

I have two idea for solving this problem.

Server maintains its own client's time and sends back to client. For client side, when there is heavy desync between client and server, the client syncs to the server time.

Solution 1 is still applied. but there is one more. like entity-interpolation, there is packet-interpolation. Client sends each packets every t seconds which is (t = [SEND-TICKRATE + CLIENT-LAG]) . It means server gets next packet after [t + LATENCY] seconds which is always larger than SEND-TICKRATE, 0.05 in this assumption.
So when server gets packet, it doesn't update it immediately but waits for some time (like 0.03 ~ 0.05 seconds). Now server has next packet with a high probability.

I think Solution 2 is good. But the drawback is, client renders other player's data behind [RTT + Entity-Interpolation time + Server packet Interpolation time], so for a fast-paced-game, Shot-behind-the-wall will more happen.
What technique is used in other fast-pace-game like league of legends or overwatch?

sentences:
AABB Sweeping, algorithm to solve "stacking box" problem I'm currently working on a simple AABB collision system and after some fiddling the sweeping of a single box vs. another and the calculation of the response velocity needed to push them apart works flawlessly.

Now on to the new problem, imagine I'm having a stack of boxes which are falling towards a ground box which isn't moving:

Each of these boxes has a vertical velocity for the "gravity" value, let's say this velocity is 5.

Now, the result is that they all fall into each other:

The reason is obvious, since all the boxes have a downward velocity of 5, this results in no collisions when calculating the relative velocity between the boxes during sweeping.

  Note: The red ground box here is static (always 0 velocity, can utilize spatial partitioning ), and all dynamic > static collisions are resolved first, thus the fact that the boxes stop correctly at this ground box.

So, this seems to be simply an issue with the order the boxes are sweept against each other.

I imagine that sorting the boxes based on their x and y velocities and then sweeping these groups correctly against each other may resolve this issues.

So, I'm looking for algorithms / examples on how to implement such a system.

The code can be found here: https://github.com/BonsaiDen/aabb

The two files which are of interest are box/Dynamic.lua and box/Manager.lua.

The project is using Love2D in case you want to run it.

sentences:
Sprite not visible when using a Rectangle for collision in XNA When I added a Rectangle to the Draw method for the sprite, it did not show up on screen.

 spriteBatch.Draw(texture, position, new Rectangle((int)position.X, (int)position.Y, (int)texture.Width, (int)texture.Height), Color.White, rotation, orgin, scale, SpriteEffects.None, 0f);

sentences:
Pathfinding in non-quantized space? Pretty much whenever anyone thinks about pathfinding, they think about algorithms like A* and DFS - graph search algorithms, which also just so happen to work as pathfinding algorithms when you quantize the space you're pathing in into a graph.

What if that's not an option, though? Are there efficient pathfinding algorithms that work in space that hasn't been split in to chunks? The "left hand rule" is one example; walk forward and when you hit a wall, turn left - but there's plenty of situations where that won't ever find the target. Are there others like that?

sentences: Creating a 2D skeleton animation system for use with Panda3D Hey. I want to be able to create a system for 2D skeletal animation in my game. I'm using panda3d as my game engine. I'd like to be able to make simple bone structures and skin them with my sprites. I would prefer to do this with straight code and algorithms, but if I have to use a 3D modeler or something, then I can try to (I didn't do a great job last time I tried using Blender... >.<)

sentences:
Using SQL for a Realtime Multiplayer Game Server's Working Data (Fast Enough?) The game I'm working on currently has a Client in Flash AS3, and a Server in C# (multithreaded).

Currently I use mySQL to handle logins (Raw access: no middleman for accessing the database) which seems to be extremely quick.

My question is would using a mySQL database be quick enough for a fairly simple real time game?

My game functions in a similar way to Diablo2, League of Legends, or even Starcraft:

User logs in
User is taken to lobby
From lobby user may view active games
User's group into 2-8 for games which exist on the server in it's own thread

Now, the game has been designed in such a way to minimize server calculations, while still providing zero trust to clients.  Is it possible to use SQL in a way to store and manipulate all game data, for each game? ie:

Users 1 through 8 all create 50 units
Each user commands all of their units to move to a location on the map
Units attack each other
etc.

Is SQL fast enough to handle this kind of data traffic?  Or would it be better to store it all in memory?  Or is there some alternative (such as paging) I haven't considered?

sentences:
Water simulation in Isometric game I'm creating a game in Flash AS3 in which the player needs to modify land in order to direct the water in the right direction.

However, water simulation is a new topic for me and I'm kinda stuck. It doesn't have to be like realistic water, with ripples and stuff, but it has to flow, and if there's enough water, it needs to rise.

I've thought up two different types of water:

A Spring: Infinite source of water. Used for simulating seas and stuff.
Water block: Just one unit of water.

My current implementation shows how I'd like the water to spread, but it doesn't rise, and doesn't allow for finite water. Also, the spreading isn't accounting for any amount of water, it just duplicates instead of actually moving units of water.

I'm curious to how you guys would solve this problem. Any examples/pseudo-code is always appreciated.

Current version: http://dl.dropbox.com/u/319897/ProjectWater.swf
You can manipulate the land by pressing left mouse. And can simulate one step of water at a time by pressing A.

Source of the water part: http://pastebin.com/Js2kYt4y

sentences:
Drawing large 2D sidescroller level terrain I'm a relatively good programmer but now that it comes to add some basic levels to my 2D game I'm kinda stuck.

What I want to do: An acceptable, large (8000 * 1000 pixels) "green hills" test level for my game.

What is the best way for me to do this?

It doesn't have to look great, it just shouldn't look like it was made in MS paint with the line and paint bucket tool.

Basically it should just mud with grass on top of it, shaped in some form of hills.

But how should I draw it, I can't just take out the pencil tool and start drawing it pixel per pixel, can I?

sentences:
Two Colliders on the same GameObject for different purposes I'm somewhat new to Unity and am trying to build a battle system.
Right now, I have an attack that checks collisions with enemy objects like this:
private void OnTriggerEnter2D(Collider2D other) {
  if (other.gameObject.layer != LayerMask.NameToLayer(_hurtboxLayer))
    return;

  var enemyHealth = other.GetComponent<Health>();
  enemyHealth.TakeDamage(_damagePoints);
}

My game also uses Rigidbody2D objects to let the player and enemies bump into each other.
Because I want the "bumping" Collider2D be different from the hitbox Collider2D, I made a child GameObject called Hurtbox for each enemy.
The Hurtbox objects have a Health behaviour which handles the HP and death of an enemy:
public class Health : MonoBehaviour {

  [SerializeField] private int _initialHealthPoints;
  private int _healthPoints;

  public void TakeDamage(int damagePoints) {
    _healthPoints -= damagePoints;

    if (_healthPoints <= 0) {
      Die();
    }
  }

  private void Die() {
    Destroy(gameObject);
  }

  private void Start() {
    _healthPoints = _initialHealthPoints;
  }

}

The Die method only destroys the hurtbox object and is not allowed to destroy the enemy object, which is its parent.
Is there any way I can put both Collider2Ds and the Health behaviour on the same GameObject and only check a specific Collider in the OnTriggerEnter2D method?

sentences:
Creating a click and drag system in GameMaker Studio 2 I am attempting to create a click and drag system in GameMaker 2, for example a dress-up game or maybe a puzzle. How would I go about getting the objects to click and drag?

I'm trying to get it so I can click and drag a piece of clothing, for example, and drag it onto a character and then drag another piece of clothing on as well.

sentences:
Body inside other body after collision I'm using bullet to create a 2D topdown game. In my physics proof of concept, I can walk around and push a box. However, if I walk too fast the character goes through the box, instead of colliding with it. See gif:

This seems like a common thing to me. However, I cannot find other people having the same problem, so that's why I'm asking a question directly. I'm using a DiscreteDynamicsWorld with two rigid bodies which I step through at 60Hz.

Why does this happen?
Is there a way to tune bullet to support higher speeds and prevent this issue?

Help is very much appreciated.

Edit

Regarding the question about how I setup collision shapes:

btConvexHullShape shape;
shape.addPoint({-size, size, 0.0f});
shape.addPoint({size, size, 0.0f});
shape.addPoint({size, -size, 0.0f});
shape.addPoint({-size, -size, 0.0f});

sentences:
SAT test for Triangle - convex hull I'm having real trouble resolving this issue with triangle-convex hull SAT test intersection.

The problem is as follows:

Misses are detected accurately enough:

Clear miss

I have not found a problem with false negatives (ie collision is there but not detected).

But I do have a problem with false positives (collision detected even though there is not one)

Appears to detect false +

This only happens occasionally with orientations like the one shown (that is actually a pretty big gap).

What I'm doing conceptually is just a usual SAT test for the triangle against the hull.  I'm pretending the single triangle is a "convex hull", indeed it might be if you imagine it is a very thin, very flat tetrahedron.  I don't know if I am mistaken in this concept of triangle-convex hull intersection, if the slight inaccuracy is to be expected, or if there is perhaps a bug in my code (the same SAT Test routines work for hull-hull, box-hull, and other test quite accurately though)

The relevant code is at line 621 of hull.h, with the SATTest overlap routine in Intersectable.cpp.

sentences:
How can I efficiently resize sprites every frame? I want to animate UI elements, like HP bars, by moving and resizing them. How can I efficiently resize sprites every frame?

I am using the LibGDX framework.

sentences:
a simple 2D rectangle collision algorithm that also determines which sides that the rectangles collide? I initially tried out implementing rectangular intersection, which works well. However, when I have to apply the physics system, such as velocity, acceleration, and directional vectors, I would have to find a way to determine which side of the rectangles collide. Now, in my system, there is no rotated rectangle, so this simplified the problem. However, I couldn't find an easy way to determine which rectangle side collided. I have once deal with this problem before but failed miserably.

What I did in the past is determine the distance between each parallel rectangular sides and check if the distance is close to 0 (use some initially defined distance range) or is 0. However, for floating-point arithmetic, this proves to be unstable because of unknown time elapse. Sometime, the rectangles would actually intersect each other before it meets the defined range.

On the other hand, I was thinking about spawning multiple rectangles, each rectangle for each sides. However, after thinking again, it would be the same thing as having a parallel side with distance range checking, just that that distance range is the width of each mini-rectangle.

Therefore, any suggestion to this problem?

sentences:
How to loop background music through splash screen, main menu, options menu? I am making a small game to sort of test the waters with Game Maker and I'm trying to have an mp3 play when the splash screen loads - and persist until the game either ends or the game starts (meaning splash, menu, options all play the background mp3).

I've created an object that isn't visible, but is present in my rooms (Menu, Splash, Options) that reads:

if (!sound_isplaying(BGM_Menu))
{
    sound_loop(BGM_Menu);
}

Which will, to my understanding, go through and check for whether or not the background music is playing, if not, start it. Well no music plays on any of the menu screens.

I figured I'd try something simple, to even just get my background music to play:

play_sound(BGM_Menu);

Nothing.

So then I decided I'd go to drag and drop since sound_loop and sound_play don't seem to want to work for me. What happens is, the BGM_Menu will start to play on my splash screen, then as soon as as it transfers over to my Menu room (from Splash) it starts to loop the same song over the one that's still currently playing from the splash screen.

I've tried to solve this issue for about an hour and figured I'd come here to see if anyone else has experienced this or knows a fix.

Thanks!

sentences:
NavMesh - LoS and "Containing" For a gameserver/backend, I have a navmesh for "walkable" areas in form of points/triangles.

Now I want to check every gametick if the client is still in a legit place and if he shots/casts a spell, if his target is in line of sight.

I found several possibilities, but I am not sure what is performance-wise ideal.

To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this:
https://github.com/SebLague/Gamedev-Maths/blob/master/PointInTriangle.cs
But this would mean that every gametick I have to check soooo much triangles.

To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check.
Second option I found would be to start a Simple Stupid Funnel Algorithm (http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html) until LoS is broken.

The questions now are:
How does a good gameserver handle this/can it be optimised?
What way to check is the best/fastest?
Is it common to only check if the position is legit every now and then or every gametick?

The Levels are fairly simple (~300 mesh-triangles, ~200 border lines, 10 players, 10 npcs maybe)

sentences:
How do you handle large triangles with frustum? I am rendering the Sponza scene ato test my frustum implementation.

My current approach is simply, test if the vertices of the triangle are within the frustum (angle between the camera looking direction and the position od the vertex relative to the camera).

If any of the vertices are visible then the trianlge is considered to be visible.

The issue is that the sponza scene has some really large triangles, thus with my approach it is possible to be looking directly at a triangle and see nothing if all 3 vertices are outside the camera frustum.

sentences:
How can you create a trigger collider between two moving objects? I want to create a trigger-collider between two boxes. When one of the boxes moves, the trigger is supposed to change its size and shape so that its left and right edge stay attached to the two boxes.

How can I implement this in C# or JavaScript?

sentences:
Trouble with the State of things in XNA I'd decided to break the mold and make my first game based on RPG mechanics (note sarcasm).  An RPG style action bar would be a reasonable and fun way to get started as it's limited in scope but still challenging.

I have my spell bar and three targets.  I click a target, cast a spell, start the cast, put the spell on recovery cooldown, set the global cooldown, the spell goes through a casting phase then casts, the effect is applied to the target, mana is spent, the spell goes on cooldown or is removed depending.  Casting is animated, cooldowns are typical gray shading.  Then the other rules start to come into play.

When a spell is being the cast the target cannot be changed.
When a spell is on cool down we want a standard global cool down effect.
When a target has an effect we put a smaller version of the icon near
it which also has the same cooldown effect based on remaining
duration.
When the effect expires we need to remove it.
When something is on cooldown and another cooldown is triggered the
cooldown must become the longer of the two.
Each spell on a target has an effect such as damage or shield
Some effects, like shield, mitigate other effects, like damage

I've ended up with too many UI concerns checking the same pieces of data.  So my buttons have states, I tried the State Pattern, but ended up with the same type of crappy code in determining what state to set my objects to.

Take the example that a spell can't be cast if it's on cooldown.  Pretty straight forward as that's information the spell has about itself.  You can't cast if you have insufficient mana, getting more complicated because now I need to know about the state of the player to properly render the spell as shaded cause it's not available, can't cast on player if effect already exists, getting ugly now I need knowledge about the target and their effects as well.  Every one of these new situations resulted in my code bloating or getting stringy.

I'm event driven enough to detect clicks but should I go farther and be creating events for everything such as OnSpellCastBegin, OnSpellCastInProgress, OnSpellCastComplete, OnManaChanged, OnTargetChanged?

I would think it's the spell classes responsibility to answer if it can be cast but this requires it have a reference to the Player, and the PlayersTarget, and whatever else in the game in the future can effect a spell cast. What kind of design approach would support future adjustments to if a spell could be cast that followed the open/closed principal where I didn't have to modify the spell class every time?

thanks!

sentences:
How to use AddForce on a capsule? I created a simple scene, with a box that serves as the ground, and a capsule that serves as the player. I added to the player a RigidBody, and a component that should move it using AddForce:

private void FixedUpdate() {
    rb = GetComponent<Rigidbody>();
    float horizontal = Input.GetAxis("Horizontal");
    rb.AddForce(new Vector3(horizontal * forceSize, 0, 0), ForceMode.Force);
}

However, instead of moving straight along the ground, my capsule rolls over its head:

I tried to mark the checkbox near Freeze Rotation: Z in my RigidBody component, but then the capsule stopped moving altogether.

What is the correct way to apply force to the capsule?

EDIT: Initially, the physic material on both the player's collider and the ground collider was None. Now, I changed it to a new material with dynamic friction and static friction 0, and it moves straight (even with gravity and without freezing the Z rotation). However, if I even slightly increase either type of friction in either one of the materials, the player falls on its face again. Why does friction have this effect on the player? And how can I move the player correctly when there is positive friction?

sentences:
How to rotate camera centered around the camera's position? Currently I am using gluLook at like so:

gluLookAt(position.x, position.y, position.z,
          viewPoint.x, viewPoint.y, viewPoint.z,
          upVector.x, upVector.y, upVector.z);

with the above, don't know if you need more information, how could I change it so that the camera acts like its rotating around itself, instead rotating around its viewpoint. You can see the current code at https://github.com/dchhetri/OpenGL-City/blob/master/opengl_camera.cpp, that class was adapted from codecolony.com.

sentences:
Unity and Chartboost loading problems I implemented chartboost in my ios game and locally it wors great.

I can receive ads.

Now my game is online but in the google analytics I get only error messages from
the game, meaning the chartboost ads fail to load.

Here:
https://www.dropbox.com/s/cft98lk27mt7p3s/cb.jpg?dl=0

The iage show google analytics registering only failed loads and
there is no single successfull ad load?

What could be the problem here?

sentences:
Phaserjs, filters, save to image cache I've tried to apply a Pixi filter to a image and save it to cache but the image doesn't get saved with the filter.

colorMatrix = new PIXI.ColorMatrixFilter();
colorMatrix.matrix = [0,0.0,0.5,-0.2, 0,0,1.0,-0.2, 0.0,0.0,0.5,-0.2, 0.0,0.0,0.0,1]
image = game.make.bitmapData()
image.load("testImage")
image.filters = [colorMatrix]
game.cache.addBitmapData("testImageWIthFilter", image);

Is it not possible to save it to cache? The only thing I see is the original image when using the code down below:

messageImage = game.add.sprite(0, 0, game.cache.getBitmapData('testImageWIthFilter'))

sentences:
How to properly repeat a texture on a quad in OpenGL? I'm drawing a quad and binding a texture to this quad like this:

#define TERRAIN_WIDTH         2000
#define TERRAIN_LENGTH        2000
#define TERRAIN_WIDTH_2       (TERRAIN_WIDTH / 2)
#define TERRAIN_LENGTH_2      (TERRAIN_LENGTH / 2)

glBindTexture(GL_TEXTURE_2D, gameTextures.terrain);
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f(-TERRAIN_WIDTH_2, 0.0f,  TERRAIN_LENGTH_2);
    glTexCoord2f(X, 0); glVertex3f( TERRAIN_WIDTH_2, 0.0f,  TERRAIN_LENGTH_2);
    glTexCoord2f(X, X); glVertex3f( TERRAIN_WIDTH_2, 0.0f, -TERRAIN_LENGTH_2);
    glTexCoord2f(0, X); glVertex3f(-TERRAIN_WIDTH_2, 0.0f, -TERRAIN_LENGTH_2);
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);

Normally, X would be equal to 1 but this will stretch the texture because the quad is very large. The idea is to increase that value so the texture is repeated (the texture was generated with GL_REPEAT of course).

But how should I find the best value for X? I have a few 512x512 textures which look nice if I replace X=512. Then I have another 1024x1024 texture which looks good to with X=512 but doesn't start to look so good with a higher/lower value. Another texture is 2048x2048 and now I need to go down to X=256, otherwise it won't look so good.

What's confusing me even more is the fact that both 512x512 and 1024x1024 textures look good with X=512. The way I see it, the lower the texture resolution, the more times I need to repeat it.

How should I calculate the value of X then?

sentences:
Can GPU draw from one VB and upload to another VB at the same time? (OpenGL) We have a working implementation of vertex double buffering, rendering from one buffer and uploading vertex data to next frame buffer at the same time.

However I am concerned that CPU spends quite a lot of time uploading vertex data. Is the upload blocked by video driver because it's busy with drawing?

Or is it caused by driver's pipeline using the frame N+1 buffers for internal rendering of the frame N-1 frame while the drawing thread is issuing commands for frame N and I should consider switching to triple buffering (however I seriously doubt that it can improve FPS)?

Or should I rather queue the frame N+1 vertex uploads and do them after frame N commands have been issued so that there are no blocks in driver?

It's just that the thread that uploads vertex data also does much other work and is now a bottleneck and I want to offload it as much as possible and definitely don't want to see it blocked by driver.

sentences:
Turn-based multiplayer animate moves from last turn I'm trying to make a 2-player turn-based strategy game, using the Google Play Games APIs

According to the documentation,

  As a match progresses, the current player can modify and store the game data on Google's servers. The other participants can then retrieve and update this data on their turn.

What this seems to be saying (sorry if I'm completely misinterpreting this; I've never played with the Play Games APIs before) is that, since each turn is just updating the game state data on the server, a round could look something like this:

Unit A is on Square 1, Unit B is on Square 3
[P1's turn] Player 1 moves Unit A to Square 2
[P1's turn] Player 1 kills Unit B with Unit A
[P2's turn] When Player 2 looks at the game, it shows Unit A on Square 2, and no Unit B

What I want is for both players to see the animation when Unit A moves, rather than Player 2 just seeing the new state and not the transition:

Unit A is on Square 1, Unit B is on Square 3
[P1's turn] Player 1 moves Unit A to Square 2
[P1's turn] Player 1 kills Unit B with Unit A
[P2's turn] When Player 2 looks at the game, it shows Unit A on Square 1 and Unit B on Square 3, then animates Unit A moving to Square 2 and killing Unit B

So basically each player gets a replay of the action from their opponent's turn before taking their turn.

I know it could be possible to do something like this by looking at the differences in position of a unit between turns, then animating the change; this, however, breaks down when you have something like an attack, where all you know is a unit was destroyed and wouldn't necessarily be able to infer which unit attacked and should be animated.

How would I go about implementing something like this?

sentences:
Is Rigidbody a variable type? I been searching for this for a while online but found no good answer so now I'm asking here. I have a scripting question about Unity's Rigidbody.

When your making a game object move with Rigidbody you typically make a script for it that starts off with

public Rigidbody rigid;

Then you put in a GetComponent call like so

void Start() {
  rigid = GetComponent<Rigidbody> ();
}

And the part I don't understand is how the Rigidbody variable works. Is it a variable type that unity is using cause even in the GetComponent it starts looking for Rigidbody not rigid. That seems like making a int variable then calling it saying Debug.Log(Int);

Also in unity script from the documentations it uses

function Start () {
  var rb = GetComponent.<Rigidbody>();
}

Theres no Rigidbody in the declaration of the variable at all. Thats what made it even more confusing for me due to how GetComponent cleary shows it getting just the Rigidbody component but from the look of the script how does it connect to the game object?

With the C# example you drag and drop the GameObject in the Rigidbody variable even when the script is connected.

The reason why I'm asking is because I'm wanting to learn intuitively where I understand all the meaning of code like a second language. Is that normal?

sentences: If I want to create a top-down 2D game should I rotate the camera? Do I have to rotate the camera to top-down view if I want to crate a top-down 2D game or just disable gravity?

sentences: How do I make my Slick2D game fullscreen? How do I make my game fullscreen? It's always in windowed mode. I'm using Eclipse on a Mac.

sentences: How do I find a point on a line? I have two points (A, B) and the length of d. How can I find point C?

sentences:
Text width phaser.js Does phaser have any function that returns the width of the text or if not, how can I center text inside rectangle I've drawn?

Thanks!

sentences:
Ray-Box (AABB) is slower than without I'm trying to write my own ray tracer. The last days I tried implementing a bounding box algorithm for it. But I'm getting a much slower frame rate with the bounding boxes turned on. I think it has something to do with checking the box with every ray but I don't know how I could change that.
Here is my code for the intersection algorithm:
bool Intersect(Ray r, float3 lb, float3 rt)
{
    float3 dir_inv = 1 / r.direction;

    double t1 = (lb[0] - r.origin[0]) * dir_inv[0];
    double t2 = (rt[0] - r.origin[0]) * dir_inv[0];

    double tmin = min(t1, t2);
    double tmax = max(t1, t2);

    for (int i = 1; i < 3; ++i)
    {
        t1 = (lb[i] - r.origin[i]) * dir_inv[i];
        t2 = (rt[i] - r.origin[i]) * dir_inv[i];

        tmin = max(tmin, min(t1, t2));
        tmax = min(tmax, max(t1, t2));
    }

    return tmax > max(tmin, 0.0);
}

My trace function:
RayHit Trace(Ray ray)
{
    RayHit bestHit = CreateRayHit();
    uint count, stride, i;

    // Trace ground plane
    IntersectGroundPlane(ray, bestHit);

    // Trace spheres
    _Spheres.GetDimensions(count, stride);
    for (i = 0; i < count; i++)
    {
        if (Intersect(ray, _Spheres[i].position - (_Spheres[i].radius), _Spheres[i].position + (_Spheres[i].radius)))
            IntersectSphere(ray, bestHit, _Spheres[i]);
    }

    // Trace mesh objects
    _MeshObjects.GetDimensions(count, stride);
    for (i = 0; i < count; i++)
    {
        //if (Intersect(ray, float3(0.0f, 0.0f, 0.0f), float3(10.0f, 10.0f, 10.0f)))
            //IntersectMeshObject(ray, bestHit, _MeshObjects[i]);
    }

    return bestHit;
}

sentences:
How can I create a character design that maintains a fixed rotation body, while allowing the body's "arm" to rotate 180 degrees? I am attempting to create a 2d shooter in Farseer Physics on the Xbox360.

I have a player body which has a fixed rotation, as I do not want the body to rotate at all during gameplay. I am now looking to add an arm/weapon to the player's body, which should be able to rotate when the player moves the thumbstick on the controller.

This arm should have the following features:

Does not react to gravity
The position does not change by itself
The only time the angle should change is when the player tells it to do so, and I should be able keep it at a fixed angle when the player decides to stop moving it.

Originally, I thought I could get this done using a fixture. Unfortunately, I don't see a way to rotate a fixture on a body after it has been added.

I assume the correct approach is to create a seperate body for the arm of the player, and attach them using a joint. I cannot for the life of me figure out which joint to use, and which characteristics to apply it. I feel like I have tried all of them, but I'm sure there are just a few variables that I am unfamiliar with that are giving me unwanted results.

sentences:
Alpha blending not rendering properly XNA 4.0 I'm trying to render a tree made out of 2 rectangles intersecting in the center at a 90degree angle. The texture has an alpha channel but which ever rectangle gets rendered second causes a weird problem with the transparency.

Here is my rendering code:

public override void render(GraphicsDevice gd, Camera camera)
{
    RasterizerState rs = new RasterizerState();
    rs.CullMode = CullMode.None;
    gd.RasterizerState = rs;
    gd.BlendState = BlendState.AlphaBlend;

    effect.CurrentTechnique = effect.Techniques["TexturedNoShading"];
    effect.Parameters["xWorld"].SetValue(Matrix.CreateTranslation(position));
    effect.Parameters["xView"].SetValue(camera.getViewMatrix());
    effect.Parameters["xProjection"].SetValue(camera.getProjectionMatrix());
    effect.Parameters["xTexture"].SetValue(m_texture);

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        gd.Indices = m_indexBuffer;
        gd.SetVertexBuffer(m_vertexBuffer);
        gd.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, m_vertices.Length, 0, m_indices.Length / 3);
    }

    rs = new RasterizerState();
    rs.CullMode = CullMode.CullCounterClockwiseFace;
    gd.RasterizerState = rs;

    gd.BlendState = BlendState.Opaque;
}

sentences:
How can I simulate a floating character in Box2D? I am creating a jump'n'run game using the Box2D physics engine. The main character should be a robot like creature without legs, floating over the ground powered by a jet engine.

The motion should look like that of a flying saucer: The creature never touches the ground, but also never gets too far from it. What construction of joints, shapes and bodies can do that nicely?

I started by trying to make a kind of pendulum:

     O        <-- head
     |
    +-+
    |X|       <-- creature's body
    +-+
 ----+-----   <-- ground (pendulum crossing)
     |
     O        <-- heavy body, weld joined to the creature, it does
                  collides with nothing, just pulling the creature
                  down to keep it upright

However, that isn't working smoothly and the creature bounces around too much. Besides, how can I simulate the jet engine nicely?

sentences:
How do you create your levels containing curved slopes in Box2d? I have just started developing games for iPhone in Cocos2d and am currently working on a Box2D prototype. I know this is not an easy start, but I have experience in the AS3 port of the physics engine. And ... I am stubborn.

My question is:
How do you implement and create your levels in the project. Is there a good parser out there or maybe a nice approach you guys know of? I am looking for a way to create curved slopes and of course circles and rectangles.

I have read about LevelSVG but it seems to add a lot of functionality that I don't want. I am a Flash game developer and I am used to writing the game logic by myself. Is this product worth the money if all you need is the parser?

Thanks

sentences:
Sprite animation frames in Adobe Photoshop CC I am creating 64x64 px sprites for my game and want to test the animation play before saving the sprite sheet in game.

I watched this video to learn, which told me:

1) Click Window->Timeframe

2) Add selected Frame

3) Click duplicate frame, then Tween frames in between. These icons on the bottom left of timeline:

The issue is, he doesn't show how to do it if my sprite needs to animate in place... only if it moves across a canvas as such:

My game uses Texture Packer to pack individual 64x64px images and then renders the frames. Therefore, I need to make little adjustments to the single frame in place, and animate them:

I tried selecting my next frame layer for my sprite and duplicating it, but it only ends up duplicating the first frame.

How can I add my selected layer in my Layers to the timeline?

sentences:
General pointers and advice in creating inventory structure? I am working on text-based Diablo-like RPG, where each weapon and armor has unique stats and names and there is a lot of overlap. Ie I can generate Silver Sword with 40 damage, but I can also generate Silver sword with 20 damage. So those items can't obviously be stored as one value. I am thinking of storing the items in multidimensional array where one column would store weapon name and the other column would be used for storing the damage. Same for armor etc. But I feel this may get cumbersome and spiral out of control very quickly.

Is there any other data structure I could use and have more flexible and efficient solution?

sentences:
How to limit players to low-level content before they advance, if they can't die I am making a game with the basic RPG elements: levels, xp, items, currency, stats, spells and monsters. The only different thing is that the player doesn't have hitpoints, you can't die. It's a simple game where you basically just kill and farm monsters.

Now a problem I'm facing right now is "content restriction". I don't want my players to skip the low-level monsters simply because they can't die by the high-level ones. So how can I achieve this?

sentences: What is "terrain mesh generation" exactly? I'm new to computer graphics and need to know and understand what the "terrain mesh generation" is? I read about "terrain", "mesh", "terrain generation" but can't find an article named "terrain mesh generation". So is there anyone can explain "terrain mesh generation" ?

sentences: Collision and response between sprites? What is an easy way to have sprites collide and react to the collision? E.g. if I'm writing a game in XNA or with Canvas 2D and need to write the code myself very simply.

sentences:
Button image on game menu is updating too slow I'm using SDL2 and i'm facing a problem with my game menu buttons.

Every time i detect that the mouse pointer is over a button of the menu i update the image of the button (from MOUSE_OUT to MOUSE_OVER).When i move several times and fast the pointer over the button and then i stop pointing at it the button image keeps updating. Like if the updating of the screen were not synchronize with the update of the events.

My guest is that because i'm polling the events by using SDL_PollEvent() there still events on the queue to poll and that causes the update of the images.

How can i avoid this problem of latency between the polling of events from the poll and the update of the image?

This is the method i use to check if the pointer is over the button. The input object keeps the type of event and the event itself.

int MenuState::update(GameEngine g)
{
    state_play = MOUSE_OUT;
    state_exit = MOUSE_OUT;

    switch(input->get_type()) {
        case MOUSE_PRESSED_EVENT:
            if((input->get_x_pos() > POS_X_PLAY_BUTTON) && (input->get_x_pos() < (POS_X_PLAY_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_PLAY_BUTTON) && ( input->get_y_pos() < (POS_Y_PLAY_BUTTON + 100))) {
                state_play = MOUSE_CLICKED;
                next_state = Game;
            }

            if((input->get_x_pos() > POS_X_EXIT_BUTTON) && (input->get_x_pos() < (POS_X_EXIT_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_EXIT_BUTTON) && ( input->get_y_pos() < (POS_Y_EXIT_BUTTON + 100))) {
                state_exit = MOUSE_CLICKED;
                next_state = Game_Over;
            }
            break;
        case MOUSE_MOVED_EVENT:
            if((input->get_x_pos() > POS_X_PLAY_BUTTON) && (input->get_x_pos() < (POS_X_PLAY_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_PLAY_BUTTON) && ( input->get_y_pos() < (POS_Y_PLAY_BUTTON + 100))) {
                state_play = MOUSE_OVER;
            }
            if((input->get_x_pos() > POS_X_EXIT_BUTTON) && (input->get_x_pos() < (POS_X_EXIT_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_EXIT_BUTTON) && ( input->get_y_pos() < (POS_Y_EXIT_BUTTON + 100))) {
                state_exit = MOUSE_OVER;
            }

            break;
        default:
            break;
    }
}

This is where i poll the events.

TypeEvent InputManager::poll_event()
{
    TypeEvent t;

     if(SDL_PollEvent(e)) {
        switch (e->type) {
            case SDL_QUIT:
                input = new QuitInput(QUIT_BUTTON);
                t = QUIT_BUTTON;
                break;
            case SDL_KEYDOWN:
                input = new KeyboardInput(KEYBOARD_EVENT);
                t = KEYBOARD_EVENT;
                break;
            case SDL_KEYUP:
                input = new NoneInput(NONE_EVENT);
                t = NONE_EVENT;
                break;
            case SDL_MOUSEMOTION:
                input = new MouseInput(MOUSE_MOVED_EVENT);
                t = MOUSE_MOVED_EVENT;
                break;
            case SDL_MOUSEBUTTONDOWN:
                input = new MouseInput(MOUSE_PRESSED_EVENT);
                t = MOUSE_PRESSED_EVENT;
                break;
            default:
                input = new NoneInput(NONE_EVENT);
                t = NONE_EVENT;
                break;
        }
        input->set_input(e);
        return t;
    }
    return NONE_EVENT;
}

This is my first try in order to make an input system and is not complete or totally optimal.

Thanks in advance!

sentences:
What happened to the Journal of Game Development? The lengthy mission statement from its website states:

  The lack of game-specific research has prevented many in the academic community from embracing game development as a serious field of study. The Journal of Game Development (JOGD), however, provides a much-needed, peer-reviewed, medium of communication and the raison d'etre for serious academic research focused solely on game-related issues. The JOGD provides the vehicle for disseminating research and findings indigenous to the game development industry. It is an outlet for peer-reviewed research that will help validate the work and garner acceptance for the study of game development by the academic community.  JOGD will serve both the game development industry and academic community by presenting leading-edge, original research, and theoretical underpinnings that detail the most recent findings in related academic disciplines, hardware, software, and technology that will directly affect the way games are conceived, developed, produced, and delivered.

The Journal of Game Development was established in 2003. It's hard to find any information about the issues but at four issues per year, I estimate the last issue was distributed sometime in 2005 or 2006. It had a good editorial board of college professors and a founding editor from Ubisoft. The list of articles looks good. The price was reasonable.

So what happened to it? Its website recently went down but you can see the last Archive.org version.

The editor-in-chief is a professor at my school so I intend to ask him in person in a week or two, but I thought I'd see what you might be able to dig up about it first. Of course I will be sure to add an answer with his official word on the matter at that time.

sentences: Invert colors Java rendering I am making a 2d platformer in java using the slick2d engine. I only use 2 colors: black and white. I want to implement a feature were i invert the colors of certain entities. However i can't find a way to do this. Anyone knows of an easy way or function?

sentences:
Unity. C# help with arrays and letter placement Think about this like "Guess the word" game: W _ _ _ _

I have a word that i separate in index - letters like this:

public static string[] splitWord;
word = "WORLD";

string[] splitWord = new string[word.Length];
for(int i = 0; i < splitWord.Length; i++)
    {
        splitWord[i] = word[i].ToString();
    }

This way when i print the splitWord variable

for(int i = 0; i < splitWord.Length;i++)
    {
         print(splitWord[i] + " " + i);
    }

i get this;

 W 0
 o 1
 r 2
 l 3
 d 4

In my Ui i have letters, when i choose one i check if the letter is in the word, this part is done.

public static void SetWord (string letter)
{
    if (GameController.word.Contains (letter)) {
        word.text += letter; ------>setting the word NOT in order
    } else {
        Debug.Log("Letter is not in the word");
    }

}

What i´m having problems with is to place the letter in the correct place of the word.
What i want to do is, based on this:

 W 0
 o 1
 r 2
 l 3
 d 4

Is to check "ok this letter is on the word, what index in the Word does this letter has?, place the letter in the correct place". That is the idea. but because im pretty new to code in general i m having problems with this.
The idea is to convert that array of stings into a hole string and use Insert() to place the letter in the correct spot.

Any ideas?

Thanks in advance for the help.

sentences:
How to render multiple projections of an object? I want to display multiple projection of an object on the same screen. The projection should also change as the body rotates, kind of a dynamic projection of the body.

I am trying to make a character for pyramid hologram (as it has been named) which needs the projections.

Here is an example found on the Internet:

(Image source)

sentences:
How to design a class for an object that its state varies over time I have a soccer team with 14 players (11 active + 3 substitutes). The team is going on a tour participating in different matches across the world. I have two very different design ideas of how for the classes for such match, and I am wondering if there is a better approach here. The language is Python and the database is Mongo.

My requirements:

At any time during a match, I want to know the current status of a player. (substitutes, active, injured) as well as their penalty cards if they got any. If they are actively playing, I want to know when they started. If they got back to sitting or got injured, I want to know their most recent start time and end time.
I want to be able to retrieve the information about a past match. For any player in a past match, I only need to know their latest status (as described above)

Here is my idea about db collections:

Players collection:
- Player ID
- Player Name
- Player Tshirt Size

Teams collection:
- Team ID
- Team Player IDs []
- Team Name
- Team logo

Matches collection:
- Match ID
- Team ID
- Match Location
- Match Time

Match Participants collection:
- Player ID
- Match ID
- Latest Status
- Latest Start Time
- Latest End Time
- Latest Penalty Card
- Latest Injury Note

As you see, I tried to separate the static information about a player (Players collection) from their dynamic information in a match (Players History collection) but I not sure how to define classes?

Class Player:
- Player ID
- Player Name
- Player Tshirt Size
- Latest Status
- Latest Start time
- Latest End time
- Latest Penalty Card
- Latest Injury Note

Class Match:
- Match ID
- Player IDs []
- Match Location
- Match Start time
- Match Tshirt color

The second option would be creating another class for the dynamic part to match to my db collection:

Class Player:
- Player ID
- Player Name
- Player Tshirt Size

Class Match:
- Match ID
- Player IDs []
- Match Location
- Match Start time
- Match Tshirt color

Class Match Participant:
- Player ID
- Match ID
- Latest Status
- Latest Start time
- Latest End time
- Latest Penalty Card
- Latest Injury Note

I do not know how I should decide which approach is better. I would appreciate if you help me figure out the approaches pros and cons or even just what criteria I need to think about when deciding between the two.

Is there any design patterns that would describe any of these approaches?

sentences:
LibGDX. How to fill background with shader? I want to make background of my game like lava via perlin noise.
I've read some tutorials but they were too old and some api calls aren't exist already.
If I understand right in libgdx I need to create a runtime-generated texture (FrameBuffer) on x=0 and y=0 with width=Screen width and height=Screen height and apply shader to it.

I tried to do:

class A extends ApplicationAdapter {
    FrameBuffer   background;
    ShaderProgram shaderProgram;

    public void create() {
       background = new FrameBuffer(
           Pixmap.Format.RGBA8888,
           Gdx.graphics.getWidth(),
           Gdx.graphics.getHeight(),
           false
       );
       shaderProgram = /* stuff to pickup .vert and .frag */
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        background.begin();
        batch.setProjectionMatrix(
          new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())
        );
        batch.begin();
        batch.setShader(shaderProgram);
        batch.end();
        background.end();
    }
}

My shaders are simple red fill programs:

//Vertex
attribute vec4 a_position;

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_Position = u_projTrans * a_position;

    v_Pos = gl_Position;
}

//Fragment
#ifdef GL_ES
    precision mediump float;
#endif

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

Nothing has been drawn. I expect that all my viewport become red

Function that picks up shaders is working, i tested at sprites

sentences:
What component should hold the character movements in ecs and fsm? In the below code, there's a FSM for CharacterState that will be handled also in CharacterSystem. The problem was, I don't know what component should hold movements data to process in CharacterState or CharacterSystem

public class CharacterState implements State<Entity> {
    STANDING,
    WALKING,
    RUNNING,
    IN_PAIN,
    DEAD
}

public enum Movements {
    STAND_STILL,
    MOVE_UP,
    MOVE_DOWN,
    MOVE_LEFT,
    MOVE_RIGHT,
    MOVE_UP_RIGHT,
    MOVE_UP_LEFT,
    MOVE_DOWN_RIGHT,
    MOVE_DOWN_LEFT;
}

CharacterComponent implements Component {
    Movements movement
}

MovementComponent implements Component {
    Movements movement
}

AnimationComponent implements Component {
    IntMap<Animation> map = new IntMap<Animation>();
}

animation.map.put(Movements.MOVE_UP.order, ASSET.CHAR_MOVE_UP);

sentences:
Flicker when drawing multiple shapes over image based texture I'm rendering video frames with multiple color filled shapes over it using SharpDx and D3D11.

Rendering seems to be fine when just rendering the video frame and is as expected.

Now if i draw a single color filled shape it is drawn and rendered as expected.

Hoever, the problem occurs when I'm trying to render more than one color filled shapes over a video frame texture.

Apart from first  colored shape , all other shapes drawn flicker when rendered thus showing the pixels under neath which are the pixels for the rendered video frame.

Any ideas as to why does this occur ?

If any more information is required then do let me know.

P.S. Using ShaprDx and Directx11

Thanks.

Edit:
It seemed to be due to rendering the color filled shapes with the same z order as the underlying texture.

This was resolved with recommendation from another forum available here as long i'm just drawing a shape filled with color but when i'm filling the quad/shapes with textures the problem is still there.

I have also tried to set the ZOrder for the each of the shapes to be different yet the problem is still there.

sentences:
XNA game loop Update and Draw I'm confused on how the game's methods are called and when.

So I read that the sequence is:

Initialize
LoadContent
Update
Draw
UnloadContent

Where 3 and 4 are the game loop, so after Update is called, Draw is called, then Update, then Draw, and so on. The game loop (Update and Draw) is executed 60 times per second.

Then I read in another place that Update and Draw can be invoked at different times and Update may be called more then one time before Draw and so on.

... and at the end UnloadContent is invoked after the Update if the Exit method is called.

sentences:
XNA: Good way to queue up animations I'm writing an AnimatedSprite class that has an Animation object (which itself contains a sprite sheet).

The AnimatedSprite plays certain animations during key input. My problem is that how do I cycle from one animation back to the original ? Is there a good method to do this?

Here is my Animation class. The AnimatedSprite just calls PlayAnimation

public class Animation
{
    public SpriteSheet SpriteSheet { get; set; }
    public bool IsActive { get; set; }
    public float FramesPerSecond { get; set; }
    public bool IsLooping { get; set; }
    public int FrameCount { get; set; }

    private int CurrentFrame { get; set; }
    private float ElapsedTime { get; set; }
    private float TimePerFrame { get { return 1.0f / FramesPerSecond; } }

    public Texture2D Texture { get { return SpriteSheet.Texture; } }
    public Rectangle Rectangle { get { return SpriteSheet.SourceRectangle(CurrentFrame);} }

    public Animation(SpriteSheet sheet)
    {
        SpriteSheet = sheet;
        FramesPerSecond = 20f;
        IsActive = true;
        IsLooping = false;
        FrameCount = SpriteSheet.NumberOfSprites;
        CurrentFrame = 0;
        ElapsedTime = 0;
    }

    public Animation(SpriteSheet sheet, int fps) : this(sheet)
    {
        FramesPerSecond = fps;
    }

    public virtual void Update(GameTime gameTime)
    {
        if (!IsActive)
            return;

        ElapsedTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

        if (ElapsedTime > TimePerFrame)
        {
            CurrentFrame += 1;//move frame ahead one
            if (CurrentFrame >= FrameCount)
            {
                CurrentFrame = 0; //reset the animation;
                if (!IsLooping)
                    IsActive = false;
            }

            ElapsedTime -= TimePerFrame;
        }
    }

}

sentences:
What algorithms exist for generating collision geometry from an image? I am currently working on a game using SFML and Box2D. I am interested in generating collision geometry from the sprite data that I load into SFML. So, for example, an algorithm that would do this would take an image and find the edges (for example where the alpha area starts) and then generating a polygon that fits to those edges.

Can I be pointed to any resources that describe an algorithm to do this?

sentences:
Is there any difference between storing textures and baked lighting for environment meshes? I assume that when texturing environments, one or several textures will be used, and the UVs of the environment geometry will likely overlap on these textures, so that e.g. a tiling brick texture can be used by many parts of the environment, rather than UV unwrapping the entire thing, and having several areas of the texture be identical. If my assumption is wrong, please let me know!

Now, when thinking about baking lighting, clearly this can't be done the same way - lighting in general will be unique to every face so the environment must be UV unwrapped without overlap, and lighting must be baked onto unique areas of one or several textures, to give each surface its own texture space to store its lighting.

My questions are:

Have I got this wrong? If so, how?
Isn't baking lighting going to use a lot of texture space?
Will the geometry need two UV sets, one used for the colour/normal texture and one for the lighting texture?
Anything else you'd like to add? :)

sentences:
How should I implement an Observer patter in the following example I am wondering how I implement an observer pattern in the following example. I am mostly wondering what should be in charge of subscribing.

The Example

A factory produces cars (Observable), they drive from A to B. Once at B the car has finished.  The scoreboard increases by +1 (Observer).

The Solution?

Option A.) The factory spawns a car, it then calls a method to subscribe the car to the scoreboard

observableCar.FinishedEvent += observerScoreboard.HandleEvent;

Option B.) Should the cars on being created register / tell the the scoreboard to subscribe itself to it the cars finishedEvent()

this.FinishedEvent += observerScoreboard.HandleEvent;

Option C.) The scoreboard is subscribed to a 'carSpawned' event on the factory. On recieving this event it then subscribes itself to the cars finishedEvent(). It then unsubscribes.

Option D.) I am missing something fundamental about the observer pattern, do more homework

I'm thinking its something more akin to option C? I'm not sure.

Thanks very much

Jim

sentences:
Creating trading card board layout in libgdx I wanna make a trading card game using libgdx. I have a general idea about how to implement the server side of the game and the game rules, but I don't know how to design the visual interface of the game (in the client side). I want to
create a layout similar to the one in the image below, but quite a bit simpler. I don't have an idea of how to do it though. I'm thinking of using scene2d and Table  and have a row the opponent, one for the player and two for the creatures and then each cell is a card/creature. Is that a good way or is there a better way?

sentences:
Bizarre Physics FixedUpdate Lag spikes So I have this large forest of around 2M tris:

Same chunk selected with view on the whole level:

It's been generated within Blender and exported as fbx into Unity. Exporting each tree as an individual object is very performance expensive so the whole forest is split into 2 Objects: Treetrunks and leaves. The Treetrunks all have meshcolliders on them, the leaves obviously don't. (However I do split the forest into chunks as seen above, each chunk roughly 400k tris)

When the Player gets outside visible range of the forest it is disabled, and enabled when the Player gets within a certain range. When it is enabled sometimes it causes a massive lag. When looking into the Profiler it shows this:

Physics? FixedUpdate? The leaves have absolutely no colliders on them, why does it take up Physics.Processing? So I wanted to search further what part of Physics.Processing takes up so much processing time but the top process already shows nothing:

I have an 8 year old GTX760 but it still manages to render the entire forest at 200fps so no, the 2 million Tris are definitely not overkill for my computer.

I've tried this and that and 3 things managed to stop the issue (as seen in the profile screenshots above, the Physics processing time significantly reduced a few frames later)

Pausing & Unpausing the game or simply Alt-Tabbing outside the Unity Player and back (not always effective)
Disabling the Player & Reenabling it (almost always effective)
Starting the Scene with the Player (including Rigidbody, Camera and raycasting scripts) disabled and enabling him a few seconds later via script.  (almost always effective) However this only worked if ALL of the forest was set active (roughly 2M tris). If half the forest was disabled on start, and activated after the Player was enabled: LAG.

The Player is the only thing in the game (at this moment) that has a Rigidbody, Raycasting Scripts and a camera.

Things that didn't work:

Waiting a few minutes
Disabling & Reenabling the Players Character Controller at any time
Disabling & Reenabling the camera on the Player at any time.
Disabling & Reenabling the fucking trees

Anyone got an idea? I'm dumbfounded over here.

sentences: What project template to use for an 8bit RPG? Should I use a 2D or 3D dimension for an 8-bit RPG game in Unity? I have been searching and I haven't found anything on this yet. Can anyone please tell me the better option because sometimes people recommend to do 3D just in case, but I don't want to mess anything up later on.

sentences:
Unity 2D C# Enemy Attackng Ai issue Ok to be specific, both of my enemies will continuously play their attack animation even when it is false. I don't understand what I am doing wrong here :(

void OnTriggerEnter2D(Collider2D other){
    //If attack collider is player and we're not attacking
    if (other.name == "Player" && !attacking) {
        attacking = true;
        attackTimer = attackCD;
    }
    if (attacking)
    {
        if (attackTimer > 0)
        {
            Debug.Log ("Decreasing");
            attackTimer -= Time.deltaTime;
        }else if (attackTimer == 0)
          {
            attacking = false;
            Debug.Log ("Done attacking!");
            //attackTimer = attackCD;
          }
    }
}

anim.SetBool ("Attack", attacking);//This sets the animation but it is in my Update function not my OnTriggerEnter2D function

sentences:
Is it possible to gain performance by omitting vertex normals in the GPU pipe? I am working on a rendering problem where I want to render as many raw triangles to the screen as I can with either OpenGL or DirectX with the absolute fastest performance possible.

I wondered about omitting vertex normals completely and only transforming vertex positions during the vertex shader stage.

1)  Is this possible?

2)  Is it actually going to increase performance --or-- is the "bare metal" of the GPU designed in such a way that trying to omit normals won't gain any more throughput?

p.s.  Yes, I realize that omitting normals will leave you with the problem of how to shade the triangle during the shader stage, but I could at least render a solid color to the screen (no shading).  At this point, all I'm wondering about is how much data I can eliminate from the typical pipeline to increase the pipeline throughput to the absolute maximum.

sentences:
Character controller passes through mesh collider I need a little help figuring out what's going on with an NPC's character controller. Here are the character controller settings for the NPC.

The problem I'm running into is that the NPC isn't walking up a slight gradient as it should; instead, it moves through the ground.

Below are the settings for the ground.

The NPC isn't on the ground- it is a few units off. Any help is greatly appreciated.

Thanks in advance...

sentences:
Scene2D: How to use Image.setDrawable() I'm trying to change the texture of an Image actor on my Scene2D stage, however I can't seem to get it working. It seems like setDrawable() doesn't really do anything.

For example, this will make the texture of the Image cookie.png:

Image itemImage = new Image(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("cookie.png")))));
itemImage.setPosition(10, 10);
getStage().addActor(itemImage);

However, this will not:

Image itemImage = new Image();
itemImage.setPosition(10, 10);
itemImage.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("cookie.png")))));
getStage().addActor(itemImage);

Am I missing something?

sentences:
What technology does Starcraft 2 use render its maps? I've got a map that is being procedurally generated at run-time and I'm currently investigating methods of rendering this map.
I've taken an interest in the look of Starcraft 2 and I'd like some advise on what methods it employs to achieve it. Secondarily, I'd like to see any tutorials, articles, or even source code examples if possible.

There are a couple of main things I'd like to get some advise on, but please also feel free to suggest anything else that could help me.

Snappable Tilesets - A typical starcraft map seems to consist of a tileset of models that one can snap together to create the cliffs, ramps and other elevated terrain. What methods do they employ to make them look so natural? What I mean is, its very hard to spot repetition.
Terrain Textures - The terrain textures are so varied and even dynamic (Zerg creep). What methods are used to do this?

Thanks.

sentences:
How can I calculate an octree node's depth from its location code? The article Advanced Octrees 2: node representations states:

  The AABB (axis-aligned bounding box) of the node can be stored explicitly as before, or it can be computed from the node’s tree depth stored implicitly inside the locational code. To derive the tree depth at a node from its locational code a flag bit is required to indicate the end of the locational code. Without such a flag it wouldn’t be possible to distinguish e.g. between 001 and 000 001. By using a 1 bit to mark the end of the sequence 1 001 can be easily distinguished from 1 000 001. Using such a flag is equivalent to setting the locational code of the Octree root to 1.

The book Real-Time Collision Detection, Volume 1 by Christer Ericson states:

  The size of a node can be explicitly stored or it can be derived from the "depth" of the locational code. In the latter case, a sentinel bit is required in the locational code to be able to distinguish, say, 011 and 000000011, turning these into 1011 and 1000000011, respectively.

Both offer the following algorithm for computing the depth of a node:

int node_depth(unsigned int key) {
    for (int d = 0; key; ++d) {
        if (key == 1) { return d; }
        key >>=3;
    }
    assert(false);
}

How and why does this work?

The location code is a 32 bit word. That is, ... 011 and ... 000 011 might be equal, depending on what the remaining bits of the first location code are. using a sentinel, one has ... xx1 011 and ... xx1 000 011 and now they are different location codes.

What I don't understand is how can I get the depth of the nodes from the location codes and how does the sentinel help me with that.

Going back to the example above, ... xx1 011 and ... xx1 000 011, these words could be ... 000 001 011 and ... 000 001 000 011, respectively. Both cases have the sentinel bit, but since 001 (and any other xx1 combination) is a valid triple, all triples are valid, and there is no way for me to tell what the depth of the nodes is.

The only solution I've found is to store the depth of the node next to the location code, but that article and the book seem to indicate that the depth can be derived from the location code somehow.

sentences:
Steelseries Stratus XL controller: Keycode for middle button I'm working on an Android app (Java, level 19+) that uses a controller to e.g. walk and it's working (almost) fine with both the Steelseries Stratus XL and the Moga Pro Power. The only problem is that the Stratus XL has a button in the middle (the one with the circle: click) that closes the app.

I now want to disable that but I have no idea what the keycode for the button is and it also doesn't say anything about it on the official Steelseries homepage.

Has anyone here worked with the Stratus XL before and knows what keycode to use?

sentences:
Maintaining frame rate while using many High Resolution models I have shelves "made of" steel rods as a 3D-file. So a lot of virtual metal rods make up a cage. When cloning this in unity a few times even my fast computer can only show this in a choppy way. But using an opacity map yields a flat result, which I don't want. For realism purposes there should be cylinders or similar, i.e. real 3D objects or the impression of real 3D objects, at least in close range.

How could I do that with more shelves without making the frame rate drop considerately?

I found that even though I am using opacity maps(128 x 128) just ten shelves and even 3dsmax begins stuttering.

EDIT: I uploaded a demo, it's for Win, X86 and X64. Get it here: http://www.sockshare.com/file/08BD739BDF94601C You need the opensource 7zip to extract.

sentences:
Why don't I have some settings in GameMaker? I recently bought GameMaker for Mac, however upon watching a few GameMaker videos I've realized that I don't have all options available.

For example, in "Sound Properties" in other videos people have the option to change the volume and the pan, whereas I don't.

Does anyone know why this is happening?

sentences:
How to code shaders in C# without resorting to other programming languages? I'm working on game and game engine and want a way to prototype shaders. I'm not skilled with C++ or GLSL or HLSL or STH, but I can code in C#.

My question is: How can I code shaders in C#, without using the other mentioned languages?

sentences:
Make a 2d top down game with round map Currently, I am making a top down game using Unity. Here is the problem that I’m trying to solve: The player in my game is always centered on the screen, and the since the map is rounded, the agents controlled by AI must acts and be shown base on the distance of the round map. Here is the sketch for the better explanation.

I want to ask for a good way to design and implementing the above task.

And here is my approach for this task:

I split the map into 4 areas (could be smaller and more in number).
Each of the 4 areas will have its corresponding area outside of the map area (The outside map areas are trigger boxes).
When the area that is covered by the main camera has its parts out of the map area, these outside parts will active the trigger boxes that are overlapped by them.
When a trigger box is activated, all the agents in its corresponding area inside the map will be moved temporally to the trigger box area. This can be done just by adding the difference between the trigger area position and the inside map area that the agent is staying to the agent’s position.
When the area that is covered by the main camera no longer overlap the trigger box, all the agent will move back to its corresponding position inside the map. This process is done by reversing the moving out process.

Here is the sketch for this.

And the flawless come when there are agents with the flocking or forming formation behavior that requires the agents to have connections with others. When an agent is moved out of it actual position, the other agents in the formation will lose their connection with the moved agent (Like the distance between them suddenly becomes large). I think that this could be somehow solved by storing the actual position of the agent and marking it as moved, but it may be too computational cost, or having too many cases.

I tried to think of a different approach, that the map border is a circle, and to show the round view is just needed to take the symmetric through the center of the map. However, the circular border shows a bad animation when the agents try to move through the border.
(I don't have enough reputation attach image about the flocking behavior problem and the circular approach, so you have to imagine it)

If you can solve the problems that I mentioned above or have a different approach, please show me. Thank you.

sentences:
2 cameras that each player sees through a different one Im very new to Networking in Unity 5.
Im trying to bring the finished basis for my 2 player, 1 vs 1, turn-based game I made for local multiplayer (both players on same computer) to an online matchmaking system.

In the game currently (for local), there are 3 cameras.
2 centered on separate canvases for selecting attacks for each player.

that once p1 chooses his attacks and presses continue, the camera is deactivated and the 2nd camera for p2's attacks is activated.
Once p2 presses to continue the 2nd cam is also deactivated

and the 3rd cam is put on, this camera is set on the battle arena and plays out in turns the moves picked by the 2 players through a turn-determining system.

What I want to do for the online is have both canvas cameras activated at the same time and each player to be assigned to a different camera.
So is there a good way i should do this? NetworkView on one of the cams?
Hope I explained the premise enough :P

sentences:
Rigidbody freeze rotation around global Y My player is a cube that moves in all directions, but cannot jump. I want to achieve that the cube cannot rotate around global Y axis, but can rotate around global X and Z. This cannot be simply done by freezing the local Y rotation, since the cube can fall from higher ground and rotate mid-air - after that the local and global y axes are not parallel anymore and some other axis should be frozen.
Currently, I am using this line:
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(transform.rotation.eulerAngles.x, Mathf.Round(transform.rotation.eulerAngles.y / 90) * 90, transform.rotation.eulerAngles.z), 1f);

which is located in the FixedUpdate(). The resulting movement is shown in this video. Clearly, this always snaps the axis that is parallel to the global Y to the closest 90° angle. This solution, however, has a few unwanted side effects. One of them is clipping with the terrain or other player cubes, the second one is that the cube randomly rotates if walking over the edges or corners, and the third one is that if one cube is on top of another and both have this script attached, they start lagging, jittering and sometimes spinning.
I also tried by freezing the rotation based on what side of the cube is "on the bottom", but this does not work OK, since it often happens that the cube does not rotate for exact 90° when it drops from higher ground and ends up frozen standing on only one edge, just slightly off from being on the ground with the whole bottom side.
What is the "to go" solution for this type of movement?

sentences:
Seeking Advice: Collision with JBox2d for Top-Down or Isometric Maps I Hope I can make this as clear as possible!

Currently working on an action RPG game, very early stages, more just the basic ideas down and written in. So i'll start on with my setup:

Using Java with LibGDX
Map creation is done with TILEd
Style of map: Isometric

Collision Engine? ... well this is where I need a bit of guidance and advice.

LibGdx is linked in with Box2d which makes it . I'd personally love to use Box2D, more because I've played around with it on a platform level and I liked how it operated with force and impulses etc, however, it seems to be created for only platform style games. So I guess one questions is: Can Box2d's properties be easily changed to support a Top-Down collision system or an Isometric collision system?

I have tried to implement Box2d into a top down game before by setting the gravity to zero, but with no gravity, the other entities on the map just float. (You bump into them and they just start... floating!)

What I was originally thinking was once I have my map created in TILEd, I would start adding a collision layer (Or modify the tiles individually) to mark what is passable and what is not. I have seen examples for box2d (again Platform only however) ways to create an Object in TILEd to mark the collidable wall or floor and when loaded it would create the shapes. Box2d would be perfect if it wasn't for the whole floating entity due to zero gravity.

So what I am looking for...

1) Is there a way to create Box2D work on a Top-Down set up without entities floating?

2) If not, what other solutions do I have for collision?

If there is any other information needed for a better response Please let me know!

Thank you!

sentences: Checking bounds of a quad I want to know how would I tell if a quad touches another quad in my game built in Slick2D. I have a class that I named "Bounds" which has 4 "Point" objects which just store an X and a Y value and a "Bounds" object stores 4 "Point"s. Simply it has 4 2D vectors, one stores the top left, another stores the top right, another stores the bottom right and the other stores the bottom left. I need to be able to check if two quads based of those 4 coordinates are inside each other. Does anyone have an idea of what I should do?

sentences:
How is a gimbal connected with Euler rotation angles? When I see any video that explains how gimbal lock occurs, they explain it using a gimbal machine and I totally understand the effect on that machine. What I don't understand is how Euler angles are related to the idea how gimbal machine works.

And my #1 confusion comes from the following:

Euler angles rotate the coordinate frame but the axes stay orthogonal.
Gimbal circles rotate so that two rotation axes become collinear.

Hence I don't understand how gimbal mechanism can show how Euler angles work.

sentences:
Could I get in to trouble for "rickrolling" users in my commercial game? Not sure if this question is too stupid but, theoretically speaking...

Could you get into trouble for using something like Application.OpenURL in a commercial game to rickroll a player or would that be legally okay? (sorry this question is really stupid)

sentences:
How can I adjust my code to make the objects start dropping at a certain speed and then increase that speed over time? I'm making a game in LibGDX where the player dodges falling objects. At the moment, my code makes each object (in this case 'DROPS') fall at random speeds. I'm wondering if anyone can suggest how to amend this code to make all the objects start falling at the same speed and have this value increase over time. Here is my current code:

for (int i = 0; i < amount; i++) {
        float x = MathUtils.random(0, ManicMeltdowns.WIDTH - TextureManager.DROPS.getWidth());
        float y = MathUtils.random(ManicMeltdowns.HEIGHT, ManicMeltdowns.HEIGHT * 3);
        float speed = MathUtils.random(2, 5);
        addEntity(new Drops(new Vector2 (x, y), new Vector2(0, -speed)));
}

I assume you have to adjust 'float speed', but I'm not sure how.

Many thanks.

-Edit- Here is the drops class:

public class Drops extends Entity{

public Drops(Vector2 pos, Vector2 direction) {
    super(TextureManager.DROPS, pos, direction);

}

@Override
public void update() {
    pos.add(direction);

    if (pos.y <= -TextureManager.DROPS.getHeight()) {
        float x = MathUtils.random(0, ManicMeltdowns.WIDTH - TextureManager.DROPS.getWidth());
        pos.set(x, ManicMeltdowns.HEIGHT);
    }

}

}

And here is the entity class:

public abstract class Entity {

protected Texture texture;
protected Vector2 pos, direction;

public Entity(Texture texture, Vector2 pos, Vector2 direction) {
    this.texture = texture;
    this.pos = pos;
    this.direction = direction;
}

public abstract void update();

public void render(SpriteBatch sb) {
    sb.draw(texture,  pos.x,  pos.y);
}

public Vector2 getPosition() {
    return pos;
}

public Rectangle getBounds() {
    return new Rectangle(pos.x, pos.y, texture.getWidth(), texture.getHeight());
}

public void setDirection(float x, float y) {
    direction.set(x, y);
    direction.scl(Gdx.graphics.getDeltaTime());
}

}

sentences:
Physics simulation methods for large delta times? What physics simulation methods are most suitable for really big delta time (hours to weeks)?

In addition, would I face any problems combining different methods for big and small delta times?

sentences:
Java BufferStrategy Flickering I was watching a tutorial on using a BufferStrategy in Java and I wanted to test a very simple example. The issue is that it flickers intensely and it seems as if a piece of the starting oval stays on the screen. I know that the loop is a very bad practice but I just wanted to very simply test the BufferStrategy.

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferStrategy;

public class Game extends JFrame {
    private Canvas canvas = new Canvas();

    public Game() {
        setBounds(0, 0, 1280, 720);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        add(canvas);

        setVisible(true);

        canvas.createBufferStrategy(3);
        BufferStrategy bufferStrategy = canvas.getBufferStrategy();

        int x = 0;
        int i = 0;

        while(true) {
            i++;

            if(i == 10) {
                i = 0;
                x++;
            }

            bufferStrategy = canvas.getBufferStrategy();
            Graphics g = bufferStrategy.getDrawGraphics();
            super.paint(g);
            g.setColor(Color.RED);
            g.fillOval(x, 200, 50, 100);
            g.dispose();
            bufferStrategy.show();
        }
    }

    public static void main(String[] args) {
        new Game();
    }

}

sentences:
Change players state and controls in-game I'm using Unity 3D

Let's say the player is an ice cube. You control it like a normal player. On press of a button, ice transforms (with animation) into water. You control it completely different than the ice cube.

Another great example would be: Player is human being and has normal FPS controls. On press of a button human transforms into birds and now has completely different controls.

Now, my question is, what would be easier and better:

make one object with animation transition and to stay in that state of anim. until button is pressed again
make two object: ice and water. Ice has an animation of turning into water. So replace ice (with animation) with water object

And if anyone knows this one too: how to switch between 2 different types of player controls.

sentences:
Legal status of games with similar titles I've been working on a game for around a year and a half named Planetfall, in which you build a colony on a new planet.

I've bee working on it with that title since before the announcement of Age of Wonders: Planetfall. The games have some overlapping mechanics and aesthetic, but other than that it would be clear that my game is not a clone or a rip-off.

I know that I probably should change the name anyway (so there's no confusion between the titles) but I was wondering what the legal status is of a title that was in development since before the announcement of another similar title. If I decided to go ahead and not change the name, what could happen?

sentences:
How can I convert my list of vertices and indices to a list of triangles? I have a full 3D collision mesh that is represented by a list of vertices and another list of indices. I need to convert the list of vertices and the list of indices into a set of triangles.

First I tried to group every three vertices from the vertex list into a triangle, so vertices 0-2 were triangle 0, vertices 3-5 were triangle 1, etc. But that method did not produce the same triangles I see on the original mesh.

Then I remembered the indices list, but I didn't know how to use them. So I came here to ask: how can I use the indices list to make my list of triangles?

sentences:
Runtime Issues on 144Hz Monitors I've recently finished my first ever Unity game. The game runs okay in my end but two of my friends had issues with the game. They both have 144hz monitors and the issues are solved when they lower the refresh rate to 60Hz. The problems are that any object who has a velocity depending on Time.deltatime, it gets halved. Is there a way to fix this on code so that nobody has to reduce their refresh rate when playing?
Here is an example code of a snowball projectile's behaviour. The snowball usually stays alive for 3f seconds and that allows him to go across the whole screen but in 144hz runtime, the snowball goes really slow and it does not last enough to even get across the half of the screen.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Snowball : MonoBehaviour
{
    [SerializeField] private float speed = 20f;
    [SerializeField] private Rigidbody2D rb;
    [SerializeField] private GameObject impactEffect;

    // Start is called before the first frame update
    void Start()
    {

        Destroy(gameObject, 3f);
    }

    void Update()
    {
        rb.velocity = transform.right * speed * Time.deltaTime * 75;
    }

    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if(hitInfo.CompareTag("Player") || hitInfo.CompareTag("Enemy"))
        {
        Destroy(gameObject);
        Instantiate(impactEffect, transform.position, transform.rotation);
        }
    }
}

Here is my game if anyone is interested in further examination: itch.io link

sentences:
XNA 4.0 and Lidgren Library, How do I create a server/client hybrid? My use of terminology may be off a little bit. I have been playing around with the Lidgren XNA sample for how the library works, and it is simple to implement it looks like.

I am curious on the logic or theory behind making the game client also act as a server? Basically I want a user to open the game client and have the option of "Hosting a Game" which would allow others to connect to that computer and play multiplayer.

It was suggested that I use some sort of thread to kick off the server code in the background for that host client and then connect the two pieces together for full functionality.

sentences: Having player names over models in 3d space I wanted to have in my multiplayer game, the players name's over their models, however I am faced with the question of how? Should I create a new Canvas object for each game model or just use 1 main canvas and move their names around relative to position in 3D world space? My aim is to have an open world game.

sentences:
C++ unmanaged inside winform First: I am using C# and C++ on windows 7.

I have created a basic rendering engine in c++ with directx 10. It works good as a stand alone application. But, when I sending the Form.Handle of a WinForm I want to render inside to the engine it crashes during D3D10CreateDeviceAndSwapChain with the following error:

HRESULT: 0x887a0001 (2289696769)
Name: DXGI_ERROR_INVALID_CALL

I get the handle from the winform during loading of the form.

unsafe {
  void *ptr=m_view.Handle.ToPointer();
  uint v = (uint)ptr;
  lhandle = v.ToString();
};

sentences:
WinAPI SwapBuffers and Threads I'm trying to use a different Thread for the whole WinAPI-Message-Loop stuff, so the window always keeps being responsive. Of course I'm using the main thread as the "window thread", because I need a context before loading textures etc. and I can't just call Get/PeekMessage for a different thread.

Now there are a few things I'm wondering about though:

Can I use the OpenGL context handle from a different thread? I'm relatively sure I can since otherwise there would be no way to do multi-threaded rendering, but maybe there's more to it.
At some point I have to call SwapBuffers() from inside the render loop - that means in this case, from a different thread. Can I just use the HDC I usually use? Is this handle thread-safe? I'm not so sure about that, but I can't really find a definitive answer on the subject.

If the answer is no, what would be a good method to deal with the issue? Maybe I can send a message from the render-thread?

sentences:
What advantages does bare OpenGL provide over frameworks/engines to small developers? I've noticed a trend of indie developers steering away from frameworks and engines, and moving towards using bare OpenGL, or using it combined with SDL/SFML2. As an indie developer, I can't see what low-level OpenGL can offer over separate engines or frameworks.

Most decent engines and frameworks give the functionality that you need, and never get in your way. They might also open the option to deal with OpenGL directly. Some even offer the functionality to compile cross-platform!

I understand the aspiration to learn what is happening below the hood, but I can't see any upsides that OpenGL might offer to indie developers over engines or frameworks.

Could you explain the reasoning behind building games from scratch using OpenGL?

sentences:
C# - XNA - Making a Modular Screen / State Manager I'm not entirely sure how to ask this question since its somewhat broad, but also a bit specific to my code.

I'm making a game in C# XNA and attempting to have the parts of it be fairly modular so that they can be used in any other relevant programs I create down the road.  For instance, I have an InputHandler accessible from any class in my program that simply checks the state of the keyboard and mouse and has various methods to find out specifically if a key / button is held down, pressed, or released, etc.

The groundwork of my program was made by following these tutorials:
Part 1
Part 2
and Part 4

(Its not a mistake that I don't have a link to part 3 as that dealt with adding in Xbox 360 gamepad functionality only, which isn't something I needed in my testing.)

In those tutorials there is a GameScreen Game Component made which is what all the other screens / states inherit from.

The way the tutorial handles screen management is that a type of screen is created in the Game1 class and then only in the Game1 class can you Hide / Show a screen or change which screen is active.

For instance, when the program is first run in the LoadContent section of Game1 a StartScreen(which inherits from GameScreen) is created.  The StartScreen is then set to be the ActiveScreen and is set to Show.

My problem is that in my StartScreen I'm handling the checks for what menu option a user selects, but I can't actually hide the current screen and change to the one that was selected because that can only be done from the Game1 class.

I could just handle all of my input checking for the different screens in the Game1 class by using an if statement based on not only what menu option is selected, but also what screen is active, but that would mean a lot of clutter in my Game1 class and it would kind of ruin my goal of making my game components modular by having all of the stuff relevant to a given screen being handled within that screens code.

My question is essentially what I should do to address this...

I tried several times to make a separate ScreenManager Game Component that is accessible from everywhere much like my InputHandler, but each time that ended in disaster with numerous errors that I simply don't have the experience or grasp on lingo to troubleshoot.

My most recent attempt at making a separate one ended with me being able to choose which screen was active, but not being able to use the ".Hide()" method that is part of the GameScreen base class.  I also had numerous "accessibility" errors.

I also tried to simply make my screens themselves be public.  For instance, in my Game1 class I have variables for GameScreen activeScreen and StartScreen startscreen.  I've tried making those two variables be Public or even Public Static, but I still couldn't use them anywhere outside of Game1.

I've looked at numerous other posts and tutorials on making a Screen Manager or how to handle State Management, but that only served to confuse me more.  They were either WAY over my head, like the Microsoft State Management sample, or they were understandable and working, but far too different from the one I have now for me to grasp how to apply it to my current code.

Is there something easy and obvious that I'm stupidly overlooking or is there some key concept at work that I'm unaware or failing to grasp?

Or am I going about it all in the wrong way entirely?

sentences: Fight with creativity burnout I have big creativity burnout :/ Do you have any ideas how can I fight with it ??

sentences:
How can I move an object the fastest way? How can I move an object the fastest way?
What I'm trying to do is to make an object pass by at speed that you almost cannot see - like an airplane that moves from side to side in very high speed.
Here is my code:
transform.position = Vector3.MoveTowards(transform.position,
            stopPoint, Time.deltaTime * ms);

sentences:
How to implement this collision detection function? I would like to know how to implement this collision detection function, but I'm not even sure what it's called.

The input shapes are 2D convex polygons, with an optional "rounding radius": imagine putting a circle on each vertex of the polygon, and filling in the area between them.

I already have a function that uses SAT to tell if they intersect (and return a minimum correction vector), but I also need a function that takes two of these shapes, A and B, and a unit direction vector. It should tell whether A will ever touch B if it moves along the direction, and if so, report how far it could move and the surface normal where they would touch.

So how would that be implemented, or at least how is it called, so I could search for hints?

sentences:
OOP architecture problem between Camera, Player, Weapon I am making an FPS game in Unity, trying to keep myself to OOP principles as much as I can but I found dead-end.
I want to add recoil to my game, now logically thinking the amount of recoil should be stored in the Weapon instances, but the recoil itself should be done by the Camera. The problem here, it doesn't make sense for the weapon to have a dependency towards the Camera, I think this could cause trouble down the line. I thought of making an Action (observer pattern), where the Weapon is a broadcaster while the Camera is an observer.
The problem here is there will be multiple players, so the Camera instance shall know if it's their Player who made the shot (the weapon would broadcast it's Player reference as well), so in order to do this, every Camera should store a reference to their own Player which again brings the problem I described with the gun. The Camera shouldn't have a reference to its player, for example, if I later want to add the ability to spectate a game, this would cause problems.

So the Player can have a Camera dependency
The Camera shouldn't have any dependencies
The Weapon can have a Player dependency

How would one go about implementing this recoil, how could I avoid the problems I've described?

sentences: What is the difference between a Facebook Canvas and Facebook Web project? I am making a game on cocos2d-JS for Facebook. What is the difference between Facebook Canvas & Facebook Web project. From what I can tell, Facebook Canvas ask for the secure url and Web ask for the site URL.

sentences:
Blendshapes in Unity vs Blender I have a model from a package that has existing Blendshapes that work fine.  I'm a bit of a Blender newb, though. I'm trying to add a Blendshape for spikiness to a cube model.  It's early WIP, but it looks roughly the way I expect it to in Blender.  However, when exported and imported into Unity, the mesh with the blendshape applied isn't quite right - the spikes are sort of... plump, as if it isn't quite changing the vertices the same way.  Is there anything specific that needs to be done with this process?  Am I missing something, or is there some tuning I need to do in Blender prior to exporting the FBX?
Blender: http://www.labyrintheer.com/wp-content/uploads/2020/08/spike_bs_blender.mp4
Unity: http://www.labyrintheer.com/wp-content/uploads/2020/08/spike_bs_unity.mp4

sentences:
Rotating multiple points at once in 2D I currently have an editor that creates shapes out of (X, Y) coordinates and then triangulate that to make up a shape of those points.

What will I have to do to rotate all of those points simultaneously? Say I click the screen in my editor, it locates the point where I've clicked and if I move the mouse up or down from that point it calculates rotation on X and Y axis depending on new position relevant to first position, say I move up 10 on the Y axis it rotates that way and the same way for X. Or simply, somehow to enter rotation degree: 90, 180, 270, 360, for example.

I use VertexPositionColor at the moment.

What are the best algorithms or methods that I can look at to rotate multiple points in 2D at once?

Also:

Since this is an editor I do now want to rotate it on the Matrix, so if I want to rotate the whole shape 180 degree that's the new "position" of all the points, so that's the new rotation = 0 for example. Later on I probably will use World Matrix rotation for this, but not now.

sentences:
Creating a frozen bubble clone This photo illustrates the environment: http://i.imgur.com/V4wbp.png

I'll shoot the cannon, it'll bounce off the wall and it's SUPPOSED to stick to the bubble. It does at pretty much every other angle.  The problem is always reproduced here, when hit off the wall into those bubbles. It also exists in other cases, but I'm not sure what triggers it.

What actually happens: The ball will sometimes set to the wrong cell, and my "dropping" code will detect it as a loner and drop it off the stage.

**There are many implementations of "Frozen Bubble" on the web, but I can't for the life of me find a good explanation as to how the algorithm for the "Bubble Sticking" works. **

I see this:
http://www.wikiflashed.com/wiki/BubbleBobble
https://frozenbubblexna.svn.codeplex.com/svn/FrozenBubble/

But I can't figure out the algorithims... could anyone explain possibly the general idea behind getting the balls to stick?

Code in question:

    //Counstruct our bounding rectangle for use
    var nX = currentBall.x + ballvX * gameTime;
    var nY = currentBall.y - ballvY * gameTime;
    var movingRect = new BoundingRectangle(nX, nY, 32, 32);
    var able = false;

    //Iterate over the cells and draw our bubbles
    for (var x = 0; x < 8; x++) {
        for (var y = 0; y < 12; y++) {
            //Get the bubble at this layout
            var bubble = bubbleLayout[x][y];
            var rowHeight = 27;

            //If this slot isn't empty, draw
            if (bubble != null) {
                var bx = 0, by = 0;

                if (y % 2 == 0) {

                    bx = x * 32 + 270;
                    by = y * 32 + 45;

                } else {
                    bx = x * 32 + 270 + 16;
                    by = y * 32 + 45;
                }

                //Check
                var targetBox = new BoundingRectangle(bx, by, 32, 32);
                if (targetBox.intersects(movingRect)) {
                    able = true;

                }
            }

        }

    }

   cellY = Math.round((currentBall.y - 45) / 32);

if (cellY % 2 == 0)
    cellX = Math.round((currentBall.x - 270) / 32);
else
    cellX = Math.round((currentBall.x - 270 - 16) / 32);

Any ideas are very much welcome.

Things I've tried:

Flooring and Ceiling values
Changing the wall bounce to a lower value
Slowing down the ball

None of these seem to affect it. Is there something in my math I'm not getting?

sentences:
Dividing coordinate into unit cube I'm trying to write a Java class to generate Perlin Noise from a Cartesian coordinate. I'm trying to follow this tutorial but I am struggling to understand the theory.

Specifically, how do you divide coordinates into a unit square or unit cube?

My original though was to a find which was higher the X or Y, then divide one by the other, So either X = 1, y < 1, or Y = 1, X < 1. But doing this doesn't really make sense as the point would always lie on one of the cube/square vertices.

Can someone explain the math to me please.

sentences:
My GameObject keeps spawning when it shouldn't I'm trying to instantiate a new gameObject when the current gameObject gets to a select point. The problem comes when the program gets to the second if() statement. It sets the floorsSpawned to 1 and when it does, the game object instantiates a bunch of times. Shouldn't the floorSpawned be set to 2 in the first if() statement and only instantiated once?

public class FloorMovement : MonoBehaviour
{

    public GameObject floor;
    [SerializeField] int speed = 10;
    public int floorsSpawned = 1;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.left * Time.deltaTime * speed);

        if (transform.position.x <= -18.0 && floorsSpawned == 1)
        {
            floorsSpawned = 2;
            Instantiate(floor, new Vector2(11.5f, -2.0f), Quaternion.identity);
        }

        if (transform.position.x <= -40.25 && floorsSpawned == 2)
        {
            floorsSpawned = 1;
            Destroy(floor, 3);
        }
    }
}

sentences:
Should clients in an online game access the database directly or through a game server? first im total noob about c# and mysql. Just trying to find which way is better. i believe your answers prevents me from losing plenty of time.

Online game(not more than 50 users at pre-alpha. Not expecting than 500+ at the end.)
Text based game / console like ( minimum graphics )
PVP -> Players are able to destroy other players.
Simlpy a hacking simulation.
There will be some servers.(NPC servers and player made servers)
players can reach that servers made by other players.

Q: Which one is the good way to store that servers data?

game client --> Mysql server ?
or
game Client --> a Server Client(which is localy running a mysqL server)

If it's totaly wrong to use mysql server how can i make it?
Thank you...

sentences:
How can I have a Mecanim animation with displacement and physics? I have 3D wolf models from my animator with displacement (i.e the wolf transforms with animation, not in-place). I have added rigid bodies to the models. I am facing following issues while executing them in my project:

When I turn on IsKinematic on my rigid body (i.e disable physics) the animations work perfectly, with displacement. But I need to have physics enabled on my wolf because it doesn't detect collision when physics is disabled and gravity doesn't have any impact.
When turn off IsKinematic (i.e enable physics), the animations don't work; the wolf start wobbling and flying in the air.

How can I resolve this?

sentences:
How can I avoid a delay with continues touch detection in swift? I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves left or right. And as long as I hold my finger it continuous to move to the direction in that I swiped. When I swipe into the opposite direction of my last swipe without leaving my finger from the touch ground, my character should move into this direction. When I release my finger from the touch screen, my character should stops instantly.

My problem is that there is often a small delay within the change of direction. And this delay makes it less precise.

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    /* Called when a touch begins */
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        lastFingerPosition = location

    }
}

override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent){
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        if(location.x > lastFingerPosition?.x && lastMoveDirection != "right"){
            movePlayer("right")
        } else if(location.x < lastFingerPosition?.x && lastMoveDirection != "left"){
            movePlayer("left")
        }
    }
}

//@Todo: Wenn man touchMoved und nicht über dem Button hoch geht, wird die Action nicht aufgehoben
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        player?.removeAllActions()
        lastMoveDirection = ""
    }
}

func movePlayer(direction: String) {
    var player = self.childNodeWithName("man")

    if(lastMoveDirection != direction){
        player?.removeAllActions()
        lastMoveDirection = direction

        var duration:CGFloat? = 0
        var x = player?.position.x
        duration = x!

        if(direction == "left"){
            var xDestination:CGFloat = 10
            var run = SKAction.moveToX(10, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveLeft")
        } else if(direction == "right") {
            duration = self.frame.width - x!
            var xDestination = frame.size.width - 1
            var run = SKAction.moveToX(xDestination, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveRight")
        }
    }
}

sentences:
World Space canvas rendering in front of line mesh I'm attempting to attach a pointer to my steamvr controller to simplify world interactions. I'm very new to unity, but found a nice volumetric line asset (VolumetricLines) that aesthetically is exactly what I want. However, it seems to be rendering behind my canvas, as you can see here:

The canvas is set to world space with the event camera set to the VR camera, and renders properly for all world objects except this line. The line also renders properly with all objects except this canvas.

What exactly is the mechanic that causes the line to render behind the canvas, when it renders in front of other game objects, and what could I do to fix the render order?

sentences: Handling different version clients in a multiplayer game What are various ways of handling different version clients in multiplayer games? For example, when there's an update, some games allow you to play with people who have a different version of the client. How is this handled?

sentences:
Why translation uses multiplication and not addition? To translate an object from (x, y, z) to (a + x, b + y, c + z) it's done using:

OK, that's cool, but why would we multiply in the first place when we can add the two matrices directly as:

addition is faster and more effective, plus it's straightforward?

sentences:
Password-less player identification I'm working on the server side part of my game (develop your village/farm) and trying to build user identification system. I'd like to have a password-less mechanism: user downloads my app from the store, run it and that's all. He doesn't have to type any login or password. The game connects with the server requesting new player creation so he can start playing as soon as he opens the app.

I assume that this process is connected with GameCenter/GooglePlayGames. A game retrieves player ID from those services and then use it for future requests (saving user progress, game specific data - like village/farm facilities' positions, other information on my server). Is it a valid and safe assumption? If not can ask you to describe how it works/should be done?

I have some doubts regarding security? Single PlayerID seems to be quite weak solution, isn't it?

Edit:

I didn't mention it but I would like to move my progress from one device to another also without creation of any account with login and password.

sentences:
How to render top-down perspective in a tile-based RPG? My question is specifically about the type of perspective that GBA Pokemon games like Fire Red/Leaf Green have:

I'm not sure of the correct terms for what I'm trying to achieve.

I am using SDL2 and can render a tilemap and sprites on top of it, with basic collision detection, but since everything is constrained inside a tile, it looks like the player collides with a wall when their head touches it, rather than the feet.

The above screenshot has a tiny bit of perspective (is that considered 2.5d?), so the head of the player hides a portion of the tile above.

There are definitely ways to make this work, e.g. being a bit more lenient on collision (i.e. not the whole bounding box of the player but the middle of it collides with a wall), but my question is mostly about efficient rendering.

Is rendering from the bottom up the best thing to do so that I respect the perspective? If it is then I guess I need to know at which tile to render the player, so I need to compare every coordinate with the player coordinates to see if it's time to render the player?

sentences:
Normalize a rotation around the Z-axis (issue with GLM) I'm trying to undo some transformations coming from an external tool*. I'm getting different results depending on subtle differences in the input and wondering how to convert to a rotation about the Z-axis only.
The transformations are expressed as a matrix = translation * rotation * -translation.  I want to decompose the resulting matrix into a single translation and rotation around Z -- I know this is possible given the source material (2D plane).
My problem is coming from GLM decompose.  Given a matrix that looks like this:
[         -0.5 |     0.866025 |            0 |            0 ]
[    -0.866025 |         -0.5 |            0 |            0 ]
[            0 |            0 |            1 |            0 ]
[            0 |            0 |            0 |            1 ]

If I call decompose, then take the eulerAngles of the Rotation I end up with either:

(            0,           -0,      2.09439 ) from quat(          0.5,            0,     0.866025,            0 )
(      3.14159,       1.0472,      3.14159 ) from quat(          0.5,            0,            0,     0.866025 )

The difference depends on how the matrix was generated, whether the rotation was 120degrees or -240degrees. The display must be clipping the floating point, introducing a subtle change.
I'm assuming both these rotations are actually the same.
How do I force/convert the result to be a rotation about the Z axis only.

*The external tool is Inkscape which uses the CSS/SVG function rotate(r, cx, cy) instead of a rotation and transform.  That function results in the matrix: translate(cx,cy,0) * rotate(r, (0,0,1)) * translate(-cx,cy,0)

sentences:
Tank avoid other objects? My tanks working  good except one thing, they not avoid each other in good way. they not generate the path to find new good position. My tank follow it own agent position and direction. I add NavMeshObstacle fit the tank size. After all this, still I get some bad things. tanks hit each other, tank moving above other tank, some time get stuck between two tanks which lead to strange movement(shaking). example this tank on the middle.

what can I do to improve tank avoiding ?

sentences:
Floating point precision issue with Box2D I'm using Box2D and I am putting edge tiles as b2Bodies so that the tile world can have physics:

The problem is that there are 3 b2_kinematic bodies under the player right beside each other.
Every so often, he gets stuck like in this image (as if there were a very very small slope) and the player box gets stuck. I have to move him back a little to overcome it.
The player has fixed rotation which is what also causes this.
I'm not sure how to fix this.
Any ideas?
Thanks

sentences:
How to normalize the direction to check if the player is able to move? I have a room with 4 walls along the x and z axis respectively. My player, who is in first person (therefore the camera), should have collision detection with these walls. I'm relatively new to this so please bare with me. I believe the way to do this is to calculate the direction and distance to the wall from the camera and then normalize the directions. However, I can only get this far before I don't know what to do. I think you should work out the angle and direction your facing?

Here _dx and _dz is the small buffer in front of the camera.

float CalcDirection(float Cam_x, float Cam_z, float Wall_x, float Wall_z)
{
    //Calculate direction and distance to obstacle.
    float ob_dirx = Cam_x + _dx - Wall_x;
    float ob_dirz = Cam_z + _dz - Wall_z;
    float ob_dist = sqrt(ob_dirx*ob_dirx + ob_dirz*ob_dirz);

    //Normalise directions
    float ob_norm = sqrt(ob_dirx*ob_dirx + ob_dirz*ob_dirz);
    ob_dirx = (ob_dirx)/ob_norm;
    ob_dirz = (ob_dirz)/ob_norm;

Can anyone explain in layman's terms how I work out the angle?

sentences:
Correct order of operations in a platformer game loop I've run into an issue with my Mega Man engine, and the structure of my game loop is making it very difficult to fix. With Rush Jet, or any falling platform, Mega Man needs to stay attached to the platform as it falls. Right now the best I can do (without resorting to workarounds like magic forcefields that pull him down) has it so that he falls for a single frame when the platform first starts falling. But even this requires the falling platform to pull him down during the collision check. Without this extra step, he constantly "jitters" in falling as the platform descends.

The order of events in my game loop is making this happen. It goes like this:

Mega Man and Rush Jet are flying horizontally for a while.
Thinking phase: Player presses down - the platform decides to set its velocity to downward.
Action phase: Platform moves down, player has no awareness of this.
Reaction phase: The two are not colliding, so no "binding force" check can occur.
Next frame, Mega Man falls. A frame later, gravity catches up and he lands on the platform again, resetting his y velocity to 0.

You can see there the basic order of my loop:

Thinking phase, where you analyze collisions from the previous frame, and any other variables, to decide on state transitions and other adjustments.
Action phase - everyone moves according to their velocity.
Reaction phase - collision checks, adjust positions to fix them. This also handles effects like moving platforms, eg. push the player by some amount. The changes to his velocity are applied in the next frame, during the action phase.

I've tried reordering these steps and various other changes, but they all make the whole thing much worse, with all sorts of bugs. If I need to make sweeping changes to my engine to get these things right, I'd rather know what the "proper" way is before wasting any time.

I know one possible solution would be for the movement step to look at who was touching the platform in the previous frame and pull him then, so they actually move together. That seems too complex though, reaching between components like that. My engine code already feels way more complicated than the original game could have been, suggesting that I'm doing something wrong.

So is there a proper sequence of events? There's another question on here about moving things along with a platform, but that doesn't address the order of events issue which causes my problem. Also, if anyone actually knows the way the classic Mega Man games did it, that would obviously be a huge help.

Find as much of my code as you want at https://github.com/Tesserex/C--MegaMan-Engine/tree/master/Mega%20Man. The CollisionComponent and MovementComponent may be the most useful.

sentences:
Unity - Avoid using Find method by caching UnityObjects - Code review I'm trying to avoid using GameObject.Find during runtime to find particular GameObject components when wanting to instantiate them.

I have created a cache for the gameobjects from which I can either return the original instance or create a new instance.

Components which should only have one instance are returned by GetOriginal<UnityObject>

A new instance of an Original component is returned using GetInstanceOf<UnityObject>

public class GameObjectTools : MonoBehaviour
{
    static List<Object> gameObjectCache = new List<Object>();

    // This is called BEFORE Start() when the script is being loaded
    void Awake()
    {
        // Cache any GameObject classes that are required by other classes here
        gameObjectCache.Add(GameObject.Find("Timer").GetComponent<Timer>());
        gameObjectCache.Add(GameObject.Find("Object Rotator").GetComponent<ObjectRotator>());
        gameObjectCache.Add(GameObject.Find("Object Translator").GetComponent<ObjectTranslator>());
    }

    public static T GetOriginal<T>() where T : Object
    {
        int index = -1;
        int numObjects = gameObjectCache.Count;

        for (int i = 0; i < numObjects; ++i)
        {
            if (gameObjectCache[i].GetType() == typeof(T))
            {
                index = i;
                break;
            }
        }

        return index == -1 ? null : gameObjectCache[index] as T;
    }

    public static T GetInstanceOf<T>() where T : Object
    {
        var o = GetOriginal<T>();
        return o == null ? null : GameObject.Instantiate(o) as T;
    }
}

I'm slightly concerned that I am not approaching this problem in the right manner and was hoping for some feedback regarding my methodology.

Is there a more efficient or straightforward approach to achieve what I am trying to achieve here?

EDIT

public class Ball : MonoBehaviour
{
    int lifeSpan = 1000;

    void Update()
    {
        if (Timer.CurrentTime > lifeSpan)
            GameObject.Destroy(gameObject);
    }
}

public class GameObjectTools : MonoBehaviour
{
    public static Ball Ball;

    void Awake()
    {

        Ball = GameObject.Find("Ball").GetComponent<Ball>();
    }
}

If I call

var ball = GameObject.Instantiate(GameObjectTools.Ball) as GameObject;

anytime after the lifespan of the ball has expired then I will get a null reference error.

How then can I ensure that this doesn't happen while still being able to create new instances from a static cache?

sentences:
Time series for creating new events in a PVP game This is more like a mathematical problem, but I guess this is the best place to ask it.

I am working on a PVP concept and I have the following problem. There is a "battle" between two players that both have set their moves before the match starts. So, during the battle, they just watch the screen and text describing the events.

This battle takes 30 min and attacking/defending text events are appearing during this time. In average, I have about 5 main events and 3 secondary events. When the battle start, the code is aware of the number of main events, but not the secondary. They are calculated on the fly.

The process is like,

newEventTime = previousEventTime + formulaForRandomTimeInterval

What I try to do is to build that formula and avoid having big empty time gaps on the battle and also avoid having a lot of them in a small period.

Also, I want to have slightly more events as the time pass to increase the interest.

Was thinking something such as:

formulaForRandomTimeInterval = (battle_time*2/main_events)*random(0,1)

where battle_time = 30 and main_events the number for that battle.

Any idea for a better solution?

Edit

Sorry for the confusion. Here are a couple of more details about it.

An example of events:

At 3' Player A attacked and made 45 damage. (Main event)
At 8' Player B attacked with a sword and made 110 damage. (Main event)
At 12' the weather changed and started raining. Both players had issues with the mud. (Secondary event)
At 19' Player A made a move but player B dodged the attack. (Main event)
...
...

There is another part of the code that decide which event will be the next and what exactly would be. The battle will be over only when the main events are finished. As I said, each battle has different number of main events of average 5, but the code know this number as the battle starts. But doesn't know the number of secondary events which are created by random.

So, when the code does the loop on the events and decide the type of the next event, the time code is called to decide in what minute it will be appeared.

sentences:
Get BP FollowCamera Rotation and Location I'm accessing my FollowCamera https://imgur.com/a/vbFagxg from my BluePrintCharacter class in my C++ code, with this following line :

FollowCamera = GetOwner()->FindComponentByClass<UCameraComponent>();
FVector WorldLocationV = FollowCamera->GetWorldLocation();

But when I run my game, I get this error : GetWorldLocation is not a member of UCameraComponent

Why is this, and how can I get GetWorldLocation from FollowCamera in C++?

In BluePrint this seems to work fine : http://i.imgur.com/8m9TWUW.png

sentences:
Selling Android apps from Android-Market-unsupported countries I am in Latvia (which the Android market doesn't support as a country for selling apps from), and I am thinking about the best way of monetizing my app. So far I've come up with these options:

Pretend I am from a supported country. Get a bank account there, etc.
Use PayPal for in-app purchases. The player gets, say, the first 10 levels for free, but is then asked to pay 0.99$ for the rest of the game. Downside: Players might not feel comfortable entering PayPal details into an app. Android market might not like it either.
Making the app free and earning money through advertising. Let's do some calculation here: Say I get 1M free downloads, each user during his playtime would see 10 banners, so 10m / 1000 * 0.3 is about 33k$ if we use AdMob with their 0.3$ per 1000 impressions. On the other hand, if we use PayPal and in-app purchases, we need a >3% conversion rate to beat this..

What should I do?

Edit: From what I just read all over the net, it looks like advertisers will change their eCPM price a lot without telling you. Using in-app PayPal purchases at least allow you to monitor the cash flow.

sentences: Any problems with flipping a sprite by scale? (2d Platformer) I am wondering if there are any problems with flipping a sprite on the x-axis using vector2 to tell which direction it is facing/flip. Though doing this helps me write less code for Ray-cast direction and creating single states with a single animation (using 1 animation player facing right than using 2 animation facing left and right). If there is a better solution please tell me and thanks. Btw I am still pretty new and learning.

sentences:
Is this the correct implementation of a fixed timestep game loop? public static void main(String[] args) {

        long newTime, delta, timeSince1Second, startTime, oldTime;
        long ticks = 0;
        double frameCap = 1000/60;
        double time_passed = 0;

        startTime = System.currentTimeMillis();
        oldTime = System.currentTimeMillis();
        while(true)
        {
            newTime = System.currentTimeMillis();
            delta = newTime - oldTime;
            timeSince1Second = newTime - startTime;
            currentTime = newTime;

            //update game based on dynamic time step here (if needed)

            //update loop (fixed time step)
            while(time_passed >= frameCap)
            {
                //update game logic (fixed time step update)
                time_passed = time_passed - frameCap; //resetting time_passed essentially to 0
                ticks++;
            }

            time_passed = time_passed + (double) delta; //time passed since start of loop

            //render here

            //frame rate counter
            if((timeSince1Second/1000) >= 1)
            {
                System.out.println(ticks+" frames per second");
                startTime = System.currentTimeMillis();
                ticks = 0;
            }
        }
} //end main function

This code has been written in java. I'd like to know if i'm missing anything here, because in the fixed time step update loop, if i display for example a window, and move the window around, the framerate will sometimes change until i stop moving the window around, which is kind of confusing to me. Is that normal? Or perhaps I might be missing something
Guidance will be appreciated

sentences:
How to run a timer parallel to a series of coroutines and WaitForSeconds In the code below, I have a cycle for enemies appearing and disappearing.

IEnumerator EnemyCycle()    {
while (isRepeating)
{

for (int j = 0; j < enemies.Length; j++) {

    canStartUpdatingReset = true;
    Enemy currentEnemy = enemies [j];
    var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
    var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 0f, fTime, currentEnemy.gameObject, false));

coroutinesToStop.Add(_currentFade);

if (currentEnemy.hasWeapon) {
                weaponCycleCoroutines.Add(StartCoroutine(FadeToForWeapon(currentEnemy.weapon.GetComponent<Renderer>().material, 0f, fadeTime, currentEnemy.weapon, false)));

            }
}

yield return new WaitForSeconds (hideTime);

for (int j = 0; j < enemies.Length; j++) {

    Enemy currentEnemy = enemies [j];
    var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
    var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 1f, fTime, currentEnemy.gameObject, true));

     coroutinesToStop.Add(_currentFade);
if (currentEnemy.hasWeapon) {
weaponCycleCoroutines.Add(StartCoroutine(FadeToForWeapon(currentEnemy.weapon.GetComponent<Renderer>().material, 1f, fadeTime, currentEnemy.weapon, true)));
}
yield return new WaitForSeconds (showTime);

        }
    }
}

I have an enemyCycleDuration float which is

enemyCycleDuration = 60*(hideTime + fadeTime + showTime + fadeTime)

Note that fadeTime comes from FadeToForWeapon and FadeToForEnemy. The idea here is I want the enemyCycleDuration to be run in parallel to EnemyCycle() so it is reset (please see code below) at the same time that

yield return new WaitForSeconds (showTime);

is reached in the  EnemyCycle().

I am resetting enemyCycleDuration in the following way in the update method but  EnemyCycle() seems to be ahead of enemyCycleDuration, always completing before enemyCycleDuration is reset. How can I get both to run parallel to each other in timing and complete at the same time?

if (canStartUpdatingReset)  {
timeElapsed +=1;
if(timeElapsed >= enemyCycleDuration) {

    timeElapsed = 0;

    Debug.Log ("Reset CycleDuration");
    }
}

sentences:
Timer as part of a condition I am using a sensor as the input to my game.

When a certain level of force is exerted on the sensor, for a certain amount of time, I want the next level to be reached.

How would I do this?

I have attached both the timer code and the game code, but I don't know how to use them together.

Timer code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Timer : MonoBehaviour
{
    public int timeLeft = 5;
    public Text countdownText;

    // Use this for initialization
    void Start()
    {
        StartCoroutine("LoseTime");
    }

    // Update is called once per frame
    void Update()
    {
        countdownText.text = ("Time Left = " + timeLeft);

        if (timeLeft <= 0)
        {
            StopCoroutine("LoseTime");
            countdownText.text = "Times Up!";
        }
        //Invoke("ChangeLevel", 0.1f);
    }

    IEnumerator LoseTime()
    {
        while (true)
        {
            yield return new WaitForSeconds(1);
            timeLeft--;
        }
    }
    void ChangeLevel()
    {

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
}

Game code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class arduino : MonoBehaviour {

    SerialPort sp = new SerialPort("\\\\.\\COM6", 9600);// Com port and the baud rate of the arduino
    Material m_Material;
    GameObject Sphere;

    void Awake(){
        Sphere = GameObject.FindWithTag ("Player");
        m_Material = GameObject.FindWithTag ("Player").GetComponent<Renderer > ().material ;
    }
    void Start ()
    {
        if (!sp.IsOpen)
        { // If the serial port is not open
            sp.Open(); // Open
        }
        sp.ReadTimeout = 250; // Timeout for reading
     }
    // Update is called once per frame
    void Update () {
        if (sp.IsOpen) { // Check to see if the serial port is open
            try
            {

                string portreading = sp.ReadLine(); // get the string output of the serial port
                float amount = int.Parse(portreading);

                if ((amount > 10f) && (amount < 100f))
                {
                    m_Material.color = Color.grey;
                   // Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));

                }

                if ((amount > 101f) && (amount < 150f))
                {
                    m_Material.color = Color.blue;
                    //Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));
                }

                if ((amount > 151f) && (amount < 201f))
                {
                    m_Material.color = Color.yellow;
                    //Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));
                }
                if ((amount > 201f))
                {
                    m_Material.color = Color.red;
                   // Sphere.transform.position = (new Vector3(0f, amount * 0.1f, 0f));

                }
            }
            catch (System.Exception)
            {

            }
        }
    }
}

sentences:
How do i easily clamp my cameras rotation when using transform.rotate() I'm making a fps controller, and I'm trying to clamp my cameras x rotation.  Here's my code so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    // Start is called before the first frame update

    [SerializeField] Camera cam;
    [SerializeField] float camSpeed;
    [SerializeField] float walkSpeed;
    [SerializeField] float jumpSpeed;

    float yaw;
    float camPitch;
    Vector3 direction;
    Vector3 worldDirection;

    Rigidbody myrigbody;
    void Start()
    {
        myrigbody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        camPitch = -Input.GetAxis("Mouse Y") * camSpeed;
        cam.transform.Rotate(new Vector3(camPitch, 0, 0));
        yaw = (yaw + Input.GetAxis("Mouse X") * camSpeed) % 360f;

        direction = new Vector3(Input.GetAxis("Horizontal") * walkSpeed, myrigbody.velocity.y, Input.GetAxis("Vertical") * walkSpeed);
        worldDirection = transform.TransformVector(direction);

        if(Input.GetKeyDown(KeyCode.Space))
        {
            myrigbody.AddForce(new Vector3(0, jumpSpeed, 0), ForceMode.Impulse);
        }
    }
    private void FixedUpdate()
    {
        myrigbody.MoveRotation(Quaternion.Euler(0, yaw, 0));
        myrigbody.velocity = worldDirection;
    }
}

I know that I want to clamp my cameras X rotation within a range of -89 to 89, but no matter what I try I can't figure out how to clamp the rotation while using cam.transform.Rotate(). I don't think I can clamp camPitch, because it is reset every frame, and I can't figure out a way to directly clamp the cameras rotation.  The cameras rotation is not resetting, so if I could somehow clamp it it would work.  Is this possible, or do I need to try a different method?  How do i get this to clamp correctly?

sentences:
PYGAME: When I release two directional keys together the player keep moving I did the code this way to avoid the player to stop if a press two directional keys together making the movement more smooth. It works well but when I release two keys or more together the player keep moving in one of the directions of the key. I can't figure out how to solve this issue.

Here is my code:

def input(self, event, pygame):
    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_LEFT:
            self.left_is_down = True
            self.speed_x = -self.velocity
        if event.key == pygame.K_RIGHT:
            self.right_is_down = True
            self.speed_x = self.velocity
        if event.key == pygame.K_UP:
            self.up_is_down = True
            self.speed_y = -self.velocity
        if event.key == pygame.K_DOWN:
            self.down_is_down = True
            self.speed_y = self.velocity

    if event.type == pygame.KEYUP:
        if event.key == pygame.K_LEFT:
            self.left_is_down = False
            if self.right_is_down:
                self.speed_x = self.velocity
            else:
                self.speed_x = 0
        if event.key == pygame.K_RIGHT:
            self.right_is_down = False
            if self.left_is_down:
                self.speed_x = -self.velocity
            else:
                self.speed_x = 0
        if event.key == pygame.K_UP:
            self.up_is_down = False
            if self.down_is_down:
                self.speed_y = self.velocity
            else:
                self.speed_y = 0
        if event.key == pygame.K_DOWN:
            self.down_is_down = False
            if self.up_is_down:
                self.speed_y = -self.velocity
            else:
                self.speed_y = 0

def update(self):

    self.x += self.speed_x
    self.y += self.speed_y

sentences:
AI control for a ship with physics model I am looking for ideas how to implement following in 2D space. Unfortunately I don't know much about AI/path finding/autonomous control yet.

Let's say this ship can move freely but it has mass and momentum. Also, external forces might affect it (explosions etc). The player can set a target for the ship at any time and it should reach that spot and stop.

Without physics this would be simple, just point to the direction and go. But how to deal with existing momentum and then stopping on the spot? I don't want to modify ship's placement directly.

edit: Just to make clear, the physics related math of the ship itself is not the problem.

sentences:
Interfaces 101: Making it Pretty I've made a few games which I've actually released into the wild. There's one particular issue I run into over and over, and that's the issue of the interface/theme of the game.

How can you make non-arbitrary, consistent decisions about the look-and-feel and interface of your game?

For example, in version one of my Silverlight chemistry-based game, I made a (bad?) decision to go witha  natural, landscape-style look-and-feel, which resulted in this UI:

Then in a later iteration, I got smarter and went with a more "machiney," grungy look-and-feel, which resulted in this (final UI):

I will definitely say that my taste in UI improved through iteration. But it was a result of a lot of initially arbitrary decisions followed by a lot of tweaking.

Is there a better way to figure out how to theme your game?

To give a parallel in writing, when you're writing a fantasy/sci-fi novel, there are a lot of elements you need to describe. While you can arbitrarily invent objects/creatures/places/etc., you get a much more consistent world when you sit down for a few minutes and design the area, region, planet, or universe. Everything then fits together nicely, and you can ask yourself "how would this work in this universe?

Edit: It seems like I didn't explain this well. Let me simplify the question in the extreme: when I need to lay out a title screen (with background, fonts, skinned buttons) how do I decide how they should look? Green or blue? Grunge or not? Rounded or flat? Serif or sans-serif?

Take that question and explode it into your game as a whole. How do you figure out how things should look? What process do you use to make them consistent and non-arbitrary?

Look at the screenshots again. I could have stuck to grass/sky/rocks, but metal seemed more fitting to the idea of chemical reactions and atoms.

sentences:
How to tween to move an object in arc? Okay, so I think I need to use a tween in order to move an object in my game.  I have some little green dudes that need to move in an arc (bezier) to a location that is clicked by the user.  My game functions by having the mouse point raycast to the screen giving my character a position to move to.  They don't just run though,  they fire off their jetpacks and should travel in an arc to the target position.  I'm pretty new to Unity but all I can come up with is using a tween to do this.  Am I missing something?   That being said,  I'm totally confused on what a tween actually is.  I can't wrap my head around how the object can be moved outside of an update function.  I'm using the "free from the asset store" LeanTween package.  I feel like there should be some sort of easier way to achieve the desired behavior.

How can I have my character move from Vector3 A to Vector3 B in an arc?

sentences:
Why is std::atan2 returning -0.0? Really? Negative zero?!

double Vector2D::GetFacingAngle(const Vector2D& target, const Vector2D& source) {
    a2de::Vector2D facingVec(Vector2D(source) - Vector2D(target));

    //Negating 'y' argument to account for flipped nature of 'y' screen coordinates.
    double result = std::atan2(-facingVec.GetY(), facingVec.GetX());

    //Which causes -0.0 as a possible result when source is right of target at the same 'y' coordinate.
    if(a2de::Math::IsEqual(result, -0.0)) return 0.0;
    return result;
}

Is this a common behavior? (Similar to subtracting 'y' coordinates for 'up' movement in screen coordinates contrary to Cartesian coordinates.)

sentences:
unable to send or update data into my mysql database using unity I am trying to save user scores into my data base so i have deveoped backend on php and mysql datbase. All the things are complete but having issues to send or receive data through my unity WWW class.

Here is my C# code to get and send data to php and then DB:

using UnityEngine;
using System.Collections;

public class Scripts : MonoBehaviour {
    string dataSubmitURL = "http://localhost/HighScore/AddScore.php?";
    string dataGetURL = "http://localhost/HighScore/GetScore.php";
    // Use this for initialization
    void Start () {
        StartCoroutine(GetScores());
        //StartCoroutine(PostScores("faizan",100));
    }

    // Update is called once per frame
    void Update () {

    }

    IEnumerator PostScores(string playerName, int score) {
        string submitURL = dataSubmitURL + "name="+ playerName + "&score=" + score;
        print(submitURL);
        WWW submitData = new WWW(submitURL);
        yield return submitData;
        if (submitData.error != null)
        {
            Debug.LogError("Error occur when Submitting data : " + submitData.error);
            Debug.LogError("Error occur when Submitting data : " + submitData.text);
            Debug.LogError("Error occur when Submitting data : " + submitData.responseHeaders);
            //submitData.text
        }
        else {
            print(" Submitted");
        }
    }

    IEnumerator GetScores() {
        WWW getData = new WWW(dataGetURL);
        yield return getData;
        if (getData.error != null)
        {
            Debug.LogError("There was an error getting the high score: " + getData.error);
        }
        else {
            print(getData.text);
        }
    }
}

If i directly run my urls into browser

string dataGetURL = "http://localhost/HighScore/GetScore.php";

then it is working perfectly and giving me data but same thing when i trying through my c# www(above code) then it reply.

There was an error getting the high score: Empty reply from server

sentences:
My frustum culling is culling from the wrong point I'm having problems with my frustum being in the wrong origin.
It follows the rotation of my camera but not the position.

In my camera class I'm generating a view-matrix:

void Camera::Update()
{
    UpdateViewMatrix();

    glMatrixMode(GL_MODELVIEW);
    //glLoadIdentity();
    glLoadMatrixf(GetViewMatrix().m);
}

Then extracting the planes using the projection matrix and modelview matrix:

void UpdateFrustum()
{
    Matrix4x4 projection, model, clip;

    glGetFloatv(GL_PROJECTION_MATRIX, projection.m);
    glGetFloatv(GL_MODELVIEW_MATRIX, model.m);

    clip = model * projection;

    m_Planes[RIGHT][0] = clip.m[ 3] - clip.m[ 0];
    m_Planes[RIGHT][1] = clip.m[ 7] - clip.m[ 4];
    m_Planes[RIGHT][2] = clip.m[11] - clip.m[ 8];
    m_Planes[RIGHT][3] = clip.m[15] - clip.m[12];
    NormalizePlane(RIGHT);

    m_Planes[LEFT][0] = clip.m[ 3] + clip.m[ 0];
    m_Planes[LEFT][1] = clip.m[ 7] + clip.m[ 4];
    m_Planes[LEFT][2] = clip.m[11] + clip.m[ 8];
    m_Planes[LEFT][3] = clip.m[15] + clip.m[12];
    NormalizePlane(LEFT);

    m_Planes[BOTTOM][0] = clip.m[ 3] + clip.m[ 1];
    m_Planes[BOTTOM][1] = clip.m[ 7] + clip.m[ 5];
    m_Planes[BOTTOM][2] = clip.m[11] + clip.m[ 9];
    m_Planes[BOTTOM][3] = clip.m[15] + clip.m[13];
    NormalizePlane(BOTTOM);

    m_Planes[TOP][0] = clip.m[ 3] - clip.m[ 1];
    m_Planes[TOP][1] = clip.m[ 7] - clip.m[ 5];
    m_Planes[TOP][2] = clip.m[11] - clip.m[ 9];
    m_Planes[TOP][3] = clip.m[15] - clip.m[13];
    NormalizePlane(TOP);

    m_Planes[NEAR][0] = clip.m[ 3] + clip.m[ 2];
    m_Planes[NEAR][1] = clip.m[ 7] + clip.m[ 6];
    m_Planes[NEAR][2] = clip.m[11] + clip.m[10];
    m_Planes[NEAR][3] = clip.m[15] + clip.m[14];
    NormalizePlane(NEAR);

    m_Planes[FAR][0] = clip.m[ 3] - clip.m[ 2];
    m_Planes[FAR][1] = clip.m[ 7] - clip.m[ 6];
    m_Planes[FAR][2] = clip.m[11] - clip.m[10];
    m_Planes[FAR][3] = clip.m[15] - clip.m[14];
    NormalizePlane(FAR);
}

void NormalizePlane(int side)
{
    float length =  1.0/(float)sqrt(m_Planes[side][0] * m_Planes[side][0] +
                                m_Planes[side][1] * m_Planes[side][1] +
                                m_Planes[side][2] * m_Planes[side][2]);

    m_Planes[side][0] *= length;
    m_Planes[side][1] *= length;
    m_Planes[side][2] *= length;
    m_Planes[side][3] *= length;
}

And check against it with:

bool PointInFrustum(float x, float y, float z)
{
    for(int i = 0; i < 6; i++)
    {
        if( m_Planes[i][0] * x + m_Planes[i][1] * y + m_Planes[i][2] * z + m_Planes[i][3] <= 0 )
        return false;
    }
    return true;
}

Then i render using:

camera->Update();
UpdateFrustum();

int numCulled = 0;

for(int i = 0; i < (int)meshes.size(); i++)
{
    if(!PointInFrustum(meshCenter.x, meshCenter.y, meshCenter.z))
    {
        meshes[i]->SetDraw(false);
        numCulled++;
    }
    else
        meshes[i]->SetDraw(true);
}

Matrices look like (Camera is at (5, 0, 0)):

ModelView
[0,0,0.99,0] [0,1,0,0] [-0.99,0,0,0] [0,0,-5,1]

Projection
[0.814,0,0,0] [0,1.303,0,0] [0,0,-1,0] [0,0,-0.02,0]

Clip
[0,0,-1,-0.999] [0,1.30,0,0] [-0.814,0,0,0] [0,0,4.98,4.99]

What am I doing wrong?

sentences:
How can I switch between two cameras with fading in/out when switching? The first script is the way I'm using now to switch between cameras.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SwitchCameras : MonoBehaviour
{
    [Header("Cameras Init")]
    public Camera[] cameras;
    public Vector3[] originalPosition;
    [HideInInspector]
    public Vector3 currentCameraOriginalPosition, currentCameraPosition;

    [Space(5)]

    [Header("Cameras Switch")]
    public string currentCameraName;
    public Vector3[] lastCameraPosition;

    private int currentCamera = 0;

    void Start()
    {
        cameras = Camera.allCameras;
        lastCameraPosition = new Vector3[cameras.Length];

        if (cameras.Length >= 1)
        {
            originalPosition = new Vector3[cameras.Length];
            for (int i = 0; i < cameras.Length; i++)
            {
                originalPosition[i] = cameras[i].transform.position;
            }
        }

        if (cameras.Length == 1)
        {
            Debug.LogError("Need more then 1 camera for switching..");
        }
        else
        {
            Debug.Log("Found " + cameras.Length + " cameras");
        }

        for (int i = 0; i < cameras.Length; i++)
        {
            cameras[i].enabled = false;
        }
        cameras[0].enabled = true;
        currentCameraName = cameras[0].name;
        currentCameraOriginalPosition = originalPosition[0];
    }

    void LateUpdate()
    {
        if (Input.GetKeyDown(KeyCode.G))
        {
            cameras[currentCamera].enabled = false;

            if (++currentCamera == cameras.Length)
                currentCamera = 0;

            cameras[currentCamera].enabled = true;
            currentCameraName = cameras[currentCamera].name;

            currentCameraOriginalPosition = originalPosition[currentCamera];
        }
        lastCameraPosition[currentCamera] = cameras[currentCamera].transform.position;
        currentCameraPosition = lastCameraPosition[currentCamera];
    }
}

And this is a script for starting a new game:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewGame : MonoBehaviour
{
    public void RestartGame()
    {

    }
}

Both scripts attached to the same GameObject.
I'm calling the RestartGame method from On Click in the inspector of a button I have in the main menu.

Now in the SwitchCameras script I'm using the G key to switch between the cameras.

But now I want to do that when a new game start to fade in/out between two cameras inside the RestartGame method.
I want to call some method from the SwitchCameras script that will gade in/out between two cameras.

The idea is when starting a new game or resuming a game that the first camera will fade out slowly, fade out I mean will be enabled false slowly and then near the end to enabled true the second camera slowly.

Like switching between the two cameras but slowly.

Should i use startcoroutine ?

sentences:
Python + Pygame - Collision problems I'm currently developing a game in Python + Pygame and i came up with a problem with the player and the platforms. The game is a 'runner' where the player it's fixed (The 'x' position isn't variable, only the jump).

This is how i'm currently doing the collisions managment:

def collide(self, yvel, platforms):
    for p in platforms:
        if pygame.sprite.collide_rect(self, p):
            if yvel > 0:
                self.rect.bottom = p.rect.top
                self.onGround = True
                self.yvel = 0
            if yvel < 0: self.rect.top = p.rect.bottom

'platforms' its a RenderUpdate group with the platforms (a simple sprite).

When the player is falling from a platform and collides with the next platform, not exactly on top of it but a little below, that's when the character jumps to the position shown in the code above, rather than collide and fall.
I don't know how to check the left bound without a 'xvel' parameter.

(The screen shows an example, but the player only changes the y-axis coordinates, the platforms are updating their position)

I've tried supply a number to a 'xvel' parameter, and check if the character wasn't on the ground (Jumping) and the 'xvel' was greater than 0, but it isn't working at all.

Thanks in advance.

sentences: Import blender camera with key frames to unity? I am wondering if I can take a camera tracked camera from blender and import it into unity. Is there any way to do this? Please let me know! Thanks in advance.

sentences:
How can I discourage camping while still supporting a "sniper" style of play? I am trying to add features into a third person shooter that suit a sniper style of play, in addition to the current rush/deathmatch style it was designed for. The current gameplay is similar in style to Gears of War and Battlefield, perhaps similar to Call of Duty in terms of combat ranges but a little slower paced. The levels are similar in size to large COD maps, or medium Battlefield maps.

Two things which I was planning to add includes some long sight lines and also some "sniper nests". I am concerned though because these two features can open the door to a lot of camping. Sniping and camping are not the same things in my opinion, but it can be easy for campers to abuse such features for easy gain, when they were intended to promote tactical sniper use. That said, I don't believe in blaming the flaws of a game on a player's choice of play style.

Sniper: Uses long range rifles, may stay in a specific spot that is tactically advantageous at the time, but knows how to move to other locations good for sniping. Provides spotting and suppression for more offensive/rush style team members.

Camper: May use any weapon, always stays in the one spot and waits for players to pass by, leading to easy low risk kills. Follows the same strategy regardless of what is happening in the game/match. Is more focussed on own performance as opposed to supporting team members.

So, I am trying to think of some ways in which to try to discourage camping while still allowing legitimate sniper play and preserving the original rush gameplay.

sentences:
In my browser game's website description, can I use a title of another game? For instance, if I think my game is a cross between Age of Empires and Minesweeper, can I have written on the description of my website "A browser-based hybrid of Age of Empires and Minesweeper" ?
Thanks!

sentences:
VAO and VBO connection and granularity with multiple objects How general should vertex array objects be?

I'd like to plan ahead and avoid a major revision down the road. I'm having a hard time wrapping my head around a few (possibly conflicting) pieces of wisdom scattered around the internet.

This answer on VAO best practices: for each batch: generate VAOs and bind buffers
Another describes one should share VAOs with multiple objects
Khronos OpenGL Vertex specification just providing general useful information

This is what I could gather from a half a year of slowly reading specs and docs, building and abstracting away a somewhat structured piece of a game engine.

The more state changes the slower the execution (self evident)
VAO holds state for draw calls (for a simple bind -> draw)
VBOs are bound to a VAO using the attribute location from a shader program (glGetAttribLocation -> glVertexAttribPointer)
These arrays are enabled by location using glEnableVertexAttribArray

So for a single VAO, how many or what kinds of objects should it take care of? Should a single VBO contain many objects' e.g. normals and the program use offsets when drawing, or is having separate VBOs for each a viable option?

Also, since we enable the attribute array by location inside the shader program, are the VAO and the shader in some way connected?

Any pointers would be greatly appreciated!

sentences:
Select display adapter in D3D9 I have a notebook that has 2 graphics card one Intel and one nvidia graphics cards.
When I want to start my game I right click on the exe file and select run with graphics processor->Nvidia but my engine stills run with my Intel graphics card on d3d9.
Is there any way to choose the graphics card with code?

sentences:
Why isn't my image's transparency honoured in the Unity sprite? I'm following through Jesse Freeman's Lynda course Unity 5 2D Essential Training. The exercise files contain sprites with transparency. Here's a screenshot of one such sprite on the trainers screen (sorry it's so small):

But here's how it looks in my scene in Unity 5.5.0F3:

I think that the sprite's alpha properties are set correctly, I have Alpha Source set to "Input Texture Alpha" and Alpha Is Transparency is checked:

When I open the PNG in PhotoShop the transparency is correctly set:

Why is the transparent area rendered as opaque in my sprite?

sentences:
How to quickly create meshes that have cutouts of other meshes? I have a mesh and I would like to quickly create planes (or boxes) that have cutouts in the shape of the silhouette that mesh, but rotated at various angles. I would like to have a system to which I can feed any mesh and it will output these cutout planes, either for random or predefined rotations of the mesh.

In the game I'm making, you have a 3D object, like a chess piece, that you rotate and translate to try to fit it in a hole in a wall that has the shape of the object. But the hole can be in the shape of any rotation of that object. For instance, in the case of a pawn, the hole can look like an upright pawn, so you wouldn't have to rotate the pawn at all; or it could just be a circle the size of the base of the piece, so you would have to rotate the pawn so it either goes in feet or head first. I want a program to procedurally generate walls with these kinds of holes for any mesh I give it.

sentences:
How to make a beam follow a path in xna I'm making a 2D shmup with XNA 4.0 and one of the weapons in the game that I want is a laser beam that follows a path or a series of points and will smoothly beam along the path.

How would I go about achieving this?

sentences:
How can I determine the velocity after impact of a 2D ball collision? Consider two balls moving towards each other. Each has a given mass and velocity. Assuming the balls collide, how can you determine what direction the balls will take afterwards? (taking into consideration the mass & velocity)

I realise it's quite a big question, perhaps someone could direct me to an appropriate tutorial.

sentences:
Trying to add a feature to my (basic) level parsing algorithm - not sure how to (JAVA) Right now this method goes through a list of GameObjects (e.g. JetPack, Platform) with their respective x and y positions in a text file called level1.txt:

platform 840 280
platform 1130 280
coin 900 300
coin 950 300
coin 1000 300
coin 1000 400
jetpack 1090 400
platform 650 500
platform 500 400
platform 200 400
NEXT
platform 200 200
coin 250 300
coin 350 700

What currently happens is whenever my Player reaches the end of the screen, he goes back to the start (x = 0). When he does reach the end of the screen, I want all the objects BEFORE NEXTto disappear and all the objects AFTER NEXT to be drawn. I know why my algorithm doesn't work as it should but I'm unsure how to fix it. Can anyone have a look at it and tell me how I can modify it to do what I want it to? listis a list of GameObjects in the text file btw.

public void loadLevel(String level) {
        list.clear();
        FileHandle file = Gdx.files.internal(level);
        StringTokenizer tokens = new StringTokenizer(file.readString());
        while (tokens.hasMoreTokens()) {
            String type = tokens.nextToken();

            if (type.equals("platform")) {
                list.add(new Platform(Integer.parseInt(tokens.nextToken()),
                        Integer.parseInt(tokens.nextToken())));
            }
            else if (type.equals("coin")) {
                list.add(new Coin(Integer.parseInt(tokens.nextToken()), Integer
                        .parseInt(tokens.nextToken())));
            } else if (type.equals("flag")) {
                list.add(new Flag(Integer.parseInt(tokens.nextToken()), Integer
                        .parseInt(tokens.nextToken())));
            } else if (type.equals("jetpack")) {
                list.add(new JetPack(Integer.parseInt(tokens.nextToken()),
                        Integer.parseInt(tokens.nextToken())));
            } else if (type.equals("pipe")) {
                list.add(new Pipe(Integer.parseInt(tokens.nextToken()), Integer
                        .parseInt(tokens.nextToken())));
            } else if (type.equals("NEXT") && player.getxPos() > SCREEN_WIDTH) {
                list.clear();
            }
        }
    }

Any help is highly appreciated, many thanks in advance.

sentences:
Getting correct angles between Vector3s I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them.

The line itself is a 3d object which is scaled to match the length between points. Currently you can draw lines that are horizontal or vertical. But drawing a line that starts and ends on a different level fail.

Horizontal and vertical work well.

Here the lines should go like indicated by the grey lines. But it adds the Z-rotation(Up/down) to the Y-rotation(direction) - (Setting the Y-rotation by hand to match the horizontal line results the line being drawn correctly).

            Vector3 dir = junctionFinderHit.transform.position - startPos;  /// Direction vector
            float angleY = Vector3.Angle(dir, new Vector3(1, 0, 0));
            float angleZ = Vector3.Angle(dir, new Vector3(0, 1, 0));

            //Debug.Log(angleY + " - " + AngleDir(new Vector3(0, 1, 0), dir, Vector3.up));

            Vector3 rotationVector = new Vector3(0,0,0);

            if (AngleDir(new Vector3(1, 0, 0), dir, Vector3.up) < 0)    /// 360 movement instead of 180
                rotationVector.y = 360-angleY;
            else
                rotationVector.y = angleY;

            /// -90 degrees to make it horizontal by default, negative to make it point to the right direction
            rotationVector.z = (angleZ-90f)*-1;

            activeStick.transform.eulerAngles = rotationVector;

What do I need to do to get the rotations correct?

sentences:
Techniques for managing vertex buffer memory I'm learning OpenGL and I haven't seen any advice on managing vertex buffers in all of the tutorials I've read.

The basic problem is that I have some memory allocated as a buffer B in which I'm going to store vertex data to send to the graphics card.

Then I have the data that represents my domain D. This is the data that the game's simulation is run against. Let's say in a simple case it's just a list of 100,000 circles that will be moving around. Let's also assume that all of the data can, but might not, change every frame. Nothing is necessarily static.

I'm looking for the techniques people use to efficiently fill B with D.

I could create a new B each frame, but I imagine that would be very expensive.

I could give every object in D a pointer to a location in B and have it update that pointer directly, but that strikes me as error prone as then I have to manage all of these pointers.

I could also traverse D and fill a reused B every frame. This is what I'm currently leaning towards. The only problem here is that I'm forced to update every vertex in B every frame (because the location of the vertex data for a particular D could change within B) unless I come up with a more sophisticated scheme that guarantees that that an object in D always gets the same spot in B.

So I can think of several options, but I'm wondering what people typically do. I imagine almost everyone has to solve this problem at some point.

sentences:
Implementing movement on a grid I have a simple snake game, where I have other NPC snakes on the field.
How do I calculate the movement of those other snakes so that they did not hit walls, and each other?

So far I have it like this:

I check for current coordinates and when there is a wall nearby I change direction to some other one. And so on, this way the snakes never collide the walls.

But not actually colliding other snakes, how do I prevent this?

I figured I could probe for the direction I'm heading and if there is anything there I would change direction too, but there is a set of situation where this won't work, for example if another snake will block off all exits later.

sentences:
How to move player along navmesh link's curve? NavMesh Link creates a navigable link between two locations that use NavMeshes.
This link can be from point to point or it can span a gap, in which case the Agent uses the nearest location along the entry edge to cross the link.

I don't know why when I use navmesh link player move along horizontal plane (that I demonstrate it by red line) between gaps in navmesh link
Is there a option that player jump along curve (that I demonstrate it green curve)?
should I use force?

you can see player move horizontally! that isn't interesting.
Offmesh Links - Unity Official Tutorials

sentences:
COLLADA, loading, the modelling/animation process? So, we're making a game in C++ using SDL - a TDS. It was originally intended to be 2D, but our lead programmer wanted to redo the engine and make it 3D. And, now, we really don't know how to go about it.

What model and animation formats should we be using? We're considering COLLADA, and if I understand correctly, we export models as .dae, then the animators import them, make the animation, then export as .dae. We then load them into the game using AssImp, then render, am I right? Or does the animator build a rig, save it as .dae, then the modeller builds on that, saves as .dae, then the animator makes the animations?

Thanks a lot for any help, really appreciate it.

sentences:
(Unity) How to show a texture on a model at a specific Pixels Per Unit? I'd like to use flat 3D models alongside pixel art sprites, but I have no idea how to make the textures applied to these models have the same Pixels Per Units as the sprites.

How can I achieve this effect in Unity?
thank you

sentences:
In Unity, why do I get a "does not implement right interface" error when trying to sort my list of objects? I am trying to create a crafting panel that sorts the list of items you can make alphabetically, yet I cannot figure out why .Sort() is not working.

What I have is a game object that holds a list of all the items you can make and the requirements, then in my crafting script I access the game object for the list and display the info.

Everything works fine until I try to sort anything. craftDatabase is what I need to be sorted. Also, it needs to be sorted by ItemID.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class CraftDatabase : MonoBehaviour
{
    public List<Blueprint> craftDatabase = new List<Blueprint>();
}

[System.Serializable]
public class Blueprint
{
    public string itemId;
    public int itemAmount;
    public float itemCraftTime = 1f;
    public CraftPanel.subsections subsection;
    public CraftPanel.workstations workStation;
    public List<requiredItem> requiredItems = new List<requiredItem>();

    [HideInInspector]
    public string desc;

    [System.Serializable]
    public struct requiredItem
    {
        public string itemId;
        public int itemAmount;
    }

    public Blueprint()
    {
    }
}

When I try to throw in craftDatabase.craftDatabase.Sort(); it gives me this error:

  ArgumentException: does not implement right interface

How do I fix this error to use Sort()?

sentences:
How can I detect if a gamepad stick has been pushed to the limit? As in the question, really. I want to be able to detect if a gamepad has it's analogue input pushed as far as it can go in any direction.

Given x and y axis values in the range [-1, 1] (-1 being left and down respectively), how can I account for all of the angles between horizontal and vertical, as this means that I can't simply check if abs(axis) == 1.

As I'm unaware of how it might affect it, the engine I'm using is UE4, so any answer could take that into account.

sentences:
Framerate dependent movement I'm moving my character controller using Euler integration like this:

Vector3 originalPos = transform.position;
Vector3 acceleration = Physics.gravity;
velocity += acceleration * Time.deltaTime;
characterController.Move(velocity * Time.deltaTime);

This works consistently on different framerates. I also implemented simple rope physics by pulling the controller back when its outside the radius. I then (on the same frame) calculate the new velocity from the new and old positions.

if (outsideOfRadius)
    Vector3 newPos = anchorPos + (transform.position - anchorPos).normalized * ropeRadius;
    Vector3 oldPosition = transform.position;
    characterController.Move(newPos - oldPosition);
    velocity = (newPos - originalPos) / Time.deltaTime;
}

This is the problematic part because it behaves significantly different on different framerates. This causes problems when my character controller lets go of the rope and tries to land on a platform. The distance covered on 30 fps is less than on say 60 fps or higher.

Is there a way I could make this work more consistently across different framerates?

sentences:
Game Engine framework or library I'm on the planning stages for an internal game engine I am about to start creating, which will be used for all my games going forward. But I'm struggling a bit with how it should be built.

The choices come down to: framework or library.

My basic objective is to hide engine details as much as possible to keep high level game development on scripts and config files as much as possible. But also to reuse the core engine for any tools we might develop in the future.

Frameworks can make things nice and easy for development, but then you're locked in. Libraries are good if you're only interested in a specific subsystem. But we need to glue everything together in a game by game basis.

Well there is also another, building the engine as a standalone exe that handles all game resources, and all the subsystems. Game logic (and other per game dynamic stuff) is done exclusively on scripts with config files to configure each internal engine subsystem.

Which one will give me more flexibility in the future.

Thanks.

Edit:
Thanks everybody, guess I was looking at this in the wrong perspective. We can't really plan something like this without a priori knowledge of what the games need, guess this is why there is no such thing as a general engine for all genres.

I'll focus first on the game proper then iteratively analyze at the end of each game how to make decent abstractions for libraries or frameworks depending on my work-flow (or possibly that of a future team).

sentences: How can I transmit move information from player to player in a web application? I am trying to create an online chess game using ActionScript and Flex.  It works well when I have two players on the same PC, but I want to publish it as a web app.  How can I transmit a move or action from one user to another, such that the other user sees what the first one did?

sentences: What does a Game Designer do? what skills do they need? I know someone who is thinking about getting into game design, and I wondered, what does the job game designer entail? what tools do you have to learn how to use? what unique skills do you need? what exactly is it you'd do from day to day. I may be wording this a bit wrong because I'm not sure if the college program is become a game designer or learn game design. but I think the same questions apply either way.

sentences:
How to move a car model on a plane? I want to create a 3 dimensional car game. But i have a problem in moving a car in other directions and accelerating.

I have a car model and a road model placed appropriately. To move car forward, I translate the road model to negative X-axis so my car looks like it moving forward in my case as my car and road track is along the positive X-axis. Now, in the middle I want to turn left or right and for that I rotate the road model, (let's 90 degree). When I do that the car should move away from the road in sideways direction (or, we can say road to be moved), but it does not. As road was being translated to negative x-axis, after rotating the road I thought to be translated along negative x-axis relative the camera but I think the X-axis of the road object is fixed. So what should I do to solve it?

I just want to move a car which can go forward and when it turns left or right it should move forward accordingly.

P.S. I know, my question may not be clear but that's all I could elaborate it. Anyone can notify me if it's not clear and I will try again to clarify my question again.

sentences:
Unity multyplayer change player prefab on scene change How do you change player prefab with mirror network? I have tried this but its not working, atleast not on switching scenes.
My current code is:
 public void switchScene()
    {
        ServerChangeScene(gameScene);
    }

    public override void OnServerSceneChanged(string sceneName)
    {
        foreach (NetworkConnectionToClient conn in NetworkServer.connections.Values)
        {
            GameObject obj = conn.identity.gameObject;

            NetworkServer.ReplacePlayerForConnection(conn, Instantiate(shipPrefab));

            NetworkServer.Destroy(obj);
        }
    }

I have also tried OnClientSceneChanges but i always keep getting the same error:
MissingReferenceException: The object of type 'NetworkIdentity' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
LobbyManager.OnServerSceneChanged (System.String sceneName) (at Assets/LobbyManager.cs:56)
Mirror.NetworkManager.FinishLoadSceneHost () (at Assets/Mirror/Runtime/NetworkManager.cs:1011)
Mirror.NetworkManager.FinishLoadScene () (at Assets/Mirror/Runtime/NetworkManager.cs:953)
Mirror.NetworkManager.UpdateScene () (at Assets/Mirror/Runtime/NetworkManager.cs:936)
Mirror.NetworkManager.LateUpdate () (at Assets/Mirror/Runtime/NetworkManager.cs:274)

Running around in the source code of mirror shows, that at somepoint the existing prefab is destroyed and then recreated once new scene has loaded. But i want the new scene to have a new player prefab. How or when can i change the player prefab for connection?
And trying to switch character without scene change also gives error.
public void ChangeCharacter()
    {
            GameObject obj = NetworkClient.connection.identity.gameObject;

            NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab));

            NetworkServer.Destroy(obj);

    }

Error
InvalidCastException: Specified cast is not valid.
Mirror.NetworkIdentity.SetClientOwner (Mirror.NetworkConnection conn) (at Assets/Mirror/Runtime/NetworkIdentity.cs:362)
Mirror.NetworkServer.InternalReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:837)
Mirror.NetworkServer.ReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:697)
LobbyManager.ChangeCharacter () (at Assets/LobbyManager.cs:56)
UnityEngine.Events.InvokableCall.Invoke () (at <e8645a79b0794e0e9a2b5bbff081b88a>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <e8645a79b0794e0e9a2b5bbff081b88a>:0)
UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.4f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)

sentences:
Unity3D JavaScript/.NET code throwing compilation error with a List-thingy So, I do this:

var intlist:List.<System.Int32>;
intlist.Add(1);

And where I say intlist.Add(1) I get:

NullReferenceException: Object reference not set to an instance of an object

Weird, huh? Apparently, the error is .NET related and List is a .NET thing. So, please clarify the problem. Thank you.

EDIT:

The "add comment" button isn't working, so I will respond in the form of an edit. No, I can't use a JavaScript array because for whatever reason it screws up in the context of my code and the Unity people say I shouldn't use them. The syntax I am using is correct (as far as I know) in JavaScript, but I don't know if it would be null or not. Obviously, it starts out empty. That's sort of the point.

EDIT 2:

It looks like I can't accept answers either. Thanks to the both of you. It turns out I did need to call the constructor, despite some rather strange syntax errors I was getting earlier. Blowing your magic fairy dust on it made the problem go away.

sentences:
Unity3D HTC Vive graphical bug when making builds Recently I noticed that my builds seem to have a weird graphical bug. This only occurs when I play a build. Running the game in VR in unity play mode doesn't show this bug.

I am not sure what is causing this or what it is even called. I do remember in the old days windows having a similar bug where you could draw on your screen basically by dragging an interface. I have an older build where this glitch didn't occur and checked the settings I had then and now and nothing changed.

Developing in VR is still fairly new to me so if it is anything basic I might not be aware of it.

My Unity version is 2017.2.0f3 with the latest SteamVR version using the HTC Vive, which has been running on the same version as when the bug didn't occur.

This link is a video of the bug occurring during the play mode in a build (in the menu the bug didn't occur strangely enough).

This link is a video of it being run in play mode. This is what I would expect in a build as well.

Just watching the first few seconds of both videos is plenty to understand the issue I am experiencing.

Thanks in advance.

Edit:
I have discovered that this issue is called ghosting. I hope this helps anyone.

sentences: GLSL mesh discard command? Is there a GLSL command similar to the discard, but it discards the whole mesh and not just a fragment?

sentences:
Can I jump from A to B? I'm making some rudimentary AI for my side-scroller and I need to know whether an AI unit can reach point B from point A simply by taking a jump.

Flight trajectory of my characters is a bit unusal as they can apply force in mid-air (like in Jazz Jackrabbit 2 for example), so unlike the classic trajectory of a projectile which is about...

  path that a thrown or launched projectile will take (...) without propulsion.

... I suppose that my problem is more about a projectile with propulsion (e.g. rocket).

To illustrate this, this is how the flight curve looks like for my character if I jump and continually press the "left button" (it looks different at the left end, this is where I was making some manuevers in mid-air):

The force applied during flight is always parallel to the X axis, so it is F = (-f, 0) if I hold "left" and it is F = (f, 0) if I hold "right".

He can move very much like a ski jumper:

So it differs a lot from the classic trajectory which is simply a parabola (source: wikipedia):

To make it more difficult, I am simulating simple air resistance so my characters can accelerate only up to some maximum speed value.

This is done by applying a small force in the opposite direction of travel:

b2Vec2 vel = body->GetLinearVelocity();
float speed = vel.Normalize(); //normalizes vector and returns length
body->ApplyForce( AIR_RESISTANCE_MULT * speed * speed * -vel, body->GetWorldCenter() );

The AIR_RESISTANCE_MULT is a constant that in my case equals 0.1.

Let's assume that my character is an infinitely small point.

And I'm NOT taking obstructions into consideration, so my question goes like this...

How to determine (at least reliably guess), given initial velocity V, an impulse J = (0, -j) that I apply to the character upon jump, gravity G = (0, g), force F = (+-f, 0) continually applied during flight and AIR_RESISTANCE_MULT if we really decide to take air resistance into account (this is optional) , whether a point lies below the curve drawn by the path my character will take?

I have literally no idea where to start with the calculations and in fact, I am not necessarily interested in an exact answer; a well working hack/approximation would be great as the AI by no means needs to act perfectly.

edit: I've decided to solve this using simulation as Jason suggests, but how to handle such a case?

Should I draw a segment from C to D and check whether the desired point lies below this segment?

Or should I binary search the timesteps between C and D to look for the point that is close enough in horizontal distance to the desired point, and only then check the vertical difference? (seems a bit overkill to me)

sentences:
Alternative to System.Drawing for breaking an image into separate tiles in Unity As far as I can tell, System.Drawing namespace is not available in unity. I there an alternative library to load and manipulate or generate images on the fly?

Example: Imagine you want to make a jigsaw puzzle game and want to load and chop random images to use as textures or such.

EDIT: specifically I want to crop images and draw patches from one image onto another image. Or overlay images with grids.
Ultimately all the resulting images need to end up as textures on game objects. If need be, I can use texture.EncodeToPNG to save a copy for other purposes or for as a cached result.

EDIT AGAIN: Let's stick to a concrete example.
Player selects a photo from their iPhone library. It is chopped into pieces and appears on 9 cubes. the player need to arrange the cubes in the correct way to recreate the original image.

sentences: Best collision shape for rooms I'm wondering what is the most efficient collision shape to use with APIs like Bullet or Havok for rooms/interiors. Rooms tend to be boxes but are concave since the normals point inward which means no to the box shape. Rooms also can have holes in the walls (doors, windows, etc) too. If I'm assigning shapes with a modeling tool like Blender it seems like my only option is a Triangle Mesh shape but it seems like I should be able to get away with a cheaper (performance-wise) shape for something like this.

sentences:
How do I know if I've gone too far with processing things in a game? A common programming quote I see every day is:

  Premature optimization is the root of all evil!

I admit I'm one of those guys that like to do premature optimization in a pretty obssessive manner but that's probably because I'm not aware how powerful modern processors are. I can think of lots of sollutions for a problem, but all of them are tough on the memory side, and I keep thinking "This will hurt me more in the future when I'll have to re-do it because it's bad performance-wise."

How do you know when the code you are thinking of is going too far and is not a case of premature optimization? How much can your game handle at a time before performance becomes a problem?

sentences:
Is it legal to reuse a 3D model as long as it has a new texture? If I create a 3D model and texture for a client, say a house. Can I reuse that same 3D model, but apply a new texture and then legally use that in my own game? Is that enough of a difference?

Thanks!

sentences:
Creating UI using Flixel I am new to game development but familiar with programming languages. I have started using Flixel and have a working Breakout game with score and lives.

What I am trying to do is add a Start Screen before actually loading the game.

I have a create function that adds all the game elements to the stage:

override public function create():void
   // all game elements
{

How can I add this pre-load Start Screen? I'm not sure if I have to add in the code to this create function or somewhere else and what code to actually add.

Eventually I would also like to add saving, loading, options and upgrades too. So any advice with that would be great.

Here is my main game.as:

package
{
    import org.flixel.*;

    public class Game extends FlxGame
    {
        private const resolution:FlxPoint = new FlxPoint(640, 480);
        private const zoom:uint = 2;
        private const fps:uint = 60;

        public function Game()
        {
            super(resolution.x / zoom, resolution.y / zoom, PlayState, zoom);
            FlxG.flashFramerate = fps;
        }
    }
}

sentences:
How to detect when a moving rectangle (sprite) is tapped I am new to Monogame. I am currently developing a simple game, just to learn some basics of Monogame development.
The idea here is to detect whether or not the user has tapped on a a rectangle (represented by moving sprite) and return true if they did or false if they did not, but it always returns false, even if I tap on the sprite. The pertaining functions are here:

// Part of Update function
protected override void Update(GameTime gameTime)
{
    touches = TouchPanel.GetState();

    if (CheckRectangleTouch(arlington.BoundingBox, touches))
    {
        arlington.spritePosition = new Vector2(200, 200);
    }
    else
    {
        arlington.spritePosition = new Vector2(100, 100);
    }
}

// Collision function
private bool CheckRectangleTouch(Rectangle target, TouchCollection touchCollection)
{
    if (touchCollection.Count > 0)
    {
        if (target.Contains(touchCollection[0].Position))
        {
            return true;
        }
    }
    return false;
}

Any idea why is this code not working, or about a better method for collision detection?

sentences:
How display path ball will bounce? I'm trying to figure out a way to show the path a ball will travel, so that the player can line up a shot before they fire the ball.

I can't think of a way to calculate this path in advance and show it to the player, especially if it involves collision detection. At first I thought I would run the game at a super high speed for one update, plot the path with some dotted lines where the ball bounced, and then in the next frame hide the 'tracer' ball. This seems to have two issues - Calculating collision detection without actually updating the frames and collision detection getting less reliable at high speeds.

If they were straight lines I think I could figure this out in a while loop, but trying to take into account the speed of the ball, the curve of the path, the reflecting from other objects..it all seems a bit much.

I'm not looking for any code and this isn't a platform specific question, more just help trying to figure out conceptually how this would work. Can this be done? Are there techniques to achieve this?

sentences: (LibGdx) Get mouse position in ENTIRE game I'm trying to get the mouse position IN GAME. By that I mean not the position on the screen, but inside the window. I've been using Gdx.input.getX(), but that's not INGAME. How do I do this?

sentences:
Calculate normal angle in screen space I'm working on adding billboarded sprites to a game engine, but the engine allows for walking on curved terrain, like spheres. In order to look like the player is walking on the terrain, I want to start with the billboard, then rotate it around its origin (bottom centre) so that its up vector matches the screenspace normal of the terrain.

Here's a diagram of the general idea:

The billboarding works fine - passed the camera's rotation matrix to the sprite, and the poly quad's 0,0,0 is at the bottom centre of the canvas.

How can I get the angle between the normal and screenspace up?

I think it's a matter of projecting the normal with the MVP matrix, to get it as a 2D screenspace vector to calculate the angle from. But I'm not having much luck attempting to implement it.

The sprites take their positioning from the centre of the tiles, along with the normal. I'd also like to move the sprites down in the rotated axis, so that they cover the tile they're standing on.

Any other methods are welcome too.

sentences:
Rendering models in isometric view How to setup the rendering and camera for isometric gameworld projection? And specifically how do i get the images exactly the right size?

What angles to use to get the exact 2/1 isomtric view?
Methods to set the camera on the right position?
Options to set like anti alias off.

I have tried many things, 45, 30, 35.264 degree angles. What i do is set the angle of the camera, then place the camera in front of the model then use dolly/fov/lens settings to get the left and right edge of the model lined up with the save frame. Then adjust camera height so the bottom lines up with the bottom of the save frame. But i keep getting jagged edges and not the isometric style 2 width one height.

sentences:
Instantiate two objects at random non-overlapping positions I'm making an endless runner game.

I have the script that make coins and walls appear at the same time in front of the player.

The problem is that sometimes the coin and wall appear in the same place/position.

How can I ensure that coins and walls do not appear in the same place/position?

public class Instantiate : MonoBehaviour
{
public float betweenSpawn = 1.05f;
public float angle;
public Vector3 spawnValues; //Range of appearing
public GameObject coinPrefab;
public GameObject wallPrefab;

public Transform coinInstantiate;
public Transform wallInstantiate;

void Start()
{
    InvokeRepeating("Spawn", 0f, betweenSpawn);
}

void Spawn()
{
    Vector3 coinPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));
    Vector3 wallPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));

    Instantiate(coinPrefab, coinPosition + coinInstantiate.TransformPoint(0, 0, 0), Quaternion.AngleAxis(angle, Vector3.forward));
    Instantiate(wallPrefab, wallPosition + wallInstantiate.TransformPoint(0, 0, 0), Quaternion.AngleAxis(angle, Vector3.forward));
}

}

sentences:
If a 3D vector represents a point, how can it have a length? I am trying to understand vector arithmetic (and specifically its use in the Unity engine). I am not able to figure out how a vector can have a length (magnitude) even though it only represents a point (position and direction)?

Does that mean that the magnitude is simply its distance from the origin point (0, 0, 0)? Or am I missing something?

sentences:
How can I incorporate the path of a jump into my A* implementation? I need to calculate the path of a jump via A* for a simple platformer game. Calculating the direction is simple, but translating the jump physics into pre-calcuted voxel paths is a bit difficult. Especially when you factor things in like obstacles. Based on the image below, what is the best way to calculate jump in A*?

To give better context, here is a video of the game I'm working on. Will be implemented here to get companions following the player

http://www.youtube.com/watch?v=yMrbCtb2Buk

sentences:
Predicting trajectory collisions for multiple moving objects For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the xy Cartesian plane, but am now interested in understanding the basics of a priori collision detection...

On Wikipedia's entry on collision detection, I noticed the reference to Newton’s Method.  So, I want to better understand the link between finding zeros of an equation and detecting a posteriori collision.

Let's start with the most obvious case of finding roots of an equation:  If you have a projectile's trajectory modeled as a quadratic function, you can find the roots to predict at what time the height will equal zero (or any other constant height, actually, by just rearranging f(x)=C to be f(x)-C=0 and then finding roots of that expression).

So, as I understand, finding the root can tell me the time at which the object will be at any chosen height.  More broadly, we basically know the (x,y) location of the object for any given time.

But how does root finding, in particular, translate to detecting collisions with another object?  The other object may be stationary, or be moving.  If the latter, do you also determine roots/location of this moving object as well? Calculate the (x,y) trajectory of both objects and determine where they will intersect?

sentences:
Show size / dimensions of an object in Unity Inspector I want to see the size of the currently selected objects in the Unity Inspector, however I can't seem to find how to add it.
Currently when I select a model in my scene, the Inspector panel shows info about its position, rotation and scale, but not the size of the object.

What I want to achieve is to create a scene so that the objects in this scene have the correct proportions to each other, i.e. if a human has a size of 1.8 'units', an example car should be about 5 units long.

sentences:
2d games unity vs Flash do people find unity better than flash for 2d games while unity is 3d engine , or Flash still better because it's made for 2d games and flash can get the job done faster ,and now flash is better for ios/android 2d games .
so what platform is the best for 2d games?

sentences:
Multilingual data bases for most common words and phrases used in games Games tend to have easy to understand instructions/menus/tutorials and so on, so I was wondering whether...

Are there multilingual data bases, built-in with the most common phrases used in games?

For instance Start, Resume, Play, Pause, Edit Profile, Awards, etc.

Any info is appreciated.

sentences: How do you determine which object/surface the user's pointing at with lwjgl? Title pretty much says it all. I'm working on a simple 'lets get used to lwjgl' project involving manipulation of a rubik's cube, and I can't figure out how to tell which side/square the user's pointing at.

sentences:
Spherical harmonics lighting evaluation The following is taken from my current understanding of spherical harmonics. There may be errors involved which solve my question if they're resolved, so please notify me if I misunderstood something.

Evaluating reflected diffuse indirect illumination at a surface point is done by computing the integral (simplified rendering equation) in the last line of

(stolen from here).

An important property of functions in SH representation is that the integral in the last line boils down to a dot product between the vectors containing the SH coefficients for projected functions L(x,omega_i) and max(N_x dot omega_i,0).

For example, for each surface point in our target image that we wish to compute indirect illumination on, L(x,omega_i) is available in a precomputed vector of a 4 elements (for 2 bands SH approximation) containing spherical harmonics coefficients. It's not really important where it came from, just that it's available at this point.

From my understanding, to actually evaluate the lighting at a surface point [x] is to project the function max(N_x dot omega_i,0) into spherical harmonics, and dot it with the coefficient vector of the incoming radiance (and then, multiply it by the stuff in front of the integral, surface albedo / pi).
The first 4 coefficients (2 bands) for max(N_x dot omega_i,0) projected into SH basis are known, they are:

c_0 = 0.88622692545...

c_1 = -1.02332670795 * n_y

c_2 = 1.02332670795 * n_z

c_3 = -1.02332670795 * n_x

So the irradiance at that surface point with normal n would just be

E = dot(L_sh,n_sh)

where L_sh is the coefficient vector for the incoming radiance, and n_sh the coefficient vector for the cosine lobe that we just calculated. Specifically, L_sh is the same max(...) function projected into SH basis [with the normal from which the light originated], just scaled a little by the color its transporting.

The above actually looks fine and seems to produce somewhat correct lighting (hard to judge without ground truth reference). What's confusing me now, is that I've come across several sources (for example here, page 17), which, in the final step, when evaluating the lighting, don't actually use the coefficients from above to project max(N_x dot omega_i,0) into SH basis, but instead calculate n_sh as

n_sh0 =  0.282094792f

n_sh1 = -0.488602512f * -n_y

n_sh2 = 0.488602512f * -n_z

n_sh3 = -0.488602512f * -n_x

These four coefficients are actually just the spherical harmonics basis function coefficients parametrized in cartesian coordinates (here they are for spherical coordinates).

What's up with that? Why aren't they projecting the max(...) function into SH basis instead? Am I misunderstanding something? Unfortunately, the usual sources (gritty details and stupid SH tricks) don't seem to go into details of this either.

sentences:
Ship Controls modeling Real life Physics I am working on a 2D ship that will fly around in space (for now, no friction or gravity). The controls are similar to the game Asteroids. My problem is that I am having trouble connecting some variables to real life applications.

For example, if I'm defining the ships velocity, which in real physics is V=distance traveled (or change in position)/time. Should velocity be a Vector2 or just a float (or int). It's how far an object moves so I would think it to be just a single integer or number but then again, your moving on an X and Y axis so shouldn't there be two velocities? One for the X and another for the Y? The velocity being a vector2 actually works really well but when I'm doing other formulas, which are floats or ints, that require velocity I run into issues because I don't have a single number then.

Another issue i'm having trouble grasping is the direction. My code for the direction is:

shipVariables.shipDirection = new Vector2((float)Math.Sin(shipVariables.shipRotation), -(float)Math.Cos(shipVariables.shipRotation));

Which works but it will immediately turns the ship if you rotate the object while moving "forward". My most successful approach to this method was doing this:

shipVariables.shipDirection += new Vector2((float)Math.Sin(shipVariables.shipRotation), -(float)Math.Cos(shipVariables.shipRotation));

The effect I like is that instead of just turning, it essentially has to overcome the previous direction to move to the next. The part I don't like is that it gains speed way to much and it's supposed to just be a direction, not a direction and magnitude.

If I have the velocity and I can get the direction, I will be able to calculate everything else with other formulas that I know (momentum, acceleration, etc...).

Any tips to lead me in the right directions would be great, thanks.

sentences:
How to move an object uniformly from one point to another at a fixed angle? In my 2d java game, I need to move Point objects (as projectiles) from Enemy object to Player object in a straight line. I did some research and found out that I can use atan2(x, y) method of Math class to get the angle, but then how am i supposed to move the projectile in that particular angle(direction)? I checked this question: How do I calculate how an object will move from one point to another? , but did not quite understand. Also there is no vector math in java.
 Any ideas would be very helpful.

sentences:
How to avoid self-intersection when applying stroke to a curve? I have several Spline2D objects in my code, each of which has a Position, Velocity, and Acceleration method that returns a vector of the specified quantity at a particular time. I've been using these vectors in order to construct geometry to create gradient strokes for the curves, but I'm having problems with self-intersections at steep curves. As an example, here's one curve where I'm having this occur:

Wireframe: http://twitpic.com/2zplw1/full
Filled: http://twitpic.com/2zpmnt/full

As you can see, on the second bend, the inner portion intersects itself, which causes that ugly artifact. Is there a good algorithm/method to stroke curves without causing that self-intersection?

EDIT: More extreme examples, plus a mock-up of what I'd like to achieve:

Wireframe: http://twitpic.com/2ztwzi/full
Filled: http://twitpic.com/2ztwkt/full
Ideal Outcome (Mock-Up): http://twitpic.com/2ztxa8/full

sentences:
Programmers/Designers: working with artists Expanding on this question, what information do I need to communicate my artistic goals for a game to a professional artist?

Assuming I'm an indie programmer. and I've found or hired an artist to for my game, how to I go about setting a template or a brief for the look and feel of my game?

sentences:
How do I use raycast to put a bullet hole on a curved surface? EDIT: As of yet I have not been able to find a way to make the bullet hole wrap around the corner of a gameobject.

I am working on a fps game that uses raycast for shooting and so far it works, but the problem is with the bullet holes. So the script will generate bullet holes (not going to explain everything it does) like it is supposed to.

The problem is that if I shoot the corner the bullet hole will just generate on whatever side the impact was closest to. How do I get the bullet hole to spawn on curves and corners? Here is the script:

public class HitFXManager : MonoBehaviour
{

    [Range(1, 200)]
    public int decalsPoolSizeForEachType;

    public GameObject concreteDecal;
    public GameObject woodDecal;
    public GameObject dirtDecal;
    public GameObject metalDecal;

    [HideInInspector]
    public GameObject[] concreteDecal_pool;
    [HideInInspector]
    public GameObject[] woodDecal_pool;
    [HideInInspector]
    public GameObject[] dirtDecal_pool;
    [HideInInspector]
    public GameObject[] metalDecal_pool;

    void Start()
    {
        DecalsPool();
    }

    public void DecalsPool()
    {
        concreteDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_concrete = new GameObject("decalsPool_concrete");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            concreteDecal_pool[i] = Instantiate(concreteDecal);
            concreteDecal_pool[i].SetActive(false);
            concreteDecal_pool[i].transform.parent = decalsParentObject_concrete.transform;
        }

        woodDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_wood = new GameObject("decalsPool_wood");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            woodDecal_pool[i] = Instantiate(woodDecal);
            woodDecal_pool[i].SetActive(false);
            woodDecal_pool[i].transform.parent = decalsParentObject_wood.transform;
        }

        dirtDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_dirt = new GameObject("decalsPool_dirt");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            dirtDecal_pool[i] = Instantiate(dirtDecal);
            dirtDecal_pool[i].SetActive(false);
            dirtDecal_pool[i].transform.parent = decalsParentObject_dirt.transform;
        }

        metalDecal_pool = new GameObject[decalsPoolSizeForEachType];
        var decalsParentObject_metal = new GameObject("decalsPool_metal");

        for (int i = 0; i < decalsPoolSizeForEachType; i++)
        {
            metalDecal_pool[i] = Instantiate(metalDecal);
            metalDecal_pool[i].SetActive(false);
            metalDecal_pool[i].transform.parent = decalsParentObject_metal.transform;
        }

    }
}

sentences:
How do I visualize parallax layers in a level editor? I'm making a 2D game in Unity, but this would apply to any 2D game engine.

If I implement multiplane parallax with orthographic cameras, it is difficult to lay out the background layer's sprites and know where they will line up with sprites in other layers.

My first instinct was to use multiple cameras, one for each layer, and scale down the movement speed of cameras for background layers. This avoids having to move all background sprites every frame.  The problem is that a layer that moves at half speed will take up half the space of the main layer when viewed in the editor. So it is difficult to know where to place sprites as you're laying out the game. The problem gets exponentially worse as you increase the number of layers.

How do I get around this? I've tried inversely scaling the layers by their intended movement speeds while working with them in the editor. That puts all background sprites in the correct locations relative to the main layer, but they're horribly distorted.

Do I need to just suck it up and constantly switch between the editor and the running game to test the parallax backgrounds?

sentences:
Resizing a parallax background (bug) I'm attempting my first 2D vertical scroller and can't seem to get the background size to work. For some reason, it stays small. I think in the beginning of the parallax scrolling class, I was told to initialize variables and I know which ones I have to change.

public Texture2D picture;
public Vector2 position = Vector2.Zero;
public Vector2 offset = Vector2.Zero;
public float depth = 0.0f;
public float moveRate = 0.0f;
public Vector2 pictureSize = Vector2.Zero;
public Color color = Color.White;

I think I must change pictureSize to make it bigger, as the current sizing I get this:

Finally, how can I remove the whitespace from the ship image?

EDIT: Here is the code for the rendering of the actual ship:

public void Render(SpriteBatch batch)
{
    batch.Begin();
    batch.Draw(shipSprite, position, null, Color.White, 0.0f, spriteOrigin, 1.0f,
    SpriteEffects.None, 0.0f);
    batch.End();
}

The whitespace seems to be provided by XNA as I've tried clearing it using Photoshop. Because I can't directly upload to the site, I have put it here

This renders the background:

public void Draw()
{
layerList.Sort(CompareDepth);
batch.Begin();
for (int i = 0; i < layerList.Count; i++)
{
   if (!moveLeftRight)
   {
       if (layerList[i].position.Y < windowSize.Y)
       {
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y), layerList[i].color);
       }
       if (layerList[i].position.Y > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y - layerList[i].pictureSize.Y),
           layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y + layerList[i].pictureSize.Y),
           layerList[i].color);
   }
   else
   {
       if (layerList[i].position.X < windowSize.X)
       {
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X,
           0.0f), layerList[i].color);
       }
       if (layerList[i].position.X > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X -
           layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X +
       layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       }
   }
   batch.End();
}

(It's from a XNA tutorial book I'm reading.)

sentences:
Restrict Trajectory on Z axis I have a cube which I select on mouse and point out the location to throw the cube with trajectory dots.

The code is working fine, but I need to restrict the trajectory dots position on z axis so the user could not be able to throw it towards z axis.

Here is my code

   if (cubePlane.Raycast(camRay, out enter))
            {
                cubeisClicked2 = true;
                fingerPosition = camRay.GetPoint(enter);

                cubeFingerDiff = cubePosition - fingerPosition;
                ShotForce = new Vector3(cubeFingerDiff.x * shootingPowerX, cubeFingerDiff.y * shootingPowerY, 0);
                if (cubeFingerDiff.magnitude > 0.4f)
                {
                    trajectoryDots.SetActive(true);

                }
                else
                {
                    trajectoryDots.SetActive(false);
                }

                for (int dotNumber = 0; dotNumber < NumberOfDots; dotNumber++)
                {
                    x1 = cubePosition.x + ShotForce.x * Time.fixedDeltaTime * (DotSeparation * dotNumber * dotShift);
                    y1 = cubePosition.y + ShotForce.y * Time.fixedDeltaTime * (DotSeparation * dotNumber * dotShift) + (Physics.gravity.y / 2f * Time.fixedDeltaTime * Time.fixedDeltaTime * (DotSeparation * dotNumber + dotShift) * (DotSeparation * dotNumber + dotShift));
                    z1 = cubePosition.z + ShotForce.z * Time.fixedDeltaTime * (DotSeparation * dotNumber * dotShift);
                    Dots[dotNumber].transform.position = new Vector3(x1, y1, 0f);
                }
            }
        }

I set the z axis to zero every where but still able point towards z axis.

Note: It is 3D game not 2D

sentences:
Playing a sound only once during collisions So recently i thought i figured out a solution for it, only to find out it doesnt work when i have more than one of the same object type added to the level.

What i was doing is iterating through my different list of objects and checking if any of them are colliding with the player, if they are i play the sound for that one colliding with the player and then i set the boolean for the sound to true, meaning the sound has been played now.

When their are no collisions going on or if the current object being iterated isnt colliding with the player i set the sound boolean back to false. So as you probably can see, there is a issue when there is more than one of the same objects added because one of them will set the boolean to false and the sound will be played over and over as long as the player is colliding with one of the objects.

So i have run out of solutions to fix this so i am seeking out help.

Thanks anyone who can offer assistance.

EDIT:

Here is an example of how i am doing it now:

private void checkNeutalSwitchers() {

Iterator<Tile> switcherIT = this.neutralSwitcherTiles.iterator();

while (switcherIT.hasNext()) {
    Sprite square_sprite = switcherIT.next();
    float distance = MathUtils.distance(playerBoat.getX(),
            playerBoat.getY(), square_sprite.getX(), square_sprite.getY());
    if (distance < 11) {
        if (square_sprite.collidesWith(player)) {
            if (square_sprite.getUserData().equals("triangle")) {
                playerBoat.detachChild(player);
                player = swithcer.getTriangle();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                    this.switchShapesSound.play();
                }

            }
            if (square_sprite.getUserData().equals("square")) {
                playerBoat.detachChild(player);
                player = swithcer.getSquare();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                     this.switchShapesSound.play();
                }

            }
            if (square_sprite.getUserData().equals("circle")) {
                playerBoat.detachChild(player);
                player = swithcer.getCircle();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                    this.switchShapesSound.play();
                }

            }
            if (square_sprite.getUserData().equals("rectangle")) {
                playerBoat.detachChild(player);
                player = swithcer.getRect();
                playerBoat.attachChild(player);
                if (this.neutralSwitcherBool == false) {
                    this.neutralSwitcherBool = true;
                    this.switchShapesSound.play();
                }

            }
        } else {
            this.neutralSwitcherBool = false;
        }
    }
}

}

sentences:
Pathfinding and clusters For an assignment, I am required to implement an A* algorithm in order to find the shortest path between two object using different heuristics

null, this effectively becomes Dijkstra
Euclidean distance
Clustering

So I have successfully implemented the A* algorithm and the first two heuristics and they work wonderfully. However the third heuristic I am having trouble with. According to the text

  The cluster heuristicworks by grouping nodes together in clusters. The nodes in a cluster represent
  some region of the level that is highly interconnected. Clustering can be done automatically using
  graph clustering algorithms that are beyond the scope of this book

  When the heuristic is called in the game, if the start and goal nodes are in the same cluster, then
  Euclidean distance (or some other fallback) is used to provide a result. Otherwise, the estimate is
  looked up in the table.

I'm not one to give up on a challenge so I would like to implement some automatic clustering technique. I am lazy and I really don't feel like manually clustering nodes, I want it to be automated. So I have been doing research on clustering and I've come across this technique: Markov Cluster Algorithm(MCL)

Are there any good methods besides the one presented? I have searched the IEEE database for clustering techniques but I am not entirely sure if those are valid for the scope of my assignment. I'm not looking for any code but I would surely appreciate any guidance on the matter.

Edit: I should clarify what is required in the assignment for clustering.

  For the Cluster heuristic consider the nodes in each room to contain a cluster, and each
  corridor to contain a cluster. Using Dijkstra’s algorithm, between each pair of clusters
  compute the shortest distance between any two nodes (one from each cluster). Use
  these results between pairs of clusters to create a lookup table.

Furthermore this is the requirements for the level. Each convex polygon represents an obstacle. If I had to guess, there are 7 clusters in total

sentences:
Reducing Spherical Harmonic Ringing I've generated some 2nd order SH light-probes from cube-maps in my scene and I was surprised how strong artifacts are around the back of the dominant lights. I switched to a Lambert source plus ambient and got a result just like in the image below. Stupid SH Tricks (http://www.ppsloan.org/publications/StupidSH36.pdf) suggests a technique called Han Windowing for reducing the artifacts, which I'm guessing is a convolution filter similar to a Gaussian blur, but I'm unable to tell much from the description or find an example.

I've also read some sources that say Gaussian might be best when using a HDR source.

sentences:
In GameMaker, is it possible for users to code something into a game while playing, and verify that it is correct? I was wondering if in GameMaker it would be possible to allow people to code a small bit of the game in so that they then unlock that move/code?

Think of the game DLC Quest, in the way that you had to find a few coins and then you were able to buy the ability to jump, would it be possible to do this but instead of getting people to buy the ability to jump, get them to code it? (Only a little bit of code, of course, not an entire script?)

sentences:
Entity systems, creating new entities? How do I create new entities (the collection of their components) in an entity system? I have space ships in my game, for example, they need a lot of information set in their components when I create them. For example I set the mass, size and a moment of inertia tensor in a physicscomponent of the ship. I also have a component that contains a list of engines on the ship (is that right by the way? My ES doesn't support multiple components of the same type, should it?), each engine has a position and a force.

Now when creating a basic ship I see a couple of options. I can just hard-code it in my game. This is the way I have it at the moment, and it doesn't feel too good, there will be a lot of code to create different kind of space ships that are very similar except for some properties which would create lots of code duplication.

I could also use a database, I've seen this used before and I can definitely see how it'd be a good fit. Although it's a pretty small hobby project that I'm working on and it seems like it would be a little overkill. I'm not sure though, maybe it's worth it?

So the only thing remaining I can think of is describing entities in a text file of some sort, which might work. I guess it would require writing lots of code to parse different kinds of values, and where would I put the code that actually sets the values on the components? I'm using C# so I guess I could use reflection on the properties but I fear it'd be slow? And I don't want to clutter up my component code.

Maybe I should mention that it's a multiplayer game. So some components are client-only which could easily be marked in some way.

So how do you create new entities, or their components, in an entity system?

sentences:
How should I pause a rotation when my character collides with a gameObject? My character always moves forward and when he enters a turn(Trigger) this is what happens:

if(other.CompareTag("TurnLeft"))
{
    // Rotates the character in 90 degrees in 6 seconds.
    MoveObject.use.Rotation(transform, Vector3.down * 90.0, 6);
}

But when he contacts with the ("StageColliders"), he keeps rotating, even though he doesn't change his position. I practically need him to pause rotating when he hits ("StageColliders") and continue when he's free of collision.
Something like this would be ideal.

if(other.CompareTag("StageColliders"))
{
    // Pause the rotation above.
}

I found the MoveObject script here http://wiki.unity3d.com/index.php?title=MoveObject
in case someone's curious.

sentences:
Protobuf vs Lua for custom file format I'm defining a custom/simple file format for loading textures in my game.  I narrowed my choice of file formats to two options:

Lua
protobuf

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build.  Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.
However, I'm kinda stuck.  Most (all?) of my support tools I write in python.  I can't find a small clean Lua module for python.  That means my python tools end up parsing the Lua syntax by hand.  It's not too onerous as file format uses a very small subset of Lua, but still annoying.
So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.
So which would you pick (or already did)?
And more importantly why?

My thoughts.
Lua
texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}

+ "plain" text format
Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
+ parsing is trivial as the engine already supports Lua.
-/+ easy (not trivial) to generate, and can be easily verified with luac.
- python tools have difficulty parsing

protobuf
message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}

+ protobufs are well tested and optimized
+ they will be needed eventually to do network communication
- networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
+ trivial to parse
+ trivial to generate
- complex binary format, impossible to edit, or verify by inspection.

sentences:
Managing Game Entity coordinates In my Game I'm currently have "Scene Coordinates" which are the X,Y coordinates relative to a Game Scene.

In that Scene there are Game Entities, let's say there's a GameEntity A in x=100.0, y=100.0 ( scene coordinates )

Which is the best way to have "Entity Coordinates" so that from GameEntity A point of view, he's standing at x=0.0, y=0.0 with OpenGL transformations?

In that way if I apply something like

glRotatef(angle, 0, 0, 1)

The entity will rotate around it's own origin and not the scene "global" origin.

sentences:
What are some standard mathematical tests for projection matrices? I'm trying to double check my math in my projection matrices.  I'm thinking about "unit tests" when I ask this.  I'm looking for 4 or 5 unit tests that would be appropriate to give one confidence that the projections are correct.

This is a little more than an obvious question.  Let me explain...  When I did this with a quaternion, the potential tests were very logical.  The perspective transforms by comparison are somewhat non-intuitive.  For a quaternion, if I start with the unit Y vector {0.0, 1.0, 0.0} and I rotate it a quarter turn about the x-axis, I know that the answer is the unit vector in the negative z direction.  It's a logical answer.  Is there something equally logical/obvious for orthographic and perspective projections?

I've gone through many math books and many tutorials over the years.  I'd like to once and for all "prove" that my ortho and perspective matrices are always projecting correctly.

If I composed an ortho matrix using left, right, bottom, top, near, far as follows:

              0.0f, 1.0f,
              0.0f, 1.0f,
              0.0f, 1.0f

I might get the following matrix (right-handed / OpenGL style)

  2.000000,   0.000000,   0.000000,  -1.000000
  0.000000,   2.000000,   0.000000,  -1.000000
  0.000000,   0.000000,  -2.000000,  -1.000000
  0.000000,   0.000000,   0.000000,   1.000000

I'd like to know if that matrix is computed correctly.

Then for a test, I'd multiply a vertex such as {1.0f, 1.0f, 0.0f} against the matrix and get back {1.0f, 1.0f, -1.0f}.  Is it correct?  ...and I'd like to do that on several standard points.

I'm having trouble visualizing "standard" or "logical" tests for this.  Something that at a glance, just makes sense.  (like the quaternion example above)

sentences:
XNA Sprite Clipping Incorrectly During Rotation I'm having a bit of trouble getting my sprites in XNA to draw when near the edge of the screen.

Seemingly if you use SpriteBatch to draw then XNA will not draw it if for example (mPosition.X + mSpriteTexture.Width < 0) as it assumes it is offscreen.

However, it seems to make this decision before it applies a rotation. This rotation can mean that, even though (mPosition.X + mSpriteTexture.Width < 0), some of the sprite is still visible on screen.

EDIT: The rotation being a part of the problem is only a hypothesis but to clarify, as the sprite moves towards the edge of the screen at a steady rate (applying a small constant velocity) it will suddenly disappear when it is still partially (usually about half of the sprite) on screen.

My question is, is there a way to get it to draw further outside the viewport or temporarily disable sprite clipping during a certain spriteBatch.draw(...)?

sb.Draw(mSpriteTexture, mPosition,
                new Rectangle(0, 0, mSpriteTexture.Width, mSpriteTexture.Height),
                Color.White, Globals.VectorToAngle(mOrientation), new      Vector2(halfWidth, halfHeight), scale, SpriteEffects.None, 0);

sentences:
Why is the ownership fixed when synching objects? I'm creating a billiard game where one white ball will be controlled by two online players.

I have set my object photonview to ownership takeover.

When a player shoots the ball in one client, it is synced on other client.
Now when I update the ball on the other client, the other client is not updated.

Why is the ownership fixed?

Only one client is sending the updates to the other client, and not vice versa.

What should I do here?

sentences:
Deferred Shading 2D Texture Issue I've been following the Rastertek tutorial on deferred shading (http://www.rastertek.com/dx11tut50.html). I have implemented it in my own architectural way but have ended up with the same issue as the tutorial; if you get the source and take a look, it appears to be working fine - but if you move the camera around you can see that only the front 2 faces are being rendered, and its like as if the cube is only being rendered to some kind of invisible pane - viewing from behind it is completely invisible.
In my image you can see that the model is being completely cut off. Is my 2D render texture possibly floating out in that space?

To provide the amount of code I have would be very dodgy. If you can help me out conceptually or take a look at the downloadable source code I would very much appreciate it.

Please see my attached image.

This image is from about 45 degrees to the side - it appears to be getting cut off along the red lines I've drawn (ignore the missing topside - thats just the light only going down the z plane):

sentences:
Why is my screen black? I'm developing an android game, and my screen is not displaying what I want it to. I've read various tutorials but they are either outdated or hard to follow. I have followed this tutorial and most of the code is identical. However, when running the game, the screen is black.

Game logic loop:

public void run(){
    while(running){
        long beforeTime = System.nanoTime();
        gameEngine.update();
        Canvas c = null;
        try{
            c = holder.lockCanvas(null);
            //synchronized (holder){
                c.drawRect(0,0,c.getWidth(),c.getHeight(),blackPaint);
                gameEngine.draw(c);
            //}
        }finally{
            if(c!=null){
                holder.unlockCanvasAndPost(c);
            }
        }

        this.sleepTime = delay-((System.nanoTime()-beforeTime)/1000000L);
        try{
            if(sleepTime>0){
                this.sleep(sleepTime);
            }
        }catch(InterruptedException e){
            Logger.getLogger(GameThread.class.getName()).log(Level.SEVERE,null,e);
        }
    }
}

Main activity:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                         WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.activity_main);
}

engine.draw(Canvas c):

public void draw(Canvas canvas){
    Paint bluepaint = new Paint(Color.BLUE);
    canvas.drawRect(50,50,100,100, bluepaint);
}

EDIT:

@wondra I did test the break point, and the thread does actually get started, or so I think. The app runs and there are no errors thrown to the log console. Someone also suggested it was the emulator not running properly.

@fadden I have implemented what you suggested, still nothing... does starting the view from the xml and not from the Java have to do anything to do with it? Does the instance still exists if I don't declare it in Java?

sentences:
How can I fetch a list of games and DLC for a user via Steam's API? We're trying to figure out how to fetch a list of all games and DLC owned by a Steam user using that user's Steam ID.

There is a method for fetching a list of games for an account by using the Steam Web API but this does not include any DLC. Another option is to use the public community XML data provided by Steam.

The problem with this is first of all that this information can be made public/non-public so we can't be sure to get the whole picture. Also this way of fetching data is flagged as deprecated by Steam.

Does anyone know of a way to achieve this using supported Steam APIs?

sentences:
What would be a good filter to create 'magnetic deformers' from a depth map? In my project, I am creating a system for deforming a highly detailed mesh (clothing) so that it 'fits' a convex mesh.
To do this I use depth maps of the item and the 'hull' to determine at what point in world space the deviation occurs and the extent.

Simply transforming all occluded vertices to the depths as defined by the 'hull' is fairly effective, and has good performance, but it suffers the problem of not preserving the features of the mesh and requires extensive culling to avoid false-positives.

I would like instead to generate from the depth deviation map a set of simple 'deformers' which will 'push'* all vertices of the deformed mesh outwards (in world space). This way, all features of the mesh are preserved and there is no need to have complex heuristics to cull inappropriate vertices.

I am not sure how to go about generating this deformer set however. I am imagining something like an algorithm that attempts to match a spherical surface to each patch of contiguous deviations within a certain range, but do not know where to start doing this.

Can anyone suggest a suitable filter or algorithm for generating deformers? Or to put it another way 'compressing' a depth map?

(*Push because its fitting to a convex 'bulgy' humanoid so transforms are likely to be 'spherical' from the POV of the surface.)

Edit: Here is an image/diagram rightly suggested that illustrates what I am trying to achieve.

Also, I should say since this question was posted I worked a lot more on this problem, and though I never solved how to the get the deformers I did eventually decide that depth maps for this were unsuitable as:

If the deformed mesh is not complete, it is possible to get texels in the map that are meant to be on the other side of the convex mesh (because they are not obscured by those closer to the camera on the correct side).
The efficiency was not as high as I had hoped due to the fact 6 maps were needed per deformation.

Not that these were unsolvable, but the other solution, which involved collision testing in kernels running on the GPU, resulted in higher quality results and was much simpler, even though it may not be as fast.

I still think this questions problem is interesting though and would be interested in any answers as I am sure there are situations where it would be preferred.

sentences:
Game Background graphics blurred edges? Why when using this code for the background for my game do I receive blocks with blurred edges?

public final class State_Play extends State_Template {
    private BufferedImage background;
    private int[] pixelelements;
    private int width,height;

    State_Play(){
        init();
    }

    public void init(){
        width=8; //Configuration.appwidth,
        height=6; //Configuration.appheight
        background=new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        pixelelements=((DataBufferInt) background.getRaster().getDataBuffer()).getData();
        maketuringarray();
    }

    public void maketuringarray(){
       int singlecolor=new Random().nextInt();
       pixelelements[new Random().nextInt(width*height)]=singlecolor | 0xFF000000;
    }

    @Override
    public void update() {
       maketuringarray();
    }

    @Override
    public void render(Graphics g) {
        g.drawImage(background, 0, 0, Configuration.appwidth, Configuration.appheight, null);
    }

Like this

sentences:
Detecting collisions without rigidbody I have a car with the following aspect:

As you can see, colliders are locally static, because they are separated from the original rigidbody component.

Well, as you can suppose, I have a problem, because MonoBehaviours with an OnTrigger(...) or an OnCollision(...) method won't work. (It needs an rigidbody and a collider on the same object)

I thought about Raycasting:

https://docs.unity3d.com/ScriptReference/Physics.BoxCast.html

https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

https://docs.unity3d.com/ScriptReference/Physics.SphereCast.html

But I have another problem, I have to specify a direction, so, using this: http://answers.unity.com/answers/539155/view.html isn't an option because this is too slow?

What can you suggest me?

sentences:
How to handle keyboard controls in Arkanoid game I'm making simple Arkanoid clone in Unity with both keyboard and mouse controls available. When I gave it to my colleagues to test one complain was that keyboard controls are not precise enough,. The problem is that I don't really know how to find a balance between two factors:

If I make paddle speed too high then it lacks precision to position it just right to make ball go to the last few blocks.
If I make paddle speed too slow then it's going to be difficult to reach ball in time.

I thought about it and I don't recall any version of arkanoid that solved that problem. Currently I have 3 ideas:

Make two (or more) keys to go in each direction. One will go faster and another slower.
Instead of making multiple buttons lets allow player to change speed of paddle during the game. Probably by entering number from 0-9 on keyboard.
Just leave it like it is now. Other control schemes are not intuitive enough.

Does anyone have any experience with this? Which approach is the most reasonable?

Edit:
Code I'm using:

    Vector3 pz = transform.position;
    pz.y = y;
    pz.z = 0;
    if (Input.GetKey(KeyCode.LeftArrow)) {
        pz.x -= Time.deltaTime * KEYBOARD_SPEED_MULTIP;
    }
    if (Input.GetKey(KeyCode.RightArrow)) {
        pz.x += Time.deltaTime * KEYBOARD_SPEED_MULTIP;
    }
    pz.x = Mathf.Clamp(pz.x, -60, 60);
    rb.MovePosition(pz);

I simply move paddle by constant speed which includes timedelta. And then I clamp position to screen.

sentences:
lz4 archive with encryption I want to make a game data archive that contains all the game assets, now I could use zlib or lz4 to just make a simple zip archive type thing, but I need a bit more security, does anyone have any recommendations on adding AES encryption to the whole thing? I was also thinking maybe I need like a MPQ archive type system where I can mount the thing in the game engine and it acts as an interface to accessing the individual files inside, allowing streaming?

Any ideas appreciated, thanks.

sentences:
Game engine with good Lua entity creation/management I'm looking for an engine that constructs it's entities using Lua or other scripting language. This is in order to find inspiration and do it in my own engine as well.

I know that CryEngine does use Lua to make their entities, but I wanted to know if there are some other alternatives that I can look up.

Thanks!

sentences:
Why is my player spinning after a collision? I've made a very simple 2D top down prototype with Unity. This is the code I use for the player:
public class PlayerTurnsController : MonoBehaviour
{
    private Rigidbody2D m_rb;
    public float Speed;

    Vector2 m_movement;

    void Start()
    {
        m_rb = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        var moveHorizontal = Input.GetAxis("Horizontal");
        var moveVertical = Input.GetAxis("Vertical");
        m_movement = new Vector2(moveHorizontal, moveVertical);
    }

    void FixedUpdate()
    {
        m_rb.MovePosition(m_rb.position + m_movement * Speed * Time.fixedDeltaTime);
    }
}

At the start and while moving everything seems OK. But when I bump into some Colliders, the player sprite starts spinning when it should just stop (not pressing any button anymore)
I already tried:

To set the rotation only when the m_Movement-Vector is > 0.1f. But this didn't change anything.

sentences:
Android game crashes when attempting to start wifi hotspots I have two methods that will try to start the WiFi hotspot on the android device so that others can connect and play the game.the problem is both method have problems and don't work.
the first method:

    public void ConnectWiFi()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {
                    AndroidJavaObject wifiConfiguration = new AndroidJavaClass("android.net.wifi.WifiConfiguration");
                    wifiConfiguration.Set("SSID", meSSID); // string
                    wifiConfiguration.Set("preSharedKey", mePassword); // string
                    wifiManager.Call("setWifiApEnabled", wifiConfiguration, enabled);
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nE - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }
    }

it crashes the game and I can't debug it.
the secont method:

    public void ConnectWiFiHardWay()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {

                    using (AndroidJavaObject classObj = wifiManager.Call("getClass"))
                    {
                        using (AndroidJavaObject wifiConfiguration = new AndroidJavaObject("setWifiApEnabled"))
                        {
                            wifiConfiguration.Set("SSID", meSSID); // string
                            wifiConfiguration.Set("preSharedKey", mePassword);
                            using (AndroidJavaObject wifiCfgClass = wifiConfiguration.Call("getClass"))
                            {
                                using (AndroidJavaObject booleanObj = new AndroidJavaObject("java.lang.Boolean"))
                                {
                                    using (AndroidJavaObject booleanClass = booleanObj.Call("getClass"))
                                    using (AndroidJavaObject methodObj = classObj.Call("getMethod", "setWifiApEnabled", wifiCfgClass, booleanClass))
                                    {
                                        methodObj.Call("invoke", wifiManager, wifiConfiguration, enabled);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nH - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }

this one throws an exception that says setWifiApEnabled Cannot be found
I can post the complete error text if that helps.
Also I followed this questions instructions.

sentences:
Android Canvas 2D Game: Supporting multiple screen sizes/resolutions I'm planning to develop a 2D game for android devices by using simple Canvas Surfaces (I know that OpenGL might be more efficient - but Canvas should definitely be enough for my type of game).

I'm currently researching on how I should handle different screen sizes/resolutions/ratios of the different android devices. I don't think it's a big deal to scale a bitmap if the screen size is just 920x512 instead of 1920x1024 (for example) - but what about completely different ratios? Like 1200x800px screens? I would have to stretch these bitmaps, or just make more objects visible from my game, which would normally be hidden in shorter screens.

I didn't really find anything useful on my research (mainly some discussions about Canvas VS OpenGL...) - so I'm giving it a try here.
What's the best/most common used technique to adjust a game to different screen sizes? Other than just putting black borders along my game, if the width/height is too large.

sentences:
Questions about dynamic loading and unloading of assets and game state I've wondered about this for a while as I worked on my project, but couldn't quite come up with the best way to expose my problem. I'll start with some context.
Context
I have a game that is divided into rooms. So from an asset point of view, it makes sense to load and unload them on a room by room basis. In my case this boils down to all the textures and audio files required by that room.
However, player triggered events can change the state of any dynamic object in the world, even those that are not on the current room. Furthermore, since the game is multiplayer, even if I'm not seeing the changes immediatly, other players might. So, even if the assets aren't loaded, I still need some way to register that change in state.
The way I'm currently handling this is to keep the entire game world state in memory since the start of the game, and only bother about dynamically loading and unloading its assets.
Which leads to the following questions related to resource management.
Questions

Loading and storing the entire game state at once seems reasonable for the scope of my games, but I get the feeling it wouldn't scale very well to larger projects. So how is this usually implemented in massive games such as MMOs that need to update a large amount of entities that are far away from the player?

Assets that are guaranteed to be needed for a particular room (such as the room's scenario and static objects) can be loaded when the player enters the room - possibly with a transition or a loading screen in between. But what about assets for unpredictable game entities that might suddenly come into your current room at any time, such as other players?
Would it be reasonable to treat those separately, load them all at once when the game starts, and keep them in memory the entire time, or would it be better to load them and unloaded dynamically in a separate thread? And in that case, does XNA handle loading assets from another thread well?

sentences:
Optimization of animation for large quantity of objects I have run into a problem where I need to animate plenty of circles just scaling up and down.

When I use animator, it needs 16ms per frame for 10000 circles. It drops fps significantly from 1000 to 30.

If I use scripts to scale the object, the result would be probably the same or worse, 10000 coroutines changing localScale.

What is the approach to this kind of problem? In agar io for example, they have done this without decreasing fps significantly, the game runs in a browser.

What are the optimizations that can be made?

Use of shaders? Chunks of objects animating as group at the same frame in animation?

sentences:
Layers with parallax in a game with zoom out by a transformation matrix I'm trying to implement a parallax rendering to my multi layered backgrounds. It's a classic 2d fighting game like The King of Fighters and Street Fighter.

It may have a stage composed by 5 layers.

Layers:

1 = Factor of 100% (the original, where generally the characters and the floor are present)

2 = Factor of 75%

3 = Factor of 50% (half of movement and scale of the first layer)

4 = Factor of 25%

5 = Factor of 0% (static, generally stuff very far away of the camera, like the sky, moon, stars etc.)

The camera with scale 1 shows 640 x 384 pixels, and with the max zoon out (scale 0.5) shows 1280 x 768 pixels.

Ie, all the stages of the game have a maximum size of 1280 x 768

These would be the sizes of the images of each layer aforementioned:

100% = 1280 x 768

75% = 1120 x 672

50% = 960 x 576

25% = 800 x 480

0% = 640 x 384

Every works fine when my transform matrix is with scale of 1, since it's only needed to multiply the actual camera position to the factor of the current layer being rendered.

The difficulty arises when the scale of the camera changes. It seems that I need to compensate the scale of the matrix in the parallax factor of the layers, but I can't figure out how.

Any sugestion?

--UPDATE--

Here some images of an example of a layer with 50% factor (960 x 576):

The first image the camera matrix is with scale 1 (no zoom) and is positioned in left edge of the screen. The second is the same but in the right edge and the last image is with the max zoom out (0.5).

I already correct the scale of the layer, the problem is correct the offset of its translation.

This layer is draw at the position (0, 0) relative to the stage size (1280 x 768) and with a origin Vector of (160 x 96).

--- UPDATE2 ---

I don't think my problem is in the camera matrix, because the sprites without the parallax processing are drawing correctly with any zoom, but here it is:

var gameResolution = new Vector2(640, 384);

var currentScale = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width / gameResolution.X * camera.Zoom,
                               GraphicsDevice.Viewport.TitleSafeArea.Height / gameResolution.Y * zoom);

var middleOfScreen = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width - 1) / 2f,
                                 GraphicsDevice.Viewport.TitleSafeArea.Height - 1) / 2f);

var currentTranslation = new Vector2(middleOfScreen.X - cameraPosition.X * currentScale.X,
                                     middleOfScreen.Y - cameraPosition.Y * currentScale.Y);

var cameraMatrix = Matrix.CreateTranslation(currentTranslation.X, currentTranslation.Y, 0);

cameraMatrix.M11 = currentScale.X;
cameraMatrix.M22 = currentScale.Y;

sentences:
Bubble shooter clone, structure for storing/adding of bubbles Im having a few issues trying to figure out what the best data structure to use for storing bubbles on the grid, and how to connect new bubbles to the grid when a moving ball collides with a ball on the grid.

My first implementation was to create a 2d array and populate it with a bunch of bubbles. I then iterate through the array and make a connection between bubbles only if there are adjacent bubbles in all directions from the current bubble. After Ive build the grid, and made all the connections, I added each bubble to list that I can look up and find connections between bubbles when a collision is detected.

When a moving ball collides with a stationary ball, I create a connection between the ball and then run a recursive BFS search from the colliding ball, finding all balls that are of the same color of the ball I just collided with. This works, but isnt very bulletproof, as I often get broken connections between balls when certain balls are deleted, or often groups of balls wont disappear that should.

My second implementation was to use a Hex grid. I had read similar questions on here where users suggested using a hex grid, so I thought I would try that approach. Again, I created a 2d array with a bunch of bubbles and tried running a mapper which mapped certain balls to each other depending on where they are in the grid. I still had a bunch of issues with connections, and often connection would end up getting broken or not connected properly.

Theres a lot of edge cases that Im still stuck on that im not exactly sure how to solve. For example, when I a colliding ball makes a connection with another ball, how should I deal with if that ball collides with a second ball at the same time. Or how should I look for balls within a certain area.

I feel like Im just overthinking this, and making the problem way more complex then it needs to be.

sentences:
Only affect pixels in buffer with alpha 0 I'm working on a transition effect where I have a texture and simply draw that as a pattern to my buffer. Here is a demo, use "e" to start the effect again.
This looks fine but it won't work if the texture has pixels with alpha 0 < x < 1.

This is the texture I used in my demo ( zoomed ):

As you can see the edges are rough and full on opaque. If I do use a texture with softer edges the pixels with alpha will just smear the black away. How can I achieve the effect of pixels in my texture with an alpha of 0 < x 1 to only affect pixels with alpha 0 in my buffer?

sentences:
AABB SAT code detects collision wrongly I've been having trouble getting my SAT code working using AABBs, and I've been trying to find a solution but, I'm scratching my head.

For some reason, it detects collisions very wrongly, as shown by this desk check I did.
(AABBvsAABB method at bottom.)

Consider two AABB, A and B.

A = X: 0, Y: 0, W: 102, H: 19

B = X = 87, Y: 6, W: 1, H: 1

These are colliding.

First, calculate normal

Normal = (0,0) - (87,6) = (-87,-6)

Next, we get half widths

aExtent = 102/2 = 51
bExtent = 1/2 = .5

Now lets calculate the overlap of the two.

 xExtent = 51 + .5 - |-87| = 51.5 - 87 =  -35.5

xExtent is less than zero so it says its not colliding, obviously this is wrong.

   /// <summary>
   /// Compares bounding boxes using Seperating Axis Thereom.
   /// </summary>
   public static bool AABBvsAABB(AABB a, AABB b, ref Manifold manifold)
   {
        manifold.Normal = a.Position - b.Position;

        //Calculate half widths
        float aExtent = a.Width / 2f;
        float bExtent = b.Width / 2f;

        //Calculate the overlap.
        float xExtent = aExtent + bExtent - Math.Abs(manifold.Normal.X);

        //If the overlap is greater than 0
        if (xExtent > 0)
        {
            //Calculate half widths
            aExtent = a.Height / 2f;
            bExtent = b.Height / 2f;

            //Calculate overlap
            float yExtent = aExtent + bExtent - Math.Abs(manifold.Normal.Y);

            if (yExtent > 0)
            {
                //Variable to multiply the normal by to make the collision resolve
                Vector2 faceNormal;

                //Check to see which axis has the biggest "penetration" ;D

                //Collision is happening on Y axis
                if (xExtent > yExtent)
                {
                    faceNormal = manifold.Normal.X < 0 ? -Vector2.UnitX : Vector2.UnitX;
                    manifold.PenetrationDepth = xExtent;
                    manifold.Normal = Physics.GetNormal(a.Position, b.Position);
                    manifold.Normal.X *= faceNormal.X;
                }
                //Collision happening on X axis
                else
                {
                    faceNormal = manifold.Normal.Y < 0 ? -Vector2.UnitY : Vector2.UnitY;

                    manifold.PenetrationDepth = yExtent;
                    manifold.Normal = Physics.GetNormal(a.Position, b.Position);
                    manifold.Normal.Y *= faceNormal.Y;
                }
                manifold.AreColliding = true;
            }
        }
        return manifold.AreColliding;
    }

Any idea what I am doing wrong here?

sentences:
overlapping 3d particles not blending nicely when at the same z I'm working on a 3d particle emitter.  It's going pretty good but I'm still having a problem with triangle sorting.

As you can see in the photos, there are some particles that are not blending properly presumably because of sorting.  I do sort my quads before I draw them back to front.  And they are all being drawn in a single glDrawElements(GL_TRIANGLES... call.

Blending is on & depth buffer is on.  Depth buffer has to be on because of the other 3d objects in the scene that are sometimes in front and sometimes behind the particles.

When they're moving in a z space they're sorting better and you don't see it as much:

I'm using a sort with the following compare:

int compare (const void *a, const void *b) {
   Particle *ia = (Particle*)a;
   Particle *ib = (Particle*)b;

   float t = ib->distanceToCamera - ia->distanceToCamera;
   if (t<0) {
       return -1;
   }
   return (t>0);

}

But I think there are times when some particles have the same z and then they're not blending nicely.

One thought was to somehow force them to not be the same z.  But with them moving on their own I'm not sure about that.

QUESTION - if overlapping triangles are close in z space but not equal, and still drawn back to front within the draw command, could they still overlap like this?

ANSWER - I set a break point and printed out all my structures to find that there are a ton of quads in the same z.  In groups.

Using the advice from the checked answer I was able to fix it. By making sure to render the solids first and the particles last I don't need to worry about writing to the depth buffer while rendering the particles. In my game they're all like gases, smoke and air. So they all need to blend with each other and on to things deeper in the scene than them.  When I start to render the particles I set:

glDepthFunc(GL_LEQUAL);
glDepthMask(GL_FALSE);

And when I'm done rendering them I return it to:

glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE);

And look at the result:

What I believe was happening was that as particle triangles were drawn if they were on the same plane they were writing to the depth buffer and then the next one on that z if larger would get masked. By turning off depth mask it doesn't write to the mask as it's drawing the particles so they're not masking each other any more.  Since I draw them last they don't need to mask other things.

UPDATE: Another benefit I just figured out. Now I don't have to sort the particles at all. The sort was only to make them draw properly with the depth test on. And that's no longer needed. So I have that savings as well.

sentences:
Tilting towards turn direction (for a motorbike) I have a motorbike which moves along based on a direction vector, I set its forward direction to the direction it's moving.

What I'd like to also do with it is have the motorcycle tilt in the direction it's turning, I haven't had much luck figuring this out though, any ideas?

sentences:
Open world game state saving Android As a hobby project I'm building a 2D game with a custom game engine in Android. Currently I can render a json map, and let the user interact with objects on the map. The game should be an open world map, with multiple maps. One of my current maps has a 150 x 150 tile pattern, with on every tile one or more objects. Thus, the map has 22.500, multiple layers, and more attributes. The player can edit objects (like fish in water object, plant seeds in soil, etc.), so every object needs to be stored separately. Some objects, like growing plants, need to be updated over time, even when the player is not playing the game.

My question is about efficiently saving and loading the game state. I think I need to store all the attributes of the maps, together with the objects, player progress, npc progress, and so on. Since this is a lot of data for a mobile device, I can't think of a good way to store this on the phone (or in the cloud).

I've tried the following:
- Store the entire game state in a serialized file. The parsing of this file took way to long while loading, and when one object's state changed, the whole game had to be loaded.
- Store every object in a sqlite database, with for every attribute a column. This was even slower than the first option, so not an option either.
- Store every object serialized as a blob in the database. This option wasn't much faster than the previous one.

I've been looking at ObjectBox, but in order to create the entity values for this database, I need to change a lot of reference values to ToOne<> or ToMany<> objects, which will take a lot of time and since I am using the map attributes to render the maps, the wrapping and unwrapping of the objects would cause (unnecessary) delay. (This is an assumption)

How do I save the game state without causing a 20-minute loading delay?

sentences:
How to create a map-like (clouds) texture If you place a map of the world on a sphere, it will look like the image is continuous. Basically the left end of the image is sort of a continuation of the right end. You won't be able to see any cuts.

I'm trying to create a clouds texture to add to my planet such that it will seem it has clouds. I managed to create the clouds in GIMP, however, I can't figure out how to make sure the left end of my image is a smooth continuation of the right end. For example if you were to map the below image to your sphere (I removed transparency to make it clearer), there would be a very obvious transition from the right end of the image back to the left end on your sphere. How would I create a texture such that I get rid of that?

Sorry for my lack of terminology.

sentences:
Implementing a 2D Platformer Game Engine Any ideas where I can find info about making 2D jump & run games? I need some general ideas, so I wouldn't reinvent wheel (at least where game design is concerned).

Another point is that I am thinking of using boxes instead of images for collision testing. However, it should possible that I can implement slopes. Commander Keen 4+ is a good example of my idea.

Actually, what is troubling me is of course the collision testing and simple physics (mainly gravity).

I've got to build the engine myself and it for the J2ME.

Thanks a lot, guys!

sentences:
Unity sprite rig affecting performance I created a simple sprite rig using the skinning editor provided by the new 2D Animation V2 package. But it causes a huge FPS drop when added to the scene.

Methods such as SpriteSkin.LateUpdate generates significant amount of garbage as shown in the picture: See the spike shown on the CPU profiler when the rig is being enabled:

The rig is not even animated.  I also checked the other sample rigs provided by Unity and they also performed in a similar fashion.

Is this normal? I'm targeting mobile, so anything that can be done to avoid or improve the situation will be helpful.

I'm using 2d-animation-v2 2.0.0-preview.2 in Unity 2018.3.8f

sentences:
State machine interpreters I wrote my own state machine tool in C and at this point I'm faced with two choices for specifying state machines.

Crafting a little language and writing a interpreter.
Writing a compiler for that language.

I know the advantages/disadvantages of each. I'd like to know what choices game programmers have made for their games. If you've used a state machine in your game in any form, I'd be interested in knowing how you did it.

sentences:
Pausing and resuming in Unity I've been writing this code quite late so please bear with me.
I'm trying to pause the game and show a menu when I'm inside a collider and then when i press a key it should unpause the game and continue but it wont and i cant figure out why.

Here's the very simple (in my eyes) code:

var savedTimeScale : float;
var playerStatus : Player_Status;
var inTheZone : boolean = false;
private var startTime: float = 0.1;
var start:GameObject;

enum Upgrade { None,Main }
private var currentPage:Upgrade;

function Start()
{
    currentPage = Upgrade.None;
}

//function for ontriggerenter and pressing button to show menu
function OnTriggerEnter(collider:Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = true;
}

function OnTriggerExit(collider: Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = false;
}

function Pause()
{
    savedTimeScale = Time.timeScale;
    Time.timeScale = 0;
    AudioListener.pause = true;
    currentPage = Upgrade.Main;
}

function UnPause()
{
    Time.timeScale = savedTimeScale;
    AudioListener.pause = false;
    currentPage = Upgrade.None;
    if(IsBeginning() && start != null)
    {
        start.SetActive(true);
    }
}

function IsGamePaused()
{
    return Time.timeScale == 0;
}

function OnGUI()
{
    if(inTheZone == true && Input.GetKeyDown(KeyCode.E))
    {
        Pause();
    }

    if(Input.GetKeyDown(KeyCode.N))
    {
        UnPause();
    }

    if(IsGamePaused() && !IsBeginning())
    {
        UpgradeMenu();
    }
}

function UpgradeMenu()
{
    BeginPage(200,200);
    GUILayout.Button("Hello");
    EndPage();
}

function BeginPage(width, height)
{
    //GUI.DrawTexture
    GUILayout.BeginArea(Rect((Screen.width-width)/2,(Screen.height-height)/2,width,height));
}
function EndPage()
{
    GUILayout.EndArea();
    ShowBackButton();
}
function ShowBackButton()
{
    if(GUI.Button(Rect(20, Screen.height-50,50,20), "Resume"))
    {
        UnPause();
    }
}

function IsBeginning()
{
    return Time.time < startTime;
}

I think it's just a case of a new set of eyes. But by my logic this should work.

sentences:
What language to use to create a browser-MMO? I have a game ready to be implemented (Class Diagrams and other UML stuff are good).

Here are some characteristics:

MMO.
Browser game and download-game.
Multiplatform.
With 2D graphics.
Real time.
Point-and-click.
With an online database (duh!).

What language should I use?

sentences:
TArrray to Texture2D in Unreal I have a TArray of type FColor (I got it from the viewport) and I want to change that to a Texture2D object I can't find anything in the API's and I'm new to Unreal.

Thanks

sentences:
Optimal sprite size for rotations I am making a sprite based game, and I have a bunch of images that I get in a ridiculously large resolution and I scale them to the desired sprite size (for example 64x64 pixels) before converting them to a game resource, so when draw my sprite inside the game, I don't have to scale it.

However, if I rotate this small sprite inside the game (engine agnostically), some destination pixels will get interpolated, and the sprite will look smudged.

This is of course dependent on the rotation angle as well as the interpolation algorithm, but regardless, there is not enough data to correctly sample a specific destination pixel.

So there are two solutions I can think of. The first is to use the original huge image, rotate it to the desired angles, and then downscale all the reaulting variations, and put them in an atlas, which has the advantage of being quite simple to implement, but naively consumes twice as much sprite space for each rotation (each rotation must be inscribed in a circle whose diameter is the diagonal of the original sprite's rectangle, whose area is twice of that original rectangle, supposing square sprites).

It also has the disadvantage of only having a predefined set of rotations available, which may be okay or not depending on the game.

So the other choice would be to store a larger image, and rotate and downscale while rendering, which leads to my question.

What is the optimal size for this sprite? Optimal meaning that a larger image will have no effect in the resulting image.

This is definitely dependent on the image size, the amount of desired rotations without data loss down to 1/256, which is the minimum representable color difference.

I am looking for a theoretical general answer to this problem, because trying a bunch of sizes may be okay, but is far from optimal.

sentences:
Keyboard.GetState() only work first time, and Memory increase (not Disposing) EDIT UPDATE 3
I been searching the web for a solution and found several people struggling with Memoryleak using MonoGame while trying to dispose objects.
It could be the case that MonoGame should be started and then closed as a own process, not from another program which are my case.
When I click on the button, a new thread is created and the MonoGame application is started:

 viThread = new Thread(startDemo);
 viThread.Priority = ThreadPriority.Highest;
 viThread.Start();

 private void startDemo()
 {
        using (Demo d = new Demo())
            d.Run();
 }

The "Demo" is closed by a Game.Exit command and i have also tried with Disposed(true) without any success. Next time I launch the MonoGame is Keyboard.GetsState() always empty and the memory is incresed. I made a loop where I started and closed the application 100times and it are eating my memory. I have seen lots of discussion about SharpDX not working correcly with dispsing resources. So here I am, stuck. Just want to point out that this worked fine for XNA but not now when changed to MonoGame. And again, thanks for all comments I got so far.

I have uploaded a project where you can see the issue by yourself. The second time dosn't the keyboard input work but mouseinput does and the memory is increasing for each time:

Donwload sln project

EDIT UPDATE 4

It is SharpDX which increase the memory, I perform following line before i exit:

SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects().Length

And its increasing all the time. So I guess it isnt released.
Someone know how to do that?

sentences:
C++ vsnprintf formatting issue? I'm working on a roguelike and attempting to write the message system. When I attempt to format a const char* with vsnprintf, it seems to somehow format it incorrectly to the point where it is corrupted.

void Gui::render()
{
    for(auto iter = log.begin(); iter != log.end(); iter++)
    {
        terminal_printf(1, 45, (*iter));
    }
}

void Gui::message(const char *text, ...)
{
    char buffer[256];
    va_list argptr;
    va_start(argptr, text);
    vsnprintf(buffer, 256, text, argptr);
    va_end(argptr);
    log.emplace(log.begin(), buffer);
}

If I call puts() in message() with buffer as an argument after it has been formatted, it is correctly formatted. If I directly emplace the text, it isn't corrupted, but it obviously isn't formatted. If puts is called in the iteration loop on the iterator, it outputs the corrupted data.

sentences:
Transform inertia tensor using quaternion I have inertia tensor T in body coordinates and quaternion q for the body. I know I can transform T to world coordinate by converting quaternion to rotation matrix R and then use the relation (R * T * R^T). However this seems unnecessarily expensive and unwieldy (especially if you are doing this often).

So my question is:

How do I transform inertia tensor from body to world coordinate directly using quaternion and without having to generate rotation matrix from quaternion?

sentences:
using delta timing is causing shake I am using delta timing to account for potential drop in frame rate. Only trouble being when I do this, I can notice an ever so slight wobble. I checked out the following JSFiddle coming from a tutorial on the subject and I can even see the wobble there, specifically on the 30fps example. http://jsfiddle.net/straker/bLBjn/

my code is:

var delta = {
    now: 0,
    last: 0,
    difference:0,
    time: 1000/60
}

var d = function(val){
    return val/delta.time * delta.difference;
}

Then further down at the game loop

delta.last = Date.now();
animate();
function animate(){
    delta.now = Date.now();
    delta.difference = delta.now - delta.last;
    delta.last = delta.now;

    //update a sprite
    platform.x -= d(10);

    requestAnimationFrame( animate );
}

How can I keep the animation smooth?

sentences: Way to Round Numbers I have it when the player clicks the mouse they can move the peice aoround the board. I am trying to have the chess pieces snap to a grid after the mouse has been released. Is there any way to round numbers so that I can round the X and Y coordinates so that it will snap to the grid?

sentences:
Unity3D | Cost of accessing a script via a static reference to the instance I saw this pattern around and I was wondering what would be the pros and cons about it. Does this suffer performance issues ? If so what would be a better alternative?

using UnityEngine;
using System.Collections;

public class SomeClass : MonoBehaviour
{

    public static SomeClass instance;

    void Awake ()
    {
        instance = this;
    }

}

And in an other script use it like so:

SomeClass.instance.SomeMethod();

sentences:
How to change a Variable on an Instance of a Player with Network Manager? So I am trying to change a variable on a player object by clicking a button using Unet. However, I am having trouble getting the instance of the player object. Is there a way to get the instance of a player from the Network Manager component? I can change the variable before the player connects but once they are connected I can no longer modify it.

Is there a way to do this?

I have a PlayerController script and all I basically want to do is change an integer on my player object based on a button press. I have tried referencing the gameObject attached to the script with gameObject and this. That doesn't seem to work and I have also tried player.GetComponent<PlayerController>().myInt and that doesn't seem to change it either.

All of these methods work until I connect as a Host or client and then it just doesn't do anything once I am connected.

sentences:
Pathfinding with MicroPather : costs calculations with sectors and portals I'm considering using micropather to help me with pathfinding. I'm not using a discrete map : I'm working in 2d with sectors and portales. However, I'm just wondering what is the best way to compute costs with this library in this context.

Just to be more clear about geometrical shapes I'm using : sectors are basically convex polygons, and portals are segments that lies on sector's edge.

Micropather exposes a pure virtual Graph class that you must inherate and overrides 3 functions. I understand how pathfinding works, so there's no problem in overriding those functions. Right now, my implementation give me results, i.e I'm able to find a path in my map, but I'm not sure I'm using an optimal solution.

For the AdjacentCost method : I just take the distance between sector's centers as the cost. I think a better solution should be to use the portal between the two sectors, compute its center, and then the cost should be : distance( sector A center, portal center ) + distance ( sector B center, portal center ). I'm pretty sure the approximation I'm using with just sector's center is enough for most cases, but maybe with thin and long sectors that are perpendicular, this approximation could mislead the A* algorithm.

For the LeastCostEstimate method : I just take the midpoint of the two sectors.

So, as you understand, I'm always working with sectors' centers, and it's working fine.  And I'm pretty sure there's a better way to work.

Any suggestions or feedbacks? Thanks in advance!

sentences:
How to create texture using raw RGBA texture data without having to use LockRect I was previously uploading textures to DirectX by creating texture in D3DPOOL_MANAGED and then calling LockRect to upload the texture data to DirectX.  However, I have switched to using DirectX9 Ex, and can no longer use D3DPOOL_MANAGED, so in order to call LockRect I have to make the texture use D3DUSAGE_DYNAMIC.  However, I would prefer not to have to use D3DUSAGE_DYNAMIC.  Is my only other option to create a texture in system memory, and then call IDirect3DDevice9::UpdateTexture to get the texture data into video memory?  I also see there is a D3DXFillTexture function.  But what i really want is something equivalent to glTexImage2D where i can create a texture and pass it raw data.

Note that I have stripped down RGBA texture data, otherwise I would try using DXCreateTextureFromFileInMemory.

sentences:
How are bullets simulated in video games? I have been playing games like MW2 recently and, as a programmer, I tend to ask myself how do they make the game so immersive. For example, how to they simulate bullet speed.

When an NPC fires a bullet from his gun, does the bullet really travel from his gun to the given target or do they they completely ignore this part and just put a bullet hole on the target?
If the bullet is really travelling from the gun to the target, at what speed is it actually travelling?

sentences:
How to think about 2D scaling/rotation transformations This is a kind of embarassing question to me since I'm getting more in-depth with XNA but some times my way of thinking about things in my head contradicts an example and I need to re-think it to make it work.

So let's say I am just working with a sprite that is 10 wide and 10 high.

Scaling:

When I apply a scaling matrix, am I just shifting the points back or scaling the X-axis and Y-axis in the LOCAL coordinate space of that sprite? I ask because on this page:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Coll_Detection_Matrices.php

and

http://www.riemers.net/eng/ExtraReading/matrices_geometrical.php

It shows the X and Y of the local axis the sprite is in being scaled down. So in my head, I think that a scaling means that you scale down the local axis space where the sprite is located which makes it smaller.

Rotation:

When I do a rotation matrix, am I rotating the local x and y axis of the sprite around the world origin or rather do I think about it as rotating the local coordinate space entirely around the world origin?

Translation:

This to me is just moving that scaled image with those smaller x and y axis to some other point in the world.

sentences:
I'm Dragging object by using touch (mobile) it doesn't stop when hit collider I want to make object stopped when it hit collider of another object.
But it doesn't stop. How can I fix this? - Unity

my code is:

public class move: MonoBehaviour {
    public float speed = 0.5f;
    // Update is called once per frame
    void Update () {
      if (Input.touchCount ==1)
        {
            Touch touch = Input.GetTouch(0);
            float x = -7.5f + 15 * touch.position.x / Screen.width;
            float y = -2;
            transform.position = new Vector2(x * speed, y);
        }
    }
}

sentences:
Why doesn't anything run after the yield return new line I am trying to make a fade to another scene in unity when I came across a problem. For some reason when the coroutine begins the Ienumerator it only runs half of the Ienumerator Method which is only the anim.SetForBlue line. Heres my code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Loseforcube1 : MonoBehaviour
{

    public GameObject blueWinPanel;
    public Animator animForBlue;
    // Use this for initialization
    void Start()
    {
        blueWinPanel = GameObject.Find("Blue win panel");
        animForBlue = blueWinPanel.GetComponent<Animator>();
    }

    public IEnumerator WaitTillNextScene()
    {
        animForBlue.SetTrigger("FadeBlueWin");

        yield return new WaitForSeconds(3.9f);
        SceneManager.LoadScene(2);
    }

    void OnTriggerExit()
    {
        if (GameObject.Find("Cube Player 2"))
        {
            StartCoroutine(WaitTillNextScene());

        }
    }
}

sentences:
When using IK the player head is looking at down the ground instead looking at the object target up what can be the problem? This script is attached to the player :
using UnityEngine;
using System;
using System.Collections;

[RequireComponent(typeof(Animator))]

public class CharController : MonoBehaviour
{

    protected Animator animator;
    public bool ikActive = false;
    public Transform lookObj = null;
    public float lookWeight = 2f;

    void Start()
    {
        animator = GetComponent<Animator>();
    }

    //a callback for calculating IK
    void OnAnimatorIK()
    {

        if (animator)
        {

            //if the IK is active, set the position and rotation directly to the goal.
            if (ikActive)
            {
                // Set the look target position, if one has been assigned
                if (lookObj != null)
                {
                    animator.SetLookAtWeight(lookWeight);
                    animator.SetLookAtPosition(lookObj.position);
                }

            }

            //if the IK is not active, set the position and rotation of the hand and head back to the original position
            else
            {
                animator.SetLookAtWeight(0);
            }
        }
    }
}

When the lookObj is a sphere or a cube it's working fine but if the lookObj for example is a big spacecraft now the player head will look to the ground down and not to the spacecraft up :

The problem is that the center of the spacecraft is at the bottom this is a screenshot when it's showing the spacecraft at regular when it's in Pivot mode :

Now when I click on the Center button now the center of the object is at the bottom :

Is there any way to fix it maybe eve fix it ?

sentences:
Rotation of a matrix with unequal rows and columns I have this simple matrix class which has a char** array for storing the data. The data array gets initialized like this:

data = new char*[cols];
  for (int x = 0; x < cols; x++)
    data[x] = new char[rows];

Is it possible to rotate this kind of matrix when its let's say 3x2?
So that the rotation will result in this (or counter clockwise works as well)

a b
c d    ->    e c a
e f          f d b

Got some kind of atable here which shows where certain elements move when the matrix is rotated, but cannot get it working in code (those numbers around a&b are the x and y indexes):

  0                               0
0 a              0 1            0 b
1 b     ->     0 b a     ->     1 a
   (0,0)->(1,0)     (0,0)->(0,0)
   (1,0)->(0,0)     (1,0)->(0,1)

I'm currently rotating with these methods (they rotate clockwise):

void Matrix::reverseCols() {
  for (int x = 0; x < cols; x++)
    for (int y = 0, i = cols - 1; y < i; y++, i--)
      std::swap(data[y][x], data[i][x]);
}

void Matrix::transpose() {
  for (int y = 0; y < rows; y++)
    for (int x = y; x < cols; x++)
      std::swap(data[y][x], data[x][y]);
}

Should I keep it like this or should I go with a one-dimensional array and calculate the index when accessing the data by a method? And should I initialize the data array by columns (like I'm doing right now) or rows?

Wouldn't really bother doing this, but while learning C++ I want to build an console window engine and test it with a Tetris clone.

Thanks!

sentences:
How can I create a custom MeshCollider for my object, or fix my collision problem? I have a problem with collisions in Unity and I am unsure how to fix it.

I have an octree with a depth of 2, and each node in the tree has a Bounds object attached to it for collisions. I am trying to see which nodes have been intersected by a specific object however it is giving me unexpected results.

The colliding object is a flat triangle that I have constructed myself which is acting as a cutting plane and I have attached a MeshCollider component to the GameObject.

When there is an intersection with a leaf node in the octree, the node is outlined in yellow and if there is no intersection, it is outlined in purple.

Before rotation

After rotation
In this image I rotated the triangle a small amount on the Y axis and apparently Unity found a collision even though the objects are not even touching at all.

I am drawing the octree nodes using Gizmos.DrawWireCube, providing the center and size of the cube which are used to create the Bounds object of the node. Due to this it seems that the Bounds object for the nodes are correct, however the collider for the triangle may be incorrect.

When I test this with another 3D object such as a cube, it works perfectly, however not with the object I need it to work with. How can I fix this issue?

Collision checking code:

       public bool intersects(Bounds otherBounds)
        {
//bounds refers to the node's Bounds object
//otherBounds is the one I'm checking against, in this case the triangle's bounds from the MeshCollider
            if (otherBounds.Intersects(bounds))
            {
                return true;
            }
            return false;
        }

Octree traversal:

 if (node.intersects(triangleCollider.bounds))
        {

            if (node.isLeaf())
            {
                node.colour = Color.yellow;
            }

            if (node.hasChildren)
            {
                for (int i = 0; i < node.children.Length; i++)
                {
                    findIntersections(node.children[i]);
                }
            }
        }

It seems that perhaps a quad is being wrapped around the triangle as can be seen in the image below. This image has a triangle which is intersecting the top half of the octree, however the top left octant should have no collision.

How can I create a custom MeshCollider which I can specify the vertices manually?

See accepted answer for solution

int cutterMask = 1 << 9;
Collider[] intersectedColliders = Physics.OverlapBox(node.bounds.center, node.bounds.extents, Quaternion.identity, cutterMask, QueryTriggerInteraction.UseGlobal);

sentences:
what do you choose to point player in multiplayer game coding? I'm making C or C++ texture multiplayer game (monopoly) and
to code multiplayer, defined type user
when you change player or point player in main() or other()
you choose Number or pointer?
for example, when one turn finish how do you change player
like user++ (user is int) or use changeUser() ...
i'm newby and know nothing

sentences:
Do I have to re-assign localized text every time the game loads? I am trying to build a localization system for games. And I have stumbled upon a problem where in Unity you basically have to change all the text in Text components / any other references like audio - when loading a game every time.

To better explain it - if the default language is English and user decided to change language to any other. Even if you localize all the files used in the game via code, later on you will have to do it again, when user loads the game after quiting it. Because components don't persist data changed via code in run-time.

How do I make it so that user would be able to change the language once, and all of those references and text... would persist and didn't require re-set up every time the game is loaded? Is that even possible in Unity?

Or should I just localize after the game has been made. And just allow people to download different language versions. But then again, it makes it difficult for people who want to change their language.

sentences:
Why this simple SFML app produce such high CPU usage? I written the following SFML.NET app.
It  draw a single 128x128 sprite on the screen.

RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
window.SetVerticalSyncEnabled(true);

Texture texture = new Texture("test.jpg");
Sprite sprite = new Sprite(texture);

// Start the game loop
while (window.IsOpen())
{
    window.DispatchEvents();
    window.Clear();
    window.Draw(sprite);
    window.Display();
}

Since VSync is enabled, the number of FPS is capped to 60. I expect the program to use very little CPU, but under task manager it show me that is use about 50%  (two cores fully actually). Also it seems it use about 30% kernel time and the rest is user time.

The exact same application in SDL (just drawing a single sprite) use about 0% (regardless SDL_RENDERER_ACCELERATED is used or not).

EDIT : surprisingly, if I let the app run for a given amount of time (let's say 10-20 seconds, the CPU usage fall down to 0%). I manage to repeat this several times. That is really strange.

sentences:
Why is chunk size often a power of two? There are many Minecraft clones out there and I am working on my own implementation. A principle of terrain rendering is tiling the whole world in fixed size chunks to reduce the effort of localized changes.

In Minecraft the chunk size is 16 x 16 x 256 as far as I now. And in clones I also always saw chunk sizes of a power of the number 2.

Is there any reason for that, maybe performance or memory related? I know that powers of 2 play a special role in binary computers but what has that to do with the chunk size?

sentences:
Multiple SpriteSheets break batching The problem: I can't fit all my 2d animation sprites for all units and environment in 1 spritesheet.

Everything batches fine until I use two spritesheets... I noticed the following : all units from spritesheet A batch fine until something needs to be rendered fom spritesheet B. so lets say from back to camera : 50units - tree -50 units - camera will result in 3 drawcalls... Not that bad but if you have: unit- tree - unit -tree -unit -tree ... like it's probably most of the time... this wil result in 100+ drawcalls even though you have only two spritesheets...

How can you solve this? Or better, how can i use two spritesheets and have only two drawcalls even though the sprites are at different distances to the camera

Hope this image helps to understand the problem:

1 : the trees are on spritesheet B and batch fine
2: the batching is broken as the unitsprite sits on spritesheet A and is put in between the trees...

sentences:
Can't make sprite collide with tilemap made with Tiled I'm a newbie who just started learning phaser.

I have created a tile map with Tiled.

It is composed of two tiled layer: background & collision.

In collision layer I put some walls.

And in the game code,

I have loaded tilemaps, create them, and they shows perfectly.

Then I set the collision, and sense the collision in update();

I think it should make the sprite collide with wall, but it didn't..

I tried adding "collison" properties in Tiled as I found from some tutorials, but it didn't work either..

Can someone help me?

Below is the critical part of the collision code.(And Also I have all my codes packed and you can download with below hyperlink.)

//load tilemaps in preload.
this.load.tilemap('zombieset', 'assets/tilemaps.json', null, Phaser.Tilemap.TILED_JSON);
this.load.image('tiles', 'assets/tileset.png');

//start physic systems
this.physics.startSystem(Phaser.Physics.ARCADE);

//create tiles, and it shows perfectly.
this.map = this.add.tilemap('zombieset');
this.map.addTilesetImage('tileset1', 'tiles');

//set collision.
this.map.setCollision(1);
this.layer = this.map.createLayer('background');
this.layer = this.map.createLayer('collision');
this.layer.resizeWorld();

//sensor collison in update()
this.physics.arcade.collide(this.asuna, this.layer);

PS. I have my all code & img & json packed here... Thanks~

https://db.tt/AAdpu3zd

sentences:
How do I create a multiplayer server also suitable for local single-player? I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer.

I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden server underneath; but can be configured to connect to multiplayer as well so that the single player and multiplayer code are one and the same.

Spitball-ideas:

Use a separate thread for the server logic and then share the data between a synchronized point in the code for the client.
Just send packets to local host from the server thread and collect them from the client thread.

How should I do this?

sentences:
Simple heart container script for 2D game (Unity)? I'm attempting to create a simple mobile game (C#) that involves a simple three-heart life system. After searching for hours online, many of the solutions use OnGUI (which is apparently horrible for performance) and the rest are too complicated for me to understand and add to my code. The other solutions involve using a single texture and just hiding part of it when damage is taken. In my game, however, the player should be able to go over three hearts (for example, every 100 points).

Sebastian Lague's Zelda-Style Health is what I'm looking for, but even though it's a tutorial there is way too much going on that I don't need or can't customize to fit in mine.

What I have so far is a script called HealthScript.cs which contains a variable lives. I have another script, PlayerPhysics.cs which calls HealthScript and subtracts a life when an enemy is hit. The part I don't get is actually drawing the hearts.

I think I understand what needs to happen, I just am not experienced enough with Unity to know how.

The Start function should draw three (or whatever lives is set to) hearts in the top right corner. Since the game should be resolution-independent to accommodate the various sizes of Android devices, I'd rather use scaling rather than PixelInset.
When the player hits an enemy as detected by PlayerPhysics.cs, it should subtract from lives. I think that I have this working using this.GetComponent<HealthScript>().lives -= 1 but I'm not sure if it actually works. This should trigger a redraw of the hearts so that there are now two hearts.
The same principle would apply for adding hearts when a score is reached, except when lives > maxHeartsPerRow, the new hearts should be drawn below the old ones.

I realise I don't have much code to show but believe me; I've tried for quite some time to figure this out and have little to show for it. Any help at all would be welcome; it seems like it shouldn't take that much code to put an image on the screen for each life there is, but I haven't found anything yet.

Thanks!

sentences:
OpenGL - Multiple Render Target - write only to some targets, discard others In OpenGL, is it possible to achieve behaviour like this:

out float out1
out vec4 out2;

//.....

out1 = /* write some value */
out2 = /* discard */

My output targets are R32F and RGBA.

sentences:
How to create a sun billboard with Ogre3d I've been working with a few different engines alongside trying to code my own project. Rather than rewrite an entire renderer, etc I am using Ogre3d. To begin with I am trying to implement a very basic scene with day/night cycle.

I've created a plane, added a simple model over the plane to simulate ground and an object. I've also created a directional light which I rotate to simulate a moving sun.

// Add a sunlight
sunNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode("sunNode");
sunNode->setPosition(0,0,0);

sun = OgreFramework::getSingletonPtr()->m_pSceneMgr->createLight("Sun");
sun->setPosition(0,0,0);
sun->setType(Ogre::Light::LT_DIRECTIONAL);
sun->setDiffuseColour(Ogre::ColourValue(0.7f,0.7f,0.7f));
sun->setSpecularColour(Ogre::ColourValue(0.7f,0.7f,0.7f));
sun->setDirection(Ogre::Vector3(0,0,1));
sunNode->attachObject(sun);

In the main loop, prior to rendering I rotate the sunNode with :

 // Rotate the sun
 sunNode->pitch(Ogre::Degree(0.05), Ogre::Node::TS_LOCAL);

This all works pretty much like a expected. However, I then moved onto adding a billboard to the sunNode in order to render the sun moving through the sky. Creating the billboardset, setting the texture, adding a billboard and attaching it to the sunNode, was pretty straight forward, however, when I compiled and ran the application, the billboard just sat at the lights position (0,0,0) and didn't move.

What would be involved in getting a billboard to track through the sky to render a simple sun?

sentences:
Allowing a unit to equip only certain types of weapons I'm making a FireEmblem style game, and I am working on items at the moment. I have a Weapon class from which Sword, Axe, etc. are derived. I also have character classes like Swordsman, Mage, etc. I would like to have a way to allow classes to only equip certain weapons (Swordsman can equip Sword but not Axe). One way I thought of was to have a global enum for WeaponType, and each weapon has a const weapon_type value. Then, each character class has a list of allowed WeaponTypes and you would check if a weapon's weapon_type is in the allowed list.

Is there a better way to implement this without using any casting?

sentences:
VB.NET game engine drawing sprites I have been looking into making a game engine using VB.NET but I'm having some trouble finding how I would draw stuff to the screen. In some places, people draw to the screen using the picture box control but I have read else where that it is not recommended to do this as I will run into problems in the future if I draw to a picture box

So I would like to know what would be the best way to draw sprites etc. to the screen. Is it OK to use picture boxes or is there another way?

sentences:
Center of Mass for Convex shape in 3D For an arbitrary convex shape in 3D, how can I calculate its center-of-gravity?

I have face-normals, and the vertices for each face.

@Ocelot No, it most certainly is not the average of the vertices, as demonstrated in this simple 2D case.

The average of coordinates is in top of shape, whereas the C.o.M. is in the bottom half.

sentences:
How to add a scrolling camera to a 2D Java game? I am attempting to create a game where the camera follows the player, always making sure the player is in the center of the screen. How would I go about this? This game is a 2D Java game, made with no engine.

I found an opensource game demonstrating what I want but I cannot work out how to add that to my game. The game is here, if you need it.

Thanks

sentences:
Rendering up close, OpenGL performance issues I have been developing a massive RTS during the past 18 months, which is comming together nicely!

Now i have an issue i can't really wrap my head around.

If i render 100 models from a distance where the camera can see them all, everthing works perfectly. If i then render them when there camera is up close, my GPU goes to 100% and of course everything starts to lag. I don't really get the difference, the math is the same.

Works on Nvidia m1000m and burns on AMD RX5700.
OpenGl version 4.1.

CPU, memory and GPU memory stays the same so i don't suspect any leaks.

I have tried debugging with glGetError() and CodeXL, no luck.

Am i missing something simple in OpenGL?

sentences:
How can I handle bouncy collision lag in an online game? In my online game, each client sends its player's x/y location to the other clients, and the other clients update the location as they receive it, with some interpolation.

Issue:
The game has bouncy collisions. So if one player collides with another player at speed, it should push that player away. But if I push another player, it won't move away because it's still receiving info from the other end, where it's stationary.

The other player will move away, however, but only after receiving that info from its client.

Question: What are some good ways of handling this problem, while keeping player positions as accurate as possible?

P.S.: I know having an authoritative server can make this better, but we don't have the time to switch over.

sentences:
How to do smooth sprite movement on WP7 XNA What's the correct technique for getting smooth sprite translations with XNA?

I've been developing the WP7 version of an app for a startup, so when we heard Angry Birds got ported today we wanted to check it out and compare. Angry Birds on WP7 had the sub-pixel blur problem with the bird sprites, whereas iPhone, Android, and Chrome all had smooth movement.

sentences:
Should I care about CPU affinity of threads? I am currently developing a rendering engine, which I plan to use for creating games. The engine makes heavy use of multithreading; I have a thread for OpenGL rendering, a thread for updating, a thread for processing user input, a thread for audio, etc. I have heavily tested it, and the threads work like clockwork. The multithreading approach has shown to be faster, more robust and flexible on a multicore processor, which I verified by profiling.

However, something which I have not considered is CPU-core affinity for threads. Should I care about it? What benefits does pinning threads provide, and to which CPU core do I pin which thread?

sentences:
Unity smooth local rotation around one Axis, oriented toward a target I want to acheive the same rotation you see in the inspector.
In short: a smooth local Y rotation, toward a target

I have a Vector3 orientation:
Vector3 dirOrientation = targetToLook.position - movingCamera.position;

So, every Update, what should I do ? I try many thing, but I don't realy understand Quaternion...

I just want to rotate localy in Y, toward a precise moving target, NOT in X or Z. and smoothly with some Lerp or Slerp.

Thanks !

sentences:
Realistic 2D Planetary Physics Engine? I'm doing a spaceflight simulator in C++ (using Allegro 5), and I realised that I could just use a physics engine instead of writing my own physics.

So that's what I'm doing.

Since this is going to be a 2D only (for simplicity's sake) simulation, I've looked at 2D physics engines only. And since this will be running on low-end hardware, just not using the z-axis of a 3D engine won't work.

I've narrowed it down to the two big physics engines: Box2D and chipmunk. I'm trying out Box2D now, but the manual says that:

  Box2D works with floating point numbers and tolerances have to be used to make Box2D perform well.
  These tolerances have been tuned to work well with meters-kilogram-second (MKS) units. In particular,
  Box2D has been tuned to work well with moving objects between 0.1 and 10 meters. So this means
  objects between soup cans and buses in size should work well. Static objects may be up to 50 meters big
  without too much trouble.

Obviously I'm going to be using Box2D for objects ranging from 100 m to 1.4e9 m (from a ship to the Sun). However, most of the time I'm going to be flying around in a ship (no collisions), or parked on the surface of a planet. Of course, there will also be accelerations of up to 275 m/s/s (at the surface of the Sun).

Is this order of magnitude going to work with Box2D? Has anyone worked with this kind of stuff in Box2D before? Should I just try another physics engine (suggestions welcome)?

sentences:
How to make low poly ground look better I'm working in Unity and have created some low poly meshes using blender. Currently, the meshes look good, but the ground seems very lacking. I am not sure how to make it feel natural or even look good in general.

Here is a current image

The ground needs to remain mostly flat due to the game placing flat objects on the top of the plane and the image shows the exact camera angle we are using. But, as you can see in the image, the ground is extremely lacking and it doesn't look like a ground but instead just a flat background color. I've tried textures but it does not look good with the trees and low poly design.

How can I make the ground look better?

sentences:
Need help choosing the right networking approach/platform for an RTS I have been thinking for a while about making an online 2D RTS-like game. (2-6 players in a match, up to 50-60 units, no AI). The key thing here is that I want the game to be playable in a browser, so it'll have to be either flash or java applet, both using TCP sockets. At first I was entirely focused on flash because of a higher market penetration and accessibility. However, after reviewing different networking approaches I am unable to make a choice.

I really liked lock-step simulation approach where server and every client are running the exact same simulation, until I realized that it's going to be tough as hell (if not impossible) to implement exactly the same logic in two different languages, one of them being actionscript. This is where java comes in. With java client and server can share simulation related code - that may as well cut the development time in half.

But then there is another approach, where clients try to simulate (or rather extrapolate) the game state correctly as long as possible, but they don't have to do it right - at some point they are going to receive the full state snapshot an adjust accordingly. Flash looks like a viable option again, but still, lock-step simulation seems so much more straightforward, as there is no "adjusting" part.

So are my assumptions correct? What would you suggest?

sentences:
UDK weapon on first person not showing up I've been following this tutorial
http://www.moug-portfolio.info/udk-weapon-basics/

all my code is the same as the page...

except here

DefaultPropeties
{
Begin Object Name=GunMesh
    SkeletalMesh=SkeletalMesh'WP_LinkGun.Mesh.SK_WP_Linkgun_3P'
    HiddenGame=FALSE
    HiddenEditor=FALSE
end object

Mesh=GunMesh
Components.Add(GunMesh)
}

i had to replace begin object for this

Begin Object Class=SkeletalMeshComponent Name=GunMesh

i think i might have forgot to add a model/skeletal so i dont have anywhere to attach the weapon to? How can I do that??

Can some UnrealScript expert please look to it for me or give me a valid tutorial link for creating a custom weapon?

thank you very much

sentences:
Using server timestamp to synchronize actions across clients tl;dr
The question is rather simple: how unsynchronized can internal clocks be between different machines?

Context
We have a "hybrid" approach where the Clients are authoritative on certain things, and the Server on some others. That is to make our life easier because the gameplay doesn't need to be too tight about certain things.
In this case, the Server will pre-determine a sequence of Enemy Types to be spawned at different locations with pre-determined delay between the spawns. We would then let the Clients handle the rest during the gameplay.
However, if we want the Clients to be mostly synched on the display of the enemies, they would need to initiate this sequence at the very same time, and thus we cannot rely on the network to have transmitted the data at the very same time for all Clients.
The idea we had was to send a timestamp of the format returned by System.currentTimeMillis() which would indicate when to begin the sequence.
But then one question remains in the way: how unsynchronized can internal clocks be between different machines?

sentences:
Maintain proper symbol order when applying an armature in flash I am trying to animate a character's leg in flash CS 5.5 for a game I am working on. I decided to use the bone tool because it's awesome. The problem I am having, however, is that for my character to be animated properly, the symbols that make up his leg (upper leg, lower leg, and shoe) need to be on top of each other in a specific way (otherwise the shoe looks like its next to the leg, etc). Applying the bones results in the following problem: the first symbol I apply it to is placed in the rear on the armature layer, the next on top of it, and so on, until the final symbol is already on top. I need them to be in the opposite order, but arrange > send to back does nothing on the armature layer. How can I fix this?

tl;dr: The bone tool is not maintaining the stacking order of my objects, please help.

Thanks for helping :).

sentences:
How can the player select his weapon among many? I'm working on the prototype of my game, I want one of the options to have a very large amount of weapons. I have searched for tutorials, but I have only found weapons changes where the weapons have already been loaded in the scene from the inspector, like this https://youtu.be/Dn_BUIVdAPg where they are only activated and deactivated.
But I want a game like dofus where there are hundreds of weapons, I think I have a data file of the weapons and so, I can load the correct model of the weapon.
How can I get the model loaded?

I have read other tutorials regarding the AssetBundle, but I think that is when you need to download the models from a server for example, but I just want to load them from the same project.

sorry for the bad english

sentences:
Why projection window is between -1 and 1 Is it a convetion ? What we achieve with this ?

I am reading about how the perspective and orthographic matrix is getting calculated and everyone is trying to normalize the homogenous coordinates to [-1,1]

Thank you !

Orthographic Projection

sentences:
Populating NPC's Outside Of Loop This was my original question:
Populating Sprites
I used the following code to spawn Enemy Sprites in my game. I have 2 types that I was using and it would display one then remove it and display the other. It did this repeatedly(Imagine someone playing with a light switch and you have what is happening with the NPCs. EnemyType1 is Off and EnemyType2 is On.).Also It does not apply the current level number meaning, it does not spawn the number of enemies for the level. The number of enemies I want to spawn is the exact number of the level.  I used other types of random methods( nextBoolean(), nextInt(), nextFloat() ). I showed the code to my friend and he told me that I would need to spawn them outside of my loop, but he did not know how to. So now I am trying to see if anyone on stack could help me. What I am trying to do is this:

NPC's = Enemies

I have 2 types of NPC's that I want to use. The number of Enemies that are spawned are equal to the the current level number. I want to be able to spawn how ever many is needed for that level and have it to where which Enemy that will spawn is random, so you don't know if you will get EnemyType1 or EnemyType2 or a Mix. Ex: Level 1, only 1 Enemy spawns, the type is random. Level 2, only 2 Enemies spawn, the type is random. Level 3, only 3 enemies spawn, the type is random. etc.

Thanks In Advance.

sentences:
Who should be contacted to request permission, for commercial songs (and cost ballpark) While playing to Fifa, it occurred to me that there is probably a license that EA pay to musicians to play their songs in their game.

Does anyone know if there is a standard license for indie games, to be able to play commercial songs in the game? Either for the intro and for the game itself, like FIFA does.

I did a brief search and the suggestion is to contact the publisher of the specific group/singer; but 90% of the time they probably won't even read such email. Is this the only way?

Of course this won't apply for free music that is distributed to be freely used for any use; my question is specifically for commercial music from decently known artists.

sentences: How to calculate players engagement? What metrics could be used to know what certain people think about the game and how much they liked it?  I would prefer parameters that don't need players to rate by themselves. Would hours of playing in a single seat be a good parameter about how much players wanted to spend time on game?

sentences:
Shader Graph - Surface type change Is there any way to control what surface type is used in shader graph insted of changing it in PBR Master?
I'm creating dissolve effect for albedo/emission/transparent surfaces (https://www.youtube.com/watch?v=taMp1g1pBeE). Then I'm making 3 materials based on that one shader that I can control with variables. It works fine for Opaque but when I want to use it for glass I need to change Surface to Transparent in PBR Master and Opaque surfaces are getting bugged due to Two Sided setting.
Can I control what type of surface is used based on some variable or maybe take it out to inspector as in standard materials?

sentences:
what are texcoord tags in mesh.xml file in Ogrexml format? I exported a 3d model from blender 2.79 and using ogrexml import/export plugin.
but the texture will crash and UV map not working in that format.
I made the model by four parts head-body-hands-shoes and they have 4 material and 4 textures, so I made a texture atlas for it and join them in a mesh to More optimization.
I think removing other UV maps has a problem because when I check the model.mesh.xml in a note editor and every vertex has 3 texture coordinate tags and I compared it with a normal correct model that looks good in the blender and in ogrexml format, it has one texcoord tag inside of vertex tag.
1-what are texcoord tags? are they using for UV maps in ogrexml format?
2-how can I clear blend files from other unused uvMaps to avoid exporting them with the model?

sentences:
SDL - Limiting loop with timer? Not polling I am using SDL/Glew to create an engine for a game I want to make. I am trying to set a constant framerate of like around 60 (once every 17ish ms). I don't know the best way to do this so I do attempted to do it with a timer.

//Main Loop
int EngineLoop(int interval, CEngine* engine)
{
    Input->Poll();
}
//---------

void CEngine::Start()
{
    _running = true;

    SDL_AddTimer(17, (SDL_TimerCallback)EngineLoop, this);
}

The input poll is this:

void CInput::Poll()
{
    SDL_Event evnt;

    while (SDL_PollEvent(&evnt))
    {
        switch (evnt.type)
        {
        case SDL_MOUSEMOTION:
            *(Rect*)(&MousePosition) = Rect(evnt.motion.x, evnt.motion.y);
            *(Rect*)(&MouseDelta)    = Rect(evnt.motion.xrel, evnt.motion.yrel);

            break;

        case SDL_MOUSEBUTTONDOWN:
            _mouseButtons[evnt.button.button - 1] = true;
            break;

        case SDL_MOUSEBUTTONUP:
            _mouseButtons[evnt.button.button - 1] = false;
            break;
        }
    }
}

This system works perfectly when I put it in some random class function to pump as much as it'd like. But when I introduced the timer, nothing works, no input is taken and the window freezes up. Is it because I am not Polling the events quick enough or?

I tried using a separate timer function that called the class function to poll the input because maybe having it on a different thread is the reason, that didn't work either.

So why didn't this work?
What other approach should I take if necessary?

sentences:
Do games process all received user input? A mouse might have a frequency of 125Hz, meaning that the system will read off the mouses position every 8ms. Keyboards work in a similar manner.

If a key is pressed and held down, events are continuously raised.

Does every one of these events make it to the game loop?

I imagine that if the game loop does not complete fast enough, the user interactions will buffer, causing a noticeable interaction latency.

I can think of ways to deal with this:

Add a maximum size to the input buffer so that as new events arrive, older   ones are pushed from the front of the queue as the new events are pushed to the back of the queue (enqueued).
When the key is pressed, send a "key-down" message and let the game loop repeat the received message until a "key-up" message is received.

Can anyone think of other ways to deal with user input, and do any of my suggestions have obvious flaws?

UPDATE
I am not developing a game, I am doing research and so my above questions are purely academic. I am not using any API.

sentences:
How can I extrude a regular, grid-based 2D shape to 3D? I have a list of vertex coordinates which encircle several 2D areas. Orthogonal lines only, but not necessarily convex areas... similar to PCB traces of conductive copper areas. I want to draw them like solid objects in 3D using OpenGL, but I'm still very new to 3D and struggling.

Please point me how to do this. I've managed to draw the outline only using GL_LINE_STRIP, but when I try GL_QUAD_STRIP or GL_TRIANGLE_STRIP, the list of coordinates is not properly ordered for triangle strip and the fact the areas are not convex prevent me from doing a simple triangular tessellation.

These are the 2D shapes:

I'd like to render them like this:

sentences:
How do I clear a specific render target when more than one are set?  Or how do I keep the depth but clear the color? Let's say I set two render targets

GraphicsDevice.SetRenderTargets(rt0, rt1);

If I call

GraphicsDevice.Clear(Color.Transparent);

both render targets will be cleared.

Therefore, how can I clear a render target at a specific index?  For example just 'rt1' and not 'rt0'.

I would like to avoid texture baking the contents of 'rt0' to another render target and copying them back to 'rt0'.  This is because PreserveContents on the XBOX 360 can only hold one render target in memory.

EDIT:

Is there any way just clear the color for a render target?  I would like to keep the depth for depth reading.

sentences:
Unity in c# errors with "the type does not contain a constructor that takes 0 arguments" This is the problematic line

datosAguardar datos = new datosAguardar ();

Here is my code

public class estadoJuego : MonoBehaviour {

public int puntuacionMaxima = 0;
public static estadoJuego estadojuego;
private string rutaArchivo;

void Awake ()
{
    rutaArchivo = Application.persistentDataPath + "/datos.dat";
    if (estadojuego == null)
    {
        estadojuego = this;
        DontDestroyOnLoad (gameObject);

    }  else if (estadojuego != this)
    {
        Destroy (gameObject);
    }
}

// Use this for initialization
void Start ()
{
    cargar ();
}

// Update is called once per frame
void Update () {

}

public void guardar ()
{
    BinaryFormatter bf = new BinaryFormatter ();
    FileStream file = File.Create (rutaArchivo);

    datosAguardar datos = new datosAguardar ();

    datos.puntuacionMaxima = puntuacionMaxima;

    bf.Serialize (file, datos);

    file.Close ();
}

void cargar ()
{
    if (File.Exists (rutaArchivo))
    {
        BinaryFormatter bf = new BinaryFormatter ();
        FileStream file = File.Open (rutaArchivo,FileMode.Open);

        datosAguardar datos = (datosAguardar)bf.Deserialize (file);

        puntuacionMaxima = datos.puntuacionMaxima;

        file.Close ();
    }  else
    {
        puntuacionMaxima = 0;
    }
}

[Serializable]
//definiendo la clase
class datosAguardar  //: ISerializable

{
    //propiedades de la clase
    public int puntuacionMaxima ;
    //metodo de la clase
    //constructor de la clase
    public datosAguardar (int puntuacionMaxima) // : base (puntuacionMaxima)
    {

        this.puntuacionMaxima = puntuacionMaxima  ;
    }

}

This is the constructor

[Serializable]
//definiendo la clase
class datosAguardar  //: ISerializable

{
    //propiedades de la clase
    public int puntuacionMaxima ;
    //metodo de la clase
    //constructor de la clase
    public datosAguardar (int puntuacionMaxima) // : base (puntuacionMaxima)
    {

        this.puntuacionMaxima = puntuacionMaxima  ;
    }

}

sentences:
Collision works except for when coming from right side I am trying to make a bomberman clone. I'm having problems with the collision on the walls that is not on the sides of the map (see image). When I come from the right (going left), the red square (player) goes through the wall but when I come from other sides (up, left, down) the collision works well and the player does not go through. The collision on the side walls works well also even when I come from the right and going left.

I am using Tiled and LibGDX and here is the code:

private void checkCollision(float delta) {
    //player.getVelocity().scl(delta);
    Vector2 position = player.getPosition();

    // just to see if it overlaps because this is the location of the
    // rectangle when getTiles is called when player moves left as shown in the image
    Rectangle rect = new Rectangle(128, 128, 64, 64);
    if(player.getRectangle().overlaps(rect)) {
        System.err.println("overlap");
    }

    if(player.isMovingRight()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap right");
                player.setPosition(tile.x - player.getWidth() , player.getPosition().y);
            }
        }
    }
    if(player.isMovingLeft()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE - 1),  (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap left"); // this doesn't show
                player.setPosition(tile.x + tile.width, player.getPosition().y);
            }
        }
    }

    if(player.isMovingUp()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap up");
                player.setPosition(player.getPosition().x, tile.y + tile.height);
            }
        }
    }
    if(player.isMovingDown()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE + 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {

            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap down");
                player.setPosition(player.getPosition().x, tile.y - player.getHeight());
            }
        }
    }

    //player.getVelocity().scl(1/delta);

}

private Array<Rectangle> getTiles(int startX, int startY, int endX, int endY) {
    TiledMapTileLayer layer = (TiledMapTileLayer)level.getMap().getLayers().get(1);
    Array<Rectangle> rectangles = new Array<Rectangle>();
    for (int x = startX; x <= endX; x++) {
        for (int y = startY; y <= endY; y++) {
            Cell cell = layer.getCell(x, y);
            if(cell != null) {
                Rectangle rect = new Rectangle(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
                rectangles.add(rect);
            }
        }
    }
    return rectangles;
}

sentences:
How to combine depth and stencil tests? I have a continuous height-mapped mesh to represent landscape. I use the stencil test to create holes in the mesh. I draw holes to the stencil buffer and then use it to discard mesh fragments. Everything works fine except that my holes are visible through the mesh even if they are occluded by higher ground.

Is there any way to apply depth testing to a hole, keeping my mesh drawn in a single call to glDrawElements?

sentences:
Can I switch scenes by swipe gesture or drag？ Can I switch scenes by swipe gesture or drag?

In my game, there are three main scenes, each of them has several layers which have some UI elements, these elements have some tap gesture.

I already know some ways to switch scenes, such as replaceScene, or by some transitions ways, just like CCTransitionMoveInT, so swiping scenes is feasible or not?

If not, why?

If yes, is it possible to cause memory increases that my gameApp crash?

sentences:
Port sandbox flash game to Android and iOS I'm want port my sandbox game to Android and iOS. Game written in AS3 (i'm use my simple 2d engine on stage3d). What do you recommend I use?

Haxe + OpenFL
MonoGame + Xamarin (C#), or other 2D engine in C# for mobile?
LibGDX + robovm (Java)
or AIR? It's slowly (seems).

I'm know C#, but don't know Haxe and Java. Game render many sprites: tiles (walls/blocks/liquids), background, entities, particles + lighting system.

My game: http://www.youtube.com/watch?v=y_KbvZCljnA

sentences:
Not able to connect to Photon(PUN).photon unity networking error I'm new to photon Networking. My game was working great suddenly this is appearing

Cannot send messages when not connected. Either connect to Photon OR use offline mode! UnityEngine.Debug:LogError(Object)

sentences:
Algorithm for Randomized Weather I'm having a hard time modeling weather.
Modeling a single aspect is trivial - some sinusoidal pattern + random noise. However more than 1 is blowing my mind. I cannot have wind, falling leaves, rain, and snow all to be random. Simple collisions like rain and snow should never happen.
On top of this I'd like an "intensity" level for maybe each. But this can come after the main logic.
Weather is stored in MySQL.
All your suggestions are welcome, but please don't suggest pinging some zipcode and pulling weather from there.

Utilizing suggestions from, actually, all answers below I've come up with this not-to-scale distribution:

Each feature will be computed with a random noise, and the combination of the 3 will produce overlay effects.
(temp < 0) and (humid > 65) => snow

sentences:
User-friendly scripting when using an ECS? I am currently creating a small hobby project to get back into game development, and I have decided to structure my entities using an ECS (Entity Component System). This implementation of an ECS is structured like so:

Entity: In my case it's a unique int identifier that is used as a key to a list of components.
Component: Holds only data, e.g. the Position component holds an x and y coordinate, and the Movement component holds a speed and direction variable.
System: Handles components, e.g. it takes the Position and Movement components and adds the speed and direction to the position's x and y coordinates.

This works fine, but now I wish to implement scripting into my games, in the form of a scripting language. In previous projects I've used an OOP implementation of game objects, which meant that scripting was pretty straight forwards. For example, a simple script could look something like this:

function start()
    local future = entity:moveTo(pos1)
    wait(future)

    local response = entity:showDialog(dialog1)
    if wait(response) == 1 then
        local itemStack = entity:getInventory():removeItemByName("apple", 1)
        world:getPlayer():getInventory():addItemStack(itemStack)
    else
        entity:setBehavior(world:getPlayer(), BEHAVIOR_HOSTILE)
    end
end

However, when using an ECS, the entity itself does not have any functions like moveTo or getInventory, instead the above script written in ECS style would look something like this:

 function start()
    local movement = world:getComponent(MOVEMENT, entity)
    movement:moveTo(pos1)

    local position = world:getComponent(POSITION, entity)
    local future = Future:untilEquals(position.pos, pos1)
    wait(future)

    local dialogComp = world:getComponent(DIALOG, entity)
    local response = dialogComp:showDialog(dialog1)

    if wait(response) == 1 then
        local entityInventory = world:getComponent(INVENTORY, entity)
        local playerInventory = world:getComponent(INVENTORY, world:getPlayer())
        local itemStack = entityInventory:removeItemByName("apple", 1)
        playerInventory:addItemStack(itemStack)
    else
        local entityBehavior = world:getComponent(BEHAVIOR, entity)
        local playerBehavior = world:getComponent(BEHAVIOR, world:getPlayer())
        entityBehavior:set(playerBehavior, BEHAVIOR_HOSTILE)
    end
end

This is a lot more verbose compared to the OOP version, which is not desirable when the scripting is aimed towards mostly non-programmers (players of the game).

One solution would be to have some sort of wrapper object that encapsulates an Entity and supplies functions such as moveTo directly, and handles the rest internally, although such a solution seems sub-optimal since it takes a lot of work to cover all the components, and every time a new component is added you would need to change the wrapper object with new functions.

To all game developers that has implemented scripting in an ECS before - how did you do it? The main focus here is usability for the end user, with as little "maintenance" cost as possible (preferably you don't need to change it every time you add a component).

sentences:
Is it possible to debug a Unity Android game directly on a device? I'm working on my game and every time I make changes to it I send the game to my mobile device to debug it.

I want to know how I can directly debug my game using an Android device instead of the MonoDevelop editor?

sentences:
How to Prevent Entities Snapping Through Platforms I am using crafty.js to make a platformer. I assigned the main player entity the default jumping controls and movement with .twoway() and used .checkHits() against the obstacles ("obs") the player will jump on. The problem is that when the player jumps, if the top of the player entity hits the bottom of the obstacle, the player entity "snaps" to the top. How do I make it so that this movement does not happen? The intended effect is that the player entity will only land on the obstacle if the player entity lands on the top.

Here is the code:

window.onload = function() {

  Crafty.init(600, 400);
  Crafty.background('#07A6FF');

  // obstacle/platform entities
  // 'obs' means obstacle
  var obs = Crafty.e('obs, 2D, DOM, Collision, Color')
  .attr({ x: 100, y: 250, w: 400, h: 45 })
  .color('#E88D0C');

  var obs2 = Crafty.e('obs, 2D, DOM, Collision, Color')
  .attr({ x: 200, y: 150, w: 45, h: 45 })
  .color('#E88D0C');

  // player entity
  var player = Crafty.e('player, 2D, DOM, Color, Collision, Twoway, Gravity, Jumper')
  .attr({x: 50, y: 50, w: 60, h: 40 })
  .color('#0035AB')
  .twoway(200, 150)
  .checkHits('obs')
  .gravityConst(200)
  .gravity('obs');
}
<script src="https://github.com/craftyjs/Crafty/releases/download/0.7.1/crafty.js"></script>

sentences:
How to align text dynamically inside a rectangle with Phaser JS I am just starting to learn the Phaser JS framework with my first game. I did not managed to find a way how i can align text inside a rectangle element dynamically without specific coordinates. Here is what i have

pointH11L1 = game.add.text(0, 0, '20');
pointH11L1.stroke = "#000";
pointH11L1.strokeThickness = 4;
pointH11L1.font = 'oswaldbold';
pointH11L1.fontSize = 22;
pointH11L1.fill = '#999999';
//pointH11L1.alignIn(graphicsRectH12L2, Phaser.CENTER);
graphicsRectH12L2.addChild(pointH11L1);
pointH11L1.x = pointH11L1.width / 2 - 6;
pointH11L1.y = -2.5;

//graphicsRectH12L2 is the  rectangle inside which i need to align.

var graphicsRectH12L2 = this.game.add.graphics(950, 405);
    graphicsRectH12L2.beginFill(0xffcd00, 1);
    graphicsRectH12L2.drawRect(0, 0, 44, 29);
    graphicsRectH12L2.endFill(0xffcd00, 1);
    group.add(graphicsRectH12L2);

sentences:
How to change the color of an invalid texture? In openGL, when I don't bind a texture, or I bind a texture that was loaded incorrectly, any calls to texture2D/texelFetch in the shader will return vec4(0, 0, 0, 1), is there a way to change this to return vec4(1, 1, 1, 1) instead?

Initially I looked for a way to test if the sampler2D was valid, and when I couldn't find that I tried using glColor4f, but that doesn't seem to work either--although that could be the amdgpu driver, it seems to have some trouble with the old pipeline calls generally.

Is there someway to change what this default return color is?

sentences:
Camera stops moving forwards near World-Center So basically this is a problem I've been having since forever. I implemented a Camera System, it works fine but somewhere around the center (0, 0, 0) of the world it doesn't work. Actually it works, but it always moves back at the position I was before. Like, if I'm at (1, 0, 0), walking forward will make me stay at (1, 0, 0), while moving backwards will not. The weird thing is that as said before it only happens there and if I'm moving forwards, backwards, left and right work perfectly!

That's how I do my Walking:

XMVECTOR D = XMVectorReplicate(d);
XMVECTOR L = XMLoadFloat3(&m_LookDirection);
XMVECTOR P = XMLoadFloat3(&m_Pos);
XMStoreFloat3(&m_Pos, XMVectorMultiplyAdd(D, L, P));

My Strafing (Left to Right) is basically the same thing.
I update my ViewMatrix like that:

XMVECTOR R = XMLoadFloat3(&m_Right);
XMVECTOR U = XMLoadFloat3(&m_Up);
XMVECTOR L = XMLoadFloat3(&m_Look);
XMVECTOR P = XMLoadFloat3(&m_Pos);
XMVECTOR WU = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

//Compute wuv vectors for camera space
XMVECTOR w = XMVector3Normalize(XMVectorSubtract(L, P));
XMVECTOR u = XMVector3Normalize(XMVector3Cross(WU, w));
XMVECTOR v = XMVector3Cross(w, u);

XMStoreFloat3(&m_LookDirection, w);
XMStoreFloat3(&m_Right, u);
XMStoreFloat3(&m_Up, v);

Then I fill in the ViewMatrix but that's unimportant.

Hope someone knows that basic mistake I'm doing!

Thanks

sentences: To use Apple's game servers, do I need to enroll in the Apple Developer program? I am developing a multiplayer iPhone game. To use the Apple game servers, do I need to register for the Apple Developer program?

sentences:
Problem switching Scenes in AndEngine I am Developing a game in AndEngine Gles2. I have splash scene, loading scene, menu scene and Level1 scene. I am using a Screen Manager to manage all scenes so  I can easily switch between splash, loading and menu scenes.

The level1 scene is also loaded from menu perfectly but a problem occurs when I go back to menu scene on the completion of level. The screen turns black and nothing is shown after that, but the music keeps playing and logcat logs continue. I think the problem is with unloading the resources of Level1 because the switching between other scenes is perfect. I can't give complete code, as it's too long.

I am using bitmapTexture region, Sprites, bodies, physics Word, hud and fixtures etc. Here is my unload method:

unload(){
    setChildrenIgnorUpdate();
    clearChildScene();
    clearEntityModifier();
    clearTouchAreas();
    clearUpdateHandler();
    BitmapTextureManager.getInstance().destroyInstance();
    destroyPhysics();
}

sentences:
Sketchup for modelling, Blender for lightmaps, rendering in Xna Reach profile? This question moved from https://stackoverflow.com/questions/4319183/sketchup-for-modelling-blender-for-lightmaps-rendering-in-xna-reach-profile

Hello. I'm a programmer looking to add some 3D assets to my game. I have played around with both Blender and Sketchup, and for my limited 3D modelling experience I'm finding I can make far more interesting models/scenes in Sketchup than blender, but I couldn't find any free lightmap baking tools for sketchup, whereas my understanding is that this is available in blender for free.

So, my question is, how can I setup a workflow whereby I can do most if not all of my work in Sketchup, and only use Blender to create the lightmaps? Is there any way to define light information in Sketchup, but have blender render the light-maps? Otherwise I'm going to have to do all the modeling in sketchup and then add the lights manually in blender every time I make a change to the scene.

Also, I couldn't find information specifically about blender and the dual texture effect in Xna Reach. Does anyone have information/tutorial/etc.. for getting lightmaps calculated with blender into Xna and rendered using the dual texture effect in xna reach (i.e. on windows phone 7).

sentences:
Light intensity on plain from angle Given a vector (v) for the direction of light and a vector (n) for the normal of a plain.

How can I calculate a rudimentary intensity value (i) where

When (v) points at (n) directly/face on (i) = 1.0
When (v) points away from (n) (i) = 0.0
And everything else in-between

For now we don't need to account for reflection, or any other side effect of a plain.

Has anyone got any ides on how to do this?

I am using DirectX11 for this but I would prefer a solution that I can implement independently.

sentences:
What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity] I came across the following declaration on unity tutorial

#pragma surface surf BlinnPhong addshadow fullforwardshadows
vertex:disp tessellate:tessEdge nolightmap

I think disp is the displacement shader but what does vertex:disp mean?
Likewise for tesselate:tessEdge.

from https://docs.unity3d.com/Manual/SL-SurfaceShaderTessellation.html

Thanks. I am rather new to HLSL.

sentences:
Unity 5 - Error with code to make pitch changes based on distance I really need help.  It's 2:00 AM here and my brain is half dead so I can't, for the life of me, find out what's wrong with this code anymore.  It's supposed to find the distance between the game object to which it's attached (the target), and another game object (the player). Then, depending on the that distance, it should change the pitch of an AudioSource inside a child (in the player). However, the pitch only changes when I'm practically over the gameobject. So, for about 9/10 of the way, nothing changes in the pitch, but when I'm right there the pitch suddenly changes (but not to maximum value of Clamp function).

What's going on? I want the pitch to, at first, stay at 0. But soon after you walk some steps in the right direction, the pitch must change gradually (and in a evenly manner), as (player) gets closer to (target). =|

ps.: The script is inside a instantiated prefab, that's why I used FindGameObjectWithTag and FindChild. Also, I'm using Unity 5.

<!-- language: lang-cs -->

[four blanks]using System.Windows.Controls;
[more indented code]

using UnityEngine;
using System.Collections;

 public class ProximitySensor : MonoBehaviour {
     public GameObject player;
     private Transform playerTrans;
     private Transform targetTrans;
     public Transform beepTrans;
     public AudioSource beepSound;
     private float distanceCurrent;

     void Start () {

         targetTrans = transform;
         player = GameObject.FindGameObjectWithTag("Player");
         playerTrans = player.transform;
         beepTrans = playerTrans.FindChild ("beepController");
         beepSound = beepTrans.GetComponent<AudioSource>();

     }

     void Update () {

         distanceCurrent = Vector3.Distance (playerTrans.position, targetTrans.position);
         beepSound.pitch = Mathf.Clamp ((1 / distanceCurrent), 0.1f, 3.0f);

     }
 }

sentences:
Unity Application.LoadLevel freezes the game on Android device I'm developing a game using Unity. The game has a single level and after the player wins/loses, I simply want to reload the same scene. Here's the code I'm using:

private void OnLevelFailed()
{
    IsGameStarted = false;
    Debug.Log("LEVEL FAILED");
    Invoke("RestartLevel",5);
}

void RestartLevel()
{
    Application.LoadLevel(Application.loadedLevelName);
}

When running this code on the editor, everything seems fine and the scene reloads as intended. However, when I build the game for Android and run it on a device (an LG G3), the game simply freezes. I used adb logcat to see the logs of any exceptions or errors if there were any but to no luck. I also suspected if the Invoke call was causing the problem and replaced it with simply the method call, but that didn't solve the problem either.

Anyone have any idea why this might happen?

sentences:
What are some gameplay cases where knowing the Z as a result of the raycasting is useful in a 2D setting? The context is an 3D engine with a 2.5D level format. Like a roller coaster tycoon level, with some other level features added, and layers removed. For example the tile functions have the following interface.

markTile([3, 5]);

This statement places a mark on the tile located at 3x5. This tile can be on top of a mountain or a cave, but different tiles on the same height can't exist, so the Z axis isn't needed. Internally everything is in 3D, but it isn't exposed to the interfaces since there can't be more than one tile at the same X, Y position.

Because the tile functions are 2D, units also store their positions in 2D.

markTile(unit.position); // place a mark where the unit is

There are also cases where knowing the Z of an unit is useful, but it is almost never about the tile or the placement position. For example it is useful to create a sprite or an exclamation mark on top of an unit, but that is done by using the Z from the tile and the height of the unit. That interface also uses an unit as the parameter, not a position, because multiple units can be on the same position unlike a tile.

placeExclamationMarkOnUnit(unitId);

Now, I am wondering, is there a need for the raycaster to even return the Z data in this setting? I can't think of a gameplay case. I can think of cases where the unit height is important, but none that would need to know the Z from the ray. I can also think of cases where I could want to place an effect on an exact position on the unit, but that can be done by just X and Y(floats, not ints) as well.

Thanks.

sentences:
Create Render Target View [138][140] need to Bind the back buffer to the render target view DirectX 11 This is the error

D3D11 ERROR: ID3D11Device::CreateRenderTargetView: A RenderTargetView cannot be created of a Resource that did not specify the RENDER_TARGET BindFlag. [ STATE_CREATION ERROR #138: CREATERENDERTARGETVIEW_INVALIDRESOURCE]
D3D11 ERROR: ID3D11Device::CreateRenderTargetView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #140: CREATERENDERTARGETVIEW_INVALIDARG_RETURN]

So as i see here i need to set the BindFlag of the backBuffer to D3D11_BIND_RENDER_TARGET, but in all the tutorial i saw nobody is doing it, they all create the render target view by using this code

hr=m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&m_backBuffer));
if (FAILED(hr)) MessageBox(0, L"Failed get buffer", 0, 0);
hr=m_device->CreateRenderTargetView(m_backBuffer, NULL, &m_renderTargetView);
if (FAILED(hr)) MessageBox(0, L"Failed to create rendertargetview", 0, 0);

And nobody, nowhere is doing as the msdn site says, that the render target view must be created with this specific flag: D3D11_BIND_RENDER_TARGET

So I tried doing it by myself.

I created a texture2d desc like this for the back buffer:

D3D11_TEXTURE2D_DESC backBufferDescription;
    backBufferDescription.BindFlags = D3D11_BIND_RENDER_TARGET;
    backBufferDescription.ArraySize = 1;
    backBufferDescription.CPUAccessFlags = 0;
    backBufferDescription.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    backBufferDescription.Height = 600;
    backBufferDescription.Width = 800;
    backBufferDescription.MipLevels = 1;
    backBufferDescription.MiscFlags = 0;
    backBufferDescription.SampleDesc.Quality = 0;
    backBufferDescription.SampleDesc.Count = 1;
    backBufferDescription.Usage = D3D11_USAGE_DEFAULT;
    m_device->CreateTexture2D(&backBufferDescription, NULL, &m_backBuffer);
    if (FAILED(hr))
        MessageBox(0, L"Fallito back buffer desc", 0, 0);

And it doesn't work the same.

Help please

sentences:
Unity pattern for multiple game views What are some proven and preferable patterns to realise multiple "screens" in the game? Not in the sense of displays (monitors) but "views" within the application.

Say it's a Civ/Heroes-type game. We will typically have these screens during the proper gameplay:

Main map (strategic)
Battle map (tactical)
City management screen
Research screen
etc.

As you can see, some of them are UI-like in nature but some are full-blown interactive scenes.

We need to be able to:

Quickly switch between them
Keep a global game state between them (e.g. the (in-)famous GameManager instance must stay intact)
Bonus points if able to make a fancy transition (e.g. city screen rolling down from above)
Bonus points if able to keep one screen (e.g. city screen) only partly covering another (e.g. the strategic map) and both are animated

Theoretical solutions I can imagine (I'm still a Unity noob):

Separate scenes for each screen. But will the engine be able to switch between them fast? (I read that a scene is akin to a "level" in a traditional game, which usually means a loading time?) Also, how will I track the global state (GameManager)? Can I overlay one screen over another?
Everything in one Unity scene but multiple cameras looking at different objects, with switching between them or nesting. E.g. one camera looking at the map grid, another at a city screen etc. But then I run the risk of objects from one "scene" (only virtually) affecting others (e.g. lights or particles) unless I place them sufficiently far apart.

Is any of my ideas going in the right direction? Is there a better pattern that I'm missing?

sentences:
SDL2 application occasionally refuses to close I've been working on a sliding puzzle/game of fifteen clone in SDL recently. A problem I've had is that when I close the game the app isn't always removed from the dock and I can't force quit it. It shows up in task manager, but doesn't show up in Activity Monitor so I can't quit the game from there and end up having to hard reboot.

I can't find any pattern as to why it happens some times and not others. I thought there might be something wrong with my cleanup of SDL but I can't find any problems, although I'm honestly not sure what to look for. The full source code for this project can be found here. Thank you

sentences:
Handling actions in component based multiplayer game Please stay with me as I explain my question.

I'm creating a multiplayer game. My design pattern follows broadly thoughts described in the post here.

The idea is that each actor whether be it a (local) player or a npc does what a GameAction attached to this actor tells it to do. These GameActions are obtained by reacting to a received GameEvent. This enables only sending GameEvents through network and each client logic will obtain own GameActions for e.g. moving local copies of remote players themselves and also getting sanity checks from time to time.

How should these actions be composed then? Who takes responsibility stopping actions?

My problem right now is that if a LocalInputHandler produces on keyDown() a CHARACTER_INPUT event it will be delivered to and consumed by a parent node the local player is living in. The parent node obtains a CHARACTER_MOVE GameAction and attaches it to the specific local player. On update() the player/character excecutes the GameAction. It moves, by itself. Like a small script interpreter. Isn't that awesome? No it isn't because if I didn't release the button (aka holding it) no new CHARACTER_INPUT will be emitted and the player excecuted it's action and nothing happens.

To solve this problem I came up with 6 classifications or types of GameActions:

Unstoppable - loops forever, can only be stopped by itself
OneTimeLooper - loops until getting stopped, always finishes task before getting interrupted
Looper - loops until getting stopped, can be interrupted any time
OneTimer - performs action only once and can't be interrupted while doing it
WeakWorker - Performs action once but can always be interrupted
Stopper - AntiAction: interrupts all types except unstoppables. Is a OneTimer

This would lead having a CHARACTER_MOVE action be a OneTimeLooper. It moves the attached actor until a CHARACTER_MOVE_STOP action tells it to do, being created because of an event originating from a keyUp() call.

But this solution smells bad to me, because then each Character/Actor/Player has to have more than one GameAction it can hold to. A Stopper must have access to it's counterpart to know if it is allowed to stop. Also shouldn't higher order classes like parent nodes have the power to stop an GameAction since they also created them?
Why not give LocalInputHandler power? How to change input style if you have a menu opened on top of the screen representing everything that happens in your world?

Clarifications and optional text:

LocalInputHandler and localPlayer are coupled by handing over LocalInputHandler the ID (represented by UUIDs, which I'm still not sure using because they are so big for networking applications) of localPlayer in construction. Each InputHandler whether be it a remote or ai InputHandler will only now by ID which actor they are handling and will refer to this ID when creating a CHARACTER_INPUT event by writing recepient = actorID into the event. The message of this event is a int[] keymap which holds information about which key is held down. keymap is a member variable of a InputHandler It could be a boolean[] but for now it's an int[] array. Parentnode of an actor takes these informations (recepientID and keymap) and packs a CHARACTER_MOVE GameAction into the event passing it down to the actor for consumption. In this process the keymap is being copied by calling .copy()on keymap because this will prevent opening a channel of direct communication from the InputHandler to the GameAction by not letting it just copy a reference but the array as a whole.

sentences:
OpenXR device not present in Start or Awake methods in Unity C# script I'm developing a VR game using OpenXR in Unity (specifically developing on a Valve Index). When I try to access the input devices through the InputDevices.GetDevices() function, I get 0 devices back when I call this function from my script's Awake() or Start() methods. But when I call the same function from my script's Update() method, I see all the devices (e.g. head set, left controller, right controller).
Why can't I see the devices in the Awake() or Start() methods?

sentences:
How would a game-state snapshot system be implemented for networked real-time games? I want to create a simple client-server real-time multiplayer game as a project for my networking class.

I've read a lot about real-time multiplayer network models and I understand the relationships between the client and the server and lag-compensation techniques.

What I want to do is something similar to the Quake 3 network model: basically, the server stores a snapshot of the whole game state; upon receiving input from the clients, the server creates a new snapshot reflecting the changes. Then, it calculates the differences between the new snapshot and the last one and sends them to the clients, so that they can be in sync.

This approach seems really solid to me - if the client and server have a stable connection, only the minimal necessary amount of data will be sent to keep them in sync. If the client gets out of sync, a full snapshot can be requested as well.

I cannot, however, find a good way to implement the snapshot system. I find it really hard to move away from single-player programming architecture and think about how I could store the game state in such a way that:

All the data is separated from the logic
Differences can be calculated between snapshot of game states
Game entities can be still easily manipulated via code

How is a snapshot class implemented? How are the entities and their data stored? Does every client entity have an ID that matches an ID on the server?

How are snapshot differences calculated?

In general: how would a game-state snapshot system be implemented?

sentences:
Changing long float to number + short scale I am looking to use a piece of code to take an extremely long number and convert it to decimal equivalent + short scale. (i.e. 120100000000 would be 120.1 Billion)

I am doing this with two separate scripts but this can be condensed into a single one. I am trying to look for a recurring process instead of the massive amount of if statements currently running in the script.
This is being done with an external array in Unity that holds the strings for short scale. (billion,trillion, etc)

Trying to find a recurring model that will look for the length, and attach it to the appropriate array object.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class amountText : MonoBehaviour {
    public Text text;
    public Text numberPref;
    public string[] values;
    public static float number = 1000f;

    private float numberLength;
    private float remainder;
    private float increaseAmount = 5000f;

void Start () {
    text = GetComponent <Text>();
}
void Update () {
    text.text = Mathf.RoundToInt(number).ToString();
    numberLength =  Mathf.RoundToInt(number).ToString().Length;
    if(numberLength <9) {
        text.text = Mathf.RountToInt(number).ToString();
        numberPref.text = (" ");
    }
    if(numberLength > 9 && numberLength =< 12) {
        text.text = number/1E-9;
        numberPref.text = (values[0]);
    }
    if(numberLength > 12 && numberLength =< 15) {
        text.text = number/1E-12;
        numberPref.text = (values[1]);
    }
    if(numberLength > 15 && numberLength =< 18) {
        text.text = number/1E-15;
        numberPref.text = (values[2]);
    }

}
}

sentences:
How to add custom control shapes to a rig in Maya I find most Maya animation videos has these circle lines to control character part rotation:

Why does my imported fbx not have these circle lines?

sentences:
How can i make my soldier to patrol over the space stationin random? I mean i want to bake all the places in the space station and make the soldier to move automatic around the spaceship to random places.

What i did so far is placing the soldier at a start point. Added a camera as child to the soldier. Added a nav mesh agent component to the soldier.

Attached a script to the soldier: It's not my script. I don't want the soldier for now to chase only to walk randomly around the space station.

I didn't change any of the setting on the Nav Mesh Agent component in the inspector and i didn't

Should i change anything in the nav mesh agent component and if so what ?

How do select or set what areas to bake so the character will know to walk to this areas or if i want to select all the areas ?

How do i tell the character when to turn right or left in case there is a wall ?
Could be also random to turn left or right. Depending if there is left and right ways or maybe there is also straight way so that's 3 possible ways to move to.

clicked the Bake button yet.

I didn't write yet the script.

using UnityEngine;
using System.Collections;

public class SoldiersPatrol : MonoBehaviour
{

}

sentences:
Calculating the intersection of a fast moving circle and a line Inside of my game, I am in need of a way to test the collision between a line segment and a fast-moving circle. I would say I need a line v capsule collision however the problem is I need the collision point. None of the existing formulas I can find can do quite what I need. I have tried line x line intersection and just moving the lines by the radius of the capsule sort of work however then the collision point found around the edges is off. Additionally, I can't find a way to work back from the collision point to the point that the circle first collided at.

Above is sort of a picture of what I am hoping to achieve. The green capsule represents the circle's path.

So really the problem here is finding that collision point because a yes or no answer is trivial here. There are formulas for ray capsule or box capsule however none of them will get me this collision point.

Does anyone have any ideas on how I can figure this out?

sentences:
What is Google Play Services Multiplayer? This question might be off-topic, i don't know where should i ask it.

What's the difference between Google Play Real-Time Multiplayer, Google Play Turn-Based Multiplayer and sockets?

sentences:
Permanently Sync a wiimote with a computer i have tried to look up many ways to sync up my wiimotes to my computer so that i can program games with it, but every time it only syncs them up temporarily, or if it says it can permanently sync it, it doesn't actually do it. it gets tiresome when i have to keep on reconnecting it every time i want to save battery life. how would i be able to sync up my wiimote to my computer so that if i turn off my wiimote, i can just hit any button and it will automatically sync it up?

Edit: I have looked here: http://wiibrew.org/wiki/Wiimote under Bluetooth pairing for some advice, but I have no idea how to export the char array to the window (i am using the standard pairing with a Bluetooth device, but instead of pairing without a code, i use the "enter device's pairing code" section. this should work, but I'm stuck at how to enter the weird characters that aren't on the keyboard).

sentences: How can I get voice recognition features into the Unity Game Engine? How can I get voice recognition features into the Unity Game Engine? Is there a plug-in or a framework (hopefully freeware) that I could use? If so, do you have any ideas on how to install it? Also, how much of a problem would there be with background noises in the game interfering with the voice inputs into the game? Are there any examples of games on the market that use this? (besides for Spain 3D for the Torque Game Engine).

sentences:
How can I fix my shadow caster problem? I'm trying to make invisible object with shadow by using it's shadow castting pass it additionaly shades back side of object itself. I mean object shades his back side and draws shadow on the background surface.(my unity version is Unity 5.6)

you can see this problem in below animated gif:

this is my shader for unity's shadow pass:

Shader "Test/ShadowCaster"
{
    SubShader
    {
    Tags{ "LightMode" = "ShadowCaster"  }
    Name "ShadowCaster"
        Pass
    {
        CGPROGRAM

#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#pragma fragmentoption ARB_precision_hint_fastest

#include "UnityCG.cginc"

        struct v2f
    {
        V2F_SHADOW_CASTER;
    };

    v2f vert(appdata_base v)
    {
        v2f o;
        TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
        return o;
    }

    float4 frag(v2f i) : COLOR
    {
        SHADOW_CASTER_FRAGMENT(i)
    }
        ENDCG
    }
    }
        FallBack Off
}

sentences:
Libgdx , how to get mouse position relative to a Tiled Map I'm porting a game that i did for Ludum Dare 26, this year, i made it using Contruct2, i decided to port it to Libgdx, for learning reasons,

http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=15150  (check the web version)

My problem is that the Player moves base on the Angle, where the mouse is pointing at,
in Contruct2, they have a really nice function called

setAngleToward(Mouse.X,Mouse.Y)

in libGdx i made this function

@Override
public boolean mouseMoved(int screenX, int screenY) {

    Vector2 centerPosition = new Vector2((float)Gdx.graphics.getWidth() / 2, (float)Gdx.graphics.getHeight() / 2);
//  Vector2 centerPosition = new Vector2(getX(), getY());

    screenY = Gdx.graphics.getHeight() - screenY ; //Inverse the Y

        Vector2 mouseLoc = new Vector2(screenX, screenY);

        Vector2 direction = mouseLoc.sub(centerPosition);
        float mouseAngle  = direction.angle();/*(float)(Math. atan2(direction.y, direction.x)); */
        setRotation(mouseAngle);

        return true;
}

which works nice, but when i reach the corners on the maps, it give me the wrong angles, because the Player is not centered anymore,

I know the solution is just use "centerPosition" with the player coords, and use
"mouseLoc" with the mouse coords but needs to be relative to the tiled map, and that's my problem i don't know how to get those paramenters , screenX and screenY, are the mouse location but base on screen position

im using OrthographicCamera and OrthogonalTiledMapRenderer

i hope can understand my problem, this is the jar i have right now

https://dl.dropboxusercontent.com/u/2553973/Others/zombiesblocksattack.jar

sentences: Using old planes in video game; copyright? So i'm developing a small video game for class and for reasons we need to stay away from copyright material. I was wondering if I would have to worry about old WW2 planes being considered copyright material? I could just make some fantasy inspired planes, but i believe having them in the game could be a lot of fun.

sentences:
How can someone make 3D tiles not looking like perfect cubes? Here are the graphics an artist did for me:

While the texture is nice when seen as image file, I think the tile is somewhat flat.

The problem is:

If he bevel the cube, then there will be tiling problems (not to mention seams between cubes). How can he make tile looks less flat?

If he make the 3D model to act like 2D isometric Tiles (which have very irregular outline) there will be so much polygons that will be a nightmare for him to model dozen of Tiles.

Of course keep in mind that for occluding reasons (each cube project 6 planes that are used to occlude hidden geometry) the overall shape should be actually bigger than a cube volume, but not smaller (anyway I can loose the height requirement, cubes can be made of any height).

sentences:
Handling image size based on different ios device versions (Unity2D) This game is built using Unity 4, C#, and the 2D toolkit. In the unity game scene settings, it is set to (ios 5 tall) and I matched the Menu background dimensions with the dimensions of an ios 5 tall device.  When testing this build on a different ios device(ios 4 etc...), the menu background doesn't fit (stretch) to the width and height of the tested device's dimensions. The answer seems pretty obvious that i'm not handling all devices dimensions.

What would be a good approach on handling images based on different ios devices? Are there any build settings to build a project that handles each device dimensions?

Thanks in advance for any advice or a good approach for cross-device handling

sentences:
Drawing order of 2D tiles with 3D bounding volume I'm wondering which algorithm was used to draw the sprites of the video game Commandos in the correct order. Each sprite has a 3D bounding volume (either a polygon or a cylinder), this is how the developers stored the information:

POLY "NONAME",73,987,0,54,7,1   ;Name,CenterX,CenterY,CenterZ,Height,#Vertices,#Tiles
POINT        0,-37              ;Coord. X, Coord. Y
POINT        36,-18
POINT        36,-1
POINT        28,28
POINT        -21,37
POINT        -36,1
POINT        -36,-9
TILE          37, 581,  74,  83,   0,   0, 0,"ROC10010.RLE","   "   ;PosX,PosY,Width,Height

POLY "NONAME",70,816,0,120,4,1
POINT        0,-8
POINT        8,6
POINT        0,10
POINT        -8,-3
TILE          48, 434,  50,  98,   0,  41, 0,"POST0001.RLE","   "

POLY "NONAME",1557,4094,0,44,0,1
RADIO       17
TILE        1539,2588,  37,  55,   7,   0, 0,"DEPT0000.RLE","   "

POLYRAMPA "NONAME",626,952,0,48,40,4,1  ;Name,CenterX,CenterY,CenterZ,Height,HeightOff,#Vertices,#Tiles
POINT       43,-8
POINT       2,29
POINT        -36,-7
POINT       1,-45
TILE         590, 515,  85, 111,   0,   0, 0,"CASA0003.RLE","   "

The last object named 'POLYRAMPA' is used for stairs and ramps.
Edit: All bounding volumes are convex and don't overlap each other.

And here are some in-game screenshots:

The first three screenshots show the same map. Of course it's possible to fake the drawing order of this 'flat' map by sorting the sprites by their y-value.

But this approach won't work if the map is more complex, like the one at the bottom right.

So my question is: Which algorithm did the developers use?
Bonus question: Is there some source code available? (pseudocode or any object-oriented programming language would be great)

Edit: Sorting by the XYZ-coordinates of the bounding boxes center point doesn't work.For example:

The objects on the left side have the same center points as the objects on the right. The cylinder on the left should be in the background but the one on the right in the foreground.

sentences:
Determining the price of a trade good depending on supply and demand of a marketplace I've been meaning to add a market/trading system in my space-themed game where a player can buy from one station and sell it to another for profit, etc. (Examples would be Starsector, Elite: Dangerous, EVE Online)
The problem I've been having is actually determining the price of an item based on parameters like: Base Value, Supply, Demand, Transaction costs, Markup, and maybe others if I can think of them. I'm not particularly sure where to start with a price formula.
Any ideas on how to best decide on this?

sentences:
Rendering characters, with cut off limbs (Blender models in Java/OpenGL) What aspects should I take into consideration for creating character animation and rendering classes if I want to be able to have detachable limbs? I've developed a detailed body system that can have everything down to the nervous system defined. I'm aiming for something similar to the level of damage detail found in Dwarf Fortress. For example, when a character takes damage to their upper arm, there is a chance of nerve damage that can disable the entire arm. Or they could lose the arm entirely.

I have a system written up for handling the data part of this. Each character has a trunk, which has appendages and internal parts. Each appendage can also have child appendages and internal parts. Child appendages are disabled/removed if a parent appendage is disabled/removed. If any of the disabled/removed appendages or internal parts are required for life, the character will soon die.

What I'm working on now is the drawing/animation portion of this. How do I define animations to know which ones are allowed given the current state of the body (missing arms/legs and so on)? How do I set up the drawing system to not draw missing limbs? Does each limb/appendage have to be its own model (I'd like to draw cut off appendages on the ground)?

The simple system I'm transitioning from (I just wrote it for testing) imports all the key frames of an animation as full models into a VBO (along with vertex counts for where key frames start/stop). It doesn't import or utilize the bones defined in Blender, and it doesn't interpolate between frames.

This is likely a pretty big question, so I'm also looking for resources that can get me where I need to go.

EDIT

I ask about the animation knowing which limbs it's animating because I would like to have it set up to perform an alternate animation if a required limb is missing. After thinking about that, I imagine I would perform that check before activating an animation, and activate the appropriate animation at that time.

sentences:
Why the object is not getting close enough to the waypoint/s too high? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Waypoints : MonoBehaviour
{
    public GameObject objectToMove;
    public GameObject[] waypoints;
    public Transform target;
    public float moveSpeed = 1f;
    public float rotationSpeed = 1f;
    private Transform myTransform;
    private int targetsIndex = 0;
    private Vector3 originalPosition;
    private bool visitNpcsDistance = false;

    public float walkSpeed = 15f;

    // Use this for initialization
    void Start()
    {
        if (objectToMove == null)
        {
            myTransform = transform;
        }
        else
        {
            myTransform = objectToMove.transform;
        }

        originalPosition = myTransform.position;

        if (waypoints.Length == 0)
        {
            waypoints = GameObject.FindGameObjectsWithTag("Waypoint");
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (visitNpcsDistance == false)
        {
            WayPointsAI();
        }

        DrawLinesInScene();
    }

    private void WayPointsAI()
    {
        if (targetsIndex == waypoints.Length)
            targetsIndex = 0;
        target = waypoints[targetsIndex].transform;
        float distance = Vector3.Distance(myTransform.position, target.transform.position);
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

        //move towards the player
        myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
        if (distance < 0.3f)
            targetsIndex++;
    }

    void DrawLinesInScene()
    {
        // draw lines between each checkpoint //
        for (int i = 0; i < waypoints.Length - 1; i++)
        {
            Debug.DrawLine(waypoints[i].transform.position, waypoints[i + 1].transform.position, Color.blue);
        }

        // draw a line between the original transform start position
        // and the current transform position //
        Debug.DrawLine(originalPosition, myTransform.position, Color.red);

        // draw a line between current transform position and the next waypoint target
        // each time reached a waypoint.
        if (target != null)
            Debug.DrawLine(target.transform.position, myTransform.position, Color.green);
    }
}

The object that move between the waypoints. I added to it a box collider and set the size of the collider to 0.4,0.4,0.4 it was 0.5,0.5,0.5

The moving object also have a rigidbody I added :

Each waypoints sphere WP1,WP2....scale is set to 0.3,0..3,0.3

I added some spheres as waypoints on a stairs so the object will move up and down the stairs.
But when it's moving up and down the object seems to be too far from the waypoints :

Look at the droid (the object that move between the waypoints) height and it's not 0.3f distance from the waypoint/s. I don't want the droid to walk on the stairs move on it touch the stairs I want it to be in the air a bit but not that high.

The droid selected and set to center and local :

when changing the local to global nothing changed but when changing the center to pivot :

sentences:
Why would the same script attached to multiple scenes not work the same way in some of the scenes? I have 4 scenes in my Unity Project. And in each scene I have identical sliders, what I want to do when Advance_Trial is called via a button press, the sliders' value resets to 0. However, this only works for two of the scenes. For remaining two it doesnt work, I checked if Advance_Trial is attached to the button gameobject which calls it and it is (in all scenes).  There are no errors messages in the console either.
How do I correct it?
Also, when the else portion is executed the sliders are not inactive meaning, the sliders are still visible. This happens for the same two scenes for which the sliders do not reset.
Am I missing something? Or do I need to check something in individual scenes?
Please see my code below.
public Slider[] sliders;

    public void Start()
        {

            sliders = FindObjectsOfType<Slider>() as Slider[];

            for (int s = 0; s < sliders.Length; s++) //Resets the sliders
            {
                sliders[s].gameObject.SetActive(false);
            }
    }
     public void Advance_Trial()
        {
            for (int s = 0; s < sliders.Length; s++)
            {
                sliders[s].value = 0;
            }

            int stimIndex = UnityEngine.Random.Range(0, signals.Count + 1);
            string text = stimIndex.ToString();
            byte[] data5 = Encoding.ASCII.GetBytes(text);
            client.Send(data5, data5.Length, remoteEndPoint);
            Debug.Log("<color=yellow>Signal played is:</color>" + stimIndex);
            Debug.Log("<color=magenta>NUMBER sent to MAX is:</color>" + text);

            Debug.Log("<color=magenta>Index removed was :</color>" + signals[stimIndex]);
            signals.RemoveAt(stimIndex);

            if (signals.Count > index)
            {

                Debug.Log("<color=orange>Yay! Keep Listening!</color>");
                index++;
            }

            else
            {

                Debug.Log("<color=green>All Trials finished</color>");

                for (int s = 0; s < sliders.Length; s++)
                {
                    sliders[s].gameObject.SetActive(false);
                }

                EndSessionPanel.gameObject.SetActive(true);
            }

        }

sentences:
Unity3D - Generate a position within a circular band around the player Given a certain condition in my game I need to generate a position around the player.  It needs to be at least 8 meters away from him and within 10 meters, in a circular matter, as in the dotted green area in the picture below.

Can anyone point me into the right direction?
Thank you.

sentences:
How do you get main camera move along a specific route? I've got a scene in the starting  of my project, and what I want to do is to get my main camera move along a specific direction and route.
Let's imagine I've got a 3-Dimensional array which contains The Positions of The points thereon. This is what I want to do :

1-Set the camera position on The first point and then go along with The other points, delay X milliseconds in each point and then go with the rest of it.

2-Whenever I will be able to change any of these parameters inside the script and programmatically:X,Y,Z components of The Position and Rotation of The Transform hierarchical property.

I'm sure enough trying to write an algorithm on my own would be a relatively difficult job, so please give me some tips and if possible a pseudo-code.
And finally I want this script to be launched at the beginning of the scene.

sentences:
Characteristics, what's the inverse of (x*(x+1))/2? In my game you can spend points to upgrade characteristics. Each characteristic has a formula like:

A) out = in :
for one point spent, one pont gained (you spend 1 point on Force so your force goes from 5 to 6)

B) out = last level (starting at 1) :
so the first point spent earns you 1 point, the next point spent earns you an additional 2 and so on (+3,+4,+5...)

C) The inverse of B) :
You need to spend 1 point to earn one, then you need to spend 2 to earn another one and so on.

I have already found the formula for calculating the actual level of B when points spent = x :

charac = (x*(x+1))/2

But I'd like to know what the "reverse" version of B) (usable for C) is, ie. if I have spent x points, how many have I earned if 1 spent gives 1, 1+2=3 gives 2, 1+2+3=6 gives 3 and so on.

I know I can just calculate the numbers but I'd like to have the formula because its neater and so that I can stick it in an excel sheet for example...

Thanks!

ps. I think I have nailed it down to something like charac = sqrt( x*m +k) but then I'm stuck doing number guessing for k and m and I feel I might be wrong anyway as I get close but never hits the spot.

sentences:
How can I make a tile appear on top of another without completely blocking the tile below? Making a small RPG with libdgx just for learning about how to draw tiled maps and move around in them.  I've got the tiles drawn and OrthographicCamera stuff figured out so I can see my world.  My question is, how can I put character on a tile, so that he appears to be standing on the tile?

My idea is to give each tile a separate texture that has the character drawn on the tile.  So for example, I would have grass.png and then I would have grass-hero.png.  And then based on where the hero is upon the next render loop, if the hero has moved to a tile that was previously "grass", instead this time draw "grass-hero".

Example:

Now, I haven't done it yet, but I'm pretty sure that would work.  My question is, is there some way that I can bypass having to use a separate "combined" tile like grass-hero, and just have my hero walk on top of the grass tile?  I imagine if I use another tool like .NET Paint I could "cut" the hero out of the black background and make the background transparent, but I still don't know how to make one tile appear on top of another.

To provide some abbreviated semi psuedo code, let me show what I have:

GameScreen (implements Screen)

@Override
public void render(float delta)
{
    worldrenderer.render();
}

WorldRenderer

public void render()
{
    spriteBatch.begin();
    drawTiles();
    drawHero();
    spriteBatch.end();
}

private void drawTiles()
{
    for (Tile tile : world.getTiles())
    {
        switch(tile.getTileType())
        {
             case GRASS:
                 spriteBatch.draw(grassTexture, tile.getPosition());
                 break;
             case FOREST:
                 spriteBatch.draw(forestTexture, tile.getPosition());
                 break;
             case STONE:
                 spriteBatch.draw(stoneTexture, tile.getPosition());
                 break;
        }
    }
}

private void drawHero()
{
    Hero hero = world.getHero();
    spriteBatch.draw(heroTexture, hero.getPosition());
}

sentences:
Player rewards in games where you normally have nothing to purchase In many games there are rewards such as gold coins, points, etc. When these rewards can be used to purchase in-game items, it motivates the player to keep playing.

Let's say we have an online game, poker, Yatzy etc.  What type of reward would keep the players playing if there are few in-game items available to buy, or none at all?

What I am looking for is a reward system that entices the players to play more in a game environment where there isn't that much to purchase. For example, there isn't much to buy in a poker or Yatzy game with the gold you win.

I guess having some titles that are added to the userid is one way, or maybe purchasing a logo for the id... A leaderboard is another.

Any thoughts on this?

sentences:
Why is text resolution so bad in VR? VR is already at a point where it can render some impressive 3D landscapes. But it is awful at rendering text. This renders things like VR Desktop as basically unusable.

Question: Why is text resolution so bad in VR? I'm talking about from a technical standpoint?

EDIT: Here is a quote from an article about text resolution in VR:

  “Text is tough in VR. It’s hard to read, given the resolution of today’s HMDs and it’s hard to write, since you’re typically blind in a headset and it’s annoying to be tied to a keyboard at a desk when you’d rather walk and move around in VR. I tolerate these problems with RiftSketch by making the text in the editor extremely large. I can only see 20 lines of code at a time in VR whereas my physical desktop has a 4K monitor where I’m usually looking at 140 lines of code per file with several files open side-by-side.”

My question is why, from a technical perspective, is this the case? If we can render i.e. Shrek in VR, why can't we render clear text?

sentences:
What's in Nintendo's "Dev Interface?" Not that long ago, Nintendo opened their developer program for access by anyone who registers a Nintendo Developer account, giving equal access to indie and commercial developers. Or, at least thats what the linked page says.

The tools page lists Unity and a HTML5 framework for game development, as well as the "Nintendo Dev Interface (NDI)." Since I am not really interested in developing using Unity (or HTML5, for that matter) I want to know what the NDI contains, at least in general terms.

(I don't doubt that at least some of that information is covered by an NDA, but I'd like to know as much as possible, since I can't register for a while)

I'm especially interested in what sort of compiler/languages are supported, what graphics APIs (and/or abstraction layers, like SDL) are allowed and how play testing works (some sort of compatability layer? Nintendo sanctioned emulation?).

sentences:
D3D11 - Setting multiple ID3D11SamplerStates for the pixel shader stage once and leaving them be In my Direct3D 11 application, I am using several sampler states to retrieve texture data. Some of them are used in all pixel shaders, some of them are only used in very specific ones.

The question may seem simple, but I was not able to find any decent information on the topic-

Are there any penalties (performance or otherwise) involved in creating a number of sampler states for the pixel shader stage of D3D11, setting them all at once and just never touching them again? My shaders would reference these samplers in HLSL if they need them (for instance some shaders would reference SamplerState linear_sampler : register(s0); while some others would reference SamplerState point_sampler : register(s1);, possibly without referencing s0 at all.

Also, is it correct, that if I never want to reference these samplers in my c++ code after creation and setting, I could just release my own external references after they are set and they will not get destroyed, as D3D is keeping internal references as long as they are "bound"(?) ?
And even if had to somehow get a reference, I could simply use ID3D11DeviceContext::PSGetSamplers (of course accepting the involved performance penalty of the lookup), correct?

sentences:
Is there a way to bypass Directx Effect Files? I am now trying to abstract my rendering pipeline, and I've been able to abstract OpenGL fairly easily. But now I have ran into a rather ugly problem with Directx.

Most of my knowledge about Dx9, 10, and 11 makes use of effect files. Something that openGL distinctly lacks. I know that this file does not have to be used. However, by the way all of DX's documentation had been written, it seems like it is required and there is no way around it.

Can anyone give me a lead here?

sentences:
Change Material color programmatically I'm writing a simple C# Script to change Materials color of a object.

public class Highlight : MonoBehaviour {

    public bool Mouse_Over = false;
    public Color Highlight_Color = Color.white;
    private Renderer rend;
    private Material[] mats;

    // Use this for initialization
    void Start () {
        rend = this.GetComponentInChildren< Renderer >();
        mats = rend.materials;
    }

    public void ToggleHighlight(bool t){
        if (mats.Length == 0) {
            return;
        }
        for(int i=0; i < mats.Length; i++){
            if (t) {
                rend.materials[i].color = Highlight_Color;
            } else {
                rend.materials[i].color = mats[i].color;
            }
            Debug.Log ("Material_" + i + ".Color = " + mats[i].color.ToHexStringRGBA());
        }
    }

    void OnMouseEnter(){
        if (Mouse_Over) {
            ToggleHighlight (true);
            Debug.Log ("MouseEnter");
        }
    }

    void OnMouseExit(){
        if (Mouse_Over) {
            ToggleHighlight (false);
            Debug.Log ("MouseExit");
        }
    }
}

As you can see, I store my original Materials inside the mats array, in the Start function.
This is to revert the renderer Materials to the original Materials, but it isn't working. The color doesn't change to the original value.

I tried to check where the problem was, and in the Debug statement inside the for loop, the color is getting updated also inside mats Array.
Why is this happening?

Seems like that mats is only a pointer to rend.materials, am I wrong?

sentences:
Collision detection - formula for getting intersection point I need help with collision detection algorithm from this paper: http://www.peroxide.dk/papers/collision/collision.pdf

I assume I am colliding with sphere of radius 1, just to make everything not important easier...I am concerned with formula, which finds intersection point with plane (page 14):

planeIntersectionPoint = basePoint - planeNormal + t0 * velocity

where:
basePoint = center of Sphere

planeNormal = normalized normal vector to colliding plane

t0 = number from [0,1] interval, first moment from this interval during which collision happens, assuming we are moving with velocity vector

velocity = velocity vector

I think that this formula doesn't work... Assuming that I am already intersecting with plane at t0 = 0, I just get:

planeIntersectionPoint = basePoint - planeNormal

What gives me point which doesn't even belong to plane, what fails further parts of the algorithm, when I check if intersection point is in triangle...

I will be grateful for every answer... Is the algorithm wrong, or that's me misunderstanding something?...

sentences: Why is fog in games exponential and has a start distance? In most tutorials I see on how to achieve fog with shaders the fog is exponential and has a minimum / start distance from the camera. Why? Both seem counterintuitive, especially the minimum distance. Is this an artistic / design choice or is this how our eyes see fog in real life?

sentences:
Calculate mesh normals with added noise I'm creating a procedurally generated planet object in Unity. I start with a cube which is created from 6 meshes (6 sides) and normalize the vertices to get a standard sphere. The problem is that there are visible seams between the meshes. I know if I set the vertex normals to the direction from the center of the sphere to the current vertex then seams will gone but my next step is to add noise to the meshes to generate terrain on the sphere.
What I already tried to remove the seams:

Generating an extra strip around the mesh

Generating an extra strip around the mesh which is located on the adjacent sides

The second solution is almost perfect but seams are still visible a little bit.

When I create the mesh object:

call the built-in RecalculateNormals on the mesh (including the borders)
remove the border vertices, indices and normals
reassign the vertices, indices and normals to the mesh object (excluding the borders)

I use libnoisedotnet to create simplex Perlin noise on the surface:
private MeshData CalculateMeshData()
{
    MeshData meshData = new MeshData();
    meshData.ChunkSize = CHUNK_SIZE;
    meshData.BorderSize = BORDER_SIZE;

    int borderedResolution = meshData.BorderedResolution;
    int vertexIndex = -1;
    float faceWidth = _radius * 2 / CHUNK_SIZE;
    float currentYPosition = -_radius - faceWidth * BORDER_SIZE;

    for (int y = 0; y < borderedResolution; y++)
    {
        float currentXPosition = -_radius - faceWidth * BORDER_SIZE;
        for (int x = 0; x < borderedResolution; x++)
        {
            bool isMeshVertex = !IsBorderVertex(x, y, borderedResolution);
            Vector3 axisAOffset = _axisA * currentXPosition;
            Vector3 axisbOffset = _axisB * currentYPosition;
            Vector3 pointOnUnitCube = _center + axisAOffset + axisbOffset;
            Vector3 vertex = pointOnUnitCube.normalized;
            vertex = vertex * GetElevation(vertex);

            vertexIndex++;
            meshData.AddVertex(vertex, isMeshVertex);

            // Prevents to create more two triangles next to the edge of the mesh.
            if (x != borderedResolution - 1 && y != borderedResolution - 1)
            {
                bool isMeshTriangle = IsMeshTriangle(x, y, borderedResolution);
                meshData.AddTriangle(vertexIndex,
                                     vertexIndex + borderedResolution + 1,
                                     vertexIndex + borderedResolution,
                                     isMeshTriangle);

                meshData.AddTriangle(vertexIndex,
                                 vertexIndex + 1,
                                 vertexIndex + borderedResolution + 1,
                                 isMeshTriangle);
            }

            currentXPosition += faceWidth;
        }

        currentYPosition += faceWidth;
    }

    return meshData;
}

private float GetElevation(Vector3 position)
{
    return 1 + _noise.Evaluate(position) / 10f;
}

Here is the noise library what I tried to use:
https://github.com/SebLague/Procedural-Planets/blob/master/Procedural%20Planet%20E03/Assets/Noise.cs
Is it possible to remove the seams fully?

sentences:
Twine Harlowe: Can I create passage links with the gui? Or any alternative way? I'm confused how I am expected to organize and write a story within Twine using just the tools outlined in the manual. The main concern revolves around initiating links between my squares/charts/whatever (the passage link system). Am I expected to always manually type [[]] with the correct name of the passage to assign any flow of passage?

I see this as being problematic when designing a story, as you would need to consistently re-position/delete/add-new squares to tell the story properly. I am confused why the gui doesn't seem to support the drop and drag between existing flow arrows? OR does it..? Going in and manually changing the names of everything each time I have to change a position...and needing to use a brand new name cause the existing name won't overwrite or swap. Some people seem to recommend ordering the passage titles by number, but this creates the very problem I am outlining where when changing the position of 3 and 4 you'd have to use like some offbrand title, and do about 8 steps just to swap positions.

Am I supposed to use a different program instead when concocting my story and only use twine once I know where everything goes? Doesn't that defeat the point of it to begin with?

sentences:
How to generate tile based natural looking map? I have a tile based map which I generate using interpolation of pixels on a reference bitmap into appropriate tiles depending on the color of the pixel.

I'm trying to make the output look natural in which blocks of similar tiles look like they are forming a single entity as in the following image:

While my version only puts static sprites onto aligned cells, the second image  takes forest tiles and smashes them together like a whole single forest.
The same is done for the water area.

Could someone explain or point me somewhere where I can learn how to make the result of the first image look like the second? Thank you

Also, how are the seamless road connections done in the above image?

sentences:
What is the correct way of implementing a deterministic frame update? My goal:

Implement the game update loop so that it's deterministic (i.e. every frame of updation behaves the same when run multiple times with same frame-input, does not depend on processing speed etc.)
Limit the framerate of the game at (maximum) 60fps (can be slower if CPU hangs)

What I don't want to do:

I don't want to use a delta_time to compute position updates, because it violates the goal
Don't want to introduce any additional input-lag that would come with any sort of buffering (for interpolating time between frames etc.)

What I came up with:

I use vsync to guarantee that the game never produces more than 60 fps
I disallow any screen-mode that is not running at 60Hz because the game would run at different speeds
I allow windowed mode only if the current screen-mode is at 60Hz

Is there a better approach that what I'm doing to achieve what I want, perhaps without limiting the supported refresh rates?

sentences:
How do console games avoid port forwarding with user hosted servers? On AAA xbox games (Call of duty, etc.), the company acts as a matchmaking service but the users host all of the games. Because not everyone has ports forwarded on their router, how do these games create an accessible server without relying on port forwarding?

In other words, how would one (on a high level) implement NAT to NAT connections?

The only thing I can think of is:

Try to open up a port via UPNP
If that fails, use a centralized relay server (latency!) or host on the centralized server

Is that a suitable idea or is there a better option?

sentences:
Why do game engines convert models to triangles instead of using quads? I've worked using Maya for animation and more film orientated projects however I am also focusing on my studies on video game development. Anyways, I was talking with one of my professor and we couldn't figure out why all game engines (that I know of) convert to triangles.

Anyone happen to know why game engines convert to triangles compared to leaving the models as four sided polygons? Also what are the pros and cons (if any) of doing this?

sentences:
SDL - Getting a single keypress event instead of a keystate? Right now I'm working on a simple SDL project, but I've hit an issue when trying to get a single keypress event to skip past a splash screen. Right now, there are 4 start-up splash screens that I would like to be able to skip with a single keypress (of any key). My issue is that, as of now, if I hold down a key, it skips through each splash screen to the very last one immediately.

The splash screens are stored as an array of SDL surfaces which are all loaded at the initialization of the state. I have an variable called currentSplashImage that controls which element of the array is being rendered on the screen. I've set it up so that whenever there's a SDL_KEYDOWN event, it triggers a single incrementation of the currentSplashImage variable.

So, I'm really not sure why my code isn't working correctly. For some reason, when I hold down a button, it seems to be treating the held button as a new key press event every time it ticks through the code. Does anyone know how I can go about fixing this issue?

[Here's a snippet of code that I've been using...]

void SplashScreenState::handleEvents()
{
    SDL_PollEvent( &localEvent );

    if ( localEvent.type == SDL_KEYDOWN )
    {
        if ( currentSplashImage < 3 && currentSplashImage >= 0)
        { currentSplashImage++; }
    }
    else if ( localEvent.type == SDL_QUIT )
    {
        smgaEngine.setRunning(false);
    }
}

I should also mention that the SDL_Event 'localEvent' is part of the GameState parent class, while this event handling code is part of a SplashScreenState subclass.

If anyone knows why this is happening, or if there is any way to improve my code, It'd be helpful to me! :D I'm still a very new programmer, trying to learn.

UPDATE:

I added a std::cout line to that the code runs multiple times with a single KEYDOWN event. I also tried disabling SDL_EnableKeyRepeat, but it didn't fix the issue.

void SplashScreenState::handleEvents()
{
    SDL_PollEvent( &localEvent );

    if ( localEvent.type == SDL_KEYDOWN )
    {
        if ( currentSplashImage < 3 && currentSplashImage >= 0)
        {
            currentSplashImage++;
            std::cout << "KEYDOWN.."; //<---- test cout line
        }
    }
    else if ( localEvent.type == SDL_QUIT )
    {
        smgaEngine.setRunning(false);
    }
}

This prints out "KEYDOWN..KEYDOWN..KEYDOWN.." in the cout stream when a button is held.

sentences: What's the difference between Collision layers and Collision masks? In PhysicsBody and PhysicsBody2D in GoDot, there are two attributes called Mask (PhysicsBody| Collision| Collision and Mask). I noticed that a body collides with another body if they have a layer in common or a mask in common. But then, if there's already a collision layer, what's the purpose of the mask?

sentences:
How to create 3D area mask? I have two cubes, one parent and one child. I want to use the parent's cube mesh as a mask for the child cube. I want to make visible only the part of the child cube that it is inside the parent cube.

I can easily achieve this effect with 2D sprites using the Sprite Mask, but I can't find a way to do it for 3D areas or 3D objects.

What I have:

What I want:

sentences:
LineRenderer not working using Vuforia in Unity So I'm trying to render a line that shows up when camera sees an image target and moves around with it. Very typical AR application. But my line renderer doesn't seem to show at all.

Here's the code:

using UnityEngine;
using System.Collections;

public class myLine : MonoBehaviour
{
    // Creates a line renderer that follows a Sin() function
    // and animates it.

    public Color c1 = Color.yellow;
    public Color c2 = Color.red;
    public int lengthOfLineRenderer = 20;

    void Start()
    {
        LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
        lineRenderer.widthMultiplier = 0.2f;
        lineRenderer.positionCount = lengthOfLineRenderer;

        // A simple 2 color gradient with a fixed alpha of 1.0f.
        float alpha = 1.0f;
        Gradient gradient = new Gradient();
        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
            );
        lineRenderer.colorGradient = gradient;
    }

    void Update()
    {
        LineRenderer lineRenderer = GetComponent<LineRenderer>();
        var t = Time.time;
        for (int i = 0; i < lengthOfLineRenderer; i++)
        {
            lineRenderer.SetPosition(i, new Vector3(i * 0.5f, Mathf.Sin(i + t), 0.0f));
        }
    }
}

and here's my set up:

I also tried attaching the script directly to the ImageTarget and nothing happened.

sentences:
Any major perf (or otherwise) concerns with rendering to/from big partial texture rather than multiple? I have a very low res mobile game I'm working on that takes multiple rendering passes followed by a pass the composes them. Currently, I have a tex for each pass- each of which gets given to the shader for final composition.

I want to keep # of textures used low, and I'm only able to sample from so many textures per-shader anyways (esp. for mobile). So I'm thinking each render pass would instead render to a portion of a single, bigger texture. Then the composition pass would sample the same texture from multiple places. Are there any red flags that pop out regarding this strategy?

My biggest worry is it would totally thrash the texel cache (since every frame, every pixel samples the exact same texels for all the textures (each texture is a 1 to 1 mapping of the screen) = incredibly predictable/efficient caching. However, I really only have a very basic understanding of how that works so I could be totally wrong.

Also, note that my game is incredibly low resolution (128x256), so a single "giant" texture that could hold maybe 6 screens would still be pretty small at the end of the day.

Any insight is helpful! Thanks!

sentences:
XNA Access violation from KernelSoundEffectInstance Some users (but not all) are reporting a periodic crash in my XNA game. They say it's happening every 15 to 20 minutes. I am unable to replicate this myself, so I asked users to send me error logs.
Here is the error log one user gave me which reported an access violation:

Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at Microsoft.Xna.Framework.Audio.KernelSoundEffectInstance.SetVolume(KernelSoundEffectInstance* , Single volume)
at Microsoft.Xna.Framework.Audio.SoundEffectUnsafeNativeMethods.SetVolume(UInt32 soundEffectInstanceHandle, Single volume)
at Microsoft.Xna.Framework.Audio.SoundEffectInstance.set_Volume(Single value)
at Game.DynamicSong.Update()
at Game.DynamicMusicPlayer.Update()
at Game.Game1.Update(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Microsoft.Xna.Framework.Game.Run()
at Game.Program.Main(String[] args)

Important note: My game dynamically fades music in and out depending on what you're doing and where you are. So I'm calling volume-related methods on looping music multiple times every update. I can't see how this could cause such an error though.

So do you think this is an error on my part or is it a bug with XNA?
How could I go about fixing this or getting around it?

Would it be safe (or even possible) to just not close the program when this exception is thrown? (probably not?)

Thanks in advance.

Update: Users are reporting that the log is identical for each crash. This means it's always happening in the KernelSoundEffectInstance class. Prior to this I was worried it may be happening in different places each time, like this person here: https://stackoverflow.com/questions/4074585/attempted-to-read-or-write-protected-memory-this-is-often-an-indication-that-ot

sentences:
Resource and game state management for multiplayer game server I'm building a virtual world kind of engine. It's mostly for fun and learning. But I would like to get it right from the very beginning, so it is stable and can be scaled relatively easily.

I've been reading a lot lately about architecture of multiplayer real-time games (and real-time 3D games in general) but still there are some questions unanswered.

For now, I know the following:

the server will be the authority, and clients will be "slaves";
the game engine core will be based on subsystems (like physics subsystem, game logic subsystem etc.) and all the communications
between those subsystems will be implemented using pub/sub approach;
I'll use enet for networking, and my network layer will be as a separate subsystem, which will just plug into the pub/sub system (so other game server components don't have to know anything about the network layer);
physics engine - some free library, haven't decided yet. I guess, I'll use the same physics engine on the server and on the clients,
and implement client-side prediction;
I would like my server to be cross-platform (Windows and Unix/Linux) so I'm thinking about using new C++11 features (like cross-platform threading support etc.). I know, C++11 is not stable yet, but I guess, it will be stable at the time when I have something working (Visual Studio 11 Beta and the latest GCC already support many C++11 features, so I guess, it's good to go). Using C++11 I could avoid some other 3rd party libraries, like Boost;
game state storage - MySQL. I'm not yet sure, what strategy I'll use to flush the game state from memory to the database, but I think, it'll be mixed - more important state changes will be stored immediately, and less important ones will be stored in batches in some background process.

I guess, this information should be enough to see where I'm going to. And now the questions.

There are going to be lots of various resource files - textures, audio, meshes etc. Do I need a resource manager also on the game server or it will be enough to have a good resource manager on the clients only?
As the game world gets bigger and the number of clients grow, the resource manager needs lots of careful planing to avoid loading all the resources in memory and thus possibly causing low-memory issues. What is the best practice - do game servers load and keep the resources cached in RAM (and also unload them as necessary to avoid low memory issues) or this task is relayed completely to clients?

I've heard a lot about memory managers/heap allocators and how the game engine might benefit from a custom memory manager to track memory allocations, collect statistics, debug etc.
Will a custom memory manager give something valuable to the multiplayer server or it is enough to use custom macros around new/delete to track standard C++ memory allocations?

Could I use some NoSQL RAM database engine which periodically (or when there are enough dirty objects, or when system goes out of free physical RAM) flushes its state to some persistent database? Will the game server benefit from such approach? I don't want to use something just because it's modern and cool, I prefer simple (but still scalable) solutions.

sentences:
Unity/UNet without a lobby: How do you get an ordered list of participants (network players)? Please imagine a turn based multiplayer game. Right now there's no lobby in place and connections are established using Unity's Network Manager HUD.

Now on the server, how can you get a list of all the match participants? Preferably ordered - something like the player on the host should be player 1, the first player who joined the match should be player two, the second player who joined should be player three....

Any advise is welcome,
thank you.

sentences:
Unity - Pixels, Units, Sprites and Pixels per unit - Setting a relationship between sprites and screen size I don't get how units and pixels work in Unity. For instance:

Here I have a camera with size 5. This means that there are 5 units from the center of the camera to either the top or bottom border. This means too that the total height of the camera are 10 units.

At the same time we have a "Display 1" set to 1920x1080. If the height of the screen in pixels is 1080, and there are 10 units, this would mean that every unity will be 108 pixels, right?

On the other hand, if I set the resolution of "Display 1" to 2560x1440, this would mean that every unit would draw 144 pixels, right?

Now, I have my sprite, a 35x37 pixels image.

Since I want my game to be a pixel art, I want the pixels to be more prominent. To do this, I would like to upscale it 4 times, meaning that instead of 35x37, I want to draw 140x148 pixels, right?

But if I go to the settings of my sprite, I find the following settings:

There is a field calles "pixels per unit". Which means that I have to manually the calculation between the resolution of my display and the size of my camera. So in this case set the "Pixels per unit" to 108.

But then, if I want to allow to have different resolutions in my game, say 1440p, this means that the "Pixels per unit" for my sprite must be 144, instead of 108. Since this setting is not automatic, and cannot be changed on runtime (I think), does this mean that I have to duplicate the same sprite and set every file with different PPU, depending on all the resolutions I want to support, and then in runtime select the appropiate sprite? Because that doesn't seem right.

Is there some concept I am not properly grasping about Units and Pixels?

sentences: How can non-CG shader code in Unity be included? In Unity shaders, #include, #define, and other preprocessor commands seem to not be able to be used outside the CGPROGRAM section of the shader. Since these are required for compiling multiple shader variants, and a large portion of the shader is non CG, this would be incredibly useful to reduce shader duplication. Do these commands exist outside CG?

sentences:
How can I alleviate network lag issues with players from other countries? I am developing a small multiplayer game where players move through the map and interact with each other. The game is written in VB.Net.

When I tested my game with players on a LAN everything worked pretty smoothly. Testing it on the internet with players from the same country worked pretty well, without lag, also. The problem is when players from other countries try to connect to the game: they can connect and play but the game is very laggy for them.

What should I do to fix the lag?

sentences:
Which technique should I use to create procedurally generated planets I am working on a personal project to create a game, in which you can fly in space to various planets and land on said planets.
I was originally using a script to create an IcoSphere which I stored using recursive chunks which worked as a LOD.
The results looked good from space, however, after creating a player on the planet, the triangles were still very large. The IcoSphere was only subdivided 5 or 6 times due to the lengthy processing times.
I was going to base the texturing of the magnitude of the point on the sphere taking into account various factors.
Is there a better method to generate planets without these processing times?
EDIT
I am only interested in generating the planet surface, not the positioning in the galaxy/universe
I have done research online into different techniques. I've seen people using cube spheres however that looked to have caused a lot of distortion around the corners. I've also seen Octohedrons which were subdivided but I think that'd give the same problems as my icosphere technique

sentences:
Can i use Soccer/football team names in my web, iphone and android apps? If i don't use logos, player names, sponsors or any images can i use team names in a for profit app? The reason i mention these is that i have seen countless references to images and badges but not the name in text format only.

Eg print the league table or show a fixtures list or show some user stats in relation to a team name in the app.

I read that a court has ruled in 2012 that fixture lists are not copyright-able as they involve pure scheduling logic and no artistic or innovative value. Also i know that logos, shield, images, player names and images etc are copyright-able.

Do team names fall under fair use if it is purely the team name in a fixture list or in a list or teams?

sentences:
Timing while calling update more than once per frame TL;DR: Using a timestep method that calls update() multiple times per frame. After an event happens, need to add a wait time before it can happen again. What's the best way to do this so the wait times are always the same across all hardware?
Lets say that a bullet is spawned every time the player presses the mouse button. If the player holds the button down, a new bullet will spawn every frame (which is obviously WAY too many). The way I always got around this was to create a variable shotCoolDown and set it equal to some arbitrary number (usually 60). Then, in the update() function, I would subtract 1 from shotCoolDown every frame, and only allow the player to shoot if shotCoolDown was less than or equal to 0, and then after creating the bullet, set shotCoolDown back up to 60. At 60 FPS, this created a maximum of 1 bullet per second.
This worked when calling update() once per frame. However, I'm now using a new timestep method from this article, which calls update() multiple (always different) times per frame. Because I don't know how many times update() will be called, I can no longer use my original shotCoolDown method.
I've also tried comparing the current time to the time at the mouse button press, and if the difference is more than 1000 ms (1 second), spawn a bullet. However, this doesn't exactly work. Since the computer's clock continues to tick while the game is paused, the player can simply shoot, pause the game and wait for the limit to pass, then unpause the game and shoot again.
Is there a better way to add these time limits? I know I can use timers, but some of my limits will be as small as 1/10th of a second; I'd rather not use a timer for such a small period of time.

sentences:
How do I play an animation using lib3ds? I am having trouble playing an animation of a .3ds object using lib3ds.

I am able to load the .3ds model with lib3ds. But I can't find a way to play (for example) my 'walk' animation. Where can I find the animation data and how can I play the animation using lib3ds?

sentences:
How to Detect a Right Mouse Click on a UI Button in Unity I've been recently working on a videogame, and I'm trying to make a script that will destroy the game object it is applied to whenever the right mouse button is clicked on it. It doesn't function at all and I don't receive any error messages in the Console. Here is all my code:
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class RightClick: MonoBehaviour, IPointerClickHandler
{
    // Initiates whenever the pointer is clicked
    public void OnPointerClick(PointerEventData eventData)
    {
        // Destroys item from players inventory when pressed
        if (eventData.pointerId == -2)
        {
            // Removes object from inventory
            Object.Destroy(this.gameObject);
        }
    }
}

I have searched for hours on this topic and have only found extremely outdated sources, please help me!

sentences:
How can I fix glitchy Collision on my 2D game? Update: I fixed the Negative axis glitch but the Invisible wall glitch still exists
I have made a 2D game in Java and I rewrote collision as I added chunks.
I have been having problems with the collision detection function, in the negative x-axis coordinates you fall through the world, and in the positive X-axis you sometimes hit into an invisible wall when there are no blocks next to you in that position.
I have tried altering all the numbers until it worked but the problems still happen
Here is the collision function (True = Yes, they are colliding with a Block | False = They are not colliding):
public boolean isCollidingWithBlock(final Point2D.Double pt1, final Point2D.Double pt2) {
        for(int i=0;i<Level.Chunks.size();i++) {
            if (Math.floor((x)/(Level.chunkX*Tile.tileSize)) == Level.Chunks.get(i).chunkNumber) {
                int chunkN = Level.Chunks.get(i).chunkNumber;
                Point2D.Double chunkpoint = pt1;
                if (chunkpoint.x >= 0) {
                    chunkpoint.x = chunkpoint.x%(Level.chunkX*Tile.tileSize);
                } else {
                    chunkpoint.x = (chunkpoint.x%(Level.chunkX*Tile.tileSize))+((Level.chunkX*Tile.tileSize)*1);
                }
                Point2D.Double chunkpoint2 = pt2;
                if (chunkpoint2.x >= 0) {
                    chunkpoint2.x = chunkpoint2.x%(Level.chunkX*Tile.tileSize);
                } else {
                    chunkpoint2.x = (chunkpoint2.x%(Level.chunkX*Tile.tileSize))+((Level.chunkX*Tile.tileSize)*1);
                }

                for (int x = (int)((this.x) / Tile.tileSize); x < (int)((this.x) / Tile.tileSize + 3.0); ++x) {
                    for (int y = (int)(this.y / Tile.tileSize); y < (int)(this.y / Tile.tileSize + 3.0); ++y) {
                        int chunkXPos = 0;
                        if (x >= 0) {
                            chunkXPos = (x%(Level.chunkX));
                        } else {
                            chunkXPos = (x%(Level.chunkX))+((Level.chunkX)*1);
                        }
                        if (chunkXPos >= 0 && y >= 0 && chunkXPos < Level.Chunks.get(i).blockData.length && y < Level.Chunks.get(i).blockData[0].length && Level.Chunks.get(i).blockData[chunkXPos][y].id != Tile.air && Level.Chunks.get(i).blockData[chunkXPos][y].id != Tile.water && (Level.Chunks.get(i).blockData[chunkXPos][y].contains(chunkpoint) || Level.Chunks.get(i).blockData[chunkXPos][y].contains(chunkpoint2))) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

sentences:
How do you make a object that always follow another object? I'm trying to make a game object follow another game object and switch to another when a button is pressed. But right now it just seems to change the position when the button is pressed but it doesn't follow the object. How can I make it follow the other object?

public Transform PosObjOne;

public Transform PosObjTwo;

public Transform PosObjThree;

void Update () {
    if (Input.GetButtonDown("UseVr"))
    {
        PosObjThree.position = PosObjTwo.position;
    }

    if (Input.GetButtonDown("NoVr"))
    {
        PosObjThree.position = (PosObjOne.position);
    }
}

sentences:
LibGDX's particle emitter - Multiple particles in the same effect? Hello everyone reading this,

I've used the particle editor to edit an effect to put in my game.
Is it possible to have multiple and randomly emitted images (particles) instead of one?

I don't want to create for example 3 particle effects in the same position for having the result I want.

sentences:
Using large textures on limited hardware I've run into a problem where some of the models that I'm loading can have very large textures (2000x2000 for example). While my desktop computer can load them just fine, my laptop gets a segfault at the glTexImage call. I've thought of a couple of things I can do in this situation:

Before giving the image to OpenGL, I could downscale it so it's below the max texture size, but I'm not sure how to then stretch the image to its original width and height
I could also outright refuse to load the texture, and replace it with a generic repeating texture, like Valve's black and purple grid, but this isn't at all reliable or desired

Are these two options viable? How is it done with game engines like Unity or Source? Are there any other options that are better than my ideas?

sentences: Possible to yield a coroutine when it is taking too long to run? Suppose I have a function that raycasts from (0,0,0) to every object in the scene.  Sometimes the scene contains just a couple objects and sometimes it contains several hundred.  Is it possible to setup the raycasting function in a way that  ensures a good framerate? For example, within the "for" loop that shoots the rays could I somehow evaluate how much time has passed since the loop started and "yield return null" if the time in seconds is greater than the target time of each frame?

sentences:
Multiple Vertex Buffers per Mesh I've run into the situation where the size of my mesh with all its vertices and indices, is larger than the (optimal) vertex buffer object upper limit (~8MB). I was wondering if I can sub-divide the mesh across multiple vertex buffers, and somehow retain validity of the indices. Ie a triangle with a indice at the first vertex, and an indice at the last (ie in seperate VBOs).

All the while maintaining this within Vertex Array Objects.
My thoughts are, save myself the hassle, and for meshes (messes :P) such as this, just use the necessary size (> 8MB); which is what I do at the moment.
But ideally my buffer manager (wip) at the moment is using optimal sizes; I may just have to make a special case then...

Any ideas? If necessary, a simple C++ code example is appreciated.

Note: I have also cross-posted this on stackoverflow, as I was not sure as to which it would be more suitable (its partly a design question).

sentences: Methods for character design When one begins the character design process, what are good starting points? Are there well known methodologies or systems to help in this process? How does the design process work in game industry, and are there big differences between the approaches different game producers use?

sentences:
Develop Isometric Games could someone explain me about isometric games ? i'm unity beginner and want to know about game development.

i read that its 2.5 d , that all the objects is actually 2d sprites,
is that true ?
can we combine it (i use isometric camera, pan only, no rotation) ? ,i mean can we use 2d (for buildings) and 3d (characters) ?
i recently play android games (Fun Hospital Tycoon), anyone know the
game ? are they using full 2d or combined ?

thank you.

sentences:
Material looks different on programatically generated mesh compared to resized default cube mesh I've written some code that generates a mesh from some 2D nodes, generating both triangles and vertices. It seems to have worked pretty well, since I get a solid mesh without any weird rendering artefacts:

As you can already see in the preview, I am experiencing some problems with lighting and materials, despite the triangles and vertices being completely valid and wound correctly.
This is probably shown best by comparing this with a mesh created via right click > 3D Object > Cube, with the exact same material assigned as the programmatic mesh:

I have tried calling RecalculateNormals() on the mesh, but this doesn't help.
I'm really stuck trying to work out what's going on, so any help is very much appreciated.
Edit:
In lieu of the code, here are the vertices and triangles that I'm using in this mesh:
Vertices: [(0.5, 0.0, 0.5), (0.5, 0.0, -0.5), (-0.5, 0.0, -0.5), (-0.5, 0.0, 0.5), (0.5, -0.5, 0.5), (0.5, -0.5, -0.5), (-0.5, -0.5, -0.5), (-0.5, -0.5, 0.5)]

Triangles: [(3, 0, 1), (3, 1, 2), (5, 4, 7), (6, 5, 7), (0, 4, 5), (5, 1, 0), (1, 5, 6), (6, 2, 1), (2, 6, 7), (7, 3, 2), (3, 7, 4), (4, 0, 3)]

For @Phillip:
Mesh editing = Instantiate(new Mesh());

Vector3[] vertices;
int[] triangles;
GenerateVertices(out vertices);
GenerateTriangles(in vertices, out triangles);

editing.Clear();
editing.vertices = vertices;
editing.triangles = triangles;
editing.RecalculateNormals();

sentences:
How do I calculate speed given two xy vectors? I have some code that returns the x and y linear velocities of a moving space ship. How can I combine these to give me total speed?

x = self.player._box2dBody.GetLinearVelocity().x;
y = self.player._box2dBody.GetLinearVelocity().y;

So if:
x = 1.99
y = -1.63

How do I calculate the total speed?

sentences:
What is the purpose for drawing vertices and shapes in OpenGL (or DX), if a game is using sprites? Something I do not understand.  All the tutorials on OpenGL, DirectX, or other, always show you how to draw a shape and then change its vertices, move it around and so on.  But all the games I know of, tutorials on creating, etc., always have sprites and sprites alone.

What is the reason for drawing triangles and squares for games?  I never see it used, only pre-made graphics.

edit:  based upon answers so far, is the purpose of drawing shapes to "bound" a sprite?  So if I have a character, on a platformer like Mario, Mario has a shape around him and that shape's location is used to detect collisions, etc.?

edit:  Maybe a small example?

sentences:
How to make a drawing action run in an left released event in Game Maker? At first I tried to make the progress bar update using only one object that would command everything (obj_Control), linking to the global left released event a script containing the draw_rectangle function, but I got no results.

The Game Maker did not acknowledge any errors, but the progress bar did not update when I clicked on the created rectangles.

obj_Control (already without the draw_rectangle event):

Because of this I decided to create 3 new objects (obj_Vida, obj_Fome, obj_Energia), each containing a sprite and when each was clicked it would perform the action to update the progress bar:

obj_Vida:

scpt 1 => obj_Control.vida+=10; (applies to self)

scpt 2 => draw_healthbar(120,100,240,120,vida,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

obj_Fome:

script 1 => obj_Control.fome+=10; (applies to self)

script 2 => draw_healthbar(120,150,240,170,fome,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

obj_Energia:

script 1 => obj_Control.energia+=10; (applies to self)

script 2 => draw_healthbar(120,200,240,220,energia,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

Room:

Room size => 360x640

Translate => vida/life, fome/hungry, energia/energy

What happens is that even dying of clicking on objects (obj_Vida, obj_Fome, obj_Energia) nothing happens to the progress bar. I discovered that it is because of the event, it would have to be a draw event. I added one below the left released event, but it did not work.

I apologize for any typing errors. I am not an English speaker and I had to translate everything. If something was not clear, please signal.

Thanks for everything.

sentences:
How to vertically flip a DDS texture on import? I have a program capable of rendering 3D graphics using Direct3D11 and it is currently compatible with two different texture formats, TGA and DDS. The code to read and load a TGA texture in memory I'm using was from Rastertek tutorials here and it handle TGA textures which are upside down by reading their bytes backwards, but the code to read and load a DDS texture I'm using is just D3DX11CreateShaderResourcesViewFromFile function from D3DX11tex.h, and it was good enough for me until a while ago.
Now I'm facing a problem as some of DDS textures I want to use are upside down in a similar way to the TGA textures, so I need somehow a code where I can control how it reads the texture so I can modify it to read the DDS texture upside-down.
I've read this article from Microsoft, but even their simplest code is far more complex than the code from Rastertek to TGA file. It's not clear to me how I can implement a method to read a DDS upside-down.
What I 'think' I understand about TGA's data it that its first 18 bytes are their header and the rest is 4 bytes for each pixel(in a RGBA style), but I really don't understand how DDS works.

sentences:
SteamVR No Longer Opening With Unity Projects I'm trying to get Unity to open/utilize SteamVR for development. Everything was working fine until today, but now Unity does not use SteamVR.
I did not make any changes to SteamVR recently, and I get the same results on multiple projects and Unity installs. I also tried rebooting.
It looks like Windows pushed an update today for KB4023057 but I can't uninstall it. It's not found within uninstall updates, not in add/remove programs, and even using command prompt wusa /uninstall /kb:4023057 results in "KB4023057 is not installed." So it seems I'm stuck with it.
Any other ideas to either try to uninstall the update or else to somehow get SteamVR working in Unity again?

sentences:
Relation between "Run in background" setting and OnApplicationPause method I'm working on a game for mobile platforms (Android at the moment, in the future it should be available for iOS and WinPhone) and I want to trigger a certain method when the game is un-paused. For this I'm trying to use OnApplicationPause(bool paused) method (when the "paused" variable is false), but the process is not working as expected. These are my questions:

In the player settings, does the "Run in background" setting influence the build (since this setting can be found only in Web player/Desktop build tabs, and I'm creating an Android build).
The problem that we started to experience is that when the game is paused, it crashes and the player has to restart the game. Is this connected to the "Run in background" setting?
What is the relation between "Run in background" and OnApplicationPause - will the OnApplicationPause be called if the "Run in background" is checked?
What is the difference between OnApplicationPause and OnApplicationFocus (meaning, which actions change the focus and which will pause the game)?

The code that I'm trying to execute at the moment is fairly simple:

void OnApplicationPause(bool paused)
{
  if(!paused) AddCoins( x => PlayerPrefs.SetInt("CoinCount", PlayerPrefs.GetInt("CoinCount")+x));
}

The idea of this code is to add a certain number of coins if the player watches an advert (the number of coins is calculated by the ad provider).

Thanks in advance

sentences:
Handling Events & User Event Limits In Pygame I am trying to make a vertical shoot em up using Python and Pygame. In order to handle timing, such as when certain enemies come out and other stage events, I've been using pygame.time.set_timer().

For example, to start spawning simple enemies, I would do the following:

First setup a USEREVENT:

SPWNGRUNT = pygame.USEREVENT + 0

Then in the main loop, check for events:

for event in pygame.event.get():
    if event.type == self.SPWNGRUNT:
        spawnGrunt()

Then at some point, trigger the event on a timer:

pygame.time.set_timer(SPWNGRUNT, 600)

However, I have quickly ran out of these USEREVENTS. I eventually get the below error:

ValueError: Event id must be between NOEVENT(0) and NUMEVENTS(32)

My questions are this. Is there a way around this? Also, is there maybe a better way of managing timing and events that I am not seeing?

sentences:
Why Are These 3D Square's Pixels Spaced? So i'm currently attempting to write a 3D renderer. From no prior knowledge because I want to challenge myself. But I'm stuck here, and thought I'd bring it to StackExchange because I always see brilliant solutions! If more code is needed please just ask!

This Is My Square Render Code:

public void renderSquare(int xPos, int yPos, float zPos, int width, int height, int color) {
    clearArray();

    for(int y = 0; y < height; y++ ) {
        int yy = y + yPos;

        for(int x = 0;x  < width; x++) {
            int xx = xPos + x;

            float xS = -1f, yS = -1f;

            if(xx < centerX ) {
                xS = ((xx / zPos)) + centerX;
            }else {
                xS = ((xx / zPos)) - centerX;
            }

            if(yy < centerY) {
                yS = ((yy / zPos) - 0.5f) + centerY;
            }else {
                yS = ((yy / zPos) - 0.5f) - centerY;
            }

            setPixel((int)xS, (int)yS, color);

        }
    }
}

Plus How I Set Pixels:

public void setPixel(int xPix, int yPix, int color) {
    if(xPix < 0 || xPix > width || yPix < 0 || yPix > height)
        return;
    try {
        render_buffer[xPix + yPix * width] = color;
    }catch(Exception e) {
        return;
    }
}

Any help is appreciated]1

sentences:
How to align the corner of the camera with x= 0, y=0? I need put Main Camera's bottom left corner at starting position 0, 0 (x, y) so all of its coordinates will be positive coordinates.
I thought to put the pivot at the bottom left corner but I don't know if it is possible.
I thought to adjust it manually, but it displays non-positive, non-integers.

I chose the aspect ratio 16:9 but if I choose the 4:3 proportions, it becomes right:

So, what is the best way to align/put the camera at position 0, 0 at bottom left corner?

sentences:
How to efficiently spawn / instantiate a large amount of objects from a prefab I am trying to make a game where the whole world is consists of a very large amount of cubes (sort of a Minecraft / Trove clone), but I keep running into huge performance issues due to the large amount of objects / vertices being rendered at once.

Just to clarify, the problem appears to be caused by the rendering, not the instantiation. I think so based on the fact that when I look away from the cubes, the frame rate will return back to normal (>60).

Is there any way to optimize this? Many answers to similar questions suggest disabling colliders, but that does not really seem to make much of a difference for me. I have also tried making the prefab static, but the problem still remains.

Currently I keep getting ~40 FPS with 10000 cubes (just the built-in cube shape stored as a static prefab with a disabled collider). I believe there should be a way to have a larger amount of objects on screen without having such a performance drop.

Does Unity have any way of storing information about a prefab in graphics card memory that would allow it to mass-render its instances in a more performance-efficient way (much like modern OpenGL uses vertex buffers)?

sentences:
Finding break in voxel grid (3D array) I am working at dynamic voxel engine in Unity (something like Space Engineers) where player can create object from voxels, push them, damage and split in to other object.

I store all data in 3D array, 1 mean voxel, 0 mean empty node.

So I looking for solution to break object (array). For example when I remove enough voxels object should split in to two.

00000000            00000    0000
01110110   ====>    01110    0110
01110110            01110    0110
00000000            00000    0000

In 2D example it should split like that.

I try to use BFS search but it not fast enough ;(. It works fine for small grids like 5x5x5, when I creat 5x5x50 grid it works few seconds before break arrays.

My algorithm:
1) First find empty node
2) When you find empty node start BFS from that node, collect all not empty nodes, when you cant find not empty node finish.

If break exist it will collect only one part of array so it find break, if there is no break it will return whole array.

The problem is speed of it ;/ How to make it faster?

sentences:
Where does Unity save Inspector properties for objects in a scene? If I add a collection of objects to my scene and configure Inspector properties on those objects (like name, layer, tag, transform parameters, attached Components and their parameters), where does the information about those Inspector properties get saved within my project?

Is it all saved within the scene's .unity file or are there other files I should look at?

sentences:
Action-oriented AI: evasion-algorithm takes much time Evasion, the process of evading, is the opposite of chasing. Instead of trying to decrease the distance to the target we try to maximize it.

It takes much time while evading multiple objects simultaneously. I use BFS here. To make it faster what algorithms should I use?

sentences: How can I make orange/lemon skin normal map? What would be the easiest way to make a bump map of the dimples on a citrus fruit such as an orange or lemon in gimp/photoshop without using pictures of it? e.g:

sentences:
Unity Placing a UI on top of Cinemachine I have cinemachine set up. I just need to place the UI on top of it. I can easily manage to make the canvas appear when there's only the main camera alone. However with Cinemachine, it appears that the virtual camera prevents the loading screen to be seen. The canvas in my hierarchy is named loadingPanel which is disabled until I trigger an event. Everything in the hierarchy has their layers set to Default, except canvas (UI) and the player (Player)
I can trigger the event and set loadingPanel to active as well as load the next level but I can't see the loading screen. I could only see my tilemap/level before I switch to the next scene. I need to see my canvas / user interface.
This is my hierarchy

Inspector

How do I see the loadingPanel when cinemachine is present?

sentences:
Resolution problems when porting a Unity game to Android So, I'm porting a game to the Android for the first time in Unity3D. And I've run in to a few problems along the way. My current problem is the resolution doesn't seem to be right, it cuts off the edges of the screen and my scrolling stops for scrolling the screen left/right are no longer in the right place.

After doing a bit of research, a lot of people say you need to make your game Resolution Independent to be able to run on all Androids/Iphone/Ipad. Is this true? If so, how do I go about doing that? If not, how can I help fix the resolution so when I port to mobile devices it looks right?

EDIT:
I still don't really have what I need, resolutions still aren't working properly even with the code and tricks listed below. I need some way for the resolution to adjust based on the device. For some reason when I try to retrieve the resolution of a device using Mungoid's code it returns 0x0

sentences:
"SetSelectedGameobject" only highlights button on second try (Unity 2017.3) To support the use of a gamepad in the options menu I set SetSelectedGameObject and firstSelectedGameObject (which doesn't seem to do anything) to the button in the upper left, so it's highlighted. This works fine in my pause and option menus (panels that are enabled/disabled) but there's also a third panel that displays the controls as an image. On this screen the first button is set as selected but it doesn't get highlighted until I go back to the pause menu and then open the "controls" screen again.

The Hierarchy:

The ControlsPanel looks like this: click

All 4 buttons are set to "automatic" and they're all accessible to the gamepad but, like I said, the first one ("Keyboard") doesn't light up the very first time I access the panel. It should be like this:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is highlighted
Pressing right on the gamepad highlights the next button ("Controller")

What actually happens:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is still grey
Pressing right on the gamepad highlights the next button ("Controller")
Press the "Back" button ("ControlsPanel" is disabled and "PausePanel" enabled)
Click on "Controls" again
This time the "Keyboard" button is highlighted

The "ControlsPanel" script:

public Image pic;
public GameObject controllerChoicePanel;
public GameObject firstControls;
private String controls;
private bool windows;

void Start() {
    controls = GetControls();
    windows = GetOS();
    pic.sprite = Resources.Load<Sprite>(controls);

    if(windows) {
        controllerChoicePanel.SetActive(true);
        EventSystem es = EventSystem.current;
        es.firstSelectedGameObject = firstControls;
        es.SetSelectedGameObject(firstControls);
    }
}

Any idea why it would work fine in my pause/options menu but not in the "Controls" one, even though I'm doing the same thing?

sentences:
Procedural Breakout level generation I am currently developing a Breakout game for a school project, and I've decided to use it as an opportunity to get started with procedural content generation. I took a quick look at some of the basic procedural stuff, but I wanted to know if there is a known good method to generate levels for this kind of game (block patterns, "power up" distribution, etc).
Any articles or ideas are greatly appreciated.

sentences:
10% idle time in WebGL I'm using requestAnimationFrame to handle my frame rate in a WebGL game, and running through the Chrome profile shows that a solid 10% of the time is spent in (idle).  Why is that?  How can I reduce this time, that, unless I'm misunderstanding, is just wasted?

I'm using raw WebGL. Here's part of my rendering code:

Animator.prototype.tick = function() {
  window.requestAnimationFrame(util.bind(this.tick, this));
  if (this.paused) return;
  this.advanceWorld();
  this.drawScene();
};

Full code at: https://github.com/nickgeorge/quantum/blob/master/animator.js

sentences:
How to start with more complex games? I'm a new game developer and I have already finished Pong, Breakout and Snake. I want to start with strategy games, where do I read up on that? What ideas should I wrap my head around?
I like games like civilization, master of Orion, etc.

Edit: I use objective-c and cocos2d. My question is more general and broad, for example how would one start with such games, e.g. I want to make a very simplified civ game.
I have a tile map, one town and one attack unit. Town gives me x money every turn, i can build more units in town.
How do I store said town, units?
Do i use classes for them?
Where does my combat function go? In units, or in separate entity? Do I use inheritance for digferent units, how do I handle makinf more units in towns? How so I implement turn-based turn? Some sort of state machines?
General read about those topics would be nice.

sentences:
How are UDP packets verified as authentic? Hey I'm writing a game and have the backend written using a sometimes-reliable UDP scheme. I want to verify that inbound packets are actually originating from the player specified in the packets.

My idea (not original by any means) was to have the player register an account once and then, once per "session", login over HTTPS/SSL by sending username+password to a simple web service. The game client would check validity of my site's SSL certificate to disallow impersonation. The username and password are submitted and the response is a generated random "secret session key".

Matchmaking happens blah blah...

Then, when playing a match/game, the game client sends packets using UDP and attaches a HMAC-SHA1 of the packet payload using the secret session key as secret. I don't care if people can see the contents of the packet -- there's nothing secret there -- so symmetric encryption isn't needed.

I don't see how the packets can be spoofed since the secret session key was transmitted to the game client over a secure channel but I don't know what I don't know, you know?

Thanks for any insights.

sentences:
Retrieving shared video memory using SharpDX I am trying to retrieve the total available video memory using SharpDX via DXGI, using the Description of the best available adapter.

The DedicatedVideoMemory is correct (1GB in my case), but the SharedSystemMemory value is wrong - and in fact is a negative number (-1073549312, in case that's of interest). The correct value should be 3072MB, as reported by my system information and when running the Microsoft VideoMemory_2012 example application (which also queries DXGI).

Any ideas what might be going on? Or is there another way to get this information using SharpDX? I need to scale some textures according to the available resources, and I need to know the shared component as well as the dedicated.

sentences:
Why is this animation jerky? I am trying to create a simple game on android but I am unsure the best way to do the game loop.  Looking at the LunarLander sample the game loop just loops like a variable time step loop (elapsed = now-lastupdate).  I tried using this method to draw a circle that grows in size to a max radius then shrinks to a min radius and repeats.  However, when I run the program the growing stage is very choppy and slow (it takes longer than it should to get to max radius).

My Code:

    public void updateSize(double elapsed) {
        if (mGrowing == true && mRadius > mMaxRadius) {
            mGrowing = false;
        }
        if (mGrowing == false && mRadius < mMinRadius) {
            mGrowing = true;
        }

        if (mGrowing == true) {
            mRadius += mDRadius * elapsed;
        } else {
            mRadius -= mDRadius * elapsed;
        }
    }

mDRadius is the number of pixel the radius should change per second and elapsed is the number of seconds that has passed.

I tried putting in a sleep of 2ms and 5ms in my game loop and I get the same result.

I converted my loop to a fixed time step (only run physics update if now-lastupdate > TIME_STEP) and the animation was a lot smoother.

UPDATE: I change the sleep to 15ms and it's a lot smoother.  Every other example I've seen of an android game does not have a sleep in the main loop.  Is this because my sample is just so simple that it takes virtually no time to update and all other examples just have a longer update time or am I missing something?

sentences:
Create entity from template in component-based engine For my project I would like to use a component-based entities in C++. My current implementation is split to these parts:

Systems - Contain a map of components of certain class and operate on these. For example PhysicsSystem has a vector of PhysicsComponents.
Components - A component contains some public variables and a maybe a constructor to initialize them.
Entities - An entity for me is just an Id. It is however not stored anywhere, instead only its components are stored in systems in map (where key is entityId and value is pointer to the component).

My problem is creating instances of different objects in my game. I would like to define objects in XML (could be any text file format). For performance reasons this file should be parsed only once when the program is run.

That means I should create some template from it in my ObjectFactory and associate it with a name. Then I would simply call factory.CreateObject("Player") to add new entity to the game.

I am not really sure how to implement this without too much overhead code. Another concern is, that the I don't want my factory to know about the systems themselves. But because my components are stored in the systems and not an Entity object, I will need to use some messaging system to pass new components to their appropriate system.

My question is, how would I implement the object spawning with template for each object type? And how do some engines describe their objects with configuration files?

sentences:
Alpha Blending: use the pixel with the smallest alpha I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other pixel(s).

Turn this:

Into this:

In pseudocode, something along the lines of…

if ( newPixel.alpha < currentPixelInFrameBuffer.alpha )
    currentPixelInFrameBuffer = newPixel;

I can't seem to find if there is a native alpha blending command that will do this. There exists DstAlpha, which is an alpha blending property that compares against the current fragment's frame buffer source alpha value, but I obviously cannot use that in the following manner…

AlphaTest Less DstAlpha

I've found there's a BlendOp Min, which is supposed to "Use the smaller of source and destination." but I can't seem to get that to work and I can't find documentation on what it means by 'smaller'.

sentences:
Is there a way to check if a Texture2D has unapplied changes? In Unity, we can use the Apply() function of Texture2D to apply any changes that we've made with SetPixel() or SetPixels().
Is there a way to check whether the texture currently has any unapplied changes? I don't see any relevant properties like IsDirty or HasUnappliedChanges, but perhaps there's a less obvious way to check.
My particular use case is that I have a texture which is normally only used for calculations and does not need to be displayed on the screen, so it's normally not necessary to call Apply() after changing the texture. However, I'd like to be able to preview the texture in the Inspector when a particular component is selected, which does require that the texture is Applied. I'm wondering if Texture2D has a built-in way to check for unapplied changes; if not, it won't be difficult to write custom code for tracking this.

sentences:
Blender exported model has reduced quality in Unity when normals applied I know this topic comes up a lot in forums, however I have spent the last 2 hours googling it and can not find a solution for my specific problem...

I have exported this model from Blender, but when I import the model into Unity with normals set to "none" it appears as it does in Blender (see left image).

However, when I try to select import or calculate normals, it distorts the character mesh making it look less detailed and less human like (see right image).

I have tried messing with normals settings in Blender, tried changing quality settings etc. in Unity but I can not get it to look 1:1 with normals applied (obviously it needs lighting and shadows so I need it to have normals).

If anyone can provide assistance to fix this or a work around, I would really appreciate it a lot!

sentences:
How can I create scenes programmatically from a deployed build in Unity? This is somewhat of an extension to this question.

I have a client who would like to create an entire game only using XML files. This is how the process should go like:

Build and run a "GameCreator" project.
Read an XML file that has the attributes of all the scenes.
Create new scenes, fill it with new GameObjects, and load some prefabs.
Deploy this new project as a standalone build.

All of the above should not use the Unity Editor. Is that possible?

I used Unity to create a framework, and now the client wants to use this framework to generate more games without using the Unity Editor, only through XML files.

I know that one can read XML files with Unity, but how can one create a scene, fill it with GameObjects, and load prefabs all using a standalone build, not the editor? Is there any other way to do what I've described?

sentences:
When I start running, it won't stop when I let go of shift. Why? Following is my code, and after I let go of shift the image speed goes back to normal but not the variable I created called movespeed. What should I add or change to fix it?

//Run with left shift
if (keyboard_check(vk_lshift))
{
     movespeed = 5;
     image_speed = 0.14;
}

sentences:
Getting the edge-cells in a list of cells on a 2d grid, and knowing which neighbor is missing I create a "circle" on my 2d-grid using this code:
public List<Cell> GetSurroundingCellsCircle(Coord originCoord, int distance)
{
    List<Cell> matches = new List<Cell>();
    int EX = distance + coord.x;
    int EY = distance + coord.z;
    int SQ = distance * distance;

    for (int x = coord.x - distance; x <= EX; x++)
    {
        for (int z = coord.z - distance; z <= EY; z++)
        {
            int c = x - coord.x;
            int d = z - coord.z;

            if ((c * c + d * d) < SQ)
            {
                Cell cell = GetCell(new Coord(x, z));
                if (cell != null)
                    matches.Add(cell);
            }
        }
    }

    return matches;
}

This code works fine and returns a list of cells that together create a circle-shape. Now I want to get all the edge-cells of this circle, and not only that, but I also need to know which side of the edge-cell that has no neighbor, so I know where to draw the line. I want a result that looks like this red line:

I wrote this code that would work for a square (it just finds the max/min of X/Z and draws a sphere there, but as you can see in my image, its missing the "rounding" cells:

int maxX = 0, maxZ = 0, minX = 0, minZ = 0;

        for (int i = 0; i < cells.Count; i++)
        {
            int cX = cells[i].coord.x;
            int cZ = cells[i].coord.z;

            if (i == 0)
            {
                minX = cX;
                minZ = cZ;
            }
            else
            {
                if (cX < minX)
                    minX = cX;

                if (cZ < minZ)
                    minZ = cZ;
            }

            if (cX > maxX)
                maxX = cX;

            if (cZ > maxZ)
                maxZ = cZ;
        }

        for (int i = 0; i < cells.Count; i++)
        {
            int cX = cells[i].coord.x;
            int cZ = cells[i].coord.z;

            if (cX == maxX || cZ == maxZ || cX == minX || cZ == minZ)
            {
                Gizmos.DrawSphere(
                    new Vector3((cells[i].coord.x * GridBase.WORLD_CELL_SIZE) + GridBase.WORLD_CELL_OFFSET,
                    1,
                    (cells[i].coord.z * GridBase.WORLD_CELL_SIZE) + GridBase.WORLD_CELL_OFFSET),
                    1);
            }
        }

sentences:
The largest vector in an array I'm working on a game engine in C# at the moment and I've come across a matter I find confusing. I need to know how to get the maximum three component vector in an array.

There is a method in OpenTK that can compare two Vector3s to find out the max, I need this on a larger scale.

I've tried using Array.Max(), but I get the error :

  At least one object must implement IComparable

sentences:
Rendering multiple squares fast? so I'm doing my first steps with openGL development on android and I'm kinda stuck at some serious performance issues...

What I'm trying to do is render a whole grid of single colored squares on to the screen and I'm getting framerates of ~7FPS. The squares are 9px in size right now with one pixel border in between, so I get a few thousand of them.
I have a class "Square" and the Renderer iterates over all Squares every frame and calls the draw() method of each (just the iteration is fast enough, with no openGL code the whole thing runs smootlhy at 60FPS). Right now the draw() method looks like this:

// Prepare the square coordinate data
GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
                                GLES20.GL_FLOAT, false,
                                vertexStride, vertexBuffer);

// Set color for drawing the square
GLES20.glUniform4fv(mColorHandle, 1, color, 0);

// Draw the square
GLES20.glDrawElements(GLES20.GL_TRIANGLES, drawOrder.length,
                        GLES20.GL_UNSIGNED_SHORT, drawListBuffer);

So its actually only 3 openGL calls. Everything else (loading shaders, filling buffers, getting appropriate handles, etc.) is done in the Constructor and things like the Program and the handles are also static attributes.
What am I missing here, why is it rendering so slow?
I've also tried loading the buffer data into VBOs, but this is actually slower... Maybe I did something wrong though.

Any help greatly appreciated! :)

sentences:
How does flocking algorithm work? I read and understand the basic of flocking algorithm. Basically, we need to have 3 behaviors:
1. Cohesion
2. Separation
3. Alignment

From my understanding, it's like a state machine. Every time we do an update (then draw), we check all the constraints on both three behaviors. And each behavior returns a Vector3 which is the "correct" orientation that an object should transform to. So my initial idea was

        /// <summary>
        /// Objects stick together
        /// </summary>
        /// <returns></returns>
        private Vector3 Cohesion() {
            Vector3 result = new Vector3(0.0f, 0.0f, 0.0f);
            return result;
        }

        /// <summary>
        /// Object align
        /// </summary>
        /// <returns></returns>
        private Vector3 Align() {
            Vector3 result = new Vector3(0.0f, 0.0f, 0.0f);
            return result;
        }

        /// <summary>
        /// Object separates from each others
        /// </summary>
        /// <returns></returns>
        private Vector3 Separate() {
            Vector3 result = new Vector3(0.0f, 0.0f, 0.0f);
            return result;
        }

Then I search online for pseudocode but many of them involve velocity and acceleration plus other stuffs. This part confused me. In my game, all objects move at constant speed, and they have one leader. So can anyone share me an idea how to start on implement this flocking algorithm? Also, did I understand it correctly? (I'm using XNA 4.0)

sentences:
Predicting enemy position in order to have an object lead its target In my 2D game I have AI turrets that should assist the player by automatically firing towards enemies. I would like to make them fire intelligently and lead their target instead of just targeting an enemy's current position. So, given the (always constant) velocity and position vector of both the enemy and the turret's projectile, how can I find a vector that represents the actual position the turret must target in order for the projectile to intersect (and hit) the enemy?

Any links to articles that describe the math, algorithms, etc. would be appreciated!

sentences:
Combine rotation XZ (horizontal) with YZ (vertical). Math formula I'm trying to make a rotation vertically and horizontally around a point at the same time but I'm not able to combine both.

I have this formula for the horizontal rotation:

camera.position.x = x * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - x * Math.sin(inc)

And this one for the vertical:

camera.position.y = y * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - y * Math.sin(inc)

I guess I need to use a Matrix, but not sure how. Here an example with Three.js:
https://codepen.io/josema/pen/xyQoga

sentences:
Keeping track of moving sprites in 2D grid I'm working on a 2D tower defence game in C++.

The game world consists of a grid of Cells, that are managed by a Map:

Essentially the map is:

[cell][cell][cell][cell][cell]
[cell][cell][cell][cell][cell]
[cell][cell][cell][cell][cell]
[cell][cell][cell][cell][cell]

And mobs are moving across the map.

Map class:

class Map{
     //...
     std::vector<std::vector<Cell>> cells;
     std::unordered_set<Cell*> cellsContainingMobs;
     void addCellContainingMob(Cell* c);
     Cell* getCellFromPos(const glm::vec2& pos);

}

Cell class:

class Cell{
     //...
     std::deque<Mob*> mobsInCell;
     void addMob(Mob* m);
     void clearMobs();
}

Mobs are a moving sprites that "walk" around the map and are managed by another class.

My goal is to at every game loop/frame, I know which cells contains mobs (Map::cellsContainingMobs), and for each of those cells, I know which mobs are in the cell (Cell::mobsInCell).

My current method for keeping track of this, is on each game loop iteration (frame) I do the following:

Clear my containers:

for (Cell* c : cellsContainingMobs){
    c->clearMobs(); //calls clear on the std::deque
 }
 cellsContainingMobs.clear();

Iterate over active mobs in the scene

Find out which cell the mob is in (this is inexpensive, as the truncated coordinates of the Mob's position is the indices of the Cell in Map::cells.
Add the Cell to the Map::cellsContainingMobs. Since this is an std::unordered_set if the same Cell is added multiple times, it will only keep one.
Add the Mob to the Cell it is currently at.

part of code:

for (Mob* m : activeMobs) {
    Cell* c = map->getCellFromPos(m->getPos());
    map->addCellContainingMobs(c);
    c->addMob(m);
}

I use std::unordered_set for Map::cellsContainingMobs to prevent keeping the same items multiple times. For Cell::mobsInCell I could probably use std::vector instead of std::deque, but I think the reason was that I don't need random access.

The reason I want to keep track of which Cells contains Mobs, and which Mobs are in which Cells, is to later make it more efficient to check for collision with Tower that shoots bullets. (I only check for collisions on the Cells that have mobs and are in the range of the tower).

My question is; should I use different type of containers for what I'm doing? Is there a completely different approach for keeping track of where my Mobs are located, that could be more efficient?

sentences:
2D Hitboxing on an HTML image I want to make a turn-based game where the player is given "opportunities for attack." An image of the in-game sprite character appears when it's the player's turn to attack. The player can mouseover the various parts of the image, which will highlight that specific body part, like so:

The player can then choose to attack that given body part.

To do this, I was thinking of adopting the "grid" method, and put my image within a 2D array... with each region of the body mapped to a certain square, like so:

Or, I could generate a pixelated version of the in-game sprite within a grid to begin with, so I would already have the mappings, like so:

Minecraft Pixel Art

I'm not sure:

how to partition the image up so that each section is represented meaningfully in the matrix
if this is the right way of doing this

Any guidance would be helpful

sentences:
How can I obtain the file size of a Unity build at runtime? I'm wondering if it is possible to obtain the filesize of a game's build at runtime.
Searching this topic only yields results for reducing the build size, which is not at all what I'm looking for.

sentences:
Libgdx OrthographicCamera culling problem with zooming When I set zoom on an orthographic camera to anything above 1 I get a strange black border on the bottom of the screen.

I suspect that this might be some sort of culling problem. I use a viewport to control the game resolution, and no matter the size the borders are there.

The camera is set on a direction (-1,-1,-1) basicaly isometric. Also it is positioned well above to origin at (1113,1113,-1113). Far plane at 7777 near at 0.00001f. The ground plane is at 0,0,0 laying in the xz axis, with an other plane on top of it sligtly off to the left and with a 45 degrees on its axis to face the camera.

Here is an image of the problem:

Posting code wont really help here since I only use defaults almost everywhere, but if you need it just tell.

sentences:
Adding Log4Net to Unity I would like to add log4net library as a logging tool to visual studio project which created by Unity, Is this possible?

I dragged the log4net DLL to assembly references in Visual Studio. so the DLL added to the project, but when I want to import it in code with using log4net, it doesn't find the library!

sentences: Load Unity game launch options from file I have a need to disable the resolution dialogue when the game launches, but have a config file that will have all of the dialogue options (resolution, quality, monitor (monitor is most important, because none of the solutions to change the active monitor after launch have worked out with a decent result)). Is there a way for a unity game to load options from a file instead of the resolution dialogue?

sentences:
Add a placeholder text to the TextField This is my TextField:

EditorGUILayout.TextField("Placeholder Text", textfield, GUILayout.Height(35));

How can I add a placeholder text in my textfield that will be removed when I want to type in the field?

sentences:
How to attach a sprite to a TMXTiledMap at a particular coordinate, in AndEngine? I am trying to add a sprite at a "grid" location on the tiled map. The TMX tiled Map is like a grid, and you can access the size of the grid by calling mTMXtiledMap.getTileRows() and mTMXtiledMap.getTileColumns().

I want to add an object at grid location, say (2, 5). My tileMap is of size (10,10).

How can I do that? There is no function like mTMXTiledMap.addChild(int x, int y, Entity mEntity).

I would appreciate any suggestions!

sentences:
Issues calculating frame independent movement I'm developing a Breakout style game in C++ using SDL. The problem so far is that the ball slows down and speeds up for no particular reason.

The slowdowns usually last a few seconds.

EDIT : When running fullscreen I noticed that the ball movement seems to be a tiny bit jerky as well. This leads me to believe that the timing should be more finely granulated. But at the same time, it shouldn't be necessary to have µs precision...

Here is my code for calculation the movement of the ball :

double deltaMovement = tick * speed;

rect.x += static_cast<int> ( deltaMovement * dirX );
rect.y += stnecessearyatic_cast<int> ( deltaMovement * dirY );

I tried changing it to help prevent float to in truncation, but this affects the speed to much, making the ball move only move horizontally or vertically ( which never happens with the above code. )

double movementX = ( deltaMovement * dirX );
double movementY = ( deltaMovement * dirY );

movementX += ( movementX > 0.0f )? 0.5f: -0.5f;
movementY += ( movementY > 0.0f )? 0.5f: -0.5f;

rect.x += static_cast<int> ( movementX );
rect.y += static_cast<int> ( movementX );

rect is an SDL_Rect and holds the ball's position. dirX and dirY are double and holds the direction of the ball, the values range from -1.0 to 1.0

I'm not sure if the issue is with the float to int conversion. I guess it could also be something with SDL internally, but I am quite sure SDL should be capable of smooth animation.

    Here's my main game loop ( I have removed some irrelevant parts of it )
    while ( !quit )
    {
        while ( SDL_PollEvent( &event ) )
        {
            // Handle input, move paddle, check if user pressed esc
            // Yes I have a means of escaping the outer while loop.
        }
        double delta = timer.GetDelta( );

    // Update the ball, check for collisions with wall/paddle/tiles
    UpdateBalls( delta );

    // Redraws everything
    UpdateGUI();
}

I'm quite sure the issue is not with my delta time, since it's fairly consistant at 1 - 4 msec. And even if it did change a lot, it shouldn't matter. But just in case, here's the code I use for calculating delta time :

double Timer::GetDelta( )
{
    timespec tmCurrent;
    clock_gettime( CLOCK_MONOTONIC_RAW, &tmCurrent);

    // Get current time in nanoseconds
    unsigned long long deltaCurrent = static_cast< unsigned long long > ( tm.tv_sec * 1000000000 + tm.tv_nsec );

    // Get diff. Delta is an unsigned long long that holds previous tick ( see below)
    unsigned long long diff = deltaCurrent - delta;

    // Convert into ms and assign to a double
    double deltaMSec = static_cast< float > ( diff / 1000000.0f );

    // Reset delta so that it can be used the next time delta is calculated
    delta = deltaCurrent;

    return deltaMSec;
}

What am I doing wrong?

sentences:
What's the right/standard way of achieving separation of concerns? Some background:

I want to start developing games, and taking some of the advice given in this site, I've started with something simple and familiar, such as pong, tetris, etc. I want to take as much time as needed to make sure that I have the basics right before moving on to something bigger. I have medium programming experience but I realize making games is a different thing.

I find myself wondering many things like should this be in a separate class? Should this module handle this stuff or is it better to let other modules have that kind of functionality? For example, the bouncing of a ball in pong, right now is handled in the ball module, but maybe it's better that some other module did it.

Right now I have different modules: one for the graphics, one for the game logic, and others for the objects (depending on the kind of movement required, not all the objects are alike).
I know I am asking a lot, any tips you have will be very much appreciated.

Short question:

What's the right or standard way of separating the modules? What have you found most effective? Is it enough to just keep the drawing (graphics) and the logic separate? Is it necessary to have a lot of classes? (for example for the objects in the game, to handle the movement, etc)

sentences: Google Web Toolkit: Ever used for making games? I've recently come across GWT (Google Web Toolkit) and have been amazed by it. I was wondering if anyone has ever put it to use making a video game? And if they did, what their experience was, whether it was worth it and whether the game was any good.

sentences: Implementing an efficient method of server-side checking I'm making a web-based action RPG game. I don't want players to cheat, but I also don't want the game to constantly pause to wait for the server to respond. I made it so the game is played on the client-side (for responsiveness) and the server does routine checking to validate the game state. But the system is very cumbersome. The server has to calculate every single frame and compare the entire game state to the game state sent from the client. If anything in the game states are different form each other, the server kicks the player off. However, this means the game has to send 30 requests a second, and the server must calculate it all in time. If many people are playing the game, I don't think my one free Heroku dyno can handle that. How do I implement an efficient and elegant way of validating players' moves on the server side?

sentences:
player movements aren't working python #from pygame.locals import
import pygame
import math
from time import sleep
import display_world

# class Player(pygame.sprite.Sprite):
class Player():
    x = 10
    y = 500
    speed = 10

    # stores if the player is jumping
    isjump = 0

    # force(v) up and mass m.
    v = 8
    m = 2

    def moveRight(self):
        self.x = self.x + self.speed
        # moving right

    def moveLeft(self):
        self.x = self.x - self.speed
            #moving left

    def jump(self):
        self.isjump = 1

    # Jumping
    def update(self):
        if self.isjump:
            # Calculate force(F).
            if self.v > 0:
                F = (0.5 * self.m * (self.v*self.v))
            else: F = -(0.5 * self.m * (self.v*self.v))

        # Change position
            self.y = self.y + self.y

        # Change velocity
            self.v = self.v - 1

        # If ground is reached
        if self.y >= 500:
            self.y = 500
            self.isjump = 0
            self.v = 8

class App:
    windowWidth = 800
    windowHeight = 600
    player = 0

    def __init(self):
        self._running = True
        self._display_surf = None
        self.image_surf = None
        self.player = ()

    def on_init(self):
        pygame.init()
        self.display_surf = pygame.display.set_mode((self.windowWidth, self. windowHeight), pygame.HWSURFACE)

        pygame.display.set_caption('MY FIRST GAME')
        self.running = True
        self._image_surf = pygame.image.load('small_mario.png').convert()

    def on_event(self, event):
        if event.type == QUIT:
            self._running = False

    def on_loop(self):
        pass

    def on_render(self):
        self._display_surf.fill((0,0,0))
        self._display_surf.blit(self._image_surf, (self.x, self.y))
        self.player.updatepygame.display.flip()
        sleep(0.03)

    def on_cleanup(self):
        pygame.quit()

    def on_execute(self):
        if self.on_init() == False:
            self._running = False

        while(self._running):
            pygame.event.pump()
            keys = pygame.key.get_pressed()

            if (keys[K_RIGHT]):
                self.player.moveRight()

            if (keys[K_LEFT]):
                self.player.moveRight

            if (keys[K_UP]):
                self.player.jump()

            if (keys[K_ESCAPE]):
                self._running = False

            self.on_loop()
            self.on_render()
        self.on_cleanup()

sentences:
What is the difference between graphics filters in Adventure Game Studio? Adventure Game Studio supports following graphics filters:

max nearest-neighbour filter and 2x-8x nearest-neighbour filter
2x-8x anti-aliasing filter

What graphics filter offers the best image quality? What is the difference between "nearest-neighbour filter" and "anti-aliasing filter"?

sentences:
How can i scale a cube on one side on x only? I have in the Hierarchy a empty GameObject and a cube as child of it.
The cube the child is at position 0,0,0 and scale 1,1,1

But when running the game the scaling is on both sides of the cube.
I put the cube as child of the empty gameobject and scaling the empty gameobject but still it's scaling the cube on both sides.

The script is attached to the empty GameObject:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
    Vector3 originalScale;
    Vector3 destinationScale;

    void Start()
    {
        originalScale = transform.localScale;
        destinationScale = new Vector3(100.0f, 0, 0);
    }

    private void Update()
    {
        if (transform.localScale.x != 100.0f)
            transform.localScale += new Vector3(1, 0, 0);
    }
}

This is a working solution:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
    public Transform[] objectstoScale;

    private void Update()
    {
        if (objectstoScale[0].localScale.x != 100.0f)
        {
            objectstoScale[0].localScale += new Vector3(1, 0, 0);
        }
    }
}

But i want to make that the same cube will also scale one side on the z. So the cube will be scaled on both x and z but without filling it one be like frames. So i tried this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Walls : MonoBehaviour
{
    public Transform[] objectstoScale;

    private void Update()
    {
        if (objectstoScale[0].localScale.x != 100.0f)
        {
            objectstoScale[0].localScale += new Vector3(1, 0, 0);
            objectstoScale[1].localScale += new Vector3(0, 0, 1);
        }
    }
}

And i have now two cubes childs of the empty gameobject one cube position is 0.5,0,0 the second is 0,0,0.5 but what i'm getting is:

What i want to do is to create automatic a rectangle scaling a cube on 4 sides at the same time not filled rectangle.

For example like this:

sentences:
How do I calculate collision response between a sphere and a plane? I'm trying to create a simple 3D game and need to constrain the player within the limits of the game world. When the player hits the sides of the world I want the player's ship to bounce off slightly.

In effect I'm trying to trap the player within a box, and stop them from escaping through the sides...

I've managed to define the limits of the gameworld as a collection of planes, with normals and distances from the origin. The player has a spherical bounding sphere and from following this website http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php I have managed to detect collisions.

I now can't quite work out what to do when a collision is detected. The best I can manage is the player getting stuck in the plane, going straight through it, or bouncing repeatedly off it at a really fast rate.

Common sense tells me I need to calculate the reflected angle off the plane, using its normal and apply that to the player's velocity, however I think I need to first see if the player has gone through the plane which is the bit I can't work out.

sentences:
Unity 2d Animation from spritesheet: How can I move the character according to the animation? I am trying to implement an attack animation that should end up in moving the player by some distance.
The animation would be something like this:

As you can see the position of the player should be different by the end of the animation, but I am not sure how to make it so. I tried to use root motion, however even if in the animator component i set "Apply root motion" to true, when I click on the animation itself, there is no option to use root motion, perhaps is it due to the fact that the animation is obtained from a spritesheet and not from a rigging software like Spine or DragonBones?
Anyway, is there another way to update, either by scripting or throught the animation window, the character's position after the animation?

sentences:
How do you use these kind of rpg ground tileset ? Searching about some tilesets for a little RPG game, I've often found these kind of tileset :

Their structure are special, there is two upper tile and 4 others for the same material. I understand that, like that, you have all what you need to create more various shapes than simple rectangles of different sizes. But I don't get how they are used in practice. I'm talking about the two little upper tiles that are used to make some corners. for me the 4 corners are stored inside only one tile ?  (hard to explain with my bad english but I'm sure you understand what I mean)

Also, do you know if that tilemapping technic has a name ? And do you kown if it is possible to use them directly in Tiled ?

sentences:
Black or White Border/Shadow around PNGs in SDL/OPENGL having the same issue as this: Why do my sprites have a dark shadow/line/frame surrounding the texture?
however, when I do the fix suggested there (changing GL_SRC_ALPHA to GL_ONE) it just replaces the black border with a white border on the images. was able to find a lot of results on google from people finding black borders and fixing it with the GL_ONE change, but no results for white borders.
any ideas?

heres some of my relevant code.

init:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glAlphaFunc(GL_GREATER, 0.01);
glEnable(GL_ALPHA_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

when each texture is loaded:

glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, surface->w, surface->h, GL_BGRA, GL_UNSIGNED_BYTE, surface->pixels);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

thanks!

sentences:
How can I deactivate and activate a button? I have a code that keeps a gameObject between scenes, the theme is that this gameObjecte has as a child a button, which I can change the linerenderer color, besides changing the image of the button according to the selected color and thus keep the data between scenes. then when I change to the next scene I deactivate the button with the meteodo "dehabilitar()"  and in the others it is not necessary, then when I change to the next scene I deactivate the button and it is not shown, but when I go back to the next scene and call the function " habilitar() "the button is not displayed. If someone can help me in what I have bad in the code or what I lack?

PS: I did different methods to activate and deactivate the button but the same thing always happens and I leave it like that for a while.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namesp

ace DigitalRubyShared
    {
        public class CambioColor : MonoBehaviour
        {

            public Button mybutton;
            public LineRenderer p1;
            public LineRenderer p2;
            public Sprite colorRojo;
            Color Rojo = new Color(1, 0, 0, 1);
            public Sprite colorAzul;
            Color Azul = new Color(0, 0, 1, 1);
            public static int counter = 0;

            public static bool estado = false;

            public static CambioColor estadoCambioColor;

            void Awake()
            {
                if (estadoCambioColor == null)
                {
                    estadoCambioColor = this;
                    DontDestroyOnLoad(gameObject);
                }
                else if (estadoCambioColor != this)
                {
                    Destroy(gameObject);
                }

            }

            void Start()
            {
                mybutton = GetComponent<Button>();
                p1 = GetComponent<LineRenderer>();
                p2 = GetComponent<LineRenderer>();

                counter = 2;
            }

            public void changeColor()
            {

                counter++;

                if (counter == 1)
                {
                    mybutton.image.overrideSprite = colorAzul;
                    //mybutton.image.sprite = colorAzul;
                    p1.startColor = Azul;
                    p1.endColor = Azul;
                    p2.startColor = Azul;
                    p2.endColor = Azul;

                }
                if (counter == 2)
                {
                    mybutton.image.overrideSprite = colorRojo;
                    //mybutton.image.sprite = colorRojo;
                    p1.startColor = Rojo;
                    p1.endColor = Rojo;
                    p2.startColor = Rojo;
                    p2.endColor = Rojo;

                    counter = 0;
                }

            }

            public void dehabilitar()
            {
                if (estado == false)
                {
//mybutton.enabled = estado;
                    mybutton.gameObject.SetActive(estado);
estado = true;
                }
            }

            public void habilitar()
            {
                if(estado == true)
                {
//mybutton.enabled = estado;
                    mybutton.gameObject.SetActive(estado);
                    estado = false;
                }

            }

            // Update is called once per frame
            void Update()
            {

            }
        }

    }

sentences:
Why does my Java game loop randomly jump to 62 FPS and crash? I've been working on a Java game, but I couldn't keep it from stuttering. I did some research, and found out that I was using a bad game loop. I've been working on a new game loop, which works a little better, but my framerate often jumps from 60 FPS to 62 FPS, and sometimes even crashes. This is the loop I'm using;

import java.applet.Applet;
import java.awt.Color;
import java.awt.Frame;

@SuppressWarnings("serial")
public class GameLoop extends Applet implements Runnable {

    final int FRAMERATE = 60;

    @Override
    public void init() {
        setSize(1280, 720);
        setBackground(Color.WHITE);
        setFocusable(true);
        Frame frame = (Frame) this.getParent().getParent();
        frame.setTitle("Game Loop");
    }

    @Override
    public void start() {
        Thread thread = new Thread(this);
        thread.start();
    }

    @Override
    public void stop() {

    }

    @Override
    public void destroy() {

    }

    @Override
    public void run() {
        int framerate = 0;
        long counter = 0;

        long lastTime = System.nanoTime();
        long frameTime = 1000000000 / FRAMERATE;

        while (true) {
            long currentTime = System.nanoTime();
            long updateTime = currentTime - lastTime;
            lastTime = currentTime;

            counter += updateTime;
            framerate++;

            if (counter >= 1000000000) {
                System.out.println(framerate + " fps");
                counter = 0;
                framerate = 0;
            }

            try {
                Thread.sleep((frameTime * 2 - updateTime) / 1000000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}

I've walked it through a couple of times, but I can't find out what's wrong. This is the console output I get;

60 fps
60 fps
60 fps
60 fps
62 fps
60 fps
62 fps
60 fps
60 fps
60 fps
...
Exception in thread "Thread-3" java.lang.IllegalArgumentException: timeout value is negative
    at java.lang.Thread.sleep(Native Method)
    at GameLoop.run(GameLoop.java:58)
    at java.lang.Thread.run(Unknown Source)

As far as I can understand, the loop crashes because Thread.sleep((frameTime * 2 - updateTime) / 1000000); has a negative input, but I don't know why it is negative.

I've added;

if (updateTime < 0)
    updateTime = 0;

After;

long currentTime = System.nanoTime();
long updateTime = currentTime - lastTime;
lastTime = currentTime;

To prevent getting a negative input, but the problem still occurs. Also, I've tried to implement the loop into my game, but it's even laggier than before. The player seems to be shaking back and forth while moving.

Could anyone tell me what I'm doing wrong and how I can fix this?

sentences:
How to use default framebuffer's depth/stencil when rendering to a texture? Is it possible to use the default framebuffer depth buffer when rendering to a texture (instead of using a depth texture)?

The Idea is to continue to render part of the scene normally but on a separate texture so I can later apply a post-processing effect without having to incur the cost of having another stencil/depth buffer. Ho can I do that?

sentences:
How can I load a large tile map with cocos2d? I am try to design a cocos2d game with a big world. The world's tile map is very big, maybe 20 iPad screen sizes worth of tiles.

I want to know how to load this using a CCTMXTiledMap? If I directly add it to screen, will it use too much memory? If so, is there a solution to solve this problem?

sentences:
How can I position framebuffer objects on the screen in OpenGL? I currently have two framebuffers which are drawn using

glBlitFramebuffer(0, 0, 1920, 1080, 0, 0, 1920, 1080,
    GL_COLOR_BUFFER_BIT, GL_NEAREST);

But the texture does not take up the whole screen, and I would like to position it at a certain x,y on the screen. The images by default start from 0,0 and then span the width/height provided, however I would like the image to start at say, [100, 100] and span the width/height provided.

How would I do this?

sentences:
Non-perfect maze generation algorithm I want to generate a maze with the following properties:

The maze is non-perfect. Means it has loops and multiple ways to reach the exit.
The maze should be random. The algorithm should output different mazes for different input parameters
The maze doesn't have to be braided. Means dead-ends are allowed and appreciated.

I just can't find the right resources on google. The closest i found was this description of the different types of algorithms: http://www.astrolog.org/labyrnth/algrithm.htm. All other algorithms were for perfect mazes.

Can anyone give me a website where i can look this up or maybe an algorithm directly?

sentences:
Draw a line along one continuous edge of a curved mesh I have a rectangular mesh, but the mesh is curved:

I want to draw a line along one side of this curvy mesh.

Currently I can easily draw line along a side of a flat rectangular mesh by getting the mesh's min and max bounds. But what should I do to draw a curved line along the border of mesh from one of its side edges.?

sentences:
2D orbital mechanics I'm working on a 2D game which involves firing projectiles around a solar system and having the path of the projectile change based on the gravitational pull of solar bodies.

I've been trying to find an explanation for how orbital mechanics work, at least in this simplified 2D scenario, but so far haven't found anything other than theoretical high-math documents.

I know that there are some existing games that do this already in 3D space, namely Planetary Annihilation and Interplanetary, but I haven't been able to find any references to how they did it. The Planetary Annihilation devs did a livestream demo of it once, but I haven't been able to find it since, and I don't think it went into much detail.

Whether by explanation or reference, does anyone know how 2D orbital mechanics work for the purpose of a game? How or where can I learn this?

sentences:
What is wrong with my Respawn coroutine? I am creating a 2D Platformer game in which if the player falls off the base/ground then I want the player to respawn at the nearest checkpoint. However I want there to be a delay between the player falling off the ground and the respawn. This is the section of my code to achieve this goal:

private void OnTriggerEnter2D(Collider2D collision)
{
    Debug.Log(collision.tag);
    if (collision.tag.Equals("Kill"))
    {
        StartCoroutine("Respawn");
    }
    else if(collision.tag.Equals("Checkpoint"))
    {

        Animator flag = collision.GetComponent<Animator>();
        if (!flag.GetBool("hasCrossed"))
        {
            flagCounter++;
            flag.SetBool("hasCrossed", true);
            checkpoint = collision.gameObject.transform.position;
        }
    }
}

IEnumerator Respawn()
{
    yield return new WaitForSeconds(respawnDelay);
    transform.position = checkpoint;

}

This works fine for small respawn delays like 1 or 2 seconds. But on increasing the delay to 5 seconds, the player after appearing at the nearest checkpoint vanishes off in an instant and then after quite a few repetitions the player reappears.

This is for the 2 second time delay

This is for the 5 second time delay

How can I fix this?

sentences:
in Unity3d, how to automatically create fixed joints in a wall of cubes? I want to create a wall:
width  6 cubes
height 7 cubes

therefore I have 22 cubes on the margins and 20 cubes inside. For each of the margins cubes(except the corners) I have to set 3 fixed joints, and for the cubes inside the wall I have to set 4 fixed joints - all this to have good physics behavior.

Pretty much I have to create a fixed joint between a cube and all his neighbors => and that's a lot!
Is there a way to automatically create these fixed joints?

Is there another way to create a physics friendly wall? I want to simulate a wall of bricks hited by a projectile.

sentences:
Missing Reference exception when accessing a GameObject in Unity I have been making a C# script that attacks the player in Unity. However, with the following code I got the following error message:

  "The object of type 'GameObject' has been destroyed but you are still trying to access it.

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class attackPlayer : MonoBehaviour {

    GameObject Enemy;
    GameObject Player;

    void Start ()
    {
        Enemy =  GameObject.FindWithTag ("Enemy");
        Player = GameObject.FindWithTag ("Player");
    }

    void Update ()
    {
        var heading = Enemy.transform.position.x - Player.transform.position.x;
        if (heading > 0.0f && heading < 5.0f)
        {
            Explode ();
        }
    }

    void Explode()
    {
        var exp = GetComponent <ParticleSystem>();
        exp.Play ();

        Destroy (gameObject,exp.main.duration);
        Destroy(Player);
    }

    void OnCollisionEnter2D (Collision2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            Explode ();
        }
    }
}

sentences:
pick up material from another object is it possible to obtain a material from another object?
I'm trying everything and nothing, the only thing I could get was just the color of another object
public MeshRenderer takematerial;
public GameObject[] Objects;
for (int i = 0; i < Objects.Length; i++) {
    Objects [i].GetComponent<Renderer> ().material = takematerial.material;
}

sentences:
How can I optimise a Minecraft-esque voxel world? I found Minecraft's marvelous large worlds extremely slow to navigate, even with a quad core and meaty graphics card.

I assume Minecraft's slowness comes from:

Java, as spatial partitioning and memory management are faster in native C++.
Weak world partitioning.

I could be wrong on both assumptions. However, this got me thinking about the best way to manage large voxel worlds. As it is a true 3D world, where a block can exist in any part of the world, it is basically a big 3D array [x][y][z], where each block in the world has a type (i.e BlockType.Empty = 0, BlockType.Dirt = 1, etc.)

I assume that to make this sort of world perform well, you would need to:

Use a tree of some variety (oct/kd/bsp) to split all the cubes out; it seems like an oct/kd would be the better option, as you can just partition on a per cube level not a per triangle level.
Use some algorithm to work out which blocks can currently be seen, as blocks closer to the user could obfuscate the blocks behind, making it pointless to render them.
Keep the block object themselves lightweight, so it is quick to add and remove them from the trees.

I guess there is no right answer to this, but I would be interested to see peoples' opinions on the subject.  How would you improve performance in a large voxel-based world?

sentences:
How can I make the player stop at the collision point and not before? I am making a Java platform game (I have created many top-down games, but nothing with gravity like a platformer) and I have implemented terminalVelocity, etc.

My problem is that, say when the player is falling at a rate of 8 pixels, I check collision for the player 8 pixels ahead before it moves, and if there is a collision the player does not move. But, say that there are 4 pixels until a block but the player is moving at 8 pixels, the collision detection stops the player because 8 pixels ahead there is a block, but the player hovers because there is a 4 pixel gap.

How would I make the player fall those extra 4 pixels?

sentences:
How to return the scene view camera to the default view By the "scene view camera" I don't mean a GameObject with a Camera component, I mean the camera used to draw the Scene window in the Unity editor, controlled by this "Scene Gizmo" widget:

The default view shows an almost isometric perspective, where all three X Y Z axes are visible.
But when I clicked the green Y cone, my view changed to look straight down the Y axis, and I can't seem to return to the 3-axis view.
Clicking the other cones on this widget just switchest to look along the X or Z axis instead, and clicking the cube in the middle or the "Top" label just toggles between orthographic and perspective projection.
How can I get back to the default 3-axis view?

sentences:
Best way to go with 3D dungeon crawler generation I'm trying to prototype a little 3D dungeon crawler. That is, the same system as any rogue-like : A map with little rooms, linked by hallways.

But in 3D. The world is still in blocks, but I can go up and down. This game is a nice exemple of what I want. I still want the world to be mostly flat (for exemple every room could be at the same height) but I need some little up-and-downs in the rooms, or the hallways between them.

I already tried 2D dungeon generation with no precise algorithm (just by myself) but I think this time it would be best to have some nice algorithm and a good workflow about it.

So I need help about this :

A nice 3D generation
What data structures should I use to store my levels ?
How should I then create it ? I'm on Unity, and for now I am associating an enum to prefabs for each type of map blocks, and then I instantiate every case. Is it a good way of doing this ?

sentences:
Strategy game tile and unit storage I've recently started working on a turn based strategy game much like games from the Fire Emblem or Final Fantasy Tactics series. However, I'm running into a few problems concerning the storage of the tile data and unit data. For example, just like in Fire Emblem I want to show all possible movement when you click on one of the units. Here is an image showing what I mean.

In this image the possible fields to move to have been indicated with a blue color. Fields that are in range for an attack have been indicated with the red color. Normally the tile the enemy unit is on would be in range to move to, however since there is someone standing on the tile the game has recognized that you can't move there.

I understand the need for an algorithm like Breadth-First Traversal to find out all possible fields to move to, but I'm unsure how to exclude fields occupied by an enemy. In order to avoid circular dependencies between fields and units I only store a reference to field in the unit class and not the other way around. So when I work my way through the fields to check all possible moves, how do I best find out if that field is actually valid?

I could of course just loop through the list of all enemies for each field that I process to see if it's occupied. Another way to potentially solve it would be to loop through the list of possible fields and removing fields occupied by enemies from that list, but I think that wouldn't work properly because occupied fields can also have the effect that empty fields around them are no longer reachable (due to the enemy blocking access to them). The easiest way to solve it would be to also store a reference to the unit within the field class. This would of course introduce a circular dependency.

I feel like there should be a much better solution than the ones I can think of, but I just can't figure it out.

Thanks in advance!

sentences: Can you embed a Unity3d mobile project into an existing native mobile app? I am creating an application for both Android and iPhone that will have a few mini games in it. I would like to create the non game section in native Android and iPhone. My question is, is it possible to have a native app that will incorporate the Unity mini game I am creating all inside one apk and ios project?

sentences:
SpriteBatch.Begin() causes everyting else to be drawn incorrectly I just added this:

_spriteBatch.Begin();
_spriteBatch.End();

to my app and was greatly confused by the fact that this causes pretty much everything else (all of my 3D objects, that is) to be drawn incorrectly. After the code above has executed, no Z-buffering seems to take place, but instead objects are just drawn in the exace same order as I send them to the scene - with the last object drawn being fully visible even while it is located behing other objects. It also screwes up the sampler state for my textures (which I can fix by setting a new SamplerState for the device).

What is going on and how do I fix it?

sentences:
Switching to a vertex shader TL;DR I need to switch from a vertex array passed to the pixel shader with a real vertex shader approach.

In my prototype, the terrain is procedurally generated and I have the following result:

The terrain vertices are passed directly to the pixel shader through an array:

//Number of vertices in terrain array
static const int verticesCount = 20;

//The vertices array, in pixel coordinates
float2 terrain[verticesCount];

//A fixed distance between neighbor vertices
float fixedDistance;

float4 PixelShaderFunction(float2 pixelCoords : VPOS,
                           float2 textureCoords :TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, textureCoords);
    int i = pixelCoords.x / fixedDistance;
    float delta = (pixelCoords.x - terrain[i].x)/(terrain[i+1].x - terrain[i].x);
    if(smoothInterpolate(terrain[i].y, terrain[i+1].y, delta) >= pixelCoords.y)
    {
        color.rgba = 0;
    }
    return color;
}

As you can see I just interpolate between the vertices and mask the texture to the terrain.

Now I need a different approach because I'm using a view matrix for the camera and it does not affect these vertices that do not go through the vertex shader, how can I replace the terrain array with a vertex shader to get a similar result?

All suggestions are welcome!

sentences:
How to calculate directional light frustum from camera frustum I'm playing around with OpenGL for a few weeks now.

For the following screenshot I picked the glm::ortho values for my lightsource by trial and error. There are two directional light sources with shadows.

I would like to calculate the values for glm::ortho by creating a bounding box around the camera frustum.

I have the corners of the camera frustum in world space ... what is the next step?
I think I should move the camera frustum into light space, calculate the bound box and put the dimensions of that bounding box into glm::ortho. But ... how? :)

The block below is a simplified version of my code with only one light source.

// Camera
mat4 cameraViewMatrix = lookAt(
    vec3(1.2f, 1.2f, 1.2f),
    vec3(0.0f, 0.0f, 0.0f),
    vec3(0.0f, 0.0f, 1.0f)
);

mat4 cameraProjectionMatrix = perspective(45.0f, 800.0f / 600.0f, 0.5f, 10.0f);

// Light
mat4 lightViewMatrix = lookAt(
    vec3(3.0f, -2.0f, 2.0f),
    vec3(0.0f, 0.0f, 0.0f),
    vec3(0.0f, 0.0f, 1.0f)
);

// Camera Frustum
vector<vec4> cubeNDC;
cubeNDC.push_back(vec4(-1.0f, -1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, -1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, -1.0f, 1.0f, 1.0f));
cubeNDC.push_back(vec4(-1.0f, -1.0f, 1.0f, 1.0f));
cubeNDC.push_back(vec4(-1.0f, 1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, 1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, 1.0f, 1.0f, 1.0f));
cubeNDC.push_back(vec4(-1.0f, 1.0f, 1.0f, 1.0f));

mat4 viewProjectionMatrixInverse = inverse(matProj * matView);

vector <vec4> cameraFrustum;
for(vec4 vertex: cubeNDC) {
    vec4 vertexTransformed = viewProjectionMatrixInverse * vertex;
    vertexTransformed /= vertexTransformed.w;
    cameraFrustum.push_back(vertexTransformed);
}

// Magic

mat4 lightProjectionMatrix = ortho(...);

Thanx for your help. :)

sentences:
should users be asked to submit high score to leaderboard? If a user gets a new high score in a game, should they be asked before having their score submitted to the leaderboard?  Originally I was just going to submit their score to the leaderboard without prompting them, but a friend told me that it is preferred that the user be asked.

thanks

sentences:
Improve the algorithm A *? Hello, I have a question about algorithm A * !

S : Start.

D : Destination.

W : Wall.

My hero goes from S and the destination is D, W is the walls, my hero can't go in there. If I use the algorithm A *, the hero will go from Cell (3,3) then to Cell (2,2) and finally to Cell (1,1).

It would be very logical if my hero is only a point. But my hero is about the same size of a Cell. So if my hero goes from Cell (2,2) to Cell (1,1), he will be hit by two walls. Each cell is 32 * 32 in size, my hero moves pixels by pixel, so he can collide with the edge of a cell. I have a collision test function, and thus the hero cannot move on.

Can someone help me, thank everyone !

sentences:
How can I calculate spotlight lighting in Vertex/Fragment shader in Unity? I've written a vertex/fragment shader for my game. It uses 3 textures and represents a floating water on the wall (so I have 1 texture for water, 1 for geometry and the last one is mask) so it looks like this:

But I also need a spot light attached to the camera to lit my geometry, and this is the single dynamic light source on the stage.

Well, I can use a surface shader to take dynamic lighting into attention, but I want to avoid using them because: it will be much larger and its execution will be much slower. Besides, I need only one dynamic light source, so I can (can I?) just calculate its lighting in the shader, and pass a position/direction to the shader using material.SetVector(). It is something like:

float4 frag(FragmentInput i) : COLOR0
{
    float4 col = i.col * tex2D(_Texture, i.uv);
    col.a = tex2D(_AlphaMask, i.uv).r / 2;

    if(col.a > 0.25f) // it's water, just return the scrolled texture color
    {
        float4 l1 = tex2D(_WaterTexture, float2(i.uv.x, i.uv.y - _Time.y / 16));
        float4 l2 = tex2D(_WaterTexture, float2(i.uv.x, i.uv.y - _Time.y / 8));
        return float4((l1 * l2).rgb, 0.5f);
    }
    else // it's geometry calculate spot light lighting
    {
        float lit = // ... calculations here ...
        return col * lit;
    }
}

Is it possible to do this? Will it work faster than the surface shader?

sentences:
How to pause audio playback when a breakpoint is hit or resume afterward? When my code hits a breakpoint, audio that was previously started (via an AudioSource) continues to play while the threads are paused.
I'm using a coroutine to query the status of the AudioSource, and update my UI. Because the audio continues to play, then after I've spend some time stepping through code the next frame tick when Unity gets control back runs the next iteration of this coroutine, which updates the UI. I never get to see the in-between states.
Because it's a relativley short audio clip it's usually finished playing before I've finished stepping through the code.
I'm using Unity 2018.4 with VSCode and the Debugger for Unity extension, if that helps.
I'm quite lost at what to try here. Looking for issues with Unity's AudioSource and breakpoints yields a lot of varied information about audio issues in general in Unity.
I've tried using Debug.Break(). It pauses the Unity editor, which can be useful but has the following caveats:

it requires extra effort on each breakpoint that requires enabling (if the call is not there already)
it requires manual intervention to resume the editor once you've finished stepping through code
because it is code, it cannot be added after Unity is playing, e.g. to additional breakpoints that are added once debugging has started

Does Unity have a mechanism that enables this behaviour that I've just missed? If not, what's an appropriate alternative approach?

sentences: Is there a way of moving the transform of an object relative to it's geometry I have a number of objects (mostly prefabs) that have their transform origin in inconvienient places such as about 1 unit to the left of the actual geometry or somewhere inside an object where it's hard to see. Is there any way to move these transforms without actually moving the object itself? This is in 3D.

sentences: What game engine should I use to mock around? I'm a software engineer student (about to start my 2nd year) and I did really enjoy last years object-oriented programming and working with Java (greenfoot and later eclipse) to make simple games. I would really like to delve deeper in to software development and can't wait for 2nd year of college to start ,so I mocked a bit in eclipse and boy writing all of the game engine is hard and takes a lot of time, so maybe anyone knows an easy game engine just to mock around and explore game development for fun ?

sentences:
Game mechanic player following path looks very roughly I want my player entity to follow a path, which works, but it looks very roughly. Like it would stuck everytime.

    bool arrivedX = false;
    bool arrivedY = false;

    float speed = 0.06f;

    if(bestway.empty()) {
        //arrived
    } else {

        if(entity->x < bestway.front()->x * gridSize) {
            entity->x += speed * machine->getDeltaTime();
        } else if(entity->x > bestway.front()->x * gridSize) {
            entity->x -= speed * machine->getDeltaTime();
        } else {
            arrivedX = true;
        }

        if(entity->y < bestway.front()->y * gridSize) {
            entity->y += speed * machine->getDeltaTime();
        } else if(entity->y > bestway.front()->y * gridSize) {
            entity->y -= speed * machine->getDeltaTime();
        } else {
            arrivedY = true;
        }

        if(arrivedX && arrivedY) {
            bestway.pop_front();
        }
    }

the vector contains grid coords from 0 to WIDTH or HEIGHT / gridSize. And the entity has pixels coords. I have tried already:

entity->x / gridSize < bestway.front()->x

which runs smoothly, but when it goes up or right it will omit one grid tile. I think it is because of when the player is at pixel 19 and the gridSize is 20 it would calculate 0 . 19/20 = 0... I tried to ceil and floor it, but it didn't work out.
Hope you guys can help me.

edit:

        int ix = int( x + 0.5f );
        int iy = int( y + 0.5f );

        if(ix < bestway.front()->x * gridSize) {
            x += speed * machine->getDeltaTime();
        } else if(ix > bestway.front()->x * gridSize) {
            x -= speed * machine->getDeltaTime();
        } else {
            arrivedX = true;
        }

Video

http://youtu.be/-DugHbMdODg

sentences:
what is the most popular mmorpg game that has an out-of-game api? World of Warcraft is off the table, because of the "WOW Glider Lawsuit" of 2008. Also see: Where is Blizzards official World of Warcraft API? Eve Online has an API

But, what is the MOST popular (in terms of usership) MMO Game that does allow programmers to develop out-of-game things (like an Android app).

sentences:
Anti-Aliasing Problem So, I was annoyed by how the HUD for my GameState was very pixel-ated and I wanted to change that through the use of anti-aliasing. However, it works with a small exception:

It adds all these lines to the HUD, which is not what I want at all, is there a way to prevent this from occurring?

Here's what it looked like before anti-aliasing:

Also, here's the code:

    public void render(GameContainer container, StateBasedGame game, Graphics graphics) throws SlickException {
    graphics.setAntiAlias(true);
    renderOverlayGui(graphics);
    renderGui(graphics);
    graphics.setAntiAlias(false);
    renderIcons(graphics);
}

private void renderIcons (Graphics graphics) {
    graphics.drawImage(imgHeart, this.radius - 4, 1);
    graphics.drawImage(imgCoolDown, this.radius - 4, 18);
}

private void renderGui (Graphics graphics) {
    graphics.setColor(GameColour.brown);
    graphics.fill(guiCircle);
    graphics.fill(guiBox);
}

private void renderOverlayGui (Graphics graphics) {
    graphics.setColor(Color.black);
    graphics.fill(guiOverlayCircle);
    graphics.fill(guiOverlayBox);
}

sentences:
How can I fix sprite vibrating randomly which is moving towards the mouse while using camera.position set to the sprite as the center? So, when I use

camera.position.x = player.x;
camera.position.y = player.y;

to set the center of camera to my sprite, the code doesn't work as intended to. It's slightly hard to explain so i made this video(https://youtu.be/afCamx_wB_4) in which I show how it should work and the difference/problem when using camera.position

The code related to this is:

function setup() {
  createCanvas(displayWidth,displayHeight);
  level = new Level;
  player = createSprite(100,100,10,10);
  edge = createEdgeSprites();
  player.speed = 5;
}

function draw() {
  background(255);
  level.play();
  player.rotation = Math.atan2(mouseY-player.y, mouseX-player.x) * 180/PI;
  drawSprites();
}

player.collide(edge); //this part is from level.play()
var run = mouseX - player.x;
var rise = mouseY - player.y;
var length = sqrt((rise*rise) + (run*run));
var unitX = run / length;
var unitY = rise / length;
player.x += unitX * player.speed;
player.y += unitY * player.speed;

Also if you notice, when using camera.position, the vibration happens at specific distance of the sprite from the mouse, and the patter is that the distance is 0 right at the center of the canvas and keeps increasing as you move away from the center.

sentences:
Rotate an object smoothly on the Y axis in Unity I am attempting a simple script to swing a door open in Unity.  This requires a smooth rotation of 90 degrees around the Y axis.  I have seen that one way to do this is using Unity's Quanternion object.  I believed that this should work:

public class DoorOpenScript : MonoBehaviour
{

    public float smooth = 20;

    // Use this for initialization
    void Start ()
    {
        SwingOpen ();
    }

    // Update is called once per frame
    void Update ()
    {

    }

    void SwingOpen()
    {
        Quaternion newRotation = new Quaternion(transform.rotation.x,transform.rotation.y,transform.rotation.z,transform.rotation.w);;
        newRotation *= Quaternion.Euler(0, 90, 0); // this add a 90 degrees Y rotation
        transform.rotation= Quaternion.Slerp(transform.rotation, newRotation,20 * Time.deltaTime);

    }

}

However, this just opens the door completely. I have tried playing with the third parameter to Slerp but with no results. What am I doing incorrectly?

sentences:
Rorschach ink blot (aka Psychology test pictures) shader (source: bonnefil.com)

I want this magnificent pattern to be in my game. So far I have figured out...

Draw one side, then render it twice left and right.
How do I render this pattern on one side? hmm...
I need help.

I need some insight on writing shader for this.

If you think is not shader fitting task, then let me know, hopefully with an alternative solution!

However I see no possible approach to achieve this without gpu. (unless you suggest to store bunch of prepared pictures of rorscach pic)

sentences:
Character stuck on box collider 2.5D I'm having trouble with my character on a 2.5D platformer. The character get stuck if it collides without reaching the platform's top. Here is a gif showing it: http://i.imgur.com/jmZ6O1K.gifv

Both colliders (platform and character) has a physics material with no friction (or minimum). So I don't know why is this happening.

Character Collider

Physic Material

sentences:
What is the correct way to draw layered Sprites in modern OpenGL? So what do I mean by layered sprites? Layered Sprites are Sprites that consist of multiple layers, e.g. you have sprite sheets for the basic Body, the Head, Clothes, Weapons, etc.

Well now I wanted to know how you would draw this in the most efficient way; right now the idea is to use vertex buffer objects (VBOs), but I heard that it is expensive to change the textures in a VBO...

So what would be the correct way to draw them? My idea right now would be to draw the Map tiles first (with a texture atlas), then I would draw all the basic bodys, then the heads, then clothes, and then the weapons. Would that be the best way or is there a more efficient way?

I also thought of using vertex arrays instead of VBOs, but as far as I know they are deprecated...

sentences:
unity 3d loading data from json problem i am trying to practice on loading data from json files my problem is about when i try to load the sprite path from the json file to load the image icon from the floder that contain it, i manged to do that but by hard code the path but when i try to use variable to hold the path its failed to load any one can help me in that please

i post the code here

public class InventoryItemDataBase : MonoBehaviour
{
    public allitemData itemsData = new allitemData();
    // Start is called before the first frame update
void Start()
{

    TextAsset asset = Resources.Load("ItemData/ItemDataBase") as TextAsset;
    itemsData = JsonUtility.FromJson<allitemData>(asset.text);

}
public ItemBase itembyid(int id)
{
    for (int i = 0; i < itemsData.ItemBase.Count; i++)
    {
        if (itemsData.ItemBase[i].id == id)
            return itemsData.ItemBase[i];
    }
    return null;
}
}

[System.Serializable]
public class allitemData
{
    public List<ItemBase> ItemBase = new List<ItemBase>();
}

[System.Serializable]
public class ItemBase
{
    public int id, Value;
    public string name, description;
    public static string path;
    public static Sprite Icon = Resources.Load<Sprite>(path);
    public Sprite sprite = Icon;
public ItemBase()
{
    this.id = -1;
}
}

&& json Data

{
  "ItemBase": [
    {
      "id": "0",
      "Value": "7",
      "name": "Teddy Bear",
      "description": "Teddy",
      "path": "IconS/Teddy/"
    },
    {
      "id": "1",
      "Value": "5",
      "name": "UFO",
      "description": "ufoos"
    }]
}

sentences:
Why when using Linerenderer it's drawing a line also in scene view? I want to draw lines using the Linerenderer only in the game view window.

I'm using Debug.DrawLine but only drawing Red lines but for some reason when the Linerenderer draw a line/s one of the Linerender lines is yellow it seems the green linerenderer is getting on the red one in the scene view window.

 Debug.DrawLine(Input.mousePosition, hit.transform.position, Color.red);

Is there a way to avoid it ? So Debug.DrawLine will draw only in sceneview and the Linerenderer will draw only in the game view window ?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateObjects : MonoBehaviour
{
    public GameObject[] objectsToRotate;
    public float speed = 0.1f;
    public Vector3 spinDirection;
    public bool useMouse = false;
    public bool automaticSpin = false;
    public LineRenderer linerendererPrefab;

    List<LineRenderer> lrs = new List<LineRenderer>();

    // Use this for initialization
    void Start()
    {
        for(int i = 0; i < objectsToRotate.Length; i++)
        {
            var lr = Instantiate(linerendererPrefab);
            lrs.Add(lr);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (objectsToRotate.Length > 0)
        {
            for (int i = 0; i < objectsToRotate.Length; i++)
            {
                var hits = Physics.RaycastAll(Camera.main.ScreenPointToRay(Input.mousePosition), 100.0f);

            for (int x = 0; x < hits.Length; x++)
            {
                RaycastHit hit = hits[x];

                if (hit.collider.name == objectsToRotate[i].name)
                {
                    objectsToRotate[i].transform.Rotate(1, 1, 1);
                    Debug.DrawLine(Input.mousePosition, hit.transform.position, Color.red);
                    SpawnLineGenerator(Input.mousePosition, hit.transform.position, false);
                }
            }

            if(hits.Length == 0)
                SpawnLineGenerator(new Vector3(0,0,0), new Vector3(0,0,0), true);

            if (useMouse == true)
            {
                if (Input.GetMouseButton(0))
                {
                    Rotate(i);
                }
            }
            else
            {
                Rotate(i);
            }
        }
    }

    private void Rotate(int i)
    {
        if (automaticSpin == true)
        {
            objectsToRotate[i].transform.Rotate(1, 1, 1);
        }
    }

    void SpawnLineGenerator(Vector3 start, Vector3 end, bool reset)
    {
        for(int i = 0; i < lrs.Count; i++)
        {
            if (reset)
            {
                lrs[i].SetPosition(0, start);
                lrs[i].SetPosition(1, end);
            }
            else
            {
                lrs[i].SetPosition(0, start);
                lrs[i].SetPosition(1, end);
            }
        }
    }
}

sentences:
Line Intersection from parametric equation I'm sure this question has been asked before. However, I'm trying to connect the dots by translating an equation on paper into an actual function. I thought It would be interesting to ask here instead on the Math sites (since it's going to be used for games anyway ).

Let's say we have our vector equation :

 x = s + Lr;

where x is the resulting vector, s our starting point/vector. L our parameter and r our direction vector.

The ( not sure it's called like this, please correct me ) normal equation is :

x.n = c;

If we substitute our vector equation we get:

(s+Lr).n = c.

We now need to isolate L which results in

L = (c - s.n) / (r.n);

L needs to be 0 < L < 1. Meaning it needs to be between 0 and 1.

My question:
I want to know what L is so if I were to substitute L for both vector equation (or two lines) they should give me the same intersection coordinates. That is if they intersect.

But I can't wrap my head around on how to use this for two lines and find the parameter that fits the intersection point.
Could someone with a simple example show how I could translate this to a function/method?

sentences:
Pathfinding in a 2D "sidescrolling" strategy game I've been thinking up a real-time strategy game that plays on a platformer type of map. The collidable portion of these maps will be made up of square tiles. I've done A* pathfinding in top down tile based games before, but I'm unsure how to lay out my tile map in such a way that allows for easy pathfinding. I've thought up some examples, but I'm not sure if it's the right way to go about it, so I thought I'd throw it out here and see if someone who knows what they're doing can give me some tips.

The first solution I thought of was to use a 2D array storing all of the tiles and empty space, similar to what I would most definitely do in a top down tile based strategy game. The 2D grid would be invisible in the background but really store whether each grid section is empty, or has a tile on it. like this:

In this example I'm unsure as to how I would pathfind up hills, or in that specific example, determine that a wall is too high to cross. Lets say that dude can jump over 1 tile high blocks, but 2 tiles is too much. How would I effectively determine that through a pathfinding algorithm?

The other example I was thinking of was to place pathfinding nodes on top of traversible terrain, like this:

Each node might be able to give directions or commands on how to get to the next (Like the need to jump to cross a gap, or it's faster to go under rather than over, etc). Now I would want to do this logically through code, and not manually place them at design time.

This might be a better solution, but something I'm thinking of in this game is to have destructable terrain. Say an explosion happens and leaves a big hole like this:

Suddenly those nodes I placed earlier won't work. I'd need to remake them on the fly. In this case the 2D grid sounds like the better option since I can just flip the value of that tile from full to empty.

So hopefully those 2 examples made sense, and I'd like some opinions on which might be the best option, or even if there's some other solution I didn't think about I would be glad to hear it! I'm using Unity if that helps.

I just want to get this design choice out of the way early, as it would be a pain to have to tear it apart later.

Thanks!

sentences: Use Ashley with Scene2d in libGDX? I want to use Ashley but I also want to use actions and listeners with Scene2d. I read that it is not a good idea, but why? Ican create a system with stage.act(); and stage.draw(); in the update method or is it a bad idea? Thanks.

sentences:
How to move bezier curve points along circle to form a symmetric curve at center From the image below, A is an open bezier curve with it's points positioned to represent a circle. AP3 and AP1 have the same position.
From B, How can I move the points (AP1 and AP3 along the bigger circle of radius r whiles the CP's reduce in length as CP1 and CP4 also rotate) till they form a symmetric bezier curve at the center of the bigger circle marked as the red curve?

sentences:
How can I make "falling away" 3D terrain like Animal Crossing? Animal Crossing has a unique way of scrolling the world map: When the character moves down, the the world rolls around and over at the top, like it's stuck to a cardboard tube:

This video shows how it moves.

How can I create this effect?

sentences:
GLSL vertex shaders with movements vs vertex off the screen If i have a vertex shader that manage some movements and variations about the position of some vertex in my OpenGL context, OpenGL is smart enough to just run this shader on only the vertex visible on the screen?

This part of the OpenGL programmable pipeline is not clear to me because all the sources are not really really clear about this, they talk about fragments and pixels and I get that, but what about vertex shaders?

If you need a reference i'm reading from this right now and this online book has a couple of examples about this.

sentences:
What could cause a pixel shader to paint outside the lines of the vertex shader output? From what I understand, the pixels that a pixel shader operates on are specified implicitly by the SV_POSITION output (in DirectX) of the vertex shader. What then could cause a pixel shader to render in the middle of nowhere?

I used the new Visual Studio 2012 graphics debugger to visualize my vertex and pixel shader output. This is the output from a DrawIndexed() call that draws a cube:

The pink part is the rendered output of the pixel shader, which takes the cube on its left as its input.

The vertex shader code:

cbuffer Buf { float4x4 final; };

struct In
{
    float4 pos:POSITION;
    float3 norm:NORMAL;
    float2 texuv:TEXCOORD;
};

struct Out
{
    float4 col:COLOR;
    float2 tex:TEXCOORD;
    float4 pos:SV_POSITION;
};

Out main(In input)
{
    Out output;
    output.pos = mul(input.pos, final);
    output.col = float4(1.0f, 0.5f, 0.5f, 1.0f);
    output.tex = input.texuv;

    return output;
}

And the pixel shader:

struct In
{
    float4 col:COLOR;
    float2 tex:TEXCOORD;
    float4 pos:SV_POSITION;
};

float4 main(In input) : SV_TARGET
{
    return input.col;
}

The raster stage is the only thing between the vertex shader and the pixel shader, so my suspicion is that it's some raster stage settings. But the raster stage shouldn't change the shape of the vertex shader output so drastically, should it?

sentences:
Unity3d Pause RigidBody object, don't stop time Time.timeScale = 0 obviously works to stop physics but it's also stoping my Invoke calls. How can I get around this to pause ONLY the game physics?

EDIT

Temporarily I'm using isKinematic = true on all of my rigid body objects via event trigger.

sentences: Can I sell Windows Phone 7 games on the marketplace from India? I am a developer from India working on a game in WP7. I need to know, can I sell my game in Windows phone apps marketplace or is it like Android market where only free/ad-based is allowed?

sentences:
Game State / Screen Management What's the best way to handle game states / screens?  My problem is this:

PlayGameScreen adds a new InventoryGameScreen to the game during it's update.  This immediately adds InventoryGameScreen to the array of GameScreens.  That's throwing an exception when iterating over the array that the contents of the array have changed.

Should I have two more arrays, like screensToBeAdded and screensToBeRemoved and do all the processing for them at the end of the game loop after drawing all the other screens?

sentences:
Combining Many Small Colliders into Larger Ones I am creating a game using a tile-map made of many thousands of grid squares. At the moment, each square has a square collider on it for checking collisions.

However, with many thousands of tiny blocks, checking them all for collisions is inefficient. If I had known the tilemap was going to look like this in advance, I could have just used 3 or 4 big colliders rather than thousands of tiny ones:

Is there some sort of standard algorithm for combining many small adjacent tiles into maximally large ones? If so, could someone describe it here, or point to literature on such algorithms?

Alternatively, maybe pre-processing the tile colliders in this way is completely the wrong approach. If so, what is the correct one to deal with the efficiency of an extremely large number of colliders?

sentences: Why is a baked normal map more efficient to render than additional physical detail? I was just contemplating about why I improve performance by baking additional details into the object rather than just rendering the more detailed model. How does the GPU get to take a shortcut to render potentially the same amount of detail on screen, just because the detail is represented in a different way?

sentences:
web based quizz game database design, how do I store results? I'm building a very basic quizz type of php/mysql/ajax game.

At this stage I'm thinking about the DB design, and specifically how to score results, I've two options in my mind. But cannot decide which one is better (being self taught. mostly by doing things, I have no idea what are best practices or what can be useful or not.)

So, I've 3 tables:

Users -> contains: user_id, user_name, user_pass, user_score
Quizz -> contains: quizz_id, quizz_answer, quizz_question, quizz_value
Results -> this is the one I'm debating. Should I keep user results in a separate table and have it like: result_id, result_user_id, result_quizz_id, result_score
Or simply include results for user inside users table under user_results and save it as array of answered quizz_ids

I'm debating if it is good practice to have separate results table or not. If I've it separately it means 10K users can easily create 10K*100 results rows. On the other hand array in user_results can become to contain 100 keys.

Performance wise, and taking into consideration good practices, which way is better?

Can mysql handle 10K*100 row lookups constantly on the bases of user_ID? Or is it wiser to just explode array from user_results column?

sentences:
Is it possible to develop multiplayer games with HTML5? I know HTML5 is great for web games, but I don't really know if it's possible to develop online games with multiple users, keeping everybody synchronized and handling logins, et cetera.
Is it possible to do this?

sentences:
OpenGL ES on iOS Books I was wondering if someone has read both the:

iPhone 3D Programming

And

OpenGL ES 2.0

books and have an opinion if one is better than the other?

I'm basically wanting to get into doing 3D graphics on iOS including shaders.

sentences:
C++ : Library for creating 3d view picture I've got a numerical simulation, where I have as an output 3d matrix of billion elements - the visualisation of data is 2d flat image:

When I was starting I was just outputting 2d data to gnuplot, now I generate png file in program itself (to cut generation time). I would like now to get a 3d picture (in flat png) from my billion elements 3d matrix - in isotropic view etc. I found on the Internet things like ImLib3d for image processing, but I am afraid it's not what I am looking for.

sentences:
OpenGL 2.0 - Texture animation with 'pixelated' effect I'm looking for a way to reproduce the effect I've tried to sketch in the image below with OpenGL ES 2.0.

The idea is to let a drop of color fall over a cube which get filled with a kind of 'pixelated' effect.

Could you figure out any feasible solution to achieve it?

Thanks for any hint!

DAN

* EDIT WITH SOLUTION *

Achieving good looking results with a procedural texture generated in real-time is quite hard. Here's a few screenshots taken from an implementation based on Nathan's idea, where the mask has been created by hand.
Cheers!

sentences:
How to get smooth movement in a low resolution game? I am using monogame to make a simple platformer with a fairly low resolution.

Right now I am struggling to get smooth movement like in the mario games. In those games despite having the low resolution mario can still slowly accelerate from standing still and the movement looks smooth. How did they achieve this?

My current solution performs all of the game's physics and movement in floats and when it comes to drawing the x and y coordinate of the player it is rounded to an int. This results in very jagged looking movement.

Is there any way to improve this so that the movement is smooth and still has acceleration? I was thinking about scaling up all of my assets by 4 and working at a higher resolution but then the player would be able to walk between pixels (as 1 pixel in the assets would be represented by 4 pixels on the screen).

Any help would be much appreciate.

Here is an awful video of my character's movement:https://www.youtube.com/watch?v=riWk8op2VyY

sentences:
How to fix normal map in unity hey, I'm just using unity, I'm having a problem with the normal map, like the picture above, if I use blender I just need to change the sRGB to non-color data, but when I import it to unity using the fbx format, why is the result like the picture above?  I've been looking for tutorials on YouTube but can't find the results, thank you
https://drive.google.com/file/d/1taEKN33XByWa-eFgzsyOpS3JYOltuYe9/view?usp=sharing

sentences:
From Core Java Graphic Dev To JOGL I've been a java developer for 3 years, and I got one opportunity to explore  JOGL.

Is it a good idea to move into JOGL from being a core java developer  ?

sentences:
Visual Basic PictureBox A description of my game:

When you start the game, you have a few seconds to memorize the arrangement of the grids. By the arrangement, I mean each grid is one of two colors. After the time is up, all the grids are set to the 'off' color. The player must click on the grids to toggle them and put them in their correct color assignments as they were seen before.

Okay so this is part of a game I am developing.Instead of using solid colors, I want use background images but I don't know how to edit the code to do so.
Any help would be welcome.

Dim GridOn As Color = Color.LightBlue
Dim GridOff As Color = Color.DarkBlue
Dim MaxTime As Integer = 40

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    For Each pic As Control In Me.Controls 'For every picture in form1's controls...
        If TypeOf pic Is PictureBox Then   'Then, only picks the pictureboxes, not the buttons, labels, etc.
            AddHandler pic.Click, AddressOf PictureBoxClick 'For each picturebox (grid), add an event handler (PictureBoxClick) to avoid
        End If                                              'typing 16 of them ourselves
    Next
End Sub

    Private Sub PictureBoxClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
    If AllowEdit = True Then
        Dim ctrl As PictureBox = DirectCast(sender, Control)
        If ctrl.BackColor = GridOn Then
            ctrl.BackColor = GridOff 'Set the backcolor to either GridOn or GridOff
        Else : ctrl.BackColor = GridOn
        End If
    Else
        'Do not allow the user to change the colors
    End If
  End Sub

sentences:
Showing a mesh on a Screen Space Overlay I have created a Screen Space Overlay.
This Screen Space Overlay panel hosts 3 Texts. This works fine.

Then I tried to show a mesh on this Screen Space Overlay.

First, I simply added it as a child of the panel.
Since this didn't show it, I added a Canvas Renderer to the mesh.
This also didn't help.

What might be the culprit here?

Thank you!

ps: What I'm trying to achieve is a mesh rotating in front of the user's eyes like this:

This a sequence of what happens in the original scene that I try to rebuild:

One can see that as soon as the item is being inspected, a (very likely a screen space) overlay is shown, and the original scene gets dark.
Also the selected item is shown and is rotated continously.

I imagined that it is a screen-filling screen space overlay which has an image. The upper menu of the image is filled with a color with 50% alpha in order to blend the background out.

I imagined that the weapon was then rendered in front of the screen space overlay image. If it was behind the the screen space overlay, it would be dim / greyed out like the rest of the scene.

That's how I came to think that the weapon was part of the Screen Space Overlay.

I know now that this isn't so because a Mesh Renderer can't be rendered in the UI "pass", but I would anyway like to know how this could be done.

Edit:
Here is a screenshot of an HDRP camera:

sentences:
Rendering part of an equirectangular video on a plane For a Unity project I have a 360 camera which produces an equirectangular video.
I need to realize preview of this video for putting it on a plane.

In most cases the part of the video to be drawn on the plane is the central part of the video, which is not so stretched and so it can be drawn as is. In some cases, instead, the camera has to be put above the scene, upside down, in order to capture the scene below, as shown in the following image.

In this kind of situation I need to produce a preview from the upper part of the video; in other words I need to project a portion of the upper part of the video on a plane.

I imagined two ways, the first one is easy but not so effective, the second one is tricky but surely better.

I project the video on a sphere and capture, with a virtual camera, the interesting part, which is taken and rendered on a plane.
I write an appropriate shader which, given the equirectangular video, crops the portion of it and draws it correctly on a plane.

May you give me a hand on writing the shader?

sentences:
Using USB sound input for an android game - is it possible? We are brainstorming ideas for an app, for a major project using Android Studio, and writing in java. My major is game development, so I intend on trying to build a video game based off the use of an electric guitar, as input.

While I can set up a means to provide input via the audio-in, through the 3.5mm, having USB input would be far more effective.

My main question is: Is it feasible?

To give background, I believe it must be entirely possible, however, I am unsure how difficult the process would be.

I am basing my question off three things.

If I plug my Xbox controller directly into my phone, it automatically works. So the requirement for local support does not work as strictly as I understood it too.
If I plug the Rocksmith cable into a computer, and tell my sound card to "listen" to it, the guitar automatically comes through the speakers as if I was using the computer as an amplifier. This implies that no software is required on the computer side to interpret the input.
If you set up the electric guitar to connect to the computer via the microphone, it is not only compatible with Rocksmith, but it works just as well. This tells me the USB cable does not do anything fancy, in order to interpret the guitar - it must all be software side.

To start me off, all I really need to do is be able to interpret the frequencies. If I run into brick walls, further on, I will simply build around it, or change my games scope.

In terms of accessibility, I do understand the repercussions of requiring the Rocksmith cable to run the game. However, at the moment, simple being able to use the Rocksmith cable allows me to work on the part I am being marked on. If it goes to plan, I can access a more accessible means to use USB, later.

For those that are not familiar with Rocksmith, for the purpose of this question, it is simply a game that includes an electric guitar to USB cable, and is able to assess the player as they play the guitar, by reading its frequencies to determine what notes are being hit.

sentences:
Unity 5: Error when everything is okay(Object reference not set to an instance of an object) i'm getting this error when the collider colides with something:

Object reference not set to an instance of an object

It's referencing to the gamecont.Death(); from this script:

and the death method is on this one:

sentences:
Unity Editor - Call a method from a ScriptableObject from its own custom Editor I have a class like this:

public class NoiseMap : ScriptableObject
{
    public string Hello()
    {
        //...
    }
}

Now I am building its custom editor:

[CustomEditor(typeof(NoiseMap))]
public class NoiseMapEditor : Editor
{

    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        // How to call Hello() ???

        serializedObject.ApplyModifiedProperties();
    }

}

I would like to get the value of the method Hello. How could I achieve this?

sentences: Right way to dispose of a WWW IEnumerator after it has completed - Unity What is the "right" way to dispose of an Ienumerator coroutine after it has completed?

sentences:
How do I communicate with an IronPython component in a C#/XNA game? My XNA game is component-oriented, and has various components for position, physics representation, rendering, etc, all of which extend a base Component class. The player and enemies also have controllers which are currently defined in C#. I'd like to turn them into Python scripts via IronPython (a .NET implementation of Python). My problem is that I'm not sure how to interact with those scripts.

The examples in Embedding IronPython in a C# Application suggest I'd have to create something like a Script component which compiles a Python script and calls the controller's Update method via Python - essentially, it'd be a wrapper class for C# to interface with Python.

I feel that I'm missing something in my research. There must be a way to load up a script, instantiate a Python object (either in the Python script or in C#) and then then have a direct reference to that Python object in my C# code.

Is there a way to work with an IronPython object directly, or is a wrapper required?

sentences:
Unity3d Android - Fixed Resolution How can i set a fixed 720p resolution on any devices using unity3d android?

  unity3d version: 2018.4.5f1

sentences:
How to make simple game from max model Possible Duplicate:
  Are there any video tutorials available for game programming with Max?

Suppose i have model of simple 3d ball made in 3ds max. i just want to make simple game for fun . the scene will have only one ball , which will move with cursor.

I know there may be other tools for game but i just want to know how to export 3ds max model in game

sentences:
MonoGame - Scale Texture2D from 16x16 to 64x64 I need to scale a Texture2D (let's say it's 16x16) to 64x64.

I tried scaling it in the SpriteBatch#Draw method, but it doesn't look like pixel art as soon as it's drawn, more like a lot of anti-aliasing happened.

I chose 64x64 because 16x16 is pretty small, and I thought I could just scale every pixel by 4 (1x1 pixel in 16x16 could be 4x4 pixels in 64x64), basically I don't want MonoGame to anti-alias when I draw the scaled Texture.

Thank you!

sentences:
How do I get the width of a string as it would be displayed on screen? What is the best and easiest way to get the width of a String using Slick2D?

I'm working on the achievement interface menu in my game that displays some images. On each image I need to draw a string such as "Reach Level 5.". Only problem is that I don't know how to get the string width to properly center the string on the image.

sentences:
How can I make my program load music from files? I'm working with a XNA game and I want my program to load music files from libary/music so I can play that music in the game.
It would be great if the mediaplayer class could play a playlist of all the music in library/music.

sentences:
Libgdx/Android/2D RPG game: optimizing time consuming when switching from Map to Map I am completely new in game developing and even more new in the use of Libgdx. So far I have successfully done great thing on my game project thanks to all the advices I could have gathered on this forum. I would need your brilliant help once again.

- Context:

I have several TiledMaps and on each one of them, there is an object layer named “trigger”. This layer contains objects with name corresponding to an animation in my code.
All the animations of this layer are loaded thanks to TextureRegion.split.

- Issue:

When I load a new map or for instance a new floor in a house, the time spent to preload the animations of this new floor is too high. Here are the tests of the time spent to load 3 animations of 4 frames each and dimension 64x64 pixels (corresponding to 16 tiles):

0.7 sec on a Samsung Galaxy S6 (this is far too much for a powerful device and only 3 animations).
1.1 secs on a 4 years old Samsung Galaxy Note2.
2.2 secs on a 4 years old Sony Xperia M (pretty old and powerless though).

Here is the logic of my gamescreen class:

- Possible solutions:

1) Preload all the animations of the game in the OnCreate and loading screen:

Far from being a good idea with my current game architecture. I expect having 300+ animations (with the fighting ones, cutscenes…). With above tests, it would take 3+ minutes on a powerful device as the Samsung Galaxy S6 for instance.

2) Preload new map animations in another Thread when the user is approaching a teleport trigger:

It will be a good idea on device with good double core CPU but I am afraid of a big FPS drop on single core device or not good double core CPU (like double 600Mhz ones).

3) Label a group of animations with a level-flag and preload them only if level flag changes:

For instance: Level1 flag for 2 exteriors which contains 10 interiors (houses for example)

Level2 flag for 1 exterior and 6 interiors.

On that example, it will just require to preload and having a loading screen when we change of level but with the current architecture of my game code, it will still be a lot of time consuming.

If there is 20 animations and 20 fights animation per level it will be still 40 animations which represent about 7-9 sec on Samsung Galaxy S6 without including sounds loading…

4) Refactor all my code and include logic I was not aware of.

I think it is the best option here. I heard of AsseManager for instance but I have no idea how it is working with Animation object.

Thank you all for your help in advance!

sentences:
Best way to do large XNA animations? What's the best way to have large animations in XNA 4.0? I have created a spritesheet with the sprite being 250x400 (more of an image than a sprite but hey ho) and there are approximately 45 frames in the animation. This causes problems for XNA as it says that the maximum filesize for Reach is 2048.

I'd rather not change to hidef as I heard that means that your game is less compatible with some computers and systems so does anyone have any idea what the best thing I could do is? The only thing I could come up with is to have a list of textures to flick through but that's not ideal.

sentences:
Using grids from a different script I suspect there is a very simple answer to this one but I have been scratching my head trying to figure it out for a while.

I have this piece of code that works fine. It effectively adds the location of the children of my GameObject to a grid array.

  public void AddToGrid()
       {
        Transform[,] grid = new Transform[totalGridWidth, totalGridHeight];
        foreach (Transform children in transform)
           {
               int roundedX = Mathf.RoundToInt(children.transform.position.x);
               int roundedY = Mathf.RoundToInt(children.transform.position.y);
               grid[roundedX, roundedY] = children;

           }
       }

However, I need to modify it so that rather than taking the children of the GameObject that runs this script - I need it of the children of a different GameObject.

i.e. this script sits on GameObject A, however I need to change it to grab the position of the children on GameObject B. I don't want to simply add this script also to B as there is other stuff in the script that won't make any sense and I need to keep the array in A.

I suspect (hope) there is an easy answer here, but am struggling to figure it out.
Thanks for the assistance.

sentences:
How can I support multiple player inputs in Pygame? I'm trying to develop a team-based Asteroids game. It's going well except for the "multiple user inputs to a single machine" part. Can anyone recommend a method for getting and updating 6 players using a single computer? Is it even possible? At the moment I'm working with a couple of old XBox controllers and a keyboard and it's almost working...

Is it possible to add additional keyboards? And would you arrange the code into one big get events function or is there a better way to check for user inputs at this scale?

sentences:
Incorrect Normal Matrix In my game engine I'm passing a normal matrix to my shaders like so:

Matrix3f normalMatrix = modelMatrix.invert().transpose();

However this is causing lighting to rotate with my object, producing a weird effect.

As I'm not performing any non-uniform scaling, I tried substituting normalMatrix for mat3(modelMatrix), and that worked fine.

Also doing the transpose inverse on the GPU using transpose(inverse(modelMatrix)) worked fine.

This has lead me to believe there is a bug in my invert() and transpose() functions.

According to some math websites, when the modelMatrix lacks any non-uniform scaling, calling inverse().transpose() on it will produce the exact same matrix.

However in my code the output is far from the same:

modelMatrix

0.25    0      0      2353.3474
0       0.25   0      0
0       0      0.25   51.86973
0       0      0      1

normalMatrix = new Matrix3f(modelMatrix).invert().transpose()

4.0 0.0 0.0
0.0 4.0 0.0
0.0 0.0 4.0

Would anyone be able to shed some light on this issue...
(I don't want to just stick with modelMatrix because I do want to support non-uniform scaling in the future)

Here are some screenshots describing the issue:

These are two frames of my planet as it rotates. The light source appears to be rotating with it (it shouldn't be). Using the modelMatrix instead of normalMatrix solves the issue.

sentences:
How could we use trigonometry for moving around a 3D World? Well I have a question about geometry and 3-Dimensional player movement in general. I'm using Java, OpenGL and LWJGL.

This is basically what I got:

currentFrontSpeed: Is a float that contains the speed of the Player.
player. increasePosition: Just adds the current Position of the Player to the value that is given on the X, Y and Z axis.

//The point we want to go: Forwards(+) Backwards(-). getFrameTimeSeconds
//just adjust the speed depending of the speed of the computer.

float distanceFront = currentFrontSpeed * DisplayManager.getFrameTimeSeconds();

//Distance of Movement
float fx = (float) (distanceFront * Math.sin(Math.toRadians(player.getRotY())));
float fz = (float) (distanceFront * Math.cos(Math.toRadians(player.getRotY())));

//This just increase the position of the player (x,y,z)
player.increasePosition(fx, 0, fz);

Another thing that I didn't explained is that the Player is always looking at the same position as the camera (if the camera turns to the right, the player would also turn to the right. Like Maincraft). That's why I use the Y-Axis to move.

The problem is that my player can only move forwards and backwards (if currentFrontSpeed is positive, my player will move FORWARDS, and if is negative BACKWARDS). And the only form to go to a place that is to the right is to move the Camera to the right and the press UP to go FORWARDS.

I've tried to achieve this doing this:

   //The same as above, the speed of the player this time Right(+) and Left(-)
    float distanceSides = currentSideSpeed * DisplayManager.getFrameTimeSeconds();

    float sx = (float) (distanceSides * Math.cos(Math.toRadians(player.getRotY())));
    float sz = (float) (distanceSides * Math.sin(Math.toRadians(player.getRotY())));

    //I just add the "horizontal" speed to the "vertical" one
    player.increasePosition(fx + sx, 0, fz + sz);

Of course this doesn't work good: if the player Y-rotation is 0, the player moves to the right and to the left perfectly; but for example, if the player rotation is 90 (looking at the right from the original position), moving up or moving to the right would take us to the same position (because is the "right" from the original position with the Y-axis 0).

I don't know if I should use another trigonometric function or add the sx and the sz to another value in the X, Y and Z axis.

EDITED

I've just edited and gived some information because of the bad explaining I did. Also this is one of my first long-writed post.

Thanks for helping!

sentences: How to add text box in slick2d? I wanted to let the player rename the character of my game. So I thought that making a text box and when he clicks the ok button, the text inside the text box will make it to a string and render it on the screen. How do I let the user type their own text?

sentences:
Coroutine to move to position passing the movement speed? I'm using this coroutine to move my player to a new position. The problem is that it takes the duration as an argument instead of the speed of the object. Which makes it hard for me to make sure the object always moves at the same speed.

How can I create a coroutine that takes the source position, target position and movement speed to move my character?

This is my current code:

IEnumerator MoveObject(Vector3 source, Vector3 target, float duration)
{
    float startTime = Time.time;
    while(Time.time < startTime + duration)
    {
        player.transform.position = Vector3.Lerp(source, target, (Time.time - startTime) / overTime);
        yield return null;
    }
    player.transform.position = target;
}

sentences:
Vector class throwing an error after publishing the FLA for generating .ipa from flash CS5 I am creating a flash game for iPhone using Flash CS5. Everything runs smoothly when creating the SWF via Ctrl+Enter. But when I am attaching the .p12 and provisioning profile files and publish the FLA to generate the .ipa there is an error thrown by the compiler that is:

"Incorrect number of arguments, Expected no more than 0"

private static function closestVertexOnOBB(p:Vector,r:RectangleParticle):Vector
{
    var d:Vector = p.minus(r.samp);
    var q:Vector= new Vector(r.samp.x, r.samp.y);

    for (var i:int = 0; i < 2; i++)
    {
        var dist:Number = d.dot(r.axes[i]);

        if (dist >= 0) dist = r.extents[i];
        else if (dist < 0) dist = -r.extents[i];

        q.plusEquals(r.axes[i].mult(dist));
    }
    return q;
}

sentences:
Open GL polygons not displaying I have tried to follow nehe's opengl tutorial lesson 2. I use sfml for my window creation. The problem I have is that both the triangle and the quad don't show up on the screen:

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>

void processEvents(sf::Window *app);
void processInput(sf::Window *app, const sf::Input &input);

void renderCube(sf::Window *app, sf::Clock *clock);
void renderGlScene(sf::Window *app);

void init();

int main()  {
    sf::Window app(sf::VideoMode(800, 600, 32), "Nehe Lesson 2");

    app.UseVerticalSync(false);

    init();

    while (app.IsOpened())  {
        processEvents(&app);

        renderGlScene(&app);

        app.Display();
    }

    return EXIT_SUCCESS;
}

void init()  {
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

    // Enable z-buffer and read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perpective projection
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluPerspective(45.f, 1.f, 1.f, 500.f);

    glShadeModel(GL_SMOOTH);
}

void processEvents(sf::Window *app)  {
    sf::Event event;

    while (app->GetEvent(event))  {
        if (event.Type == sf::Event::Closed)  {
            app->Close();
        }

        if (event.Type == sf::Event::KeyPressed &&
            event.Key.Code == sf::Key::Escape)  {
            app->Close();
        }
    }
}

void renderGlScene(sf::Window *app)  {
    app->SetActive();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // Clear the screen and the depth buffer
    glLoadIdentity();                   // Reset the view

    glTranslatef(-1.5f, 0.0f, -6.0f);   // Move Left 1.5 units and into the screen 6.0

    glBegin(GL_TRIANGLES);
        glVertex3f( 0.0f, 1.0f, 0.0f);  // Top
        glVertex3f(-1.0,-1.0f, 0.0f);  // Bottom Left
        glVertex3f( 1.0f,-1.0f, 0.0f);  // Bottom Right
    glEnd();

    glTranslatef(3.0f, 0.0f, 0.0f);

    glBegin(GL_QUADS);  // Draw a quad
        glVertex3f(-1.0f, 1.0f, 0.0f);
        glVertex3f( 1.0f, 1.0f, 0.0f);
        glVertex3f( 1.0f,-1.0f, 0.0f);
        glVertex3f(-1.0f,-1.0f, 0.0f);
    glEnd();
}

I would greatly appreciate it if someone could help me resolve my issue.

sentences:
Move Particle to touch position on android I am attempting to make a Particle start moving to the position of my finger on the touch of the screen.

I have been using this as the basis so far:

public void update()
{
    deltaX *= .9;
    deltaY *= .9;

    this.x += this.deltaX;
    this.y += this.deltaY;
}

public void moveTo(int newX, int newY)
{
    float dx = newX-this.x;
    float dy = newY-this.y;

    float length = (float) Math.sqrt(dx*dx+dy*dy);

    dx/=length;
    dy/=length;

    dx *= 10;
    dy *= 10;

    deltaX = dx;
    deltaY= dy;
}

now while it does move the Particle, it is rarely in the direction of my finger.
How can I make the particle have the correct amount of velocity to get to the position of my finger, but no farther?

Thanks in advance!

sentences:
Camera rotation in 4D What practical choices do I have in order to rotate a camera in 4D space? I would like to make it as intuitive as possible.

A camera in 3D space can be represented by

a point where it is located
the forward vector (movement using the [w] and [s] buttons)
the left (movement using the [a] and [d] buttons)
the up vector (eg. [space] and [ctrl])

In 4D space, the an additional axis is added:

the fourth axis vector (eg. [q] and [e])

All of the vectors remain orthogonal to eachother. So the movement is trivial.

sentences:
Preventing banding textures in DirectX I have a 3D scene that I've tried rendering in Direct3D 10 and using WPF's 3D framework. Obviously, going directly to Direct3D is producing far better performance but I am getting banding which doesn't appear using the same scene in WPF.

Does anyone have any tips on removing this type of artifact? It's obviously possible because WPF doesn't have it... If you have any questions about my Direct3D setup I will be please to add that information.

WPF:

Direct3D:

sentences:
New Input System Differs Between Editor and Runtime? I'm sure the problem is me.
Here is a simple look script (from a tutorial, actually).
I'm getting inconsistent results between editor and runtime. I'm guessing its a framerate thing.
Code:
using UnityEngine;
using Mirror;
using Cinemachine;

public class PlayerCameraController : NetworkBehaviour
{
    [Header("Camera")]
    [SerializeField] private Vector2 maxFollowOffset = new Vector2(-1f, 6f);
    [SerializeField] private Vector2 cameraVelocity = new Vector2(4f, 0.25f);

    [SerializeField] private Transform playerTransform = null;
    [SerializeField] private CinemachineVirtualCamera virtualCamera = null;

    private Controls controls;
    private Controls Controls {
        get {
            if (controls != null) { return controls; }
            return controls = new Controls();
        }
    }
    private CinemachineTransposer transposer;

    public override void OnStartAuthority()
    {
        transposer = virtualCamera.GetCinemachineComponent<CinemachineTransposer>();
        virtualCamera.gameObject.SetActive(true);

        Controls.Player.Look.performed += ctx => Look(ctx.ReadValue<Vector2>());

        enabled = true;
    }

    [ClientCallback]
    private void OnEnable() => Controls.Enable();

    [ClientCallback]
    private void OnDisable() => Controls.Disable();

    private void Look(Vector2 lookAxis) {
        float deltaTime = Time.deltaTime;

        float followOffset = Mathf.Clamp(
            transposer.m_FollowOffset.y - (lookAxis.y * cameraVelocity.y * deltaTime),
            maxFollowOffset.x,
            maxFollowOffset.y);

        transposer.m_FollowOffset.y = followOffset;
        playerTransform.Rotate(0f, lookAxis.x * cameraVelocity.x * deltaTime, 0f);
    }
}

The code seems right. Watching the values of Vector2 lookAxis reveals that the numbers are slightly different coming into the function based on environment.
Is there something wrong with this code that would give different results between editor and runtime?

sentences:
Monetizing an Android library? I'm developing a library ( i.e. a JAR file that you put into the libs folder in eclipse ) which would extend surfaceView, which other people would hopefully use to make games.

I guess the best way to make any money off it would be to show banners on that surfaceview, right?

Maybe someone had similar experience? What advertising company would you suggest? admob, leadbolt? would they agree that I would integrate their sdk into my library ( not a finished app )?

Thanks!

sentences:
Spawning player at a certain point after a new scene was loaded I have a Game Manager with a DontDestroyOnLoad function on it, before loading a scene I'm passing the variables needed to reset players position to a certain position. This is what my code looks like;

public IEnumerator LoadingNextLevel(int levelToLoad, string spawnPoint)
{
    pState.movingToNextLevel = true;
    fadeToBlack.SetTrigger("FadeOut");

    yield return new WaitForSeconds(0.5f);
    SceneManager.LoadScene(levelToLoad);
    fadeToBlack.SetTrigger("FadeIn");
    pState.movingToNextLevel = false;
    if (spawnPoint == "Red")
    {
        player.transform.position = GameObject.FindGameObjectWithTag("Red").transform.position;
    }
    else if (spawnPoint == "Blue")
    {
        player.transform.position = GameObject.FindGameObjectWithTag("Blue").transform.position;
    }
}

This doesn't give me any error, nor it does the job. What am I doing wrong?

sentences:
Can I write code from 2 computers at the same time? So I know it might not be that related to game dev, but I'm now starting a project with friends and we want to code. Thing is, we are not living close, and when several programmers write different classes or parts of code, syncing is a problem. Skype is not fast enough, it actually makes it worse (you need to pack and unpack .zip solution file), nor email.

Any one got a software that can connect 2 (or more) computers, and when we write code it will show up (simultaneously) on one of them/both?

I don't care much for lags, if we need to wait few secs till it shows up, it's fine.

I thought about TeamViewer, but as far as I remember only one can write/do an action at a time.

Thanks!

sentences:
Libgdx: Using an AssetManager in every Screen or use a single AssetManager in Game class I have a HexGame class extending Game and various Screens that receive the game object in their constructor. I was thinking of having one AssetManager in the game class and using it to load the necessary assets in each screen's constructor and unload them in the screen's dispose method.
The alternative would be to use a new AssetManager in every screen. What would be best practice?

sentences:
How to create a tile map texture in Oxygine? I started playing around with Oxygine and Ogmo last night when I stumbled upon this GitHub that read in the Ogmo level.

I ended up fixing the doRender method as it did not work (could just be due to it being an old version of Ogmo or something):

void OgmoLevel::doRender(const RenderState& rs) {
    auto tileLayers = this->tileLayers;
    Sprite sprite;
    for (size_t layerIndex = 0; layerIndex < tileLayers.size(); ++layerIndex) {
        auto tileLayer = &tileLayers.at(layerIndex);

        auto resAnim = project->resource->getResAnim(tileLayer->tileset->name);
        resAnim->getFrame(0).getDiffuse().base->setLinearFilter(false);

        sprite.setResAnim(resAnim);

        int gridXSize = tileLayer->definition->gridWidth;
        int gridYSize = tileLayer->definition->gridHeight;

        size_t columns = roomWidth / gridXSize;
        size_t rows = roomHeight / gridYSize;

        auto tiles = &tileLayer->tiles;
        size_t tilesSize = tiles->size();

        size_t i = 0;
        float yy = 0;
        for (size_t y = 0; y < rows; ++y) {
            float xx = 0;
            for (size_t x = 0; x < columns; ++x) {
                int tileID = tiles->at(i);
                if (tileID != OGMO_BLANK_TILE)
                {
                    int tWidth = tileLayer->tileset->tileWidth;

                    int actualRow = (tileID * tWidth / tWidth) / tWidth;
                    int actualColumn = (tileID - (actualRow * tWidth));

                    sprite.setColumnRow(actualColumn, actualRow);
                    sprite.setPosition(xx, yy);
                    sprite.render(rs);
                }

                xx += tileLayer->definition->gridWidth;
                ++i;
            }
            yy += tileLayer->definition->gridHeight;
        }
    }
}

The issue I see with this, is that the same exact rendering is happening every single frame. Normally for the tile maps, there are checks to determine whether or not the tile is on the screen. Now that is fine and all, but this time around, I know it is fully static 99% of the time and I want to render it to a texture and just continue to render that.

I've looked at the MemoryTexture and ImageData classes, but there wasn't really anything online I could find to tell me how to properly use them. Does anyone have any idea how I can achieve caching this?

(not enough rep to create proper tags)

sentences:
Isometric objects are mapped incorrect angle, but the map is fine. What am I missing? I laid out my iso map and it's fine, but when I add my sprite actors they get located in the correct location but they are laying down not standing up. I tried rotating them on the z by 45 but then they moved to the wrong location.

Anyone have any idea what I'm doing wrong? looks like a steam roller ran over my object :-)

I'm going to try and upload pics.

https://picasaweb.google.com/114100917691803291674/20140120?authuser=0&feat=embedwebsite

**correct location,but the image is laying down...

**standing up, but wrong map position..

sentences:
Picking college degree (want to be games programmer) Alright, so I know there's plenty of questions that have to do with college degrees on this site, but I don't feel that any of them really answer my question. I recently got accepted into Northeastern University. The thing that drew me to the university was not only that it appears to have a comprehensive computer science program, but that it offers combined majors with the other colleges. Since i'm interested in both game art and game programming, I applied to the Computer Science and Digital Art major. However, after looking at the other combined majors, I wondering if I picked the one that is right for me.

The five majors I'm currently looking at right now:

Computer Science and Digital Art:

Pros: Teaches both programming and art fundamentals.
Cons: The mathematics requirements are the weakest of the five majors
(only require linear algebra).

Computer Science and Game Design:

Pros: Very comprehensive in both computer science and game design.
Requires the most computer science courses out of the 5 majors (the
extra courses are game design specific). I'd be the most likely to
meet like minded peers in this major as well.
Cons: Doesn't really touch on subjects of game art at all. You are
allowed to take two art+design electives, that's it.

Computer Engineering and Computer Science:

Pros: Gives a comprehensive education on computing in general
(hardware and software). The biggest benefit of this major, I feel,
is that it would teach me how to think. By that, I mean it would
teach me to think in such a way that it'd be very easy to dive into
other aspects of both computer engineering and computer science (more
so than the other majors).
Cons: It's a computer engineering major first, and a computer science
major second. Some of the information I learn may be pretty much
useless.

Computer Science and mathematics:

Pros: Naturally, it has the most math courses of any other major.
Cons: The only major con is that I'm not really crazy about math, and
don't know if I really want to subject myself to a bunch of it.

Computer Science and physics

Pros: It's actually pretty well split among math, physics, and
computer science.
Cons: Like the computer engineering major, some of the information I
learn may be pretty much useless.

I don't want this post to be ridiculously long so forgive me if I'm not specific enough. I'm guess I'm torn between different beliefs. Computer Science and Digital Art/Game Design would probably be the most fun majors for me, since they'd suit my personal interests. However, the other majors would give me information that would be useful in a broader sense (I could apply them outside the fields of game design / interactive media). I don't think any one of these majors will prepare me completely for the games industry, not even the game design one. However, I do think that no matter which of these majors I pick, I'll still be able to get into the game industry.

sentences:
Unity: Can't access repeatDelay from StandaloneInputModule? I have a very specific problem. I'm trying to change the repeatDelay variable within my StandaloneInputModule, but it's not coming up as a variable. All of the other variables come up when I use GetComponent<StandaloneInputModule>(), but not the one that I want. Is there something different about repeatDelay that I'm not seeing?

EDIT: I'm using the UnityEngine.EventSystems namespace too.

sentences:
Computing chance of winning when dealing with fuzzy numbers Computing chance of winning in a one player and one enemy battle when using fixed numbers is quite easy; for example if we have these numbers:

  Player : Attack : 5 - Health : 30 - Attack Interval : 2s
  Enemy : Attack : 10 - Health : 20 - Attack Interval : 5s

When both player and enemy start battling together at the same time you can say for 100% the player will win this battle because it takes the player 8 seconds to kill enemy but enemy needs 15 seconds to win, so it is certain the player would win this battle.

Now considering using not fixed numbers (Attack and Attack Interval are fuzzy), for example for these numbers:

  Player : Attack : (5>10)10% - Health : 30 - Attack Interval : (2s>5s)50%
  Enemy : Attack : (10>15)20% - Health : 20 - Attack Interval : (5s>7s)10%

Note: (5>10)10% means for 90% of times when a player attacks it would have 5 hit points and for 10% of times it randomly can be from 5 to 10 point.

Note: (2s>5s)50% means for 50% of times player attack interval is 2s and for 50% of times it randomly can be from 2 to 5 second.

Now this changes choosing the winner for some numbers; either the player or the enemy can win the battle. How can we compute the chance of winning? For example, concluding that the player has 34% of winning in this battle, etc.

UPDATE : I'm creating probability tree for player and enemy for my example with a little change in numbers to get rounded numbers. example is this :

  Player : Attack : (5>10)10% - Health : 30 - Attack Interval : (2s>5s)70%
  Enemy : Attack : (10>15)20% - Health : 20 - Attack Interval : (5s>7s)10%

now i achieve two probablity/winTimeNeeded chart like these :

Now how can i get player overall win probability with these chart and numbers?

Update : with @realUser404 solution i can say player have exactly 82.0028% of winning in this example (if player and enemy have exactly the same time we consider this a lost.)
still if some one have better solution I'll be happy hear about it I'll wait til the end of bounty.

sentences:
Good map file structure? I need a map file structure for my game but does anyone know a good way to map it out? I was thinking something like this:

name=MyMap
add[floor[stone]][solid][20, 640]
add[playerspawn][20, 620]

sentences:
What framework provides mouse-interactive components as game sprites? Background:

I wish to make a really flashy chess game.  The squares on the board will be unique terrain. The pieces will be colourful images.  The pieces will be animated. The pieces will sometimes be overlaid with each other at times.  It will have sound, allow saving, and need keyboard input sometimes.

The basic question (tl;dr):

I am looking for a free framework that will allow me to use interactive GUI components as sprites, that would make such a game easy to develop.

Things I want:

I need to be able to overlay partially transparent/translucent images on some sort of game canvas.
The images, or an invisible component holding them, should receive mouse events like clicks, click-and-drag, and mouse-over.  Pre-defined checking methods/functions are ok too.
The framework should allow animation of the images.
The framework must not exclude easy support for music, sound effects, keyboard or file IO.  I am happy to use compatible libraries or frameworks top do these things separately, but there's no point saving effort on mouse interaction only to find it has made everything else too difficult.
The framework and all its dependencies must be free.  I want to be able to distribute my game, free or for profit, without ever having to pay money for the tools or frameworks used in development. (Even if you think this is unfair or unrealistic, you won't change my mind.)
Documentation must be available.
Cross-platform i.e. should look and behave the same on linux or windows without major tweaking.

Things I don't care about:

Whether what you suggest is technically a framework, a library, an engine, or even a tutorial on how to easily do it.
I don't need bleeding-edge performance like you need for a fast-paced shooter.
The precise language or paradigm used.
Your (correct) belief that flashy graphics won't improve the chess experience. :-)
Anything relating to chess AI, marketing, or other important but out-of-scope considerations.

I appreciate any suggestions.

sentences:
How to test a Unity game with different graphics APIs? If I don't have a device with Metal, is there a way to test the application with it anyway?
And if my device supports both DirectX and OpenGL, how can I tell the application, for example on Windows, which one should it use?

sentences:
OpenGL - Debug version runs faster than Release version My Visual Studio 2019, 64-bit version of Tetris using OpenGL runs significantly faster, 3X, in Debug mode than in Release mode.
The image above shows the board.  Each cycle of the rendering or game loop redraws everything, viz., the light blue background, the grid, the individual game pieces (one shown) with the latest one added moving every 300 ms, and the text score display.  I have moved all the repetitive code out of the loop, e.g., that which sets the location in shaders for uniform constants.
The Release mode loop cycle time ranges from 0.05 to 1390.0 ms while that of the Debug mode ranges from 0.05 to 350.0 ms.
Any thoughts on what I might investigate?
Thanks.

sentences:
Accessing colliders from one script C# I want to access specific colliders(to see if they are been clicked) from one script insted of making multiple scripts for every collider.How?

I am using unity.

using UnityEngine;
using System.Collections;

public class MainMenuManager3D : MonoBehaviour
{
    public enum Menu
    {
        MainMenu,
        NewGameMenu,
        LoadGameMenu,
        OptionsMenu,
        GameSettingsMenu,
        GameGraphicsMenu,
        Exit
    }
    public Menu currentMenu;
}

I want to change the currentMenu based on which collider is clicked in this script. Insted of making 99999 scripts for every collider.

sentences:
Restricting character movement to "rails" I'm building a Pacman clone in Unity 3D and am now thinking about how to restrict the movement of the player to the hallways that the map is made up of.

Basically, the player is only allowed to change direction at an intersection. When he is not at an intersection, he can only continue to move in the same direction, or reverse by 180°.

The simplest idea I have come up with so far is, to have little un-rendered Boxes with Colliders at every intersection, and when the player collides with one of those, the collider knows which directions the player can go from there.

This seems easy, but a lot of work. Is there an easier way to restrict the movement of the player to given track (as in a railroad), but allow him to change "onto" a different "track" at given points (those would be the intersections)?

sentences:
What is the most efficient method to load 2D dynamic chunks? Information/context

I'm writing a 2D sandbox game - similar to Terraria. The world is made up of many chunks, in a variable like this:

vector<Chunk> chunks;

There's no need to go too in depth about the Chunk class, but each chunk has these members:

int x, y;
Block blocks[256];

When a chunk is initialized, the blocks are all set (with a Perlin noise based algorithm.) There are 256 blocks per every chunk because a chunk is a 16x16 area filled with blocks. To the loading of the chunks, the members of the Block class are irrelevant.

Question

As the player walks around the world, I obviously need new chunks to load for them to explore. I don't think it needs saying but I shouldn't load every chunk in the world at once because:

It would be incredibly inefficient to render (even with my current system of block culling,) and
I don't know how many chunks will be in the world - there can be a huge amount, basically as many as the player wants to load.

I've tried a few different (but similar) ways to load and unload the chunks, but none of them worked very well. The main problem with both was that they sometimes gave segmentation faults.

What's the best way to dynamically load and unload chunks in a world?

By "best", I mean the most performance-efficient method.

Keep in mind I can easily load a chunk at any position - this isn't the problem. I just want a way of deciding which chunks to load.

sentences:
Box2D - Platformer tiled map problem I'm using C++, Box2D and SFML.

I convert a Tiled map to world in my platformer game and I get stuck when I go against a block when I go forward like that :

I can use a circle as foot of my character but sometime, it make me jump a bit. Is there a solution or I must only do shape ?

sentences:
2d stealth-type collision I'm curious as to how stealth games work. I am working with 2d right now to get the hang of it, and so far I have come up with the following ideas.

create a bounding circle around the player/enemy
if the circle comes in contact with and object, let's say a crate, shoot out rays 360 degrees.
if the ray contacts the player/enemy, trigger something saying you have been found.
if the ray contacts the crate, the ray will never hit the player, thus making him "hidden" to the enemy

Naturally, there will be some kind of crazy vector math involved in this. What I am wondering is if this is the right way to go about doing this? Is having rays being shot out every second or half-a-second something that's feasible and won't slow down the program drastically?

sentences:
How to determine what hexes are in an area bounded by 3 hexes I've been searching for hex grid algorithms for a while now, but I'm not having much luck.

I'm working on a game that will be using hex grids for the board.  There seems to be sufficient resources to manage the A* path finding routines, but trying to find something as simple as determining a set of hexes within a triangle seems to be a real challenge.

An example of what I'm looking for is that I want to have a starting coordinate.  I want to get a hex that is 3 hexes to the north/east away from the source hex.  I want to get a hex that is 3 hexes to the south/east away from the source hex.  I then want to produce a list of all hexes bounded by these 3 hexes.

It should be simple enough, but the fact that rows are staggered is completely confounding me.

Thanks

sentences:
Horizontal scrollview only I am using unity's scrollview.
I want to disable the vertical scrollbar and i want the viewport to resize vertically depending on the content.
Too confusing to explain with word so i have created the example picture below :

How do i achieve this properly ?

sentences:
Transform values stay zero while catching mouse movement I am working on a game using GoogleVR, but I don't think that has anything to do with my problem.

Basically, I am testing to see if I can move a stick by using the mouse at the moment.

I am getting mouse movement, as seen from the value of md:

(-0.5,-1.25)
UnityEngine.Debug:Log(Object)
PlayerMovement:Update() (at Assets/Character Pack/PlayerMovement.cs:30)

But the transform is wrong, as seen from the localRotation:

(0,0,0)
UnityEngine.Debug:Log(Object)
PlayerMovement:Update() (at Assets/Character Pack/PlayerMovement.cs:29)

I just want to see my stick move in some predictable way based on the movement of the mouse, and I am not certain why my equation is wrong.

public class PlayerMovement : MonoBehaviour {
    Vector2 mouseLook;
    Vector2 smoothV;
    public float sensitivity = 5.0f;
    public float smoothing = 2.0f;

    public GameObject stick;

    // Use this for initialization
    void Start () {
        smoothV.x = 0.5f;
        smoothV.y = 0.5f;
    }

    // Update is called once per frame
    void Update () {
        var md = new Vector2 (Input.GetAxisRaw ("Mouse X"), Input.GetAxisRaw ("Mouse Y"));

        md = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
        smoothV.x = Mathf.Lerp (smoothV.x, md.x, 1f / smoothing);
        smoothV.y = Mathf.Lerp (smoothV.y, md.y, 1f / smoothing);

        stick.transform.localRotation = Quaternion.AngleAxis (-mouseLook.y, Vector3.right);
        stick.transform.localRotation = Quaternion.AngleAxis (mouseLook.x, stick.transform.up);
        Debug.Log ("(" + stick.transform.localRotation.x + "," + stick.transform.localRotation.y + "," + stick.transform.localRotation.z + ")");
        Debug.Log ("(" + md.x + "," + md.y + ")");
    }
}

sentences:
Semi-fixed or Fully-fixed timestep? I am making an iphone shmup and am trying to decide what type of game loop to use. I want to use either semi-fixed timestep or fully-fixed timestep.

With semi-fixed timestep I will make zero or more update(FIXED_INTERVAL) calls followed by one update(dt) call where dt <= FIXED_INTERVAL per game loop. As I understand it the drawbacks with this method are that my physics update(dt) logic is going to be more difficult to program because I basically have to assume a variable dt for every update. And then I've also heard that each run of my game will be slightly different due to floating point values not being the same every time.

Then with fully-fixed timestep I am making zero or more update(FIXED_INTERVAL) calls followed by one interpolation(dt/FIXED_INTERVAL) call where dt < FIXED_INTERVAL per game loop.

So it seems like the big decision I really have to make is: do I want to tackle the challenge of implementing an update(dt) with a variable dt or do I want to tackle the challenge of implementing interpolation?

Now from what I've read the majority of people are saying to use fully-fixed and do the interpolation. But when I think about implementing interpolation it seems like I'd be a lot more complex than an update(dt) with variable dt. This is because if I use interpolation I have to remember both the previous state and the current state. So if I want to use interpolation I have to come up with an additional layer of indirection that abstracts out entire individual game states. Whereas with semi-fixed timestep where I don't have to use interpolation I don't have to come up with a game state abstraction because there's always only one game state and it's simply the "global arrays" that represent my enemies, and enemy bullets etc.

So what's the more practical choice: do I implement it semi-fixed knowing that my physics updates could get complicated with the variable dt. Or do I use fully-fixed and try to come up with a game state abstraction so that I can keep track of previous state and current state in order to perform interpolation?

sentences:
Unity GameObject.Find() not working in batchmode? I am trying to make GameObject.Find() work in batchmode but for some reason it returns a null object.

my code:

public class test: Monobehaviour {
    public static GameObject go;

    static void doing()
    {
        go = GameObject.Find ("testing");
    }
}
//testing is the name of the gameobject in the editor

I call it from the console on mac using: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath "" -executeMethod test.doing

sentences: Dynamic Aspect Ratio in Unity (for Anti-Aliasing) I am using HDRP with 1920x1080 resolution. The anti-aliasing works very well if the screen resolution increases and it works really bad if the screen resolution is lower than 1920x1080. Why does this happen? Is there a way to overcome this?

sentences:
What is the name of perspective of Age of Empires II? One would describe Age of Empires 1's "perspective" as a 2D sprite game:

Below is a screenshot of Age of Empires II. How would you describe the "perspective"? Is it also a 2D sprite game?

"Perspective" may not even be the correct word. If it isn't, what should I use?

sentences:
Skeletal animation in OpenGL I'm using Assimp to do skeletal animation in my OpenGL application.

I used Blender to export this one-boned model to a COLLADA file:

The model has only one bone, called arm bone, that controls the arm mesh. All the other meshes are static.

I made several structures and classes that help me play animations.
All the nodes are added to an std::vector of Node objects. each Node contains aiNode data and a toRoot matrix.
The bone hierarchy is encapsulated in a Skeleton class, and the animation matrix (T * R) are updated for each bone in a class called Animation.

My Model::Draw() function is this:

void Model::draw()
{
    //iterate through all animation sets. if the animation is running, update the bones it affects.
    for(size_t i = 0; i < _animations.size(); i++)
        if(_animations[i].running())
            _animations[i].updateAnimationMatrices(&_skeleton);

    //calculate Bone::finalMatrix for each bone
    _skeleton.calculateFinalMatrices(_skeleton.rootBone());

    //iterate through the nodes and draw their meshes.
    for(size_t i = 0; i < _nodes.size(); i++)
    {
        _shaderProgram.setUniform("ModelMatrix", _nodes[i].toRoot());

        _nodes[i].draw();
    }
}

To get the "animationMatrix" for each bone (the TR matrix) I call Animation::updateAnimationMatrices().
Here's what it looks like:

void Animation::updateAnimationMatrices(Skeleton *_skeleton)
{
    double time = ((double)_timer.elapsed() / 1000.0);
    while(time >= _animation->mDuration) time -= _animation->mDuration;

    //iterate through aiNodeAnim (called channels) and update their corresponding Bone.
    for(unsigned int iChannel = 0; iChannel < _animation->mNumChannels; iChannel++)
    {
        aiNodeAnim *channel = _animation->mChannels[iChannel];
        Bone *bone = _skeleton->getBoneByName(channel->mNodeName.C_Str(), _skeleton->rootBone());

        //rotation
        glm::mat4 R = ... //calculate rotation matrix based on time

        //translation
        glm::mat4 T = ... //calculate translation matrix based on time

        //set animation matrix for the bone
        bone->animationMatrix = T * R;
        bone->needsUpdate = true;
    }
}

Now in order to calculate the "finalMatrix" for each bone (based on animationMatrix, offsetMatrix etc..), and upload it to the vertex shader, I call Skeleton::calculateFinalMatrices().

void Skeleton::calculateFinalMatrices(Bone *root)
{
    if(root)
    {
        Node *node = _getNodeByName(root->name->C_Str());
        if(node == nullptr) {
            std::cout << "could not find corresponding node for bone: " << root->name->C_Str() << "\n";
            return;
        }

        if(root->needsUpdate) //update only the bones that need to be updated (their animationMatrix has been changed)
        {
            root->finalMatrix = root->animationMatrix * root->offsetMatrix;

            //upload the bone matrix to the shader. the array is defined as "uniform mat4 Bones[64];"
            {
                std::string str = "Bones[";

                char buf[4] = {0};
                _itoa_s(root->index, buf, 10);

                str += buf;
                str += "]";

                _shaderProgram->setUniform(str.c_str(), root->finalMatrix);
            }

            root->needsUpdate = false;
        }

        for(unsigned int i = 0; i < root->numChildren; i++)
            calculateFinalMatrices(root->children[i]);
    }
}

Here's my bone structure, if it helps.

My glsl vertex shader is pretty standard. Here it is.

And finally, here's the result I get: (ignore the model's static legs. that must be some bug in the Blender exporter).

And here's the result I should get: (using a 3d party software)

It looks like there's something wrong with the bone's matrix calculation, although I don't know what. Any ideas or tips?

Thanks!

sentences:
Render to Texture Using Multisampling I have a DirectX11 application, which has multisampling / anti-aliasing enabled.  However, I want to add an effect that requires a render-to-texture step.  When I add this extra step, I lose all anti-aliasing.  Here's basically what I'm doing:

1) render scene to texture

2) render texture to screen (with some effect, say blurring or something).

I've tried enabling multisampling on the render texture, but i'm not sure how to get it to work.  I've made it use 8 samples and specified D3D11_DSV_DIMENSION_TEXTURE2DMS, but apparently that step required me to use Texture2DMS in the shader.  But now I don't know how to sample a Texture2DMS in the shader, because I can't just pass in the textures coordinates, I have to pass in a sample index, which I don't know how to calculate.

How to I use render to texture effects while preserving multisampling / anti-aliasing?

sentences:
Knob in DigitalOnScreenControl not moving. Why? I have set up a DigitalOnScreenControl in my game but the knob does not move. The base and the knob are drawn on the screen but the latter doesn't move as per the AndEngine example here.

Here is a snippet of my code:

this.mDigitalOnScreenControl = new DigitalOnScreenControl(300, 300, ResourceManager.getCamera(), ResourceManager.joystickControlBase,
                ResourceManager.joystickControlKnob, 0.1f, ResourceManager.getActivity().getVertexBufferObjectManager(),
                new IOnScreenControlListener() {

            @Override
            public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, final float pValueX,
                    final float pValueY) {
                    Log.v(TAG, "onControlChange");
            }
        });

        final Sprite controlBase = this.mDigitalOnScreenControl.getControlBase();
        final Sprite knob = this.mDigitalOnScreenControl.getControlKnob();
        controlBase.setAlpha(0.5f);
        controlBase.setOffsetCenter(0, 0);
        controlBase.setScaleCenter(10, 10);
                    controlBase.setScale(1.25f);
        knob.setScale(1.25f);
        this.mDigitalOnScreenControl.refreshControlKnobPosition();
        ResourceManager.getEngine().getScene().attachChild(this.mDigitalOnScreenControl);

The mDigitalOnScreenControl is a DigitalOnScreenControl object defined previously. I use a ResourceManager class to obtain texture regions and other game resources such as the camera amongst others. Note: Since the base and the knob are drawn, the ITextureRegions returned by the ResourceManager are valid. When I execute the program, there are no errors in DDMS.

The knob just doesn't move. Does anybody have an idea?

Thank you!

sentences:
How to make a fun slot machine? We currently have a simple slot machine in our online virtual world game.

You set the amount you want to bet (in virtual money) and pull the lever, and depending on the 3 figures (there's only one line) you get a reward, a free round, lose some more money, or most of the time, get nothing at all. You can instantly pull the lever again. The previous bet will be maintained.

At the moment this slot machine isn't really fun to play. The chances of winning something are pretty low (though when you win, you can win a lot). When you pull the lever, the result is determined (though not shown) immediately, so there's also no way influence the outcome of the wheels.

How can it be made more fun?

sentences: How do I get to ModPE to perform a function the first time a mod is opened? I am making a Minecraft PE mod and I want to set a variable only on the first launch of the mod. So, how do I make it it set the variable and then not set it again until I import the mod again?

sentences:
How to test Google Play Multiplayer locally I'm building a simple HTML5 game and I need to implement multiplayer without sharing the game on Google Play.

I'm using CocoonJS's multiplayer api.

How can I test Google Play Multiplayer locally? Do I really have to use websockets instead?

sentences:
physics engine without time steps I'm looking for physics engines that doesn't use time steps. I don't think time steps are reliable, and I don't like how without tweaking the engine a bullet going too fast can pass through a wall without colliding it. Moreover I suspect they do a lot of unnecessary computations.

I thought of a physics engine concept where all the movements are represented by forces and movement beginning time. In such an environment as long as no event occur the engine would not do any computation.

I imagine the following:

I shoot a bullet in space, an object is created representing its physics properties.
The engine compare the bullet trajectory with other's to find if it's gonna collide with an other object.
It finds a collision, in 3 seconds.
An callback is programmed to trigger in 3s to process the collision.
In the meantime if no other event occur (like shooting an other bullet, changing an object trajectory, etc...) no other computation is done.

Does such an engine exists?
Is there a name to this technique?
Have you ever tried using this approach?

sentences: Best collision algorithm for Axis Aligned Bouding Boxes I have a number of quads (suppose like 20-40) and i want to quickly check the collisions between any of them. I would like to know if there's a quick algorithm to do that 60 times per second without performance decrease

sentences:
Issue with implemented Minesweeper algorithm So I'm attempting to learn Python by way of Minesweeper.  I've got experience with SDL, so I figured playing around with PyGame sounded like a fun way to learn the syntax of the language.

Anywho, I'm having an issue in uncovering adjacent open squares as you would in a normal game of Minesweeper.  I click on a cell with 0 neighboring mines, and attempt to scan the top, left, right, and bottom to see if those also have 0 neighboring mines, and I do this recursively.

Here is the error that I receive:

RuntimeError: maximum recursion depth exceeded in cmp

And here is my algorithm:

#open up blank mines
def open_blank_cells(mines, cr, cc):
  #top
  if (cr > 0):
    t_mine = mines[cr-1][cc]
    t_mine.switch_state(3)
    if (t_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr-1, cc)

  #right
  if (cc < 9):
    r_mine = mines[cr][cc+1]
    r_mine.switch_state(3)
    if (r_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr, cc+1)

  #bottom
  if (cr < 9):
    r_mine = mines[cr+1][cc]
    r_mine.switch_state(3)
    if (r_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr+1, cc)

  #left
  if (cc > 0):
    l_mine = mines[cr][cc-1]
    l_mine.switch_state(3)
    if (l_mine.neighbor_mines == 0):
      open_blank_cells(mines, cr, cc-1)

  return

where mines is my 2D array of cells, cr is the index of the current row (first array index), and cc is the index of the current column (second array index).

I thought that my algorithm was decently solid (but please tell me if I'm wrong there!!!), so I turned to the Internet and found that the default Python recursion limit of 1000 could be to blame.  However, when I bump it higher with the call to sys.setrecursionlimit the game either exhibits the same behavior, or simply crashes as the system kills it.

When I comment out 2 of the 4 recursive checks in the function, it will open up blank cells without any problem.  3 or more however breaks the algorithm.

Edit

As requested....

Calculation of neighbor_mines

# if not a mine, figure out how many surround it
  for i in xrange(10):
    for j in xrange(10):
      if (mines[i][j].is_mine == False):
        #check top 3
        if (i > 0):
          if (j > 0):
            if (mines[i-1][j-1].is_mine == True):
              mines[i][j].neighbor_mines += 1

          if (mines[i-1][j].is_mine == True):
            mines[i][j].neighbor_mines += 1

          if (j < 9):
            if (mines[i-1][j+1].is_mine == True):
              mines[i][j].neighbor_mines += 1

        #check left and right
        if (j > 0):
          if (mines[i][j-1].is_mine == True):
            mines[i][j].neighbor_mines += 1

        if (j < 9):
          if (mines[i][j+1].is_mine == True):
            mines[i][j].neighbor_mines += 1

        #check bottom 3
        if (i < 9):
          if (j > 0):
            if (mines[i+1][j-1].is_mine == True):
              mines[i][j].neighbor_mines += 1

          if (mines[i+1][j].is_mine == True):
            mines[i][j].neighbor_mines += 1

          if (j < 9):
            if (mines[i+1][j+1].is_mine == True):
              mines[i][j].neighbor_mines += 1

Switch_state

 def switch_state(self, newstate):
    self.state = newstate

    #marked as mine
    if (newstate == 1):
      nf = "sq_mine_marked.png"
    elif (newstate == 2):
      nf = "sq_mine_question.png"
    elif (newstate == 3):
      nf = "sq_mine_open.png"
    elif (newstate == 4):
      nf = "sq_mine_mine.png"
    else:
      nf = "sq_mine.png"

    oldrect = self.rect #save old rect as load_image overwrites it
    self.image, self.rect = load_image(nf, (255,0,255))
    self.rect = oldrect

sentences:
Why do mobile games have delays for certain actions? Many phone games restrict the number of actions you can take in a given amount of time. I don't get what is the purpose of this limitation. Is it only to force the player to buy additional turns? Some games don't even allow this for some turn "kinds" (like action A can be played again by spending real money while action B cannot be played again by spending money).

Another possible reason would be to limit the bandwidth usage to their server and make it more predictable over time, but I can't see phone games using so much data.

sentences:
How to generate multiple particles at once? I am tying to create a cartoony balloon-pop animation. I want there to be particles that come from all sides of a sphere. However they should all come at once, in a single burst.

What I've done is this. I generated a particle system as a child of the sphere. I set the shape to sphere, reduced the duration, and increased the rate. However it doesn't seem like any particles are being generated at the same time still, only one is created at once.

How can I make all of the particles come at the same time?

sentences:
How can I reference the frontmost part of a mesh in my Unity code? (and help making FPS projectiles seem more real) I have started making a PC game using Unity. It's just a test project, where I'm making as basic as possible FPS shooter.

I'm using the FPS Controller prefab, and I have also a rifle model attached to it. The result is pretty much what I wanted.

Now I'm considering how I want to create projectiles for the gunfire. I think it will be best for me to create each bullet as just being a ray from the gun barrel heading forwards, OR I might create rigidbodies from the gun barrel I'm not sure yet.

My question is: What is the proper way to reference the point in space in which the gun barrel current ends? At the moment, I am thinking just attach ANOTHER gameObject to the gun model, and just manually position it where the barrel finishes. But this seems 'cheaty' and I think perhaps there is a better way (something like mesh.position.z + mesh.length, but I can't seem to find anything like mesh.length).

I haven't posted code at all, because I haven't really written any on this project yet.

I would also be very interested to hear the pro-tip version of how best to simulate this gunfire (ie. is it best to use rigidbodies? or somehow use raycast or something? or some better way that I haven't even dreamt of)

sentences:
Scaling surface changes colors I'm building a pixel art game with pygame, and I'd like to scale it to double the size. I have tried the pygame.transform methods like scale and scale2x, but they seem to alter the colors quite badly, there's an added red hue. Is there a way to scale pixel art correctly in pygame? Basically making each pixel 2x2 of the same color. Or do I have to do it manually, if yes, any suggestions?

This is the setup I have currently, "works" but messes up the colors:

#set scaling
scaling = 1

screen = pygame.Surface( (screen_w, screen_h) )
window = pygame.display.set_mode( (screen_w * scaling, screen_h * scaling) )

while not done:

    #do things...

    pygame.transform.scale(screen, (screen_w * scaling, screen_h * scaling), window)
    pygame.display.update()

E. for reference, here's what happens.

No pygame scaling

vs. pygame scaling

sentences:
Unity Ambient Occlusion not working with Orthographic camera It seems like the Ambient Occlusion setting from the Unity Post Processing stack (obtained from the asset store) only works with a Perspective camera, yet I haven't come across any documentation stating that this is the case or that it lacks support for Orthographic.

All the other settings in the stack seem to be working in both Perspective and Orthographic.

Is this a bug, or something I'm not doing right or understanding?

sentences:
How can I implement a directional melee attack? I am attempting to make a top down game similar to the SNES Zelda games, in Unity 4.3, in 2D. When my character swings their sword, every enemy within a radius takes damage. I want to make sure that melee attacks only damage enemies the player is facing.

How can I do this?

The relevant code in PlayerAttack.cs looks like this:

// Update is called once per frame
void Update () {
    // have the player initiate an attack on the object
    if(Input.GetKeyUp(KeyCode.F)){
        MeleeAttack();
    }
}

private void MeleeAttack(){
    // create a variable called distance to make sure the distance is close enough
    // to inflict damage from a melee attack target.transform.positon = the position
    // of the object to attack and transform.position is the position of the players
    // transform
    float distance = Vector3.Distance(target.transform.position, transform.position);

    // make sure the distance is not greater than 1.5 so the player cannot
    // melee an enemy from to far away
    if(distance < 1.5f){
            // get a reference to the enemy's health script and type cast it.
            EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
            // now call the function that will decrease the enemy's health
            eh.AdjustCurrentHealth(-10);
    }
}

sentences:
How to calculate a quad based on a triangle pairs shared edge Based on two given triangles, I would like to calculate a quad that can be used as a 'fat' line for the edge between the triangles.

I have googled around and while it is very easy to draw lines in OpenGL or DirectX, the problem is that you can only guarantee a thickness of 1 pixel.

To overcome this I need to generate a quad for the line.

So given the below image...

I have a set of triangles, and I want to draw a line where the red dots are.
I know the start and end vectors for this line. And all the details of the triangles

I need to create a quad so that I can define the thickness (seen as the blue arrow)

An extra complication is that the triangles may not be on the same plane.

So from the side perspective, the 'line' would need to be created with its edge growing like this. Where both black lines are the sides of two separate tringles and the shared edge is from the point and moves into the screen.

All the calculation for this will be done offline

I am hoping that just a nudge in the right direction and I will be able to hammer this out on my own. (maybe)

OR if there is another way to solve the fat line problem then let me know.
I will be rendering this using OpenGL ES 1 (without a shader)

Thanks.

sentences:
Java - Collision detection (Glitch) I am working on a platformer game for the final year project in HS.
However... The collision detection system I use is basically about checking wether a specific part of the character intersects with another block or not.

The collision seems to be working fine except that it causes some bugs such as player king of getting stuck or slowing down when hitting from the sides or gets thrown up when both upper and < or > keys are used.

My question is; How can I improve the collision code in order to avoid such glitches and have sort of 'slippery' collisions?

here is a preview of how the bounds look

and here is a preview of what it actually looks like in game
(click for better quality)

The code i use for collision detection:
(tempObject are blocks that the player is intersecting with)

if(getBoundsTop().intersects(tempObject.getBoundsBottom())){
    y = tempObject.getY() + height;
    velY = 0;
    System.out.println("Top collision");
}

if(getBoundsBottom().intersects(tempObject.getBoundsTop())){
    y = tempObject.getY() - height;
    velY = 0;
    falling = false;
    jumping = false;
    //isOnBlock = true;
} else {
    falling = true;
    //isOnBlock = false;
}

if(getBoundsRight().intersects(tempObject.getBoundsLeft())){
    x = tempObject.getX() - this.width;
}

if(getBoundsLeft().intersects(tempObject.getBoundsRight())){
    x = tempObject.getX() + this.width;
}

and here is are the bound methods:

public Rectangle getBounds() { return new Rectangle( (int)x, (int)y, (int)width, (int)height ); }

    public Rectangle getBoundsTop() {
        return new Rectangle(
                (int)x,
                (int)y,
                (int)(width-(width*0.01f)),
                (int)(height/2)
        );
    }
    public Rectangle getBoundsBottom() {
        return new Rectangle(
                (int)x,
                (int)(y+(height/2)),
                (int)(width-(width*0.01f)),
                (int)(height/2)
        );
    }

    public Rectangle getBoundsLeft() {
        return new Rectangle(
                (int)x,
                (int)y,
                (int)((int)width*0.15f),
                (int)height
        );
    }

    public Rectangle getBoundsRight() {
        return new Rectangle(
                (int)
                ((int)x+(width-(width*0.15f))),
                (int)y,
                (int) ((int)width*0.15f),
                (int)height
        );
    }

sentences:
How can you tell if what you're buying is legal? In the past few days I've been browsing 3D asset marketplaces and repositories (I've been doing it for ages, but a lot recently). Many assets are paid for, others are free. In the past few days I've found suspicious activity on these sites, for example something sold on one site and given free on another site. I've recently reported many of these cases to the respective sites. The problem is, that now I look really closely at these models before buying them. I try to compare textures, geometry where I can, and poly count as tools for sniffing out property theft (copyright infringement).

I have bought some real bargains lately, and I know they're the real deal because I have spoken individually with the artists and am 99% I know it's the real deal. However how can I approach a store and have any confidence that what I'm buying isn't some reskinned asset ripped from a commercial game? (These are harder to spot as comparing geometry is harder)? I've tried to stick to reputable and popular sites, but I've already reported a number of people on these for abuse. It's worrying how often sellers aren't discovered by the site's owners or anyone else before I say something. For example there might be multiple thumbs up or 5 star reviews for people buying models that I've found out are actual rip-offs, or have been ripped off by someone else.

How can I know that a model I buy didn't come from some commercial game from 5 or 10 years ago, or from some mod from some point in time? Do I have any protection for example in future I release a commercial game and it's discovered that one of my assets from someone's mod or a commercial game from the past?

A while back I'd bought some products that seemed to be real bargains, and now that I'm a lot more cautious about these issues, I regret buying them.

sentences:
memorizing button tap code iOS game I'm using a single view app in Xcode 6.1 for my game with Storyboards. Not unity or sprite kit. It's a small game not even 3MB. Anyways, I created un-lockable characters with a BOOLEAN.

-(void)hidden{
 if(scoreNumber  > 9  || HighScoreNumber >9){
 BlueChar=YES;
 }

 -(IBAction)Blue{

  bird.image=[UIImage imageNamed:@"BLUE.png"];

 if(BlueChar ==YES){       //BlueChar=BOOL
 BlueChar.hidden=NO;
 }

When you click on BlueChar button, the UIImageView is connected to BlueChar character. So when you tap START GAME button game starts and you play as BlueChar. Then when it's GameOver and you click START GAME button again, the BlueChar button that was clicked isn't saved and instead you play as Original Character.

How do I make it that if you click BlueChar button ONCE, now you can play as BlueChar forever unless you click on another button that represents another character? How do I make the game save the last button clicked unless user clicks on another button in Objective-C code?

sentences:
Process Purchase Event get called on each App launch - iOS At present when I launch the app, each time ProcessPurchase event get called in iPhone device. Though upto now I have not pressed any purchase related buttons.

Yes I have setup subscription purchase within my app and before I have purchased subscription in sandbox environment two to three times but now their time period is expired.

Here you have debug log for actual event happening:

As per my past experience, ProcessPurchase event require to call only two times when a user purchase something or at restore purchase time.

So why its get called each application launch that I can't able to understand!!!

Please give some help in this so I can complete my Unity IAP related thing.

Source Code :
https://pastebin.com/bNpXsjHg

sentences:
Loading next scene when counter is down to 0 I am trying to let my Unity project load next scene when the counter I have is down to 0. However I am unable to do that for some reason. The way I am trying to do it by :

    int i = SceneManager.GetActiveScene().buildIndex;

    void Update () {
     if (GameObject.FindGameObjectsWithTag("Birds") == null)
        {
            SceneManager.LoadScene(i + 1);
        }
    }

In the editor I have created a folder where I have made 3 scenes. Have called them Level 1, Level 2 etc.

What am I doing wrong?

sentences:
LWJGL 3 HelloWorld example crashing I'm trying to start LWJGL 3 development and I am having an issue with getting things working. I have created a new Gradle project and successfully built the HelloWorld example from https://www.lwjgl.org/guide but when I run I get an error. However the error seems to be different each time. Here is one example:
Hello LWJGL 3.2.3 build 13!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff6d4fe829, pid=4595, tid=5891
#
# JRE version: Java(TM) SE Runtime Environment (14.0.1+7) (build 14.0.1+7)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libobjc.A.dylib+0x6829]  objc_msgSend+0x29
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/rob/Projects/Personal/cc/hs_err_pid4595.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Another:
Hello LWJGL 3.2.3 build 13!
[thread 9731 also had an error]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff34cc1027, pid=4579, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (14.0.1+7) (build 14.0.1+7)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [CoreGraphics+0x73027]  CGClipRelease+0xe
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/rob/Projects/Personal/cc/hs_err_pid4579.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

What should I start looking at to resolve this?

sentences: LibGDX ImageButton resizeing How can I resize ImageButton ? It show very big on screen . How I know it is an Actor and it is not resizing automatically . I can`t find the method for resizing it. Any ideas?

sentences:
Tool to create a bitmap font from a true type font What tool do you use to convert ttf fonts to bitmap fonts?

Following is a list of features I'm looking for.  I'd be happy with any tool really, but one that had these features would be better.

outputs power-of-2 texture atlas
parsible config file (so I don't have to use their rendering library)
output kerning information
cross platform
a rendering library would be great if it lets me make the actual OpenGL calls.

So what tool have you used?  Were you happy with it?

sentences:
Pygame surfaces and their Rects I am trying to understand how pygame surfaces work. I am confused about Rect position of Surface object.
If I try blit surface on screen at some position then Surface is drawn at right position,
but Rect of the surface is still at position (0, 0)...
I tried write my own surface class with new rect, but i am not sure if is that right solution.
My goal is that i could move surface like image with rect.move() or something like that.
If there is any solution to do that i would be happy to read it.

Thanks for answer and time for reading this awful English

If helps i write some code for better understanding my problem.
(run it first, and then uncomment two lines of code and run again to see the diference):

import pygame
from pygame.locals import *

class SurfaceR(pygame.Surface):
    def __init__(self, size, position):
        pygame.Surface.__init__(self, size)
        self.rect = pygame.Rect(position, size)
        self.position = position
        self.size = size

    def get_rect(self):
        return self.rect

def main():
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    pygame.display.set_caption("Screen!?")
    clock = pygame.time.Clock()
    fps = 30

    white = (255, 255, 255)
    red = (255, 0, 0)
    green = (0, 255, 0)
    blue = (0, 0, 255)

    surface = pygame.Surface((70,200))
    surface.fill(red)

    surface_re = SurfaceR((300, 50), (100, 300))
    surface_re.fill(blue)

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                return 0

        screen.blit(surface, (100,50))
        screen.blit(surface_re, surface_re.position)

        #pygame.draw.rect(screen, white, surface.get_rect())
        #pygame.draw.rect(screen, white, surface_re.get_rect())

        pygame.display.update()
        clock.tick(fps)

if __name__ == "__main__":
    main()

sentences:
Is there a way to convert a shader code to shader graph? I would like to ask if there is a way to convert a Coded shader into the new Shader graph, beacause i want to edit my shaders in more efficient way.

Any help is appreciated.

sentences:
Java Slick2d image depth/layering I'm making a topdown 2d game, and I've made a decent entity system so far.
But I want to do the following with it:
I want to have drawing depth, so if, for instance, a tree is above another tree, then it should be drawn underneath the other tree. Here is basically a picture of what I mean.
This is what I'm trying to avoid:

Instead of that I want something like this:

If you have any idea how to do this, please tell me. If you need any code, here's basically what I do:
In my main class I call a generate entities class. In that then I add Tree class-es to an arraylist through which it renders them.
Thanks.

sentences:
Ball vs 45-degree slope collision detection I have a simple game in which the player moves a ball around. The ball bounces off of walls. Right now I have square walls(■) implemented: I use simple bounding-box collisions to check if the player will move into a wall when updating its x or y speed and if so, I multiply that speed with -1 to make them bounce.

However, I also want to implement triangular pieces(◢◣◤◥). To bounce back I believe one can simply use:

   newxspeed = -1*yspeed;
   newyspeed = -1*xspeed;

However, what I am having trouble with is the collision detection: When does the player hit the diagonal?

sentences:
How can I add velocity to the standard CharacterController? I have FPS controller from standard asset.  After a long trial and error I figured that CharacterController doesn't respond to AddForce.

So, I have this trigger in the scene which I would like to throw FPS controller upwards.

Now, I know that I need to replace AddForce with adding velocity to the player. How to do that?

I need to use FPS controller component for velocity and add Vector3.up.
So, every game object other which will enter the trigger, will get upwards velocity.

void OnTriggerEnter(Collider other)
{
    other.attachedRigidbody.AddForce(Vector3.up * 100, ForceMode.Impulse);
}

sentences:
Get enum value "string", and get int value of that Sorry if the title is confusing, but I literally don't even know how to summarise this into a title. So here's the problem:

I have a list of combat moves for a character. I have an animation for each of those possible moves. When the "combat manager" (instantiated to manage each individual fight) works out what move the enemy and your person will make, it should tell the Animator to play the animation specific to the selected move. I'm really not sure how to go about this so:

The player's Animator has a state for each possible move, containing that move's animation. The script controlling the Animator has a public enum "CombatMove" containing every possible move (ie. CombatMove.WhicheverMove). So the Combat Manager will get the name of the move (eg. "Right Middle Jab"), remove the spaces and search for an enum value whose name is that string (eg. CombatMove.RightMiddleJab). Now it has the corresponding enum value, it retrieves the int value of that (eg. 0). It then sends that int value to the Animator, where each move's transition will occur if the int value equals the move's int value on the enum. So summed up:

move's string name, turned into an enum value name, turned into its int value, used to specify which move animation should be played.

The questions:

1) How do you find an enum value whose name equals a given string?

2) How do you get the int value of that enum value?

If this is confusing, please comment what makes no sense and I will try to explain, I'm honestly so lost that I don't even know how to ask what I need to ask.

EDIT:

IF anyone is wondering what I mean by 'int value', Fafase's answer at http://answers.unity3d.com/questions/764091/using-c-enums-to-control-an-animator.html says that each enum value has an int value by default, which can be used in animation conditions; however I have no idea how to access them, which part 2 of my problem.

sentences:
Swept AABB vs Line Segment in 2D I've been trying to get a swept collision detection up and running now for almost a week and I can't for the life of me get it working.

There is a answer on this linked here below:
Swept AABB vs Line Segment 2D
I've translated this into Go which will be running the game server and needs this logic:
func SweepRectLine(rectX, rectY, rectW, rectH, rectHSpeed, rectVSpeed, lineX1, lineY1, lineX2, lineY2 float64) (bool, float64) {
    outVel := [2]float64{}
    // hitNormal := [2]float64{}
    lineNX, lineNY := lineX2-lineX1, lineY2-lineY1
    // lineMinX, lineMaxX, lineMinY, lineMaxY := math.Min(lineX1, lineX2), math.Max(lineX1, lineX2), math.Min(lineY1, lineY2), math.Max(lineY1, lineY2)
    var lineMinX, lineMaxX, lineMinY, lineMaxY float64
    if lineNX > 0 {
        lineMinX, lineMaxX = lineX1, lineX2
    } else {
        lineMinX, lineMaxX = lineX2, lineX1
    }
    if lineNY > 0 {
        lineMinY, lineMaxY = lineY1, lineY2
    } else {
        lineMinY, lineMaxY = lineY2, lineY1
    }
    r := (rectW/2)*math.Abs(lineNX) + (rectH/2)*math.Abs(lineNY) //radius to Line
    boxProj := (lineX1-rectX)*lineNX + (lineY1-rectY)*lineNY
    velProj := rectHSpeed*lineNX + rectVSpeed*lineNY

    if velProj < 0 {
        r *= -1
    }

    hitTime := math.Max((boxProj-r)/velProj, 0)
    outTime := math.Min((boxProj+r)/velProj, 1)
    // log.Println("start", hitTime, outTime)

    rectXMax, rectXMin := rectX+rectW/2, rectX-rectW/2
    if rectHSpeed < 0 { // left
        if rectXMax < lineMinX {
            return false, 0
        }
        hitTime = math.Max((lineMaxX-rectXMin)/rectHSpeed, hitTime)
        outTime = math.Min((lineMinX-rectXMax)/rectHSpeed, outTime)
    } else if rectHSpeed > 0 { // right
        if rectXMin > lineMaxX {
            return false, 0
        }
        hitTime = math.Max((lineMinX-rectXMax)/rectHSpeed, hitTime)
        outTime = math.Min((lineMaxX-rectXMin)/rectHSpeed, outTime)
        // log.Println("right", hitTime, outTime)
    } else {
        if lineMinX > rectXMax || lineMaxX < rectXMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    rectYMax, rectYMin := rectY+rectH/2, rectY-rectH/2
    if rectVSpeed < 0 { // up
        if rectYMax < lineMinY {
            return false, 0
        }
        hitTime = math.Max((lineMaxY-rectYMin)/rectVSpeed, hitTime)
        outTime = math.Min((lineMinY-rectYMax)/rectVSpeed, outTime)
    } else if rectVSpeed > 0 { // down
        if rectYMin > lineMaxY {
            return false, 0
        }
        hitTime = math.Max((lineMinY-rectYMax)/rectVSpeed, hitTime)
        outTime = math.Min((lineMaxY-rectYMin)/rectVSpeed, outTime)
    } else {
        if lineMinY > rectYMax || lineMaxY < rectYMin {
            return false, 0
        }
    }

    if hitTime > outTime {
        return false, 0
    }

    outVel[0] = rectHSpeed * hitTime
    outVel[1] = rectVSpeed * hitTime
    return true, hitTime
}

I also put up a Gist with a executable UI here: https://gist.github.com/KidLinus/3f847c46b0e6dc1addac7252d9cb54ab
I can't for the life of me figure out what all class variables stand for. I think that some of them are native to Unity but that's just a guess. I've come so far as to figure out that the extent is half of the width/height in said direction. What the "line.n" stands for is anyones guess, I assume its the direction and have no idea if it's normalized or not.
There are also a couple of dead variables just laying there.

sentences:
How to ease toward a rotation limit, instead of stopping abruptly? I rotate my camera using a framerate-independent exponential ease-out blend like so:

    _x += Input.GetAxis("Mouse X") * xSpeed;
    float target = 0f; //I want to blend towards 0
    float sharpness = 0.05f; //the smaller this value, the longer it takes to settle down to the target value
    float referenceFramerate = 90f;//the approximate framerate on my developer machine
    float blend = 1f - Mathf.Pow(1f - sharpness, Time.deltaTime * referenceFramerate);
    _x = Mathf.Lerp(_x, target, blend);

This works fine.

Now my camera should be clipped at a certain rotation yaw.

The new camera rotation yaw is calculated like this:

    _CurrentYaw += _x * Mathf.Abs(_CameraDefaultPos.z);
    if (_CurrentYaw > 160f)
    {
       _CurrentYaw = 160f;
    }
    else if (_CurrentYaw < -120f)
    {
       _CurrentYaw = -120f;
    }

This clipping part of my code makes the camera stop abruptly at the maximum.

How could the above Mathf.Lerp function be adopted to make it so that the _x value would be damped more quickly when going towards the rotation limit?

sentences:
XNA 4.0 storage framework not being recognized This may be a silly question but, im unable to do any save game data because for some reason, this following namespace is unrecognizable:

 using Microsoft.Xna.Framework.Storage;

All the normal XNA namespaces work but not this one. Im ade sure to uninstall XNA 3.1, and the windows phone 7 SDK. Then i un-installed XNA 4.0 and reinstalled it. Im not sure whats wrong, but i would really enjoy some help so could get to saving some games.

sentences:
Averaging Camera Position I'm making a camera which tracks the player. I am using a basic algorithm to calculate a position for the camera relative to the player. Then I am taking an average of this over the last x number of frames. This creates a nice chase camera which always slightly lags and evens out the players movements.

Where I am running into trouble is with delta Time. How can I weight each entry in my list of previous positions so that delta time is taken into account. Currently I'm having an issue where, when the frame rate is particularly slow, the camera lags really far behind the player.

I should also mention that currently I am adding each entry ElapsedTimeInSeconds/0.01f times to give the weight. So the average is effectively over fewer frames if the frame rate is slow. I also tried entering values as Value * DeltaTime, then keeping an average of delta time to divide the values by when I get them back out of my average tracking class but that didn't work.

What I think I really want is an average over the last n seconds rather than the last n frames.

sentences:
Baking lights causes weird seams on meshes. How to avoid it? I'm trying to bake lightning in the simple scene with some imported geometry.
The result is weird seams near the edges of the meshes even there is no free space between them.
How to avoid it and just simply bake that lightning? This is just something that should not be.

sentences:
Incomplete mesh using DrawIndexedPrimitives after rotating mesh Through help on this site I was able to draw the triangles of an unrotated, nonscaled nontransformed mesh created in Blender and exported to OBJ, accurately imported through Assimp and rendered in XNA Graphics.
However after applying rotation on a single axis in Blender(Z) and adding materials(I wanted to test loading of materials through Assimp) the same mesh appears incomplete. Is something wrong with my view matrix or is it something else?

This is what the unrotated mesh looks like:

Here is the rotated mesh:

Camera, View and Projection are defined as follows:

cameraPos = new Vector3(0, 5, 9);
viewMatrix = Matrix.CreateLookAt(cameraPos, new Vector3(0, 0, 1), new Vector3(0, 1, 0));
projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 200.0f);

Rendering is done through this code:

device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
effect = new BasicEffect(GraphicsDevice);
effect.VertexColorEnabled = true;

effect.View = viewMatrix;
effect.Projection = projectionMatrix;
effect.World = Matrix.Identity;

foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
    pass.Apply();
    device.SetVertexBuffer(vertexBuffer);
    device.Indices = indexBuffer;
    device.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 0, 0, oScene.Meshes[0].VertexCount, 0, mMesh.FaceCount);
}
base.Draw(gameTime);

sentences:
Game Research Points Possible Duplicate:
  Any interesting thesis topic?

I just wanna know what are the points of research in nowadays games. As I am Teacher Assistant and I must make a master thesis and I wanted to make the Thesis about games and contribution to game society the problem that all my faculty stuff are from old era where word games mean to them cards and chess boards only so they are useless to help me in finding a research point in gaming field

also I know most of research may be in GPU stuffs (Graphics) or in AI stuffs

But when I think I don't know from where to start and how to get a good research point to work on.

So if anyone can help I will be appreciated :)

sentences:
Sample Projects/Source for Navigational Meshes Anyone aware of any sample source code that contain Navigational Meshes?

I'm aware of recast navigation (which is a little bit too complicated). - Written in C++.

Preferably C# but C++ is ok.

sentences:
Objects with custom shaders cast grayscale shadows when lightmapped Unity 5 seems to be able to calculate colored shadows from objects mapped with standart shader and legacy shaders.

What should I do to make my custom shader to cast colored shadows as well?

sentences:
ASSIMP transformation hierarchy and animations I don't fully understand the transformation hierarchy used by ASSIMP.

According to the docs (http://assimp.sourceforge.net/lib_html/structai_node.html) an aiNode's transformation is relative to its parent. Does this mean I need to concatenate its parents (and their parents) matrices with the nodes matrix to get the LOCAL matrix for the model? Or is the nodes transform already per-multiplied with all the parents, meaning transforming the nodes vertices by the nodes transform directly puts the vertices in the models LOCAL space (and not just the 'NODE' space)?
Kinda same as 1) but does transforming the vertices with the aiNodes transform put it in the "bind pose"?
What is the point of even having a transform per aiNode? Why not just pretransform all the vertices? From what I understand the counter-argument has something to do with animations... but each animation step already has its own position/scale/rotation!

Any help is much appreciated, I don't fully grasp the transform hierarchy which makes it hard to formulate good questions.

sentences:
Can 2D Rigidbodies detect collisions with 3D Box colliders? I would like to know if Rigidbody2D's can detect collisions with 3D Box colliders and/or normal rigidbodies.

I seem to have a problem where my 2D Colliders don't detect collision with my 3D Cubes. :/

sentences:
3D rotation math/code for plane I am making a simple 3D game with plane in space.
With c++ (win32).
But the plane rotation is not realistic.
The code I am using for the rotation is the following:

point3D AxisRotation(point3D point,point3D Rotation){
float sx = Sin(Rotation.x*PI/180);
float cx = Cos(Rotation.x*PI/180);
float sy = Sin(Rotation.y*PI/180);
float cy = Cos(Rotation.y*PI/180);
float sz = Sin(Rotation.z*PI/180);
float cz = Cos(Rotation.z*PI/180);
float xy,xz, yx,yz, zx,zy;
xy = cx*point.y - sx*point.z;
xz = sx*point.y + cx*point.z;
yz = cy*xz - sy*point.x;
yx = sy*xz + cy*point.x;
zx = cz*yx - sz*xy;
zy = sz*yx + cz*xy;
point.x = zx;
point.y = zy;
point.z = yz;
return point;}

The axis of the rotation needs to be (Roll,Yaw,Pitch).
Does anyone know the code or the math for it ?
Thank you. Dave

sentences:
Limit position rigidbody How can I limit the position of a rigidbody, between two values if I use this code:

public Vector3 dir;

Rigidbody rb;

void Awake()
{
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    rb.velocity = new Vector3(0f, 0f, 6f);

    rb.AddForce(dir * 1f, ForceMode.VelocityChange);
}

If I use Vector3.Clamp then the object will shake

sentences: Animate moving object I have a sphere shot out of a cannon which i need to get lined up with another sphere when and if the two spheres collide. Considering that both spheres are moving (one in X and the other is shot at the first one) how would i animate the cannon sphere to line up if the collision occurs? I can use a bool to check if collision but how do i animate the projectile in the animation tab so that the projectile takes into consideration the always changing position of the X moving sphere ?

sentences:
Fastest way to render lines with AA, varying thickness in DirectX So I'm doing some DirectX development, using SharpDX under .NET to be exact (but DirectX/C++ API solutions are applicable). I'm looking for the fastest way to render lines in an orthogonal projection (e.g. simulating 2D line drawing for scientific apps) using DirectX.

A screenshot of the sorts of plots I'm trying to render follows:

It's not uncommon for these sorts of plots to have lines with millions of segments, of variable thickness, with or without antialiasing per-line (or full screen AA on/off). I need to update the vertices for the lines very frequently (e.g. 20 times/second) and offload as much to the GPU as possible.

So far I have tried:

Software rendering, e.g. GDI+ actually not bad performance but obviously is heavy on the CPU
Direct2D API - slower than GDI, especially with Antialiasing on
Direct3D10 using this method to emulate AA using vertex colours and tessellation on the CPU side. Also slow (I profiled it and 80% of time is spent computing vertex positions)

For the 3rd method I'm using Vertex Buffers to send a triangle strip to the GPU and updating every 200ms with new vertices. I'm getting a refresh rate of around 5FPS for 100,000 line segments. I need millions ideally!

Now I'm thinking that the fastest way would be to do the tessellation on the GPU, e.g. in a Geometry Shader. I could send the vertices as a line-list or pack in a texture and unpack in a Geometry Shader to create the quads. Or, just send raw points to a pixel shader and implement Bresenham Line drawing entirely in a pixel shader. My HLSL is rusty,  shader model 2 from 2006 so I don't know about the crazy stuff modern GPUs can do.

So the question is:
 - has anyone done this before, and do you have any suggestions to try?
 - Do you have any suggestions to improve performance with rapidly updating geometry (e.g. new vertex list every 20ms)?

UPDATE 21st Jan

I have since implemented method (3) above using Geometry shaders using LineStrip and Dynamic Vertex Buffers. Now I'm getting 100FPS at 100k points and 10FPS at 1,000,000 points. This is a huge improvement but now I'm fill-rate and compute limited, so I got thinking about other techniques/ideas.

What about Hardware Instancing of a Line Segment geometry?
What about Sprite Batch?
What about other (Pixel shader) oriented methods?
Can I efficiently cull on the GPU or CPU?

Your comments & suggestions much appreciated!

sentences:
Unity 2d, Animations start distorting I'm making my first game and I just finished adding animations for walking and jumping. Everything looked good at first but with time they started distorting, even rotating (Rotation is Frozen).
This is how the character looks in the beginning:

But after some time of walking and jumping:

Did anyone have a similar error?
Can anyone Help?

sentences:
Does passing uniform constants from technique into shader cause branches? I am trying to find a way to organize my evergrowing number of shader techniques/functions (I am coding in sm_3.0). One way is to do this:

float4 PS_Crossroads(PS_INPUT input, uniform bool left_right) : COLOR0
{
    if (left_right)
        GoLeft();
    else
        GoRight();
    ...
}

technique LEFT
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertSh();
        PixelShader = compile ps_3_0 PS_Crossroads(true);
    }
}

technique RIGHT
{
    pass Pass1
    {
        VertexShader = compile vs_3_0 VertSh();
        PixelShader = compile ps_3_0 PS_Crossroads(false);
    }
}

My question is will this cause a branch at runtime or will the compiler be smart enough to split it into two separate techniques?

Thanks.

P.S. Ok I won't post this as answer, because we already have an answer by someone much more experienced than me, but from my humble tests (on different PCs) and my humble Google research, this approach (using uniform constants) is efficient and indeed forces the compiler to create different shader versions for each branch, removing flow controll completely from the finall compiled shader. I tested the compiled shader codes with Nvidia NSight.

sentences:
How to achieve highly accurate car physics such as Liveforspeed? Liveforspeed is a racing simulator, there is amazing amount of realistic physics. for example, tires get warm, tire actually deforms when you turn corners. You need to play this game with a mouse at the minimum because it almost drives like the real thing.

Anyhow, how does one achieve that level of physics simulation? Are there off-the-shelf solutions out there? If not, how does one start with simulating real world physics as close as possible.

I would love to be able to work on an opensource car physics focused game. Imagine, more passionate developers, it could keep things going.

sentences:
When should I hard-code data versus load external data? I'm a thousand or so lines of code into making my own 2D space-based game, which creates networks of randomly generated star systems and populates them with a random selection of planets, stations, ships and weapons.

There will potentially be hundreds of different stations/ships/etc that the game will need to use - so here's what I was wondering. Should I spend the time to create a 'softcoded' data-loader, which would store all of this information in (for example) XML files, and would therefore be somewhat easier to modify later, or should I simply go with what I've been doing right now - hardcoding all of the objects into the main engine of the game.

I'm the only person on the project, and as I said, it's only a hobbyist thing I'm doing in spare time away from university. But would the community recommend investing in creating an entire extra system of storing data in additional files?

What are the benefits of softcoding data in a way like this, versus simply hardcoding it all via constructors? Is there a long-term benefit to having external files that can be modified - if I'm not looking for the game to have 'mods', is it necessary to have external files? If it's just a hobbyist thing that I might give up on in a few weeks or months, should I waste time on this?

sentences:
SharpDX - Character Skinning Different in Windows Phone 8.1 Emulator and Real Device I have an engine written using SharpDX, that can load a character mesh and animation stored in a FBX file, then it renders a scene and animates a character. It is written as an Universal Windows Store App, so it runs on Windows 8.1 desktop, tablets and Windows Phone 8.1 devices. The Windows 8.1 part of the app works fine. It was a bit tricky to rewrite the code for the Windows Phone 8.1 part, because Windows Phone 8.1 only supports DirectX feature level 9_3, so I had to change some unsupported DXGI formats, compile the shaders with 4_0_level_9_3 shader profiles instread of 5_0 and reduce some attributes in order to fit 256 register limit for 4_0_level_9_3.

Now, I have this problem. When I try to run the engine in Windows Phone 8.1 Emulator, it runs fine. The character shows and animated fine. There is a tiny man, who waves his hands. See this screen:

But When I try to run the exact same code in the real Windows Phone 8.1 device, it is not doing the same. The character shows, but it is not standing and waving, instead it is in TPose and floating in space in a rotation-like movement.

It is very confusing, because it is the exact same code, only I try to run it in an emulator and real device. What could be different for emulator and real device, that it is not rendering the same thing - the thing that it should?

I've been stuck at this for over a week and I am kind of desperate now.. so thank you for any advices, comments and tips.. anything.

sentences:
Randomly generated maps in Multiplayer I am currently trying to get randomly generated maps work in multiplayer but I have so many difficulties trying to figure out how. How do other games implement this(Minecraft, Terraria, Don't starve)? My current solutions are as follows.

Generate the map client side and verify(Hash?)

This is the least bandwidth intense but the algorithm needs to be EXACTLY the same as the server side and it is the easiest to exploit.

Generate Server side and transfer to client

This method will ensure that the players all have the EXACT same map, but it it very resource intensive for the server and requires a lot of bandwidth and increased loading times.

sentences:
How to use Unity3D Social for OSX? I can't seem to find any documentation using the Social APIs with OSX. I can successfully use the iOS Social Libraries, but when I translate it over to OSX, it doesn't do anything. Also please refrain from suggesting Prime31, as I know that option exists, but the functionality for OSX leaderboards/game center is natively built into Social API in Unity 4.1+ yet there is no documentation to be found!?

I want to know how to use Social.ReportScore, and the ShowLeaderboard UI Methods for OSX games. I would also like to know how to report achievement progress.

I've tried using the EXACT methods from the Unity.Social Library that works for my other iOS/iPhone/iPad games.  I've attempted the code in both C# and UnityScript (JScript) to no avail.

Please help.

sentences: Mobile game monetization idea - pay to remove ads? Has anyone tried a free app/game with Apple's iAds with an in-app-purchase to remove the ads?  Just wondering if this works.  A friend mentioned that some apps do this... is this a common and/or "user-friendly" monetization method?  Assume the ads are "tastefully" on the home screen and not in the actual game itself.

sentences:
Starting programming in 3D with C++ EDIT: There aren't sufficient enough tutorials for what I'm trying to do in Python, so I'm going to take my time and slowly build up my skills in C++. It's hard to trip and not land in a book of C++ tutorials on game development and 3D programming.

Once I get passed the basic syntax for classes in multiple files with preprocessor declarations, what is the next step in 3D?

Do I use DirectX or OpenGL? If I use DirectX, are there sufficient enough books on the subject for a BEGINNER? Same question for OpenGL. I love programming books, I just feel that most of them are way below par - they either have good general explanations and terrible source code, or vice versa.

Thanks for your time. I'll do my best to turn this into an active discussion on the matter.

sentences:
How to import animations from one model to others I have two models (one animation in each) which I got for free from Mixamo. I imported them in Unity and they look like this:

http://imgur.com/atjQbkI

Justin@Idle and Justin@Walking.

As can be seen from the picture, they both contain only one animation (idle and walking). But in my scene I have a couple of other character models.

But I am unable to get these two animations (idle and walking) to work on any of those models at all. (I am pretty confident that they have the same skeleton, since they are coming from the same 'pack').

What are the steps I need to do in order to get these two animations to work on every character and I can trigger them by scripting in c#?

I figured out that I need to make the .fbx rig as 'Humanoid' I suppose, but since these .fbx files don't contain the animations the Animations tab does not contain anything.

This picture shows my situation: http://imgur.com/DuTQJoK

I would like to write in my code something like this:

npcObj.GetComponent<Animation>().animation.Play("idle");

or

npcObj.GetComponent<Animation>().animation.Play("walking");

I tried adding the animations in an Animation component and calling them in script like this, but the model keeps having its T-pose.

Thanks to whoever can help me!

sentences:
Separate game clocks/intervals in XNA I am making a real time strategy game in XNA. I have separated the Client (rendering, input, sound) code from the Sim (game logic).

I want to have features like replaying and fast forwarding. Also, I would like to give the Sim longer time intervals in its Update to finish its work without having to always implement time slicing to prevent frame rate stuttering.
I imagine I can do this when the two systems become decoupled and have their own update frequency.

So, how can I run the Client and Sim at two different update intervals? How should I code it?

Currently I am running with FixedTimeStep = false and using ElapsedGameTime in Update() computations. Can I create new GameTime instances to leverage this existing code..?

sentences:
C++ property is none when accessed in bp I have a class in C++ that I want to access in BP. It appears to be fine in C++ but in BP I get Accessed None errors when I try to use it in BP. Here is the class declaration that I am trying to use in BP

UCLASS(BlueprintType)
class ZOMBIEHORDE_API UQualitySettings : public UObject
{
    GENERATED_BODY()

public:

    // constructors

    UQualitySettings();

    // class functions and properties
};

I am holding on to it in the GameInstance as below so I can access it through the GameInstance reference.

CLASS(Blueprintable)
class ZOMBIEHORDE_API UZombieHordeGameInstance : public UGameInstance
{
    GENERATED_BODY()

public:

    UZombieHordeGameInstance();

    UPROPERTY(BlueprintReadOnly, Category = "Zombie Game Instance")
    UQualitySettings *QualitySettings = nullptr;
};

And GameInstance .cpp

UZombieHordeGameInstance::UZombieHordeGameInstance()
{
    QualitySettings = NewObject<UQualitySettings>();
    ensure(QualitySettings);// this passes and does not throw an error
}

This shows how I am accessing it in a widget blueprint.

So how can it be that accessing QualitySettings in BP is None?

sentences:
Circle to Polygon collision response I'm working for collision response for my 2d game. Character is represented by circle and obstacles are represented by Polygons(in my example it would be rotated rectangle for simlification). The problem is when circle collides with vertice of polygon, I know how it must work , but can't find the vector.
C - the center of the circle.
V - vertice.
P - the center of the polygon.
X - the vector I need to find.

Then I'll just move my character by vector V.sub(X).
Tried this algorithm, but it gained no result.
https://stackoverflow.com/questions/1073336/circle-line-segment-collision-detection-algorithm

sentences:
How to centralize stat/feat/equipment related changes in an RPG? I have a game with an RPG system where derived stats, like HP,armor, etc depend on a variety of components: armor, stats and feats. I'm running into an issue where the code to change derived metrics gets spread throughout the game - some is in the inventory module, another in stats module, another in buffs module.

How can I centralize and ensure accuracy of all my stat/equipment related changes to the character?

I thought that I can just create a "mega method" within the character class that would recalculate everything any time I change anything within the formula, but I don't know if this recalculate everything is a good practice, or if there are potential pitfalls with this approach down the road.

One of the complications with the complete rebuild that I see is that I will have to keep track of the player's HP and properly restore it after rebuild is complete.

sentences: glBindVertexArray very occasionally causes crash I'm writing a game in an engine of my own design. Very occasionally, and without much cause, when I come to render the post processing result to a quad, the glBindVertexArrays crashes. It actually doesn't crash on that thread, it crashes in the nVidia GPU thread on an instruction called "INT E29".. I don't know machine code very well. Anyway reading up about this, it looks like it could be something to do with putting the wrong stuff in VAOs but when this crash happens I will have rendered it for a good minute at 400+ fps already, and the VAO wouldn't ever been called other than on initialisation. Any ideas?

sentences:
How to import character from Blender to Unity? I am trying to import a character into Unity from Blender. I exported the model (which has actions/animations) from Blender as a FBX file and dropped in into my Unity project’s Assets folder. The model with all of its components (mesh, armature, animations) appears in the project window; however, Unity doesn’t immediate associate the animations with the model when I drag an instance of the model into my scene.

I have also imported a Blender default model (“Constructor” - a man with red overalls and a wrench), and have been comparing the settings of my model to the Blender model in order to find discrepancies.

3 observations I have made:

Blender’s model is automatically assigned an “Animation” window in the Inspector panel (image #1), while mine is assigned an “Animator” window (image #2). Since the former window is the one where the animations are listed and you assign the default animation, it seems like this one is crucial. How do I import my model such that the “Animation” window appears in its Inspector window? (I’ve tried adding an “Animation” window myself, but it doesn’t recognize the model’s animations as the Blender model’s “Animation” window does.

In Unity, my model’s animations all begin at -1.0 (even though they begin at keyframe 0 in Blender) (image #3). For each animation, I get the message, “The clip range is outside the range of the source take.” I get this message even when I move the animation forward several keyframes in Blender and re-export the file to Unity as a FBX.
I compiled several of my actions into an animation that I then exported as a .mov file, and this is the sequence of actions that begins when I press “Play” in Unity. When I deleted this animation from Blender (as I thought this was the issue), my model now does nothing when I press “Play.”

I am using:

Blender 2.67 and Unity 4.1.5f1

My actual question: How do I import my character into Unity such that it is automatically assigned an “Animation” window?

I have been struggling with this issue for several hours now, and none of the online tutorials or forums seem to address it.

sentences:
How to receive broadcast message in Unity? I am trying to get the broadcasted message in overridden method of NetworkDiscovery.OnReceivedBroadcast(). For that what I had done is below:

I create class which implements NetworkDiscovery where I override the method OnReceivedBroadcast() to capture the broadcast messages.
In Unity Editor, I created an empty GameObject where I add the class in step #1 as component.

Now in code, I started the custom NetworkDiscovery class as below:

Discovery.Initialize();
Discovery.StartAsClient();

Now, when I start the broadcast in server, I am not receiving any broadcast message in OnReceivedBroadcast().

Below is my custom NetworkDiscovery class.

public class CustomNetworkDiscovery : NetworkDiscovery
{

// Use this for initialization
void Start()
{

}

// Update is called once per frame
void Update()
{

}

public override void OnReceivedBroadcast(string fromAddress, string data)
{
    base.OnReceivedBroadcast(fromAddress, data);
}
}

One thing I noted is, If I use the NetworkDiscovery component directly in step #2; instead of using custom NetworkDiscovery class. I am able to see broadcast messages in it's default GUI.

How can I receive the broadcast message in the inherited class?

Any help will be appreciated.
Thanks.

sentences:
Spriterenderer on top of canvases I have two canvases. One with a background image and one with all overlaying elements like texts and such.

The background canvas has an order of 0, the overlay canvas of 1.

Now, I'd like to create an animating sprite on top of those canvases but I can't for the life of me get the sprite on top of the other images.

I can see the sprite being on top on the stage, but when I switch to gameview, it's gone! There are no scripts attached to the sprite. Only an animator(Which works fine when I play it).

Note:

My canvases have a render mode of
Screen space - Overlay.
I've set the spriterenderer on
Sorting Layer 9, order 300. Although
it's  the only sprite out there.
layer 1 or order 1 didn't do anything
different, though.
The other elements in the canvases are either UI texts or Images
All the elements in the canvases are on either BackgroundLayer or OverlayLayer
The canvases themselves are on the UI layer

sentences:
Resolve Unity error about "Constructors and field initializers" on the loading thread The code below is producing an error message I don't understand:

  Constructors and field initializers will be executed from the loading
  thread when loading a scene. Don't use this function in the
  constructor or field initializers, instead move initialization code to
  the Awake or Start function

I don't know where the problem is in my code or what I need to change - can someone please explain?

var XPos : float = transform.position.x;
var YPos : float = transform.position.y;
var ZPos : float = transform.position.z;
var Waiting : float = 0.02;

function OnTriggerEnter (col : Collider) {
    if (col.gameObject.tag == "Player") {
        this.transform.position = Vector3(XPos, YPos+0.1, ZPos);
        yield WaitForSeconds(Waiting);
        // ...similar code omitted
        transform.GetComponent.<Collider>().isTrigger = true;
        Destroy(gameObject);
    }
}

sentences:
How do I handle specific tile/object collisions? What do I do after the bounding box test against a tile to determine whether there is a real collision against the contents of that tile?  And if there is, how should I move the object in response to that collision?

I have a small object, and test for collisions against the tiles that each corner of it is on.

Here's my current code, which I run for each of those (up to) four tiles:

// get the bounding box of the object, in world space
objectBounds = object->bounds + object->position;
if ( (objectBounds.right >= tileBounds.left) &&
     (objectBounds.left <= tileBounds.right) &&
     (objectBounds.top >= tileBounds.bottom) &&
     (objectBounds.bottom <= tileBounds.top))
{
    // perform specific test to see if it's a left, top , bottom
    // or right collision. If so, I check to see the nature of it
    // and where I need to place the object to respond to that collision...
    // [THIS IS THE PART THAT NEEDS WORK]
    //
    if( lastkey==keydown[right] && ((objectBounds.right >= tileBounds.left) &&
                                   (objectBounds.right <= tileBounds.right) &&
                                   (objectBounds.bottom >= tileBounds.bottom) &&
                                   (objectBounds.bottom <= tileBounds.top)) )
    {
        object->position.x = tileBounds.left - objectBounds.width;
    }
    // etc.

sentences:
Techniques for drawing lines, with mouse, on 3D objects in WebGL or OpenGL? Can anyone point me to techniques for drawing lines, with the mouse, on 3D objects in WebGL or OpenGL?

Here's the effect I'm looking for, using WebGL: http://www.spacegoo.com/cadillac/

I can imagine the general idea - projecting a ray onto the surface, then perhaps using normals and UVs, transform the intersections into UV-space and drawing the line on a texture, which gets mapped onto the object.

Would love to find some proper literature on it though.

sentences:
Weird blending behavior on PowerVR SGX544MP2 On PowerVR SGX544MP2, sometimes blending behaves in a very strange way for me.

Instead of blending with the actual color from the previous draw calls, it tries to blend with black:

(sorry about the low quality, it's not my tablet and not my photo)

Some polygons render correctly, however (that blue hit decal on the left (which is blended with black in the middle, however), the beam and the HUD), but certain decals are broken.

How do I fix or work around the problem? It seems to be related to deferred rendering of tiles, but I don't really know. On other GPUs, it looks alright.

sentences:
How can I implement audio stop/pause/resume in Java? In Java, we can play audio like this:

audioInputStream = AudioSystem.getAudioInputStream(audio);
AudioFormat audioFormat = audioInputStream.getFormat();
DataLine.Info info = new Info(SourceDataLine.class, audioFormat);
sourceDataLine = (SourceDataLine) AudioSystem.getLine(info);
sourceDataLine.open();
sourceDataLine.start();
floatVoiceControl.setValue(-20);
byte[] buf = new byte[0xFF];
int onceReadDataSize = 0;

// look at here
while ((onceReadDataSize = audioInputStream
     .read(buf, 0, buf.length)) != -1)
  sourceDataLine.write(buf, 0, onceReadDataSize);

Seems that we can play audio by doing some initializations and create a loop that continuously do sourceDataLine.write.
So, I think I can implement pause/resume by changing the last few lines to:

// look at here
while (true) {
  if (!paused)sourceDataLine.write(buf, 0, onceReadDataSize);
  onceReadDataSize = audioInputStream.read(buf, 0, buf.length);
  if (onceReadDataSize == -1) break;
}

But it doesn't work -- it just stop when I set paused to true in another thread, and when I set it back to false, it doesn't resume.

Is there any workarounds? Or is there any alternative Java audio library?

sentences:
Is it legal to use a generic celebrity names in a card game? Before tagging this as a duplicate to
Legality of using names in a game?, please be aware that it is a more special case than that generic question

So I am working on a card game similar to Cards Against Humanity, where some cards would have celebrities names, the case I am interested in is if the celebrity name is too generic that they can't really claim that this name can only be them, specially there is no context where their field of famous is referred to to confirm the identity.

Example

Lady Gaga - no one can argue that this name doesn't refer to the known celebrity.

But

Will Smith - is too generic, searching linkedin or facebook you will find thousands of people called Will Smith.

I guess if the card says the actor Will Smith then that is different.

Am I wrong in this assumption?

sentences:
Create shape from points / lines in editor and mathematically calculate nearest points within shape If I want an editor that accepts "points" of a minimum of three (a triangle) and I just add some points first, like this:

how can I mathematically connect these corners (points) into an object of multiple triangles? so amount of triangles looks like something like this, by connecting nearest point:

and then later render this and also being able to define what it is and check for collisions on this ground, so I can create more than Rectangle based "bricks" on a Platformer for example. Also being able to texturize the whole object without it looking ugly.

Any ideas? Or what is this called in game programming?

sentences: Game Characters vs Characters in other medias How do a characters designed for a game differ from characters made for books or movies? When a book or a movie is converted into a game, what are the differences and similarities that have to be addressed? Are there pitfalls in character design when jumping between these different medias?

sentences:
Performance cost of using character collider? I am attempting to get an update to this question: https://answers.unity.com/questions/57680/should-a-character-controller-attach-with-rigidbod.html
There are conflicting answers. From my understanding since the character controller uses a collider with no rigidbody attached there will be a performance penalty.

"You should never move a Static Collider on a frame by frame basis.
Moving Static Colliders will cause an internal recomputation in PhysX
that is quite expensive and which will result in a big drop in
performance. On top of that the behaviour of waking up other
Rigidbodies based on a Static Collider is undefined, and moving Static
Colliders will not apply friction to Rigidbodies that touch it.
Instead, Colliders that move should always be Kinematic Rigidbodies."

On the other hand there is another answer that says:

"The character controller (CC) - at least as implemented in PhysX,
that is a kinematic CC - is a very specific piece of code working
alongside (but outside of) the main physics simulation (rigid body
dynamics). Although the CC do use a capsule collider, the collision is
typically performed "by hand" in the CC code rather than automatically
through the physics simulation like other colliders."

Does anyone have more insight into this?

sentences:
Webgl, weird rendering with sprite that has alpha So I have a webgl application where I render all kinds of objects, but in this specific example, I have two shaders. One that renders sprites and one that renders colored polygons. In this example I draw a rectangle and two sprites. The rectangle is drawn first and the sprites are drawn second. The rectangle has a lower z and the the sprites have the same z that is higher then the rectangle. This is the result with depth test function of gl.LESS and gl.BLEND enabled with blend function gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA). The texture is a png. Here is the result

This is not the correct result obviously as the sprite below is somewhat cut off. Also, if I draw the sprites before the rectangle, I get this

At first, I figured that that black around the sprites was just the pixel not being blended as alpha, but as it turns out from changing the clear color, that black is actually the background, so it looks like the rectangle is literally being cut out.

What could cause this behavior?

There is a lot of code, so tell me what is relevant and I will post it.

sentences:
Using an array of 3d points to construct point cloud or surface in OpenGL I have an array of 3 dimensional point objects, I can manipulate the input into this array into any configuration I want, for example, it could be a vector of floating point numbers, a vector of ints, etc.
Anyway, I want to display this 3d point cloud using OpenGL.  How should I go about doing this? I know enough that I can create a 3d cube from structured inputs but how would I go about creating vertices from this unstructured input?  If I don't need to construct these vertices how would I go about simply displaying these points as a cloud?  Any suggestions or advice is welcome.

sentences: How can I run a Node server on the player's machine? I'm making a game with Unity. The game's multiplayer server runs on Node, but it's only run on my own machine. How do I bundle Node to my game's installer to install it on my player's machine?

sentences:
InvalidCastException in Farseer's raycasting when trying to use the built-in explosion class? I'm trying to create an explosion at the point that two entities collide, but whenever explosion.Activate() is called, it causes an InvalidCastException to be thrown in Raycast(), on the line that returns the callback.

return callback(fixture, point, output.Normal, fraction);

Is this a bug in Farseer, or am I doing something wrong? It doesn't appear to be a known issue.

sentences:
Clicking on a canvas getting polygon I'm using Canvas to create polygons like this:

http://bl.ocks.org/mbostock/6675193

I want each of those polygons to represent a clickable province. How do I know which province is clicked when the user clicks on something? I have a list of vertices (thousands) but I feel like each time looking for the closest vertex is too slow (I think I might be wrong). What's a fast way to do it? Thanks.

sentences:
Multiple colored textures vs Color Overlay Let's say we're using DirectX 9/10/11. In our game we have a character wearing armor.

The armor has 50 different color variations.
So, if armor is red, the first method would load the red texture from file.
The second method would display the 1 base texture, with a red overlay.

Code wise the overlay armor would just contain an extra flag that would specify color.

Is it faster / more efficient to load different textures in? Or, is it faster / more efficient to color the texture on the fly?

I'm not aware if there is some huge overhead for dropping a tint over a texture...

sentences: Is there a library like ImGui with the ability to customize frames, buttons, sliders, etc. in the windows for OpenGL I'm trying to write a game on OpenGL using C++. From third-party libraries for creating windows (widgets?) Inside OpenGL, I was able to add ImGui to my project, create a window and attach some functions to it. But I did not find information like changing the style of this window. Specifically, in this situation, I need to create the starting window of the game (start the game, settings, exit, etc.) and create in-game windows (inventory, character menu, minimap, chat, etc.). I heard about Qt, but given the size they require, my program will weigh 3-4 times more than we would like. In addition, I do not need any super high-quality graphics and a large set of visualization capabilities. I would like to understand what my program consists of and have a set of basic concepts about how this is implemented. Could you advise: is there a similar library with the ability to create and edit the style of in-game windows (maybe in ImGui this function is still there?) with open source code in C++?

sentences:
Unity3D multi-threaded data importer? Goal

I would like to be able to separate all my data file readers from the main thread and balance the load over multiple frames. The idea being that while the data is being read/parsed/filtered I can continue playing the game at a decent FPS and show a loading progress bar while the results of the file importing pop in one at a time when they are ready.

Information

The data files contain things like transform information for objects, points to be used in runtime mesh generation, and terrain data. They all have to be parsed, filtered, and/or modified to be ready to be used in the scene.

I already have import code for the project I just need to transplant it from blocking my main thread and being done in one frame to a multi-threaded and multi-frame approach.

Thoughts

I have little experience in multi-threading so this is also a learning project for me. I would appreciate all your comments, input, code samples, and pointers.

From my perspective I need to create a queue of tasks. Each task being a file to load, read, parse, and filter. Then if a CPU is open a task is taken from the queue and is given a thread to be executed on that CPU. The task completes and gives the resulting data back to Unity3D for it to handle.

Questions

Does a heavy load on other CPUs freeze the game like it would if it were on the main thread, and thus require some sort of system where you yield for one frame if execution time is taking too long?
How do I receive progress updates from the tasks to be used in a interface progress bar via some sort of co-routine?
If a user only has one CPU how would this system handle the situation? Is that even a realistic scenario?
What sort of C# classes (usable in Mono's subset of the .NET runtime) already exist for multi-threading and task queuing that can save me time?

sentences:
Uncontrollable platform spawning I made simple spawner like this:

void Update() {

    if (PlatformPosition.spawnNewPlatform) {
        NewPlatform();
    }
}

public void NewPlatform() {

    if (active) {
        newTransform = transform;
        Instantiate(prefabs[Random.Range(0, prefabs.Length)], newTransform.position, Quaternion.identity);
    }
}

And so it looks like my platform script:

public static bool spawnNewPlatform = true;

void Awake() {
    spriteSize = GetComponent<SpriteRenderer>();
    offscreenX = (Screen.width / PixelPerfect.pixelsToUnit) / 2 + offset;
}

void Update () {

    pos = transform.position;
    posX = pos.x;

    if (posX <= -offscreenX) {

        spawnNewPlatform = true;
    }
    else {
        spawnNewPlatform = false;
    }
}

Now when I start the "game" the spawner create unexpected number of platforms. Sometimes it's 2 clones sometimes it's 10...
I don't understand what is the problem and how to fix it. Is it frame rate issue?

sentences: Distributed Leaderboard for p2p games I've heard about this term distributed leaderboard for p2p games and I've searched it online but couldn't find much of a thing about it.I was curious what does it really mean and didn't really knew where to ask.Do you guys know what does it mean to have a distributed leaderboard? it's something like a global leaderboard but for p2p players?

sentences:
Unity3D and Texture2D. GetPixel returns wrong values I'm trying to use Texture2D set and get colors, but I encountered a strange behavior.
Here's the code to reproduce it:

Texture2D tex = new Texture2D(2,2, TextureFormat.RGBA32 ,false);

Color col = new Color(1.0f,0.5f,1.0f,0.5f); //col values: 1.00, 0.500, 1.00, 0.500
tex.setPixel(0,0,col);
Color colDebug = tex.getPixel(0,0);  //col values: 1.00, 0.502, 1.00, 0.502

The Color retrieved with getPixel is different from the Color set before.
I initially thought about float approximation, but when inspectin col the value stored are correct, so can't be that reason.

It sounds weird even a sampling error because the getValue returns a value really similar that not seems to be interpolated with anything else.
Anyway I tried even to add these lines after building the texture but nothing change:

this.tex.filterMode = FilterMode.Point;
this.tex.wrapMode = TextureWrapMode.Clamp;
this.tex.anisoLevel = 1;

What's my mistake? What am I missing?

In addition to that. I'm using tex to store Rect coordinates returned from atlas generation, in order to be able of retriving the correct uv coordinate of an atlas inside a shader. Is this a right way to go?

sentences:
VBO in a class doesn't draw when The class has a destructor I am making this class QuadTemplate

class QuadTemplate
   {
    public:
    QuadTemplate()
    {
        vbo=0;
        uvbuffer=0;
        vao=0;
        TextureID=0;
        vboType=0;
        drawStart=0;
        drawCount=0;
        programID=0;
        TextureShaderID=0;
    }

    ~QuadTemplate()
    {
        glDeleteBuffers(1, &vbo);
        glDeleteBuffers(1, &uvbuffer);
        glDeleteProgram(programID);
        glDeleteTextures(1, &TextureShaderID);
        glDeleteVertexArrays(1, &vao);
    }

    GLuint vbo;
    GLfloat vboData[12];
    GLenum vboType;

    GLuint uvbuffer;
    GLfloat uvDate[8];
    GLenum uvType;

    GLuint vao;

    GLint drawStart;
    GLint drawCount;

    GLuint TextureID;
    GLuint TextureShaderID;
    GLuint programID;
};

this class like the name says is a template where I store all the Vbo's date, it doesn't have any other function because I have a function that give it the values, the problem is when I try to draw the Vbo, it doesn't work, not only that it also presents some graphics mistakes, but when I comment the destructor, it work perfectly fine. why it doesn't work with the destructor?

sentences:
Tags changing automatically on iOS build! First let me tell you that game runs fine in the editor. I check for hitting an enemy via a tag comparison and as I said it works correctly in the editor but when I deploy to my iPad and attach remotely with with MonoDevelop, I can see that the same object I'm checking against in Editor and had "Enemy" tag now has another tag, "Door".

Even before character doing anything, their tag is changed to "Door".

It's actually in the main menu and before running much code so I'm fairy certain it's not my code.

I'm sure there is nowhere in the code that I'm changing the tags.

And my specs: Unity is 5.6.1, Xcode is 8.3.3 and my iPad iOS is 10.3.2 and my macOS (OS X) is 10.12.5
(Tried with both Append and Replace builds)

Thanks

sentences:
Environment mapping - cube mapping using OpenGL I'm trying to do cube mapping.
Problem is that I'm getting this:

This is what I get when I rotate it:

But it should look like this

Here is code for vertex shader

varying vec2 tex_coord;

void main()
{
 vec3 v = vec3(gl_ModelViewMatrix * gl_Vertex);

 gl_TexCoord[0].stp = normalize(gl_Vertex.xyz);
 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

 //gl_ModelViewMatrix * gl_Vertex
}

fragment shader

uniform samplerCube _tex;
void main()
{
 //gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
 gl_FragColor = textureCube(_tex, gl_TexCoord[0].stp);
}

Could you please tell me what am I doing wrong?

sentences:
Save Script Doesn't Save Item Variables I've been working on an RPG videogame, and I have been trying to implement a Save button into my game, which is supposed to save the player's itemAmount variable, which is in another script, called ItemInformation. I retrieve the itemAmount variable at Start() by getting the script from the itemHolder GameObject. I plan to use this script in multiple GameObjects, because I use the same variable (itemAmount) with different values in different GameObjects. For some reason, I don't receive any errors or warnings in the Console. Here is my script to the Saving System:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class InventorySave : MonoBehaviour
{
    // Public variables for inventory and health
    private GameObject itemHolder;
    private ItemInformation myItemAmount;

    // Initiates before the first frame
    void Start()
    {
        // Gets components for the player variables
        itemHolder = transform.gameObject;
        myItemAmount = itemHolder.GetComponent<ItemInformation>();
    }

    // Function that will be called when player saves game from pause menu
    public void SaveGame()
    {
        // Creates file to store variables
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/SaveData.dat");
        SaveData data = new SaveData();

        // Gets the player data
        data.itemSave = myItemAmount.itemAmount;

        // Writes player data to file and encrypts it
        bf.Serialize(file, data);
        file.Close();
    }
}

// Holds data that is to be saved
[Serializable]
class SaveData
{
    // Variables for save file
    public int itemSave;
}

sentences:
How to implement the server-side game loop? The server needs to handle the physics, because all the movement will be handled by it. So for that I need a game loop. The thing  is that the server doesn't have the render part, it's just a console.

All the posts I found on the internet were involving the render part. I'm not stupid, I know I should not take in consideration that part but then which type of loop should I use? (fixedtimestep, semi-fixed). My game functionality would resemble League Of Legends or Dota 2 functionality.

Actual questions:

1.What is the server functionality for this type of game?

2.What does the game loop look like?

Additional info: I use libGDX for the client part, and JBox2D on the server part, KryoNet for Networking and thinking of using lwjgl (only the System class) for Native timers.

sentences:
Synchronize points from UI and server I am sorry in advance if it's not perfectly clear.

I would like to make a game with let's say the following map (in real it will be a 3D globe).

Now this map contain point, and each point is a place where user can build stuff.

The distance between point is very important, and also, the location of each one of them (not on water and equally distant to each others)

The problem I face, is I don't know how to sync the point with the server. explaining :

I want the point to be equally distant between each others, and only on lands. Generate them is easy from the game itself. but since the game will have a server that control what is build on each case by multiple player, I should generate them in the server. but I don't know how can I do this. since only the game itself know the map and where it can place the point.

Should I generate them in the game, than copy the amount I can fit and write it in the server like if i can fit 200points, I make the server generate 200 points with id from 0 to 200 and the UI will draw them in order ?

I need a little help to find the good direction to explore.

Thank you

sentences:
Having trouble defining a FindMyTag I'm not a coder, im an artist, so this stuff doesn't make a ton of sense to me. I know enough to know I don't know enough, and i'm old enough to know my brain doesn't 'get' code... that said for context of what level of help I need :) ...

I'm trying to get an AI path based on an object tag. When I instantiate the object this script is on, it should look for 'mytag' on another object in the scene, and set that as 'target'

    public class pickAItarget : VersionedMonoBehaviour
    {
        /// <summary>The object that the AI should move to</summary>
        private Transform target;
        public string mytag;
        IAstarAI ai;

        void Start()
        {
            Debug.Log(GameObject.FindWithTag("mytag"));
            GetComponent<pickAItarget>().target = GameObject.FindWithTag("mytag").transform;
        }

The script compiles fine and im able to put in the tag I want to find in the inspector but when the object instantiates I get

UnityEngine.GameObject.FindWithTag (System.String tag) (at C:/buildslave/unity/build/Runtime/Export/Scripting/GameObject.bindings.cs:195)
Pathfinding.pickAItarget.Start () (at Assets/Scripts/pickAItarget.cs:26)

I feel like I HAVE defined mytag, but obviously I don't understand something.

sentences:
Effect of vertex winding on normals and shading I have implemented a Phong and Gourand shader for a triangle mesh that is being imported from an STL file. It appears to be working fairly allright but some triangles seem to be what I can only describe as upside down due to lack of better wording. This effect is visible in both shading models albeit a bit smoother in Phong. Here is an example:

On something basic like a cube the rendering is perfect. I am no expert but from what I have read, I am lead to suspect that perhaps the winding of the vertices in the mesh might be causing normals that are somewhat incorrect. Could this be possible and if so, how does one correct for that?

The effect of interpolating the normals by either division or by area weight does not really make too much of a difference. I can also confirm that the normals that I am calculating are basically the same as those that come with the STL as calculated by FreeCAD. The manually calculated normals are slightly better though because they are area weighed. They are calculated as follows:

glm::vec3 e1 = vecs[1] - vecs[0];
glm::vec3 e2 = vecs[2] - vecs[0];
faceNorms[i] = glm::cross(e1, e2);

with "vecs" being the 3 points of my vertices. I then sum up all these area-weighed normals for each face that uses a normal and finally normalize that.

PS. FreeCAD renders the mesh in a "flat" fashion and I guess thereby avoids this issue but unfortunately rendering "flat" with GLES 2.0 is a bit of a performance waste from what I have read.

sentences:
Rotate around a 3d Object (Software Renderer) I have a simple 3d software renderer (SDL / C++) which can load a 3ds Model and render it (shaded) and rotate it around X Y Z - Axis.
Now I would like to rotate / move around the object, meaning, the object itself stands still, and everything in the scene is displayed from the angle of the view. Is that what a camera in 3d engines does, and how would I implement something like this ?

(No OpenGL / DirectX is used, just plain software)

sentences:
How to let players connect over the internet via TCP? We are making a 2 player game, using a Client/Server architecture and need a way to connect over the internet.

Connecting in the same network is no problem and works flawlessly. Will it be a lot of work to implement a way to connect online, that players can use (so nothing where they need access to the router settings)? And how would it be done?

I couldn't find a single tutorial or thread talking about this. They all just connected to the localhost.

(using gamemaker studio 2 and it's built in tcp networking functions)

  edit:

  The server regularly sends broadcast packages to all ip's, while the
  client reads their origin ip and can then connect to said ip. They
  both are on the same subnet so the adrress is 192.168.0.xx.

  I also have a way to get the public ip (95.xxx.xxx.xx) using a http
  get from ipv4bot.whatismyipaddress.com. But when trying to connect to
  the server, using the public one, I't won't connect (doesn't matter if
  both are on the same network).

sentences:
How do client-server cooperation based games like Diablo 3 work? Diablo 3 cooperates with Blizzard servers even during single player games. In fact, Blizzard has had problems with the games "melting their servers."

I would like to ask: How do the client and the server communicate? What details does the client leave to the server, and vice versa? What details are redundant - both the client and the server know - and how often do they disagree?

The previous paragraph contains the important questions, but I have a few more that I must explain my motivation towards. I am interested in the programming of botting. Ethical botting - I don't plan on actually abusing the automation to run 24/7. I just find it to be a great programming challenge to glean information from a game, and then make decisions from that information. I am stuck in the starting gate. The unofficial questions from this post would be: How can I make a bot (language, tools, libraries)? Can I get information through the communication between client and server, rather than the brute force pixel detection easily used in more static games?

There probably is a trust issue, and to that all I can say is that I promise not to abuse the answers. But please feel free to answer any of the questions you feel comfortable with. Thank you!

sentences:
Character Controller + Lag = Massive Teleportation Through Walls I'm working on a fairly robust game with another developer and we've been having a really serious issue with (I believe) the character controller. Specifically, if there's ever a large lag spike (as there are somewhat frequently - the code's not well optimized in some parts) there's a chance that the character controller will wing right through all nearby colliders and fall out of bounds.

It happens pseudo randomly, but I've noticed that it seems to be somewhat predictable, such as standing next to certain objects (nothing weird about them - just tables with colliders).

The lag often is a cause of large chunks of a level having SetActive(true) called on them in one frame or multiple objects being instantiated in one frame. These objects sometimes have colliders/rigidbodies attached but don't seem to be in any direct contact to the character controller.

I can very consistently make it happen by moving towards certain walls (again, very normal walls) and alt-tabbing while my character is still moving also seems to cause the issue predictably, which is VERY strange.

Has anyone ever experienced anything like this with the character controller? I'd give a code sample but honestly not even sure where from the codebase would be pertinent other than

if (Time.deltaTime < 0.15f)
{
    if (applyGravity && noClip == false)
        moveDirection.y -= gravity * Time.deltaTime;

    controller.Move(moveDirection * Time.deltaTime);
}

Which seems awfully straightforward to me. Obviously moveDirection gets changed elsewhere in the function too but it's all similarly bland. I'm pretty experienced with this sorta' stuff and it doesn't ring wrong to me at all.

Some other stuff.

Checked that moveDirection isn't a huge number

Tried eliminating Time.deltaTime from the equation

Fairly sure colliders aren't ending up inside of the player while a lag spike happens (again, alt-tabbing will do it too)

Geometry surrounding the player is clean (box colliders, mesh colliders on well-developed meshes)

Nothing strange like rapidly setting any components on or off is happening to my knowledge.

Anyone have any experience with this sort of issue?

sentences:
How can I rig an SVG humanoid? I have a template SVG file for an articulated doll and it looks something like this:

I can manually rotate and pose it in Adobe illustrator, but is there a better workflow to rig 2D segmented assets?

sentences:
Change animation speed of a 3D model I am working on a small simulator. There is a 3D character on the screen and it randomly plays an animation (I used animation.PlayQueued(...) command inside a for loop).
Now I have added a slider ( GUI.VerticalSlider ) on screen. I want to change the speed of all playing animations of 3D character when change the value of slider.

I know to use animation["animationNane"].speed=xx; but my problem is I have to pass the parameter of animation name that I want to change the speed . but actually I don't want to change the speed of specific animation clip. I want to change the speed of whatever the animation running in my 3d character. How can I change the speed of whatever animation is playing?

sentences:
Multiplayer Game - Node.js syncing other players' position I'm creating a multiplayer platformer game with 4 players in multiple rooms. I've read a lot of articles and researched about client prediction and lag compensations. I think I can somehow manage to understand how to update "my client". But what would be the best approach in the multiplayer platformer game to update "other clients". This is what I'm thinking:

Approach 1: the client sends input "left" to the server -> server increases the velocity of the player -> the server sends the actual input "left" of this client to all other clients -> other clients run the physics on the input.

Apporach 2: the client sends the input to the server -> server adds velocity, update state -> game loop in server updates the position of every single client back to everyone, sends it to all clients -> client gets it and updates.

What would be a better approach? or please if there is a better approach, tell me I am very stuck..

sentences:
Specular intensity of non-metals(plastics) in metalness pbs workflow The specular color in metalness/roughness workflow is usually defined as following:

float3 specColor = lerp(0.03f, albedoColor, metallic);

The Cook-Torrance BRDF is given with the following formula:

The final color will be:

Ci = (diffColor*(n.l)+Ks*specColor*cook);

My question is - won't specular be too dim for non-metals? Cook-Torrance term will be multiplied by 0.03 in case of dielectrics - this will make the specular component virtually non-existent. This doesn't seem realistic to me, because smooth plastic reflects a lot of light, almost as much as metals:

What am I missing?

sentences:
How to move from A to B, with check and fix the destiny? I only found the formula for check the collision between two lines. But never about of movement and fixed from one point to other point in one of the line.

I need move from pA to pB and if take collision in one line (wall), move around before of the wall to the new destiny point fixed.

Where found this and/or which is the formula?

sentences:
How to run multiple Lua scripts within the same lua state without conflict I've been working with Lua for sometime and there is a problem that I could never solve it. First, I'm using a single lua state to have a connection between my scripts so they could transfer data via global table _G.

My scripts have a template like this:

-- Vars
local somevar = 0

-- Update
function Update()
  -- stuff
end

I call Update() function from my application every game step, but since there are other scripts loaded in current lua state with the same template only the Update() function from the last chunk in lua is getting called and there is no way I can call all of Update() functions in my scripts.

If I load my scripts every time I want to call the functions, It'll work the way I want, but this way my local variables and every change that I have made to the scripts would get dumped because the chunk is replaced with a new one.

I've seen a message on Lua's site itself which talks about setting an environment for each chunk that is going to get loaded, but that's not what I want because it forces each script to reside in a unique table and there is no way to communicate with global table since we're going to override the global table for our unique tables.

I'd really appreciate if someone give me some advice because there isn't really much on the internet about these kinds of stuff.

UPDATE

I know the answer to first part of my question. Right now I'm using a table for each of my scripts, something like this:

code1.lua

code1 = {}

function code1.Update()
  -- Update
end

This makes every script accessible via the global table with their table name. The problem is if I load this script for another object in my game, then it'll conflict with the previously loaded script because they're both using the same source and therefore the same names and I can only access the last loaded. As you can see, I've stated this about environments in first part of my question.

sentences:
1-bit game - How to change the palette for the entire game at runtime? So I'm making a 1-bit color game, and would like to have an option in the menu to change what those two colors are so the player can adjust it to their liking. What is the simplest and/or best method to go about this? This would apply to the entire screen, not individual sprites/meshes, as I want to preserve the 1-bit color look.

Most of my assets are sprites, with a few flat meshes that are rendered without anti-aliasing so that they blend in with the sprites. They're all exported with the two standard colors I'm using (a yellow-ish off-white and a dark grey-ish-blue), but I can go back and re-export them in black and white if that is necessary for the suggested method.

My eventual plan is to support the basic black and white, a few monochrome monitor color schemes, and some color combinations that you'd see on 8-bit computers (C64, Apple, etc.).

sentences:
My object just automatically "launch" or do stuff without me clicking on my mouse when it respawn? I've already set the ball (my object) initially at the start where I have to click for the ball to launch from the paddle (it's a ping pong game).
private void LockBallToPaddle() {
    Vector2 paddlePos = new Vector2(Paddle.transform.position.x,
        Paddle.transform.position.y);
    transform.position = paddlePos + paddleToBall; //For the ball to stick to the paddle
}

Launch the Ball:
private void LaunchBall() {
    if (Input.GetMouseButtonDown(0)) {
        hasStarted = true;
        rbBall.velocity = new Vector2(Random.Range(-2f, 2f),speedVelocity);
    }
}

Both of which I put under Update()
private void LaunchBall() {
    if (Input.GetMouseButtonDown(0)) {
        hasStarted = true;
        rbBall.velocity = new Vector2(Random.Range(-2f, 2f),speedVelocity);
    }
}

Now the problem is when my ball hits a certain collider, I want it to respawn the position back to the paddle. So instead of Destroy the game object, I just copy and paste those same methods under collision
if (collision.gameObject.tag == "bottom") {
    LockBallToPaddle();
    LaunchBalls();
}

But now it just launches straight away from the paddle when hit the collision without me clicking anything like what "Launchballs()" intended to. What should I do?

sentences:
Efficient unwrapping on multi hard edge object I'm having trouble unwrapping this without creating hundreds of seams which massively increases the vertex count in the game engine (Unity).

I've tried the various projection methods without much success. Three planar maps (45 deg looking down, 45 up and one side) yielded the leat amount but still dozens.

I've tried all sorts of manual seam drawings but can't figure out what would be optimal so I'm looking for suggestions.

Regarding the texture having contiguous seams doesn't really matter.

Cross posted on Blender Stack Exchange

sentences:
Obfuscating Monogame assets I'm obfuscating spritesheets. I've already encrypted the .txt file dictionaries. Now I'd like to perform binary serialization on the image files. Texture2D does not allow for this though, probably because it's coupled to the ContentManager and by extension the Graphicsdevice.

The solution I'd like to go for would be serializing the image files in a single wrapper object in the obfuscation code, and deserializing it when the game is loading. However, Content.Load<Texture2D>() will only take the asset name as parameter. Is there a workaround, or am I looking at this problem the wrong way?

sentences:
Input.GetAxisRaw not returning zero after releasing the key In my WebGL Project here is the way for camera navigation (Movement/Rotation) on Update event:

void UpdateMovement()
    {

        bool accelerate = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
        moveDirection   =
            new
            Vector3(
                Input.GetAxisRaw("Horizontal") * moveSpeed,
            0,
            Input.GetAxisRaw("Vertical") * moveSpeed);
        //moveDirection = new Vector3(Input.GetAxis("Horizontal") * moveSpeed, 0, Input.GetAxis("Vertical") * moveSpeed);
        moveDirection   = transform.TransformDirection(moveDirection);

        if (Input.GetButton("Up"))
        {
            moveDirection.y += moveSpeed;
        }
        else if (Input.GetButton("Down"))
        {
            moveDirection.y -= moveSpeed;
        }

        if (Input.GetAxisRaw("Mouse ScrollWheel") > 0)
        {
            moveDirection.y = moveDirection.y + scrollSpeed;
        }
        else if (Input.GetAxisRaw("Mouse ScrollWheel") < 0)
        {
            moveDirection.y = moveDirection.y - scrollSpeed;
        }

       moveDirection *= (accelerate ? speed : moveSpeed);
        controller.Move(moveDirection * Time.deltaTime);

    }
    void UpdateRotation()
    {
        if (!Input.GetMouseButton(1))
            return;

        rotationX += Input.GetAxis("Mouse X") * lookSpeed;
        rotationY += Input.GetAxis("Mouse Y") * lookSpeed;
        rotationY = Mathf.Clamp(rotationY, -90, 90);
        rotationZ = Input.GetAxis("Mouse ScrollWheel");

        transform.localRotation = Quaternion.AngleAxis(rotationZ, Vector3.forward);
        transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up);
        transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left);
    }

All working fine but the problem on WebGL canvas when I rotate the camera using mouse and comes out of the bound of WebGl canvas meanwhile, I also continuously press horizontal or vertical key, then release input key doesn't work. Remember I logged the key[Input.GetAxisRaw("Horizontal"),Input.GetAxisRaw("Vertical")] input and found that it is not reset to zero on release.

 Debug.Log("Hr GetAxisRaw : " + Input.GetAxisRaw("Horizontal"));
 Debug.Log("Vertical : "     + Input.GetAxisRaw("Vertical"));

Normally when I don't use camera rotation using mouse and during this time, when i release the horizontal/vertical key, it works fine.

sentences:
Re-create 2D side-on wave effect from Worms game I'm trying to recreate the waves/water effect from Worms ( see here http://youtu.be/S6lrRqst9Z4?t=31s ) From what I understand its not actually a sprite, its procedurally generated by something like a sin wave.

Has anyone created something like this before? or any idea how I would go about it?

sentences:
How can i rotate the FPSController to it's original rotation angle? It should be kind of slowly standing effect.
The FPSController is starting at rotation: X = 7 Y = 112 Z = -31

The problem is that i have on the FPSController a script that i use the mouse to rotate the camera around. And i see that when i rotate the camera the center point of the FPSController seems stuck on this angle even if i change the rotation to 0,0,0

If i start the game running it when the rotation of the FPSController is 0,0,0 then it's standing but when i start the game with 7,112,-31 and then moving the mouse it keep be locked on this rotation values. And i want it to slowly return to the original 0,0,0

I tried when the game is running and the fpscontroller rotation set to 7,112,-31 to change it to 0,0,0 but it keep staying at the rotation of 7,112,-31

What i want is that the fpcscontroller to stand. I don't think that i need to change it's position but only the rotation.

In my script i tried this:
At the top:

public FirstPersonController fpc;
public float speed = 10F;

Then in the Update:

void Update()
{
  fpc.transform.rotation = Quaternion.Slerp(fpc.transform.rotation,
  Quaternion.Euler(0, 0, 0), Time.deltaTime * speed);
}

But it didn't return it to the standing position it keep it on the current rotation 7,112,-31

sentences:
How do I get the 3d coordinates of my model Instance? [LibGDX] I want to get the 3d coordinates (as a Vector3) from my model Instances.
with the following code I can only get the original coordinates, but in the render method, my model is rotating around the Y-axis (and moving at the same time) and I want to get its coordinates each frame.
I'm using a little class created by @Xoppa :

public static class GameObject extends ModelInstance {
    public Vector3 center = new Vector3();
    public Vector3 dimensions = new Vector3();
    public float radius;

    public BoundingBox bounds = new BoundingBox();

    public GameObject (Model model, String rootNode, boolean mergeTransform) {
        super(model, rootNode, mergeTransform);
        calculateBoundingBox(bounds);
        bounds.getCenter(center);
        bounds.getDimensions(dimensions);
        radius = dimensions.len() / 2f;
    }
}

and here's my code:

public void render(float delta) {
    super.render(delta);
    if (loading && manager.update()) {
        doneLoading();
    }

    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    batch.begin();
    backgroundSprite.draw(batch);
    batch.end();

    for(GameObject instance : instances){
        instance.transform.rotate(new Vector3(0, 1, 0), 0.5f);
        float x = instance.bounds.getCenterX();
        float y = instance.bounds.getCenterY();
        float z = instance.bounds.getCenterZ();
        System.out.println(x+" "+y+" "+z);
        if(isVisible(cam, instance)){
            modelBatch.begin(cam);
            modelBatch.render(instance, environment);
            modelBatch.end();
        }
    }
}

Please help, there's no function "getPosition" or sth like that, it's all about Matrix4 and I have never had a math course about it. I'm stuck.

sentences:
Why are leaderboards often separated between platforms? I noticed that many games (if not most or all) are employing different leaderboards for different platforms. For example, different leaderboard for iOS and Android. Different leaderboard for Xbox and PS.

I can't see the logic behind that. After all, let's say iPhone and Android are sending the data to a single service/system.

Is it a business decision?

sentences:
maps in a multiplayer diablo clone - unity3d I'm messing around with unity3d free, trying to figure out if i can get away with using its readymade graphic engine. I have some problems figuring out how maps should be implemented/handled

(the graphics are 3d, like diablo, but essentialy game is only X/Y movement)

Case 1.
Model a "3d" map within Unity scenes, then model a 2d version of it for serverside calculations (line of sight, positioning, movement and spawning of objects). How to keep them in sync the easiest? Are there any tools for this purpose?

Case 2.
Feed a tile based map to Unity client, making it render it from small pieces (tiles). Essentialy use the 2d server version to render the pretty 3d client version. Is that possible at all within unity?

I would love to be able to generate terrain randomly, so solving case two would be most beneficial...

Probably both my cases are a good deal off the "correct" approach, so please give me some hints on the industry standards ;-)

sentences:
Apply impulse in direction line is pointing with force proportional to the length of line I have a line perpetually pointed at the mouse and originating at the player, but the length is limited to a certain value.

I also can create a circular object on demand in Box2D (specifically the love2d bindings). I would like to apply an impulse on the new object that will send it flying in the direction of the line, with force proportional to the length of the line (that specific proportion is not important).
The object should not roll along that line like a cannonball in a cannon barrel, but it should begin its journey in the direction of the line, such that a user can intuitively direct the projectile (all my attempts* at solving this issue have led to some angles (45/135) having similar projectile directions as flat angles (0/180), which means the angle is not functional as an aiming mechanism). I suppose a successful implementation might look like this:

I have been looking through tutorials and haven't found an answer. I see whisperings of ways to do it by simply supplying the angle (if I read the pages correctly) but Love2D's function does not support that.

The way in Love2D to apply a linear impulse is Body:applyLinearImpulse( ix, iy, x, y ) with ix and iy being the x and y components of the impulse, and x and y being the position to apply the impulse (default to origin of body).

*The best I have tried is to apply the distance of the line as the x/y components in applyLinearImpulse. This creates the awful failure I mentioned earlier where the angle of the line does not produce much difference in the angle of the projectile (but it does produce a tiny amount, with extremely diminishing returns as the line approaches a 90 degree angle / vertical line).

sentences:
Fixed-Timestep still updating too fast I'm trying to figure out if I'm approaching my simple fixed-timestep implementation correctly, following examples such as: Gaffer (without RK4), and DeWitters

Currently, I have a game object which contains position and velocity data members, with position calculated by

 position = position + (velocity * dt)

However, unless the velocity is set to a value of two decimal places, the update makes the position change in an instant (e.g. Velocity = 0.05 works, but this does not seem logical; to me Velocity should be >0?; even a value of 0.5 makes the update appear instant). Therefore, I have come to the conclusion that I have implemented by game loop incorrectly.

Note, I'm using SDL and C++, however the following is all Psuedocode:

bool quit = false;
World world;

Uint32 frameTime = SDL_GetTicks();
double accumulator = 0.0;
const double dt = 1.0 / 60.0;
int fCount = 0;
while(!quit){
    fCount = 0;
    double newTime = SDL_GetTicks();
    double nextFrameTime = newTime - frameTime;

    if(nextFrameTime > 0.25)
        nextFrameTime = 0.25;

    frameTime = nextFrameTime;  //Line of error, should be frameTime = newTime
    accumulator += nextFrameTime;

    while(accumulator >= dt){
        world.Update(dt);  //A simple counter revealed Update being called 15-16 times during this loop
        accumulator -= dt;
        fCount++;
    }
    //fCount is equal to 15 when dt = 1.0/ 60.0, fCount = 8/9 when dt = 1.0/30.0
    double interpol = accumulator / dt;
    world.Render(interpol);
}

If there isn't any apparent issue with this code then perhaps I have messed up my position/physics calculations based on Update(dt).

Any help is appreciated

sentences:
Algorithm for smoothing a network object's movement We are building multiplayer game where there's no central server managing the game.

Each player is responsible for sending out its state to all connected players.

In addition, all clients run prediction between received packets, to keep all objects moving in between state packets.

We also smooth out the positiobs received from remote clients, for example in scenarios where the received oosition is small enough and should be moved smoothly from the current predicted position.

The issue I am trying to handle is how should the algorithm behave in case it hasn't finished smoothing out the position yet, and a new state is being received?

The smoothing algorithm currently operates for a given configured duration (e.g: 80 ms). Should a new incoming state cancel the ongoing smoothing? What is done in such cases?

One option is to never reset started smoothing, that is, run for the whole 80  ms, but update the target position in case new state is received.

Another option would be to reset (start the 80 ms count all over again. This time with the new start/end positions).

Both options have their issues. I am wondering whether there's a formal way to deal with this.

sentences: What is the purpose of mesh optimization functions? I remember there is a specific function in Direct3D which optimizes a mesh or a 3D object in some way. What is the purpose of this function? How does it reorganize vertices to make it better?

sentences:
Health Bar is always 100% full I have this GUI to graphically display a variable similar to the health in a game. The variable 'test' goes up and down during gameplay.

To show this I have the following onGUI ():

public GUISkin btnskin1;
public Texture2D emptyTex;
public Texture2D fullTex;
public Vector2 pos = new Vector2(20,40);
public Vector2 size = new Vector2(60,20);

void OnGUI()
{
    float test;

    GUI.skin = btnskin1;

    if (LoadDiagram.diagramaCarga.TryGetValue (TimeManager.gametime, out test))
    {
        GUI.BeginGroup (new Rect (pos.x, pos.y, size.x, size.y));
        GUI.Box (new Rect (0, 0, size.x, size.y), emptyTex);

        //draw the filled-in part:
        GUI.BeginGroup (new Rect (0, 0, size.x * test, size.y));
        GUI.Box (new Rect (0, 0, size.x, size.y), fullTex);
        GUI.EndGroup ();
        GUI.EndGroup ();
    }
}

In the game scene I attached the empty bar to the emptyTex texture, and the full bar to the fullTex texture. When I play the game, he bar is always full. I have not inserted the minimum and maximum of the variable test because I don't know where, but I guess that may be necessary.

Any hints?

sentences:
Techniques for mapping "nodes" and paths between nodes in a world space that extends in three dimensions I'm trying to create a travellable map/world.  I want to model able-to-be-occupied nodes/tiles/locations and allowed paths between them to create a space infinitely able to be built upon in all directions (not just flatland), in a browser-based game ( http://ninjawars.net , for a sense of it).

For example your character will be in a node "a field", and could then move north into "the first floor of a shack", or south or east or west.   After moving north, movement choices would then be: south back to the field, or up to the second floor of the shack.

Basically, a grid maze with the minor complexity of the up and down option.

What are useful methods for modeling both the inhabitable nodes and the paths between them?  X,y,z euclidean coordinates and relational lists of available connections from individual nodes?

Or are there alternatives to grids that could still allow fun visual representation of movement options?

sentences:
Spawn chance, modulated by probability weighted by progress I've been struggling with this for over a day now. What seemed a simple task, has just wrecked me. I hope someone here can help me figure out what I'm missing. Please, please help me :)

The functionality I need:

Think of my game as Guitar Hero, but instead of pre-placed nodes, I place the nodes randomly as the game progresses, at certain valid points in time. Now, instead of relying on randomness alone, I've made phases of difficulty, where I set a certain number of nodes to be spawned throughout the phase, and I'd like to have those evenly distributed within the phase. Since it's an arcade/highscore game, it needs to be roughly the same number of nodes placed every time you play the game, but the nodes should be placed differently each time. Until recently, I simply had something like this code, called for each valid point in time:

if(Random.Range(0f, 1f) < 0.25)
    // Spawn node

The problem:

Now I want to balance the number of nodes per phase. To do this, I have these variables:

TotalNodesToPut
NodesPut
NodesLeftToPut
PhaseProgress (0.0-1.0 normalized percentage of progress)

My plan was, to have the base chance of spawning a node to be 50%. I would then like to modulate that down to 0% and up to 100% depending on how many nodes still need to be put down, and how far we have progressed through the phase. It should be so that the percentage of nodes put down follows the progress percentage. If we have spawned 5 of 20 nodes (25%) but have progressed 75% of the phase, the chance to spawn a node should be really high. If we have spawned 15 of 20 nodes (75%) but have only progressed 25% of the phase, the chance to spawn a node should be really low.

It seems like a simple task, but I just can't get it to work :( I've tried dozens of things, started over again and again, and it's just never right, which is why I'm hesitant to show any code. I wouldn't want to start people off on the wrong foot. I have tried searching on the web, but haven't found anything about this particular problem. Any help is much appreciated!

sentences: Stop detecting Input in Unity? How can I stop detecting input from the user in Unity? I want to achieve the following: "do not detect Input.GetMouseButtonDown" In C#?

sentences:
What are reasons for input polling vs. input events? I noticed people use both - but is there any empirical evidence when it's better to use one over the other?

This is related but not quite a 'why use either' or even 'why use both': Polling vs event driven input

sentences:
developing a uci compatible chess engine I have understanding of how chess engines work in theory. I know the algorithms like minimax and alpha beta pruning. I want to develop a UCI compatible chess engine.I know that UCI protocols are these: http://wbec-ridderkerk.nl/html/UCIProtocol.html but I don't quite get how the program is supposed to get those commands and how it is supposed to give result.

As minimal as it maybe, but a working model in a short time to test first is preferred. I'll add features on the go. Any tips are welcome. please guide me, thankyou.

If this is not the right place for this question, please guide me where to ask this.

sentences:
Unity bounds includes the center of the scene I'm trying to get the bounds of an object and put a box around it.

Sounds simple right? I just encapsulate all the bounds together and use its center and size to do so.

But the problem is one corner of the box is always at the center of the scene, like a part of the object is there, unless the center of the scene is in the bounds.

This is when object is at the center

This is when it isn't

This is the code i'm using:

    public static Bounds Calculate(Transform TheObject)
    {
        Renderer renderer = TheObject.GetComponent<Renderer>();
        Bounds combinedBounds = new Bounds();
        if (renderer != null)
            combinedBounds = renderer.bounds;
        var renderers = TheObject.GetComponentsInChildren<Renderer>();
        foreach (Renderer render in renderers)
        {
            if (render != renderer) combinedBounds.Encapsulate(render.bounds);
        }
        return combinedBounds;
    }

sentences: Animation transitions won't work I downloaded an animated spider that comes with its own animations. I put the idle and walk animations in the controller. The default idle works fine but it won't transition to walk. I have other characters in my scene that transition with no problem. The only difference is that the other characters animations are separate from the character and the spider's animations are attached to the spider. I have been looking for any tutorial on the attached animations but can't find anything. Any help would be appreciated.

sentences:
Find the direction a Projectile should be fired from a Moving Object to hit another moving Object? I am trying to do a simple AI Controller, which fires Missiles at the surrounding targets in the Scene.

The AI Controller can fire projectiles when moving or stationary.
The Targets are either stationary or move around in the scene with a Constant Velocity and can't fire projectiles.

I did some searching on Stack overflow and came up with this code to find the direction the AI controller must fire the projectile (constant speed) to hit a target travelling at a constant velocity(it can also be stationary):

private bool GetProjectileDirection(GObject target, GObject source, out Vector3 direction)
{
    // Initialize direction to Zero
    direction = Vector3.zero;

    // The Relative Position between the AI Controller and the target.
    Vector2 w = new Vector2(target.Position.x - source.Position.x, target.Position.y - source.Position.y);

    // The Relative Velocity between the source and the target.
    Vector2 v = new Vector2(target.Velocity.x - source.Velocity.x, target.Velocity.y - source.Velocity.y);

    // Quadratic Equation Co-efficients
    float a = Vector2.Dot(v, v) - BULLET_SPEED * BULLET_SPEED;
    float b = Vector2.Dot(w, v);
    float c = Vector2.Dot(w, w);

    float root = (b * b) - (a * c);

    // The Problem seems to occur here as this becomes less than zero most of the time,
    // and exits the function.
    // But on the screen, the object is well within the range for the AI to fire at it
    if (root < 0)
        return false;

    // If root < 0, then this becomes NaN and brings the simulation to a crawl
    double t = (-b - Math.Sqrt(root)) / a;

    double shootX = w.x + t * v.x;
    double shootY = w.y + t * v.y;

    double theta = Math.Atan2(shootY, shootX);
    direction = BULLET_SPEED * new Vector3(Math.Cos(theta), 0, Math.Sin(theta));

    return true;
}

I am pretty sure I am missing something. I just can't pinpoint what exactly is it. As a result, the AI seems to miss most of the targets around it.

sentences:
Browser game - small models with tileable textures vs one big model and one big texture I am few years behind in terms of browser capabilities. I plan to combine 3D with pixel art, and I am going to use Unity to make a browser based game.

I have made a stage that is one model and has around 1k poly's. Then I made a large 2048x2048 texture for it. Lots of that texture is tileable, I'd say that I could fit unrepeated parts on a 256x256 texture while the rest is just repeated content. This looks like a huge waste when I just tile it manually in photoshop on a big texture file and I feel like I am doing something "dirty".

But when I would split that one model into 100 models and tile them separately with 32x32 textures, that would make more sense, but would increase model count from 1 to 100.

What is the correct way to do this? Lots of models with tiled textures, or screw it and make one big model with one large texture? Or maybe performance now is so great I don't even need to care and just do whatever?

Thanks

sentences:
Alternative to 2D array in a tiled-map structure After searching for a long time, I'm surprised this question was not asked yet. In a 2D, tiled-map game, how do you handle the map ? I'd be glad to have your point of view in any languages, though I'm more interested in C++ implementations.

A 2D array, a 2D vector, a class handling a linked-list with ad hoc computing to handle coordinates, a boost::matrix... ? What solution do you use and why ?

sentences:
Calculate intersection of a line with a plane I was reading something about: “Intersection of a line with a plane”. But I don’t fully understand how to calculate it on their way.

The goal is to calculate where the plane and the line will “cross”. These items are given:

The eye is in position: O(0,0,-10)
A point of a 3D-object is P(10,20,30)
The screen has the equation z=0

I have a questions about how they calculate this:

This part is clear. That is the location form the eye (vector representation).

They specify the location of the plane, there is nothing strange here (vector representation).

Now they calculate what part of the line will cross, how did they calculate this? How did they know a = 1/4? And b = 10/4?

This is everything that was given.

sentences:
How can I animate the stretching of a sprite over time? My goal is to find the function to stretch a sprite like my example below, and then get it to animate during a certain time. It is like an interpolation, where the starting point is the original image, and the final point is the stretched image. Any idea?

Here is an example, hope it is clear.

sentences:
Is there a significant importance in what axis I chose in my top down 2.5D game? I have read several posts stating what seems like a "standard" in how to chose your 2d axises in a 3d engine. It is often Y up on screen and X right on screen. However, in these examples I often see that it's a scene set up like a platformer, where the player sees the world from the side.

I'm developing a top down 2.5D (locking depth axis but keeping perspective on camera) game and I have it setup so that Z is up on the screen and X is right on the screen. To me it makes sense as Y is height in the world and thus would approach the camera. I will make use of the 3d world at certain times and I feel that it would be confusing to not have the standard axises then...

Is there something I'm not thinking about here?

sentences:
OpenGL 2.1 vs Modern OpenGL I want to make a 3D voxel game, randomly generated planets, some with live (one minimum with life) , and they are spinning around the sun. For now I have this in OpenGL 2.1 (using fixed pipeline, glBegin / glEnd), and this planet and sun is sphere made out of triangles not blocks, and you will be able to travel to the other planets with your custom made spaceship:

And I have a couple of questions:

Is it ok to use OpenGL 2.1 or should I use OpenGL 3.3+
Do I need shaders to do something like not rendering block that are not visible
Do you have some resources for voxel games?

And finally sorry for my English.

sentences:
Possible to use StateMachineBehaviour with Blend Trees? One of the touted benefits of the StateMachineBehaviours is adding a sound hook to an animation state. That sounds great! Unfortunately, I'm not sure how I could do this when a blend tree is involved. I can put a script at the top level of the state containing the blend tree, but how would I go about getting more information so I can figure out what sound to play? Does it even make sense here?

Basically I have a blend between an idle animation and a walk. I'd like to start playing an idle sound when the idle animation starts playing and then crossfade the sound over to a walk as the animation blends over to walk.

Doable?

sentences: Which version of AndEngine (gles1 or gles2) should I learn? I m new to Game Development. I've chosen AndEngine, but there are 2 versions: gles1 and gles2. I tried sample code from both and found that gles2 code is not run on an emulator, but required an actual device. And in gles2 there are also BaseGameActivity and SimpleBaseGameActivity. I'm a little confused. Which is best?

sentences:
Fastest way to assign sprites to components in Unity I'm using a sprite atlas and Unity's built-in sprite editor to tease out the individual images. Specifically, I have a single texture containing lots and lots of icons for armor, and I am assigning those to a Sprite[] field of a Component.

However, the process of manually assigning sprites to the component -- via drag and drop -- is tedious. Is there a faster way to do this? Perhaps a way I can bulk assign sprites to a component?

Update: This is the code of the final solution. In short, the easiest thing to do is to put the texture atlas in the /Resources folder and then programmatically access the sprites by name.

private void MergeTextureAtlas(string atlasName, Dictionary<ItemSubType, List<Sprite>> spriteLookup) {
    Sprite[] atlasSprites = Resources.LoadAll<Sprite>(atlasName);
    Assert.IsNotNull(atlasSprites, atlasName);
    Assert.IsTrue(atlasSprites.Length > 0, atlasName);

    int spritesLoaded = 0;
    foreach (ItemSubType itemSubType in Enum.GetValues(typeof(ItemSubType))) {
        string subTypeFriendlyName = ItemSubTypeHelper.GetSubTypeName(itemSubType);
        foreach (Sprite atlasSprite in atlasSprites) {
            if (atlasSprite.name.Contains(subTypeFriendlyName)) {
                if (!spriteLookup.ContainsKey(itemSubType)) {
                    spriteLookup.Add(itemSubType, new List<Sprite>());
                }
                spriteLookup[itemSubType].Add(atlasSprite);
                spritesLoaded++;
            }
        }
    }

    if (spritesLoaded == 0) {
        Debug.LogWarning(String.Format(
            "Found 0 new sprites in texture atlas '{0}'.",
            atlasName));
    }
}

sentences:
Can applications using old versions of Opengl still run on newer cards? OpenGl 3.0 and up has a quite big difference from the older versions like OpenGl 2.x and opengl 1.x in terms of implementation, does that mean applications which are written with the old versions of opengl won't run on computers having video cards supporting Opengl 3.x and up?

Sorry, if this is not the right place to ask this.

Thanks.

sentences:
Smooth interpolation with variable time steps My game engine just went through a small overhaul that changed its fixed time step loops into variable time steps ones. Though everything has already been adapted steadily to the new environment, there is still one algorithm that relied heavily on steady ticks: my camera's behavior.

It was pretty much like this (pseudo-code):

    class Camera {
        const float factor = /* value between 0 and 1 */;

        void update() {
            Vector2 distance = player.getPosition() - this.getPosition();
            this.move(distance * factor);
        }
    }

What is generally done for this sort of "pursuing" behavior? This is more than simple speeds and accelerations.

I could go with the following, but it still leaves a feeling of choppiness when in contrast with the rest of the game.

    class Camera {
        const float factor = /* value between 0 and 1 */;
        const float fixedStep = 1.0f / 40.0f; // supposing that it worked under 40FPS before

        float timeAcc = 0.0f;

        void update (float timeElapsed) {
            timeAcc += timeElapsed;

            while (timeAcc >= fixedStep) {
                timeAcc -= fixedStep;

                Vector2 distance = player.getPosition() - this.getPosition();
                this.move(distance * factor);
            }
        }
    }

It is C#-like pseudo-code, but don't be fooled: I'm actually using C++ and SFML, so I don't have many (or any) already-implemented methods at my reach.

sentences:
How to Draw texture between 2 Vector3 My scenario:
RTS combat style, 1 unit fires beam on another unit

My problem is i want to draw a flat texture between 2 Vector3 points. I have looked at various Billboarding styles but that doesn't give me a proper solution.

I looked at this:
http://msdn.microsoft.com/en-us/library/bb464051.aspx

is BasicEffect and DrawPrimitives the correct solution just stretch the texture to the distance between point of origin to target? I used the quad class they used but i found this it seemed to inflexible

So my question to you is how would i go about this sort of problem?

Regards

sentences:
How can I detect a perfect passageway for collision detection? The problem is when I move diagonal it moves fractions of units and therefore my coordinates might be a fraction of a unit say (40,400) might be actually (40.12,400.40) but another problem is my pink square might be moving really fast. Below is a screenshot where you can see I can make it past a pixel perfect passageway with my pink square but the other passageway with the white square is very difficult if not impossible to make it through (I have by zooming in and moving REALLY slow but sometimes it impossible for the reasons listed above) Suppose in the example above I am holding the up and left arrows how can I make it so the pink square slides across the yellow rectangle and detects it can move upward and begins to move up?

The code I am using right now looks like this

float d45 = (float) (1 / Math.sqrt(2));
moveX = -d45;
moveY = d45;
moveX = moveX * t * speed;
moveY = moveY * t * speed;
        for (Stuff s : collidables) {
            if (overlaps(s, moveX, 0)) {
                collidedX.add(s);
                x += moveX > 0 ? s.x - width - x : s.x + s.width - x;
            }
        }
        if (collidedX.size < 1) {
            x += moveX;
        }
        for (Stuff s : collidables) {
            if (overlaps(s, 0, moveY)) {
                collidedY.add(s);
                y += moveY > 0 ? s.y - height - y : s.y + s.height - y;
            }
        }
        if (collidedY.size < 1) {
            y += moveY;
        }

I check for collision twice once on the Y axis and another on the X axis so that it can still slide to the left even if you are pushing the up and left arrow. The problem is it skips over the 100 unit passage to the left of the picture above. If I create a passage that is 110 units wide it will slide up fine but this isn't really cool because I like how it looks where it slides perfectly. Any ideas?

sentences:
Playing with hashmap in drawing I'm developing a game in Java for Android, using LibGDX.
In my render(), between the batch.begin() and batch.end() I'm running through all the game objects and draw them.

Every game object is stored in a list, which that list is stored inside a hash map. I iterate through this hash map, getting every list and going through that list, like this:

    batch.begin();
    Iterator it = objectsMap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        Array list = (Array) pair.getValue();
        for (int i = 0; i < list.size; i++) {
            GameObject object = (GameObject) list.get(i);
            drawObject(object);
        }
    }
    batch.end();

My drawObject() code:

private void drawObject(GameObject object, float x, float y) {
    if (object == null) {
        return;
    }
    if (object.getVisibility()) {
        TextureAtlas.AtlasRegion currentFrame = object.getCurrentFrame();
        if (currentFrame != null) {
            float objectAlpha = object.getAlpha();
            Color color = batch.getColor();
            if (objectAlpha != 1) {
                color.a = object.getAlpha();
                batch.setColor(color);
            }
            batch.draw(currentFrame, x - object.getOriginX(), y - object.getOriginY(), object.getOriginX(), object.getOriginY(), currentFrame.getRegionWidth(), currentFrame.getRegionHeight(), object.scaleX, object.scaleY, object.getSpriteDirection());
            color.a = 1;
            batch.setColor(color);
        }
    }
}

A method called setRegion() sets the current animation frames of the object:

protected void setRegion(String name, float frameDuration) {
    currentFrame = atlas.findRegion(name, 0);
    if (currentFrame == null) {
        currentFrame = atlas.findRegion(name, -1);
    }
    width = currentFrame.getRegionWidth();
    height = currentFrame.getRegionHeight();
    animationStateTime = 0;
    animation = new Animation(frameDuration, atlas.findRegions(name),      Animation.PlayMode.LOOP);
}

And in the update() of the objects this is called:

            currentFrame = (TextureAtlas.AtlasRegion) animation.getKeyFrame(animationStateTime, isLooping);

The getCurrentFrame() method only returns currentFrame variable.
The alpha is a field with a value between 0 and 1. (getAlpha() returns only the field)

My question is that considered a "heavy" activity? Can this be a significant impact on the FPS values? Because I'm running my game on old devices (like Galaxy S2) and the FPS can get pretty low values. I'm trying to find the cause to it.
I used to have a reference to every list but with the time I realized I'm going to have too much lists, so I decided to do it like this. Maybe you know a better way of holding references to all game objects?

Thanks!

sentences:
Unreal Engine 4 Android Building Error Android Launch error
My sdk settings:

LogPlayLevel: UnrealBuildTool: Preparing native code for debugging...
!LogPlayLevel: UnrealBuildTool: UnrealBuildTool Exception: ERROR: D:/Program Files/NDK/NVPACK/android-ndk-r12b/ndk-build.cmd failed with args APP_ABI="arm64-v8a " NDK_DEBUG=1
LogPlayLevel: CommandUtils.Run: Run: Took 36,7394016s to run UnrealBuildTool.exe, ExitCode=5
LogPlayLevel: BUILD FAILED
PackagingResults:Error: Error Launch failed! Unknown Error

sentences:
How to make an event appear after one event has been activated on RPG MAKER VX ACE? I am trying to create my first RPG, and I having some difficulty to make an event appear after an event had been activated, and then disappear later, only to reappear after the player activated an event (to cut off an area during certain times).

How would I do this in RPG Maker?

sentences: "Acrobatic" and "fluid" combat system (i.e. Spider-Man 2018) Like it says in the title, I like the way that Spider-Man Has a dynamic and fluid feeling combat system. I can't exactly put my finger on a few key aspects, though, and I don't have any way I can think of to recreate it in a game engine. Why does it feel good to play, and how could I apply that to my game?

sentences:
Using Variable to Reference Different C# Script I had a question about using a variable to access different scripts. I have a Rhythm game I'm working on, and I have different scripts named Rudement1, Rudement2, Rudement3, ect... One of my other scripts has something like this,

public GameObject HighHatFlare;
public int RudementNumber = TrainingMenuScript.TrainingMenuInt;

// Use this for initialization
void Start ()
{
    Rudement1.NoteCreated = Rudement1.NoteCreated + 1;
}

What I'm looking to do is use this same script but modify it to to something like this:

public GameObject HighHatFlare;
public int RudementNumber = TrainingMenuScript.TrainingMenuInt;

// Use this for initialization
void Start ()
{
    Rudement(RudementNumber).NoteCreated = Rudement(RudementNumber).NoteCreated + 1;
}

The goal is that I can continually use this script and it will modify itself as I use different "Rudement" scripts. I figured it some type of "RudementNumber" or 'RudementNumber', but I can't figure it out. Can someone help me with this?

A rudement is a basic sticking pattern that you learn at a very beginning level of drumming. Also spelt "Rudiment" I was always told to spell it with an "e" because of its French roots (not relevant).

In this context it could be replaced by the term "level". Each rudiment is a different level and therefore has different amounts of notes. The base script between each level is identical, but the note patterns are different.The script above is attached to each note to give them a numeric order as they are created. It is running under a mono behavior. I think that at it's simplest I'm wondering if you can reference a script name via a changeable string with the intent to pull a variable from it. As the level changes so does this string to pull the amount of NotesCreated from the new level.

sentences:
Which is the right way to build a OpenGL Projection Matrix This time I'm trying to learn the core of matrix transformations. I dont like the idea to using a Math library and dont understand what is hapening on background, because this I'm having some dificulties with Projection Matrix. I've read many tutorials that explain how Projection Matrices show be and what they do. But at this moment I got two different Projection Matrices and I dont know which should I use.

Look at this, frist from this tutorial:

private float near = 0.1f;
private float far = 100.0f;
private float fov = (float)Math.toRadians(45.0);
private float aspect = (float) 400 / (float) 300;

private float f = (float)Math.tan(fov / 2.0f) * near;
private float Sx = (2.0f * near) / (f * aspect + f * aspect);
private float Sy = near / f;
private float Sz = -(far + near) / (far - near);
private float Pz = -(2.0f * far * near) / (far - near);

projection = new Matrix4f(new float[]{
        Sx,   0.0f, 0.0f, 0.0f,
        0.0f, Sy,   0.0f, 0.0f,
        0.0f, 0.0f, Sz,   -1.0f,
        0.0f, 0.f,  Pz,   0.0f,
    });

Now look this second, from this tutorial:

private float near = 0.1f;
private float far = 100.0f;
private float fov = (float)Math.toRadians(45.0);
private float aspect = (float) 400 / (float) 300;

private float f = 1.0f / (float)Math.tan(fov / 2.0f);
private float Sx = f / aspect;
private float Sy = f;
private float Sz = -(far+near) / (far-near);
private float Pz = -(2.0f * near * far) / (far – near);

projection = new Matrix4f(new float[]{
        Sx,   0.0f, 0.0f, 0.0f,
        0.0f, Sy,   0.0f, 0.0f,
        0.0f, 0.0f, Sz,   -1.0f,
        0.0f, 0.f,  Pz,   0.0f,
    });

So, which is correct? Or if both are correct, there is some recommendations? I think the second one is more easy to read.

P.S.: In my code i'm using Right Handed System and Column-Major Matrices.

Thanks for your attention!

sentences:
Why is my alpha transparency not working correctly in Unity? In Unity I have never seen a bug quite as weird as this one.

As usual, I import my texture with a transparent background and then check the alpha is transparency box and apply it, and everything seemed okay. It had worked like it usually does and made the background of my texture transparent. When I apply it to an object or even just paint it onto the terrain it shows the original texture, but in the areas where there should be nothing it replaces it with some nightmarish plaid hell.

I have tried other transparent textures but that doesn't seem to work either same result but for each different picture there is a different pattern and color of plaid. I really would appreciate any help I can get on this because I'm just stumped.

sentences:
how to slide pieces for a slide puzzle game for android(libgdx) I want to make a small one-screen game in which the player has to slide pieces of an image until the image is completed. I used texture regions to create the pieces from an image

int numOfTiles_Horizontal = 5;
int numOfTiles_Vertical = 5;

float tile_width = img.getWidth() / numOfTiles_Horizontal;
float tile_height = img.getHeight() / numOfTiles_Vertical;

TextureRegion[][] tiles = new TextureRegion[numOfTiles_Horizontal][numOfTiles_Vertical];
for(int col = 0; col < numOfTiles_Horizontal; col++) {
    for(int row = 0; row < numOfTiles_Vertical; row++){
        tiles[col][row] = new TextureRegion(img, col * tile_width, row * tile_height, tile_width, tile_height);
    }
}

, but I'm unsure about how to allow the player to move the tiles into a blank space as well as making a "blank space" to allow tiles to move.

The game would look like this:

I followed some tutorials for libgdx but cannot find much on achieving this.

I am new to the engine and Android development so any help is appreciated.

sentences:
Unity3D - Screen Capture of particular UI elements How can I screenshot particular UI elements?

In my case I need screen capture UI Panel with child objects like UI Text, UI Input and etc.

Please take a look at picture. Thanks in advance

sentences:
Orientation while rotating around a point I am using this formula to rotate around a point.

X := originX + sin(angle)*Size;
Y := originY + cos(angle)*Size;

In cartesian cordinates how would I keep the objects orientation in relation to the origin object as it moves around the origin.  Any one know where I could look for answer to that?

sentences: How can I move the Floor in ZBrush? I built a character is ZBrush, added some subtools and extracts and realized I have to move the angle 'cause he is "falling". Is it possible to move him and all subtools around him at once (like groups in photoshop) or change the angle of the "Floor"?

sentences:
How do I modify a Boids algorithm to be player controlled? Found source code on Boids in C#.

http://3carrotsonastick.wordpress.com/2012/11/01/boids-in-c-xna/

How do I go about making the raven class in the above player controlled?
If I could control it myself, it would be a great help, but I don't know how to go about it.

sentences:
What is the geometrical interpretation of Input.GetAxis("Mouse X")? According to the documentation, Input.GetAxis("Mouse X") produces a range of values from -1 to 1. However it will produce another range if it is setup to be  delta mouse movement.

  Returns the value of the virtual axis identified by axisName.

  The value will be in the range -1...1 for keyboard and joystick input. If the axis is setup to be delta mouse movement, the mouse delta is multiplied by the axis sensitivity and the range is not -1...1.

Question

I don't understand what the value means geometrically. Is it a displacement between two points each in  consecutive frame updates? If so what is its unit? Pixels, points, centimeters, etc?

sentences:
Rotate a plane defined by its normal and its distance First apologies for the amount of pictures, it's a bit hard trying to explain my problem without pictures. Hope I've provided all the relevant code. If you feel you want to know about how I am doing something else, please tell me and I will include it.

I've been trying to work around rotating a plane in 3D space, but I keep hitting dead ends. The following is the situation:

I have a physics engine where I simulate a moving sphere inside a cube. To make things simpler, I have only drawn the top and bottom plane and moved the sphere vertically. I have defined my two planes as follows:

CollisionPlane* p = new CollisionPlane(glm::vec3(0.0, 1.0, 0.0), -5.0);
CollisionPlane* p2 = new CollisionPlane(glm::vec3(0.0, -1.0, 0.0), -5.0);

Where the vec3 defines the normal of the plane, and the second parameter defines the distance of the plane from the normal. The reason I defined their distance as -5 is because I have scaled the the model that represents my two planes by 10 on all axis, so now the distance from the origin is 5 to top and bottom, if that makes any sense.

To give you some reference, I am creating my two planes as two line loops, and I have a model which models those two line loop, like the following:

top plane:
std::shared_ptr<Mesh> f1 = std::make_shared<Mesh>(GL_LINE_LOOP);
std::vector<Vertex> verts = { Vertex(glm::vec3(0.5, 0.5, 0.5)), Vertex(glm::vec3(0.5, 0.5, -0.5)), Vertex(glm::vec3(-0.5, 0.5, -0.5)), Vertex(glm::vec3(-0.5, 0.5, 0.5)) };
f1->BufferVertices(verts);

bottom plane:
std::shared_ptr<Mesh> f2 = std::make_shared<Mesh>(GL_LINE_LOOP);
std::vector<Vertex> verts2 = { Vertex(glm::vec3(0.5, -0.5, 0.5)), Vertex(glm::vec3(0.5, -0.5, -0.5)), Vertex(glm::vec3(-0.5, -0.5, -0.5)), Vertex(glm::vec3(-0.5, -0.5, 0.5)) };
f2->BufferVertices(verts2);

std::shared_ptr<Model> faceModel = std::make_shared<Model>(std::vector<std::shared_ptr<Mesh>> {f1, f2 });

And like I said I scale the model by 10.

Now I have a sphere that moves up and down, and collides with each face, and the collision response is implemented as well.

The problem I am facing is when I try to rotate my planes. It seems to work fine when I rotate around the Z-axis, but when I rotate around the X axis it doesn't seem to work. The following shows the result of rotating around Z:

However If I try to rotate around X, the ball penetrates the bottom plane, as if the collisionplane has moved down:

The following is the code I've tried to rotate the normals and the planes:

for (int i = 0; i < m_entities.size(); ++i)
    {
        glm::mat3 normalMatrix = glm::mat3_cast(glm::angleAxis(glm::radians(6.0f), glm::vec3(0.0, 0.0, 1.0)));

        CollisionPlane* p = (CollisionPlane*)m_entities[i]->GetCollisionVolume();
        glm::vec3 normalDivLength = p->GetNormal() / glm::length(p->GetNormal());
        glm::vec3 pointOnPlane = normalDivLength * p->GetDistance();
        glm::vec3 newNormal = normalMatrix * normalDivLength;

        glm::vec3 newPointOnPlane = newNormal * (normalMatrix * (pointOnPlane - glm::vec3(0.0)) + glm::vec3(0.0));

        p->SetNormal(newNormal);
        float newDistance = newPointOnPlane.x + newPointOnPlane.y + newPointOnPlane.z;
        p->SetDistance(newDistance);
    }

I've done the same thing for rotating around X, except changed the glm::vec3(0.0, 0.0, 1.0) to glm::vec3(1.0, 0.0, 0.0)

m_entites are basically my physics entities that hold the different collision shapes (spheres planes etc). I based my code on the answer here Rotating plane with normal and distance

I can't seem to figure at all why it works when I rotate around Z, but not when I rotate around X. Am I missing something crucial?

sentences:
SAT - penetration and pull out vector based on previous body position I implemented SAT alghorithm that is able to detect collisions and return shortest "pull out" vector.
On the screenshot below this vector is determined by yellow color (P and Q).
If I add Q vector to position of body B, then will be no collision.
However I realized that I can't use this vector to solve collisions, because the body could arrive from completely different direction. I should rather pull out body B by using direction of vector Z.
I already tried to calculate additional overlap by using axis determined by vector Z. However in such case I'm pulling body B too far away from A.
Is there any ellegant solution for that by keep using SAT algorithm?

sentences: Best place for learning how to write games in Unity3d What's the best place for tutorials & other learning resources for unity3d?

sentences:
How to develop VR PC games without a Head-Mounted Display of my own? I am an intermediate student of Unity 3D, and I am not able to purchase heavy and expensive equipment like Oculus Rift, HTC Vive, or other models that are not available in Pakistan.

So I'm wondering how I can develop VR games without these peripherals.

sentences:
Whenever I grapple onto a RigidBody, the grappling/reeling mechanics glitch out in Unity. How can I fix this? I'm trying to make a game in Unity 2020.1, the feature I'm trying to prototype and test is a grapple gun. The grapple gun should grapple onto walls, and platforms reel the player in. I've implemented this already using the below code:
if (Input.GetMouseButton(0))
       {
            RaycastHit2D hit = Physics2D.Raycast(crosshair.transform.position, mousePos - (Vector2) crosshair.transform.position);

            hitPoint = hit.point;

            if (hit.collider != null)
            {
                if (!isStrung)
                {
                    if (hit.collider.gameObject.CompareTag("Ground"))
                    {
                        Debug.DrawLine(crosshair.transform.position, hitPoint, Color.red, 5);
                        Debug.Log(hitPoint);
                        isStrung = true;
                        distance = Vector2.Distance(transform.position, hitPoint);

                        springJoint.enabled = true;
                        springJoint.distance = distance;
                        springJoint.connectedAnchor = hitPoint;

                        lineRenderer.enabled = true;
                        lineRenderer.SetPosition(0, transform.position);
                        lineRenderer.SetPosition(1, hitPoint);
                    }
                }
            }
       }

This code handles the raycasting and grappling while this code:
private void FixedUpdate()
    {
        playerRb.AddForce(Vector2.right * xInput * speed);
        if (isStrung)
        {
            if (springJoint.distance > 2)
            {
                springJoint.distance -= 0.1f;
            }
        }

        if (hitObject)
        {
            hitRb.AddForce(((Vector2)transform.position - hitPoint) * objectPull);
        }

    }

handles the reeling.
The problem came in once I added some code to allow the player to grab onto an object with a rigid body, as I wanted to allow the grappling gun to move the object.
An example of the goal I'm working towards in in this gameIQ Ball. I want the line to remain straight, but I also want the reeling effect exhibited in the game above.
Here is the problem-causing code:
else if (hit.collider.gameObject.CompareTag("Object"))
                    {
                        Debug.DrawLine(crosshair.transform.position, hitPoint, Color.green, 5);
                        Debug.Log(hitPoint);
                        distance = Vector2.Distance(transform.position, hitPoint);

                        springJoint.enabled = true;
                        springJoint.distance = distance;

                        lineRenderer.enabled = true;
                        lineRenderer.SetPosition(0, transform.position);
                        lineRenderer.SetPosition(1, hitPoint);

                        hitRb = hit.collider.gameObject.GetComponent<Rigidbody2D>();

                        springJoint.connectedBody = hitRb;

                        hitObject = true;
                    }

[In FixedUpdate()]
if (hitObject)
        {
            hitRb.AddForce(((Vector2)transform.position - hitPoint) * objectPull);
        }

Here's a screen recording which should illustrate the problem:
Google Drive - Screen Rec
When I run the game, the grapple gun works fine while I reel onto a wall, with the tag. "walls", but once I grapple onto the RigidBody (the square), the grapple. gun stops working properly. Sometimes, when I grapple onto the RigidBody, there is a green line (same as the one used to show the ray trace), however, I am unsure as to whether this is actually causing the problem.
My full code is in this HasteBin link: Hastebin

sentences:
Check bounds in 2d platformer level transition I have asked How camera works in 2d platformer in level transitions about camera transitions,
in the process I am stuck somewhere else.
I have a targetRoom that is 32 by 32 tiles:
// [x, y, w, h]
let mb = [0, 0, 32, 32];

// bounds
let targetRoom = {
  minX: mb[0] * bs.pxTileSize,
  maxX: (mb[0] + mb[2]) * bs.pxTileSize,
  minY: mb[1] * bs.pxTileSize,
  maxY: (mb[1] + mb[3]) * bs.pxTileSize
};

I have a player object:
let p = {
    x: 0,
    y: 0,
  onEdgeX: (p, bx) => {
    p.x = bx;
  },
};

I allow the player to move within these bounds:
this.checkEdgeX = (p) => {
  let { minX, maxX } = targetRoom;
  let cbox = absCBox(p);

  if (cbox[0] < minX) {
    p.onEdgeX(p, minX - p.cbox[0]);
  }
  if (cbox[0] + cbox[2] > maxX) {
    p.onEdgeX(p, maxX - p.cbox[0] - p.cbox[2]);
  }
};

p.cbox is players local collision box [x,y,w,h]. eg: [-6, -6, 12, 12];
absCbox returns the collision box in world coordinates:
const absCbox = p => {
  let cbox = p.cbox;
  return [
    p.x + cbox[0],
    p.y + cbox[1],
    cbox[2],
    cbox[3]];
};

In checkEdgeX when the collision box exceeds the limit,
p.onEdgeX is called which puts the player inside the bounds again.
The problem is, when I want player to go beyond the edge to the other level.
How do I check if the player is allowed to pass beyond the edge to the next level?
When player goes to the next level, how do I make sure it is within the bounds again?
Because player might go just a little bit to stand in between two levels, never meeting inside the bounds of either level.
I want the transition to be in the image in my linked question above.

sentences:
Leaderboard not working in Unity I'm trying to create a leaderboard for my game. I have the game created and added the leaderbaord using cloudonce. I have also created the app on google play console and linked the app to the game services. I have followed the following tutorial to create the leaderboard: Leaderboard tutorial
I have followed the exact same instruction as given in the tutorial. Once the game is over, the leaderboard button is activated. I have attached LeaderboardsButton script(this script comes with the CloudOnce package) to the leaderboard button.
Here is the code in the game over panel for getting the score:
void OnEnable()
{
    DisplayGameOverScore();
}
void DisplayGameOverScore()
{
    gameOverScore.text = ((int)gameManager.playerScore).ToString();
    gameOverHighScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
    CloudOnceServices.instance.SubmitScoretoLeaderboard(PlayerPrefs.GetInt("HighScore", 0));
}

This is the CloudOnceServices script as per the tutorial:
public static CloudOnceServices instance;

private void Awake()
{
    TestSingleton();
}

private void TestSingleton()
{
    if (instance != null)
    {
        Destroy(gameObject);
        return;
    }
    instance = this;
    DontDestroyOnLoad(gameObject);
}

public void SubmitScoretoLeaderboard(int score)
{

    Leaderboards.HighScore.SubmitScore(score);
}

I have attahced this script to an empty game object along with the InitializeCloudOnce script(this is provided with the CloudOnce package).
I have also created an alpha test on googleplay. Once I open the link and start the game, the google play services console open and when I hit the leaderboard button, google play services console loads but after that nothing happens. It just goes back to the game. I read that other people ran into similar issues and the advise given was to check if the SHA1 certificate fingerprint is the same in app signing under release management and the credentials in GoogleApis. They both match. I'm not sure what the issue is?

sentences:
Procedurally generating a building of specific area Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly generated factory would have an area within a few units of (placeholder value) 30.

Its relatively simple to write a basic random rectangle generator to meet these specifications, but our goal is for the factory to be more complex, perhaps made up of 2, 3, or even 4 intersecting rectangles, producing more complex shapes (think of L, U, and O shaped buildings).

I've tried generating a random rectangle and then using basic algebra to fill in a 2nd rectangle, but so far I've had no luck implementing more than 2 rectangles, and even then I am unhappy with the results for just a 2 rectangle design.

Some more relevant info:
2D top down
Some of the mechanics are factorio style so rooms should have reasonable length and width to allow room for machinery
Currently in Java and Lua (can use built in libraries from either if needed)

Thanks in advance!

EDIT:
When I say "good" or "bad" outputs, a bad output would be any output which has space unusable by the player. The factory shape limits where the player can place factory machines such as conveyor belts. Ideally, the factory shouldn't have areas that are only 1-2 blocks wide, the shape shouldn't be one or two big rectangles with a line of 1-2 blocks "hanging" out to one side.
A good output would be where all floor space is "workable", so all areas are at least 3-4 blocks wide. A good output doesn't always have to be complex (1 or 2 rectangles is okay), but it should have a fair chance if being made up of more than 1-2 rectangles.

sentences:
Implementing a 2d Selection Box I'm in the process of implementing a selection box for my simulation and am having difficulty with something which appears simple. At the moment, I can draw the selection box and accurately select the items under it, provided the box was dragged from the top-left-hand corner downwards:

If I start dragging the box from any other point the rectangle doesn't correspond to that of the viewport, as demonstrated by the negative width and height.

Here is my code:

// selectionBox is Rectangle

if (mouse.LeftButton == ButtonState.Pressed && prevMouse.LeftButton == ButtonState.Pressed)
{
    if (selecting)
    {
        selectionBox.Width = mouse.X - selectionBox.X;
        selectionBox.Height = mouse.Y - selectionBox.Y;
    }
    else
    {
        selecting = true;
        selectionBox.X = mouse.X;
        selectionBox.Y = mouse.Y;
    }
}

// Code to handle selection finished omitted

// Drawing code
if (selecting)
{
    DrawingHelper.DrawRectangle(selectionBox, Color.Yellow, false);
    DrawingHelper.DrawRectangle(new Rectangle(startPoint.X - 4, startPoint.Y - 4, 8, 8), Color.Red, true);
}

How can I adjust the X, Y, Width and Height of my selection box so that X and Y are always the top-left of the selection box no matter where the selection began?

sentences:
How can I record and replay axis input accurately for testing? I want to do integration testing for an old C#/Unity project. The project uses its own input system, so I can't use inputEventTrace or any other convenient Unity class. So I subscribed a new game object to the custom input system so that it records any input detected in each frame.
But when I replay, because of the difference in frame times, the replays are not quite equal to the original playthrough (especially because of the axis input). My understanding is that input in Unity is not event-based, so I can't think of any way to perfectly mimic the input given different frame times. Does anyone know of a way to do this?

sentences:
Game Clock Precision I'm reading a fantastic article about game timer precision and here is a quote about 2/3 of the way into the article:

  If you start your game clock at about 4 billion (more precisely 2^32,
  or any large power of two) then your exponent, and hence your
  precision, will remain constant for the next ~4 billion seconds, or
  ~136 years.

He doesn't give a concrete example of this though.  Does this mean I would want to add 2^32 to the game clock value that I store at the beginning of each frame?  Or is there a way to actually set the clock in Windows so that the numbers start at 2^32?

sentences:
How do I manually define save paths in GMS? I want to know if it is possible to set the path for my game's save data in GameMaker: Studio outside of the two default options I am given in the program. The options I get are:

%LocalAppData%\<game_name>

and

%AppData%\<game_name>

I can't seem to find a text box or text feild that let's me set something different. I feel like there should be one for advanced users so that path variables and wildcards can be used in the save data path.

I also tried opening the game's config .gmx and setting the path there. Unfortunately it did not work as the only values that do work are 0 & 1 which represent the default path options respectively. Is this possible? Am I missing something?

sentences:
Spline type to achieve a specific result Is there a type of spline which can produce (approximately) the following result given the specified points indicated. I want to be able to specify how curved the corners are from the "centre points" so that I get "very square" corners to "very round" corners. Sorry about my shakey hand ! Points along a line should produce (roughly) a linear curve.

I found quite a few questions and answers online about this but they all seem to be B-spline related, and don't (I think) quite capture my constraints. If anybody knows what I'm looking for, direction to an online reference/article would be great.

My points always appear on an integer lattice (grid), and are always equally spaced.

I'm looking for something low complexity, but which I can pass a value, say t in [0,1] and returns the (x,y) position of the curve at that time. I realise I could probably build a function like this piece-wise, but wondered if there is a ready made spline solution (piece-wise equation) which could achieve the same result.

Maybe B-splines or NURBS are the answer, but maybe they are heavy on computation too...

Given Sirisian's answer below, I suddenly realised how Bezier curves work. Wow they really are a clever idea!

Everything seems centred around a single t value, e.g.

l1(t) = a+t(b-a)
l2(t) = b+t(c-b))
m(t)  = l1(t)+t(l2(t)-l1(t))

We can expand m to simplify if necessary.

I think B-Splines give a nice result, e.g. see below. It also has the advantage of not being restricted to a uniform grid. Not sure about speed of computation yet though...

sentences:
What are the typical day-to-day tasks of an entry level games programmer? What I would like to know is: What are the daily duties of a graduate programmer in the games industry workplace? Is it mostly coding, analysing, designing, or what?

Thank you.

P.S. I am in my second year of University at the moment and am working towards specialising in games programming, specifically gameplay, tools or UI programming.

sentences:
How to set "useGravity" for Rigidbody to entities in Unity For the position you can use this:
[Inject] private ComponentDataFromEntity<Position> _position;

But cant use it for Rigidbody. How to access the parameters for Rigidbody for entities?

sentences:
Change sprite angle on sloping ground I have a problem here with GameMaker built-in physics environment.My player is designed to be on a skateboard. I want my player to rotate its sprite, according to the kind of fixture(up or down slopes) he is moving on.I've tried everything i could and everything i could find, but it didn't help me much, because the object is rotating in a very strange way.I enabled some flags to see the mask. Also, I've been studying vector algebra and i know it the angle between vector x speed and vector y speed should be the direction. Please help. Here's what i have so far:

1 object which is the player
Information about object: obj_Player
Sprite: sprite7
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_Static_Parent
Children:
Mask:
Physics
Start Awake: true
Is Kinematic: false
Is Sensor: false
Density: 0.5
Restitution: 0.1
Group: 0
Linear Damping: 0
Angular Damping: 0
Friction: 0.2
Shape: Polygon
Points:
(76, 52)
(76, 60)
(0, 56)
(0, 52)
Create Event:
execute code:

///Initialize the tires
var half = sprite_width / 2;
var halfy = sprite_height / 2;
var tire = instance_create(x-half+12,y+halfy,obj_Wheel);
physics_joint_revolute_create(id,tire,tire.x,tire.y,0,0,0,0,0,0,false);
var tire = instance_create(x+half+12,y+halfy,obj_Wheel);
physics_joint_revolute_create(id,tire,tire.x,tire.y,0,0,0,0,0,0,false);

Step Event:
execute code:

//Code
facing = -point_direction(0, 0, phy_speed_x, phy_speed_y);
phy_fixed_rotation = true;
phy_rotation = facing;

//Move him
if(keyboard_check(vk_space)) {
physics_apply_impulse(x,y,0,-100);
}
if mouse_check_button(mb_left)
{
phy_position_x = mouse_x;
phy_position_y = mouse_y;
}

Information about object: obj_Wheel
Sprite: spr_Wheel
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_Static_Parent
Children:
Mask:
Physics
Start Awake: true
Is Kinematic: false
Is Sensor: false
Density: 0.05
Restitution: 0.1
Group: 0
Linear Damping: 0.1
Angular Damping: 0.1
Friction: 30
Shape: Circle
Points:
(8, 8)
(8, 8)
Create Event:
execute code:
Keyboard Event for  Key:
execute code:
            physics_apply_torque(-100);
Keyboard Event for  Key:
execute code:
            physics_apply_torque(100);

And here is the result:
  http://i.stack.imgur.com/sn1qh.gif

sentences:
Cartesian Coordinates & Layout The way cartesian coordinations are presented and used is kinda confusing.

When working with 2D the vertical axis is Y, though when working with 3D the vertical axis is Z and Y becomes the "depth" axis.

Basically I'm thinking the correct way, and best way would be to use the layout of axis.

Though Blender (3D modelling program) and other program, a lot games, present the axis in the "weird order" (my opinion)

Also if you read on Wikipedia about cartesian coordinates, your are presented with that layout of axis.

Wikipedia Cartesian Coordinates

Is there any specific or logical reason for this "flip" of axis?

sentences: Is Update called based on screens refresh rate? MonoGame My game is running 60fps (Because I'm using a 60hz monitor) but if I would use a 85hz monitor it would be running 85fps. My question is if update is called based on the screens refresh rate or if its limited to 60 calls per second

sentences:
Low Res Atlas Texture vs. Many different materials without textures So I have recently started to look into optimizing a medium complex 3D scene, more specifically i am looking to improve the performance i get from a fairly realistic bus. I am currently using the Unity3D standard shader. There are a lot of different objects within the scene, most of which are repeated and instanced. While many individual objects require only limited color variance often enough just a solid color and no texture at all.

I have read a lot about batching and atlasing but can't quite find an answer on the trade-off of using textures when no textures are required. I understand that reusing the same material allows for batching and can greatly reduce the amount of draw-calls, however how does this compare to the complexity of texture mapping if this could be avoided entirely? Is it still good practice to atlas solid colors on very low resolution atlas-textures and thus combine materials together? How does it look if i intend to use metallic and smoothness maps as well? Does it all come down to scene complexity and a number game or is there a straight answer?

I have the same uncertainty when it comes to objects which are made up of an arbitrary single digit number of solid colors; given supporting geometry, is it better to assign different materials with solid colors to regions of the object or create low-resolution textures?

In general; what is the point at which atlasing becomes the worse choice?

Thanks in advance!

sentences:
Behaviour Trees: How to clean up when a sequence is interrupted? I'll try to show my problem on a minimal example, in reality it's more complex:

It's a simple behaviour, that repeats "an action" that has a certain animation. If a player gets close, this sequence gets interrupted and the AI executes the "Flee" action.
The interruption happens because the top level selector is "dynamic" which in Unity/NodeCanvas means, that its higher priority nodes get executed every frame and if they succeed they interrupt the lower priority ones.
My problem is shown via the red arrow - if the "action" gets interrupted, the clean up (in this case "stop animation") doesn't execute.
What is the best practice to handle the clean up? Is my setup flawed? Or should I just be using a different interrupting mechanism?
Thanks for any help!

sentences:
Creating a 2D texture array for depth view Following my question here, I decided to create an 2D texture array for all of my depth screen texture so that I can use them for shadows for all my lights.

I'm having an issue setting it up, I'm getting an E_INVALIDARG when I try to create it.

This code is what I use to create the 2D array Texture

D3D11_TEXTURE2D_DESC sTexDesc;
sTexDesc.Width = this->Width;  // 1024
sTexDesc.Height = this->Height;// 1024
sTexDesc.MipLevels = 0;
sTexDesc.ArraySize = arraySize; // The value is 25 here
sTexDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
sTexDesc.SampleDesc.Count = 1;
sTexDesc.SampleDesc.Quality = 0;
sTexDesc.Usage = D3D11_USAGE_DEFAULT;
sTexDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
sTexDesc.CPUAccessFlags = 0;
sTexDesc.MiscFlags = 0;

HRESULT hr = pd3dDevice->CreateTexture2D(&sTexDesc, NULL, &(this->shadowTexture));
if(FAILED(hr))
    throw std::exception("Failed at creating texture array for shadows");

This is the code that I use to create the depth view

D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
ZeroMemory(&dsvDesc, sizeof(dsvDesc));
dsvDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
dsvDesc.Texture2DArray.ArraySize = arraySize; // The value is 25 here
dsvDesc.Texture2DArray.FirstArraySlice = index;
HRESULT hr = pd3dDevice->CreateDepthStencilView(shadowTexture, &dsvDesc, &pDepthMapDSV);
if(FAILED(hr)){ throw std::exception("Error creating 2d texture for shadow"); }

CreateDepthStencilView will return OK for the first texture but it  crashes for the second.

What have I done wrong here?

sentences:
Can I release any sort of app or game on the PlayStation Store? I'd like to develop a game, and try it out mainly on the Playstation 4.

Can I build any game, or app, and release it on the Playstation Store? Or does Sony only allow what it wants in the store, much like Apple and the AppStore? Note that I'm not asking how to build a game, but whether or not there are restrictions that would prevent me from releasing certain kinds of games or applications to the Store.

sentences:
Efficiently separating Read/Compute/Write steps for concurrent processing of entities in Entity/Component systems Setup

I have an entity-component architecture where Entities can have a set of attributes (which are pure data with no behavior) and there exist systems that run the entity logic which act on that data. Essentially, in somewhat pseudo-code:

Entity
{
    id;
    map<id_type, Attribute> attributes;
}

System
{
    update();
    vector<Entity> entities;
}

A system that just moves along all entities at a constant rate might be

MovementSystem extends System
{
   update()
   {
      for each entity in entities
        position = entity.attributes["position"];
        position += vec3(1,1,1);
   }
}

Essentially, I'm trying to parallelise update() as efficiently as possible. This can be done by running entire systems in parallel, or by giving each update() of one system a couple of components so different threads can execute the update of the same system, but for a different subset of entities registered with that system.

Problem

In the case of the shown MovementSystem, parallelization is trivial. Since entities don't depend on each other, and don't modify shared data, we could just move all entities in parallel.

However, these systems sometimes require that entities interact with (read/write data from/to) each other, sometimes within the same system, but often between different systems that depend on each other.

For example, in a physics system sometimes entities may interact with each other. Two objects collide, their positions, velocities and other attributes are read from them, are updated, and then the updated attributes are written back to both entities.

And before the rendering system in the engine can start rendering entities, it has to wait for other systems to complete execution to ensure that all relevant attributes are what they need to be.

If we try to blindly parallelize this, it will lead to classical race conditions where different systems may read and modify data at the same time.

Ideally, there would exist a solution where all systems may read data from any entities it wishes to, without having to worry about other systems modifying that same data at the same time, and without having the programmer care about properly ordering the execution and parallelization of these systems manually (which may sometimes not even be possible).

In a basic implementation, this could be achieved by just putting all data reads and writes in critical sections (guarding them with mutexes). But this induces a large amount of runtime overhead and is probably not suitable for performance sensitive applications.

Solution?

In my thinking, a possible solution would be a system where reading/updating and writing of data is separated, so that in one expensive phase, systems only read data and compute what they need to compute, somehow cache the results, and then write all the changed data back to the target entities in a separate writing pass. All systems would act on the data in the state that it was in at the beginning of the frame, and then before the end of the frame, when all systems have finished updating, a serialized writing pass happens where the cached results from all the different systems are iterated through and written back to the target entities.

This is based on the (maybe wrong?) idea that the easy parallelization win could be big enough to outdo the cost (both in terms of runtime performance as well a code overhead) of the result caching and the writing pass.

The Question

How might such a system be implemented to achieve optimal performance? What are the implementation details of such a system and what are the prerequisites for an Entity-Component system that wants to use this solution?

sentences:
How do I create a view matrix that does not contain the camera translation? I'm looking at this tutorial
https://capnramses.github.io/opengl/cubemaps.html
about half way down the webpage, there is a description of a vertex shader

#version 400

in vec3 vp;
uniform mat4 P, V;
out vec3 texcoords;

void main() {
  texcoords = vp;
  gl_Position = P * V * vec4(vp, 1.0);
}

  The P and V matrices are my camera's projection, and view matrices,
  respectively. The view matrix here is a special version of the
  camera's view matrix that does not contain the camera translation.
  Inside my main loop I check if the camera has moved. If so I build a
  very simple view matrix and update its uniform for the cube map
  shader. This camera only can only rotate on the Y-Axis, but you might
  use a quaternion to generate a matrix for a free-look camera. Remember
  that view matrices use negated orientations so that the scene is
  rotated around the camera. Of course if you are using a different
  maths library then you will have different matrix functions here.

I'm having difficulty figuring out how to construct this matrix in my program. How would I construct it from a projection matrix, view matrix, or camera matrix? (These are the matrices already within my program)

sentences:
How do I add a smooth force my player's rigid body, to make them jump? I am trying to add force to the player's rigidbody, when the screen is held. I've written the following code:

float PlayerForce=50.0f;

void FixedUpdate()
{
   bool PlayerActive = Input.GetButton ("Fire1");

   if (PlayerActive) {
       PlayerRigidBody.AddForce (new Vector2 (0, PlayerForce));
   }
}

This does not add a smooth jump effect. I've searched for smooth force effect, but I didn't find anything useful. How do I add a smooth force my player's rigid body, to make them jump?

sentences:
glsl uniform int as index of const array I have a const array that define a few materials for directionnal light. I'd like to change the material using an uniform int as index of that array. Doing that leads to severe framerate drop.

I know that this could be fixed by just keeping the array in the cpu and send the material as uniform. But why does this not lead to framerate drop and the other do?

It seems that even with 2 elements in my array I have framerate drops. But accessing the array with a constant doesn't make me lag ( I presume glsl drivers optimize this by replacing the line with the correct element in the array ).

This is my shader :

struct Material
{
    vec3 ambiant, diffuse, specular;
    float shininess;
};

const Material materials[] = Material[]
(
    Material( vec3( 0.05375, 0.05, 0.06625 ), vec3( 0.18275, 0.17, 0.22525 ), vec3(  0.332741, 0.328634, 0.346435 ), 0.3 * 128 ),
    Material( vec3( 0.1, 0.18725, 0.1745 ), vec3( 0.396, 0.74151, 0.69102 ), vec3( 0.297254, 0.30829, 0.306678 ), 0.1 * 128 ),
    Material( vec3( 0.25, 0.25, 0.25 ), vec3( 0.4, 0.4, 0.4 ), vec3( 0.774597, 0.774597, 0.774597 ), 0.6 ),
    Material( vec3( 0.19125, 0.0735, 0.0225 ), vec3( 0.7038, 0.27048, 0.0828 ), vec3( 0.256777, 0.137622, 0.086014 ), 0.1 * 128 ),
    Material( vec3( 0.24725, 0.1995, 0.0745 ), vec3( 0.75164, 0.60648, 0.22648 ), vec3( 0.628281, 0.555802, 0.366065 ), 0.4 * 128 ),
    Material( vec3( 0.0, 0.0, 0.0 ), vec3( 0.5, 0.5, 0.0 ), vec3( 0.60, 0.60, 0.50 ), 0.25 * 128 ),
    Material( vec3( 0.05, 0.0, 0.0 ), vec3( 0.5, 0.4, 0.4 ), vec3( 0.7, 0.04, 0.04 ), 0.078125 * 128 )
);

void main()
{
    Material mat = materials[ index ];

    vec3 lightColor = vec3( 1.0, 1.0, 1.0 );

    float diffuseFactor = max( dot( normalize( Normal ), lightPos ), 0.0 );

    vec3 reflectedRay = reflect( -lightPos, normalize( Normal ) );
    float specularFactor = pow( max( dot( reflectedRay, normalize( cameraPos - Position ) ), 0.0 ), mat.shininess );

    vec3 ambiantColor = lightColor * mat.ambiant;
    vec3 diffuseColor = diffuseFactor * lightColor * mat.diffuse;
    vec3 specularColor = specularFactor * lightColor * mat.specular;

    color = vec4( ambiantColor + diffuseColor + specularColor, 1.0f );
}

sentences:
Can you call a method from the script of all instantiated prefabs of a cetain object? I am currently trying to recreate chess and the problem I am having is that I need to instantiate all of the pawns in a loop (I could write it out but it seems inefficient) and I need to be able to call a method from all of the pawns to look for a check (I'll probably use raycast but I haven't gotten to that yet). How can I go about calling the method that looks for checks from all of the instances of the pawn?
I'm pretty new to unity so please go easy on me if I said something dumb

sentences:
How to create soft Icecream like particles with Liquidfun and Corona Currently using the "elastic" flags for particle behavior, which looks decent when it is flowing downwards but when the icecream collects in cup it is too liquidy.  Also this gives it a springy bounce which I am not sure how to take out. I am wondering how I should make it thicker more solid along but to stay a bit elastic? Can I change behavior of particle after it is created?

I have tried with a "spring" flag and "viscous" flag but it looks sort of the same.

Demo Clip

Corona/LiquidFun

  -- Create Particle System
  local particleSystem = physics.newParticleSystem{
    filename = _PRT,
    radius = 1,
    imageRadius = 2
  }

  offset_x = _C.x + 70
  offset_y = _UL.y + 100
  -- Paramaters for red particle faucet

  local particleParams_red =
  {
          flags = { "elastic"},
          linearVelocityY = -10,
          color = { 1, 0, 0.1, 1 },
          x = offset_x,
          x = offset_x + display.contentWidth * 0.15,
          x = offset_x + display.contentWidth * -0.15,
          y = offset_y,
          lifetime = 60.0,
          radius = 5,
  }

sentences:
What legal matters do I need to consider when releasing an MMO? Let's say I've finished programming an indie MMO game similiar to Tibia. I've got:

a stable server application ready to launch;
a tested, bug-free, working client application ready to play;
the game's official website (ready to host), with a payment system and freely downloadable game client.

No matter how impossible it sounds, let's also assume none of these break copyright laws.

My game divides accounts into free and premium groups. Premium accounts can access all game features, requiring server authorisation to work properly. Let's say that the "premium account" can be bought on the website for a fixed monthly rate. Free accounts can play for free, but with limited access. This is what the mentioned payment system will be for. If I've correctly understood, this is the freemium model.

I'm completely novice to business entity issues, so
in short: what steps, in legal terms, do I have to take from here so my game can legally earn me money? For example, is there something like verification that the game gives the user what it actually offers when paying on its website?

If relevant, I live in Europe.

sentences:
Making a DX9 game resolution independent How can I change the resolution and stretch my entire game to the new resolution? I want my game to have a base resolution, and when I change it to stretch to that new resolution. I saw a few similar questions but all the answers suggested that i should change the presentation parameters. If i do that, my screen resolution changes, but all my other objects remain the same size and draw in the wrong position.

I use a LPD3DXSPRITE object to draw the textures to the screen, some DirectX text, and vertices defined as this:

#define D3DFVF_VERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

I tried to put D3DXSPRITE_OBJECTSPACE at sprite->Begin() and play with the projection, view and world matrices but without success.

Can someone tell me if this method is possible and how should I do it? I also read about another method that suggested rendering to a surface, and then stretching the surface, but i don't know how to implement that. I am a beginner in DirectX. I googled the second method, but I couldn't find someone explaining it, and I don't think I can draw from a sprite to a surface.

sentences:
ID3D11Buffer and std::array : buffer looks empty I am having trouble at rendering vertices stored in a std::vector.

// Create and initialize the vertex buffer.
D3D11_BUFFER_DESC vertexBufferDesc;
ZeroMemory(&vertexBufferDesc, sizeof(D3D11_BUFFER_DESC));
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.ByteWidth = sizeof(VertexData) * this->vertex_data.size();
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;

D3D11_SUBRESOURCE_DATA resourceDataVertex;
ZeroMemory(&resourceDataVertex, sizeof(D3D11_SUBRESOURCE_DATA));
resourceDataVertex.pSysMem = &(this->vertex_data);

HRESULT hr = pDevice->CreateBuffer(&vertexBufferDesc, &resourceDataVertex, &(this->pVertexBuffer));
if (FAILED(hr)) return false;

this->vertex_data being a std::vector<VertexData> with VertexData being:

// Vertex data
struct VertexData {
    XMFLOAT3 v;
    XMFLOAT2 vt;
    XMFLOAT3 vn;

    VertexData(XMFLOAT3 v, XMFLOAT2 vt, XMFLOAT3 vn) : v{ v }, vt{ vt }, vn{ vn } {}
};

Now I'm not sure doing resourceDataVertex.pSysMem = &(this->vertex_data); is a good idea. I can render another mesh without problem just by changing the ID3D11Buffer vertex buffer (said mesh being known at compile-time and stored in a C-Array).

This time around I simply get no render at all. I triple checked my object is in sight and vertex_data is fully populated.

sentences: How can I place my Enchant.js game into a DIV in a fully-designed web site? Following the Enchant.js tutorial I cannot find a way to define the place the game is rendered in the page. It either takes the maximum possible area or limits itself to the given size (using game.scale = 1).

sentences: How check if an arbitrary given mesh is a single closed mesh? I'm building a space game where it is allowed for the player to insert his own mesh to be his spaceship. The problem I'm facing is that a ship must be a Polygon Mesh. The player will then be able to place thing inside the ship to make it behave. My question is, given an arbitrary mesh (a set of vertices and triangles), how check if it is a polygon mesh (no holes, with a clear inner side)?

sentences:
Creating the Animations in C++ from 3DS Max I'm reading from the FBX format and I'm using Bones to animate an object, and I'm at the point where I have to decide on the code that actually moves the vertexes.

So far I thought on two methods:

Create a bone class that has an array of XYZ and an array of vertexes addresses and the weight. The array of XYZ (and rotations' values) will be filled from their positions/rotations at every frame.
My model object will have an array of this bones class, and at each call I'll update the vertexes by multiplying the bones' XYZ for the vertexes, something like:

for(int i = 0; i < object->bonesCount; i++)
{
    for(int j = 0; j < object->bones[i]->vertexesCount; j++)
    {
        object->bones[i]->vertex[j].xyz *= object->bones[i].xyz; //plus rotation
    }
}

And the second method is having an array of vertexes * amount of frames, I do something like the above code and I save each vertexes' positions at every frame in the array, so I don't have to call the loop above (I think it might impact performance), but I'd have much more arrays to work with.

So my questions are, (1) which is the best approach for this, and (2) is there another method I didn't think of?
Any info related to this is appreciated, as I have nothing done yet and I'm still elaborating on how it should be before I start coding (I try to avoid doing the first thing I come up with so there's less chances of needing to recode it later).

Thanks!

sentences: What is the difference between an alpha and a beta release? What is the difference between an alpha and a beta release? I'm surprised this question hasn't been asked here before.

sentences:
GL_DEPTH_COMPONENT vs GL_DEPTH_COMPONENT32 I googled like crazy and checked the OpenGL documentations but I couldn't find out how the precision of a depth buffer created using GL_DEPTH_COMPONENT is chosen.

As far as I know the precision is implementation dependent. But how will the precision be chosen? Will it always use the highest precision possible or rather the fastest one? Or is no general answer possible?

Shoud I always go with GL_DEPTH_COMPONENT32 instead?

sentences:
Is it a good option to simultaneously work on a game and a game engine? I'm considering this, now I work on 3d game but I want also to make in slow tempo, iteratively a game engine is it a good choice?
The game what I working on is with non custom engine (Unity, Unreal Engine 4 - I not yet selected, switching from engine to engine)
and also I want to develop a custom 3d engine but this engine will not be heavy but lightweight so with selected features. So I'm not talking about making Unity like engine but still 3D thank you for answer :)
And this engine will contain:

c#
opengl
existing physics engine (Bullet or sth)
...

what I not considering:

editor
multiplayer
characters

so just API
Additionally I have linear algebra background but no experience with shaders
edit: currently I want to make game in existing game engine
but in future I want to migrate with game to custom game engine

sentences:
God rays shader - Trouble with sun position I have found a shader that I like here: https://www.shadertoy.com/view/4dyXWy

The code for the fragment shader from the link above is:

#define DITHER          //Dithering toggle
#define QUALITY     0   //0- low, 1- medium, 2- high

#define DECAY       .974
#define EXPOSURE    .24
#if (QUALITY==2)
 #define SAMPLES    64
 #define DENSITY    .97
 #define WEIGHT     .25
#else
#if (QUALITY==1)
 #define SAMPLES    32
 #define DENSITY    .95
 #define WEIGHT     .25
#else
 #define SAMPLES    16
 #define DENSITY    .93
 #define WEIGHT     .36
#endif
#endif

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord.xy / iResolution.xy;

    vec2 coord = uv;
    vec2 lightpos = texture(iChannel0, uv).zw;

    float occ = texture(iChannel0, uv).x; //light
    float obj = texture(iChannel0, uv).y; //objects
    float dither = texture(iChannel1, fragCoord/iChannelResolution[1].xy).r;

    vec2 dtc = (coord - lightpos) * (1. / float(SAMPLES) * DENSITY);
    float illumdecay = 1.;

    for(int i=0; i<SAMPLES; i++)
    {
        coord -= dtc;
        #ifdef DITHER
            float s = texture(iChannel0, coord+(dtc*dither)).x;
        #else
            float s = texture(iChannel0, coord).x;
        #endif
        s *= illumdecay * WEIGHT;
        occ += s;
        illumdecay *= DECAY;
    }

    fragColor = vec4(vec3(0., 0., obj*.333)+occ*EXPOSURE,1.0);
}

That is in GLSL, but I am using DirectX 11. I've been able to port it across quite easily, but I feel like I have some knowledge gaps that are making it hard for me to get correct. For example, I don't understand the difference between texture(iChannel0, uv).x and texture(iChannel0, uv).r if someone wouldn't mind explaining ( I understand sampling the colour channels but xyz while sampling?).
I also do not understand the channel resolution. Is it the dimensions of the 2D texture that I'm rendering to? Or perhaps the ratio of the texture?

Here is what I have come up with so far, just the bare minimum of changes to get it working:

SamplerState g_samSampler   : register( s0 );
Texture2D g_texInfo         : register( t0 );

#define DITHER
#define DECAY       0.974f
#define EXPOSURE    0.24f
#define SAMPLES     64
#define DENSITY     0.97f
#define WEIGHT      0.25f

struct PixelInput
{
    float4 vPosition : SV_POSITION;
    float2 vTexCoord : TEXCOORD0;
};

float4 PS( PixelInput input ) : SV_TARGET
{
    float2 uv = input.vTexCoord;

    float2 coord = uv;
    float2 lightpos = g_texInfo.Sample( g_samSampler, uv ).zw; //TAKE NOTE OF THIS LINE

    float occ = g_texInfo.Sample( g_samSampler, input.vTexCoord ).g; //light
    float obj = g_texInfo.Sample( g_samSampler, input.vTexCoord ).b; //objects
    float dither = g_texInfo.Sample( g_samSampler, uv/float2( 4.f, 3.f ) ).x;

    float2 dtc = (coord - lightpos) * (1.f / float(SAMPLES) * DENSITY);
    float illumdecay = 1.;

    for(int i=0; i<SAMPLES; i++)
    {
        coord -= dtc;

        #ifdef DITHER
            float s = g_texInfo.Sample( g_samSampler, coord+(dtc*dither) ).g;
        #else
            float s = g_texInfo.Sample( g_samSampler, input.vTexCoord ).g;
        #endif

        s *= illumdecay * WEIGHT;
        occ += s;
        illumdecay *= DECAY;
    }

    return float4(float3(0.f, 0.f, obj*.333f)+occ*EXPOSURE,1.f);
}

Please note that my green channel of the passed in texture g_texInfo stores the light texture (the white circle for the sun) and the blue channel stores the light occluders.
I am doing this as a post processing effect on a screen quad. (Is this correct?)
My suspicion is the line float2 lightpos = g_texInfo.Sample( g_samSampler, uv ).zw; is causing the trouble - I don't really understand this part - how can I find the position of the sun?

Here's what I'm receiving from my current shader, it appears that the light rays are being emitted in the wrong direction.

When I shift the camera so that the sun is in the top left, it gives the correct effect, it is also occluded properly when putting an object in the way.

sentences: Find out triangles that are not occluded from a camera view? For a project i need to find out triangles that are directly seen by the camera / user. Triangles that are occluded by other triangles should be ignored. There may be 200 thousand triangles in a model, so raycasting on a CPU is no possibility due to performance. Is there something build in to unity or opengl that can do this? If not how would you approach this problem? Many 3d editing software use techniques, e. g. to select or slice only triangles that are visible.

sentences:
Unity for loop: (List) Argument out of range I am attempting to copy the contents of one list into another. On the first iteration I get an "Argument out of range" error.

static List<Building> SaveBuildings(List<Building> buildings)
{
    if (buildings.Count == 0)
        return null;
    Debug.Log("Save Buildings Count: " + buildings.Count);
    List<Building> records = new List<Building>();
    for (int i = 1; i < buildings.Count; i++)
    {
        Debug.Log("i: " + buildings[i].name);
        records[i] = buildings[i].GetRecord();
    }
    return records;
}

The offending line is: records[i] = buildings[i].GetRecord();

This code "Debug.Log("Save Buildings Count: " + buildings.Count);" shows that the list is not empty. The following code "List records = new List();" instantiates a new list to be used.

My understanding is that everything should work well, but when I run the code this line fires "Debug.Log("i: " + buildings[i].name);" and then the error.

I've changed "int i" to be "0" and "i < buildings.Count" to "i <= buildings.Count" with i being 1 and 0. Same results.

I need fresh eyes to find the error lol thank you for your help

sentences:
Handling data logic on libgdx ai state machine or in ashley system? In this below example, I've combined libgdx ashley and AI state machine. Do you think it's a good idea to handle the logic in state machine or stick on handling the data logic on System?

public enum TrollState implements State<Entity> {
     MOVE_AWAY() {
         @Override
         public void enter(Entity entity) {

         }

         @Override
         public void update(Entity entity) {
              PositionComponent position = Mappers.position.get(entity);
              ...
         }

         @Override
         public void exit(Entity entity) {

        }

        @Override
        public boolean onMessage(Entity entity, Telegram telegram) {
             if (telegram.message == 0) {
                 Gdx.app.log("Slime", "Waaaah, goo away, big daddy! yummmmmmy");
                 return true;
            }
            return false;
        }
     }
}

sentences:
Unity : Objects become black when size is changed to smaller While working with Unity 5.4, my models become black when I resize them to a smaller scale. When I make the models bigger they are fine. I am using a directional light . On the image below as you can see on the left the model is fine. But the others are black.

HOPE YOU CAN HELP.

sentences: Google Admob GDPR compliance - Unity I have created a unity game that uses admob to show only rewarded video ads and there are no banner/interstitial ads in my game. Is it mandatory to take user consent (for EU countries) for showing the rewarded ads and if so how do I go about implementing it. I followed some online tutorials to implement admob ads but there was no mention of gdpr in any of those. Can someone please help?

sentences:
Beginner flash game development: Start with framework or from scratch? I want to write some simple flash games (as a hobby). I have a lot of programming experience, but no experience with Flash/ActionScript.

My question is:
As a beginner, is it a good idea to start with a framework like Flixel, FlashPunk or PushButton or would it be better to write my first games from scratch?

Also, if you vote for using a framework, which one would you recommend?
What are the differences?

And another question: What about Flex, would you recommend using it?

sentences:
Narrow-phase collision detection algorithms There are three phases of collision detection.

Broadphase: It loops between all objecs that can interact, false positives are allowed, if it would speed up the loop.
Narrowphase: Determines whether they collide, and sometimes, how, no false positives
Resolution: Resolves the collision.

The question I'm asking is about the narrowphase. There are multiple algorithms, differing in complexity and accuracy.

Hitbox intersection: This is an a-posteriori algorithm, that has the lowest complexity, but also isn't too accurate,
Color intersection: Hitbox intersection for each pixel, a-posteriori, pixel-perfect, not accuratee in regards to time, higher complexity
Separating axis theorem: This is used more often, accurate for triangles, however, a-posteriori, as it can't find the edge, when taking last frame in account, it's more stable
Linear raycasting: A-priori algorithm, useful for semi-realistic-looking physics, finds the intersection point, even more accurate than SAT, but with more complexity
Spline interpolation: A-priori, even more accurate than linear rays, even more coplexity.

There are probably many more that I've forgot about. The question is, in when is it better to use SAT, when rays, when splines, and whether there is anything better.

sentences: Can geometry grass shaders be painted to a terrain or are they limited to meshes? So I was follow the roystan grass shader tutourial and although it works well I don't understand the use for it. From what I understand the shader is basically just a flat plane that calculates grass on top of it. If I wanted to apply this grass to a terrain and place it on uneven ground would I have to manually add in a "grass plane" all over the environment and at different angles or am I missing something? Thanks.

sentences:
Masters in Computers Science OR Game Design and Development? Hey guys so I've been very confused on what path to take in terms of education. I'm a soon to be computer science graduate with a BS in Computer Programming.
My hope is to one day land a job in the gaming industry but I've read a few posts on what people have said against and for a degree in game design. They have all been about a bachelors degree and in my case that will already be obtained.

It is true that a computer science degree is more general and that many non gaming employers will not think of it as any less, compared to a game design degree. But since I already will receive a computer science degree will it still look bad if I have a masters in game design and a BS in computer science when interviewed for a gaming company and non gaming company? As well as is the masters in game design worth it or should I stick to with computer science?

what i hope to gain from my degree is further understanding of game creation, I want to develop my own game and I have been learning to use Unity and Unreal but want to expand my knowledge in other areas.

I want your input on what you consider the best choice and why.

Thanks.

sentences:
What are the parameters for btHingeConstraint::setLimit? What does each parameter in btHingeConstraint::setLimit do to the hinge constraint?

void btHingeConstraint::setLimit    (   btScalar    low,
        btScalar    high,
        btScalar    _softness = 0.9f,
        btScalar    _biasFactor = 0.3f,
        btScalar    _relaxationFactor = 1.0f
    )

sentences:
Does gimbal lock occur only when a combination of local and world rotation axis are used? In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis with another which causes us to lose a degree of freedom. This never made sense to me since a rotation around e.g. the LOCAL_RIGHT axis will rotation the whole LOCAL_BASIS, no alignment happens. The only explanation I've seen that made sense was this one by DMGregory where it clearly explains that gimbal lock occurs when we e.g. change the yaw using the local basis and the pitch using a world basis.
My question is: Is that the only scenario where gimbal lock occurs or am I missing something? I also thought that quaternions help avoid gimbal lock but again, I'm missing something here because it seems to occur regardless of the rotation representation method (euler/quaternion).

sentences:
Aggregation of value in GLSL loop results in 0 I'm banging my head against a wall trying to understand why this code is giving me some reasonable results with some visible colors on parts of the screen...

#version 130

in vec2 vTex; // must match name in vertex shader
flat in int iLayer; // must match name in fragment shader

out vec4 fragColor; // first out variable is automatically written to the screen

uniform sampler2DArray tex;
uniform sampler2DArray norm;

#define MAX_LIGHTS 4

struct Light {
    vec3 position;
    vec4 color;
    vec3 falloff;
    vec3 aim;
    float aperture;
    float aperturehardness;
};

uniform Light lights[MAX_LIGHTS];

void main()
{
    vec4 DiffuseColor = texture(tex, vec3(vTex.x, vTex.y, iLayer));
    if (DiffuseColor.a == 0)
        discard;
    vec3 NormalMap = texture(norm, vec3(vTex.x, vTex.y, iLayer)).rgb;
    NormalMap.g = 1.0 - NormalMap.g;
    vec3 FinalColor = vec3(0,0,0);

    for (int i=0; i<MAX_LIGHTS; i++)
    {
        vec3 LightDir = vec3((lights[i].position.xy - gl_FragCoord.xy) / vec2(320.0, 200.0).xy, lights[i].position.z);
        float D = length(LightDir);
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);
        vec3 Diffuse = (lights[i].color.rgb * lights[i].color.a) * max(dot(N, L), 0.0);
        vec3 sd = normalize(vec3(gl_FragCoord.xy, -1.0) - lights[i].position);
        float Attenuation = smoothstep(lights[i].aperture * lights[i].aperturehardness, lights[i].aperture, dot(sd,lights[i].aim))
            / (lights[i].falloff.x + (lights[i].falloff.y*D) + (lights[i].falloff.z*D*D) ) ;
        vec3 Intensity = Diffuse * Attenuation;
        FinalColor = max(FinalColor, DiffuseColor.rgb * Intensity);
    }
    fragColor = vec4(FinalColor, DiffuseColor.a);
}

... but when I change FinalColor = max(FinalColor, DiffuseColor.rgb * Intensity); to FinalColor = clamp(FinalColor + DiffuseColor.rgb * Intensity, vec3(0,0,0), vec3(1,1,1)); everything goes black. Is there something I don't understand about aggregation of variables in loops in GLSL, or about the + operator operating on vectors? By my logic, the changed code should return more brightness than the original code because the changed code would be adding all the values whereas the old code would just be taking the highest one.

sentences:
Use JS to grab values from a dynamic Lua Table ((BACKGROUND: I'm modding a game that runs using Lua and the Source2 Engine (Dota). Gameplay logic uses Lua and HUD uses JS))
I used Lua to create a global table. For instance:
global itemRollsManager[itemID] = {
  id = 19,
  buff1 = "modifier_bonus_range",
  ability = "tusk_ice_shards"
}

Now I need to grab that info and display it in the HUD using JS. I've successfully grabbed the itemID inside JS, but now I need to grab that table and those values while the game is running.
How do I do this? Is it even possible with just JS and Lua?

sentences:
How to Stop TextMeshPro Truncate from Removing Next Line? Unity 2020.3.1f1 In updating from Unity 2019 to 2020, it appears the TextMeshPro (TMP_Text) is behaving differently. The code for TMP stayed the same upon updating Unity, so I presume Unity itself must be doing something differently. Nevertheless, I also updated the TMP package and it did not resolve the issue.
The Issue:
I have two lines of text in one text box. I want the overflow to be truncated, but to keep the second line in existence. Example Input:
This is the really long text on the first line that I want cut but
still have this line show.

In short, I want it to read as follows when using the "truncate" option like it used to work before
This is the really long text
still have this line show.

Instead, the second line disappears and it acts as if I have only that first line (centered vertically).
This is the really long text

So how do I get this functionality back? Is it possible?

sentences:
Experienced coder/designer moving into game development - what's involved? I am interested in moving into game development once my current project is done, as it's nearly at a point where it will pay my bills and allow me to hire someone else to take the driver's seat, meaning that, for the first time in my working life, I'll be in a position to devote a proper amount of energy to getting into game development, which has been something I've wanted to do for a long time but forced myself to wait on, as there are only so many hours in the day to devote to projects.

I am an experienced web developer (12 years) with most of my experience programming in C# and .Net (8 years). I am also a capable graphic designer. I have a surface knowledge of C++, though it's been 10 years since I wrote any C++ code. I also played with the DirectX 5 API back then as well.

I am happy to outsource graphics and sound, leaving me with coding, game design, level design and so forth.

Do I need to learn C++ properly, or can I rely on my C# and .Net knowledge?
If I'm going to leave C++ out of the equation, am I seriously limiting myself with regards to platform agnosticism?
Given that my memory of mathematics (high school level) is hazy at best, how much time I do I need to devote to pure maths self-education, or can I pretty much figure it out as I go?

In a nutshell, I'd love to get some idea of what the best approach for me would be, including DO's and DON'T's that might slow me down. I know that baby steps will be required at first, but it would be nice to get some advice as to what path I should follow to get myself up to speed quickly so that I am able to create decent indie games with nice looking 3D graphics, AI, particle effects and so forth.

sentences:
Optimization of A* in Python I am working on an IA (in Python) for small board game, and I need to do a lot of pathfinding per round in order to find the best move I can do (minmax implementation).

My problem is that even if the board is small (9*9), I am able to run it (only) approx. 10000 per second, and I don't know how to speed it. Do you have some advise?

def shortest_path(self, start, goal):
    elements = []
    heapq.heappush(elements, (0, start))

    came_from = {}
    cost_so_far = {}
    came_from[start] = None
    cost_so_far[start] = 0
    current = None
    while len(elements) > 0:
        current = heapq.heappop(elements)[1]
        if goal.is_on_goal(current):
            break
        for next in self.edges[current].neighbors:
            new_cost = cost_so_far[current] + 1
            if next not in cost_so_far or new_cost < cost_so_far[next]:
                cost_so_far[next] = new_cost
                lowest_priority = new_cost + goal.heuristic(next)
                heapq.heappush(elements, (lowest_priority, next))
                came_from[next] = current
    way = []
    if goal.is_on_goal(current):
        reverse_edge = current
        while reverse_edge in came_from:
            way.insert(0, reverse_edge)
            reverse_edge = came_from.get(reverse_edge, None)
    return way

sentences: pre-load new scene in unity async but don't show it I have a top down dungeon crawler in 3D where I show one room at a time. Each room is it's own unity scene. Each room has an exit point that when clicked I fade the screen, load a new scene and then fade in the screen. What I'd like to do, but not sure how, is to pre-load the next possible scenes (note the S, there will be 2 but could be more. 2 because it's the next room or the previous if the player decides to go back) while in one scene. I know the scenes that are possible to get to, but how can I pre-load but not show them and because there is more than 2, I assume if they go in one direction, there is a pre-loaded one that I need to unload. Overall I want to do this to make a faster/smoother transition between rooms, but I want the one room at a time for artistic style.

sentences:
Unity: how to mimic the lighting of a mesh as seen in the editor view I have a camera which shows a "bird's eye view" of a procedurally generated mesh like so:

Currently in the editor view (right), the terrain looks exactly as I would like it to. However, in game (left) I haven't been able to get it to appear as I would like:

I was using a directional light above, which was causing the effect where the centre of the mesh appears "shiny". So I looked around at some forum posts and questions on here and decided to try using ambient lighting instead by altering the settings in Window>Rendering>Light Settings, but this is the result:

This is the material I'm using (EDIT: I'm using a particle shader as the colouration of my mesh is based on altering Mesh.colors. ):

I have tried fiddling around with different material types but I couldn't get better results. My question is: how do I set up my game to use the same lighting that's being used in the editor?

Thanks in advance

EDIT: Camera settings at runtime as requested:

EDIT 2: Just to update; I have still not managed to fully solve this problem. I ended up using some different colours for my heightmap and tweaking the Metallic and Smoothness properties of the material, and the shininess and non-even lighting is somewhat diminished, but it does still exist.

If you watch at about 20 seconds into this video, when the mesh is dully coloured, the "circular" lighting effect is still present, which shadows being cast from the centre outwards, and the middle appearing almost blurred and the edges sharp.

Later in the video you can see a colourful version of the mesh, where these undesirable lighting effects are barely noticeable (note that I don't always want it to be be in bright colours, hence this is still an issue).

I feel like there should be a very simple solution to this. Why can I not get the lighting conditions that I see in the editor in the game view?

I am very happy to keep updating here with further progress/clarifications, and would love to hear any suggestions anyone has.

sentences:
Doesn't multiple inheritance solve all problems that entity systems do? The question is pretty self explaining: doesn't multiple inheritance solve all the problems that entity systems also solve?

I just remembered a term called "multiple inheritance", and that seems to solve a lot of bloating problems that classical inheritance imposed.

sentences:
How to properly handle the landing part in a jump animation Look at this sprite sheet.

It is clear that frame 1-3 are the "jump up" frames after which the last frame will be fixed until the "peak" of the jump (when gravity starts pulling back). When moving back down frame 4-7 are used and it all ends with an "idle" frame (which is not shown here in this jump sprite).

My question is about frame 6 and 7 in this sprite. When the entity "lands" after a jump it is suppose to run animation 6-7 as the "landing" animation. When moving down in a jump frame 4-5 are easy because they are the "start" of the animation. Frame 5 can be kept for as long as you fall... but what is the appropriate way to go from frame 5 to 6-7-x? Do you check if the frame after the next is a fall and then "initiate" landing or do you do that when you have actually hit the ground?

It can't be timed because of various scenarios such as jumping off a cliff or jumping under a low roof hitting your head and bouncing you back down.

Any ideas?

sentences:
Solving 2D Collision Detection Issues with Relative Velocities Imagine you have a situation where two objects are moving parallel to one-another and are both within range to collide with a static wall, like this:

  => 20m/s     => 40m/s
+==========+ +==========+          +======+
| Object A | | Object B |          | Wall |
+==========+ +==========+          +======+

 |-- 1m --|   |-- 1m --|  |- 1m -|

A common method used in dynamic collision detection is to loop through all objects in arbitrary order, solve for pair-wise collision detection using relative velocities, and then move the object to the nearest collision, if any.

However, in this case, if object A is checked first against B, it would see that the relative velocity to object B is -20 m/s (and would thereby not collide this time frame). Then it would see that the object A would collide with the static wall, and the solution would be:

+==========++==========++======+
| Object B || Object A || Wall |
+==========++==========++======+

And the red object passes through the blue one. So it appears to be a matter of choosing the right order in which you check collisions; but how can you determine which order is correct? How can this passing through of objects be avoided? Is ignoring relative velocity and considering every object as static during pair-wise checks a better idea for this reason?

sentences: Can I develop on the Oculus Rift with below the minimum required hardware? I have tried to see if my GTX 960m supports VR and sadly it seems I need minimum GTX 970m, still I have seen videos that if you overclock your 960m you can get a decent 115 frames. My question is, can I still develop games for the Oculus Rift in my 960? I can't afford now to buy assets, oculus and a new laptop.

sentences:
Is there a gl*TexStorage* equivalent to glCompressedTexImage* I have been using glTexImage functions to create textures and then heard of glTexStorage* that is supposed to be better and is introduced in the latest standards.

But the problem is that I can't seem to find an equivalent to glCompressedTexImage2D(...) in terms of gl*TexStorage.

I've only found 2 references on an IRC chat to these supposedly equivalent functions while searching. (here and here)

Do these equivalent functions even exist ? And if they don't, why don't they exist ?

Thanks for any help

sentences:
how to ignore physics collision of some objects in box2d I know this sounds silly but I would like some objects to follow physics while others not to collide each other.

I tried to achieve them by setting their position exclusively. But then it will ignore all physics.

Is what I am trying to do even possible?

sentences:
Handling exact collisions on character controller and/or other objects in unity? (eg. head shot, chest , leg,etc) Hello all I have been working on games in Unity for a long while (making slow progress as I do it purely on my own , and of course you helpful people here on gamedev.stackexchange!)

I've made lots of capsule characters of my own using Rigidbody and without Rigidbody and on a basic level they work fine.  But i now want to detect exact points of collisions (for example if a bullet hits his head, or hand or knee etc etc)

I've been trying to read as much as I can find about this, but honestly can't find the answer i need. I believe I would achieve it by making several colliders on the character. But I don't know exactly how this would work , also I have seen some guides saying that I should use OverlapSphere but again there wasn't exact instructions and I can't figure out how to do it.

Also, when I add some sphere colliders to my character, they dont stay in the correct position in relation to the model once it is animated (eg. Crouching, or running, the leg spheres pop out of his legs for example).

Could anyone here provide an explanation of how I can do it?

sentences:
Unity SkinnedMeshRender: is there a way to cache mesh and restore later? In unity, I'm writing a script that deforms a mesh associated with a SkinnedMeshRenderer pretty significantly. However, at some point, I'd like to reset it back to particular states. I'd like the ability to both reset to its original position, and an intermediate position.

Right now, I've tried baking the mesh:

Mesh originalMesh = new Mesh();
skinnedMeshRenderer.BakeMesh(originalMesh);

But when I then try to restore it:

skinnedMeshRenderer.sharedMesh = originalMesh;

It doesn't seem to behave as I would have expected.

I've also tried:

Mesh originalMesh = skinnedMeshRenderer.sharedMesh;
//deform sharedMesh
skinnedMeshRenderer = originalMesh;

but this does nothing since it seems to be just storing a reference.

Am I missing something obvious here?

Just to add detail, I want to take a snapshot of all the verticies, weights, blendshapes, etc. And then restore everything back to the snapshot at a later moment in time. I can reset the blendshapes fine, but the mesh seems to be messed up.

sentences:
How is the Call of Duty checkpoint system implemented? Does anybody know how it is implemented or has any advice how to do it?

I'm especially interested in how to avoid that a player dies right after a checkpoint. How does the game evaluate when it's save to do one. Of course there seem to be "simple" triggers based on passing through a position in the map or achieving certain objectives, but I'm pretty sure they avoid that the game saves while a bullet is in flight killing you.

I have the feeling that the game shows you something slightly different on every reload, like if it would save the game at one point and maybe do a little replay. If it reloads and you die quickly, the next reload will be slightly different, I feel.

Could it be that once a trigger for a checkpoint is passed, the game saves it's whole state to a new file. Then it waits for maybe 2s whether you die. Only if you don't die it saves the game. Is that all?

Maybe it even freezes it's random number generator and stores the next player actions, too. So when the checkpoint loads, it can fast forward a little bit and a different amount of time each load?

sentences:
combining multiple materials into one material (Unity) I am confused with how should I texture my character.

I am using blender for modelling. And while my model is too complex I dont want to use uv map techniuqe. I can get what I need with using seperate materials. Therefore I assign different materials to different meshes in Blender then import it to Unity. Therefore I have lots of different material in one model and I think it increases draw call. What can I do to combine these material into just one.

I thought baking would be sollution but while my character is dynamic I can not get a good result.

sentences:
Why do prefabs speed up loading? I have a scene with a massive terrain.  It took a long time to load (approximately 60 seconds) when I pressed play. I am in the editor.

I prefabbed it.

Now it only took about 5 seconds to load when I pressed play.  Why?

My best guess is that there is some preloading done when it is prefabbed, but it only takes a few seconds to prefab it.  So that couldn't be the reason.  Any ideas?  I am at a loss.

sentences:
How do I stop my player or camera from jittering during player movement? In my game, I have a third person character. The player moves with a rigidbody and has isKinematic set off with interpolate on. In the script, it moves with Rigidbody.MovePosition with the y position froze. Here's my player script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
   public float speed;

   public Rigidbody rb;

   public Transform camPos;

   // Start is called before the first frame update
   void Start()
   {
       rb = GetComponent<Rigidbody>();
       camPos = Camera.main.transform;
   }

   private void FixedUpdate()
   {
       if (Input.GetKey("w"))
       {
           rb.MovePosition(transform.position + (camPos.forward * speed * Time.fixedDeltaTime));
       }
       if (Input.GetKey("s"))
       {
           rb.MovePosition(transform.position + (-camPos.forward * speed * Time.fixedDeltaTime));
       }
       if (Input.GetKey("d"))
       {
           rb.MovePosition(transform.position + (camPos.right * speed * Time.fixedDeltaTime));
       }
       if (Input.GetKey("a"))
       {
           rb.MovePosition(transform.position + (-camPos.right * speed * Time.fixedDeltaTime));
       }

       rb.velocity = Vector3.zero;
   }
}

For my camera, I have it lookat the player and lag behind smoothly. Here's that script:
//Hakeem Thomas
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamPos : MonoBehaviour
{
    public Transform target;
    public float smoothTime = 0.5F;
    private Vector3 velocity = Vector3.zero;

    public GameObject player;

    private float mouseX, mouseY;
    public int mouseX_Speed, mouseY_Speed;

    //mouseSensitivity
    public int turnSpeed;

    void getMouseXY()
    {
        mouseX += Input.GetAxis("Mouse X") * smoothTime;
        mouseY -= Input.GetAxis("Mouse Y") * smoothTime;
    }
    void LateUpdate()
    {
        getMouseXY();
        // Define a target position above and behind the target transform
        Vector3 targetPosition = target.TransformPoint(new Vector3(0, 1.5f, -2.5f));

        // Smoothly move the camera towards that target position
        transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref velocity, smoothTime);
        transform.LookAt(target);

        target.rotation = Quaternion.Euler((mouseY * mouseY_Speed), (mouseX * mouseX_Speed), 0);
        player.transform.rotation = Quaternion.Euler(0, (mouseX * turnSpeed), 0);

    }
}

My issue is that whenever the player moves either the camera/player jitters.
I have debugged the player transform y position to make sure it wasn't moving up or down (it doesn't). To help with this issue I have either turned down the Fixed Timestep under Time in the project settings or put the code in the camera script is fixed update instead of late update (which is an issue based on my research).
I know MovePosition for the player isn't the right way to move, but I don't know how to make the player move in the direction the camera is facing with rb.velocity. I suspect the issue may lay in the player script with variable camPos. Either way, I would like to stop the jittering.

sentences:
Children of canvas objects do not register OnMouseUpAsButton Objects I create inside my canvas do not register the OnMouseUpAsButton() event. I tried doing it on an empty project and it doesn't work so I guess I'm misunderstanding how something works. That being said, objects inside game world register event properly. I tried reading documentation but I still don't get why this is happening.

My code (the only code used in the project)

using UnityEngine;
using System.Collections;

public class test_click : MonoBehaviour {

void OnMouseUpAsButton()
{
    Debug.Log("Mouse up test click");
}

public void Thisworks()
{
    Debug.Log("yes");
}

void Start () {}
void Update () {}
}

My project objects:

I have spent the last 12 work hours searching for causes of this problem so I'm sure it is something absolutely obvious yet I just can't see it.

sentences:
enabling and disabling the script in unity I have three gameobject(G1,G2,G3) and I have set their tag name as "enemy".And I have another gameobject(Manager) where I have attached the script and I have a button when I click on the button the script in all the three gameobjects should be disabled .But the problem is that ,the script is disabled for only one gamobject.

public void ArrowIndicatorInvisible()
{
    GameObject.FindWithTag ("enemy").GetComponent<MessageScript>().enabled=false;
}

What will be issue.Can anybod help me solving it

sentences:
Modularization in a project I'm writing a C# game in Mono, and I want the game to be as modular as possible.
I've started by writing the whole Item (inventory) System of the game in a seperate .dll library
But I've hit a problem. I want Items to have effects, so I've written a base Interface for this:

interface IBehavior
{
    bool ApplyBehavior(Player destinationPlayer);
}

I'm following guidelines from the answer on this post regarding the (Unit, Effect, Behavior, Ability [Lets call it UEBA]) structure. Problem is that Player is a class from like the main module in the game so I assume this breaks modularity in the code.
What would be the best solution to fix this conflict?
I'm considering writing another, separate module, of UBEA, that will use Player and then the Item System module will use that module instead of the main module, and then the UBEA module will break modularity.
Should I also move Player to another module?
Am I even able to create full modularity if this is the model of things I want to create?

Thanks for the answers!

sentences: What's the best for doing ground check? What's the best for ground check? I have a capsule player and I'm using the raycast technique but it's not accurate when it comes to slopes. So what's better? Overlapping, Raycasting, CheckCapsule, or CapsuleCasting?

sentences:
How to await player input using Coroutines How can I accept player input using Coroutines, pausing execution of Unity while the player has not yet provided input? It seems like a simple problem, but I can't seem to figure it out. Here is my latest attempt. In this program I want to do some logic and pause in the middle, continuing only when the player has inputted some data. Someone please tell me I'm on the right track :O

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InputTester : MonoBehaviour
{
    int choice = -1; // valid choices for this example are 0 and 1

    void Start()
    {
        StartCoroutine(DoSomeLogic());
    }

    IEnumerator DoSomeLogic()
    {
        print("Starting...");
        print("Awaiting your choice - 0 or 1. :: ");
        // yield return StartCoroutine(WaitForKeyDown(KeyCode.Alpha0) || WaitForKeyDown(KeyCode.Alpha1));
        // how to combine these two into a single method that gives the player a choice?
        print("Continuing...");
        switch (choice)
        {
            // logic based on the choice
        }
    }

    IEnumerator WaitForKeyDown(KeyCode k)
    {
        while (!Input.GetKeyDown(k))
            yield return null;
        SetChoiceTo(k);
    }

    private void SetChoiceTo(KeyCode keyCode)
    {
        switch (keyCode)
        {
            case (KeyCode.Alpha0):
                choice = 0;
                break;
            case (KeyCode.Alpha1):
                choice = 1;
                break;
        }
        //StopAllCoroutines(); // how do I stop all the coroutines that accept player input?
        print(choice);
    }
}

sentences:
Behavior after collision using masks overlap I'm using masks to make collision detection in a game using pygame. The detection works well, but I have had problems with the behaviour after collision.

In most games, the obstacles are vertical or horizontal, making easy manipulate the velocity of objects moving. So, if the object collide, there is just two options: cancel x component or cancel y component. In this way, the object stop the move only in the normal direction.

But, my obstacles have any shape (not any, just rectangles and triangles) and direction, making things hard.

Basically, I want to cancel the velocity component in the normal direction to obstacle in the collision point.

Some help?

Thanks

sentences:
Ray Tracing Shadows in deferred rendering Recently I have programmed a raytracer for fun and found it beutifully simple how shadows are created compared to a rasterizer. Now, I couldn't help but I think if it would be possible to implement somthing similar for ray tracing of shadows in a deferred renderer. The way I though this could work is after drawing to the gbuffer, in a separate pass and for each pixel to calculate rays to the lights and draw them as lines of unique color together with the geometry (with color 0). The lines will be cut-off if there is occlusion and this fact could be used in a fragment shader to calculate which rays are occluded.

I guess there must be something I'm missing, for example I'm not sure how the fragment shader could save the occlusion results for each ray so that they are available for pixel at the ray's origin. Has this method been tried before, is it possible to implement it as I described and if yes what would be the drawbacks in performance of calculating shadows this way?

sentences:
Why does Forge not find my texture for my custom background? I am creating a minecraft mod that improves the main menu for my minecraft server. At first I wanted to create the background, but somehow when I try to start minecraft it closes and I get a nullpointerexception because minecraft didn't find my background.

public class ThundrialMenu extends GuiScreen {

    @Override
    public void initGui() {

    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        Random rnd = new Random();
        int background = rnd.nextInt(3)+1;
        String backgroundLocation = "/assets/thundrial/gui/Background"+background+".png";
        this.drawBackground(mc.renderEngine.getTexture(new ResourceLocation(backgroundLocation)).getGlTextureId());
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public void updateScreen() {
        super.updateScreen();
    }
}

This is the folder where the pictures are located:

Why does Minecraft not find those pictures?

sentences:
How can I scale player/enemy stats to balance the difficulty just right? I'm creating an old school top-down grid based RPG, where you enter random encounters every few steps.  I want to know what kind of systems or guidelines there are for creating the leveling and stats system for such a game.  Right now I'm just sort of guessing based on intuition and it's clear that that isn't going to work for very long.

For example, let's say I have a max level cap of 50, and 10 dungeons.  The ideal would be that the player should need to gain about 5 levels per dungeon in order to stand a chance in the next dungeon, but that the monsters in the current dungeon can't provide enough XP to skip the next dungeon (within a reasonable amount of time anyway).

The easy route that I can think of would be to just define every enemy as worth 1 XP, and then set the amount of XP required for the next level in increasing increments, so that I only really have to track number of kills (level 1 --> 2 would be 10 XP, or 10 kills, level 2 --> 3 would be 12 XP, or 12 kills, etc.).  But that's boring.  As a player myself, I like to see the numbers related to my actions get larger over time (i.e. at level 1 --> 2 as 10 XP, but level 2 --> 3 as 150 XP, etc.).

And that's not even counting for stats like Strength, Vitality, and so on.  But that in itself is a whole other question: are there any kinds of formulas for stats and their effects on each other?  For example, enemy has 50 armor, and my guy has 30 strength.  That is considerably more armor than strength, so I would expect my hit to be pretty weak...but how can I calculate those statistics to get a final damage number?

Are there any guides or any kind of "standards" for such basic systems?  Even if "every game is different," I still need to learn the absolute BASIC ideas for "most" games.  I have questions such as, "if you have an agility-like stat, what is a common way to determine dodge rate?" and so on.

EDIT: I found this after posting, but I'm gonna include the link here if someone else stumbles across this with similar questions.  Balancing Player vs. Monsters: Level-Up Curves

sentences:
What is the `AssetBundle` dropdown in the inspector for? I know what an AssetBundle is alright. But what is the dropdown at the bottom right for?

Apparently you can choose an asset bundle for this asset to belong to. So what? What happens when you choose one? Does Unity build an AssetBundle for you? Where?

sentences:
How can you pass a large amount of textures or equivalent to the fragment shader in OpenGL? I am adding shadow mapping to a game engine I am working on.

For this effect, each light source needs it's own associated shadow map cube texture.

I am going to be exaggerated and say there can be up to 1000 lights in the world at a given time (this would most likely lag the entire thing, but that's not the issue).

This means I need up to 1000 depth maps loaded into the shaders at any one time.

According to:

GLint temp;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &temp);
cout << temp << endl;

I have up to 4 texture units available. And the way I am currently passing my shadow maps is:

void Shadow_Map::load_to_GPU(GLuint program, GLuint index)
{
    glUseProgram(program);
    glActiveTexture(GL_TEXTURE0+index+1);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);

    string name = "depth_maps[" + to_string(index) + "]";

    GLint loc = glGetUniformLocation(program, name.c_str());
    if(loc == GL_INVALID_VALUE || loc==GL_INVALID_OPERATION)
    {
        cerr << "Error returned when trying to find depth_map uniform."
             << endl;
        return;
    }

    glUniform1i(loc,1+index);
}

So under my current methods I am very far away from the amount of depth map cube textures I need to use. Is there a better way to pass a large amount of cubicTextures, or what other techinique could I use to be able to handle large amounts of point lights?

sentences:
Separating Sprites from Models with PyGame So I'm trying to code a game using the Model-View-Controller pattern, and therefore have a need to separate the models for my game objects with their sprite representations. The problem that I'm running into is with PyGame's sprite class. For example, let's take the code below for a Tank object in my game.

class Tank(Projectile):
    '''A tank object.'''
    MAX_SPEED = 8.0

    @property
    def MAX_TURN(self):
        return 10.0 - 0.75 * abs(self.velocity)

    def __init__(self, position=(0, 0), heading=0.0, power=100.0, name=None):
        Projectile.__init__(self, position, heading)

        self.gun = Gun(self)
        self.radar = Radar(self)

        self.power = power
        self.name = name

    def update(self, dt):
        super(Tank, self).update(dt) #Just writing this here for illustrative purposes

Additionally, in a separate views file, I have the code for the basis of a sprite:

class TankSprite(RotatableSprite):
    _image = pygame.image.load('images/tank/body.png').convert_alpha()
    _layer = 0
TankSprite.groups = tank_group, all_group

Now the standard solution might just be to merge these two into one, and then use pygame's pygame.sprite.group.update() method to update and draw everything as desired. But with a MVC pattern, I run into a few problems:

First, there is no way of knowing when a new object is created. For
example, when the Tank fires its Gun, its creates a Bullet object.
Since the Bullet is a model, there is no way to detect this creation
without some awkward View code in the Models.
Second, I don't believe I can use pygame's collision methods or
Group objects, which isn't the worst, but somewhat awkward.

Really, the bullet problem is killing me more than anything else. Any help would be appreciated.

sentences:
Changing textures on a Model messes up antialiasing? (XNA) Here is a code sample:

        blockModel = game.Content.Load<Model>("Models/Cubes/Cube"); //this is a .fbx file, made in blender

        absoluteBlockTransforms = new Matrix[blockModel.Bones.Count];
        blockModel.CopyAbsoluteBoneTransformsTo(absoluteBlockTransforms);

        /*
        foreach (ModelMesh mesh in blockModel.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.Texture = game.Content.Load<Texture2D>("Textures/Cubes/CubeLayout"); //this is the texture it's already using, but copy-pasted into a different directory
            }
        }*/

This looks fine

Now if I uncomment the lines above, somehow everything gets screwed up?

Somehow just setting the Texture property messes something up, but I'm not sure what exactly (aside from the symptoms).  Note that framerate doesn't actually change; the small difference is just a coincidence.  Also, the multisampling property is set after this is called, so it's not an issue of it somehow changing the graphics property.

sentences:
trouble in box2d flash with invoking a setLinearVelocity() from inside an eventHandler The set linear velocity doesnt affect a sprite when written inside an event handler.. but if i call setlinear velocity inside the main constructor..ie if the setlinearvelocity is called at the beginning of game code ..it moves..but not when i call it within a event handler..either keypress or mouse,it doesnt work?

Please ..any help would be greatly appreciated

sentences:
Why are my game ticks longer than expected? I was working on my game, adding stuff to it, when I noticed my ticks were in the low 50's when I had set it to do a constant 60. This is my run method.

public void run() {
    init();
    long lastTime = System.nanoTime();
    final double amountOfTicks = 60.0;
    double ns = 1000000000.0 / amountOfTicks;
    double delta = 0;
    int updates = 0;
    int frames = 0;
    long timer = System.currentTimeMillis();

    while (running){
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        if (delta >= 1) {
            gameUpdate();
            updates++;
            delta--;
        }

        try {
            Thread.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        gameRender();
        frames++;

        if (System.currentTimeMillis() - timer > 1000) {
            timer += 1000;
            frame.setTitle(title + "   |   " + "Frames Per Second: "
                    + frames);
            System.out.println(updates + " Ticks, " + frames + " Frames");
            updates = 0;
            frames = 0;
        }
    }
    stopGame();
}

I've tried removing all the code I added before this occurrence happened and it didn't help. Suggestions would be great!

sentences:
OpenGL RTT FrameBuffer question and Rendering to texture while sampling it What i need to do:

Blur the selected texture and pass the texture to another effect for postprocessing.
Notice that i want one texture passed all over.

How do i want to do this:

Bind the FBO ( with texture to be blurred attached as colorbuffer )
Change the FBO viewport size to match the texture size
Enable the shader
Bind the texture
Render viewport sized quad with the texture and output to that texture via FBO colorbuffer
Unbind texture
disable shader
Disable fbo
...
pass that texture to another effect..

What i have already done:

A FBO with ColorBuffer attached ( the texture i want to blur ),
The shader
All the other reqd stuff..

What's the problem?

When i want to blur texture and i bind that texture as a color buffer to my FBO, and then pass the texture via uniform to the shader while rendering to sample it (and blur), the results are not stored. Seems like FBO can't have the same texture stored as output and sample it at the same time ( kind of understandable ).

Question:

Is this normal behavior ? How do i approach 'blur a selected texture' so that i can pass one texture over to another effect to work on it ?

I can imagine a 'dummy' texture within the effect class to which FBO renders to and then it gets copied to a texture that was requested to be modified..
Any better option ?

Thanks for shedding a bit of light on this, i think i need some logic help in here.

sentences:
Rotating points on a circle I have drawn a 2D circle in X,Y,Z. I wanted to draw something on specific vertices of that circle and I managed to do it. When I wanted to move the circle, I wanted the vertices to get the updated position, so I created another array of vertices and calculated the new vertex positions.

Now I want to rotate the circle, and while rotating it, the vertices should get the new orientation. How can I do this?

void creature::drawCircle(Vec3f Pos,float radius, int segments )
{

    // automatically determine the number of segments from the circumference
    if( segments <= 0 ) {
        segments = (int)math<double>::floor( radius * M_PI * 2 );
    }
    if( segments < 2 ) segments = 2;

    GLfloat *verts = new float[(segments+2)*3];
    GLfloat *vertsNew = new float[(segments+2)*3];
    verts[0] = 0;
    verts[1] = 0;
    verts[2] = 0;
    vertsNew[0] = 0;
    vertsNew[1] = 0;
    vertsNew[2] = 0;

    //Create circle
    for( int s = 0; s <= segments; s++ ) {
        float t = s / (float)segments * 2.0f * 3.14159f;
        verts[(s+1)*3+0] = math<float>::cos( t ) * radius;
        verts[(s+1)*3+1] = math<float>::sin( t ) * radius;
        verts[(s+1)*3+2] = 0;
    }

    //Transform points
    for( int s = 0; s <= segments; s++ ) {
    ci::Vec3f  m_newCirclePos;
        m_newCirclePos.x = verts[(s+1)*3+0];
        m_newCirclePos.y = verts[(s+1)*3+1];
        m_newCirclePos.z = verts[(s+1)*3+2];
        m_newCirclePos += ci::Vec3f(Pos);

        vertsNew[(s+1)*3+0] = m_newCirclePos.x;
        vertsNew[(s+1)*3+1] = m_newCirclePos.y;
        vertsNew[(s+1)*3+2] = 0;

    }

    // Attach tentacles on specific vertices
    for (int i=0; i<m_tentacle.size(); i++)
    {
        m_tentacle[i]->m_Nodes[0].x = vertsNew[(i+1)*3+0];
        m_tentacle[i]->m_Nodes[0].y = vertsNew[(i+1)*3+1];
        m_tentacle[i]->m_Nodes[0].z = vertsNew[(i+1)*3+2];
        m_tentacle[i]->enforceConstraints(Vec2f(0,0),0,0,0,0);
    }
    glPointSize(10);
    glEnableClientState( GL_VERTEX_ARRAY );
    glVertexPointer( 3, GL_FLOAT, 0, vertsNew );
    glDrawArrays( GL_POINTS, 0, segments + 2 );
    glDisableClientState( GL_VERTEX_ARRAY );
    delete [] verts;
    delete [] vertsNew;
}

sentences:
Determine terrain type and worldobject placement techniques I'm currently researching the techniques of generating a procedural map. I've already found some methods regarding the mesh generation (e.g. variations of noise like perlin, simplex and cell, midpoint displacement and diamond square).

The next step for me is to determine the terrain type. The most easy way is probably matching a static value to the height value (e.g. everything below 0.2 is water, everything between 0.2 and 0.3 is sand, everything between 0.3 and 0.5 is grass, etc.). To make a more advanced version I can use temperature and moisture values for the biomes. I'd very much like to know other techniques to determine this.

I also want to place objects (like rocks, trees, plants) on the map, however I can not seem to find different techniques to research/implement this. I probably just don't know the name of the global technique to find specific techniques. I found the use of fractal noise with a variable for the probability, but I'd like to know more techniques.

So, let me know some of your techniques.

sentences:
Can I make my sprite design very similar to Pokémon's sprite design? I'm making a 2d RPG and I'm having trouble designing a sprite, so I downloaded an image of Pokémon Leaf Green's player sprite and copied how it looked. I didn't copy it completely, only how it looks. Here's the image:

Can I get sued for this? the gameplay and mechanics are far from Pokémon's mechanics, the only problem is the sprite of the characters. Can I get into trouble because the character sprite looks too much like Pokémon's character?

sentences:
How to properly setup unit testing for my c++ game project? I'm currently creating a 2d game in C++ using visual studio and utilizing gtest/gmock for my testing framework. The problem I'm having is I'm not sure what my best option is for testing. I'm using SDL and opengl and if I try and test normally my test project crashes when it hits any opengl calls. I'm using glew to access opengl so in my game I setup glew and call glew.init() within my window class:

void Window::Initialize()
    {
        if (SDL_Init(SDL_INIT_VIDEO) != 0)
        {
            SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SDL Error", "SDL did not initialize", nullptr);
            SDL_Quit();
        }

        /** All attributes need to be set before window creation **/

        p_window = SDL_CreateWindow("Shadow Gods", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1024, 768, SDL_WINDOW_OPENGL);
        if (!p_window)
        {
            LOG("ERROR: SDL window failed to initialize! SDL error: %s\n", SDL_GetError());
            SDL_Quit();
        }

        glContext = SDL_GL_CreateContext(p_window);

        glewExperimental = GL_TRUE;
        if (glewInit() != GLEW_OK)
        {
            LOG("ERROR: GLEW failed to initialize!");

            SDL_GL_DeleteContext(glContext);
            SDL_DestroyWindow(p_window);
            SDL_Quit();
        }

        //Sets the values that the depth and color buffers will be set to when glClear is called
        glClearDepth(1.0);
        glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
    }

Now in order to test any of my classes that utilize openGL calls I need to make sure to create a window object first and initialize before calling any other code:

#include <gtest\gtest.h>
#include "GameEngine\Window.h"
#include "GameEngine\Sprite.h"

TEST(SpriteClassTest, SpriteInitialize_True)
{
    Blz::Window win;
    win.Initialize();
    Sprite sprite;
    ASSERT_TRUE(sprite.Init(23, 32, 100, 100, "../Game/CharImage.png"));
}

I don't want to have to do this for every class that utilizes opengl since 1.) It's redundant and 2.) My tests might be failing because there is something wrong with the window initialize() function instead of what tests were designed for. So is there a better way? If not, how could I get around having to include my "window.h" header in every file and having to initialize the window in every test? Can I do this globally with gtest?

sentences:
Rendering fancy particles? I'm making a tower-defense game for Windows (not phone) in XNA.

I've seen this video of another tower-defense game for Windows Phone that uses particle effects, which I really like. They change color, glow and density as they move away from the explosion. Really cool stuff!

http://www.youtube.com/watch?v=YhPr4A4LRPQ&hd=1

I would like a similar result (particle-wise) to the stuff in the video, however, I don't know where to start. I suppose I need to do linelist hardware instancing to achieve the result, and then update every particle position on the CPU.

Or is there a better alternative? Post your suggestions. That'd be great, thanks.

Edit It's the explosion particle effect that I want to implement. Not the particle effects that the projectiles leave when they fire.

sentences:
How to implement stress/strain mechanics in voxel terrain? I am in the process of developing a Minecraft-like world where the terrain is divided into voxels. However, I would also like for unstable configurations of landscapes to collapse predictably. For example, an overhang that is too heavy would fracture and break off at 'high stress' voxels, as would a pillar formation with an asymmetrically eroded base. I was thinking about adding a 'stress vector' field to each voxel in the terrain, and doing the following (pseudocode):

foreach voxel in terrain
    foreach neighbor in voxel.neighbor_voxels()
        if magnitude(voxel.stress - neighbor.stress) > stressThreshold
            detach_voxels(voxel, neighbor)

But the problem is that I don't know how I would go about calculating these individual stresses. Is there some kind of FEA-based algorithm specialized for voxel discretizations that I can use to calculate the stresses on a per-voxel basis? Or am I approaching this all wrong and there's some other way to do this?

sentences:
Proper setup for Mecanim standing jump animation I have a character standing jump animation with that the character at start prepares for the jump (flexing downwards) and then jumps up in the air and i'm wondering how to get it working properly with Mecanim in Unity.

The difficulty is that the jumping in my code isn't just an on/off trigger but is triggered by a Y velocity that determines how high the character can jump.

With my current approach, when jumping the character lifts instantly off the ground and then executes the starting part of the animation which of course looks wrong.

Is there any way to configure single jump animations with Mecanim to work with a Y velocity or do I have to split the animation into three parts (prepare/jump/landing) for this?

sentences: Calling opengl32.DLL from java? I don't like LWJGL in some cases, so I prefer to use Swing. The thing is that Swing doesn't have OpenGL. I have tried JOGL and it's a mess to install, needs external jars, and I have yet to get it working. So I was wondering if I could just make an OpenGL class that uses opengl32.DLL and put the graphics into a window made with Swing? Also, is opengl32.DLL able to be called with a 64 bit Java program?

sentences: Are there specific benefits to using XNA for 2D development if you don't plan on releasing on xbox/windows phone? I've been using XNA for a while to tinker with 2D game development, but I can't help but feel constrained by the content pipeline when targeting PC only. Things like no vector fonts or direct use of graphics files make it a pain while other frameworks do these things with no problem. I like XNA because it's robust and has a lot of support, but what are the specific benefits that I'd get developing exclusively for PC, if there are any at all?

sentences:
Can I use flat shading on a generated mesh? I tried to generate a mesh from code in Unity. The problem is, that the edges are automatically smoothed. When I import a model into Unity, I can set the smoothing angle of the edges, but is something like this possible with a generated mesh?

I would like to have no smoothing at all.

sentences:
how to load normals for a model from texture2d? I know i can do this through custom shaders, but i want to know is it possible to set it through xna itself. As for each effect i have pick normals from a texture2d, i want to change normals of model.

I have done this much, but i don't know how to go further??

  foreach (ModelMesh mesh in Home.Model.Meshes)
       {
           if (mesh.Name == meshName)
           {
               foreach (ModelMeshPart part in mesh.MeshParts)
               {
                   VertexPositionNormalTexture[] normals = new VertexPositionNormalTexture[part.VertexBuffer.VertexCount];
                   part.VertexBuffer.GetData<VertexPositionNormalTexture>(normals);

                   Color[] data = new Color[normalMap.Height * normalMap.Width];
                   normalMap.GetData<Color>(data);
               }
           }

       }

Thank you

sentences:
How to highlight intersection between objects? I'm new to Unity and I'm developing an augmented reality app.

My situation is as follows: I have two objects in the scene, a neighborhood model and a cube. The mockup will be the object I am going to enlarge and the cube will be like the acrylic box where the mockup is. The cube represents the viewing area and will be transparent. The model has an animation in which it moves and scales and the cube remains fixed.

I need something to assign to the cube so that when expanding the model, the parts that stick out of the cube will have 50% colorless transparency (all gray) and the part of the model that is inside the cube (in intersection) remains solid and with the colors and textures.

The idea is to present the mockup on an initial scale that is inside the cube (acrylic box) then the model's animation will zoom in on the mockup at certain points, the whole mockup will be much larger than the cube. the outside of the cube is transparent and colorless, and the inside remains coloured  to make it more prominent.

Can someone help me?

sentences:
How can I Implement spin in billiard game? I'm not sure that you played billiard or snooker before.if you played you should know about spin.
but anyway if you don't know about it you can see it in this video

I want to Implement spin like this game

for example difference between Top spin and Back spin is:

Top spin

Back spin

Spin behaviour

if you aim behind the ball you can shoot the ball in all direction

if you aim closest to right you can just aim the right

if you aim closest to left you can just aim the left

I found a same Issue that used Torque in stackoverflow but I don't know why didn't work!

Top Spin

GetComponent<Rigidbody>().AddTorque(Vector3.back * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

Back Spin

GetComponent<Rigidbody>().AddTorque(Vector3.forward * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

I noticed that flyordie's snooker didn't use AddTorque.so I don't need answer that Implemented with AddTorque.

Update

What I tried

I add joystick to select spin angle

then I apply spin force ( It seems my spin works but sometimes didn't work that I attached video in end of my question).

this is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainBall : MonoBehaviour {

    private Vector3 FirstPos; // store first position as reset position
    public Transform SpinRoator; // spin rotator cylinder that show spin angle
    private Rigidbody rigidbody;
    public bool SpinUsed; // spin should use once
    private float v2;

    private void Start() {
        rigidbody = GetComponent<Rigidbody>();
        FirstPos = transform.position;
    }

    //After goal reset ball position
    public void ResetPos(){
        rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
        transform.position = FirstPos;

    }

    void SpinForce(){
        SpinUsed = true;
        float F = ComebackForce(); // calculate comeback force
        StopBall(); // stop ball
        rigidbody.AddForce(SpinRoator.forward*F);// apply spin force
    }

    // calculating return force after hitting f = m.a
    float ComebackForce(){
        var m = rigidbody.mass;
    var v1 = rigidbody.velocity.magnitude;

    var a = (v1 - v2) / Time.deltaTime;
        var F = m * a;
        v2 = rigidbody.velocity.magnitude;
        return F;
    }

    //stop ball
    public void StopBall(){
      rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
    }

private void OnCollisionEnter(Collision other) {
    if(other.collider.tag == "Ball" || other.collider.tag == "ColorfulBall"){
    if(!SpinUsed){
    SpinForce();
    }
    }
}
}

but What is Problem?!

It seems works correctly but My Problem is sometimes Spin don't work correctly you can see this video that demonstrate this problem.my ball goes wrong direction of spin!!!

1.Ball goes Wrong sometimes

as you can see in above gif ball goes wrong direction!!! ball should go along yellow cylinder but I don't know what is problem of my code!!!

1.Ball goes slow sometimes

another problem is comeback force is slow sometimes!!!
I calculate comeback force F = m.a but why is it slow?!

sentences:
Python/PyGame mixer.music playback of OGG file has intermittent clicking sound - how to proceed? I have a class within my python + pygame game that handles sound - it worked well until I tried use pygame.mixer.music to switch between streaming .ogg music files. The class switches between them on the pause event.

The issue I'm having is that the music will play, and even switch between tracks fine, but about half the time I'm getting a quiet, regular clicking noise over the sound track. I've checked, and the pygame mixer is set to the same bitrate as my .ogg files. I've tried playing with number of channels and tracks, all to no avail. I'm not sure what the root cause of the clicking is - whether I've chosen a poor file encoding / bitrate, or just not initialized/called pygame mixer correctly.

Here is the problimatic code:

class SoundMgr():

def __init__(self):
       pygame.mixer.init(22050, -8, 4, 4096)
       self.musicFilename = ""
       self.musicPos = 0
       self.musicVolume = .35
       self.musicMuteVolume = .1

def playMusicTrack(self, which):
    pygame.mixer.music.load("data/music/" + which + ".ogg")
    pygame.mixer.music.set_volume(self.musicVolume)
    pygame.mixer.music.play(-1)
    self.musicFilename = which

def dampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + "b.ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicMuteVolume)

def undampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + ".ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicVolume)        </code>

When I call dampenMusic / undampenMusic the track plays correctly, but about half the time it has a clicking sound over it. The other half of the time it plays perfectly. I've tested, and I can't discover any pattern to when it will / won't have the static.

The clicking noise is about 2 times a second, and is about 50% the volume of the track.

Anyone who is more experienced with pygame / sound encoding able to give me any tips?

sentences:
Finding a point between 2 moving points colinearly , given 2 moving points and distance P/S: The engine I work on doesn't have grouping integration. That's why I need a formula to change the position.

A------B---------------C

A and C are moving points that can move anywhere

A = (xa, ya), C = (xc, yc)

B (xb, yb) is a point between A and C colinearly

With one condition that distance of AB = constant = r, distance of AC can be varied.

How to find xb and yb?

Asked from Mathematics StackExchange:

  Deepak says:

  The locus of all possible points B is a circle centred on A and of
  radius r. The intersection between this circle and line AC will give
  you point B (and another point opposite it on the circle which you can
  neglect).

  Try to write down the relevant equations and solve them?

Example: http://www.mathopenref.com/collinear.html

sentences:
Why place entity config outside of scripts? I've seen a lot of games that define the entity components in script files, but when they configure each entity and specify what components it has, they use some other file format (like XML). Why do they do that?

I'm asking mostly to see what others' rationale was for this. I also configure my entities outside of scripts (though I chose JSON not XML). My reasons for doing this are to make it easier for me to implement save games and also because I think this kind of configuration is better organized in something like XML or JSON.

@Christopher Larsen's answer: Too long to post as a comment

I fear you might have deviated a bit from the subject of the question. The problems you are describing are more related to hierarchy-based entities; note in my question I mentioned I was talking about component-based entities.

Here's an example of what I wanted to ask. Below are two alternative ways to configure an entity: through the script and through an external JSON file. My question was, why do so many people prefer to configure the entity outside of scripts?

A base Entity class:

class Entity:
    def __init__(self, name):
        pass
    def addComponent(self, comp):
        pass

The script approach:

orc = Entity('Orc')
orc.addComponent(PositionComponent(3.4, 7.9))

The JSON approach:

{
    "name" : "Orc",
    "components":
    {
        "PositionComponent": {
            "x" : 3.4,
            "y" : 7.9
        }
    }
}

I already stated my reasons for using this approach, which are technical and organizational. I wanted to know why so many others (from what I've seen) use this.

sentences:
Changing direction after collision In the first tutorial for GameMaker (catch the clown), I want to set the direction of the clown after the collision with the wall.

I want to do it by pressing the wall object with the mouse (before the collision, to set the angle parameter). For example by pressing only once the wall object it would change the clown's direction after collision by 45 degrees, twice by 90 degrees, and so on.

How can I do that?

sentences:
How are "2.5D" art assets created? By "2.5D" I mean the art style in games such as Roller Coaster Tycoon, Age of Empires 2 or Fallout 1 and 2:

Everything in the games appears to be created with a "pixel art"-like tool. Am I correct?

How are the moving characters are created though? Take AoE2: For much of my childhood I was convinced that the soldiers, villagers and other characters were 3D!

Could someone explain:

What dimensionality are the characters?
What sort of software package could I use to create them?

sentences:
OpenGL ES object rotation around z axis I have an object on my screen which is presented rotated and panned,
But i have 2 problems regarding the z axis rotations. It's a bit tricky to explain so i uploaded 2 videos to describe each problem.

1) Reverse rotation : After rotating the object around the x axis, the z rotations are being reversed and not as it should be.

2) Wrong Z axis rotation : Again, After rotating the object around the x axis, i'm trying to rotate the object around the z axis and the rotation results in a different axis rotations.

I do believe the video's describe the problems well.

EDIT: Second attempt

As kindly explained by the user @Fault, i understood the problems i was facing with.
So i tried to solve those by just rotating the projection matrix around the z axis, which seemed to be working, but it doesn't.

Since i am rotating the model's axis, I get this problem (video). the issue appears in the 23'd seconds, while i'm demonstrating how it works.
As can been seen, when the z rotation causes a wrong x and y rotations.

I do understand that i must likely have to move these rotations to world view and not model view, the thing is i'm not really sure how to do that.

Here is the relevant code:

Render function:

{
...

    CC3GLMatrix *projection = [CC3GLMatrix matrix];
    float h = 4.0f * self.frame.size.height / self.frame.size.width;
    [projection populateFromFrustumLeft:-2 andRight:2 andBottom:-h/2 andTop:h/2 andNear:4 andFar:100];
    [projection rotateByZ:zRotationEnd];
    glUniformMatrix4fv(_projectionUniform, 1, 0, projection.glMatrix);

    [modelView populateFromTranslation:_currentPan];
    [modelView rotateBy:_currentRotation];

    glUniformMatrix4fv(_modelViewUniform, 1, 0, modelView.glMatrix);
...
}

X and Y rotations:

- (void) rotateAroundX:(float) x andY:(float) y newRotate:(BOOL) isNewRotate
{
    if (isNewRotate) {
        rotationStart = CC3VectorMake(0.0, 0.0, 0.0);
    }

    int rotationDirection = ceil(zRotationEnd/90);
    if (rotationDirection % 4 == 2 || rotationDirection % 4 == 3) {
        rotationEnd.x = rotationEnd.x - (x-rotationStart.x);
        rotationEnd.y = rotationEnd.y - (y-rotationStart.y);
    } else {
        rotationEnd.x = rotationEnd.x + (x-rotationStart.x);
        rotationEnd.y = rotationEnd.y + (y-rotationStart.y);
    }

    rotationStart.x = x;
    rotationStart.y = y;
    _currentRotation = CC3VectorMake(rotationEnd.y, rotationEnd.x, 0);
    NSLog(@"Current x is: %f y is: %f z is: %f",_currentRotation.x,_currentRotation.y,zRotationEnd);

}

Z rotations:

- (void) rotateAroundZ:(float) z newRotate:(BOOL) isNewRotate
{
    if (isNewRotate) {
        zRotationStart = 0;
    }
    zRotationEnd = zRotationEnd - (z - zRotationStart);
    zRotationStart = z;
}

And the vertex shader:

attribute vec4 Position;
attribute vec4 SourceColor;

varying vec4 DestinationColor;

uniform mat4 Projection;
uniform mat4 Modelview;

attribute vec2 TexCoordIn;
varying vec2 TexCoordOut;

void main(void) {
    DestinationColor = SourceColor;
    gl_Position = Projection * Modelview * Position;
    TexCoordOut = TexCoordIn;
}

I would really like to get this right, so any help will be appreciated.

Cheers!

sentences:
Unreal Crashing just by me adding components I have created an actor cpp class called gun base.  for some reason it is causing a perpetual crash in unreal.
this is its header file.
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "GunBase.generated.h"

UCLASS()
class GIZMOSHOOTER_API AGunBase : public AActor
{
    GENERATED_BODY()

public:
    // Sets default values for this actor's properties
    AGunBase();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:
    // Called every frame
    virtual void Tick(float DeltaTime) override;
    //virtual void PullTrigger();

private:

    UPROPERTY(EditDefaultsOnly)
    USoundBase* FireSound;
    UPROPERTY(EditDefaultsOnly)
    UParticleSystem* MuzzleFlash;

    UPROPERTY(EditDefaultsOnly)
    USceneComponent* RootSceneComponent = nullptr;
    UPROPERTY(EditDefaultsOnly)
    UStaticMeshComponent* GunMesh = nullptr;
    UPROPERTY(EditDefaultsOnly)
    USceneComponent* BulletSpawnPoint = nullptr;
};

and this is the cpp file.
// Fill out your copyright notice in the Description page of Project Settings.

#include "GunBase.h"
#include <Components/StaticMeshComponent.h>
#include <Components/SceneComponent.h>

// Sets default values
AGunBase::AGunBase()
{
    // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;
    RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
    RootSceneComponent->SetupAttachment(RootComponent);
    GunMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    GunMesh->SetupAttachment(RootSceneComponent);
    BulletSpawnPoint->SetupAttachment(GunMesh);  //This is the line its complaining about
}

// Called when the game starts or when spawned
void AGunBase::BeginPlay()
{
    Super::BeginPlay();

}

// Called every frame
void AGunBase::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

The crash is saying something about an exception access violation, and in particular is referencing line seventeen  on the cpp file which has a comment on it.  Just in case this means something, I have tried several things to get this code to work, I then builded it, and tried to open the project in unreal again but i always got a crash.  thanks.
Edit:  I had a function in the header file (pulltrigger its commented out) that was causing me errors but I commented it out and the crash is still occuring.

sentences:
Adapting tilemap algorithm to support isometric tilemap I'm using Phaser to build an isometric game. The framework doesn't have support for isometric tilemaps yet, so I'm starting to write a PR for it to support.

What I currently have, loading an isometric tilemap on the current Phaser.Tilemap object, is this:

As you can see, the tiles are wrongly positioned because of the simple 2D tile positioning approach the framework currently uses.

The class that actually makes the parsing of the JSON map and converts it into a tilemap is Phaser.TilemapParser, specifically at line 185.

What I need is some help on where to start adapting this parser – or any other part of the code – in order for it to support isometric tilemaps.

I don't know exactly where to start extending this parser – or even writing a new parser just for isometric tilemaps. Also, I know the calculations are different for positioning isometric tiles, and I want to know too where that change should go here, as I didn't find that either.

sentences: What is the difference between AR, VR and MR? Please explain clearly and in short about the differences and boundaries between AR, VR & MR.

sentences:
libGDX upload z-axis of sprite to graphics card Background:
I want to obtain each fragments position via vertex interpolation to then calculate the light vector for phong shading (L = [Fragment pos] - [light source pos]).

Problem:

At the moment I am using libGDX's com.badlogic.gdx.graphics.g2d.Sprites to upload my 2d sprites via the batch to the graphics card. However they only transport the x and y information for each vertex ( I think in the shader z is 0). I also want to upload the z axis of the sprite for use with normal map based pixel shading (calculate the vector of the incoming light).

Should I use a com.badlogic.gdx.graphics.Mesh for that or can I extend the Sprite class and somehow put the z axis in the vertices float[] array? If I should do that, how do I do this?

sentences:
Why does the D3DXCOLOR structure not work as I expect? I looked up some R G B values for certain colours, such as "Indian red" for example, which has the RGB values (238, 64, 4).

If I use those values into a D3DXCOLOR structure like this: D3DXCOLOR(238, 64, 4, 255), the colours display oddly - as white! This displays as yellow: D3DXCOLOR(238, 64, 0, 255). Why is this?

sentences:
Confused about why my projection matrix works My projection matrix was  buggy, I'm not great at mathematics, but I checked it against the the songho tutorial, and the broken one seems correct to me but switching nearplane to farplane seems to have fixed it. What am I missing? My nearplane and farplane values are positive, nearplane is small about 0.01, 1.0f last time i ran against both; farplane is usually relatively large about 1000.0f, 500.0f the last time I ran it against both.

f32 l = left;
    f32 r = right;
    f32 t = top;
    f32 b = bottom;
    f32 n = nearplane;
    f32 f = farplane;

    m4x4 Result =  //TODO why did changing n to f in 0 and 5 fix it? and make sure it is fixed
    {
#if 0 // works
        2*f/(r-l), 0, (r+l)/(r-l), 0,
        0, 2*f/(t-b), (t+b)/(t-b), 0,
        0, 0, -(f+n)/(f-n), -2*f*n/(f-n),
        0, 0, -1, 0,
#else // doesn't
        (2*n)/(r-l), 0, (r+l)/(r-l), 0,
        0, (2*n)/(t-b), (t+b)/(t-b), 0,
        0, 0, -(f+n)/(f-n), (-2*f*n)/(f-n),
        0, 0, -1, 0,
    };
#endif

sentences:
Java, Crashing with a Shader on Intel HD Graphics I just got a new computer (Acer Aspire ES1-311) which has an integrated Intel HD Graphics card, and I noticed that this fisheye shader crashes my game (LibGDX game, VM Crash):

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec2 pos;
uniform float radius = 100;
uniform float scale = 1;
void main()
{
    vec2 textureCoordinateToUse = v_texCoords;
    float dist = distance(pos, v_texCoords);
    textureCoordinateToUse -= pos;
    if (dist < radius)
    {
        float percent = 1.0 + ((0.5 - dist) / 0.5) * scale;
        textureCoordinateToUse = textureCoordinateToUse * percent;
    }
    textureCoordinateToUse += pos;
    gl_FragColor = texture2D(u_texture, textureCoordinateToUse);
}

I've tried to update the drivers from the official site, but the driver application says that they might be incompatible with my computer!

However, does anyone spot anything "wrong" in the shader that might cause the crash?

Thanks.

sentences: Making a 2D TMX tile map Should there be a specific link between the characters height as well as the tile size for the tile maps? That is if a tile is 32x32 does that mean that a character sprite has to be the same size? Also does the size of tiles I use have any great impact on the game itself?

sentences:
How to add a sound that an enemy AI can hear? Given:

a 2D top down game
Tiles are stored just in a 2D array
Every tile has a property - dampen (so bricks might be -50db, air might be -1)

From this I want to add it so a sound is generated at point x1, y1 and it "ripples out". The image below kind of outlines it better. Obviously the end goal is that the AI enemy can "hear" the sound - but if a wall is blocking it, the sound doesn't travel as far.

Red is the wall, which has a dampen of 50db.

I think in the 3rd game tick I am confusing my maths.

What would be the best way of implementing this?

sentences:
How to have a tilted FNT font on Godot? Since FNT is a bitmap font I was thinking perhaps making the padding negative to the right and left side of the characters and rasterizing each glyph already skewed by an angle could make the font appear to be tilted. Does any one know whether FNT sports negative padding or whether Godot support some form of skewing that could accomplish that?
Please take a look at the image to see what I'm describing

sentences: What decrease of polycount should occur as a function of distance? What decrease in polycount should occur as a function of distance. I make a terrain and I wounder what is the right formula to keep the "poly size"(the screen size) constant. Or is there some mental flaw in this approach?

sentences:
Issue with loading XML So recently i've been changing my XML files that i'm using in-game, to add in a bit more data to the files but i've also changed the way in which i load & save files, by now using the XDocument API.
*Previous Thread/Topic:
Xna, writing XML </Asset> end element

So now that i'm all done, i've come to trying out the new files in my new project and i have a strange error:
There was an error while deserializing intermediate XML. Input string was not in a correct format.

Oddly though, this at line 13:
http://pastebin.com/jMtNwV8N

In all honesty i don't know what to say. And to what exactly the problem is, i'm having a slight hunch that it could be something to-do with the way the files are saved:
http://pastebin.com/Q2pJye5B

Problem is that my initial thinking right now is that it might have to be something to-do with the '\t' or '\n' literals, but then there's these literals in the actual data lines i.e lines 11 & 12 so it wouldn't all of a sudden chuck me an error at line 13

Guess i'm just a bit mystified by this and to what the problem might be?

Any help greatly appreciated :)!

Edit:
Well just to test it out then, i removed all the '\t' & '\n' from the saving code. And re-tried it then, unfortunately i'm still getting the same error :/
Same place, with the error occurring at the ending element of Rect.

sentences:
Prevent counterclockwise rotation So I have an object that has a handle attached to it, the player is supposed to rotate this handle. For that, I'm taking in the horizontal and vertical axis of a controllers analogue stick and transform these values into degrees, which I then use to rotate the object.
The problem is that I can't seem to completely block out the possibility of rotating the handle counterclockwise, as the player is only supposed to rotate it clockwise. What happens is that every couple of frames while I try rotating counterclockwise it detects a clockwise rotation, executing my according code, even though I was rotating counterclockwise consistently.
The principles I use to determine which direction the rotation is going is done by comparing the input angle of the last frame to the current input angle, like:
// Variant 1:
var inputAngle = Mathf.Atan2(x, y) * Mathf.Rad2Deg;

float angleDifference = inputAngle - previousAngle;
if (angleDifference > 180f) angleDifference -= 360f;
if (angleDifference < -180f) angleDifference += 360f;

if (Mathf.Sign(angleDifference).Equals(-1))
{
// Counterclockwise rotation
}
else
{
// Clockwise rotation
}

// ...

previousAngle = inputAngle;

In another attempt, I tried to do this comparison by simply checking if my current angle is larger than my previous one while having the input transformed in a 0° to 360° range and also handling the overflow from going back to 0° from 360°, which did not work consistently either.
So I tried to see what the values are giving in this faulty case, but what this told me was simply that the values are not as I expected them to be, as the current angle should be smaller than the previous one while rotating counterclockwise, in those cases and I can't figure out why or how to prevent it?

So I guess in the end my question would be how can I consistently prevent a player from rotating counterclockwise by reading a controller's analogue stick input.

sentences:
How do I measure the bounds of a string in PyGame? I am trying to position some text on my screen using pygame, and knowing the size of the string would help.

When using C# and XNA I could use SpriteFont.MeasureString("Hello World") to get the size of the rendered string.

Is there any way to do something similar in pygame?

sentences:
Why is my character jumping at different heights randomly? I have a character controller on my character's gameobject and I'm trying to make the character jump. This is working but sometimes he jumps way higher than other times. Does anyone know why this is happening? Here's the code:

    using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour
{
CharacterController cc;
public float Speed;
float Forward;
float Sideways;
float vertical;
public float gravity;
public float Jump;

// Start is called before the first frame update
void Start()
{
    cc = GetComponent<CharacterController>();
}

// Update is called once per frame
void Update()
{
    Forward = Input.GetAxis("Vertical") * Speed;
    Sideways = Input.GetAxis("Horizontal") * Speed;

    if (!cc.isGrounded)
    {
        vertical -= gravity * Time.deltaTime;
    }
    else
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            vertical = Jump * Time.deltaTime;
        }

        vertical = -8 * Time.deltaTime;
    }

   Vector3 Delta = transform.TransformDirection(Sideways, vertical, Forward);

    cc.Move(Delta * Time.deltaTime);
}
}

sentences:
Re scaling an object from its current scale to a scale of 0 I want to have an animation which starts at a starting scale of whatever the current gameObject's scale (i.e 1, 1, 1 or 2, 3, 2) is which then end at a scale of 0, 0, 0.

The problem is that Unity's animator has fixed values and so, I cannot make one animation that would easily apply to every object.

I'm fine with using C# code to do this but I haven't been able to find anything that works yet. Thanks for your help!

sentences:
How to create inline glow shader for 2d polygon in CG using Unity Shader Lab? So here is what I am trying to do. Given irregular polygon (on the left) I would like to be able to create a shader that would resemble Photoshop inline glow effect with opaque fill (on the right).

Creating similar effect for 3d object I can achieve with Fresnel function. However, I am not able to do it for a flat surface of any given irregular 2d polygon.

EDIT

I am planning on using Voronoi method to generate polygons and then connecting individual polygons to territory shapes based on which player owns them. Which, then will have border material applied. What I need is effectively border (or territory) shader. That means shader has to work for more irregular shapes, like the one below.

sentences:
Terrain shader from heightmap opengl GLSL I generated a terrain from a heightmap and now I'd like to apply  shader on it which can contain different textures, based on height but I can't adapt any online code to my project.
This is the GL_LINE rendered image

The matrix generated from the heightmap has 0-255 values and -1 as the endline character.

This is the code of the terrain, the matrix is stored in a map<int, map<int, int>> data;structure:

#include "Terrain.h"

Terrain::Terrain(Scene* s, string filename): Entity(s) {
    this->hm = s->getHeightmap(filename);
    texture = scene->getTexture("avatar2.jpg");
    shader = scene->getShader("terrain.shader");
}

Terrain::~Terrain() {
}

void Terrain::draw() {
    cout << "Draw Terrain" << endl;
    glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
    //glUseProgramObjectARB(0);
    glUseProgram(this->shader->getRes());
    glTranslated(0, -20, -31.4);
    glRotatef(45, -1, 0, 0);

    const float offX = -25;
    const float offY = 0;
    const float lato = 0.5;
    const int limit = 100;
    const int limsx = 0;

    glBegin(GL_QUADS);
    for (float i = limsx; i < limit-1; ++i) {
        for (float j = limsx; j < limit-1; ++j) {
            glVertex3f(offX+lato*(j+1), offY+lato*i, hm->getHeight(i,j+1)/50);
            glVertex3f(offX + lato*(j + 1), offY + lato*(i + 1), hm->getHeight(i + 1, j+1)/50);
            glVertex3f(offX + lato*j, offY + lato*(i + 1), hm->getHeight(i+1, j)/50);
            glVertex3f(offX + lato*j, offY + lato*i, hm->getHeight(i, j)/50);
        }
    }
    glEnd();
}

Can you help me generating a terrain shader? Thank you very much

EDIT: thanks a lot to sakul_ca. This is what I got by using and editing his code

I used a shader that applies 4 textures to different heightmap values

sentences:
How can I edit multiple sprites in Sprite Editor at once? I have 100 sprites in one atlas. I want to edit some of them with same values.

For example, I want to edit sprite's position no 1 ~ 30. Do I have to edit them one by one?

Is there any function like Shift + drag for selecting several sprites?

sentences:
Unity hangs when adding a GameObject to a List Since 3 days ago Unity started freezing after adding a GameObject to a List. I haven't changed anything in that particular code, so I have no idea why this is happening:

 private IEnumerator HandleSelectedCubes() {
    if (InputManager.instance.selectedCube != null && !selectedCubes.Contains(InputManager.instance.selectedCube)) {
        if (oldSelectedCube == null) {
            selectedCubes.Add(InputManager.instance.selectedCube); // This is where it crashes
            oldSelectedCube = InputManager.instance.selectedCube;
        } else if (InputManager.instance.selectedCube.name != oldSelectedCube.name) {
            ClearSelectedCubes();
            selectedCubes.Add(InputManager.instance.selectedCube);
            oldSelectedCube = InputManager.instance.selectedCube;
            InputManager.instance.selectedCube = null;
        }

        AudioManager.instance.PlayCubeSelectSound();

        if (selectedCubes.Count == 4) {
            InputManager.instance.allowCubeSelection = false;
            moveDone = true;
            yield return new WaitForSeconds(0.07f);

            var destroySelectedCubes = true;

            foreach (var cube in selectedCubes.ToList()) {
                if (cube != null && cube.tag == "Lightning")
                    destroySelectedCubes = false;
            }

            foreach (var cube in selectedCubes.ToList()) {
                if (cube != null) {
                    cube.GetComponent<Cube>().hasGivenShard = true;
                    CubeAbilities.instance.TriggerSpecialCubeAbility(cube);

                    if (destroySelectedCubes) {
                        DestroyCube(cube);
                        ClearSelectedCubes();
                    }
                }
            }

            InputManager.instance.playerMovesCount++;
            AudioManager.instance.PlayCubeDisappearSound();
            ShardManager.instance.AddSessionShards(4);
        }
    }
}

sentences:
Sony PSM SDK's 2D game engine I have started with the Sony PSM SDK this week, I'm interested in creating a little 2D game and have been reading through the web about a so called "2D game engine" integrated into the SDK.

Some information I read suggested that it was added on January 2012, but I have been going through the documentation and haven't been able to find any reference to it.

Does anybody know if they finally introduced the 2D game engine for the PSM SDK?

sentences:
Where to promote your indie game? Possible Duplicate:
  Where to advertise my game?

Let's say I have developed a game and I want to "get it out there".  What I have in mind is open-source, non-commercial games.

What websites do you know of where you can promote your newly developed game, rather than simply posting it on your blog?

sentences:
How to make a game where match duration is determined only by skill disparity between the best player and the second best player? I want to create a real-time multiplayer game (with a variable number of players, potentially 2-20+, per match) where the match duration is determined only by how much better the best player is compared to the second best player. Thus, 2 properties are required:

Game duration is independent of the number of players. Racing games have this property in that the time it takes for a match to end (which is how long it takes the best player to finish) is independent of how many players are playing. However they don't have the 2nd property.
Game duration is inversely proportional to the skill disparity between the best and second best players - we want close games to last longer than complete stomps. I'm not aware of any game where there is such a strong correlation between match duration and skill disparity that one could say it's the rule. I mean, in Chess, if one is really bad, one could be mated in a few moves, and if two players are close in skill, then games might last really long, but this is not certain. In any case, these games tend to not have the first property.

How might one design a game that has both properties?

sentences:
How do I make an infinitely scrolling background? I am trying to make a game where a torpedos keep coming from random directions and the player has to maneuver a submarine to escape them.

I am currently offsetting the background to give it an illusion that the submarine is moving i.e. if the submarine moves forward, I move the background (quad) backwards. This is primarily being done as I want it to be an infinite space. The position of the submarine does not change, the player just controls the rotation of the submarine and the background moves in the opposite direction. The background is set to repeat to give it an infinite space illusion.

The torpedo gets spawned at a random distance and moves towards the submarine. Since, the position of the submarine does not change, the torpedo will always hit the submarine. How do I structure this game, specifically the background repeat so that I can actually move the submarine in absolute dimensions and still maintain the infinite space illusion?

sentences:
How can i exclude "Y" from drag in unity? I'm trying to make a moving object drag when no input is received, but i want the drag to only apply to X and Z variables, and not Y. Meaning i want it to fall at a normal speed, but when i stop giving it force in x and z directions, i want it to gradually and quickly stop going in those directions. How can i achieve this?

I've done this:

Vector3 input = new Vector3(Input.GetAxis("Horizontal") , 0, Input.GetAxis("Vertical");
If (input.x == 0 && input.z ==0) rb.drag = 3;

sentences:
Make a door in a cube-wall I have created a wall using a cube in Unity. Now I want to create a door in it.

How can I make a door in that cube?

Consider that the cube is automatically generated, so i have to generate the door in a C# script.

sentences:
How are CSS and WebGL coordinates related? I'd like to build a simple framework which rendering combines web page DOM elements with WebGL, such that they're manipulable in the same coordinate space.

How does the plain CSS coordinate system relate to the one used by WebGL? How can I make sure the two line up (e.g. have a div and a WebGL quad transformed the same way)? Can I expect CSS3D transform coordinates to correspond to WebGL?

sentences:
How to collapse a structure after procedural destruction When considering this temple structure with procedural damage in pink:

How can I efficiently determine the collapse of such structure as below?

Even if the model is defined on a voxel grid, it would still require possibly wide-ranging searches for connected-ness?

In the 2D case, flood-filling and labeling disconnected components is probably doable, but what about the 3D-case?

Can this be done without traversing the entire world space, every frame -- which I imagine, wrecks havoc to a data cache?

Lastly, what is the technical term for this problem of "making stuff fall down after procedural damage?"

sentences:
Will my Admob Unity Plugin be Obsolete? When I got back to Google Admob Console I received this announcement:

"Beginning on 23 Jan 2018, Google Mobile Ads SDK versions older than 7.0.0 for Android and 7.0.0 for iOS will no longer be supported. Publishers with these older versions will not be able to serve ads in their apps(s). Please ensure that you have upgraded to the latest version of the Google Mobile Ads SDK."

I am concerned about whether the Unity game I released eight months ago will continue to serve Admob ads.

I think this pertains to many Unity developers. It seems that the Google Mobile Ads for Unity uses a different versioning system. Its current version is version v3.10.0.

So what is the latest version of Admob Unity Plugin that will be affected by this? Will we be affected at all?

sentences:
Why are most characters all the same height in games? In the majority of video games I play, I notice that NPC's are the same height. What's up with that?

It kinda takes me out of the experience, when I see ten people in a row that are 5 foot 8. Anyone else notice this, or am I crazy?

sentences: How to reduce the time it takes to speed up an object? I have a body that I am applying a force to every step. However, I it takes a significant amount of time for it to speed up, which I do not want. Is there some value I can adjust to help with this?

sentences:
I am getting different results when using 'Maximize on play '? so i'll be straight to point.
when i move my character without using 'max on play' it works fine just as i wanted it to be.
but when i switch to 'max on play' my character moves very fast.
i am using addForce() to make me character move in Update().
after some googling i found that as i am working with physics i need to use FixedUpdate();
But when i tried with fixed update i felt like it was not registering the keystrokes as it would in Update().
i would really appreciate if someone would help me out here.
Edit - Movement Script Added
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    [SerializeField] float jump_speed;
    [SerializeField] float walk_speed;
    [SerializeField] float max_speed;
    Rigidbody2D rb;
    int jump_counter;
    Animator animator;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        animator = GetComponent<Animator>();
        jump_counter = 0;
        animator.SetBool("isIdle", true);
        animator.SetBool("isWalkingLeft", false);
        animator.SetBool("isWalkingRight", false);
    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space)  && jump_counter <=1)
        {
            rb.AddForce(transform.up * jump_speed);
            jump_counter++;
        }
       else if (Input.GetKey(KeyCode.D))
        {
            rb.AddForce(transform.right * walk_speed);
            PlayWalkingRightAnimation();
        }
       else if (Input.GetKey(KeyCode.A))
        {
            rb.AddForce(-transform.right * walk_speed);
            PlayWalkingLeftAnimation();
        }
        else
        {
            if(jump_counter<=0) PlayIdleAnimation();
        }
    }
    void FixedUpdate()
{
     rb.velocity = Vector2.ClampMagnitude(rb.velocity, max_speed);

}
    private void OnCollisionEnter2D(Collision2D collision)
    {
        jump_counter = 0;
    }

    void PlayWalkingLeftAnimation()
    {
        animator.SetBool("isWalkingLeft", true);
        animator.SetBool("isWalkingRight", false);
        animator.SetBool("isIdle", false);
    }
    void PlayWalkingRightAnimation()
    {
        animator.SetBool("isWalkingRight", true);
        animator.SetBool("isWalkingLeft", false);
        animator.SetBool("isIdle", false);
    }
    void PlayIdleAnimation()
    {
        animator.SetBool("isWalkingLeft", false);
        animator.SetBool("isWalkingRight", false);
        animator.SetBool("isIdle", true);
    }

}

I have added whole script hope this helps understand my problems.

sentences: How to flip a box2d body when it can't move forward? LibGDX I'm attempting to create a simple enemy for a platformer. It should move forward constantly until it hits something like a wall, and then it should flip and move forward the other direction. How might I accomplish this?

sentences:
melonJS: Entity and solid block on collision layer Actually I have my player entity with 64x64 sprite animation and 18x60 hitbox also the map is made by 16x16 tiles.
When my player goes some way he can pass through blocks (but not all of them).
For example there are 4 situations:

Good (player can't pass the tile with isSolid property on collision layer)

Good (player can't pass the tile with isSolid property on collision layer)

Bad (player pass the tile with isSolid property on collision layer)

Bad (player pass the tile with isSolid property on collision layer)

Looks like melonJS checks only corners of hitbox instead of whole rectangle.
Can anyone help me in this situation.

UPD: my PlayerEntity.

var PlayerEntity = me.ObjectEntity.extend({
    init: function(x, y, settings) {
            settings.image = "player";
            settings.spritewidth = 64;
            settings.spriteheight = 64;
            this.parent(x, y, settings);
            this.setVelocity(3, 10);
            this.updateColRect(23, 18, 4, 60);
            me.game.viewport.follow(this.pos, me.game.viewport.AXIS.BOTH);
            this.direction = 'stand2';
            this.addAnimation("run", [0,1,2,3,4,5,6,7,8,9]);
            this.addAnimation("stand", [33]);
            this.addAnimation("stand2", [44]);
            this.addAnimation("jump", [29,29,29,29,29,29,29,29,27,27]);
            this.addAnimation("jump2", [26,27,27,27,29,29,27,27,26]);
    },
    update: function() {
            hadSpeed = this.vel.y != 0 || this.vel.x != 0 ;
            if(hadSpeed)
                this.animationspeed = me.sys.fps / 10;

            if (me.input.isKeyPressed('left')) {
                this.jumping ? this.setCurrentAnimation('jump2') : this.setCurrentAnimation('run');
                this.flipX(false);
                this.vel.x = -this.accel.x * me.timer.tick;
                this.direction = 'left';
            }
            ...
            right/jump etc goes here
            ...
            updated = this.updateMovement();
            if (!hadSpeed) this.setCurrentAnimation('stand');
            if (updated) this.parent(this);
            return updated;
    }
});

sentences: Game Maker 8 high score table pixel size How big is the high score table in Game Maker 8? I wanted to make a background image for the table but each time I do the background is either too big or too small and makes it blurry.

sentences:
Do I need the dev kit in order to release for Wii U? In nintendo's developper website I found this quote.

  Q: How much does it cost to develop on Wii U?

  It’s free of charge to participate in the program and to submit games
  to Nintendo for technical certification. There is some cost involved
  for Wii U development hardware, but we run a program to help
  developers who are just getting started.

Now is it necessary to get those dev kits? I mean if I have my own personal console. Use Unity libraries (for example there is a ready .dll for using the WiiMote ), am I obliged to get the dev kit? I plan to develop my game using unity if that makes any changes.

sentences:
Physics system imploding under force I have a basic physics body system (incomplete/very basic; as collision resolution and detection are not implemented, just mass, position, velocity, acceleration, force and impulse).

I implemented position, velocity, acceleration, force and impulse as described in Game Coding Complete 3rd. Ed. by Mike "Mr. Mike" McShaffrty et al. specifically Chapter 15: Collision and Simple Physics by Jeff Lake which is: (paraphrasing from text and code, US copyright law and all that.)

  Gravity is a Force.

  Application of a Force vector adds it to a std::list of forces.

  Application of an Impulse vector adds it to a std::list of impulses.

  Upon calling Update on the physics body:

  Add all forces and all impulses together (F).
  Clear the impulses list.
  Set acceleration to (F / mass)
  Set velocity to (velocity + (acceleration * deltaTime))
  Set position to (position + (velocity * deltaTime))

(See code below)

The problem I'm having is when gravity is applied as a force the list grows linearly...forever. Eventually it overcomes any attempt to directly set the position of an object to the point that A) The object is always affected by gravity no matter if or how fast the position is changed (clamping to the screen is a good example) B) The list grows so large that the system implodes and chugs. C) If, before the system implodes, the object is stopped at a specific position, the acceleration due to gravity continually increases making it ever harder to change the acceleration/velocity/position of the object (specifically applying an impulse or force upwards).

If I change the noted line in GravityHandler to elem->ApplyImpulse(deltaG); it works satisfactorily but is this correct or am I missing something?

My implementation according to his example:

RigidBody and its state:

void State::ApplyImpulse(const Vector2D& impulse) {
    _impulse.push_back(impulse);
}

void State::ApplyForce(const Vector2D& force) {
    _forces.push_back(force);
}

//RigidBody is a `friend` of State.
void RigidBody::ApplyForce(const Vector2D& force) {
    _curState.ApplyForce(force);
}
void RigidBody::ApplyImpulse(const Vector2D& impulse) {
    _curState.ApplyImpulse(impulse);
}

GravityHandler:

void GravityHandler::Update(double deltaTime) {

    class UpdateObject {
    public:
        UpdateObject(double deltaTime) : _deltaTime(deltaTime) { };
        void operator() (RigidBody* elem) {
            double mass = elem->GetMass();
            if(Math::IsEqual(mass, 0.0)) return;

            double gxm = elem->GetXGravityModifier();
            double gym = elem->GetYGravityModifier();

            Vector2D deltaG(_GRAVITY_VALUE.GetX() * gxm * mass * _deltaTime, _GRAVITY_VALUE.GetY() * gym * mass * _deltaTime);
            elem->ApplyForce(deltaG); //The problem seems to be here.
        };
    private:
        double _deltaTime;
    };

    _accumulator += deltaTime;
    if(_accumulator < (1.0 / 60.0)) return;
    _accumulator -= deltaTime;
    if(!_isActive) return;
    std::for_each(_subscribers->begin(), _subscribers->end(), UpdateObject(deltaTime));
}

RigidBody:

void RigidBody::Update(double deltaTime) {

    double mass = GetMass();
    //If static body, do nothing.
    if(Math::IsEqual(mass, 0.0)) return;

    Vector2D F;
    F += std::accumulate(_curState._forces.begin(), _curState._forces.end(), Vector2D());
    F += std::accumulate(_curState._impulses.begin(), _curState._impulses.end(), Vector2D());
    _curState._impulses.clear();
    SetAcceleration(F / mass);
    SetVelocity(GetVelocity() + GetAcceleration() * deltaTime);
    SetPosition(GetPosition() + GetVelocity() * deltaTime);

}

sentences:
Collision Detection Between 3 or More Objects Say I have a 2D grid of particles, and I wanted to find out if any of them were colliding. In my head I have come up with a system where you check every possible location for each particle in that 'tick' and see if there is a collision. But, I have found a problem with this system.
If I check each particle against every other particle, (or in a smaller grid, that's radius is the particle's velocity) then how would I check if 3 or more particles have collided? The issue is that the system will see two particles collide, then set their velocities accordingly, but what if there was another particle which was going to collide, but wasn't checked in time, so the system doesn't see any collision, and lets it 'tunnel'.

sentences:
Distance from capsule center to point on the surface this question is engine agnostic, I will use the term "object" to refer to entities in my scene.

The scenario is the following:

I have 2 entities
Entity O is a capsule
Entity C is a point

I want to move B toward A's center but stop on A's surface in the less computationally expansive way I can think about.

I figured I'd work out the distance between the center of the capsule and the point on the surface where I should stop and use it as an offset to my destination point (destinationPoint -= direction * computedDistance), but I don't know how to find that distance.

My question is: can you come up with a better way to achieve my goal and if not can you solve the problem I've stumbled upon in my solution?

This is a representation of the secondary problem. In the figure I know the coordinates of C, O, A, B, and I want to know the length of PO or the coordinates of P.

sentences:
Where is linked_portal_door in the Source SDK? I just made a new mod in the Source SDK. I saw online that there is an entity that allows portals to be created (linked_portal_door). However, I cannot find or create this entity.

Is it included in the base SDK or do you have to have an add-on. If it is not included, is there an alternative?

I am using Source Engine 2007.

sentences:
How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel? I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment.
The map would be entirely put in darkness at the beginning, but as the player shoots the environment, it would be rendered with its "real texture". So say I have a tree. First it is entirely black or greyish, but if I shoot somewhere, I would see some green.
To accomplish this, I'm using a raycast to get the impact point and so I can access any renderer of the point that the player is shooting on. I guess the next step would be to write a custom shader to light the exact pixel that is shot. Do you have any idea how I could write this shader or another way of doing this effect?

Regards

sentences:
How to use collision masks and overlap_area in pygame? So, I've been prototyping a game, and I've been using sprite collision, and it's not cutting it any more. I read up on the documentation about masks and overlap area: https://www.pygame.org/docs/ref/mask.html#pygame.mask.Mask.overlap_area

How exactly do I use this? The documentation says "This can be used to see in which direction things collide, or to see how much the two masks collide. An approximate collision normal can be found by calculating the gradient of the overlap area through the finite difference."

I don't quite follow this description. How can I tell the direction of the collision? What does the return value actually contain? How would I implement this collision for two Pygame Sprites with images and transparency?

Is there a more in-depth explanation (preferably with sample code) anywhere? I can't find anything more detailed than the documentation.

sentences:
ShaderBytecode Compiler one technique multiple passes I have an effect code with a basic structure like

technique TechniqueName {
    pass FirstPass {
        Profile = fx_4_0
        VertexShader = RenderFirstVS
        GeometryShader = null
        PixelShader = RenderFirstPS
    }
    pass SecondPass {
        Profile = fx_4_0
        VetrexShader = RenderSecondVS
        GeometryShader = null
        PixelShader = RenderSecondPS
    }
    pass ThirdPass {
        Profile = fx_4_0
        VertexShader = RenderThirdVS
        GeometryShader = null
        PixelShader = RenderThirdPS
    }
}

Now I tried to compile this with

using (BinaryReader reader = new BinaryReader(stream)) {
    CompilationResult result = ShaderBytecode.Compile(reader.ReadBytes((int)stream.Length), "fx_4_0");
    if (result.HasErrors) {
        throw new Exception(result.Message, new Exception(result.ResultCode.ToString()));
    }
    Data = result.Bytecode.Data;
}

stream is new MemoryStream(Encoding.Default.GetBytes(effectContent)).
The Data-Property (byte[]) is about 1 KiB large but if I try to load it via

context.InputAssembler.InputLayout = new InputLayout(device, effect.Data, someElements)

it crashes with following exception D3D11 ERROR: ID3D11Device::CreateInputLayout: Input Signature in bytecode could not be parsed.  Data may be corrupt or in an unrecognizable format. [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE]

Any idea how I can fix this or why the error is thrown? I do not want to use multiple shaders because I reuse many parameters I do not want to reassign in a deferred shading setup.

sentences:
Bitmap font rendering, UV generation and vertex placement I am generating a bitmap, however, I am not sure on how to render the UV's and placement. I had a thread like this once before, but it was too loosely worded as to what I was looking to do.

What I am doing right now is creating a large 1024x1024 image with characters evenly placed every 64 pixels. Here is an example of what I mean. I then save the bitmap X/Y information to a file (which is all multiples of 64).

However, I am not sure how to properly use this information and bitmap to render. This falls into two different categories, UV generation and kerning. Now I believe I know how to do both of these, however, when I attempt to couple them together I will get horrendous results.

Now for the algorithm. I am doing my letter placement with both GetABCWidth and GetKerningPairs. I am using GetABCWidth for the width of the characters, then I am getting the kerning information for adjust the characters.

Does anyone have any suggestions on how I can implement my own bitmap font renderer? I am trying to do this without using external libraries such as angel bitmap tool or freetype. I also want to stick to the way the bitmap font sheet is generated so I can do extra effects in the future.

Rendering Algorithm

for(U32 c = 0, vertexID = 0, i = 0; c < numberOfCharacters; ++c, vertexID += 4, i += 6)
{

    ObtainCharInformation(fontName, m_Text[c]);

    letterWidth = (charInfo.A + charInfo.B + charInfo.C) * scale;

    if(c != 0)
    {

        DWORD BytesReq = GetGlyphOutlineW(dc, m_Text[c], GGO_GRAY8_BITMAP, &gm, 0, 0, &mat);
        U8 * glyphImg= new U8[BytesReq];
        DWORD r = GetGlyphOutlineW(dc, m_Text[c], GGO_GRAY8_BITMAP, &gm, BytesReq, glyphImg, &mat);

        for (int k=0; k<nKerningPairs; k++)
        {
            if ((kerningpairs[k].wFirst == previousCharIndex) && (kerningpairs[k].wSecond == m_Text[c])) {
                letterBottomLeftX += (kerningpairs[k].iKernAmount * scale);
                break;
            }
        }

        letterBottomLeftX -= (gm.gmCellIncX * scale);
    }

    SetVertex(letterBottomLeftX, 0.0f, zFight, vertexID);
    SetVertex(letterBottomLeftX, letterHeight, zFight, vertexID + 1);
    SetVertex(letterBottomLeftX + letterWidth, letterHeight, zFight, vertexID + 2);
    SetVertex(letterBottomLeftX + letterWidth, 0.0f, zFight, vertexID + 3);
    zFight -= 0.001f;

    float BottomLeftX = (F32)(charInfo.bitmapXOrigin) / (float)m_BitmapWidth;
    float BottomLeftY = (F32)(charInfo.bitmapYOrigin + charInfo.charBitmapHeight) / (float)m_BitmapWidth;

    float TopLeftX = BottomLeftX;
    float TopLeftY = (F32)(charInfo.bitmapYOrigin) / (float)m_BitmapWidth;

    float TopRightX = (F32)(charInfo.bitmapXOrigin + charInfo.B - charInfo.C) / (float)m_BitmapWidth;
    float TopRightY = TopLeftY;

    float BottomRightX = TopRightX;
    float BottomRightY = BottomLeftY;

    SetTextureCoordinate(TopLeftX, TopLeftY, vertexID + 1);
    SetTextureCoordinate(BottomLeftX, BottomLeftY, vertexID + 0);
    SetTextureCoordinate(BottomRightX, BottomRightY, vertexID + 3);
    SetTextureCoordinate(TopRightX, TopRightY, vertexID + 2);

    /// index setting

    letterBottomLeftX += letterWidth;

    previousCharIndex = m_Text[c];

}

sentences: How to add the iPhone X screen dimensions to the mix of different iPhone screen sizes Generally for Unity I design all my artwork in Illustrator. So I start off with 1440x1920 (for portrait games) and outline a red frame of 1080x1920. So everything that fits well within the 1080x1920 usually covers the family of iOS devices for me. Then I set the  Pixels Per Unit to 192 for all my images. This approach has really served me well. Now that the iPhone X is in the mix, how can I cater for it in a similar way?

sentences:
How to implement auto-aiming / auto-targeting We all know how auto-aiming or auto-targeting works in games.

Now, I need to find how to implement it in my game.

In fact I should implement it in UDK and I would be glad if anyone gave me more specific explanation for UDK. But conceptual explanation is also enjoyable and I'll implement it myself in my way.

sentences:
Add tiles to both sides of TileMap List in MonoGame This is what my tile map looks like (red highlighting added for clarity):

My code:
private List<List<int>> _layoutLayer = new List<List<int>>(50); // Layout Layer
private List<List<int>> _trLayer = new List<List<int>>(50); // Transitional Layer
private List<List<int>> _entityLayer = new List<List<int>>(50); // Object Layer
private List<List<int>> _logicLayer = new List<List<int>>(50); // Logic Layer

// To add a tile
if (inputManager.IsMouseHeld(true))
{
    try
    {
        switch (_currentLayer)
        {
            case LayerRepresentation.LayoutLayer:
                _layoutLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
            case LayerRepresentation.TransitionalLayer:
                _trLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
            case LayerRepresentation.EntityLayer:
                _entityLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
            case LayerRepresentation.LogicLayer:
                _logicLayer[_gridMouseY][_gridMouseX] = _currentTile;
                break;
        }
    }
    catch
    {
         // Player clicked outside of map bounds, add specified amount of tiles to map
    }
}

What I need:
When the player clicks outside of map bounds for example on the point A, add the amount of tiles between point A and the map to the map's height. Do the same with point B, but add to the map width instead.
What I've tried:
    // Inside the above catch block
    if (_mapHeight - _gridMouseY == 0 && _gridMouseX < _mapWidth && _gridMouseX > -1)
    {
        List<int> tempDefaultLayout = new List<int>();
        List<int> tempDefaultOther = new List<int>();

        for (int i = 0; i < _layoutLayer[0].Count; i++)
        {
            tempDefaultLayout.Add(0);
            tempDefaultOther.Add(-1);
        }
        _layoutLayer.Insert(_gridMouseY, tempDefaultLayout);
        _trLayer.Insert(_gridMouseY, tempDefaultOther);
        _entityLayer.Insert(_gridMouseY, tempDefaultOther);
        _logicLayer.Insert(_gridMouseY, tempDefaultOther);
        _mapHeight++;
    }
    else if (_mapWidth - _gridMouseX == 0 && _gridMouseY < _mapHeight && _gridMouseY > -1)
    {
        for (int y = 0; y < _layoutLayer.Count; y++)
        {
            for (int x = 0; x < _layoutLayer[y].Count; x++)
            {
                if (_layoutLayer[y].Count <= _mapWidth)
                {
                    _layoutLayer[y].Add(0);
                    _trLayer[y].Add(-1);
                    _entityLayer[y].Add(-1);
                    _logicLayer[y].Add(-1);
                }
            }
        }
        _mapWidth++;
    }
    return;

The problems:

The first part is about adding tiles to the height (only one row at a time) Adding the temp Lists to the layer Lists with List.Add() doesn't work, I don't know why. I used List.Insert instead.
The second part is used to add a single column to the map one at a time.

Any help would be appreciated.

sentences:
How can I write a dots effect shader when the character is behind an object? I watched an interesting effect while I was playing Super Mario Odyssey: when Mario or another character was behind an obstacle (walls, etc), a tiny gray silhouette mesh appears.

I tried to build something similar using an amplify shader with Unity but I could not achieve it.

How could I write this?

Here is an example from the game:

sentences:
Real time lighting in a 2D game with angled camera perspective The game "Monaco: What is yours is mine", has a nice real time lighting/shading effect as shown in this picture:

Notice how the vision is blocked by obstacles. I would be interested in seeing if this effect could work in a game with angled camera view. There are about a million such games, for example see Stardew Valley:

It is not clear to me if these two graphics styles could be easily combined. I'm looking for examples - either full games or just technical demos, etc. of the Monaco-like lighting effect applied to angled camera perspective (like in Stardew Valley).

sentences:
2D isometric game with 3D prefabs Is it possible to have a 2D isometric game in Unity, but also have 3D prefabs in the scene?
Will that work or should I make the game in 3D with an isometric camera?

sentences:
How can I scroll sprites when swiping using Cocos2D? I'm adding 3 sprites (layers) to CCParallaxNode:

BGLayer = [CCSprite spriteWithFile:@"Layer.png"];
[_backgroundNode
    addChild:BGLayer
    z:2
    parallaxRatio:layer1Speed
    positionOffset:ccp(screenSize.width/2,screenSize.height/2)
];

How can I create the scroll when swiping?

sentences:
RPG Data (Skills, Monsters, Items, Equippables) I'm creating a simple RPG type game. I've dabbled with the idea of just loading all the skills, monsters, items and so on at once. However, to do that seems horrible wasteful since I would have potentially hundreds of things in memory that may not necessarily be used just for the battle system.

I'm pretty close to finishing the battle system, I just need to figure out how to handle the data prior.

So would it be best just to just access the disk to load this information in when I need it?   I was considering porting this to another device after I get it working on a PC.

I was looking at the decompilation of Pokemon Red and I'm not exactly sure how they managed to do it either. Given that the RAM for the Gameboy was 8 kilobytes (32 if expanded).

Any pointers (no pun intended) or ideas?

sentences:
Scaling a GameObject for a progress bar representation I am trying to implement a progress bar system for my game. I know that it could be done with Unity's OnGUI and scaling with width of the texture but I don't want it to be a GUI element because in my game we would have several progress bars for each specific item.

In the below image you can see two of the progress bars and they are textures mapped on to a plane.

The actual progress bar that needs to increase/ decrease in width is just a gameObject. I could just localScale and just scale it in the x direction of the gameobject but that scales in both directions. So scaling is not a solution. How do I make it work such that it I could control its width? Is there any other way I could implement this system? Or could I just use Unity's OnGUI for this purpose? Thing is this progress bars need to show up in the game on top of several gameOjects in the perspective camera view. So I am not sure if OnGUI would work for that. Any ideas?

I want something similar to what we see in games like LoL where they have health bars on top of the in game characters like in the image below

sentences:
Unifying Texture-, Bump- and Lightmapping I would like to implement a rendering component that makes use of texture-, bump- and light mapping. Unfortunately, I am a little bit stuck on some implementation details. In particular,

Does each different map require individual texture coordinates? (I assume at least a   light map would)
Is there a simple file format that stores all the information needed? ( I guess .obj's are missing support for light maps)

I would be grateful for advice on this.

sentences:
Mixing interpolation with extrapolation in multiplayer game I am creating a multiplayer drag racing game and have difficulties mixing extrapolation and interpolation. To save network bandwidth i am getting information from the opponent only on his button press, which is:

car->speed = newSpeed;
car->distanceReached = newDistance;
car->currentForce = newForce;

And i extrapolate the rest until the next update from opponent. On player update, extrapolation kicks in:

//Find new acceleration, frictionForce and mass being constants.
car->acceleration = (car->currentForce - car->frictionForce) / car->mass;

//Calculate new velocity.
car->speed += car->acceleration * dTime;

//Reduce force.
car->currentForce -= car->friction * dTime;
if(car->currentForce < 0)
    car->currentForce = 0;

//Update distance reached
car->distanceReached += car->speed;

So we got update from opponent - car starts moving until force is equal 0. This seems to be working fine. What is not - when update is received in the middle of extrapolation, i am setting new position directly as seen before and car jumps to adjust to the "real" position. So the question is - how to incorporate interpolation in this situation for car not to jump and not to ruin already running extrapolation?

sentences:
Should I continue studying OpenGL or just switch to DirectX to  give me a better chance of landing a job in the game industry? I've been learning graphics programming for some time now using OpenGL and Linux. I'm pretty familiar with most of the concepts, but I would really like to further my knowledge and eventually pursue a career in game development, especially game engine development.

So far it seems to me that the majority of game studios make games for Windows using DirectX.

Edit: I know that the OpenGL vs DirectX question has been asked here before, but I haven't found an answer in the perspective I want.

Edit 2: After reading all the responses/comments I've decided to continue diving deeper into graphics with OpenGL/GLSL, but I'll try to play around with DX as well, just to have a basic understanding of the API.
I'd like to thank everyone for the answers and insight you've given me.

sentences:
How do I get GLEW to use my Nvidia GPU instead of an integrated Intel card? I'm new to graphics programming, though not to coding generally. I've been learning opengl from the OpenGL Superbible, 6th Edition. I was trying out the shader examples from the book but couldn't get them to work. The logged error says approximately "incorrect #version". The book uses GLSL 4.3 core.

I ran glewinfo.exe and the generated text file said that the core OpenGL version on my system was OpenGL 4.0, but it was the stats of my integrated Intel GPU, not my Nvidia GT720m GPU. I'm pretty sure the nvidia gpu supports a higher opengl version.

How do I get GLEW to detect the high-performance GPU and make calls to the Nvidia drivers instead of the integrated Intel HD GPU?

A similar question has been asked there, but it concerned only running the program on the gpu. How do I tell which version of OpenGL the Nvidia GPU supports?

sentences:
How to get an OnClick Event in Unity to action? I am new to Game Dev and I am following a Tutorial.  Within this tutorial, we create a quest system, that allows you to accept or decline a quest. This tutorial is based on Unity 5 and I am using 2020.1 so there could be version differences that could be causing the issue.
I have a script called:
Quest001Buttons.cs
public class Quest001Buttons : MonoBehaviour {
    public GameObject ThePlayer;
    public GameObject NoticeCam;
    public GameObject UIQuest;
    public GameObject ActiveQuestBox;
    public GameObject Objective01;
    public GameObject Objective02;
    public GameObject Objective03;

    public void AcceptQuest() {
        Debug.Log("Accept Registered");
        ThePlayer.SetActive(true);
        NoticeCam.SetActive(false);
        UIQuest.SetActive(false);
        StartCoroutine(SetQuestUi());
    }

    IEnumerator SetQuestUi() {

        ActiveQuestBox.GetComponent<Text>().text = "My First Weapon";
        Objective01.GetComponent<Text>().text = "Reach the Clearing";
        Objective02.GetComponent<Text>().text = "Open Chest";
        Objective03.GetComponent<Text>().text = "Get Weapon";
        QuestManager.ActiveQuestNumber = 1;
        yield return new WaitForSeconds(0.5f);
        ActiveQuestBox.SetActive(true);
        yield return new WaitForSeconds(1);
        Objective01.SetActive(true);
        yield return new WaitForSeconds(0.5f);
        Objective02.SetActive(true);
        yield return new WaitForSeconds(0.5f);
        Objective03.SetActive(true);
        yield return new WaitForSeconds(9);
        ActiveQuestBox.SetActive(false);
        Objective01.SetActive(false);
        Objective02.SetActive(false);
        Objective03.SetActive(false);

    }
}

I have an Empty GameObject called "QuestButtonManager" which I have assigned the above script to.
I also have a UI GamObject called "Accept" and I have attached the QuestButtonManager GameObject to the OnClick() Event within that component.  I have selected:
"Runtime Only" and the function of "Quest001Buttons.AcceptQuest".
When I run the game and press the Accept Button...the game seems to not function after that and is stuck on that screen, with the button highlighted...not even the Debug.Log text is printed in the console.
Any help is greatly appreciated before I give it up and look for a more updated version to learn on.

sentences:
Rotating RigidBody2Ds in Godot I am practising programming games with the Godot Engine and I've been having some issues with RigidBody2Ds.

In this case I have a RigidBody2D as a child of a Node2D. The Node2D is rotating and the RigidBody2D with it. However, as soon as I use apply_impulse() it just returns to it's initial rotation point, which is zero.

Does anyone know what's going on here?

sentences:
Card game - creating card Listener I am making a card game where there are 21 cards on hand and 2 options from where user can draw cards to his hand and throw a card from hand.

I am new on game development and I'm following the principle of MVC.
Till now in my game I have a InputHandler class that handel the input. GameWorld and GameRender are two class which controll the game logic and render the game respectively. Both of these class are called by GameScreen class which extends Screen.

My question is how should I implement the touchListener to these cards. They are now just sprites and I have used texture Packer to create a spriteSheet

Doing research i have found that Stage and Actor are the things that I am looking for. Reading on wiki I found that these are useful to create menus. I've also read that working with stage and Actor is  complex for creating game environment and follow the rule of MVC.

So, please anyone could guide me a way from where should I need to move forward. This is the very basic move that I need to move but I know if I did wrong here, i have to pay much more later.

sentences:
How do I gain access to objects in order to change their properties in Unity? I have created a GUI text object named "GUIText" in the Unity editor, and I want to change what the text says via code (I'm using C#). How do I access GUIText1 to change its string properties?

I want to be able to write code like this:

GUIText1.Text = "";

In general, I'm not sure how to get access to any sort of object created in the editor (a mesh or a light for example). How do you access them in code?

I already know how to write the scripts and trigger them.

sentences:
Parametric form of a cubic function After researching about curves in computer graphics (splines in my case), I have come across something I did not know: Explicit functions like: \$y=x^2+2\$ are not the best way to interpolate between points because you could get 2 or more values for y for the same x. So, parametric functions seem much better for this if we make the commonly used t parameter, the distance from origin, time, etc...
After studying a bit how to convert from explicit to parametric form I have been shocked when I have found in some texts they use these parametric cubic functions to interpolate through points:
$$\begin{align}
    x(t)&=at^3 + bt^2 + ct +d \\
    y(t)&=2at^3 + 2bt^2 + 2ct +2d
\end{align}
$$
but wait... this is the exact same form the explicit function was:
$$
    y(x)= ax^3 + bx^2 + cx + d
$$
From what I have seen for other example functions in some math books the parametric funcions where not the same form that its explicit form counterpart.
Am I missing something?
Examples of the texts I'm refering to could be:
https://www.cs.helsinki.fi/group/goa/mallinnus/curves/curves.html
http://escience.anu.edu.au/lecture/cg/Spline/parametricCubicCurves.en.html

sentences:
How do I avoid users hacking my network games from the client side? I've decided to make an online game; the server sends packets of information to the client application, which is going to simulate what it gets from the server. The client makes a part of the design of the game, and sends the new state back to the server for processing.

The clients can send fake information to the server, and inform the server that I've done the task successfully, without trying. Assume a Counter-Strike game; the client may send a fake packet to the server and tell the server that I've defeated someone. How can I avoid this violation?

sentences:
Unity - Array of custom class with a superclass using generics does not show in the inspector I want to create 2 classes for Scriptable Object: Weapon and Armor. Because both have similar functionality, I made a base class for both of them.

using UnityEngine;

public abstract class Gear<T> : ScriptableObject{

    public int price;
    public int level;
    public Sprite image;

    [Header("Levels List")]
    public T[] levels;

    public T CurrentLevel() {
        return this.levels[this.level];
    }

    public T NextLevel() {
        return this.levels[this.level + 1];
    }

    public bool UpgradesLeft() {
        return this.level + 1 < this.levels.Length;
    }

    public void Reset() {
        this.level = 0;
    }

    public bool Upgrade() {
        if (!this.UpgradesLeft()) return false;
        this.level++;
        return true;
    }
}

[System.Serializable]
public abstract class StatsLevel {
    public int price;
}

Both weapons and armors have the properties in common like they all have a price, they all have a Sprite Image, and so on... and more importantly they all have an array of Stat Levels. Meaning that every armor or weapon can have different levels, and depending on their level, the stats will be different. For that I used Generics.

So when I created the Armor, I did it this way:

using UnityEngine;

public enum ArmorStat { Low, Med, High, Super }

[CreateAssetMenu(fileName = "Armor", menuName = "NARG/Armor", order = 1)]
public class Armor : Gear<ArmorStatsLevel> {
    // Armor custom logic
}

[System.Serializable]
public class ArmorStatsLevel : StatsLevel {
    public int weight;
    public ArmorStat blunt, slash, range;
}

in this class I define the stats unique to an Armor. Up to here everything looks peachy. But the issue comes with the Inspector:

As you can see, the inspector is not showing the array with the list of Stats on different levels, and I after a lot of research, I think it has to do with the Generics. If instead of unifying the common code between Armor and Weapon on the Base, I duplicate it each subclass, the Array is shown without problem.

How could I make it so that the array information is shown in the inspector?

sentences:
Sound plays several times upon collision Upon collision, my sound effect plays several times. How can I fix this?

public Sprite charAlive, charDead;
public AudioClip popAudio;

void  OnCollisionEnter2D (Collision2D col ){

    if (col.gameObject.name == "dirtWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        AudioSource.PlayClipAtPoint(popAudio, transform.position);
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "gooWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "grassWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
}

IEnumerator Dead() {
//      AudioSource.PlayClipAtPoint(popAudio, transform.position); // PLAYS SEVERAL TIMES
//      AudioSource.mute(popAudio);
    yield return new WaitForSeconds(3/2);
            Application.LoadLevel ("untitled");
    // LOAD LEVEL RESETS EVERYTHING, MAKE LOAD CHAR INSTEAD?
}

sentences:
Determining IF & WHERE a line intersects with a 2D plane (in 3D space) The following problem I'm working on is for one of my favorite past-times: game development.

Problem: We're in 3D space. I'm trying to determine if a line between two vectors in said space is passing through a circle; the latter of which consists of: center vector, radius, yaw & pitch.
In order to determine that, my aim is to convert the circle to a plane which can either be infinite or just have the diameter of the circle for all it's sides.
Should the line between the two vectors in fact pass through that plane, I am left with the simple task of determining whether that intersection point is within the radius of the circle, in which case I can return either true or false.

What's already working: I have my circles set up and the general framework is there. The circles are appearing/rendered in the 3D space exactly as specified, great!

What was already tried: Copied some github gist codes and tried to make them work for my purposes. I kinda worked, sometimes at least. Unfortunately due to the nature of how the code was written, I had no idea what it was doing and just scrapped all of that. Researched the topic a lot, too. But due to me not really understanding the language people speak when talking about line/plane intersections, I could have read the answer without recognizing it as such.

Question: I'm stuck at line intersections. No idea where to go and how it works logically! So, where do I go from here and how can one comprehend all of this?

Note: I'm working with Java, but I'm not looking for spoon-fed code. It's a logical issue I'm trying to get past. If explained well enough, I will make the code work with trial and error!

sentences:
HLSL: Using instance float input to select texture index, possible? I'm writing a game for the xbox360 using XNA.
I would like to draw several models with a single DrawInstancedPrimitives call. Each model will use a different texture.

To do this, I would like to create a sampler array, and select which sampler to use in the array from a value passed into the shader from the instance vertex buffer.

So the shader code might look like:

void InstancingVertexShader(..., in float4x4 data : TEXCOORD0)
{
    output.TextureIndex = data._m00
}

void InstancingPixelShader(...)
{
    color = tex2Dlod(samplers[input.TextureIndex]);
}

Before I start trying to implement that, my question is:

Is it possible to do that, or will the HLSL complain?

Are there any cons to this method that I should know about?

sentences:
What are some good examples of exuberant in-game instructions for telling the player to repeatedly smash a button? What are some good examples of exuberant in-game instructions for telling the player to repeatedly and quickly press a button or perform an action? I'm especially interested in examples in retro games (e.g., from the NES, SNES, and 1980-90s arcade eras), and I would love to see examples with text, graphics, or both.

To illustrate, here are a few examples of the type of instructions that I'm thinking of:

Smash the A button to lift something heavy!
Toggle the joystick back and forth to break free!
Quickly press the button to build power in a meter!

I'm working on a 2D iOS game with retro-style pixel art, and there's a point where I want the player to quickly tap on a sprite to complete an action. I have a serviceable starting point -- the word "TAP" flashing with an arrow repeatedly moving downward beneath it:

But it still doesn't feel quite right.

I would love to see some actual examples from the golden days of 2D gaming to use as reference material. I know examples abound, but I'm just struggling to think of any concrete ones at the moment.

Can you think of any examples of this type of thing in old games?

sentences:
How can I cut a doorway through my wall at runtime? I am working on a Unity project where I have 3 models: a stacked, rounded wall (think logs), a flat wall (think bricks), and a door.

The door has an animation to open / close itself, and when it's attached to a wall, there's one major problem -- when the door swings in, it reveals not the empty space one would expect, but the segment of wall it's layered on top of!

Since all 3 models are part of dynamic mesh structures, I can't "pre-calculate" what the model should look like to account for the empty space of the door -- what if the player puts the door on the next segment of wall instead?

I considered expanding the "door" model to a "door + wall segment" model (replacing that wall segment entirely), but because I already have two separate shapes of wall, it quickly becomes a combinatorics problem -- 2 models for each door, per door shape (not to mention windows, or a 3rd [or fourth!] wall shape!). In short, this doesn't seem like a tenable solution.

What would work most cleanly is if I could remove a "Door-shaped" segment of my Wall segment mesh, leaving a clear hole that the Door model could snugly fit.

In an equation: Final Mesh A = Mesh A Volume - (Mesh A Volume ∪ Mesh B Volume)

Is an operation like that feasible? My gut tells me that polyhedron intersection is hard, and there might be a better way to do this. I'm also equally interested if someone has a better suggestion on how to solve the initial problem of doors intersecting with wall segments.

sentences:
Performance problems with quadtree for dynamic objects I´ve implemented a quadtree spatial partitioning to my game engine as I wanted to try it and see how it affects the performance checks. The results were great (instead of hundreds collision checks only for cursor I was suddenly having just about 10%), however I faced performance problems (not caused by the number of collision checks but by the spatial structure itself [or my implementation]) :

1. At first I was inserting items every frame and at the end of the frame the quadtree was cleared and so on. I realised this slowed down the performance more than 2-3 times.

2. Of cource the next step was to try to make the quadtree dynamic by not clearing it but by checking the moving objects from the quadtree. However this process is also not trivial as I can have a multiple nodes containing the same object (if it doesnt fit to any of the children I "broadcast" and check neighbour nodes so it can be visible in more than 1 node) and I ended up by digging through the entire quadtree again.

How did you solve these problems with the quadtrees? I´ve read that some of the engines use multiple spatial structures to divide work for static/dynamic objects, I would use quadtree for static structure but what would be suitable for dynamic? Also I think I "hurt" myself when I want to make as generic solution as possible so I dont have to change the spatial structures of my game engine no matter what type of game I´m creating with it at the time.

sentences:
Slick2D : translate -> scale -> translate doesn't return to the old position I am trying to implement zoom using Slick2D library.

As I understand, to zoom something on non (0,0) coordinates, we need:

translate so the target point is in (0,0)
apply scale factor
translate the target point back from (0,0)

Code example :

 aGraphics.translate(-width/2, -height/2);
 aGraphics.scale(2,2);
 aGraphics.translate(width/2, height/2);

The issue is, as far I understand, that the scale factor is applied to the translation too. To compensate this, I have use the next code :

 aGraphics.translate(-width/2, -height/2);
 aGraphics.scale(2,2);
 aGraphics.translate(width/4, height/4);

Is this expected behaviour for graphics ? Can I workaround the above effect using push/pop matrix ?

sentences:
How to identify whether the boundingvolume intersects with walls or floor when it doesnt return normals? My game in jMonkey is the kind that use will have to place objects in a scene (which consist of walls and slabs and floor). All my models are centered at origin. When the user click a point I use ray casting to find the point on the floor where the object will be placed (setLocalTranslation() and shootables.attachChild()).

CollisionResults results = new CollisionResults();
allAttached.collideWith (ray, results);

Now the problem is that when I click too close to an object or wall, the objects run into each other. I will use physics bounding volume to prevent objects running into each other but how to distinguish between horizontal(floor and slabs) and vertical planes (walls) which are part of same scene model.

I'm using code like this to identify collision in objects

private void checkCollision(Spatial model) {
      CollisionResults results = new CollisionResults();
      //BoundingBox box = new BoundingBox();
      //model.setModelBound(new BoundingBox());
      //model.updateModelBound();

      BoundingBox box = (BoundingBox) model.getWorldBound();
      allAttached.collideWith(box, results);

      CollisionResult closest = results.getClosestCollision();
      System.out.println("\n SIMAR \n Geometry = ");
      System.out.println(closest.getGeometry().getName());
      System.out.println("\nContactPoint = " + closest.getContactPoint());
      System.out.println("\nContactNormal = " + closest.getContactNormal());

        }

  }

However the problem is that its not giving me any normals/ etc.
Secondly its give me my geom-mall model scene when I shoot floor/ walls and slabs. Using ray casting I can identify horzontal and vertical surface as it gives getContactNormal but in case of BoundingVolume instead of ray, getContactNormal is just null.

How should I identify whether there is a collision with the wall or not.

sentences:
multi touch on HTML5 with JavaScript? How action game controls should be implemented so that they would work on smart phones as well?

At the moment I use wasd/arrow keys and I am able to handle for example two keys down at the same time.

But many phones has no physical keyboard so should I render some control areas? Are there any JS libraries for this?

sentences:
Different shader programs but same buffer drawing I've setup 3 different instances of the same shader code (e.g. I've compiled the code into 3 separate programs)

For each program, I've gone through the whole route of something like this:

//Setup
gl.useProgram(program);
const buffer = gl.createBuffer();
const location = gl.getAttribLocation(program, aName);

//Upload (each uses the buffer/location it created in Setup
gl.useProgram(program);
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(gl.ARRAY_BUFFER, data, usagePattern);
gl.vertexAttribPointer(location, nComponents, dataType, false, 0, 0);
gl.enableVertexAttribArray(location);

//Draw
gl.useProgram(program);
gl.vertexAttribPointer(location, 2, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);

However, no matter what I pass into data - e.g. different sized quads, all three are the same size.

Notably, changes to other uniforms/attributes like matrices and color do change per object

How do I change this so that the changes to data per instance will be drawn properly?

(I realize if they actually use the same shader I should maybe keep a reference to one program and use some sort of buffer pool- but I'm not there yet, just getting started with WebGL)

sentences:
Suitable interpolation for animating explosions Is there a standard interpolation function for animating explosions? Like there is with smoothstep or smootherstep for walking animations or cars going from point A to B.

I'm assuming the explosion needs to grow very fast at the beginning and then slow down - how much in relation to the default linear interpolation, I don't know.

I've tried inverse smoothstep and inverse squared from this article: Interpolation Tricks, but none quite cuts it, maybe I'm applying them wrong.

sentences:
JOGL Hardware Shadow Mapping Transparent Shadow Texture I'm using hardware shadow mapping on JOGL based on the demo(HardwareShadowMapping) supplied by the distribution. After generating the shadow texture from lights point of view, I apply it to my scene with no problems.

What I'm looking for is soft shadows instead of pitch black shadows. Is there any way that I can change the alpha values while applying the shadow/depth texture? Btw I'm not an expert on OpenGL especially about custom shaders and I don't want to spend more time on understanding and developing custom shaders instead of the game.

Here's a screenshot of the application in case you come up with another solution to what I'm trying to achieve. The game is actually a hack&slash RTS hybrid.Here's the pseudo code of the gl event listener attached to shadow pbuffer.

  gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
  gl.glPolygonOffset(polygonOffsetFactor, polygonOffsetUnits);
  gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
  //render shadow casting geometry
  gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
  gl.glBindTexture(GL.GL_TEXTURE_2D, lightViewTextureID);
  gl.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
  //I sense here a way of updating alpha values of this texture

sentences:
Are there any hex tile sizes where both width and height are integers? I'm trying to figure out the optimal width and height (in pixels) to start building hex tiles for game development. My preference is for "flat topped" hex grids, but the math is similar for both.

I am looking for an "optimal" tile size that allows both the width and the height of the tile to be a rounded pixel number, based on the fact that height = sqrt(3)/2 * width.

My math skills being virtually nonexistent, I just ran a brute force script that ran through widths from 1 to 1024 and did not come up with a single value for w where h was an integer. Is this really the case? How does anyone create pixel-perfect hex tiles if there's no even width & height size that can accommodate a perfect hex aspect ratio?

sentences:
How to make transitions between images in canvas (unity) So I have 3 same images, but with different colors which I want to cycle in my menu. They are only with different hue/saturations and I want them to slowly reduce their alpha 1 by 1 so that the one behind pops up and then restart the cycle.

I'm trying to set a public image and reduce it's alpha, but it's not smooth.

sentences:
Techniques to mitigate microstuttering when the FPS is above 60fps and vsync is off The problem with first person shooters is that your input is important, and coupling it with VSync ruins it.
The following frames per second data when rendering with OpenGL shows:

60-100 fps: annoying jitter
140 fps: minor jitter, but certainly noticeable
200 fps: very minor small jitter sometimes
260 fps: either generally fine or very very small
300+ fps: perfectly fine

The problem is other games I play that use similar rendering algorithms only stutter in the range of 60-100fps, whereas my range is 60-250fps (albeit it gets better when you get into the 200 range but you can still notice it if paying attention).
At first I thought my game loop may have been wrong, but after going through it in great detail it is working just fine (and vsync works perfectly smooth with it too, if it was broken this would be an issue the update rate and the vsync monitor refresh rate are not divisible by each other).
60 - 100 fps is 62.5 - 10ms
100 - 250 fps is 10 - 4ms
Not being able to go above 4ms would be pretty constraining!
Because I'm using C# (note: I have zero GC, it doesn't run), I don't know if this means I'm somehow running into higher variability with the VM than I would when I did stuff in C++. I don't know if being in the 4-10ms range means that sometimes it will spike.
Now I did profile this, and this is what I've seen:

Ignoring the green line, the blue line is the uncapped version and orange is vsync. Since the vsync line has massive variability but seems to render fine, whereas the blue one has spikes but are all generally below the vsync line (and definitely not greater than the spikes from vsync), I don't understand whether I'm actually seeing those blue spikes and it's because of some kind of intermediate frame tear or not. It doesn't look like a frame tear to me, it just looks like a frame is lost and I lurch forward a bit more than normal like I was lagging online.
So the question is... what can I do to diagnose this issue? Or is this normal?
I was thinking of rendering to a framebuffer and just drawing that every 1/60 seconds in an attempt to smooth things out and emulate vsync but this comes with it's own drawbacks. Problem is... my back is against the wall and I'm worried I'll be doing potentially stupid and wasteful stuff.
EDIT 1: Ticker code that does what I do
(int, double) timerFunc()
{
    long currentTime = GetCurrentTime();

    accumulation += currentTime - lastTimeSeen;
    lastTimeSeen = currentTime;

    // If it returns 1.27, then we have to run 1 tick, and interpolate at t = 0.27
    double tickFraction = accumulation / timePerGametick;

    int ticksToRun = floor(tickFraction);
    double fraction = tickFraction - ticksToRun;

    if (ticksToRun > 0)
        accumulation -= (ticksToRun * timePerGametick);

    return (ticksToRun, fraction);
}

EDIT 2: Game loop and basic logic (uses timerFunc data from above)
void update(int ticksToRun) {
    for i in ticksToRun {
        foreach plane in planes that should move {
            plane.Tick();
        }

        foreach entity in entities {
            entity.Tick();
        }
    }
}

// interpolation will be in [0.0, 1.0)
void render(double interpolation) {
    foreach plane in planes {
        planeDelta = (plane.current - plane.prev);
        planeInterpolated = plane.prev + (planeDelta * interpolation);
        render(planeInterpolated);
    }

    foreach entity in entities {
        entityDelta = (entity.current - entity.prev);
        entityInterpolated = entity.prev + (entityDelta * interpolation);
        render(entityInterpolated);
    }

    swapBuffers();
}

void gameLoop() {
    while (true) {
        (int ticksToRun, double fraction) = timerFunc();

        pollInput();

        if (ticksToRun > 0)
            update(ticksToRun);

        render(fraction);
    }
}

sentences:
Ball Speed is not increasing as per code I am working on small project , but now I have a problem . The problem is The Player speed (Ball speed) is not increasing as per the code .

In the beginning ball speed increases , but as the time goes the speed becomes constant .

I made Gravity as -50 in Y - Axis .

So here is the C# Script attached to the ball :-

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Ball_Script : MonoBehaviour
{

// Ball Physics Variables
private Rigidbody Ball_Rigid;
public float Ball_Speed = 10f;
private float Speed_Change_Time = 1.0f ;

// UI Text
public Text My_Ball_Speed_Text ;
public Text My_Key ;

// Use this for initialization
void Start ()
{
    Ball_Rigid = GetComponent<Rigidbody>();
    My_Ball_Speed_Text.text = Ball_Speed.ToString () + " km/h";
    My_Key.text = "No Key Pressed";
}

// Update is called once per frame
void Update ()
{
    // Restart game
    if(transform.position.y < -7.0f)
    {
        Application.LoadLevel(0);
    }

    // Ball Automatic Movement script Starts here
    Speed_Change_Time_Interval ();
    Ball_Rigid.AddForce (new Vector3 (Ball_Speed * -1 * Time.deltaTime, 0, 0));
    // Ball Automatic Movement script Ends here

    if(Input.GetKeyDown(KeyCode.LeftArrow))
    {
        Ball_Rigid.MovePosition(new Vector3(transform.position.x , transform.position.y , transform.position.z - 1.0f));
        My_Key.text = "Left Arrow Pressed";
    }

    if(Input.GetKeyDown(KeyCode.RightArrow))
    {
        Ball_Rigid.MovePosition(new Vector3(transform.position.x , transform.position.y , transform.position.z + 1.0f));
        My_Key.text = "Right Arrow Pressed";
    }
}

// This Fixed update stops the ball from bouncing
void FixedUpdate()
{

    Vector3 currentVelocity = Ball_Rigid.velocity;

    if (currentVelocity.y <= 0f)
        return;

    currentVelocity.y = 0f;

    Ball_Rigid.velocity = currentVelocity;
}

// This function increases the ball speed in every 1 second
void Speed_Change_Time_Interval ()
{
    Speed_Change_Time = Speed_Change_Time - Time.deltaTime;

    if(Speed_Change_Time <= 0)
    {
        Ball_Speed = Ball_Speed + 10;
        Speed_Change_Time = 1.0f;
        print(Ball_Speed);
        My_Ball_Speed_Text.text = Ball_Speed.ToString ()+ " km/h";
    }
}
}

Here FixedUpdate () stops the ball from bouncing and  Speed_Change_Time_Interval () function  increases the ball speed in every second . But it works some extent . Then there is no change in speed of the ball . Here is the video of the game ( Recorded with Jing , so file is in .swf format . Sorry for that :( ) Link :- http://www.mediafire.com/download/ibk4ffjm3y6i96y/Ball_Vid.swf

File size = 9.28 MB

So what is the problem of this script . If my method is wrong / not good please suggest me a good one :).

Hope you will help me to figure it out .

Thanks ,
Regards

NB :)

sentences:
Storing Users Character in MySQL Database Just asking a quick question about storing Characters in a database.

I am currently implementing a MySQL Database to store character data, using this current structure

Character Table:

playerUsername: VARCHAR(255)
characterName: VARCHAR(255)
idCharacter: INT(11)

Which is working fine to get all the characters that a certain person has.

While implementing this I was wondering how I would go about storing the character model data, like in WoW or other MMO's. Do they store all the models you create locally? or is that somehow stored in the database.

I have found a few structures online but they mainly contain character names and id not how the individual models are stored.

Any help on this would be greatly appreciated

sentences: Render TIny.x bones in Direcx 9 I would like to render the bones of the Tiny.x animated mesh.  I know there are 35 bones, and I know their names, but I'm having trouble with each bone's matrix.  Do I need to convert the matrix with d3dxvec3transformcoord function, or can I use the .m41,.m42,.m43 on the vertex buffer ?

sentences:
Correct way to "randomly" generate flowing terrain I'm creating a simple top down RTS game.  I plan on it "randomly" generating maps on the fly when I need to.  I plan on it all working in 'passes':

Fill the terrain in with all grass
Go back and add some random spurts of gravel
Round out the gravel
Draw Mountain Landscape on second layer
Round out mountains
etc. etc.

Now, take a look at this picture below:

I hand created this using my map editor but I plan on this basically being the result after hopefully pass/step 3.

How should I go about deciding when and were to place my gravel so that it is at least irregularly shaped and sporadic enough to look natural?

Thanks if you can!  Any and all help is appreciated!

As a side note:

Each pass is basically me iterating through all of my tiles (The map is divided into 40x40 tiles) similar to this:

for (int x = 0; x <= GRIDMAX - 1; x++) {
    for (int y = 0; y <= GRIDMAX - 1; y++) {
        //Terrain(x, y, 0) = SomethingHere;
    }
}

sentences:
Accessing a newly Instantiated Object I currently am creating a script that allows the player character to attack by shooting orbs at foes.

I have the current code to do that (not final code, for testing purposes):

if(Input.GetButton("Fire1"))
    {
        print("firing");
        GameObject newOrb = (GameObject) Instantiate(MagicOrb, this.transform.position, Quaternion.identity);
        BasicAttackOrb orbControl = newOrb.GetComponent<BasicAttackOrb>();
        if (MoveHandler.facingRight)
            orbControl.SetDirection(BasicAttackOrb.RIGHT);
        else if (!MoveHandler.facingRight)
            orbControl.SetDirection(BasicAttackOrb.LEFT);

    }

So I create the new orb projectile, instantiate it, and then attempt to set the direction.

In the orb script:

public class BasicAttackOrb : MonoBehaviour
{
    public const int LEFT = -1;
    public const int RIGHT = 1;

    public float orbSpeed = 15.0f;

    public int direction;

    // Use this for initialization
    void Start ()
    {
        direction = 0;

    }

    // Update is called once per frame
    void Update ()
    {
        if (direction == LEFT)
            this.transform.Translate(-1.0f * orbSpeed * Time.deltaTime, 0.0f, 0.0f);
        else if (direction == RIGHT)
            this.transform.Translate(1.0f * orbSpeed * Time.deltaTime, 0.0f, 0.0f);

    }

    public void SetDirection(int dir)
    {
        direction = dir;
    }
}

So, if the direction is RIGHT (aka 1) it flies right. If it's LEFT (aka -1) it flies left.

However, the orb direction stays at 0, and is never set. This indicates to me that the initial code above in the Input.GetButton("Fire1") block is incorrect.

Am I accessing the GameObject incorrectly? I feel like it's just a slight coding error with objects but for the life of me I can't find it.

sentences:
Followed the XNA GameStateManagement sln, but my doesn't work. What am I doing wrong? If someone has the time I wanted to know if you would be willing to check out my solution file here: http://elvis.rowan.edu/~majeko02/AwesomeShip.zip

I followed the XNA GameStateManagement on AppHub, but nothing comes up from me. and I haven't the clue why.

I believe I done everything correctly and verified it as well.

I wanted to know if someone has the time could they check it out?

Download link here: http://elvis.rowan.edu/~majeko02/AwesomeShip.zip

I am racking my brain trying to figure out why it doesn't work.

Any help, is greatly appreciated.

sentences:
Export Blender 3D animation to be played by Android OpenGLES Below code snippet shows the way to export coordinate of bones:

def export_bone_matrix(armature, bone, label, file_handler):
  SystemMatrix = Matrix.Scale(-1, 4, Vector((0, 0, 1))) * Matrix.Rotation(radians(90), 4, 'X')

if (bone.parent):
    Export_babylon.write_matrix4(file_handler, label, (SystemMatrix * armature.matrix_world * bone.parent.matrix).inverted() * (SystemMatrix * armature.matrix_world * bone.matrix))
else:
    Export_babylon.write_matrix4(file_handler, label, SystemMatrix * armature.matrix_world * bone.matrix)

I have create a 3D character in Blender, and add keyframes in it by transforming
in some frames.  From the graph editor, you can easily tell the all displacement
of transformation - translate, rotate, scale are all measured with respect to the
original value in frame 0.

Is it possible to write OpenGL in Android to animate the same 3D animation in Blender?
I'd like to transform the 3D character - translate, rotate in each frame according to
the displacement value exported from Blender.

Below lists the python function to export translate, rotate displacement in each frame:

def get_bone_action_location(action, bonename, frame=1):
loc = Vector()
if action == None:
    return(loc)
data_path = 'pose.bones["%s"].location'%(bonename)
for fc in action.fcurves:
    if fc.data_path == data_path:
        loc[fc.array_index] = fc.evaluate(frame)
return(loc)

def get_bone_action_rotation(action, bonename, frame=1):
rot = Quaternion( (1, 0, 0, 0) )  #the default quat is not 0
if action == None:
    return(rot)
data_path = 'pose.bones["%s"].rotation_quaternion'%(bonename)
for fc in action.fcurves:
    if fc.data_path == data_path: # and frame > 0 and frame-1 <= len(fc.keyframe_points):
        rot[fc.array_index] = fc.evaluate(frame)
return(rot)

Or I need to transform the meshes with vertex group controlled by root bone by the
transform matrix - SystemMatrix * armature.matrix_world * bone.matrix?  And for those
controlled by child bones by the matrix in terms of (SystemMatrix * armature.matrix_world * bone.parent.matrix).inverted() * (SystemMatrix * armature.matrix_world * bone.matrix)?

sentences:
Unity gizmos with custom renderer Im working on a small project to learn the basics of post-processing, shaders and other effects in Unity.
My project is in 2D, so I followed this Brackey's tutorial and this tutorial. The bloom effect did not work for me with the expiremental 2D renderer, so I used a forward renderer instead.
Problem is, now all of my gizmos (including the camera's gizmos) are gone!
Anyone knows what could be the problem? Do I need to set something in the renderer so it will show?

sentences:
Organizing an entity system with external component managers? I'm designing a game engine for a top-down multiplayer 2D shooter game, which I want to be reasonably reuseable for other top-down shooter games. At the moment I'm thinking about how something like an entity system in it should be designed. First I thought about this:

I have a class called EntityManager. It should implement a method called Update and another one called Draw. The reason for me separating Logic and Rendering is because then I can omit the Draw method if running a standalone server.

EntityManager owns a list of objects of type BaseEntity. Each entity owns a list of components such as EntityModel (the drawable representation of an entity), EntityNetworkInterface, and EntityPhysicalBody.

EntityManager also owns a list of component managers like EntityRenderManager, EntityNetworkManager and EntityPhysicsManager. Each component manager keeps references to the entity components. There are various reasons for moving this code out of the entity's own class and do it collectively instead. For example, I'm using an external physics library, Box2D, for the game. In Box2D, you first add the bodies and shapes to a world (owned by the EntityPhysicsManager in this case) and add collision callbacks (which would be dispatched to the entity object itself in my system). Then you run a function which simulates everything in the system. I find it hard to find a better solution to do this than doing it in an external component manager like this.

Entity creation is done like this:
EntityManager implements the method RegisterEntity(entityClass, factory) which registers how to create an entity of that class.
It also implements the method CreateEntity(entityClass) which would return an object of type BaseEntity.

Now comes my problem:
How would the reference to a component be registered to the component managers? I have no idea how I would reference the component managers from a factory/closure.

sentences:
Synch clocks between client and server in Java We're developing a simple boggle game in Java for a college project (purely academic purposes, so we're trying to keep it simple).
Our application is composed by a client portion and a server portion. The idea is that when a game starts all the participants have a fixed amount of time (3 minutes) to find words from the grid.
Of course we have to ensure that all timers start at the same time and players with higher ping don't get penalized. By searching on Google and other forums most people suggest the correct approach is to implement the (S)NTP algorithm, even though for a similar question here someone suggested that NTP is overkill. Is it or is it not?
Our idea is basically this: when the game starts, the server sends to all the participants a future datetime to start the timer task and then simply waits for the clients to communicate the results. If indeed NTP is the best approach I'd like to know if there are alternatives to the already available Apache Commons Net library since we're using Java 14 with modules and JavaFX, so we need to use jlink and it doesn't allow for non-modular dependencies. Thanks in advance

sentences:
TiledMap taking a lot of time to load in libgdx I am developing a game using libGdx in which a level has 2400 * 450 tiles Map and each tile is of 4 pixels. I am also using box2d in my game.

My problem is that when I run the game on my phone it takes a lot of time to load the screen (more than a minute).
How can I reduce this loading time?

I created tilemap using Tiled and I am using Android Studio.

Below is my code (SCALE is 2.0f and PPM is 4)

@Override
public void show() {
    w = Gdx.graphics.getWidth();
    h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, w / SCALE, h / SCALE);
    camera.update();
    viewport = new FitViewport(w / SCALE, h / SCALE  ,camera);
    viewport.apply();
  .
  .
  .

    map = new TmxMapLoader().load("maps/lvl3.tmx");
    tmr = new OrthogonalTiledMapRenderer(map, 1/SCALE);

}

@Override
public void render(float delta) {
    update(Gdx.graphics.getDeltaTime());

    //Render
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    tmr.render();

    .
    .
    .
    b2dr.render(world, camera.combined.scl(PPM));
}

public void update(float delta) {

    world.step(1 / 60f, 6, 2);
    cameraUpdate(delta);
    tmr.setView(camera);
    batch.setProjectionMatrix(camera.combined);
}

@Override
public void resize(int width, int height) {
    camera.setToOrtho(false, width / SCALE, height / SCALE);

    viewport.update( width , height );
}

Please help and thanks in advance

sentences:
SharpDX Constant buffer not passing values I'm trying to pass values to a Pixel Shader. I've added the following to the HLSL files.

cbuffer QuadShaderValues : register(b0)
{
    float3 PixelDropThresholds;
    float4 OverlayColor;
    uint PixelDropEnabled;
}

I've added the follow structure to the C# code;

[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct QuadShaderValues
{
    public SharpDX.Vector3 PixelDropThresholds;
    public SharpDX.Color4 OverlayColor;
    public uint PixelDropEnabled;
}

I've added the following code to the Initialization of the device :

m_ShaderValueBuffer =
            AddDisposable(new SharpDX.Direct3D11.Buffer(direct3DDevice, SharpDX.Utilities.SizeOf<QuadShaderValues>(),
                SharpDX.Direct3D11.ResourceUsage.Default,
                SharpDX.Direct3D11.BindFlags.ConstantBuffer,
                SharpDX.Direct3D11.CpuAccessFlags.None,
                SharpDX.Direct3D11.ResourceOptionFlags.None, 0));

        direct3Dcontext.VertexShader.SetConstantBuffer(0, m_ShaderValueBuffer);

I've added the following code to the Render Method :

deviceContext.UpdateSubresource(ref ShaderValues, m_ShaderValueBuffer);

The values do not seem to be making it into the shader.

sentences:
32 bit or 16 bit textures I'm trying to build some 2d character with Photoshop and Spine. By now, I have created some of my characters using 16 bit color depth images in Photoshop. Now, I wonder whether I have to use 32 bit or just create everything with 16 bit textures...
How much does it affect my game? Considering a 2D Unity or Flash game.

sentences:
Player motion and combo systems Where do you usually implement player motion when going through the state machine of a combo system?

An example, when player presses X+Y it must do an uppercut like movement (Like street fighter) where the player jumps and hits. Another example could be the Devil may cry series where you can press down+sword button and the enemy is thrown up and the player authomatically jumps to let player hit target in the air.

When creating a combo, you have 2 things to take care of. One is the media that will be played when the combo is done (sound, animation, etc...) and the other the movement of the player when doing this combo.

How do you handle the movement of the player? I have 2 posible options:

1) Include the player motion (translation, rotatio, etc...) in the animation

2) Delegate the player motion to the combo nodes while they are being linked.

First option could be the easiest but seems a bit restrictive. For example if you want to let the player do some other action while the current combo node media is playing (ej. jumping) could be tricky (Jump + hit).

Second option would need to have some many diffeernt nodes (We could use some kind of delegates here to minimize the node count(IOC)) to cover all the motion needs of every part of the combo.

What do you think. Am I thinking too much?

Cheers.

sentences:
LibGdx Triangle Collision I'm back with another question.

I'm trying to get a collision between an actor and a sprite.

With the actor, which only moves upwards and downwards, I've got no problem since it's shape is a rectangle.

But with the other sprite I've got this:

This sprite moves from the very right part of the screen to the left and resets its position when it reaches the left edge of the screen So the actor moves upwards or downwards to avoid it.

The problem is, I can't use a rectangle as a collision detector for this sprite and I haven't found a proper way to do its collision.

The way I call this triangle and the actor's sprite is this:

texture = new Texture(Gdx.files.internal("texturepack_nuevo.png"));

then, out of that single Texture I get a texture region for both the actor and the triangle sprite.

sentences:
How should bullet reflections be implemented? Im working on a tank game where bullets are relected off of walls.  The formula for a relfection is r=d−2d⋅n∥n∥2n where d is the incoming vector and n is the normal of a wall.  My bullets stick to the walls and then "bounce" off at the corners; an undesirable effect.  Im honestly questioning my formula implementation at this point.
func collision():
    for i in get_slide_count():
        var collision = get_slide_collision(i)
        if collision.collider.is_in_group(globals.wall_group):
            var normal = collision.normal
            velocity = velocity - ((2 * velocity.dot(normal)) / normal.length_squared()) * normal
            rotation = velocity.angle() + PI

if i use the is_on_wall function and simply negate the velocity this does produce a bouncing effect but not a correct one.  I still need the normal.
I orignally used rigid bodies as seen in the image.  But i have switched to kinematic bodies.

sentences:
How make Unity wait before consuming next item in a list? I have a class like so:

public class SomeObject : MonoBehaviour
{
    protected List<EdibleStuff> SomeItemsToConsume;

    private void StartConsuming()
    {
        this.SomeItemsToConsume
            .ForEach(item =>
            {
                StartCoroutine(Consume(item));
            });
    }

    private IEnumerator Consume(EdibleStuff edibleStuff)
    {
        yield return new WaitForSecondsRealtime(2);

        // Check whether edibleStuff is still fresh after 2 seconds
        // Figure out how to consume it -- e.g. by cooking, eating raw, whatever
    }
}

Before SomeObject consumes the next item in the SomeItemsToConsume list, I would like it to wait another short period of time, say, another 2 seconds.

I have tried these approches:

I added another yield return new WaitForSecondsRealtime(2); statement at the end of the Consume(EdibleStuff edibleStuff) method, but that did not work.
I added another co-routine, which simply contains the statement yield return new WaitForSecondsRealtime(2); in its definition, at the end of the ForEach loop, but that did not work either.

How can I achieve the effect I want?

sentences:
What's wrong with using a static class to load and expose all of my assets? What are the pitfalls associated with loading and storing all references to all of your content/assets within a single static class?

I've been trying to ask myself why I would want to instantiate an assets bank and can not think of a good reason to do so.

I have made a static class which enumerates through my game assets and adds each one to a dictionary which I can access (safely exposed, of course) anywhere like so:

var tex = Assets.Image("folder\\easyaspie");
spriteBatch.DrawString(Assets.Font("font2"), new Vector2(100, 100), Color.White);

... you get the picture.

I appreciate that this gets much more complicated when you have so many assets that having them all loaded at once is not a good idea. However, there is nothing to stop you from including selective loading of assets in your static class, as well as having static methods to change the contents of the 'reference banks'.

What do you think?

Edit:

My examples are pretty shallow, I recognise it's not a good idea to attempt to grab the reference of an asset mid-draw and is much better stored locally.

sentences:
How to Handle frame rates and synchronizing screen repaints I would first off say sorry if the title is worded incorrectly.

Okay now let me give the scenario

I'm creating a 2 player fighting game, An average battle will include a Map (moving/still) and 2 characters (which are rendered by redrawing a varying amount of sprites one after the other).

Now at the moment I have a single game loop limiting me to a set number of frames per second (using Java):

Timer timer = new Timer(0, new AbstractAction() {

    @Override
    public void actionPerformed(ActionEvent e) {
        long beginTime; //The time when the cycle begun
        long timeDiff; //The time it took for the cycle to execute
        int sleepTime; //ms to sleep (< 0 if we're behind)
        int fps = 1000 / 40;

        beginTime = System.nanoTime() / 1000000;

        //execute loop to update check collisions and draw
        gameLoop();

        //Calculate how long did the cycle take
        timeDiff = System.nanoTime() / 1000000 - beginTime;

        //Calculate sleep time
        sleepTime = fps - (int) (timeDiff);

        if (sleepTime > 0) {//If sleepTime > 0 we're OK
                ((Timer)e.getSource()).setDelay(sleepTime);
        }
    }
});
timer.start();

in gameLoop() characters are drawn to the screen ( a character holds an array of images which consists of their current sprites) every gameLoop() call will change the characters current sprite to the next and loop if the end is reached.

But as you can imagine if a  sprite is only 3 images in length than calling gameLoop() 40 times will cause the characters movement to be drawn 40/3=13 times. This causes a few minor anomilies in the sprited for some charcters

So my question is how would I go about delivering a set amount of frames per second in when I have 2 characters on screen with varying amount of sprites?

sentences:
cocos2d-x "immediate mode"? I have some c++ game code that draws the game state on each game-loop cycle in "immediate mode". By that I mean that the game code does not add the sprites to be drawn to any sort of "scene graph" or other data structure. It just starts from a blank slate on each game loop cycle, and piles on the sprites from back to front. (I know you might wonder what API this c++ code is actually using. Well, it's written in Marmalade, which I'm moving away from. Marmalade provides an abstraction layer and the essence of this question is about replacing that abstraction layer.)

I am having trouble understanding what "immediate mode" really means in opengl es, and how it relates to the "fixed function" vs. "programmable" pipeline. Some things I read say, don't use the old immediate mode functions, use the modern shader-based programmable API instead." But at the same time, I believe glDrawArrays() is fine to use in opengl es 2.0, right? So that's an "immediate mode" function.

(I believe what's going on here is that "immediate mode" means different things at different levels. My understanding is that a library like cocosd2-x is "retained mode" in that you add sprites to a scene graph that's managed by the engine. But at the opengl level itself, I think "immediate mode" means something a bit different, namely whether you keep the vital drawing structures in CPU space until you draw them with a begin() end() sandwich, versus uploading them ahead of time to the GPU. So it that sense the GPU "retains" your data across calls. But still, you can draw a frame in "immediate" mode in the sense of piling on sprites one at a time using glDrawArrays() as many times as necessary.)

In the "hello world" example of cocos2d-x, we see

// add the sprite as a child to this layer
this->addChild(sprite, 0);

That is exactly what I don't want to have to do, because as I say, my code base is set up not thinking of the sprites as objects, but just as drawing a bunch of rectangles from texture sheets (atlases) stacked on top of each other. I don't want to think of adding sprites to some scene graph and "letting the engine take care of it." That may be a fine way of thinking in general, but it would involve a huge rewrite of my existing code.

On the other hand, I think I like the idea of cocos2d-x because it gives me a convenient way to develop a code base that I can develop on Windows and run on iPhone, Android, and elsewhere.

So what I'm trying to understand is: Can I use cocos2d-x in some "immediate mode" fashion?

Basically, in opengles 2.0, I am allowed to call glDrawArrays(), correct? And if I batch up my sprites in a reasonable way, I can limit the number of calls to glDrawArrays() in each frame. So I want to do that, and I'm fine writing that gl code myself. But I think even though perhaps this defeats some of the point of using cocos2d-x in the first place, there are still huge portability and not-reinventing-the-wheel advantages of using cocos2s-x vs writing things from scratch myself?

So can I use cocos2s-x in that "immediate mode" way, and still retain the write-once/run-everywhere benefits?

sentences:
Unity, check if all GameObject tagged are destroyed Hello im a total noob so please dont blame me.
So, I have this code but I cant find a fitting answer on how to check if everything tagged "Target1" is destroyed. Most of the answers are either overcomplicated or ,and most certainly, im too stupid

public Transform teleportTarget;
public GameObject thePlayer;
public Transform[] spawnLocations;
public GameObject[] whatToSpawnPrefab;
public GameObject[] whatToSpawnClone;

void spawnTargets()
{
    whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnLocations[0].transform.position, Quaternion.Euler(0, 180, 0)) as GameObject;
    whatToSpawnClone[1] = Instantiate(whatToSpawnPrefab[1], spawnLocations[1].transform.position, Quaternion.Euler(0, 180, 0)) as GameObject;
    whatToSpawnClone[2] = Instantiate(whatToSpawnPrefab[2], spawnLocations[2].transform.position, Quaternion.Euler(0, 180, 0)) as GameObject;
    whatToSpawnClone[3] = Instantiate(whatToSpawnPrefab[3], spawnLocations[3].transform.position, Quaternion.Euler(0, 180, 0)) as GameObject;
}

private void TeleportPlayer()
{
    thePlayer.transform.position = teleportTarget.transform.position;
}

Im just looking for a way to check if all GameObjects Tagged "Target1" (in the whole game)
are destroyed and then to spawnTargets and TeleportPlayer.
Previously I had the bug, that when they respawned it wasnt checking anymore. It has to check all the time.Because else I get stuck, because teleport teleports me all the time. I hope you understand what I mean

I know this is a easy question but im a noob and im sorry for wasting your time, still I hope you can help me.

sentences: When does OpenGL Perform Perspective Divide When does OpenGL divide by W? Is this done automatically within the vertex shader? It is my understanding that the vertex shader outputs the final vertex position, so I presume no transformations can be made after this point...

sentences:
Unity Re-import doesn't re-import fbx So I have an fbx file with animations and materials on it. Simple stuff.

But when I change something on the fbx, like adjusting some animation, then re-export as fbx, Unity does not re-import the fbx when I do RMB -> Re-Import. It shows the loading bar but doesn't actually effect the current mesh by re-importing.

Is this normal?

Is there a way to re-import the fbx while keeping the modification I made on the mesh. Like, I changed the Scale Factor and some other things, so I want to keep these while re-importing.

sentences:
Are there any resources about performance tweaks? There are many optimization tricks that you can apply to your C++ code that can help speed up your program, and there are more game-related tweaks poping out every day. For example, I've just heard where you are trying to draw some meshes with same texture it's faster to draw them all in one call (or something like that which mean to pass texture once and for all of them).

Are there any books or weblogs or something which demonstrate these things? I'm working with C++ if there are any general advises about optimization, I'll be glad to hear about them.

sentences:
Moving a top-down camera while keeping its height constant I'm currently writing the script for the player to explore the plane below. The camera view is set to be slightly rotated as to look down. And I have set the code to make the camera move.

This is the code, and everything is set in the update method.

        if (Input.GetKey("w"))
        {
            transform.Translate(Vector3.forward * panSpeed * Time.deltaTime);   // , Space.World if want to avoid camera going down
        }
        if (Input.GetKey("s"))
        {
            transform.Translate(Vector3.back * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(Vector3.right * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(Vector3.left * panSpeed * Time.deltaTime);
        }

The problem is that everytime that the camera goes forward, it goes straight down. And I don't want it to do that. I want to keep the "height" from the plane below to be the same as in the picture below. I want the camera to move along the red axis.

I know of the existence of Space.World in order to achieve this, but the problem is that if I do that, whenever I rotate, now the controllers are all screwed up, because if I rotate to the right for example. Now Forward (W) moves the camera to the left, Right (D), moves the camera forward, etc etc.

So basically what I need is 1: to make the camera keep the distance to the plane below while moving (not going down). and 2. To make it possible that even with rotations, the controllers are kept, and not having this weird behavior, when forward is not longer forward.

Any ideas how to achieve this?

sentences:
Flash AS3 sidescrolling tiles optimization I'm trying to make a sidescrolling game in Flash that will run on a low performance laptop.

While studying the subject from Tonypa I saw that he builds a Bitmap by making copys of the BitmapData of each tile from the Tile Sheet and placing it on the bigger Bitmat with the size of the screen.

But when I came to think on how to scroll my map I ran into some optimization doubts.
I came up with two choices:

Create a MovieClip, place a Bitmap instance for each tile that is shown on the screen + 1 row in it, then move them all. Then when the tile ran off the screen I would move it to end of the MovieClip and replace their BitmapData for the next row in my map.
Use a Bitmap with copys of each tile in it (as shown in Tonypa's tutorial) but 1 extra row, move the whole Bitmap, and when it comes the time to replace rows, redraw the whole Bitmap and move it back to the origin position.

The first idea is how a co-worker of mine suggested, the second one is my own, but none of us has enough technical knowledge to be sure on a technique that would be optimal in performance, can anyone help?

sentences:
OnCollisionEnter not called when two colliders collide In my 2D game, there is a ball with a circle collider ,and a platform with a box collider.

The ball has a material for bounciness and a rigidbody2D. The platform only has the box collider.

I find it to be as simple as could be, but it's not working for some reason, so apparently it's not that simple. Here's the C# code snippet found in the ball class which is attached to the ball game object:

void OnCollisionEnter(Collision other)
{
    Debug.Log("Hit");
    animator.Play("Bounce");
}

Why isn't the function being called on collision? Any idea would be appreciated.

sentences:
How to setup libgdx with eclipse? I want to make a game using libGDX game library which should run on android devices. I don't want to use android studio. I want to use eclipse ide.

When I run libgdx-setup.jar, it asks for android sdk's location, but I am unable to find android sdk's download link in the official website.

sentences:
How to add zombie arms to enemies in HTML canvas I'm making a game with HTML canvas (not WEBGL). I have zombies that go to the center of the screen, but for now they are just circles. I want to give them two arms, like the arms players have in surviv.io. I have looked at this question: Moving an object in a circular path. I don't know what trigonometry to use to calculate the angle. Here is my code:

var canvas = document.querySelector('#canvas');
var context = canvas.getContext('2d');

function Enemy(x, y) {
  this.x = x;
  this.y = y;
  this.r = 5;
  this.color = `hsl(${Math.floor(Math.random() * 360)},50%,50%)`;
  this.vx = 0;
  this.vy = 0;
  this.draw = () => {
    this.x += this.vx;
    this.y += this.vy;
    context.beginPath();
    context.fillStyle = this.color;
    context.arc(this.x, this.y, this.r, 0, Math.PI * 2);
    context.fill();
  }
}
var enemy = new Enemy(0, 0);

function loop() {
  requestAnimationFrame(loop);
  context.fillStyle = 'rgba(0,0,0,0.2)';
  context.fillRect(0, 0, canvas.width, canvas.height);
  var angle = Math.atan2(canvas.height / 2 - enemy.y, canvas.width / 2 - enemy.x);
  enemy.vx = Math.cos(angle);
  enemy.vy = Math.sin(angle);
  enemy.draw();
}
requestAnimationFrame(loop)
<canvas id='canvas'>

I want the arms facing the center, and I want them to move when the enemy changes direction.

sentences:
How to run DOTween tweens in succession? I have a function in my Unity game which marks a given cell GameObject as a valid cell for next move by changing the texture on it. I wanted to spice things up a bit by adding some tweens to the changing cells so I decided to use a simple tween in DOTween - I wanted to rotate the cell 360 degrees in-place while changing the texture when it's facing away from the player (so that the texture doesn't suddenly pop to a different one when it's visible). So I did something like that:

public void markAsLegal()
{
    centerPivot.DOLocalRotate(new Vector3(180, 0, 0), .5f, RotateMode.WorldAxisAdd);
    this.GetComponent<Renderer>().material.mainTexture = Resources.Load("textures/legal_hex") as Texture2D;
    centerPivot.DOLocalRotate(new Vector3(180, 0, 0), .5f, RotateMode.WorldAxisAdd);
    isLegal = true;
}

This, however, doesn't seem to wait for one rotate before starting the next one and so the cells end up in some weird middle ground, slanted. How can I make DOTween/Unity know that I want these commands to be executed in progression, ie. 180 degree rotation ends -> change texture -> finish the remaining 180 degrees?

sentences: Phone for Android game development I've been developing casual iPhone/iPod Touch games touch for about two years.  I'd like to port some games to the Android platform.  Since I'm stuck w/ a two year iPhone contract I don't want to get an Android phone that requires a service plan.  What is the best phone to get for development in this situation?

sentences:
Sprite with transparency: Create box collider (ignoring transparent area) I have a sprite which has a transparent area in it. The non-transparent area is a free-form graphic (red). I would like to create a box collider around it (yellow), but ignoring the transparent area.

Some notes to the image above:

Left: This is what happens, if I apply a PolygonCollider2D. The yellow line represents the area covered by the PolygonCollider2D. This is not what I want.
Middle: This is what happens, if I apply a BoxCollider2D. The yellow line represents the area covered by the BoxCollider2D. This is also not what I want, as it includes the transparent area of the sprite.
Right: This is what I want: Have a BoxCollider2D outside my free-form graphic.

Here's how I currently load my sprite data into the game during runtime:

My sprites are located in the /Assets/Resources/SceneData/... folder structure of my project. The graphics are stored as .png files.
When loading a level, I load the required graphics as sprites like this:

    var sprite = Resources.Load<Sprite>("SceneData/AfternoonAtTheBeach/DragAndDrop/Graphics/Level1/ElephantWithIceCream");

"ElephantWithIceCream" is the .png file (Resource.Load wants me to refer to this file without file extension)

After that, I create a new game object and attach a SpriteRenderer component to it. The sprite is assigned to the
SpriteRenderer by setting the sprite attribute of the SpriteRenderer component.

My first thought on how to solve my problem was to do something like this:

Create a PolygonCollider2D and try to convert it into a BoxCollider2D. But I was not able to find code examples on how to do this.

After that, I thought of trying it to do like this:

Create a PolygonCollider2D and try to extract some useful information out of it (such as bounds, center, extents, etc...).
Delete the PolygonCollider2D and create a BoxCollider2D. Use the previously extracted info to create the BoxCollider2D.

But I fail doing so. I am also a bit confused as sometimes they refer to world space or local space. Does anyone have a working recipe for doing something like this? I do not really understand how to work with center, bounds and extents. If there is any better way of doing this, I am highly interested. Thanks a lot for your help!

sentences:
Why does this simple if-statement that checks my main characters state never get called (Java/LibGDX)? Been working on this for a while - basically I want my player to perform a front flip when he jumps (screen tap -> player jumps). I wrote the animation class Animator (extends Player implements ApplicationListener and my plan is to initialise it in Player (main character class) whenever his state becomes JUMPING. I did a few tests using System.print and found that when the screen is tapped (i.e. whenever touchDown() is called) the Player's state IS modified (using stateModifier("jumping").

However, the code inside if(state == playerState.JUMPING) in update() for some reason is never called. I know this is the case because the System.print I wrote never gets outputted. I'll throw my code in here since you will probably need to see the big picture:

public class Player extends GameObject implements InputProcessor {
private Animator jumpAnimation; // the class where the animation takes place
private playerState state; // enum of player states
private float gravity;
private boolean allowJump;
private float accelerationJump;
private Texture img;
private Sprite sprite;

public Player(float xPos, float yPos) {
    super(xPos, yPos);
    img = new Texture(Gdx.files.internal("JUMP1.png"));
    sprite = new Sprite(img);
    setxPos(xPos);
    setyPos(yPos);
    setxSpeed(4.6f);
    setySpeed(0);
    sprite.setX(getxPos());
    sprite.setY(getyPos());
    setType("player");
    gravity = 0.34f;
    accelerationX = 0.02f;
    accelerationJump = 14f;
    allowJump = true;
    Gdx.input.setInputProcessor(this);
    state = playerState.NORMAL;
}

// change the player state
public void stateModifier(String modify) {
    if (modify.equalsIgnoreCase("jetpack")) {
        state = playerState.JETPACK_MODE;
    } else if(modify.equalsIgnoreCase("normal")) {
        state = playerState.NORMAL;
    } else if(modify.equalsIgnoreCase("jumping")) {
        state = playerState.JUMPING;
        System.out.println(state);
}
}

public void update() {

    // Player's speed in the y plane is affected by gravity
    setySpeed(getySpeed() - gravity);
    // Player constantly moving
    moveBy(getxSpeed(), getySpeed());
    // Don't allow Player to fall below the ground due to gravity
    if (belowGround()) {
        moveTo(getxPos(), groundY);
    }
    // If Player is on the ground then he can jump, so set allowJump to true
    if (onGround()) {
        allowJump = true;
        setySpeed(0);
    }
    // if the player is in a jumping state, run the jump animation
    if (state == playerState.JUMPING) {
        // this print statement should get called when a player jumps but never does
        System.out.println("should animate right now");
        jumpAnimation = new Animator(getxPos(), getyPos());
    }
}

public void jump() {
    setySpeed(getySpeed() + accelerationJump);
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    // if the player is in a normal state (i.e. not jumping) and he is allowed to jump
    if (state == playerState.NORMAL && allowJump) {
        // set player state to playerState.JUMPING
        stateModifier("jumping");
        jump();
                    // set player state to playerState.NORMAL after the jump
        stateModifier("normal");
        allowJump = false;
    }
    return true;
}

}

Any help is highly appreciated, thank you very much.

tl;dr when screen is tapped, touchDown() is called, which changes the Player's state to JUMPING. however when i write an if statement in update() to check for this, it never gets executed. why is this the case?

sentences:
How to implement rectangle selection? I don't know if there is another term for it, but I mean this: You hold down a mouse button. A rectangle forms when you move the mouse around. The units inside the box get selected when you let go of the mouse button. I need this for a RTS style game I'm working on, but I don't know how to approach it.

I currently have functionality for selecting a unit, basically if you click within a certain area the unit is added to the list of selected units,

def mouseUp(self, button, pos):
    adjusted = self.coord_convert(pos)
    if button==1:
        for a in self.agent_list:
            if a.pos.get_distance(self.coord_convert_adjusted(pos)) < 16:
                self.selected.append(a)
            elif a in self.selected and a.pos.get_distance(self.coord_convert_adjusted(pos)) > 16:
                self.selected.remove(a)

The next step would be to allow for selecting multiple units at once by checking if they are inside a box, can you provide some guidance on how I should proceed?

Edit: To clarify, I'm asking how to create a box which starts at the position of MOUSEDOWN, and changes in size relative to mouse movement while holding the pressed button down, until let go.

sentences:
(DX11.1) CreateSwapChainForHwnd fails with E_NOINTERFACE when using Graphics Diagnostics The CreateSwapChainForHwnd fails with E_NOINTERFACE "No such interface supported" when I use the Graphics Diagnostics on Visual Studio 2013 Update 4 on Windows 7 sp1 under DirectX 11.1. The program runs fine in debug mode. Has anyone come across this problem before or know of a solution?

Here is the initialisation code:

#include <d3d11_1.h>

// Set feature levels supported by our application
D3D_FEATURE_LEVEL eFeatureLevel1[] =
{
    D3D_FEATURE_LEVEL_11_1,
    D3D_FEATURE_LEVEL_11_0,
    D3D_FEATURE_LEVEL_10_1,
    D3D_FEATURE_LEVEL_10_0,
    D3D_FEATURE_LEVEL_9_3,
    D3D_FEATURE_LEVEL_9_2,
    D3D_FEATURE_LEVEL_9_1
};

D3D_FEATURE_LEVEL           eReturnedFeatureLevel;

D3D11CreateDevice(nullptr,                  // default adapter
    D3D_DRIVER_TYPE_HARDWARE,
    0,                          // no software device
    uiCreateDeviceFlags,
    eFeatureLevel1,
    ARRAYSIZE(eFeatureLevel1),
    D3D11_SDK_VERSION,
    &m_spDeviceOld,
    &eReturnedFeatureLevel,
    &m_spContextOld);

if (eReturnedFeatureLevel < D3D_FEATURE_LEVEL_11_0)
{
    //MessageBox fails silently here!!!
    return false;
}

// Fetch the underlying interfaces and store them:
m_spDeviceOld.As(&m_spD3DDevice);
m_spContextOld.As(&m_spD3DImmediateContext);

SETPRIVATEDATA(m_spDeviceOld, "CD3DObject::m_spDeviceOld");
SETPRIVATEDATA(m_spContextOld, "CD3DObject::m_spDeviceOldspContextOld");

// This is the earliest the Debug Layer can be created
MyDebugLayer.CreateD3DDebugLayer();

SETPRIVATEDATA(m_spD3DDevice, "CD3DObject::m_spD3DDevice");
SETPRIVATEDATA(m_spD3DImmediateContext, "CD3DObject::m_spD3DImmediateContext");

m_spD3DDevice->CheckMultisampleQualityLevels(DXGI_FORMAT_R8G8B8A8_UNORM,
                                            4,
                                            &m_ui4xMsaaQuality);

assert(m_ui4xMsaaQuality > 0);

DXGI_SWAP_CHAIN_DESC1 stSwpChainDesc = { 0 };
stSwpChainDesc.Width = 0;
stSwpChainDesc.Height = 0;
stSwpChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
stSwpChainDesc.Stereo = false;
stSwpChainDesc.SampleDesc.Count = 1;
stSwpChainDesc.SampleDesc.Quality = 0;
stSwpChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
stSwpChainDesc.BufferCount = 1;                                 // Used to be 1
stSwpChainDesc.Scaling = DXGI_SCALING_STRETCH;
stSwpChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
stSwpChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

// Use 4X MSAA?
if (m_bEnable4xMsaa)
{
    stSwpChainDesc.SampleDesc.Count = 4;
    stSwpChainDesc.SampleDesc.Quality = m_ui4xMsaaQuality - 1;
}
// No MSAA
else
{
    stSwpChainDesc.SampleDesc.Count = 1;
    stSwpChainDesc.SampleDesc.Quality = 0;
}

Microsoft::WRL::ComPtr<IDXGIDevice1> spDXGIDevice;
m_spD3DDevice.As(&spDXGIDevice);

IDXGIAdapter1* pDxgiAdapter = 0;
spDXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&pDxgiAdapter);

IDXGIFactory2* pDxgiFactory = 0;
pDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&pDxgiFactory);

// Create DXGI swap chain targeting a window handle (the only Windows 7-compatible option)
HRESULT MyHr = pDxgiFactory->CreateSwapChainForHwnd((ID3D11Device*)m_spD3DDevice.Get(), m_hMainWnd, &stSwpChainDesc, nullptr, nullptr, &m_spSwapChain);

//MessageBox fails silently here!!!
//MessageBox(m_hMainWnd, _com_error(MyHr).ErrorMessage(), "Error Caputed", MB_OK);

ReleaseCOM(pDxgiAdapter);
ReleaseCOM(pDxgiFactory);
spDXGIDevice->Release();

Why does the code fail when I use the graphics diagnostics tool and not normally? Basically the main window appears then the application shuts down. Also any calls to MessageBox([NULL/or not]) fails silently too.

Supplemental: m_spDeviceOld and m_spContextOld are ID3D11Device and ID3D11DeviceContext used for getting the 11.1 interface they then are detached at exit and the 11.1 interfaces are released instead.

Thanks in advance for your indelible advice.

sentences:
Manipulating vertices after multiplication with MVP matrix (OpenGL) I'm making a collage of lots 16x16 renders on a 512x512 texture, of the same scene, from various viewing positions and angles, preferably lots of times per second. I've profiled my program (which contained a glDrawElements call per mesh), and the multiple glDrawElements calls seemed to slow it down a lot. In order to optimize, I've resorted to instanced rendering. However, the main problem I'm having is changing the viewport between, say, every 3 instance renderings, or so. I was thinking of adding a fourth matrix, which would scale the perspectively-projected vertices of a would-be 16x16 picture, translate them so that the little images don't overlap, and based on the little picture's position and size (16x16 pixels) on screen, use the `discard' command in the pixel shader.

How do I scale the projected vertices from the current large viewport into a 16x16 smaller version of it and translate them inside the former at a certain position?

Or, more clearly, how do I change the viewport during a glDrawElementsInstanced call, every N instances?

EDIT
Here's a visualization of what I'm trying to achieve:

Keep in mind, I can't change the viewport as I want to do this during a call to glDrawEleemntsInstanced, every 3 instances, or so.

How do I compute a matrix or what do I have to do to get the post-projection vertices scaled and translated so that I'll have the full image scaled in a 16x16 portion of the screen?

sentences:
Single pass box blur is not giving same result as double pass box blur I've been using 2-pass box blur written in GLSL in Blender without problem.

Blur horizontally:

uniform sampler2D bgl_RenderedTexture;
void main()  {
    float blur = 0.3;

    float resolution = blur * 0.1;
    int n = 10;
    int i = -n;
    int totalWeight = 0;

    vec2 st = gl_TexCoord[0].st;

    vec4 outColor = vec4(0.0);
    for(; i < n; ++i) {
        vec2 uv = st + vec2(float(i) / 2.0 / float(n) * resolution, 0);
        outColor += texture2D(bgl_RenderedTexture, uv);
        totalWeight += 1;
    }
    gl_FragColor = outColor / float(totalWeight);
}

Blur vertically:

uniform sampler2D bgl_RenderedTexture;
void main()  {
    float blur = 0.3;

    float resolution = blur * 0.1;
    int n = 10;
    int j = -n;
    int totalWeight = 0;

    vec2 st = gl_TexCoord[0].st;

    vec4 outColor = vec4(0.0);
    for(; j < n; ++j) {
        vec2 uv = st + vec2(0, float(j) / 2.0 / float(n) * resolution);
        outColor += texture2D(bgl_RenderedTexture, uv);
        totalWeight += 1;
    }
    gl_FragColor = outColor / float(totalWeight);
}

The output is as desired:

But when I try to do it with single pass, it's only blurring in the direction of the inner loop.

uniform sampler2D bgl_RenderedTexture;
void main()  {
    float blur = 0.3;

    float resolution = blur * 0.01;
    int n = 10;
    int i = -n;
    int j = -n;
    int totalWeight = 0;

    vec2 st = gl_TexCoord[0].st;

    vec4 outColor = vec4(0.0);
    for(; i <= n; ++i) {
        for(; j <= n; ++j) {
            vec2 uv = st + vec2(float(i), float(j))
              * resolution / float(n) / 2.0;
            outColor += texture2D(bgl_RenderedTexture, uv);
            totalWeight += 1;
        }
    }
    gl_FragColor = outColor/ float(totalWeight);
}

I must be missing something really simple but it's not visible to me. Can anyone help me?

sentences:
Lag compensation of projectile shooting game I'm thinking about an algorithm for firing projectiles with lag compensation. Now I did find only one descent solution:

Player hits fire button.
Client sends input "fire".
Client waits for server response.
Server generates bullet then sends response to client.
Client recieves response and finally fires projectile.

Is this solution only "trueway"? I find it the only one that can be fair to all of the clients. Valve in this case, doesn't compensate lag from rocket shots. I am feeling that I will not compensate it, too. I think that with today's bandwidth I can close my eyes on this problem, because I don't see any solutions with fair logic. What do you think?

sentences:
OpenGL ES 2.0: Repository of Quality Shaders Could I kindly ask, to suggest me a repository of high quality OpenGL (OpenGL ES 2.0) vertex and fragment shaders, please?

I am looking for pixel based ligting shaders (such as phong) and simmilar. It would be nice to see more of them, to be able to choose between quality vs shader performance.

sentences:
Does OpenTK work in Windows 8? While looking up OpenTK, I found a couple of references to threads that talk about Windows 8 support:

This one from 2011 claims that OpenTK works on a Win8 preview
A newer one from 2012 leaves the question open, and mentions crashes on VMs.

Is there a definitive answer to this?

sentences:
Retrieving snapshots of game statistics What is a good architecture for storing game statistics, so that I can retrieve snapshots of it at various moments?

Say I have a game, and the user's statistics initially are:

 {
 hours_played = 0,
 games_played = 0,
 no_of_times_killed = 0,
 }

When the user purchases something for the first time from within the game, the stats are

 {
 hours_played = 10,
 games_played = 2,
 no_of_times_killed = 5,
 }

And when he purchases something for the second time, the stats are

 {
 hours_played = 20,
 games_played = 4,
 no_of_times_killed = 10,
 }

Let me name the events as "purchase1" and "purchase2"

How do I model my statistics, so that at any point in the future, I will be able to retrieve the snapshot of the statistics at the time when "purchase1" was fired.
Similarly for "purchase2" and any other event I will add.

Hope that made sense..

sentences:
Freeglut vs SDL vs GLFW I need to port my game project from Android (written in C, OpenGL ES 2.0, thanks to NDK) to Windows and Linux platforms. Of course I will need to rewrite some platform dependent code, but for now I'm stuck with the question of which library to use for creating OpenGL context and handling input.

Just a quick googling gives me 3 candidates:

FreeGLUT - rewritten and free good old GLUT.
SDL - most well know one lib, used in many games.
GLFW - some kind of newer library, but simple and functional.

I'm quite new to PC development and don't see any significant differences between them.
Can you help me with the choice? I need only core mouse/keyboard input and creation of OpenGL context. I'll be using GLEW to load OpenGL functions.

sentences:
How can I stop startcoroutine when pressing once on the escape key? I want like in games to pass over a cut scene or splash screen in this case. So the user can hit the escape key to pass it over.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.Assertions.Must;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Splashes : UnityEngine.MonoBehaviour
{
    [Header("Splash Screen")]
    public bool useSplashScreen = true;
    public GameObject splashesContent;
    private List<Graphic> splashes = new List<Graphic>();
    public float splashStayDiration = 3f;
    public float splashCrossFadeTime = 1f;

    void Start()
    {

        if (!useSplashScreen || splashesContent.GetComponentsInChildren<Graphic>(true).Length <= 0) return;

        //if we use splash screens and we have splash screens
#region Get All Splashes
        //if you build on PC Standalone - you can uncomment this
        //foreach (var splash in splashesContent.GetComponentsInChildren<Graphic>(true).Where(splash => splash != splashesContent.GetComponent<Graphic>()))
        //{
        //    splashes.Add(splash);
        //}

        for (var i = 0; i < splashesContent.GetComponentsInChildren<Graphic>(true).Length; i++)
        {
            var splash = splashesContent.GetComponentsInChildren<Graphic>(true)[i];
            if (splash != splashesContent.GetComponent<Graphic>())
            {
                splashes.Add(splash);
            }
        }

#endregion

        //And starting playing splashes
        StartCoroutine(PlayAllSplashes());
    }

    private IEnumerator PlayAllSplashes()
    {
        //Enabling Splashes root transform
        if (!splashesContent.activeSelf) splashesContent.SetActive(true);

        //main loop for playing
        foreach (var t in splashes)
        {
            t.gameObject.SetActive(true);
            t.canvasRenderer.SetAlpha(0.0f);
            t.CrossFadeAlpha(1, splashCrossFadeTime, false);
            yield return new WaitForSeconds(splashStayDiration + splashCrossFadeTime);
            t.CrossFadeAlpha(0, splashCrossFadeTime, false);
            yield return new WaitForSeconds(splashCrossFadeTime);
            t.gameObject.SetActive(false);
        }

        //Smooth main menu enabling
        splashesContent.GetComponent<Graphic>().CrossFadeAlpha(0, 0.5f, false);
        yield return new WaitForSeconds(0.5f);
        splashesContent.gameObject.SetActive(false);
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {

        }
    }

    public void ExitGame()
    {
        Application.Quit();
    }
}

This splash is showing up each time the game is running. So I want to give the player the chance to press escape key to pass over it.

sentences:
Smoothing a shot power curve I'm making a game with shot powers (user presses and holds and launches an object)

Distance from the cursor was working for testing but obviously a distance of 1 and 2 pixels is double. I scaled this by 4 to make the difference itself less drastic but they're double of each other.

Is there a common way to smooth the strength of a shot so it's not so great per jump?

sentences:
Will performance suffer if I have a really large depth range but not very many objects? I don't know where the impression came from, but somehow it got in my head that having too small a "near" and too large a "far" in your projection at the same time would impact performance. In general that seems to hold true if there are many objects in your world like a crowded city where distant things are more likely not to be drawn because they're obstructed by closer objects. But what about fewer objects that don't obstruct each other?

I'm working out a game idea that has an "eye in the sky" camera that is expected to see a large portion of terrain kind of like an RTS (actually the camera is attached to a drone flying at altitude). I tried bringing my camera closer to the terrain and trying to make it behave like it's 50k ft in the air but nothing quite beat the feel of actually putting the camera very far away from the ground and using the field of view to zoom in and out. To make this work, I had to increase my Far plane by an extra order of magnitude.

All objects are on or near the ground in a relatively tight Y range compared to how far my camera is. I'm not drawing an obscene amount of things (at least not yet, it's still early in development) and very few objects are completely obscured by larger/closer objects. Is the large render distance of my camera going to be an issue or have side effects as I progress through development? Or should I re-approach the idea of bringing my camera closer to the world and having it simulate a larger distance (and how exactly would I do that)?

I'm using Unity 5, but I imagine my question won't be too specific to a framework.

sentences:
How to rotate enemies on 2D radar and clip them to circle shape? I've been working on implementing a 2D radar for a 3D game lately, it's working fine in a very basic version. This is what is looks like:

It works by transforming the 3D coordinates of the enemies nearby to the local player space and then drawing those coordinates with the center-offset of the radar circle.

Transforming the enemy positions (and adding them to a vector):

if (LocalPlayer)
{
    Vec3    diff;
    double  distance;
    position.clear();

    for (auto i = commonInfected.begin(); i != commonInfected.end(); ++i)
    {
        diff = (*i)->GetPosition() - Global::camera->GetPosition(true);
        distance = diff.xz().Length();

        if (diff < 100)
        {
            position.push_back(diff);
        }
    }
}

Drawing the enemies:

    for (int i = 0; i < position.size(); ++i)
    {
        pos.x = position[i].x;
        pos.y = position[i].z;

        pos += {80, 80}; // center of the circle

        context->DrawText("x", pos.x, pos.y);
    }

However, the problem I have is that the plotted enemies do not rotate with the player and that plotted enemies can "go out" of the circle shape of the radar. How do I approach this kind of problem?

I have seen and carefully read through this question but couldn't understand it.
Plotting entities on a radar

sentences: Multiple Colliders in Collision I have an object that has a front collider, left collider and right collider.  When a collision occurs, I notice that there are situations where the front collider and left collider/right collider has collided with the object. I need to somehow figure out which collider made contact "first".  Is there anyway to do this?  The reason I need this is because I have different code that needs to run depending on which collider made contact first.

sentences:
Programmatically Modifying Images to Create Morning, Sunrise/Sunset and Night-Time Modes I'm using RPG-Maker-XP-like sprites (any 2D adventure/RPG style sprites). I would like to tint them so that they look different at different times of day.

Times of the day are the set of:

Daytime (normal)
Early morning (bluish?)
Sunrise and Sunset (orangish?)
Night time (dark)

What do I need to do to tint them, and make them look good, during different times of the day? Are there any "known" formulas for any of these times, like "delete the green blue component and tint heavily red+green for a sunrise effect"?

Ideally, I have just the original sprites, with no additional information or images (like spot-highlights or shadows separated out).

Finally, I'm using Silverlight/FlatRedBall for this, so I do have access to per-pixel information, as well as RGB tinting (adding, subtracting, multiplying, etc.)

sentences:
Sliding loose dirt shader/material/effect Im sure there is some sort of technique with a name I don't know or didn't think to search, but how would I go about making an effect similar to loose dirt sliding down the face of a slope when something disturbs it? I guess I think of it as a mini avalanche or something.

I have attempted it a couple times with pretty poor results, but some of the properties i tried to replicate was: the sliding dirt spreads out the further it gets from its start position depending on the surface shape, angle of repose, rocks or larger pieces of debris causing even more dirt to slide(quasi-recursion?), loose dirt 'sliding' over other dirt, etc. I assume id need to combine the right ratio of shaders, particles and textures to look right but I cant seem to find any real info on this type of effect. Would something like this be too intensive to do real-time?

sentences:
Resize sprite to match camera width? I'm trying to resize my small background sprite to match the screen width of the user's device.

This is what I'm trying

// Use this for initialization
void Start () {
    // Set filterMode
    SpriteRenderer sr = (SpriteRenderer) GetComponent("Renderer");
    sr.sprite.texture.filterMode = FilterMode.Point;

    // Get scaling
    float multiplier = Camera.main.rect.width / sr.sprite.bounds.size.x;

    // Scale
    transform.localScale = localScale * multiplier;
}

It seems there is a problem with the measure I get from the Camera width, I also tried Screen.width but it seems it returns the value in pixels.

sentences:
Unable to generate standalone noise I've been stuck this evening on getting a Perlin Noise function to generate by itself. Every time I run the program without adding to different types of noise together it calls an ArgumentException error.

Here is my code I'm using.

        //perlin gen
        Random rand = new Random();
        double freq = 1 / 32.0;
        double lacu = 3.0;
        int octave = 5;
        double pers = 0.5;
        int seed = 1;

        Perlin perlin = new Perlin(freq, lacu, pers, octave, seed, QualityMode.High);

        //init the noise map
        noiseMap = new Noise2D(128, 128);
        noiseMap.GeneratePlanar(1, 2, 1, 2, true);

And the error that it calls is here.

public void GeneratePlanar(double left, double right, double top, double bottom, bool seamless)
    {
        if (right <= left || bottom <= top || this.m_generator == null)
        {
            throw new ArgumentException();
        }

I've checked and re-checked the code multiple times, so I'm not sure what is going on that is making the GeneratePlanar function call the ArgumentException error.

sentences:
Why when using editor script with handles with DrawSolidArc it's not drawing any arc over the object? This is the editor script is in the Assets/Editor
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(DrawSolidArc))]
public class DrawSolidArcEditor : Editor
{
    public float arrowSize = 1;

    void OnSceneGUI()
    {
        DrawSolidArc t = target as DrawSolidArc;

        Handles.color = Color.blue;
        Handles.Label(t.transform.position + Vector3.up * 2,
                             t.transform.position.ToString() + "\nShieldArea: " +
                             t.shieldArea.ToString());

        Handles.BeginGUI();
        GUILayout.BeginArea(new Rect(Screen.width - 100, Screen.height - 80, 90, 50));

        if (GUILayout.Button("Reset Area"))
            t.shieldArea = 5;

        GUILayout.EndArea();
        Handles.EndGUI();

        Handles.color = new Color(1, 1, 1, 0.2f);
        Handles.DrawSolidArc(t.transform.position, t.transform.up, -t.transform.right,
                                180, t.shieldArea);

        Handles.color = Color.white;
        t.shieldArea = Handles.ScaleValueHandle(t.shieldArea,
                        t.transform.position + t.transform.forward * t.shieldArea,
                        t.transform.rotation, 1, Handles.ConeHandleCap, 1);
    }
}

And the mono script for example this script is attached to a simple 3d cube :
using UnityEngine;

[ExecuteInEditMode]
public class DrawSolidArc : MonoBehaviour
{
    public float shieldArea = 5;
}

but there is nothing around the cube. not also near it nothing.
it should draw arch in the editor.
Later I want to be able to use the mouse with a click down and drag to be able to change the arc size but for not it's not drawing any arc.
I took the example from the unity official docs :
https://docs.unity3d.com/540/Documentation/ScriptReference/Handles.DrawSolidArc.html
I noticed now also for example that I don't see the gui button in the inspector of the object that the mono script is attached to :
if (GUILayout.Button("Reset Area"))

not sure what's wrong with the editor script.
This is working. I still wonder why the unity docs example didn't work but this is working and I don't need the editor script. The problem with this script is that I must to turn on the Gizmos in the editor and I don't want to make it turned on all the time. So it's working but not as I wanted.
I want to draw the arc without the gizmos.
using UnityEngine;

[ExecuteInEditMode]
public class DrawSolidArc : MonoBehaviour
{
    public Vector3 offset = Vector3.one;
    public float fieldOfViewAngle = 20;
    public float viewDistance = 4;
    public bool usePhysics2D = false;

    public void OnDrawGizmos()
    {
        DrawLineOfSight(this.transform, offset, fieldOfViewAngle, viewDistance, usePhysics2D);
    }
    public static void DrawLineOfSight(Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, bool usePhysics2D)
    {
#if UNITY_EDITOR
        var oldColor = UnityEditor.Handles.color;
        var color = Color.yellow;
        color.a = 0.1f;
        UnityEditor.Handles.color = color;
        var halfFOV = fieldOfViewAngle * 0.5f;
        var beginDirection = Quaternion.AngleAxis(-halfFOV, (usePhysics2D ? Vector3.forward : Vector3.up)) * (usePhysics2D ? transform.up : transform.forward);
        UnityEditor.Handles.DrawSolidArc(transform.TransformPoint(positionOffset), (usePhysics2D ? transform.forward : transform.up), beginDirection, fieldOfViewAngle, viewDistance);
        UnityEditor.Handles.color = oldColor;
#endif
    }
}

sentences:
How can I avoid tight script coupling in Unity? Some time ago I started working with Unity and I still struggle with the issue of tightly coupled scripts. How can I structure my code to avoid this problem?

For example:

I want to have health and death systems in separate scripts. I also want to have different interchangeable walking scripts that allow me to change the way the player character is moved (physics-based, inertial controls like in Mario versus tight, twitchy controls like in Super Meat Boy). The Health script needs to hold a reference to the Death script, so that it can trigger the Die() method when the players health reaches 0. The Death script should hold some reference to the walking script used, to disable walking on death (I'm tired of zombies).

I would normally create interfaces, like IWalking, IHealth and IDeath, so that I can change these elements at a whim  without breaking the rest of my code. I would have them set up by a separate script on the player object, say PlayerScriptDependancyInjector. Maybe that script would have public IWalking, IHealth and IDeath attributes, so that the dependencies can be set by the level designer from the inspector by dragging and dropping appropriate scripts.

That would allow me to simply add behaviors to game objects easily and not worry about hard-coded dependencies.

The problem in Unity

The problem is that in Unity I can't expose interfaces in the inspector, and if I write my own inspectors, the references wont get serialized, and it's a lot of unnecessary work. That's why I'm left with writing tightly-coupled code. My Death script exposes a reference to an InertiveWalking script. But if I decide I want the player character to control tightly, I cant just drag and drop the TightWalking script, I need to change the Death script. That sucks. I can deal with it, but my soul cries every time I do something like this.

Whats the preferred alternative to interfaces in Unity? How do I fix this problem? I found this, but it tells me what I already know, and it does not tell me how to do that in Unity! This too discusses what should be done, not how, it does not address the issue of tight coupling between scripts.

All in all I feel those are written for people who came to Unity with a game design background who just learn how to code, and there is very little resources on Unity for regular developers. Is there any standard way to structure your code in Unity, or do I have to figure out my own method?

sentences:
Unity font API behaves differently in built game Specifically it's Font.CreateDynamicFontFromOSFont(), use this script attached to an empty GameObject in the scene.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestFontTexture : MonoBehaviour {

    void Start ()
    {
        var font = Font.CreateDynamicFontFromOSFont("Consolas", 12);
        font.RequestCharactersInTexture("HelloWorld", 20);
        SaveTexture2PNG("./fontTexture.png", (Texture2D)font.material.mainTexture);
    }

    void Update ()
    {

    }

    void SaveTexture2PNG(string path, Texture2D tex)
    {
        byte[] bytes = tex.EncodeToPNG();
        System.IO.File.WriteAllBytes(path, bytes);
    }
}

After click play it should create a fontTexture.png file containing character glyphs in the Assets folder, but only in editor though. In the built game it just created a completely black image.

Since it's OS concerned, I'm using Windows 7 with font Consolas installed and Unity 5.6.5f.

How to make it work in a built game?

sentences:
How to deal with data transfer between scenes What i would like to achieve is to have 1 global 2d map where armies could move (Scene 1). When they collide, trigger loads new scene, setup parameters like army size etc (Scene 2). Once battle is finished, I would like to close scene2 and load again scene1.
I implemented this and had bad feelings about setting up Scene 1 into the same position as i left it(I used singletos for this).
Wouldnt it be better approach to hide Scene1, so all data will be consistent and once scene 2 is finished, show it again? Is it possible and is it good idea?

Another way I was thinking about was to create scene3 which would contain all important data needed for scene1 setup. So when I move from scene1 to scene2, i can destroy scene1. Once I finish scene2, I would start scene 1, which has its data inside scene 3 so scene setup would be done out of the box without defining some special scene init scripts.

Honestly I could not fight any proper solution for scene management, only tons of basic tutorials

sentences:
Optimizing gaussian blur with linear filtering There's a few (here, and here) gaussian blur tutorials out there suggesting that you can essentially cut the number of texture lookups in a gaussian blur shader in half by exploiting the GPU's hardware linear filtering.

Essentially turning this:

Into this:

It sounds good in theory, but after attempting to implement this, I've come to the conclusion that it can't be done correctly, and I'd like someone to prove me wrong :)

My beef lies with the weights.  Take the far left 2 texels in the first image.  Their overall contribution to the shader equals:

t1 * w1 + t2 * w2

In the image, their weights 1 and 4, respectively.  Now let us assign abitrary color values to the texels... 10 and 20.  This gives their overall contribution, according to the formula, of 90.  Great.

Now let us try to work this out with linear filtering.

What we want is essentially a new sampling location and a new weight, such that the value sampled at this new location, multiplied by the new weight, equals our original formula.

((t1 - t2 * new_offset) + t2) * w3 = t1 * w1 + t2 * w2

Let's make it easy and choose a sampling location halfway between texels 1 and 2, so that the value sampled is 15 (((10 - 20) * .5) + 20).  So the new weight MUST be 6, so that 15 * 6 = 90.  Ok great.

Now what happens when you change the values...instead of 10 and 20, you use 10 and 30.  With the first way, you get 10 * 1 + 30 * 4 = 130.  But with the linear sampling way, you get a linear sampled value of 20 ((10 + 30) / 2), times the weight of 6...120!  It doesn't match!

Can anyone shed any light on why the linear sampling optimization is thought to work, and what I'm misunderstanding about it?  I would be more than thrilled to be wrong about this :)

sentences:
Linking error at tessellation shaders in GLSL I'm testing the triangle tessellation from the link http://prideout.net/blog/?p=48#shaders . All the shader are compiled correctly, but when I try to link the program using the command:

glLinkProgram(programID);

I got the following error:

Tessellation control info
(0): error C6029: No input primitive type
----------------------------------------
Tessellation evaluation info
(0): error c7005: No tessellation primitive mode specified
-----------------------------------------------------------
Geometry info
(0): error C6022: No input primitive type
(0): error C6029: No ouput primitive type
----------------------------------------
Not valid

It's so strange I declare output for TC Shader using command:

layout(vertices = 3) out;

And input layout for TE shader using command:

layout(triangles, equal_spacing, cw) in;

Why I still got this error?
I hope to see you answer about it.

I put my shaders in below:

Vertex shader:

#version 410 core

in vec4 Position;
out vec3 vPosition;

void main()
{
    vPosition = Position.xyz;
}

TC shader:

#version 410 core

layout(vertices = 3) out;
in vec3 vPosition[];
out vec3 tcPosition[];

#define ID gl_InvocationID

void main()
{
    float TessLevelInner = 3;
    float TessLevelOuter = 2;
    tcPosition[ID] = vPosition[ID];
    if (ID == 0) {
        gl_TessLevelInner[0] = TessLevelInner;
        gl_TessLevelOuter[0] = TessLevelOuter;
        gl_TessLevelOuter[1] = TessLevelOuter;
        gl_TessLevelOuter[2] = TessLevelOuter;
    }
}

TE Shader:

#version 410 core
//TessEval

layout(triangles, equal_spacing, cw) in;
in vec3 tcPosition[];
out vec3 tePosition;
out vec3 tePatchDistance;
uniform mat4 Projection;
uniform mat4 Modelview;

void main()
{
    vec3 p0 = gl_TessCoord.x * tcPosition[0];
    vec3 p1 = gl_TessCoord.y * tcPosition[1];
    vec3 p2 = gl_TessCoord.z * tcPosition[2];
    tePatchDistance = gl_TessCoord;
    tePosition = normalize(p0 + p1 + p2);
    gl_Position = Projection * Modelview * vec4(tePosition, 1);
}

Geometry shader:

#version 410 core
//geometry shader
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
in vec3 tePosition[3];
in vec3 tePatchDistance[3];
out vec3 gFacetNormal;
out vec3 gPatchDistance;
out vec3 gTriDistance;
uniform mat4 Modelview;
uniform mat3 NormalMatrix;

void main()
{
    vec3 A = tePosition[2] - tePosition[0];
    vec3 B = tePosition[1] - tePosition[0];
    gFacetNormal = NormalMatrix * normalize(cross(A, B));

    gPatchDistance = tePatchDistance[0];
    gTriDistance = vec3(1, 0, 0);
    gl_Position = gl_in[0].gl_Position; EmitVertex();

    gPatchDistance = tePatchDistance[1];
    gTriDistance = vec3(0, 1, 0);
    gl_Position = gl_in[1].gl_Position; EmitVertex();

    gPatchDistance = tePatchDistance[2];
    gTriDistance = vec3(0, 0, 1);
    gl_Position = gl_in[2].gl_Position; EmitVertex();

    EndPrimitive();
}

Fragment Shader:

#version 410 core
//fragment shader
out vec4 FragColor;
in vec3 gFacetNormal;
in vec3 gTriDistance;
in vec3 gPatchDistance;
in float gPrimitive;
uniform vec3 LightPosition;

float amplify(float d, float scale, float offset)
{
    d = scale * d + offset;
    d = clamp(d, 0, 1);
    d = 1 - exp2(-2*d*d);
    return d;
}

void main()
{
    vec3 AmbientMaterial = vec3(0.04f, 0.04f, 0.04f);
    vec3 DiffuseMaterial = vec3(0, 0.75, 0.75);
vec3 LightPosition = vec3(0.25, 0.25, 1);
    vec3 N = normalize(gFacetNormal);
    vec3 L = LightPosition;
    float df = abs(dot(N, L));
    vec3 color = AmbientMaterial + df * DiffuseMaterial;

    float d1 = min(min(gTriDistance.x, gTriDistance.y), gTriDistance.z);
    float d2 = min(min(gPatchDistance.x, gPatchDistance.y), gPatchDistance.z);
    color = amplify(d1, 40, -0.5) * amplify(d2, 60, -0.5) * color;

    FragColor = vec4(color, 1.0);
}

sentences:
Using a state pattern across multiple controllers / general architecture advice I'm trying to implement a state pattern - having skated by with enums forever - and have hit a bit of a wall when it comes to it's implementation in my game. It's a grid based strategy game with an MVC hierarchy.

The general flow is InputManager -> CursorManager -> GridManager. So if the player presses "Up", the InputManager will translate that to the appropriate action and notify the CursorManager. The CursorManager will then update the cursor's world position and then then prompt the GridManager to find what's in the hex in order to update the UI with terrain/unit info.

My new addition is thus having the GridManager change the cursor's state depending on what's in the tile. You pressed up? Let's let the cursor state dictate what happens to the grid. So naturally I created a cursor state object in the CursorManager, but suddenly realized each state needed decent amount of shared information across different the two controllers.

For instance,

public class FreeCursor : CursorState
{
    public override void ActionPressed()
    {
        currState = gridManager.selectTile(cursor.position);
    }
}

So this means the FreeCursor state would need reference to the GridManager object, reference to the cursor GameObject, and also a reference to the current state itself. All 3 of those are already in the CursorManager, so it's no problem, just throw them all in a constructor: FreeCursor(CursorState context, GridManager gridManager, GameObject goCursor)

But d'oh, when gridManager.tileSelected() completes, it should return the new state. So the GridManager should be saying

public CursorState selectTile(Vector3 position) {
     //...
     return new FreeCursor(this);
}

...Except now we're missing the GameObject and the current cursor state, which aren't accessible in the GridManager.

So I could go one or two ways - make the GridManager also contain a reference to the context, so it becomes return new SelectedUnitState(this, CursorManager) and changes our flow to be InputManager -> CursorManager <--> GridManager. Or I could say screw it, throw the cursor state and GameObject into the GridManager and call it day.

...But both feel just wrong? The latter through combining two somewhat distinct controllers - the former by making the state be passed it's own containing object like a poor man's reflection or something. Because if I do that, I might as well just use Unity's GameObject.Find(Cursor). Am I wrong to think this? And if so, is the problem with my implementation of the state pattern or the way I've laid out my 'architecture'?

tl;dr: How do you handle a state pattern with data from multiple controllers?

Thanks!

sentences:
Bouncing ball isssue I am currently working on the 2D Bouncing ball physics that bounces the ball up and down. The physics behaviour works fine but at the end the velocity keep +3 then 0 non-stop even the ball has stopped bouncing. How should I modify the code to fix this issue?

Here is the video shows how it works.
Note: Bandicam cannot record the velocity transition between -3 and 0. So, it just shows -3 when the ball stops bouncing.
http://www.youtube.com/watch?v=SEH5V6FBbYA&feature=youtu.be

Here is the generated report: https://www.dropbox.com/s/4dkt0sgmrgw8pqi/report.txt

    ballPos         = D3DXVECTOR2( 50, 100 );
    velocity        = 0;
    acceleration    = 3.0f;

void GameClass::Update()
{
    // v = u + at
    velocity += acceleration;

    // update ball position
    ballPos.y += velocity;

    // If the ball touches the ground
    if ( ballPos.y >= 590 )
    {
        // Bounce the ball
        ballPos.y = 590;
        velocity *= -1;
    }

    // Graphics Rendering
    m_Graphics.BeginFrame();
    ComposeFrame();
    m_Graphics.EndFrame();
}

sentences:
Where am I obligated to put credits? First of all this is not a discussion for the best place to put credits, but rather where it's allowed.

So for instance is it fine if I just include a credits.txt file in the install directory, or will I have to make an in-game place where you can read them.

And is there any general rules, or is it up to the individual which need credit?

sentences:
OpenGL ES - DrawCalls count - bottleneck? I am newbie to OpenGL ES (so far, I used mainly DX11). Now for my scene, I have about 100 draw calls. I can use instancing, but only about half of objects can be instanced, so draw calls count would be about 50 - 60 / frame. Every object is max. 700 triangles (I use low-poly models)

What is some kind of limit of drawcalls per scene (targeting iPhone 4 like performance devices) ? So far I am running my code via ATI GLES on Windows, but there is a lot of power from my CPU and GPU.

Or is there a way, how to find bottleneck of my application ? I know gDebugger is for OpenGL, but with ES version it behave sometimes weird (a lot of warnings in calls I dont have in my code, so I suspect them to be from ATI layer code).

sentences:
"Compose PSM Master Package" doesn't do anything I made a game for PlayStation Mobile, and I'm ready to build the master for publishing.

Per the mastering instructions, I have filled out all the required information in app.xml, created app keys for this specific application, and built on Release.

And now that I click on "Compose PSM Master Package", the PSM Studio pretty much does nothing. I have .psdp and .pspp files in the Release folder, but I don't get a .psmp file for submission.

I think all my account information is okay, including bank account information.

I also tried deleting and recreating the app keys, but "Compose PSM Master Package" still refuses to do anything.

What am I missing? What kind of interaction should I expect from "Compose PSM Master Package"?

sentences:
Finding the Distance between 2 Objects I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix T2. And We are having a View Matrix V and Projection Matrix P.
Basically 2 Object are render using this function

Render(vec3 position,X Rotation , Y Rotation, Z Rotation, Scaling);

So i am having 2 different T1 and T2 transformation matrix.

How should i find the distance between these 2 objects ?
Please Explain ?
I have tried by simple formula using position vector but it is giving me incorrect distance ?

sentences: Get position of tiles in a grid So I have a 7x7 grid made using a for loop and instantiating the sprites. Now via code, let us say l placed my rectangular sprite,which takes 3 cells on the grid, somewhere on that grid. How can I get the position of the cells on which this rectangular sprite is on?

sentences:
LWJGL Text Rendering Currently in my project I am using LWJGL and the Slick2D library to render text onto the screen. Here is a more specific example:

    Font f = new Font("Times New Roman",Font.BOLD,18);
    font = new UnicodeFont(f);
    font.getEffects().add(new ColorEffect(Color.white));
    font.addAsciiGlyphs();
    try {
        font.loadGlyphs();
    } catch (SlickException e) {
        e.printStackTrace();
    }

then i use font.drawString to write onto the screen.
This is a quick easy way but it has a lot of disadvantages. for example font.loadGlyphs take a very long time 1-3 seconds. so when i want to change a color or font type then i have to wait 1-3 seconds which means I cannot do it while rendering (ie. cant have different color text on the same screen).

My question is what is a better way of drawing multicolored text onto the screen? I use slick2d only for the text rendering so maybe i can fully get rid of the library and draw text some other way...

If you have an answer please leave a quick short example.

Thanks!

sentences:
What does an engine like Frostbite look like in the early early stages? I have been having great fun playing Battlefield, and am blown away by how it all looks and sounds. I was just wondering what a game engine starts life as. At what point of writing code does it finally do something, and what did it do before it started rendering all the textures, light and particles, perfectly?

Are there any good articles, online, or examples anyone's seen?

sentences: How to run in any direction while looking and shooting at the enemy In Bayonetta, you can run in any direction and keep shooting at your target and looking at it while locked on. How did they do that animation? I want to implement it using Unity.

sentences:
Initialize an object in property drawer based on an int variable in Unity I have created following classes for my game in unity:

[System.Serializable]
 public class abstract BaseA {
 }

 [System.Serializable]
 public class DeriveABaseA : BaseA {
 }

 [System.Serializable]
 public class DeriveBBaseA : BaseA {
 }

 [System.Serializable]
 public class abstract BaseB {
     public int Type = 0;
     public int AType;
     public BaseA A;
 }

 [System.Serializable]
 public class DerivedABaseB : BaseB {
     DerivedABaseB() {
         Type = 1;
     }
 }

 [System.Serializable]
 public class DerivedBBaseB : BaseB {
     public DerivedBBaseB() {
         Type = 2;
     }
 }

 [System.Serializable]
 public class ClassC {
     public int BType;
     public BaseB B;
 }

 public class ClassD : MonoBehaviour {
     public List<ClassC> C;
 }

now, I'm trying to add my custom editor for them. this is the first time I'm using editor scripting and I have few question regarding how to add custom editor scripts for my classes:

What is the correct way of adding new element to variable C
How can I call PropertyDrawer for ClassC when I'm drawing C elements?
How to initialize variable B of class ClassC based on the user entered value for variable BType in class ClassC?
How can I call DerivedABaseBPropertyDrawer or DerivedBBaseBPropertyDrawer based on type of variable B in class ClassC?
How to initialize variable A of class ClassB based on the user entered value for variable AType in class ClassB?

This is code code that I was able to get it to work except for 2nd and last question:

[CustomEditor(typeof(ClassD))]
 public class ClassDEditor : Editor {
     ClassD m_target;
     public override void OnInspectorGUI()
     {
         m_target = (ClassD)target;
         if (GUILayout.Button("Add"))
         {
             //Is this the correct way of adding value to this list?
             m_target.C.Add(new ClassC());
         }

         foreach(var c in m_target.C) {
             //How propertydrawer can be called for each element of C?
         }
     }
 }

 [CustomPropertyDrawer(typeof(ClassC))]
 public ClassCPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {
         //Is the following code valid (it's working) and is there a cleaner/simpler way of doing this?
         object obj = fieldInfo.GetValue(property.serializedObject.targetObject);
         var index = System.Convert.ToInt32(new string(property.propertyPath.Where(c => char.IsDigit(c)).ToArray()));
         ClassC objC = ((List<ClassC>)obj)[index];
         if(objC.BType == 1 && typeof(objC.B) != typeof(DerivedABaseB)) {
             objC.B = new DerivedABaseB();
         } else {
             objC.B = new DerivedBBaseB();
         }
     }
 }

 [CustomPropertyDrawer(typeof(ClassB))]
 public ClassBPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {
         //How to get access to B instance object
         var type   = property.FindPropertyRelative("Type").intValue;
         var a_type = property.FindPropertyRelative("AType").intValue;
         var drawer = null;

         if(type == 1) {
             drawer = new DerivedABaseBPropertyDrawer();
         } else {
             drawer = new DerivedBBaseBPropertyDrawer();
         }
         if(a_type == 1) {
             //Set A == new DeriveABaseA();
         } else {
             //Set A == new DeriveBBaseA();
         }

     }
 }

 [CustomPropertyDrawer(typeof(DerivedABaseB))]
 public DerivedABaseBPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {

     }
 }

 [CustomPropertyDrawer(typeof(DerivedBBaseB))]
 public DerivedBBaseBPropertyDrawer : PropertyDrawer {
     public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
     {

     }
 }

sentences: Physics engine for Billiard game I need to write a simple 3D billiard game using OpenGL. Which physics engine is simple and best to use in this case? Or it's better to write physics by myself?

sentences:
resources on creating world editor / game IDE The craftyjs javascript game engine is in the process of creating a game builder that will assist the developer in map design, sprites, animations and that kind of stuff.

Are there any good resources on how a game builder should be crafted, both from an ease of use point of view(you need these features, and the world should be displayed like this) and a technical point of view(You need to store the data like this). I figure there should be blogs and articles written by players in the traditional console and pc game industry that we can learn from, but i have a hard time finding any.

sentences:
Parsing .sc2replay files How do I parse StarCraft 2 replay files (.sc2replay)? Is there an API?

I know of Sc2gears, but it doesn't quite fulfil my needs.

sentences:
How do I refer to a native library with Unity 5 on Android? I have a library called mylibandroid.a. This is given to me by another developer. I also have the iOS version of this lib, and have been able to access it from Unity.

It is supposedly built for android. I have included it in my Plugins folder in my Unity 5 project, but I renamed it mylibandroid.so as droid libs use this naming convention. I can see the library included in the .apk file, so Unity seems to know it should go in there.

My code looks like this:

public class AlmoTest : MonoBehaviour
{
#if UNITY_ANDROID
    [DllImport("mylibandroid.so")]
    private static extern void FreeGlobals();

    public void TestFreeGlobalsButtonPress()
    {
        Debug.Log("Pressed");
        FreeGlobals();
    }
#endif
}

When my function is called, I get this error:

E/Unity   ( 4188): Unable to find mylibandroid.so
I/Unity   ( 4188): Pressed
I/Unity   ( 4188):
I/Unity   ( 4188): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebug.gen.cpp Line: 56)
I/Unity   ( 4188):
I/Unity   ( 4188): DllNotFoundException: mylibandroid.so
I/Unity   ( 4188):   at (wrapper managed-to-native) AlmoTest:TestFreeGlobalsButtonPress ()
I/Unity   ( 4188):   at AlmoTest.TestFreeGlobalsButtonPress () [0x00000] in <filename unknown>:0

sentences:
Find a specific child object in a prefab overrides list When I select a prefab in the Inspector and open the Overrides drop-down menu, how can I find the particular child object I want to revert?
I can't find a filter box where I can type the name, so I don't need to deal with the very long list of objects.

sentences:
Ortbit camera rotation multiplication order with quaternions? So I switched my camera to use quaternions and the first thing I noticed is that things started to 'roll' even though I'm not using any roll values. I looked it up and I found that people suggest that using rotation = horizontal * rotation * vertical solves the issues instead of rotation = rotation * horizontal * vertical which I thought was the more intuitive thing from doing matrix multiplication. The explanations I read as to why one works and the other doesn't were pretty vague and unclear.

My question is: why does it work this way? what's wrong with 'rotation * h * v`?

Sample code:

float Horizontal = 0;
float Vertical = 0;

if (Keys['W'] == Key_Held)
{
    Camera->Position += Camera->Forward() * CamMovSpeed * DeltaTime;
}
if (Keys['S'] == Key_Held)
{
    Camera->Position -= Camera->Forward() * CamMovSpeed * DeltaTime;
}
if (Keys['A'] == Key_Held)
{
    Camera->Position -= Camera->Right() * CamMovSpeed * DeltaTime;
}
if (Keys['D'] == Key_Held)
{
    Camera->Position += Camera->Right() * CamMovSpeed * DeltaTime;
}
if (Keys['E'] == Key_Held)
{
    Camera->Position += vec_Up * CamMovSpeed * DeltaTime;
}
if (Keys['F'] == Key_Held)
{
    Camera->Position -= vec_Up * CamMovSpeed * DeltaTime;
}

// mouse
int dx = Mouse->x - Mouse->LastX; Mouse->LastX = Mouse->x;
int dy = Mouse->LastY - Mouse->y; Mouse->LastY = Mouse->y;
if (Mouse->MMB == Key_Held) // pan
{
    Camera->Position -= (Camera->Up()*dy + Camera->Right()*dx) * SpeedMul/2 * DeltaTime;
}
if (Mouse->RMB == Key_Held) // orbit
{
    Horizontal += dx * SpeedMul*10 * DeltaTime;
    Vertical += dy * SpeedMul*10 * DeltaTime;
}
if (Mouse->Wheel) // zoom
{
    Camera->Position += Camera->Forward() * Mouse->Wheel * SpeedMul*10 * DeltaTime;
}

if (Horizontal != 0 || Vertical != 0)
{
    quat QVertical(vec_Right, -Vertical);
    quat QHorizontal(vec_Up, Horizontal);
    Camera->Rotation = QHorizontal * Camera->Rotation * QVertical; // this works
    //Camera->Rotation = Camera->Rotation * QHorizontal * QVertical; // this doesn't
    Camera->Rotation.Normalize();
}

sentences:
Random World Generation Possible Duplicate:
  How are voxel terrain engines made?

I'm making a game like minecraft (although a different idea) but I need a random world generator for a 1024 block wide and 256 block tall map. Basically so far I have a multidimensional array for each layer of blocks (a total of 262,114 blocks).

This is the code I have now:

Block[,] BlocksInMap = new Block[1024, 256];

public bool IsWorldGenerated = false;

Random r = new Random();

private void RunThread()
{
    for (int BH = 0; BH <= 256; BH++)
    {
        for (int BW = 0; BW <= 1024; BW++)
        {
            Block b = new Block();
            if (BH >= 192)
            {

            }
            BlocksInMap[BW, BH] = b;
        }
    }

    IsWorldGenerated = true;
}

public void GenWorld()
{
    new Thread(new ThreadStart(RunThread)).Start();
}

I want to make tunnels and water but the way blocks are set is like this:

Block MyBlock = new Block();
MyBlock.BlockType = Block.BlockTypes.Air;

How would I manage to connect blocks so the land is not a bunch of floating dirt and stone?

sentences:
How to make an articulated mob in Minecraft? I am attempting to make a sea serpent, and I want to know how to make it be able to turn in any place, or at each 'segment', somewhat like the snakes in mocreatures. I know how to make mobs in general, rendering and modelling, as well as AI, so it's just this single element.

I am using Forge if that helps.

sentences:
How do I calculate the exit vectors of colliding projectiles? I'm trying to create projectiles which bounce/ricochet off one another when they collide in mid-air.

All projectiles are spherical and have identical size, mass, and speed.  Each has two vectors: one representing its current location and the other its direction and speed.  (Vectors, here, basically being <x,y,z> tuples.)  The distance/direction between the two projectiles can easily be calculated as a fifth vector.

In my head, I envision the ricochet as reflecting each projectile's velocity off of a plane perpendicular to the line between the two projectiles, but Googling for "vector reflection" and the like just gets me pages full of math I don't know how to translate into code.  :-)

How can I model this collision?  I'm not worried about real-world factors like drag, friction, or gravity — simple reflection is enough.

static void ricochet(Projectile projectile1, Projectile projectile2) {
    Vector position1 = projectile1.position;
    Vector position2 = projectile2.position;

    Vector direction1 = projectile1.direction;
    Vector direction2 = projectile2.direction;

    Vector distance = new Vector(position1).subtract(position2);

    Vector reflection1 = new Vector();
    Vector reflection2 = new Vector();

    // MAGIC!

    projectile1.direction = reflection1;
    projectile2.direction = reflection2;
}

sentences:
Find a partner to build a game with Possible Duplicate:
  How do I find artists to work on my game?

I have started working on a spacesim game but my art is terrible...

Is there a website where I could find people who might be interested in collaborating on a game with me?

sentences:
How can i start rotating object slowly smooth and then stop the rotation also slowly smooth? In the top of the script:

public FirstPersonController fpc;
public float speed;

In the Update

void Update()
{
  fpc.transform.localRotation = Quaternion.Slerp(fpc.transform.rotation,
  Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
}

The problem is that the rotation start immediately. And i want it to start slowly smooth then it will get some speed and then near the end to slowly smooth again until stop.

Update:

This is the complete script for now:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public UnityStandardAssets.ImageEffects.Blur blur;
    public UnityStandardAssets.ImageEffects.BlurOptimized blurOptimized;
    public FirstPersonController fpc;
    public float fadeDuration = 5;
    public float startAcceleration = 0.6f;
    public float endAcceleration = 0.6f;
    public float maxSpeed = 1.0f;

    private Material material;
    private float targetAlpha = 0;
    private float lerpParam;
    private float startAlpha = 1;
    private bool rotated = false;
    private float rotationSpeed;
    private Quaternion clampedTargetRotation;
    private bool start;

    void Start()
    {
        material = GetComponent<Renderer>().material;
        SetMaterialAlpha(1);

        fpc.enabled = false;
    }

    void Update()
    {
        lerpParam += Time.deltaTime;

        float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
        SetMaterialAlpha(alpha);

        if (alpha == 0)
        {
            fpc.enabled = true;

            if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                rotationSpeed = Mathf.Clamp(rotationSpeed + startAcceleration * Time.deltaTime, 0, maxSpeed);
                rotationSpeed = Mathf.Clamp(rotationSpeed - endAcceleration * Time.deltaTime, 0, maxSpeed);
                clampedTargetRotation = Quaternion.RotateTowards(fpc.transform.localRotation, whateverRotationTokeepGoing, rotationSpeed * Time.deltaTime);
                fpc.transform.localRotation = clampedTargetRotation;
            }

            if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
            {
                fpc.GetComponent<FirstPersonController>().enabled = true;

                blur.enabled = false;
                blurOptimized.enabled = false;

                rotated = true;
            }
        }
    }

    public void FadeTo(float alpha, float duration)
    {
        startAlpha = material.color.a;
        targetAlpha = alpha;
        fadeDuration = duration;
        lerpParam = 0;
    }

    private void SetMaterialAlpha(float alpha)
    {
        Color color = material.color;
        color.a = alpha;
        material.color = color;
    }
}

My problem is in the rotation part:

if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                rotationSpeed = Mathf.Clamp(rotationSpeed + startAcceleration * Time.deltaTime, 0, maxSpeed);
                rotationSpeed = Mathf.Clamp(rotationSpeed - endAcceleration * Time.deltaTime, 0, maxSpeed);
                clampedTargetRotation = Quaternion.RotateTowards(fpc.transform.localRotation, whateverRotationTokeepGoing, rotationSpeed * Time.deltaTime);
                fpc.transform.localRotation = clampedTargetRotation;
            }

The rotation should start from the current fpc rotation state and end at 0,0,0
This is where the rotation should be end when fpc is 0,0,0

if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))

If fpc rotation is at 0,0,0 then stop. Between the start and stop make the whole rotation operation.

sentences:
How to get 60fps animation in terms of rounding/truncating position/alpha floats I am wondering what gives the best animation performance running at 60fps with lots of objects. I have seen in a few places such as this that you should round or truncate your values so you don't get 54.2356345234578px, but instead get 54.24px.

animationValue = +animationValue.toFixed(2)

For x, y, alpha, etc. Any float values. I sort of understand why this is, but I am interested to know if there are any ideal heuristics to take into account. For example, maybe rounding .toFixed(2) is not ideal for particle animations. Maybe it is choppy for alpha transitions. Wondering if this has been solved, and what to truncate the values to for performance. Also in terms of calculating velocity or physics stuff, just generally what the scale of rounding/truncation should be so there are no noticeable effects.

sentences:
How to let a gun follow the camera while characters hands are following the gun I have made a character using MakeHuman, imported to blender and created a view animations. Then I imported the character as .fbx file into Unity. I set up an FPS scene with a player holding a gun in front of him. The camera is inside the character's head and the character is inside a capsule which is the actual movement controller. I basically just set the parent as needed. So if the gun should follow the hand I make the hand to be parent of the gun in the hierarchy.

I want the gun following the camera, so it is pointing exactly at the center of the players view where a crosshair is positioned.

But when I let the gun follow the camera, I can't let the hands follow the gun. And if I let the hands follow the gun, I can't let the gun follow the camera.

Is there some logical error in my mind or is this a common situation to find some individual method?

sentences:
Determine position of a rotated element in Tetris Tetris-Tiles are stored as a 4x4 boolean matrix. Each rotation step has it's own matrix, the representation of the T-Block would look like this:

[
    0, 0, 0, 0,
    0, 1, 1, 1,
    0, 0, 1, 0,
    0, 0, 0, 0
],
[
    0, 0, 1, 0,
    0, 0, 1, 1,
    0, 0, 1, 0,
    0, 0, 0, 0
],
[
    0, 0, 1, 0,
    0, 1, 1, 1,
    0, 0, 0, 0,
    0, 0, 0, 0
],
[
    0, 0, 1, 0,
    0, 1, 1, 0,
    0, 0, 1, 0,
    0, 0, 0, 0
]

I'm trying to find a way to calculate the position of the block when it's being rotated and collides with the board (the board is also a matrix). The original Tetris would simply not allow rotation of a block when the rotation would result in a collision. Modern variants of the game will resolve the collision and move the block to a valid position.

Here are some situations that should be solved. The board is 6x6, red = active block, grey = placed/occupied blocks. Each time, a counter-clockwise rotation should be performed. The green overlay indicates the matrix for the block. The arrow indicates the resulting correction to resolve the rotation:

Block is at the left side of the board. Since the block cannot leave the board, it should be moved back inside after a rotation.
Block hits "ground", but isn't placed/committed yet. In this case, the tile must be moved up to resolve the collision (in case of a "I"-Block, the movement would be 2 cells up).
Tile would hit occupied blocks, must be moved left to resolve collision.
Tile cannot be rotated.

What would be the best approach to tackle this problem? Optimally, the solution should be generic, eg. work with arbitrary 4x4 matrix blocks on an arbitrarily sized and populated board.

sentences:
How should I organize my matrices in a 3D game engine? I'm working with a group of people from around the world to create a game engine (and hopefully a game with it) within the next upcoming years. My first task is to write a camera class for the engine to use in order to add cameras to the scene, with position and follow points.

The problem I have is with using matrices for transformations in the class, should I keep matrices separate to each class? Such as have the model matrix in the model class, camera matrix in the camera class, or have all matrices placed in one class/chuck?  I could see pros and cons for each method, but I wanted to hear some input form a more professional standpoint.

sentences:
Direct3D9 application won't write to depth buffer I've got an application written in D3D9 which will not write any values to the depth buffer, resulting in incorrect values for the depth test. Things I've checked so far:

D3DRS_ZENABLE, set to TRUE
D3DRS_ZWRITEENABLE, set to TRUE
D3DRS_ZFUNC, set to D3DCMP_LESSEQUAL
The depth buffer is definitely bound to the pipeline at the relevant time
The depth buffer was correctly cleared before use.

I've used PIX to confirm that all of these things occurred as expected. For example, if I clear the depth buffer to 0 instead of 1, then correctly nothing is drawn, and PIX confirms that all the pixels failed the depth test. But I've also used PIX to confirm that my submitted geometry does not write to the depth buffer and so is not correctly rendered.

Any other suggestions?

sentences:
Object is not rotating from right direction im beginner to unity so im using this code to rotate object with mouse with max rotation of 35 degrees,it is working but it's only possible to rotate object if mouse is under of that object. here is my code:

    using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class rotObj : MonoBehaviour {
    //private float baseAngle = 0.0f;
    private float maxRotaion = 35f;
    void Update () {
        var dir = Camera.main.ScreenToWorldPoint (Input.mousePosition) - transform.position;
        var angle = Mathf.Atan2 (dir.y, dir.x) * Mathf.Rad2Deg;
        if (angle >= -maxRotaion && angle <= maxRotaion)
            transform.localRotation = Quaternion.AngleAxis (angle, Vector3.forward);
    }
}

as i think, localrotation is making that problem? how can i fix this without removing maximum rotation angle and will be able to rotate object not just from mouse under object, but from any position? my english grammar is very bad but i hope you will understand

sentences:
Animation after enemy spawns right now in my game, four enemies spawn in four spawn points with a delay, but what I want to do is that if you don't kill the enemy after a couple seconds, an animation (it's an animation of a scratch, basically to let the player know it has been attacked) appears.

Right now I have a script that display an image (it's an image because I was testing the scripts), but now I want to change the image for the animation but after trying and failing a lot of times I decided to ask here, and hopefully someone can help me.

This is the script of the "attack", and it's attached to the enemy prefab:

public Image TargetImage;

void Start ()
{
    TargetImage.enabled = false;
}

public void spawnAttack(){
    StartCoroutine (playerIsAttacked (5, TargetImage));
}

public IEnumerator playerIsAttacked (float t, Image im)
{
    yield return new WaitForSeconds (t);
    TargetImage.enabled = true;
}

}

and this is in the timed spawn script:

public class TimedSpawn : MonoBehaviour {

public GameObject spawnee;
public bool stopSpawning;
public float spawnTime;
public float spawnDelay;

void Start () {
    InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
}

public void SpawnObject (){
    GameObject newSpawn = Instantiate (spawnee, transform.position, transform.rotation) as GameObject;
    newSpawn.GetComponent <enemyAttack> ().spawnAttack ();

    if (stopSpawning) {
        CancelInvoke ("SpawnObject");
    }
}

}

sentences:
How to achieve an GPS-Based game like "Parallel Kingdom" I'd like to use Google Maps, in my game, much like "Ingress", "Pokémon GO" and "Parallel Kingdom".
When I take a deeper look into the Android API/Google Maps API, and dozens of forums, I noticed that it's very hard to display sprites or even animations using the Google Maps API. Someone said that you need to layer stuff. Someone else said it's better to use game engines for that. No one tells me how to begin. I opened Android Studios and made a new Google Maps project. I compiled and ran the app. There is the map, so I guess I have completed the first step.
How do I combine the Google Map with an extra view or LibGDX layer for displaying sprites? How manage this with a multiplayer server?
I am wanting to set my map up like "Parallel Kingdom", which you can see, below.

sentences:
Is there a reason not to delete the System.Collections namespace in Unity3D? I find various scripts on tutorials, books and even on the community wiki using the System.collections namespace without ever actually using it.

Is this an obscure Unity3D requirement, or are the authors using the default script template and forget/don't bother deleting the import?

sentences:
How to add state to the custom inspector in Unity I'm writing a custom inspector for my asset (by deriving from Editor),
and I have a few variables controlling the state of the inspector (like whether a foldout is opened or not), that I'd like to be saved. I don't want to put them on the object, since then it would end up as junk inside the game state, but I also don't want it to be reset every time I click away from the object and then click back.

Do you guys have an idea where could I put the data so it gets persisted?

sentences:
Having to check collisions twice per game tic I have vertically moving elevators (3 solid tiles wide) and static solid tiles.  Each are separate entities and therefore have their own respective collision routines (to check for, and resolve, collisions with the main character)

I check my vertical collisions after characters vertical movements and then horizontal collisions after horizontal movements.

The problem is that I want my platform to kill the player if it squashes him from the top, and also if he's on a moving platform (that is moving up) that squashes him into a solid block.

Correct behaviour, player on solid blocks being squashed from above by decending elevator

Here is what happens.  Gravity pushes character into solid block, solid block collision routine corrects characters position and sits him on the solid block which pushes him into the moving elevator, elevator routine then checks for collision and kills player.

This assumes I am checking solid blocks first, then elevator collisions.

However, if it's the other way around, this happens....

Incorrect behaviour, player on accending elevator gets pushed into solid blocks above

Player is on an elevator moving up, gravity pushes him into the elevator, solid block CD routine detects no collision, no action taken.  Elevator CD routine detects character has been pushed into elevator by gravity, corrects this by moving character up and sitting him on the elevator and pushes him into the solid blocks above, however the solid block vertical routine has now already run for this tic, so the game continues and the next solid block collision that is encountered is the horizontal routine.  This detects a collision and moves the character out of the collision to the left or right of the block which looks odd to say the least (character should get killed here).

The only way I've managed to get this working correctly is by running the solid block CD, then the elevator CD, then the solid block CD again straight after.  This is clearly wasteful but I can't figure out how else to do this.

Any help would be appreciated.

sentences:
OpenGL - Changing blending modes using sprite batching I'm working on a game which uses sprite batching to render sprites efficiently where each sprite gets batched with its VBO data into a VAO every frame (containing vertex coordinates, texture data and color data). So far so good. I'm sorting them on the CPU and ordering the batch before each draw call according to render order to simulate z-ordering.

However, there's one problem: what do I do when I want to draw particles, for instance, which require a blending mode change? All of the sprites are drawn using glDrawArrays use the same blending mode, but for my particle data I want to change the blending mode. If I put the particles in the same batch then I won't have the ability to change it necessarily. My goal is to switch from normal blending (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) to additive blending (GL_SRC_ALPHA, GL_ONE).

1st solution: use a separate draw call for every sprite and don't batch them at all. then for each call I can change the mode appropriately

2nd solution: add a z-coordinate to each sprite to do z-ordering automatically on the GPU using depth testing (this means I can render particles separately in their respective batches with ~2 calls -> +1 for sprites & +1 for particles) which will allow me to change blending modes.

Is there another way of approaching this problem? What am I missing?

sentences:
How should I track real-time resource generation in a client-server scenario? I am currently building a game that has a "City" entity.  These cities generate and consume resources such as food variably over a period of time.  I need to be able query the server often to find exactly how much food the city at any given point.  These queries can take place  multiple times per minute.  There could also be 400,000 cities to track at a given time.

How would you handle tracking these resources?  Would you do it in real time, keeping an instance of the city in memory on the server, with some sort of a snapshot in time of the resources, then computing the growth/consumption from that snapshot time for subsequent queries?  Would you work exclusively with a database, using a similar "snapshoting" scheme?  Maybe a mixture of the 2, caching recently queried cities in memory for a period of time?

There is also a lot of other data that each city needs to track.  A player can queue units to build in a barrack.  The armies available in the city will need to be updated as units complete.

I'm interested in everyone's input on where/when/how you'd manage the real time data.

sentences:
How do I get my team NPC to follow the player? | Game Maker Studio I would like to have 4 teammate NPC's that would follow behind the Player. First off, I know how to get the movement and collisions working properly but getting the NPC's to follow the player is where I'm struggling.

This code checks if the player's x is greater than the x of the NPC so it can move right.

if obj_testPlayer.x > x - 34 { // want it to stop 34 pixels away from the players left
   xspd += 3
} else {
   xspd = 0;
}

Once the NPC is 34 pixels away from the Player it will stop, but when the player moves again, the NPC is stationary. Also, when I change this code to check if the player is on the left of NPC; The NPC won't move.

All I'm trying to do is get the NPC moving Horizontally when the player is on the right or the left side of the NPC but it's not working.

sentences:
How can I get the borderSize/s of a plane? public Texture2D gridImage;
public GameObject floor;

    private int borderSize;

    private void Start()
    {

        GenerateGrid();
    }

    void GenerateGrid()
    {
        Color gridColor = Color.cyan;
        Color borderColor = Color.black;
        Collider floorCollider = floor.GetComponent<Collider>();
        MeshRenderer floorRenderer = floor.GetComponent<MeshRenderer>();
        floorRenderer.material.mainTexture = gridImage;
        floorRenderer.material.mainTextureScale = new Vector2(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        floorRenderer.material.mainTextureOffset = new Vector2(.5f, .5f);

        Vector3 foorSize = new Vector3(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        for (int x = 0; x < gridImage.width; x++)
        {
            for (int y = 0; y < gridImage.height; y++)
            {
                if (x < borderSize || x > gridImage.width - borderSize || y < borderSize || y > gridImage.height - borderSize)
                {
                    gridImage.SetPixel(x, y, new Color(borderColor.r, borderColor.g, borderColor.b, 50));
                }
                else gridImage.SetPixel(x, y, new Color(gridColor.r, gridColor.g, gridColor.b, 50));
            }
            gridImage.Apply();
        }
    }

In the end I want to create something like this on a 3D Plane UI :

sentences:
Out of bounds in AAA games In many common AAA titles (Source engine games especially), when the player reaches an area 'un-catered' for, such as out of bounds, or noclipping under the map; a strange effect occurs on the screen (buffer tearing?).

It can be described as being similar to the trail of windows that Windows XP may leave behind a window being dragged whilst theres a system hang.

I can only postulate that the developers do not clear the color buffer when refreshing the screen?

Is that correct? If so, why?

sentences:
Separating axis Theorem rotation issue I made a post yesterday to see if anyone could understand my problem.

However I did not receive much guidance, probably because my question was not clear.

I have worked on it a little more and discovered the actual issue and now have a clearer picture of what is causing the problem.

As you can see from the image, the boxes are projected correctly along their appropriate axis (all components labeled 1 are from the main white box 1 and vice versa).

The problem comes when the box is rotated. (See image 2). Box 1 has been rotated but the corner (projection?) in green clearly does not match the shape of the rotated box 1 and is much much closer to box 2 than it should be. The axis projections have changed and axis 1 is on the far left but axis 3 has gone?

THE CODE CAN BE SEEN ON MY PREVIOUS POST
Separating Axis Theorem Issue

Thank you! ;D

sentences:
Collision resolution when moving in two directions I am making a bomberman clone and I'm having problems regarding moving on both x and y axis (pressing down+left, down+right, up+left). Here is a video to demonstrate the problem. I use Tiled for the map. Below is the code:

private void checkCollision(float delta) {
    player.getVelocity().scl(delta); // dont mind
    Vector2 position = player.getPosition();

    if(player.isMovingRight()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap right");
                player.setPosition(tile.x - player.getWidth() , player.getPosition().y);
            }
        }
    }
    if(player.isMovingLeft()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1),  (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap left");
                player.setPosition(tile.x + tile.width, player.getPosition().y);
            }
        }
    }

    if(player.isMovingUp()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE - 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap up");
                player.setPosition(player.getPosition().x, tile.y + tile.height);
            }
        }
    }
    if(player.isMovingDown()) {
        Array<Rectangle> tiles = getTiles((int)(position.x/TILE_SIZE - 1), (int)(position.y/TILE_SIZE + 1),
                (int)(position.x/TILE_SIZE + 1), (int)(position.y/TILE_SIZE + 1));
        for (Rectangle tile : tiles) {
            if(player.getRectangle().overlaps(tile)) {
                System.out.println("overlap down");
                player.setPosition(player.getPosition().x, tile.y - player.getHeight());
            }
        }
    }

    player.getVelocity().scl(1/delta);

}

private Array<Rectangle> getTiles(int startX, int startY, int endX, int endY) {
    TiledMapTileLayer layer = (TiledMapTileLayer)level.getMap().getLayers().get(1);
    Array<Rectangle> rectangles = new Array<Rectangle>();
    for (int x = startX; x <= endX; x++) {
        for (int y = startY; y <= endY; y++) {
            Cell cell = layer.getCell(x, y);
            if(cell != null) {
                Rectangle rect = new Rectangle(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE);
                rectangles.add(rect);
            }
        }
    }
    return rectangles;
}

To reproduce the problem shown in the video: Try to collide (coming from up) with one of the blocks that is not on the sides, press both down and left. Try again but press down and right. For the third one, make sure you are colliding with the top wall by pressing up then press left (both are pressed). It can also be done on the bottom wall by pressing down and left.

sentences:
(XNA) What's a Good Database Program for a Turn-Based RPG? I'll begin by saying that I feel my level of expertise matters here, and so I have about a year worth of experience as a programmer in the C# language and most of the .NET framework as a whole, but have scarcely worked with databases at all throughout my career so far. Can't exactly say why. Either way, I'm a bit of a beginner, although SQL/LINQ I am capable of working with once I have this question resolved. Moving on...

At home, I am developing a single-player (so only one person needs to access it) turn-based RPG in XNA. I have a lot of the logic done and the time has come for me to begin building a database for it.

THE REQUIREMENTS: There will be both dynamically written data not included with the program (such as the location in the world at which a player saved his game, that he may load in the same place) and read data that needs to be capable of being distributed easily with the program (such as a table containing stats of every monster).

THE DESIRED BUT OPTIONAL PERKS: Beyond these absolute requirements, ease of use is a second priority I want to focus on. My amatuer nature doesn't want me digging around on ground I am too unfamiliar with.

MY ATTEMPTS AT RESEARCH: I understand Access to be a simple-to-use (though oft frowned upon) choice that could work based on needing only one user to access the database at a time. SQL Server could also work, but I understand it to be more difficult to use based on my needs. And in both cases, I am not sure if there are complications associated with the distrubution of pre-loaded data with the programs. In this case, I think I should use an XML file to hold the data I want the game to come with, but I am not sure. Amidst all of this, I have also considered creating the .dbml right there in Visual Studio because it seems the simplest, but same issue: I don't know the limitations of capability and distribution.

I have tried to outline what I know and what I need to accomplish, as well as some of the options I have attempted to research, but ultimately, my knowledge has holes in it I can't find the answers to and I can't form a conclusive answer. Thus, I ask you kind people, based on the above, what is my best option for how to start building my game's database?

sentences: What would be the best way to implement a multi-directional "board game" movement system? I'm pretty new to game dev, and can't figure out how to do this, even though it is probably really easy. If you need more reference, look up some gameplay of the Wii game Dokapon Kingdom, that's the kind of system I'm trying to create. I also made a picture to help you better understand my dilemma. Thank you all so much in advance!

sentences:
What are your favourite game-specific coding gems? I'll start off with John Carmack's the Fast Inverse Square Root in Quake III:

float Q_rsqrt(float number) {

  long i;
  float x2, y;
  const float threehalfs = 1.5F;

  x2 = number * 0.5F;
  y = number;
  i = * ( long * ) &y;
  i = 0x5f3759df - ( i >> 1 );
  y = * ( float * ) &i;
  y = y * ( threehalfs - ( x2 * y * y ) );

  return y;

}

sentences:
Unity move canvas slightly with smartphone acceleration I'm developing an AR-App with the Samsung-GearVR. To get a smooth UI, I thought about creating a UI, which is not completely fix, I thought it could be nice, when the UI is slightly behind my head movement, but still lerps to the correct position, when my head is not moving. (A lot of 2D-Sidescroller got this style of camera, which is not fixed on the character, but instead is following the character with a bit of delay, I want this effect for my canvas.)

First off I changed my canvas to World space, which works fine, then I was thinking about the Input.acceleration method, but it does not really give you the actual acceleration, but the actual rotation of the phone. Now I'm struggling, because I don't know, how to get the current acceleration. Is there some better way to achieve this effect or do I have to build something with the Input.acceleration method?

sentences:
How to design and implement turn-based system? Possible Duplicate:
  How to implement turn-based game engine?

I am considering making a game like Master of Orion but I don't know how to start with turn-based systems. If any of you played this game they know what I mean, same system is used in Civilization.
1. You give orders to your units and production queues
2. Click End Turn.
3. Everything moves, go to 1.

I know that some form of state machine is used, but maybe you could point me into some book or manual on the matter.

sentences:
Breaking up a 2d shape into small triangles I have a "piece of cloth" (2d shape) that I'm applying soft-body physics to.  This works great when the shape is a square and I can create a regular grid of vertices between which are hung the cloth's "springs."  However, now I'm trying to get this to work with non-square piece of cloth, so I'd like to be able to break the polygon down into thousands of tiny triangles.  I've seen lots of libraries to tessellate or triangulate polygons, but they all seem to minimize the number of triangles created, which is exactly the opposite of what I want.

Does anyone know of a library (optimally in JS!) that breaks up a polygon into arbitrarily small chunks?  Preferably as regular as possible (i.e., creating a grid-like layout where possible), but not required.

Alternatively, does anyone know if there's a name for this, so I can just look up the algorithm and implement it myself?

sentences:
SerialPort() data reading slowing down Unity I am sending a few data from Arduino Uno to Unity using serial Port, baud rate is 115200. Still Unity is response time is pretty poor.

At first it takes fraction of seconds to process, but as time goes response time increases a lot.

What can I do ?

Is there a better way to send data ?
I have heard using byte[] will be very helpful. Can anyone please tell me how to send Vector from Arduino as byte & recieve in Unity, if actually possible.

As I said I will open-source the project. Take a look.

sentences:
How to stop sinking bodies in physics engine C++ I'm writing a rigid body simulation in C++, and have come across a problem when an object should come to rest on the ground.

Because gravity is being applied to it's velocity, the object starts sinking through the ground, or whatever else it's resting on.

To combat this, I am adjusting the position of the object, by moving it along the collision normal by the penetration depth. This has the drawback of making the object look like its vibrating, so it never comes to rest.

I read somewhere ages ago, that there is a way to counter this, by generating a force along the normal which will cancel out the force which is causing it to sink. A google search did not return any useful answers however. I suspect this is because I'm not asking the right question, but I don't know a more concise way to word it, so I'd appreciate if someone here has solved this, and could steer me in the right direction.

sentences:
What's the difference between XNA Game Services and glorified global variables? The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add method.

Now, instead of having to pass an AudioComponent to all classes and methods that require it, instead you just pass your Game instance and look up the service. (Service Locator)

Now, because games have many services (GraphicsDevice, SceneGraph, AudioComponent, EffectsManager, et cetera), you will now basically be passing Game to everything.

So why not just make these instances a Singleton? Well, because Singletons are bad because they have a global state, prevent testing, and make your design much more brittle. Service locators are equally considered to be an anti-pattern to many because instead of just passing the dependency to an object, you pass a service locator (the Game) which couples that class with the rest of the services.

So then why are Services recommended in XNA and game development? Is it because games are different from regular programs and are highly intertwined with their components and having to pass every component necessary for the functioning of a class would be highly cumbersome? Are Game Services just then a necessary evil in game design? Are there alternatives that don't involve lengthy parameter lists and coupling?

sentences:
How do I become a game publisher? I wonder how I can become a game publisher locally. For example, I know a Japanese game that I want to publish in India, where I live.

How do I acquire a license to do this? I tried emailing the Japanese game company, but they didn't reply. I also asked if they need to know my company size or credits in India before proceeding with a contract, but they also keep silent.

sentences:
Getting started using C# and Physics (Resources, Tutorials, Samples, etc.) As an application developer, I plan on now getting started in game development so I have come along to this site.

I am a proficient C# developer so I guess it makes sense to start game development in the same language, unless someone directs me otherwise.

I'm looking for some "getting started" type of tutorials that cover basic game architecture and essential physics such as collision, velocity, gravity, friction etc.

I know about XNA and physics engines such as farseer but, at the moment, I'd like to get started without attaching myself to a particular framework or set of classes.

Please let me know of good resource, tutorials, etc. that will get me started in this manner.

sentences:
How to transform a spherically-projected render into a perspective projection? Suppose that you have a projection obtained by mapping spherical coordinates to a texture; example:

What is that projection called?
Is it possible to "fix" such texture so that it becomes a regular perspective projection?

sentences:
My GML object doesn't want to inherit variables here's the error that I can't seem to get rid of.

FATAL ERROR in
action number 1
of  Step Event0
for object side2_obj3:
Variable side2_obj3.sidePick2(100004, -2147483648) not set before reading it.
at gml_Object_side2_obj3_StepNormalEvent_1 (line 1) - if (sidePick2 == 1)

this object is inheriting from an object that holds the variables sidePick1 and sidePick2. I stripped the level down to just the object to see if this was being caused by a code collision and the issue seems to be persisting.
EDIT
I gave tried calling the following function
Event_inherited ()

And it didn't work

sentences:
Geometric clipping of triangles intersecting near plane I was reading about how rasterization works but there is one topic I can't quite understand.
After perspective projection, our point is in clip space as I understand it.
Now we test all points in a triangle like so
rejected = true
for every point:
   if (abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w)
      point.w > 0) {
      rejected = false;
    }

So the triangle is only rejected if all points are behind the near clipping plane or fall out boundaries, but it can happen that one point is behind the near clipping plane and others are in front.
Now there is a part I don't understand.
To deal with this we somehow clip points in 3d space by constructing new triangles.
So how is this exactly works?
And why we can't just interpolate our z values to test if the point is behind or in front of the near plane?

sentences:
Making sense of the positions of gameObjects Project files: https://github.com/Sebastian-Nielsen/makingSenseOfPositions

Note: There are no scripts running, all I am doing in between each picture is manually changing the x-coordinate in the inspector of the given gameObject.

See the problem: Gif

Here we got my lovely little scene

Now, take note on the x-position of the tile the dark soldier is standing upon; it's -13.78.

Take a look at the Dark Soldier's x-position now. There is a difference of 3 between those two on the x-axis!

Now, look what happens when I change the x-coordinate of the Dark Soldier to -13 to match that of the tile. (I expect the Dark Soldier to now be precisely on top of the tile he was standing on in the first picture -- maybe he was a little off in that pic).

Wait what? He moved away from the tile at position x=-13.

Why is that?! I think I'm going crazy! Please make sense of this, why is this happening?

sentences:
Can Unity censor my content or invalidate my license for offensive content? If I make an offensive game can they pull my license and prevent me from selling my game? Like we're talking think of the most offensive thing you can think of: you're in charge of the most efficient genocide against some specific racial/religious/political group, your choice... now imagine the game is mocking victims and generally being extremely rude, violent, and insensitive.

Now I have no intention of making such a horrible game but I am using an extreme example to ask my question. It's not unheard of for less extreme things to get blocked by brands who didn't want to associate with them, for example I saw that Apple removed the Confederate flags from Civil War games in the App Store.

Would Unity be able to prevent me from using their game engine or selling my game after I had already purchased appropriate Unity licenses and completed the game?

Do they have that kind of power with their licensing model? Or would even the most extreme cases still be legally allowed to sell the content?

I want to make something that may have some mildly provocative/divisive content (not as offensive as say, South Park, which I know was made in Unity, but more serious than South Park) and I'm just making sure I don't get a bunch of work done and then get disappointed later, wishing I had gone with some kind of more free/open engine.

sentences:
Unity c#: Interface object never equals null I've created an interface class for some mechanic I'm using to interact with things in my game. Now, I noticed that checking if that value is null never returns true.
Here's a screenshot of where this happens:

The error I get is the following:

MissingReferenceException: The object of type 'InteractiveItem' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
InteractiveItem.CurrentGameObject () (at Assets/Scripts/Interactive/InteractiveItem.cs:10)
Interactive.ManualStopInteract () (at Assets/Scripts/Interactive/Interactive.cs:30)

The line where this fails is:

if (IsInteracting() && this.interacting.CurrentGameObject().GetComponent<InteractiveUtilityChest>() == null && !MainReferences.UIReferences.IsAnyMenuWindowOpen()) {
        // do something
}

The IsInteracting() check is for some reason returning true here because the last line (InteractiveItem.cs:10) is in the method interacting.CurrentGameObject()

I don't get how this can happen or how I should solve it. As far as I know, an interface is a nullable type.

sentences:
How to expand the limit of screen mouse access for FPS side rotation I started coding in Godot and i have a working FPS controller but the problem is that when i move my mouse sideways , it cannot move my sight beyinid that side of my screen , in other words the movement of my charecter is limited by the size of my screen , how to prevent this
Rotation code
func _input(event):
if event is InputEventMouseMotion:
    head.rotate_y(deg2rad(event.relative.x * -mouseSensitivity))
    camera.rotate_x(deg2rad(event.relative.y * -mouseSensitivity))

sentences:
How can I draw a texture line by line I wish to draw a texture to the screen line by line (horizontal lines).
Can I do this in xna?

At first I wish to just start at the top of the texture, draw one single horizontal line of pixels and x no of milliseconds later draw the next line and so on until the texture is fully drawn.
In the future I may want to draw these horizontal lines in any order.

Any ideas how best to achieve this?

sentences:
How to make async step timing (game loop) using Box2D and C++ I'm making a game in C++ using Box2D and WebSocket++. The world needs to updated every 1/60 second. Meanwhile the WebSocket server handles players. How I should make the interval? I know there's no setInterval function in C++, but I can do something like this:

• make async function - https://stackoverflow.com/questions/33234403/using-setinterval-in-c/33234557

• make async thread - https://codereview.stackexchange.com/questions/40915/simple-multithread-timer

or maybe there's a lib?

Note: this isn't a duplicate of How should I write a main game loop? because here I need asynchronous game loop. In linked topic there are synchronous game loops.

Why I won't use while (sync loop):

commands after while (loop) are never excuted if loop is set to true.

sentences:
Distributed spawning of units I have a collision detection implemented in my game. Now I have spawning of units in a class Spawn:

public class Spawn {

    private double x;
    private double y;

    private String team;

    private String meta;

    public double getX() {
        return x;
    }

    public void setX(double x) {
        this.x = x;
    }

    public double getY() {
        return y;
    }

    public void setY(double y) {
        this.y = y;
    }

    public String getTeam() {
        return team;
    }

    public void setTeam(String team) {
        this.team = team;
    }

    public String getMeta() {
        return meta;
    }

    public void setMeta(String meta) {
        this.meta = meta;
    }

    public void spawn(AbstractActor actor) {
        actor.setPosition(new Point(x, y));

    }
}

and I call spawn() method for every unit. I have multiples spawns btw but that's not important.

However when a unit (AbstractActor) gets spawned, it's spawned on x, y. But when the second unit gets spawned it's spawned on the same location and none of these units can move (because of my collision detection implementation). AbstractActor has Point getPosition(), void setPosition(Point position), double getRadius(), which are maybe required in calculation (notice that I use radius so every unit has CircleCollider).

How would you implement spawning on different places close to the x and y. For now maximum players are 5 for one spawn but mostly 3 will be used.

Btw spawn() gets called at the beginning for every player and then if player dies after some time he respawns so the spawn() function gets called then too.

Thank You in advance for your help.

sentences: DirectX 9.0c Lights? I'm still learning DirectX from a book. It says that a graphiccards can only handle 15 lights. I'm just a bit confused , there are a lot of games using more lights, or are this just some alpha blending  tricks or what ever?

sentences:
How can I change this isometric engine to make it so that you could distinguish between blocks that are on different planes? I have been working on an isometric minecraft-esque game engine for a strategy game I plan on making. As you can see, it really needs some sort of shading. It is difficult to distinguish between separate elevations when the camera is facing away from the slope because everything is the same shade. So my question is: can I shade just a specific section of a sprite? All of those blocks are just sprites, so if I shaded the entire image, it would shade the whole block. I am using LWJGL.  Are there any other approaches to take?

Here is a screenshot from the engine:

sentences:
Gameobject not destroyed OnCollisionEnter I have this GameObject with the tag coin I am trying to destroy when the player collides with it using this code located in a player script attached to the player

    public void OnCollisionEnter(Collision col){
        var hit = col.gameObject;
        if(hit.tag == "Coin"){
            Destroy(hit.gameObject);
        }
    }

However upon collision nothing is happening

sentences:
Interactions between game objects I'm programming a basic Pacman clone to teach myself game programming. However, I'm struggling with the best way to have the game objects communicate/interact without my code becoming a huge mess.

Right now, I have a stack (implemented as a list) of objects in my base Game class. These objects include components such as Graphics, Input, etc. as well as "actual objects" such as Map, Pacman, etc. While running the game, the Game class loops through all of the objects and updates the ones which want to be updated and draws the ones which want to be drawn.

However, these objects must obviously interact. I implemented a Link function on the objects which allows one object to be "linked" to another; i.e. it gives one class a pointer to the other class so interaction can take place. For example, the Pacman class may use Link to be given a pointer to the Map class so Pacman can determine whether or not it can move in a certain direction.

With a game as simple as Pacman, this structure probably won't be too challenging to maintain, but were a game to have many interacting objects, I suspect the code would get out of hand. Is the method I am using right now alright, or should I look at another implementation of object communication? If so, what would you recommend?

I've looked at Communication between objects in games?, but whenever I try to implement the mediator pattern, I end up with a giant mediator class which is a challenge to maintain. Is the mediator pattern what I should be using?

sentences:
Is there a way to keep the mesh collider when updating objects in Unity? I have a 3D object as an imported asset in Unity which i want to make updates to in Maya.
The asset get's updated automatically in Unity when i save the object in Maya - but not in the project hierarchy where i have placed it in the scene.

Is there a way to keep the object with it's mesh collider when the model is updated without having to re-create it in the hierarchy for every iteration?

sentences:
How to set a body to a specific position using Andengine I'm developing a game with a single player and multiplayer mode. Lets say I have walls (static bodies), vehicles (dynamic bodies) and bullets (dynamic bodies).

It works fine to control my own vehicle using vehicleBody.setLinearVelocity(velocityX, velocityY);. The vehicle can collide with walls and bullets as expected.
Now I like to move the enemy vehicles in multiplayer mode. When I use the same method to move the body by its velocity values (in multiplayer mode), the vehicles get out of sync really quickly, means they don't have the same position on all devices because some data packages get lost.

What I'm currently doing is the following:

On device #1:

1) I move the body using setLinearVelocity

2) Then I get the X and Y position of the body and send a data package to the other device

On device #2:

3) I receive the data package and set the position of the body. I tried different ways, hopefully you can tell me the best way or alternatives I did not try yet:

using vehicleBody.setTransform(...):

activity.runOnUpdateThread(new Runnable() {
    @Override
    public void run() {
        vehicleBody.setTransform(new Vector2(newPosX, newPosY), angle);
    }
});

I also tried using MouseJoint (based on that tutorial),
    but somehow the body was bouncing randomly to the next position. Sometimes it was working great, but when I restarted the game the vehicle of the enemy started bouncing again. Maybe I failed to setup the parameters. Here is what I used:

public MouseJoint createMouseJoint(float newPosX, float newPosY) {
    final float PIXEL_TO_METER_RATIO = PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT;
    Vector2 v = vehicleBody.getWorldPoint(
            new Vector2(newPosX / PIXEL_TO_METER_RATIO, newPosY / PIXEL_TO_METER_RATIO));

    MouseJointDef mjd = new MouseJointDef();
    mjd.bodyA = groundBody;
    mjd.bodyB = vehicleBody;
    mjd.dampingRatio = 0.2f;
    mjd.frequencyHz = 30;
    mjd.maxForce = (float) (1000.0f * vehicleBody.getMass());
    mjd.collideConnected = true;
    mjd.target.set(v);

    return (MouseJoint) mScene.mPhysicsWorld.createJoint(mjd);
}

Before I've used bodies I was using simple sprites and it worked perfectly. I sent data packages to the other device(s) and set the position and rotation of the enemy vehicle by using vehicleSprite.setX(newPosX), vehicleSprite.setY(newPosY) and vehicleSprite.setRotation(angle). Compared to that, bodies seem to be very complicated. So how I can I keep positions synced without bouncing?

By the way, on some pages I read about using KinematicBody instead of DynamicBody for a vehicle. What is the advantage? My vehicle needs to collide with the environment, so I think DynamicBody is the correct choice, isn't it?

sentences:
Need Guidance Making HTML5 Canvas Game Engine So I have some free time this winter break and want to build a simple 2d HTML5 canvas game engine. Mostly a physics engine that will dictate the way objects move and interact(collisions, etc). I made a basic game here:

http://caidenhome.com/HTML%205/pong.html

and would like to make more, and thought that this would be a good reason to make a simple framework for this stuff. Here are some questions:

Does the scripting language have to be Javascript? What about Ruby? I will probably write it with jQuery because of the selecting powers, but I'm curious either way.
Are there any great guides you guys know of? I want a fast guide that will help me bust out this engine sometime in the next 2 weeks, hopefully sooner.
What are some good conventions I should be aware of?
What's the best way to get sound? At the moment I'm using something like this:

var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'paddle_col.wav');
audioElement.load();

I'm interested in making this engine lightweight and extremely efficient, I will do whatever it takes to get great speeds and processing power. I know this question is fairly vague, but I just need a push in the right direction.

Thanks :)

sentences: What is a "cue" in the XACT API? I understand that a wave bank is a collection of .wav data files and that a sound bank is a collection of tracks, each having a .wav with properties. But what is a cue?

sentences:
What are the implications of using multiple OpenGL Contexts on a single thread? I'm trying to integrate two third-party OpenGL rendering pipelines into the same application, namely Cinder's OpenGL API for 3D drawing and backbuffer rendering, and Google Skia's API for 2D drawing. Unfortunately, Skia tends to trigger a lot of GL state changes in general use, and offers no functionality to reset the GL state. To make matters worse, Cinder (GLNext branch) tries to keep an internal record of all of its GL state changes so that they can be easily 'unwound', but bad things can happen if its internal representation becomes different from the actual GL state.

The easiest way to alleviate these problems was to create a new OpenGL context for use exclusively by Skia, performing context switches only when 2D updates were necessary. However, I've noticed some weird behaviours when I'm required to switch context more frequently, like certain draw calls failing or blend states flickering. Everything I've read about GL contexts indicates that they're meant for use in multiple threads or multiple windows. I've also read about context switches failing in certain circumstances? Is there anything terribly wrong with switching context in a single-threaded, single-windowed application?

sentences:
I'm looking for a C++/OpenGL/SDL game engine tutorial I have a decent knowledge of SDL, OpenGL and FMOD. I am looking for a recent tutorial or book on the basics of making a game engine. Most of the book and tutorial I found are using old dead library like glut and glaux or simply outdated like NeHe tutorial.

The one thing I would really like to understand is the structure and how everything is linked together.

I do not want to use a tutorial to copy it or anything else like that but simply to understand the structure behind it. No server stuff.

I would really appreciate if the tutorial/book use OpenGL and SDL because I really love to use them.

sentences:
Handling damage taken by enemy I'm learning the basics of combat system by doing it myself, but there is a logical problem I can't figure out. It's on Unity2D, using C#.

Collider2D[] enemiesToDamage = Physics2D.OverlapCircleAll(attackPosition.position, attackRange, attackableLayer);
            for (int i = 0; i < enemiesToDamage.Length; i++)
            {
                enemiesToDamage[i].GetComponent<DamageEnemy>().TakeDamage(damage);
            }

This is what my attack function looks like, this script is assigned to every enemy in my game and functions properly. But the problem is I want to assign every enemy a unique function whenever they take damage, like jumping back or flying away, and I can't do it in one script. What do I do?

sentences:
Storing visibility graph for path-finding: do redundant and non-visible pairs of points have to be saved? Using C# in Unity, I have recently implemented an algorithm that determines during run-time the visibility graph of a given scene in my game project (visibility between corners of obstacles). Now I am in doubt about the best way to save the result.

So, considering that I want the visibility graph for path-finding, I would like to know the following:

1) Suppose that points A and B are visible to each other. Then, AB and BA both detect the same visibility line. It happens to all mutually visible pairs in my case. So, in order to perform an A* algorithm do I really need all these redundant pairs or can I get rid of the redundant ones, leaving only AB or only BA?

2) Now suppose that points A and C are NOT visible to each other. Do I have to save AC and/or CA? It is, to apply an A* algorithm do I have to save pairs of points that are not visible?

I ask that because if the answer to both questions is "yes", then the final array storing the graph becomes NxN, where N is the number of points (corners of obstacles) in the scene, with each cell holding the value 0 for non-visible pairs or a value equal to the distance between each visible pairs. I think technically it is called an Adjacency Matrix.

However, if the answer to any or to both of these questions is "no", then I would be able to save a lot of memory because the final results would require a much smaller array. The reason is that I would then not save redundancy and also most points are not visible to each other (it's technically a non-dense graph), so they would not be included.

But I am not sure I can go that route for path-finding. So, in case the answer to any of the 2 questions above is "no", what is the logical format I should use for saving the results, in order to perform an A* algorithm in the visibility points?

Many thanks for your time.

sentences:
Box 2D Collision Question I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic.

The whole Scenario is explained below:
I have 3 balls in total. I want to balls to remain in their places and the third ball to be able to move. When the third ball hits the other two balls then they should move according to the speed and direction from which they were hit.
My gravity of the world is 0 because I only want z-axis gravity.

I would also like some one to point me towards some good tutorials regarding Box 2D basics which is language independent.

I hope I have explained my scenario well.

Thanks for the help in advance.

sentences:
Level Design: Char Traveling to and from a Site I'm developing a 2d platformer game where your character can travel to and from sites as he pleases. To travel to and from these sites the character must travel along a path between his current location and his destination (see illustration below).

And of course the idea is that you can travel through the level backwards if you wish to return to Site One. But as you probably realize, doing this may provoke some serious problems, and will put limitations on the level design (no cliffs or long drops because then your character wouldn't be able to overcome them on the way back). I've come up with multiple ways to overcome this (such as designing two levels for the same path etc), but I was wondering if anyone else has any creative work-arounds for this problem. Any help and advice is appreciated.

sentences:
How can I remap Unreal's Editor default movement (WASD) keys for a non-QWERTY keyboard I am using a French (AZERTY) keyboard, and as such my "usual" game movment keys are ZQSD instead of WASD. I have been trying to change Unreal Editor's default keys to those I am accustomed to but I can't figure out how to do it.

Using UE 4.19.1

Here are the settings I've tried so far:

sentences:
terrain not properly rendering I'm extending the terrain quad with resources from various tutorials and have the following code:

public class WorldTerrain extends TerrainQuad {

    public static final String NAME = "terrain";
    public static final int PATCH_SIZE = 9;
    public static final int TOTAL_SIZE = 33;
    private static Vector3f spawnLocation = new Vector3f(13, 3, 16);
    private Material mat_terrain;

    private void loadText(AssetManager assetManager) {
        /**
         * 1. Create terrain material and load four textures into it.
         */
        mat_terrain = new Material(assetManager,
                "Common/MatDefs/Terrain/Terrain.j3md");

        /**
         * 1.1) Add ALPHA map (for red-blue-green coded splat textures)
         */
        mat_terrain.setTexture("Alpha", assetManager.loadTexture(
                "Textures/Terrain/splat/alphamap.png"));

        /**
         * 1.2) Add GRASS texture into the red layer (Tex1).
         */
        Texture grass = assetManager.loadTexture(
                "Textures/Terrain/splat/grass.jpg");
        grass.setWrap(WrapMode.Repeat);
        mat_terrain.setTexture("Tex1", grass);
        mat_terrain.setFloat("Tex1Scale", 64f);

        /**
         * 1.3) Add DIRT texture into the green layer (Tex2)
         */
        Texture dirt = assetManager.loadTexture(
                "Textures/GrassRocky.png");
        dirt.setWrap(WrapMode.Repeat);
        mat_terrain.setTexture("Tex2", dirt);
        mat_terrain.setFloat("Tex2Scale", 32f);

        /**
         * 1.4) Add ROAD texture into the blue layer (Tex3)
         */
        Texture rock = assetManager.loadTexture(
                "Textures/Terrain/splat/road.jpg");
        rock.setWrap(WrapMode.Repeat);
        mat_terrain.setTexture("Tex3", rock);
        mat_terrain.setFloat("Tex3Scale", 128f);
    }

    private static float[] generateHeightMap(AssetManager assetManager) {
        AbstractHeightMap heightmap = null;
        try {
            heightmap = new HillHeightMap(1024, 100, 2, 10, 1);
        } catch (Exception ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        }
        return heightmap.getHeightMap();
    }

    public static Vector3f getSpawnLocation() {
        return spawnLocation;
    }

    public WorldTerrain(Interface app) {
        super(NAME, PATCH_SIZE, TOTAL_SIZE, generateHeightMap(app.getAssetManager()));
        loadText(app.getAssetManager());
        setMaterial(mat_terrain);

        setModelBound(new BoundingBox());
        setLocalTranslation(32f, 0f, 32f);

        List<Camera> cameras = new ArrayList<Camera>();
        cameras.add(app.getCamera());

        RigidBodyControl landscape = new RigidBodyControl(0.0f);
        addControl(landscape);

and the interface:

public class Interface extends SimpleApplication {

  private TerrainQuad terrain;
  Material mat_terrain;

  public static void main(String[] args) {
    Interface app = new Interface();
    app.start();
  }

  @Override
  public void simpleInitApp() {
    flyCam.setMoveSpeed(50);

    terrain = new WorldTerrain(this);
    rootNode.attachChild(terrain);
  }

This gives the following result:

as you can see large parts of the terrain are not rendering (ignore the weird mountains those are only tests). If I move the camera around these holes move around suggesting it's a rendering problem in the terrain. Anybody who knows how to fix?

sentences:
Duration in ScaleModifier andengine I want to scale an image before screen resume in AndEngine so I have applied the following code to my sprite:

ScaleModifier scaleDrag1 = new ScaleModifier(1, 1, 0.7f);

drag1.registerEntityModifier(scaleDrag1);

But my issue is that the scaled image is shown when the screen resumes because of the 1 duration. It makes my sprite scale after the screen resume so the scaling is visible to the user, I tried setting the duration to 0 but then that sprite is not shown.

Can anyone tell me what should I do to scale image before resume in AndEngine.

sentences:
Unity Anima2D - IK Limb for leg not working I'm having an issue getting an IK limb to work using Anima2D in Unity. If I place a limb IK for the neck joint, the head moves as expected, however trying to place one for the leg seems to have no effect.

A CCD IK seems to work, but only moving one bone of the leg, whereas I need both bones to move, like a real limb with a knee joint.

Is there anything obvious I'm doing wrong?

Thanks!

sentences:
How can I move an object around a canvas in a random direction at random times? I am currently trying to move an object (circle ball) around the canvas in a random direction.

I have already written the code for the wall collisions so the ball bounces back into canvas when the ball hits any of the canvas sides.

The canvas size is 600 x 500

in order to move the object around the canvas I have used;

   xPosition += ySpeed;
   yPosition += ySpeed;

From the code above, the ball moves from one end to the other end of the canvas in the same angle and direction, then bounces back at a different angle.

How can I go about doing this, if I wanted my object to move in the same speed but in a random direction around the canvas.

Any help is appreciated, thanks!

sentences:
Is there any way in game maker to pass argument parameters to strings executed via the execute_string() function of version 8.0 (pre-studio)? Last I checked, the game I'm modding was compiled* using Game Maker 8.0

So for a little set up, here is my situation. There's a game out there which has a box in which you can enter a string and it executes it. I decided to try and mod the game through use of this cheat box along with some other objects which execute strings and whatnot.

In general, this is all essentially powered by the built-in function 'execute_string'. My main problem is that as far as I know one cannot pass arguments to these executed strings, which is essential to anything complicated** I might wish to do.

I know there is a similar function called execute_script which allows for argument parameters to be passed into the code being executed. However, adding scripts as rescources is one of the many things that get "flushed" out of memory when saving/loading using the default save system. I am definitely not interested in reloading code from files on the fly and I don't want to make my own save system (which would still require code to be loaded from files) as I would prefer to basically have to use a save file and a few 3D model/image files to send the mod to anyone else who might be interested in it. I could also send the raw source, but regardless I don't want a lot of unstable resource manipulation.

  So basically, is there a way for me to pass arguments into the code being executed with "execute_string" without having to implement my own function stack memory space and do the pushing and popping of arguments manually?

*The game was made many years ago in game maker 6.0. I believe it was recompiled for efficiency purposes.

**For instance, a very common technique to make some more complicated enemies or buildings is to make your own dynamic memory allocator using an array as a virtual memory space and use the interfaces of raw memory allocation to build lists and trees or whatever else you need. That is definitely something which requires a lot of different function calls.

sentences:
Snake4d - a 4 spatial dimensional game I wrote a little 4 spatial dimension game, it's a 4D snake. The rule are the same as the game for the old Nokia cell phone - eat the food, don't cross yourself, don't go out of the borders.

What do you think of the idea? How do I make a better graphic of the UI? Do you have any suggestion? Like this actually seem a DOS game ...

Here is a little explanatory video: http://www.youtube.com/watch?v=8IUnqm8j4BE

And here there is a new version I did with OpenGL and C++: http://www.youtube.com/watch?v=NaeqUp3jbls

Moreover I have a question, which from the two representation above you like more? Or better, do you have any idea how to represent the 4 dimension at the best?

Btw any comments, suggestions, and questions are appreciated about the UI, the game concept, etc.

sentences:
How can I tell a fragment shader to not write a particular pixel? In a WebGL I'd like to send a screen space quad through that gets processed by a fragment shader, but have the fragment shader only write out a pixel under certain conditions (say... that it was within a circle, or that the pixel belonged to the positive side of a halfspace defined by a curve equation or something).

Is it possible within a fragment shader to say "don't write a pixel"?

I know this could be accomplished using various other methods like alpha blending, rendering this first and having it put the background color where it doesn't want to draw a pixel, or maybe doing some trick with the depth or stencil buffers.  I also know i could create a bunch of geometry to match what it is that I want to render.

Is there a way though to make the fragment shader choose not to write a pixel at all?

sentences:
Composition heavy OOP vs pure entity component systems? I admit, I have made the sin of overusing, and even abusing inheritance. The first (text) game project that I made when I was taking my OOP course went as far as "Locked door" and "unlocked door" from "Door" and "Room with one door", "Room with two doors", and so on from "Room".

With the (graphical) game I worked on recently, I thought I had learned my lesson and put a limit on using inheritance. However I noticed the problems soon beginning to appear. My root class was beginning to bloat more and more, and my leaf classes were full of duplicate codes.

I thought I was still doing things wrong, and after looking it up online I discovered that I wasn't the only one with this problem. It's how I ended up discovering Entity systems after some thorough research (read: googlefu)

When I began reading on it, I was able to see how clearly it was able to solve the problems I was having with the traditional OOP hierarchy with components. These were in the first readings however. When I stumbled upon more… “radical” ES approaches, such as the one at T-machine.

I began disagreeing with the methods they were using. A pure component system seemed either overkill, or rather, unintuitive, which is probably the strength of OOP. The author goes so far as to say that ES system is the opposite of OOP, and while it may be usable along OOP, it really shouldn’t. I'm not saying it's wrong, but I just didn't feel like a solution I would like to implement.

So to me, and to solve the problems I was having at the beginning of the post, without going against my intuitions, is to still use a hierarchy, however it won’t be a monolithic hierarchy like the ones I used before, but rather a polylithic one (I couldn’t find a word opposite to monolithic), which consists of several, smaller trees.

The following example shows what I mean (this is inspired by an example I found in Game Engine Architecture, Chapter 14).

I would have a small tree for vehicles. The root vehicle class would have a rendering component, a collision component, position component etc..

Then a tank, a subclass of vehicle would inherit those components from it, and be given it's own "cannon" component.

The same goes for the Characters. A character would have it's own components, then the Player Class would inherit it, and be given an Input controller, while other enemy classes would inherit from the Character class and be given an AI controller.

I don't really see any problems with this design. Despite not using a pure Entity Controller System, the problem with the bubbling up effect, and the large root class is solved by using a multi-tree hierarchy, and the problem of the heavy, code duplicating leafs is gone since the leafs don't have any code to begin with, just components. If a change needs to be done to the leaf level, then it's as simple as changing a single component, instead of copy pasting the code everywhere.

Of course, being as inexperienced as I am, I did not see any problems when I first started using the single hierarchy, inheritance heavy model, so if there are problems with the model that I'm currently thinking of implementing, I wouldn't be able to see it.

Your opinions?

P.S: I am using Java, so using multiple inheritance to implement this instead of using normal components is not possible.

P.P.S: Intercomponent communications will be done by linking dependent components to each other. This will lead to coupling, but I think it's an ok trade off.

sentences:
Why code reflection became a must in game engines? I'm currently doing some research on programming languages(compile time reflection area, if you ask) and I found that on the game engine area the reflection feature becomes a must, an engine either uses a language which has reflection feature itself(for example uses C#), or implements it for non-reflection languages(for example both UE and CryEngine implement reflection mechanisms for C++).

I'm not a game developer, so I have no experiences on game developing and not familiar with engines, so can anyone tell me in what case the reflection becomes a must? And what's more, does reflection used only in development phase or also used in released production?

sentences:
How to scale-to-fit OGL viewport to GLFW window? Say my window is 1280x720. I want to render my stuff to lower resolution and then stretch it to window. I've tried this:

glViewport(0, 0, 1280 / 2, 720 / 2);

When I call glViewport and pass lesser width and height than window, I get all my OpenGL rendering in left bottom 1/4 of window. I need to scale it (linear filtering preferably) back to window size so I would get a pixelated effect.

I wonder if there is such possibility within glad/glfw API.

sentences:
Attach component of other Object to a variable within Unity Inspector This question might sound a bit stupid and I'm sure there is a simple solution for this .. I'm just not finding it:

Actually all I want to do is attach the MeshRenderer Component of this Object

to a variable of a script on another Object like

Problem: As soon as you click on the Capsule Object ofcourse the Inspector changes to this Object and I cannot drag in a component to the previous selected Object anymore.

I know there are a lot alternatives like linkin only the GameObject e.g. as MeshObject and later in code refer to MeshObject.GetComponent<MeshRenderer> but I wondered if this can be done directly, too.

sentences: Runtime resolution changing with GLFW3 I've been trying to figure out the correct method for changing the resolution/fullscreen state of a GLFW window for a while now, but after searching all I found were references of how to do it with older versions of the library such as this. I suspect you'd just destroy the window object and re-create it, but was not sure because of how some functions such as glfwSetKeyCallback take a GLFWwindow* as a parameter, and I don't know if that'd continue to work after it has been re-created. The documentation also does not have any examples on doing such a thing, so any help would be appreciated.

sentences: b2DistanceJoint with frequency equal to 0 vs b2WeldJoint What is the difference of b2WeldJoint and b2DistanceJoint? They both have frequency and also when you put frequency of Distance Joint to 0 it acts like Weld Joint. It seams that you can create Distance Joint effect using Weld Jonit and vice versa.

sentences:
Conceptual - What is the optimal way to combine steering behaviors with rigid body physics? I am working on a simple 3D space simulator that makes use of the Bullet physics engine. The spaceships are rigid bodies that have a mass and hitbox so that they can be considered for collisions. At the same time, I am trying to implement simple steering A.I. as detailed in numerous tutorials across the web. However, all of these tutorials assume zero-size points in 2D space with no orientation.

For the most part, I have succeeded in implementing the behaviors by applying a force to the rigid body in the direction of desired steering. The spaceship moves, turns, and accelerates smoothly and correctly navigates to the desired position in 3D space:

currentVelocity = body.getLinearVelocity();
tempVector = body.getWorldTransform().getTranslation();
desiredVelocity = targetPosition.sub(tempVector).normalize().scale(maxVelocity);
steeringForce = desiredVelocity.sub(currentVelocity);

body.setGravity(steeringForce); *[see footnote]

However, the spaceship does not change its orientation at all. The problem I am trying to solve is simple - to make the spaceship face in the direction that it is currently travelling.

From my research, it seems that simply setting the orientation of the object to face the direction of its velocity is really bad when using a physics engine because it may cause a rigid body to become stuck inside another one. On the other hand, using a more realistic navigation system based on thrusters is prohibitively (and needlessly) complex because the number of spaceships will be very high.

What is the best way of overcoming this problem?

Edit: Also of note is that the Bullet physics library does not allow setting the orientation of a body.

**Note: I used the function setGravity() instead of applyForce() as suggested by an admin at the Bullet physics forums because applying a force is dependent upon frame-rate. On the other hand, gravity is applied evenly according to Bullet's simulation steps, not to mention that gravity otherwise unused in a space simulator.*

sentences:
Cube doesn't render as expected when rotated (representing 3D in 2D) Cube.

When I rotate the object around OZ moves to the left.

Rotation around OX - the cube rises up.

Rotation around the OY-the cube is compressed.

The function I use for rotation:

void rotation(double angleX, double angleY, double angleZ, int x, int y, int z)
{
    angleX = angleX * M_PI / 180;
    angleY = angleY * M_PI / 180;
    angleZ = angleZ * M_PI / 180;

    double cX = cos(angleX);
    double sX = sin(angleX);
    double cY = cos(angleY);
    double sY = sin(angleY);
    double cZ = cos(angleZ);
    double sZ = sin(angleZ);

    double x0 = x;
    double y0 = y * cX + z * sX;
    double z0 = z * cX - y * sX;

    double x1 = x0 * cY - z0 * sY;
    double y1 = y0;
    double z1 = z0 * cY + x0 * sY;

    double x2 = x1 * cZ + y1 * sZ;
    double y2 = y1 * cZ - x1 * sZ;

    SDL_RenderDrawPoint(ren, x2, y2);
}

Used matrices. However, the result was the same.

sentences:
Switching renderer off/on for an object in unity using C# I have a GameObject called 'Stone' that is rendered on Game Play. I have attached a C# script called RenderOff to to make 'Stone' invisible on Game Play.

RenderOff.cs

using UnityEngine;
using System.Collections;

public class RenderOff : MonoBehaviour {

    void Start () {

        this.gameobject.renderer.enabled = false;

    }

}

It has errors - Type 'RenderOff' does not contain a definition for gameobject' and no extension methodgameobject' of type `RenderOff' could be found.

What does that mean ?

sentences:
2d top-down map: normalisation or not? I am an absolute beginner with game programming, should this question be poorly formulated, be aware it was not sloppiness by my side, but lack of game programming experience.

The game I am planning to code will use a top-down 2D map as "world". The world might be larger than the window (the window can zoom in or out) and the vehicles can be located at any point of the world (= it's not a tiled map, the space is "continuous").

To clarify with an example: if the world is a terrain of 1000x1000 metres, a vehicle could be at location (327.31, 720.4) metres.

My question is: what is the most convenient way to represent the world internally? I could think to these possibilities:

do nothing and use metres as if I were working with the physical object,
normalise to pixels defining the world size as the number of pixels for representing 1000 metres at maximum zoom,
normalise to 1 defining the word as a square of size 1

...but I am sure there might be some other ones / some of mine could make no sense. It's just that being my first game I don't have a clear pictures of the problems ahead of me, and I would like some guidance in making a reasonably correct initial choice.

Thank you for your time.

sentences:
Efficient system to reach the "parent" variable I've been stuck doing this in a very inefficient way and really want to know if there's some design pattern that solves this because it seems like a pretty common problem to have.

I have a system where I have a "world" class then that class has a list of town objects then the town has a list of buildings and buildings have a family. It's simple to for example, know what buildings a town has since the towns have all buildings in a list but what I always end up needing is a way for the building to know what town it is in for example. This can be done by giving buildings a town variable to keep that saved but I have to keep making sure that gets set properly for every stage in the chain which makes a mess of the code. It also messed up saving cause it saved a building in the town's building list but when saving the buildings data, had to save the town's data again since the building has that variable, creating a loop.

I've also tried making static methods that can be reached anywhere that say, a building can use and it will search through all towns until it finds where the building belongs, but that seems very inefficient to me and I've heard the same from others.

Lastly I've tried giving all of these things an ID but that still makes them have to search what "parent" has their ID.

Is there some way of doing this a more correct way? I have a hard time finding good search terms for it so I finally decided to just ask for guidance.

sentences:
Windows 10 User has only DX 10.1 API A user of ours has an issue whereby they cannot run our application, which requires DX11 API support and hardware support for DX10.1. The strange this about this issue is that the user is running Windows 10, having upgraded from Vista(!).
His DXDiag output looks like this:
         Operating System: Windows 10 Pro 64-bit (10.0, Build 10240) (10240.th1.150930-1750)
             Language: English (Regional Setting: English)
  System Manufacturer: Dell Inc.
         System Model: Studio 1747
                 BIOS: Default System BIOS
            Processor: Intel(R) Core(TM) i7 CPU       Q 720  @ 1.60GHz (8 CPUs), ~1.6GHz
               Memory: 4096MB RAM
  Available OS Memory: 4084MB RAM
            Page File: 3956MB used, 3839MB available
          Windows Dir: C:\WINDOWS
      DirectX Version: 10.1

...

---------------
Display Devices
---------------
      Card name: ATI Mobility Radeon HD 4650
   Manufacturer: Advanced Micro Devices, Inc.
      Chip type: ATI display adapter (0x9480)
       DAC type: Internal DAC(400MHz)
    Device Type: Full Device
     Device Key: Enum\PCI\VEN_1002&DEV_9480&SUBSYS_02EB1028&REV_00
 Display Memory: 2809 MB
 Dedicated Memory: 1017 MB
  Shared Memory: 1792 MB
   Current Mode: 1600 x 900 (32 bit) (60Hz)
   Monitor Name: Generic PnP Monitor
  Monitor Model: unknown
     Monitor Id: SEC544B
    Native Mode: 1600 x 900(p) (60.209Hz)
    Output Type: Internal
    Driver Name: aticfx64.dll,aticfx64.dll,aticfx32,aticfx32,atiumd64.dll,atidxx64.dll,atiumdag,atidxx32,atiumdva,atiumd6a.cap,atitmm64.dll
Driver File Version: 8.17.0010.1129 (English)
 Driver Version: 8.970.100.9001
    DDI Version: 10.1
 Feature Levels: 10.1,10.0,9.3,9.2,9.1
   Driver Model: WDDM 1.1
Graphics Preemption: DMA
 Compute Preemption: DMA
       Miracast: Not Supported
Hybrid Graphics GPU: Not Applicable
 Power P-states: Not Applicable
Driver Attributes: Final Retail
Driver Date/Size: 1/13/2015 17:45:56, 1094024 bytes

I am by no means a DirectX expert, but my understanding was that all post W7 OS's had DX11+ support baked in to the operating system, and that updates are provided via Windows Update. I've never seen this particular issue before, and am not sure what the next step is. The user says that they are fully up to date wrt Windows Update.
Just to clarify a little more, here is a quote from a Q&A on the steam site:

DirectX has two components - the API on the computer (the software) and the GPU (the hardware). You need both to have "support" for a specific DirectX version. What you get when you look at DxDiag is the API version installed on your operating system. It gives you the software. This number is useless if you don't have the equal number for your hardware.
DirectX 11 API (the software) comes standard with Windows 7 and Windows 8.

The issue we are having is that we use the DX11 API via SharpDX, and use feature level 10.1. So we need the DX11 API, which we had assumed was always available for > W7. It seems that this is not the case for this user, and it's the first time we have seen this.

sentences:
How do I render a PNG image with OpenGL? I have an image (100×200 px) painted with Paint.NET and saved as a .png with 32-bit color depth. How can I render it using OpenGL 1.1  (with the LWJGL binding) or higher inside the display?

I tried creating a ByteBuffer, then loading the pixel color values inside that buffer, but I'm missing the OpenGL settings that need to be enabled. Some help?

sentences:
XNA Multisampling only for 3D I am working on a game which consists of 3D elements and a 2D GUI. I have it working properly, but I want to enable multisampling for only the 3D parts, and not the 2D Textures. Otherwise, the GUI icons become blurred.

Here is the code for my Draw method

    protected override void Draw(GameTime gameTime)
    {
        graphics.PreferMultiSampling = true;
        graphics.ApplyChanges();

        GraphicsDevice.Clear(Color.Black);

        GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
        GraphicsDevice.DepthStencilState = DepthStencilState.Default;

        foreach (Element e in Elements)// 3D part
        {
            e.Draw(GraphicsDevice, camera);
        }

        graphics.PreferMultiSampling = false;
        graphics.ApplyChanges();

        spriteBatch.Begin();
        UIM.Draw(GraphicsDevice, spriteBatch);
        spriteBatch.End();//

        base.Draw(gameTime);
    }

Using this code, I get an exception because all of my Texture2Ds dispose for some reason.

Is there a way to change the MultiSampling in the middle of the Draw method?

sentences:
How to draw a sprite at a floating point xy coordinate with interlaced drawing? I have a 2D game made in MonoGame (XNA 4.0 framework). Here's what I want to do:

draw a 2d image at a floating point xy coordinate such as 125.5, 300.12 (and do NOT round them to an int).
the image is automatically "interlaced", which means the picture is shaded correctly around the borders so that it looks like it's actually a fraction of the way across pixels, and not aligned exactly on pixels.

How do I do this? Is there a standard library for this?

P.S. the game I'm working on eventually needs to work on Mac and Linux as well, so please don't give me any dead-end solutions.

sentences:
Why loss of floating point precision makes rendered objects vibrate? I'm working on an open-world game. I noticed glitches when I move far away from the origin. The objects seem to be shaking or wiggle. Especially the z-fighting seems to wiggle. And the objects that move. If I understand correctly this is caused by floating point precision problems. Currently I'm using floats for everything on CPU side and in shaders, I don't use doubles.

Before I try to come up with a solution I want to understand how does float imprecision lead to objects shaking on the screen. (Why do they shake instead of disappearing or stopping or something?) And where does the error come from: the calculations on CPU side (camera movement / physics calculations of objects) or calculations on GPU side (transform in shaders / depth-buffer not being precise enough)? Why do objects not shake when they are far away from the camera?

(I asked this before but realized my question was very broad, I wanted to be more specific.)

sentences:
Android Studio libgdx multiplayer Does anyone know if it's possible to setup a multiplayer game using libgdx in Android Studio?

I've been trying to convert my game to multiplayer using all kinds of tutorials on libgdx & multiplayer but I'm guessing it's just not possible with android Studio. Seems it's only possible to add leaderboard and achievements?

If someone managed to get multiplayer working with libgdx in Android Studio please let me know. And perhaps explain how to get it working?

If someone knows it's impossible please let me know as well.

If impossible, is it worth trying eclipse? Since it's not supported by Google anymore...???

Thnx in advanced

sentences:
Unity Can't adjust firing rate I need to be able to control the speed in which the gun fires.
I'm trying to use the couroutine to limit the speed of update method but it doesn't work for some reason.

I've tried several fireRate values(10K etc.), none of them seem to slow the updates. How can I accomplish this feat?

 float fireRate = 10.1f;

        public IEnumerator CheckFireRate()
        {
            yield return new WaitForSeconds(fireRate);
        }

        void Update()
        {
            StartCoroutine(CheckFireRate());
            //Fire gun
        }

sentences:
Tips on how to architect your JavaScript game with classes OK, so I'm creating a <canvas> game using JavaScript (ES6+) features like Classes. It's straight from the vue-cli and webpack.

So, I have these Classes with the following (and such) variables

class Player {
    this.x = 1;
    this.y = 5;
    this.name = 'Guy';
    this.stats = [];
}

class Map {
    this.level = 1;
    this.config = {};
    this.images = Image();
    this.canvas = null;
    this.context = null;
    this.board = []; // From a tileset
}

// POINT OF ENTRY STARTS HERE
// const game = new Game();
class Game {
    this.map = null;
    this.player = null;
    this.assets = Images();
}

The problem I'm having is that sometimes, I'm having to access a created object that was instantiated elsewhere.

For example, this.player was instantiated inside the Game class. But in the Map class, I have the drawMouseSelection method where it needs the current Player's X and Y and Map's board array of tiles.

For example, I pass the all of board[2500] to a static helper method in UI class to get the correct tile hovered on.

** What I am doing**

I just pass the whole object and deal with it as such. Am I passing too big of objects?

sentences:
Doing powerups in a component-based system I'm just starting really getting my head around component based design.  I don't know what the "right" way to do this is.
Here's the scenario.  The player can equip a shield.  The the shield is drawn as bubble around the player, it has a separate collision shape, and reduces the damage the player receives from area effects.
How is such a shield architected in a component based game?
Where I get confused is that the shield obviously has three components associated with it.

Damage reduction / filtering
A sprite
A collider.

To make it worse different shield variations could have even more behaviors, all of which could be components:

boost player maximum health
health regen
projectile deflection
etc

Am I overthinking this?  Should the shield just be a super component?
I really think this is wrong answer.  So if you think this is the way to go please explain.

Should the shield be its own entity that tracks the location of the player?
That might make it hard to implement the damage filtering.  It also kinda blurs the lines between attached components and entities.

Should the shield be a component that houses other components?
I've never seen or heard of anything like this, but maybe it's common and I'm just not deep enough yet.

Should the shield just be a set of components that get added to the player?
Possibly with an extra component to manage the others, e.g. so they can all be removed as a group.  (accidentally leave behind the damage reduction component, now that would be fun).

Something else that's obvious to someone with more component experience?

sentences:
Tips for implementing MMO quest mechanics? What tools, patterns, or best practices would you recommend to implement the quest mechanics given below listed requirements?

I am talking about software architecture (how generic should you be) and choices for object wiring, event subscription, and representation of conditions. Mentioning of tools / libraries you have successfully used are welcome.
Edit: If you are using scripting, what setup do you recommend?

Requirements:

simple 2D mmo(rpg)
all the game data, including quests, is stored in a relational database
any event in the game could trigger a new quest for players or advancement of existing quests
a quest can have an arbitrary number of conditions that must be met before the quest is available to players
a quest can consist of an arbitrary number of sub-quests / steps with arbitrary conditions
quests would range from simple:

talk to A - kill 5 B - talk to A - permanently increase health
to quite involved:

use item in area X - go to area Y - a bot will spawn - kill bot without taking more than 10% damage - bot drops item - pick up item - portal unlocks - deliver item to J behind the portal - receive gold and experience - allow to pass portal once more - lock portal for this player
level instances are a possibility (players can complete certain quests in teams or isolation which will spawn the level location just for those participants)
Quests should preferably be manageable using a world editor without scripting or programming knowledge (Edit: not advocating against scripting in general though)
I assume C++ as the language of implementation

I was thinking that if I could combine any chain of events and conditions we could model more complex and thus possibly more engaging quests.
I experimented with rolling my own ECA (Events-Conditions-Actions) engine but that might be overkill. It has been particularly difficult to model generic conditions without using any sort of scripting.

sentences:
How to reproduce the 3ds Max Gradient Ramp effect? The material definition of a mesh is composed of these three components: Self-Illumunation, Refletcion and Refraction. Each of these components has a Gradient Ramp as a map and the mapping mode is set to spherical environment.
I'm searching for a way to reproduce these effects in a shader (the shader language doesn't matter). Is it possible?

My first idea was to save the Gradient Ramp as a texture: you can see the result in the image below (reflection component):

and using them in the shader through environment spherical mapping, but the result is wrong.

In this image you can see the original rendering (3ds Max, reflection component):

and in this image you can see my rendering:

The underlying idea seems to be correct, in fact there's a correlation between the two images but something goes wrong.

Thanks for any suggestion.

sentences:
How to generate an explosion? I'm currently working in an Angry Bird-esque game, where the user flings a bomb at buildings and the bomb explodes.

How do I create explosions in Corona? Essentially some sort of area of effect explosion should occur on collision, which pushes all the elements within the area out of the way (this could probably be done with applyForce)

I've tried the following, but left me with lackluster results:

function setExplosion(self, event)
    event.other:applyForce(300, 300, circle.x + (circle.width/2), circle.y + (circle.height/2))
end

Note that the circle is the explosion radius.

Anybody have any tips on creating explosions?

EDIT:

function setExplosion(self, event)
    event.other:applyForce(500, 500, circle.x + (circle.width/2), circle.y + (circle.height/2))
end

function drawExplosion(eventX, eventY)
    return function()
        circle = display.newCircle( eventX +20, eventY +20, 150 )
            circle.myName = "circle"
            game:insert(circle)
       circle:setFillColor(100,100,100, 100)
     physics.addBody( circle, "static", {isSensor = true} )
        circle.collision = setExplosion
        circle:addEventListener( "collision", circle )
end
end

sentences:
How to fight against memory editing cheat software? What is the best way to protect run-time memory from such software?

We just published an online game (written on AS3, Flash, published on a social network), and pretty much all of the players got max_int money just using a simple memory editor ("ArtMoney").

sentences:
Unused frame(window) management I'm rewriting my game now using software designing patterns and want to do the code, most correct I can. While implementing MVC(Model View Controller) I got a question which I would like to discuss or to hear some opinions of experts.
The question is about management of unused frames... For example next sequence of windows:
ResourceLoadingWindow -> LoginWindow -> GameWindow
Definetly that I don't want to reuse ResourceLoadingWindow , since I'm using Java Applet and I don't see any situation when I will need to reuse it. The different story is about LoginWindow, which can be reused a lot of times, because some player would want to Logout and come back again in few minutes for example. I would like to know, following the MVC structure, should I destroy window, removing it from ContentPane or just hide? Maybe I need to unregister it from controller or I shouldn't do so?

Thanks in adavance.

sentences:
TopDown 2d player control Whats the usual way to control a player in a top down game? We have to look in the direction of the mouse cause the player hold a torch.

My first try was:

to to make it absolute like W move to screen top, A left, D right, S bottom... But it feels a kind of strange.
second try was to make it relative to the player. So W is always straight forward, A and D is moving sideway and S is backwards. But i heard of my tester thats very hard.

So whats the better / right way for the movement in a top down game in that you can move in a another direction as you look?

sentences:
Enemy walks to the nearest player? I'm trying making my enemy goes to the nearest player to him but what i get is kind of hesitated or shaking. I think is from the first line on Update but i don't know how to solve it. Here is my script

private Animator enemy_anim;
private NavMeshAgent mAgent;
private GameObject[] player;
public GameObject[] dead_point;
public int farPoint, dead_point_number,player_number;
public float dist;
public bool enemt_run, enemy_atack = false;

void Start()
{
    mAgent = GetComponent<NavMeshAgent>();
    enemy_anim = GetComponent<Animator>();
    player = GameObject.FindGameObjectsWithTag("Player");
    dead_point = GameObject.FindGameObjectsWithTag("dead_point"); // 3 points
    enemy_dirction();

}

void Update()
{
    player_number = Random.Range(0,player.Length);
    dead_point_number = dead_point.Length;
    dist = Vector3.Distance(transform.position, player[player_number].transform.position);

    if (player != null && dist <= 5.1f)
    {
        mAgent.destination = player[player_number].transform.position;
        if (dist < 1.2f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
        }
    }
    else
    {
        if (dead_point_number > 0)
        {
            mAgent.destination = dead_point[farPoint].transform.position;
        }
        else
        {
            mAgent.destination = player[player_number].transform.position;

        }
        if (mAgent.remainingDistance <= 1.5f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
            enemt_run = true;

        }
    }

    mAgent.speed = 1.0f;

    enemy_anim.SetBool("run", enemt_run);
    enemy_anim.SetBool("attack", enemy_atack);
}// end update

void enemy_dirction()
{
    if (dead_point_number > 0)
    {
        farPoint = Random.Range(0, dead_point.Length);
        mAgent.destination = dead_point[farPoint].transform.position;
    }
    else
    {

    }
}

sentences: Can I add rigging bones to a model imported from Blender inside Unity? I created a model in Blender but recently I stumbled upon a video claiming that you can add rigging to a model in Unity. So instead of rigging in Blender, is it possible to do it in Unity?

sentences:
Block player movement What do i need to keep my player model from going through environment objects like walls, trees etc?

Im trying to figure out if should use rigid bodies and the built in physics but i feel that its too difficult to predict what will happen then.

Is there an alternative that still will prevent the player from going through environment objects?

At the moment my player is a 3d model compsosed of some primitive shapes and a capsule collider.

sentences:
Shadow map artifacts I want to try adding shadows to a 3D XNA game. I've set up some testing environment with one light and one camera. However, I'm running into artifacts with my approach.

I'm using the shader code from http://pastebin.com/zXi0hmsU to render the final result and http://pastebin.com/rY4Gcj9N to create the shadow maps. The code is pretty straight forward and involves production of the depthmap from the light point of view, then projecting it into the camera space and checking for occlusions.

However, from most angles I am getting pretty ugly results

The scene consists of some simple cubes (constructed by hand, facing outside, backface is culled), one light (shadow map shown in top left corner - looks okay) and one camera.

My RenderTarget for the shadow maps is initialized by

int shadowMapSize = 512;
RenderTarget2D shadowMap = new RenderTarget2D(GraphicsDevice, shadowMapSize,
    shadowMapSize, true, GraphicsDevice.PresentationParameters.BackBufferFormat,
    DepthFormat.Depth24Stencil8);
GraphicsDevice.SetRenderTarget(shadowMap);
GraphicsDevice.Clear(Color.White);
GraphicsDevice.DepthStencilState = DepthStencilState.Default;

Afterwards, the CreateShadowMap effect is applied, followed by the LambertWithShadows effect. Finally, the shadow map is drawn using a SpriteBatch.

Rest of the code consists of simply providing the correct values to the shaders. If necessary, I can provide it at well.

sentences:
Coding for a really, really high-resolution display array I've been tasked with building a real time "full screen" demo to run on a 5x2 array of 60+ inch LED TVs: or, in other words, a 20 megapixel display.

We've got a machine built that can run a single Win7 desktop spread across the displays at full resolution, and some pretty decent video cards.

My question is: aside from the ridiculous amount of work that my pixel shaders are going to be doing, are there any other limitations of DX10.* that would come into play here that wouldn't on a more sanely sized viewport? I won't have access to the hardware until next week but I'd like to have something written by then that I can use to benchmark the system.

Update

While Imanaged to get this working on a single machine with a bunch of AMD EyeFinity (6 output) cards - to keep things working smoothly, the "easiest" way turned out to be to create a DX window per display as having a window span displays caused some performance issues - I also got it working pretty well by distributing the task across a group of machines, each of which drives two displays.

It was surprisingly easy. For my test XNA app, I added a GameComponent that captures some game state (camera position/orientation, etc.) and UDP-spams it across the local subnet per frame.

That component has a Mode switch (send or receive). If it's in Receive mode, it catches UDP datagrams and updates the game state with the information from the sender. Send mode just sends state packets, and, via a service/daemon, causes nodes to start or stop the client app. Any client can act as a "master", and switching a client into Send mode requests all other nodes to switch into Receive. It's pretty entertaining to see what happens when people are fighting over control.

Another neat benefit: I created a console app which processes a series of keyframe state definitions - location, time, etc. - interpolates as needed, and sends them using the same code as is used in the game engine. This lets me easily script movement, submit transforms from a web browser, etc.

All in all, it took about 50 lines of code to keep multiple copies of the app running in sync. Some additional complexity came from off-setting the camera position for each machine and correcting some perspective/projection annoyances, but most of that came down to a per-node configuration file.

sentences:
Calculate how many degrees a physical device is off centre (offset) given X, Y, Z Let's say I have a physical device that I can rotate with my hands and receive X Y Z coordinates of that device. What I need to calculate is the offset - how far is the pendulum of gravity straight down. Basically how many degrees I am off centre.
Is there a way of doing so? I've googled a lot of questions but so far I'm struggling.
Thanks.
Updated:
There is a physical device (sensor) which I can rotate. The device sends its X Y Z coordinates and a calculated acceleration vector in mg (mill mg). I can read this data from this device using BLE. The device should lie flat while transportation, so I need to calculate how many degrees the device is off centre (which is the laying flat on table).
Updated x2:
I need to calculate the angle between the device's centre vector and a gravity pendulum (the blue angle) on the photo.

sentences:
Simple mobile multiplayer game. TCP/UDP? I'm tying to dive into multiplayer game programming.

The game is quite simple, it's a 2D scroller mobile game, the player need to touch the screen in order to move 1 step and it could contain up to 4 players at max. 1 of the player could create a room for other players to join.

I was thinking that I would use TCP for this and will only send packets when 1 of the player trigger an event like moving or exiting the game. Is my approach is correct? Since from what I've read, many games are created in UDP instead of TCP.

In case of UDP, what is sent between the clients and the server? The position of each entity in the game at a fix time interval?

I'm really new multiplayer programming. I'd appreciate if someone would share their story.

Thank you.

sentences:
Developing an ELO like point system for a multiplayer gaming site I'm currently working on a gaming site where users will submit virtual players for different games, like Chess, Nash, Backgammon, Go, etc. The idea is that users don't compete themselves, but through their virtual players. There will be leagues, tournaments, and other competition formats.

The question is which would be a good rating system for users in this environment. Take into account that every user may have many different virtual players playing in many different games. As a general guideline I would like to guarantee the following properties:

Users who have a lot of mediocre players should not score higher than users with a few very good players.
A user with a high rating should not be penalized if he adds a new bad player, until he has had enough time to improve his player.
Users who don't play often should not score higher than users who play every day.

Thanks in advance.

sentences:
GetComponentsInChildren().text - does not contain a definition My Slider GameObject has a GUIText child. I am writing a C# script that should change the text component in the GUIText, but instead of this I am getting:

error CS1061: Type UnityEngine.GUIText[]' does not contain a definition fortext' and no extension method text' of typeUnityEngine.GUIText[]' could be found (are you missing a using directive or an assembly reference?)

 public Slider timeSlider;
 int i = 5;

 timeSlider.GetComponentsInChildren<GUIText>().text = 'Some Text' + i;
 //timeSlider.transform.GetComponentsInChildren<GUIText>().text = 'Some Text' + i; // doesn't work either

From the documentation I understand that GUIText should have a 'text' variable - Would anyone know why ().text is invalid?

Thank you!

How the hierachy is:

sentences:
Problem with repeating objects in array when already in the array When the player move forward then paint is instantiate and stored in the array, even if the paint is already in the array it will again be stored in the array.

But I don't want to repeat any paint in the array.

public GameObject[] array;
public GameObject paint;
int temp = 0;
private RaycastHit hit;

public float speed = 10f;
public Text levelText;
public GameObject paint;
float maxdistance = 0.51f;
Vector3 newtargetposition;
bool pos;
private void FixedUpdate()
{
      if(Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward,out hit, maxdistance))
      {
        if (hit.collider.gameObject.tag == "Obstacle")
        {
            move = false;
        }
     }
    if (move)
    {
        PlayerMove();
    }

public void PlayerMove()
{
    if (move)
    {
      vector3 positions = transform.position + new Vector3(0f, -0.5f,0f); //when player move then paint instantiate y position

        array[temp] = Instantiate<GameObject>(paint, position, Quaternion.identity);
        temp++;

        newtargetposition=position;
        Debug.Log("newtargetposiiton:" + newtargetposition);

        if (temp == 150)
        {
            if (newtargetposition == position)
            {
                //what can i do here
                //i dont want to paint here because position store in newtargetposition,it is repeat
                //array[temp]--;
                Debug.Log("newtargetpositions:" + newtargetposition);
                //temp--;
            }
            gameOver.SetActive(true);
            SceneManager.LoadScene(1);
        }
    }
}

when player move forward store position in array

when player move back already fillup position again store in array

sentences:
How to handle shoot instructions, in a multiplayer TD I'm currently working on a Multiplayer Tower Defense game, using ImpactJS & Node. I seek some clarification about how to handle projectiles from towers, let me explain.

So the server is running the master game, and the clients just follow the instruction from the server. Lets say there is about 20 towers on the stage, all needs instructions for which creeps to shoot at. Now lets say each towers fires twice in a second, that's 40 shots each second, (worst case scenario) which is 40 request per second to each client, would't this casue alot of stress to the server, saying that we have 50 games running the same time.
So what i am really asking, is this method inefficient, and is there a smarter way to handle all these instructions.

Thank you.

sentences:
How to disable script component while in game? I'm trying to make a C# script to disable the First person controller script component for my character. I'm doing this so that while I'm controlling something else such as a vehicle, the only control script enabled at the time is the vehicle, and vice versa for when I'm not in the vehicle.

I did find a tutorial on the Unity Web site for Enabling and Disabling components but it uses a light component as an example, and I have no idea of how to do the same thing with a script component. I really appreciate any help I can get to solve this problem.

Thank you

This is the code in C# provided by the tutorial:

public class EnableComponents : MonoBehaviour
{
    private Light myLight;

    void Start ()
    {
        myLight = GetComponent<Light>();
    }

    void Update ()
    {
        if(Input.GetKeyUp(KeyCode.Space))
        {
            myLight.enabled = !myLight.enabled;
        }
    }
}

sentences:
ARCore: Differentiate between two planes detected in adjacent vertical walls in the room I'm working on Vertical plane detection.
When I'm pointing at wall 1 of my room, plane1 here is the vertical plane detected in wall 1...
I'm recording the quaternion via this formula
 val quat =  Quaternion(plane1.centerPose.qx(), plane1.centerPose.qy(), plane1.centerPose.qz(), plane1.centerPose.qw())

Now, when I point my phone to the other wall (adjacent) of my room and check its rotation, I get the same values, I assumed this is the world rotation. Let me know if I'm wrong.
Is there any other way where I could differentiate between vertical planes detected in adjacent walls
I'm using this to loop through the detected planes
 for (plane1 in frame.getUpdatedTrackables(Plane::class.java)) {
                if (plane1.trackingState === TrackingState.TRACKING) {
                    val type: Plane.Type = plane1.type
                    if (type == Plane.Type.VERTICAL) {

sentences:
Simple stupid funnel algorithm without visible points In the simple stupid funnel algorithm we are searching for consecutive portals points, that are tightening the funnel (the angle between the current left and right point decreases).

But what when there is no single visible point, that would tighten the funnel, like presented on image below. How to determinate next apex and current left and right point?

sentences:
Projectile Shoot three at a time In my game there is a bird flying and on touch it throws different artifacts projectile downwards. And these artifacts should hit the containers moving right to left on the screen. Now if user keeps on tapping rapidly it make a line of artifacts and it didn't miss a single container. So what I want to do is to restrict user to throw 3 artifacts at a time and when one of them got destroyed it'll make room for one more. Here is how I'm doing it:
In my player.cs I'm using a static int named inventory and then in Update() method I've the code where it increment the inventory.

if (Input.GetTouch(i).phase == TouchPhase.Began){
                OnShoot ();
                inventory++;
                Debug.Log ("Inventory: " + inventory);
            }

and in OnShoot() I'm checking if (inventory < 4) then Instantiate otherwise if (inventory > 4) set inventory = 0;.
 Now in the artifacts.cs if it hit the container and get destroyed or got destroyed going out of the bound missing the container it should Player.inventory--;
This code works fine but if the user speed of tapping is more then it again started throwing like in a line form as described above.

sentences:
Why can't I read .ttf file when running Android configuration? When running or debugging my game on Android device, I get this error in the logcat:

  com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/fonts/myFont.ttf (Internal)

Which is created by this code line:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

where fontFile is defined like this:

FileHandle fontFile = Gdx.files.internal("data/fonts/myFont.ttf");

This doesn't happen when I run the desktop configuration.

I know that for desktop configuration you have to define the working directory of your project, but I don't see such option in android configuration and it also makes no sense, so I don't think it's a "working directory"-related problem.

Obviously, the file is in the correct path.

Also note that everything worked fine in my previous project. I created this new project by creating a new blank prj using libgdx-setup and then copying all the classes and packages from the older project. So maybe it's a problem related to some Gradle file?

sentences:
How to keep triangles from connecting across voxel mesh I am working on a voxel engine and have just started learning webgl. I have generated a list of Vertices and Indices by using Array.concat() on a template array and adding a value based on my position in loop.

var verticesTemplate = [
    // Front face
    -0.5, -0.5,  0.5,
     0.5, -0.5,  0.5,
     0.5,  0.5,  0.5,
    -0.5,  0.5,  0.5,

    // Top face
    -0.5,  0.5, -0.5,
    -0.5,  0.5,  0.5,
     0.5,  0.5,  0.5,
     0.5,  0.5, -0.5,

    // Right face
    0.5, -0.5, -0.5,
    0.5,  0.5, -0.5,
    0.5,  0.5,  0.5,
    0.5, -0.5,  0.5,

    // Bottom face
    -0.5, -0.5, -0.5,
     0.5, -0.5, -0.5,
     0.5, -0.5,  0.5,
    -0.5, -0.5,  0.5,

    // Left face
    -0.5, -0.5, -0.5,
    -0.5, -0.5,  0.5,
    -0.5,  0.5,  0.5,
    -0.5,  0.5, -0.5,

    // Back face
    -0.5, -0.5, -0.5,
    -0.5,  0.5, -0.5,
     0.5,  0.5, -0.5,
     0.5, -0.5, -0.5,
];
var indicesTemplate = [
    0, 1, 2,      0, 2, 3,    // Front face
    4, 5, 6,      4, 6, 7,    // Back face
    8, 9, 10,     8, 10, 11,  // Top face
    12, 13, 14,   12, 14, 15, // Bottom face
    16, 17, 18,   16, 18, 19, // Right face
    20, 21, 22,   20, 22, 23  // Left face
];
var WorldVertices = [];
var WorldIndices = [];
var IndexLoopIndex = 0;

function generateMeshData() {
    for(var x = 0; x < 4; x++) {
        var blockVertices = [].concat(verticesTemplate);
        addToX(verticesTemplate, blockVertices, x);
        for(var y = 0; y < 4; y++) {
            addToY(verticesTemplate, blockVertices, y);
            for(var z = 0; z < 4; z++) {
                var block = blocks[x][y][z];
                if(block.isActive === true) {
                    // adds a value of 1(The blockSize) to all z coordinates in verticesTemplate and adds to end of WorldVertices
                    addToZ(verticesTemplate, blockVertices, z);
                    WorldVertices = WorldVertices.concat(blockVertices);

                    var indices = [].concat(indicesTemplate);
                    addToXYZ(indicesTemplate, indices, 24*IndexLoopIndex);
                    WorldIndices = WorldIndices.concat(indices);
                    IndexLoopIndex++;
                }
            }
        }
    }
}

The problem is that the triangles are skewed after the mesh is rendered using gl.drawElements. And I can't figure out why. So how can I keep triangles from being drawn that connect cubes?

sentences:
Why glDrawElements draws nothing? I tried to implement indexed draw, but when I call I got nothing on screen. Even more strange that I wasn't get any error when call it and buffer variables packed right.

There my constructor:

Mesh::Mesh(Shader &shader, std::vector<GLuint>* indices, std::vector<VertexData>* vertices) {
shaderProgram = &shader;
_meshLenght = (GLsizei) indices->size();
_indices = indices;

glGenBuffers(1, &_ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices->size(), indices, GL_STATIC_DRAW);

//create one here
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);

std::vector<glm::vec3> positions {};
std::vector<glm::vec3> normals {};
std::vector<glm::vec2> texture {};

for (size_t i = 0; i < vertices->size(); ++i) {
    positions.push_back(vertices->at(i).positions);
    normals.push_back(vertices->at(i).normals);
    texture.push_back(vertices->at(i).texCoords);
}

glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*(positions.size()+normals.size()), nullptr, GL_DYNAMIC_DRAW);

glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(glm::vec3)*positions.size(), positions.data());
glBufferSubData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*positions.size(), sizeof(glm::vec3)*normals.size(), normals.data());

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<const void*>((sizeof(glm::vec3) * positions.size())));

glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

And there my draw code:

void Mesh::Draw() {
glBindVertexArray(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
if (_ebo==0)
    glDrawArrays(GL_TRIANGLES, 0, _meshLenght);
else {
    glDrawElements(GL_TRIANGLES, _meshLenght, GL_UNSIGNED_INT, nullptr);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

Also show my vertices info screenshot:

And if you need have apitrace trace file:
https://drive.google.com/file/d/0B-dWIpzqq91mQXVIeHhTOHFhRkU/view?usp=sharing

sentences:
Unity3D - Change player input axes on trigger Hope someone can help me with this, it seems like it should be a simple problem but that only makes it more frustrating!

I have a simple game where you roll a ball around by applying force to the horizontal and vertical axes. What I want to happen is, on a trigger, the axes switch from say the X and Y, to the X and Z, changing the way the player controls without changing the input buttons... The script I use to move the player is below:

{
  float moveHorizontal = Input.GetAxis ("Horizontal");
  float moveVertical = Input.GetAxis ("Vertical");

  Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
  rb.AddForce (movement * speed);
}

(Where rb is the player ball object) - I'm thinking I'm going to have to change the way the player is controlled as I can't any reference to a 3rd axis in the Input.GetAxis documentation... any help with this would be great!

Thanks!

sentences:
Communication in an entity-component through public variables or public member functions I am currently coding my own ECS to get a deeper understanding of how such an engine works. I am currently putting together systems. I am aware that there is no right answer to my question as there are a lot of flavors of ECS. Probably I should say that I try to avoid an event queue at the moment. So I only want to do synchronous and direct communication.

Please note that this is the basis and preparation for my systems and event system for asynchronous communication.

How do you guys concept your components? Are you offering public variables directly accessed by the systems or do you communicate through public member functions?

Public variable

class AIComponent : public IComponent{
  public:
    bool m_LeftPressed = bool();
}

Public member function

class AIComponent : public IComponent{
  private:
    bool m_LeftPressed = bool();

  public:
    bool leftPressed();
}

sentences:
Calculating Minimum Translation Vector in Separating Axis Theorem based algorithm In the 2D SAT collision determination algorithm, you project the convex polygons onto each potential separating axis. Supposing the polygons intersect, from what I understand, the axis for which the overlap of the projections is the smallest determines the minimum translation vector. The MTV direction is parallel to the separating axis and the magnitude is the length of the overlap.

When calculating the overlap, however, I'm wondering if it is necessary to account for different overlap scenarios.

We have projection intervals (for some axis) (a, b) and (c, d). (a, b) comes from the polygon who normals we're currently testing as separating axes.

Case 1:

Case 2:

Intuitively, the overlap in the first case is b - c, and the overlap in the second case is d - a. And if this turns out the be the axis of minimum overlap, you might want to flip the MTV direction in one of the above cases, depending on what you are doing.

However, I'm wondering if it is actually necessary to consider the d - a interval. I.e., is there a proof of something to the effect that, when d - a is less than b - c, that the axis cannot possibly be the axis of minimum overlap (or, if it is, that we could have used another edge's normal, such that its projections' b - c interval was the minimum overlap)? In the second case, it is true -- d - a is less than b - c, and there is a smaller axis of overlap (e.g. b - c when the axis is the red polygon's upper edge normal).

But does this hold in general? Is there a simple counter example?

sentences:
How to lerp all members of array in Unity 5? I've an array of gameobjects called cards and I have this code to run when clicking a button

public void mover()
{
  for (int x = 0; x < cards.Lengh; x++)
  {
    cards[x].transform.position = Vector3.Lerp(
      cards[x].transform.position,
      new Vector3( Random.Range(2.5f, 15.5f), 1.5f, Random.Range(-5.2f, -13.5f)),
      CardMoveSpeed * Time.deltaTime);
  }
}

But when I click on the button it moves instantly.

How can I move all of them smoothly (by using lerp)?

I read about using co-routines but I don't fully understand how to implement it in this situation.

sentences:
How can I use the gap range attribute slider to add/remove gaps between the units? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateStairsUnits : MonoBehaviour
{
    [Header("Stairs Units Prefab")]
    public GameObject stairsUnitsPrefab;
    [Space(5)]
    [Header("Settings")]
    [Range(1, 2000)]
    public int numberOfUnits = 1;
    [Range(10, 100)]
    public int gap = 10;

    private int oldNumberOfUnits = 0;
    private int oldGapValue = 0;
    private List<GameObject> units = new List<GameObject>();
    private GameObject unitsParent;
    private GameObject Unit;

    // Use this for initialization
    void Start ()
    {
        oldNumberOfUnits = numberOfUnits;

        unitsParent = GameObject.Find("Stairs Units");
        for (int i = 0; i < numberOfUnits; i++)
        {
            Unit = Instantiate(stairsUnitsPrefab, unitsParent.transform);
            Unit.transform.localPosition = (i + 1f) * new Vector3(gap, 0, 0);
            Unit.name = "Stairs " + i.ToString();
            Unit.tag = "Unit";
            units.Add(Unit);
        }
    }

    private void Update()
    {
        if(gap > oldGapValue)
        {
            for(int i = 0; i < numberOfUnits; i++)
            {
                units[i].transform.position = (i + 1f) * new Vector3(gap, 0, 0);
            }

            oldGapValue = gap;
        }

        if (numberOfUnits < oldNumberOfUnits)
        {
            var res = oldNumberOfUnits - numberOfUnits;
            for (int i = 0; i < res; i++)
            {
                Destroy(units[units.Count - 1]);
                units.RemoveAt(units.Count - 1);
            }

            oldNumberOfUnits = numberOfUnits;
        }
        else
        {
            for (int i = oldNumberOfUnits; i < numberOfUnits; i++)
            {
                Unit = Instantiate(stairsUnitsPrefab, unitsParent.transform);
                Unit.name = "Stairs " + i.ToString();
                Unit.transform.localPosition = (i + 1f) * new Vector3(gap, 0, 0);
                units.Add(Unit);
            }

            oldNumberOfUnits = numberOfUnits;
        }
    }
}

I tried inside the Update this :
I want that if I move the gap slider range to the right that it will add more gaps between the existing units and new units if adding new units.
if(gap > oldGapValue)
            {
                for(int i = 0; i < numberOfUnits; i++)
                {
                    units[i].transform.position = (i + 1f) * new Vector3(gap, 0, 0);
                }

                oldGapValue = gap;
            }

but this part of code does nothing it's not adding any gaps and I'm not sure also how to remove gaps if moving the rang slider to the left for example if the gap value is 50 and I removed it to the left and now the gap value is 23 then the gaps should be now 23 between the existing units and if adding new units then add 23 gap between each new unit.

sentences:
Why is this MeshRenderer null? The following line fails in my class:

MeshRenderer nRenderer = _Sphere.AddComponent<MeshRenderer>();

This is the entire class. All works except the mentioned line.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SphereMaker : MonoBehaviour
{
    private GameObject _Sphere;

    void Start()
    {
        _Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        _Sphere.AddComponent<MeshFilter>();

        MeshRenderer nRenderer = _Sphere.AddComponent<MeshRenderer>();
        Material nMat = new Material(Shader.Find("Universal Render Pipeline/Lit"));//I'm using the URP

        if (nMat == null)
        {
            Debug.LogError("no mat!!\n");
        }
        nMat.color = Color.red;

        nRenderer.material = nMat;

        float fSize = 0.4f;

        _Sphere.transform.localScale = new Vector3(fSize, fSize, fSize);
        _Sphere.transform.position = new Vector3(0, 0, 0);

    }
}

Does anybody see what I'm doing wrong?

Thank you!

sentences:
Finding distances between sprites in an array i'm new to java and was hoping if anyone can help me out. So my game has meteors which spawns off screen and sometimes as they spawn, they overlap each other which I don't want. I want them to spawn from a certain distance from each other.

From pseudo code I know what I want which is to find the centre point of sprite, find other meteors on screen and calculate the distance and then spawn from a certain distance from each other. I know the distance to point formula (distance = Math.sqrt(Math.pow(x2 - x1, 2) + (Math.pow(y2 - y1, 2)));), but how do I do that within an array. Here is my code so far:

Meteor Class

public class Meteors {
    private Texture bigMeteor;
    private Vector2 posBigMeteor;
    private Random yrand;

    //Constructor
    public Meteors(float x){
        bigMeteor = new Texture("meteor.png");
        yrand = new Random();

        //Spawn location of meteor
        posBigMeteor = new Vector2(x, yrand.nextInt(AstroDemo.HEIGHT/2 - bigMeteor.getHeight()));
    }

    public Texture getBigMeteor() {
        return bigMeteor;
    }

    public Vector2 getPosBigMeteor() {
        return posBigMeteor;
    }

    public void reposition(float x){
        posBigMeteor.set(x, yrand.nextInt(AstroDemo.HEIGHT/2 - bigMeteor.getHeight()));
    }
}

Playstate Class

public class PlayState extends State {
    //Total meteor count on screen
    private static final int METEOR_COUNT = 8;

    private Naught naught;
    private Texture bg;
    private Random xrand;
    private Array <Meteors> meteors;

    public PlayState(GameStateManager gsm) {
        super(gsm);
        //Starting co-ordinates of main character (Naught)
        naught = new Naught(50, 100);
        //Setting viewport of the camera
        cam.setToOrtho(false, AstroDemo.WIDTH/2, AstroDemo.HEIGHT/2);
        bg = new Texture("bg.png");
        xrand = new Random();

        meteors = new Array <Meteors>();

        //Spawn meteors randomly off screen
        for (int i = 1; i <= METEOR_COUNT; i++){
            meteors.add(new Meteors(AstroDemo.WIDTH/2 + (xrand.nextInt(300))));
        }
    }

    @Override
    protected void handleInput() {
        //If screen/mouse is held
        if(Gdx.input.isTouched()){
            //Main Character jumps/flys
            naught.jump();
        }
    }

    @Override
    public void update(float dt) {
        handleInput();
        naught.update(dt);
        //If meteors are left side of the screen, re-position to the right side of the screen
        for(Meteors meteor : meteors){
            if (cam.position.x - (cam.viewportWidth/2) > meteor.getPosBigMeteor().x + meteor.getBigMeteor().getWidth()){
                meteor.reposition(meteor.getPosBigMeteor().x + (AstroDemo.WIDTH/2 + 20 + (xrand.nextInt(300))));
            }
       }
        cam.position.x = naught.getPosition().x + 80;

        cam.update();
    }

    @Override
    public void render(SpriteBatch sb) {
        //Adjust the spritebatch for co-ordinate system in relation to camera
        sb.setProjectionMatrix(cam.combined);
        sb.begin();
        //Draw background where the camera is
        sb.draw(bg, cam.position.x - (cam.viewportWidth/2), 0);
        sb.draw(naught.getTexture(), naught.getPosition().x, naught.getPosition().y);
        for (Meteors meteor : meteors) {
            sb.draw(meteor.getBigMeteor(), meteor.getPosBigMeteor().x, meteor.getPosBigMeteor().y);
        }
        sb.end();
    }

    @Override
    public void dispose() {

    }
}

sentences:
Implementing a delay timer into triggered method I have a shoot method that is used as a mouseDown() Trigger on my player. I am wanting to introduce a delayTimer but am unsure of how to do this within the method due to the trigger.

public void Shoot(){
    if (BulletsManager.bullets > 0 && facingRight == true) {
        playShotgunSound();
        Instantiate (Bullet, firePoint2.position, firePoint2.rotation);
        BulletsManager.SubtractPoints (bulletsToSubtract);
        facingLeft = false;
        facingRight = true;
    }

        if (BulletsManager.bullets > 0 && facingLeft == true) {
        playShotgunSound();
        Instantiate (Enemy, firePoint2.position, firePoint2.rotation);
        BulletsManager.SubtractPoints (bulletsToSubtract);
        facingLeft = true;
        facingRight = false;
    }
}

Could anybody advise as to how I'd implement it within this code?

sentences:
Top Down bounds of vision Obviously in a first person view point the player sees only what's in front of them (with the exception of radars and rearview mirrors, etc).  My game has a top down perspective, but I still want to limit what the character sees based on their facing.

I've already worked out having objects obstruct vision, but there are two other factors that I worry would be disorienting and want to do right.

I want the player to have reduced peripheral vision and very little view behind them.  The assumption is he can turn his head and so see fairly well out to the sides, but hardly at all behind without turning the whole body.  How do I make it clear you are not seeing behind you?
I want the map to turn so the player is always facing up.  Part of the game is to experience kind of a maze and the player should be able to lose track of North.  How can I turn the map rather than the player avatar without causing confusion?

sentences: How can I apply a shader to images in a map in XNA? Basically, what I'm trying to do is apply a shader to my background image and only the background image. The problem is: the background is actually made up of tiles that are picked out of a list of images. The background code loads and draws the tiles according to a map (an int[,].) I've been reading up on using RenderTarget2d, but I haven't found anything that suggests I'd be able to use specific images (let alone images set up according to a map.) So here's my question: is there a way to render my backgrounds to a texture so I can apply a shader or is there another way for me to apply a shader that I might want to try?

sentences:
Slick2D crashes on Image.getGraphics() on some machines On some machines, creating a new Image and calling getGraphics() on it causes lwjgl to enter into some kind of faulty state that crashes when swapping buffers. Any idea what causes this and how to make Slick clean up after itself properly?

Reproduction code:

package crashrepro;

import org.newdawn.slick.*;

public class CrashRepro extends BasicGame {
    public static void main(String[] args) throws Exception {
        CrashRepro cr = new CrashRepro("CrashRepro");
        // Crash only happens in fullscreen mode.
        AppGameContainer agc = new AppGameContainer(cr, 800, 600, true);
        agc.start();
    }

    public CrashRepro(String title) { super(title); }

    @Override
    public void init(GameContainer gc) throws SlickException {}

    @Override
    public void update(GameContainer gc, int i) throws SlickException {}

    @Override
    public void render(GameContainer gc, Graphics grphcs) throws SlickException {
        Image img = new Image(128, 128);
        img.getGraphics(); // This crashes the game.
    }
}

Stack trace:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.WindowsContextImplementation.nSwapBuffers(Ljava/nio/ByteBuffer;)V+0
j  org.lwjgl.opengl.WindowsContextImplementation.swapBuffers()V+35
j  org.lwjgl.opengl.ContextGL.swapBuffers()V+3
j  org.lwjgl.opengl.DrawableGL.swapBuffers()V+0
j  org.lwjgl.opengl.Display.swapBuffers()V+39
j  org.lwjgl.opengl.Display.update(Z)V+44
j  org.lwjgl.opengl.Display.update()V+1
j  org.newdawn.slick.AppGameContainer.gameLoop()V+78
j  org.newdawn.slick.AppGameContainer.start()V+17
j  crashrepro.CrashRepro.main([Ljava/lang/String;)V+27
v  ~StubRoutines::call_stub

sentences:
Strange quaternion rotation I was implementing some quaternion rotations in too my infant 3d game engine and the rotations were really strange? Excuses my cluelessness.

Anyways this is what I have:

static XMVECTOR XMConvertToQuaternion(XMFLOAT3 axis, float radian)
{
    axis = XMNormalize3(axis);
    XMVECTOR tempAxis = XMVectorSet(axis.x, axis.y, axis.z, 1);
    XMVECTOR q = XMQuaternionRotationAxis(tempAxis, radian);
    return q;
}

Then later on down when I apply the quaternion to the world matrix I have:

XMMATRIX scaling = XMMatrixScaling(scale.x, scale.y, scale.z);
XMMATRIX rotateX = XMMatrixRotationX(radianRotation.x);
XMMATRIX rotateY = XMMatrixRotationY(radianRotation.y);
XMMATRIX rotateZ = XMMatrixRotationZ(radianRotation.z);

XMMATRIX rotateQX = XMMatrixRotationQuaternion(MathHelper::XMConvertToQuaternion(axis, radianRotation.x));
XMMATRIX rotateQY = XMMatrixRotationQuaternion(MathHelper::XMConvertToQuaternion(axis, radianRotation.y));
XMMATRIX rotateQZ = XMMatrixRotationQuaternion(MathHelper::XMConvertToQuaternion(axis, radianRotation.z));
XMMATRIX translate = XMMatrixTranslation(translation.x, translation.y, translation.z);
XMStoreFloat4x4(&mWorld, scaling*rotateQX*rotateQY*rotateQZ*translate);

I did get a rotation. However, the character is rotating very strangely.

sentences: Is there a way to use the UnityEngine.UI with SteamVR and the Vive? I recently got into developing VR games using the Vive as my standard platform. Now I would like to design some UnityEngine.UI elements that would be interactable via the built in pointer scripts that come with the SteamVR module from the Unity Asset Store.  However, I can't seem to find any kind of built in method for allowing interaction between the pointers and buttons, scroll bars, etc.  I have also been unable to write anything myself that would do the trick, it's almost as if the Unity UI is just not designed to interact in a VR environment at all.  Does anyone have a method for using the UnityEngine.UI in a VR environment?  If so, can you please point me in the right direction?

sentences:
How was/is playback of music handled on consoles such as the NES, Master System, Gameboy, etc? So, I deliberately left out the SNES because AFAIK the music subsystem is basically entirely self-contained. However, on systems like the NES and Gameboy, while there are sound chips, there isn't any sort of dedicated sound CPU.

My question is how one reliably plays back music without putting too much of a burden on the CPU? Timing is clearly very critical: music won't sound right if the notes aren't played at exact intervals. Naively, one might just continually update the registers of the sound chip. However, this leaves no time for programming game logic! You could plan to update the registers every cycle in the main loop, but then any interrupts triggered would throw everything off.

I haven't been able to find any information on this, despite there seeming to be a clear conceptual gap! So basically, how does a game like say, Super Mario Bros on the NES manage to play back music consistently and reliably, regardless of what is happening on screen?

sentences:
Rate-limiting players actions in a multiplayer game I'm thinking about building a multiplayer game with combat between players and monsters. Actors need to have a maximum actions per minute, otherwise users could cheat by holding down the attack key. Plus, I'd like to vary the maximum APM depending on the player class and monster.

How should I handle rate limiting combat in my game?

Assuming every actor has a timestamp of when their last action occurred, should I queue up actions to execute or should I drop them if they're received too early? Can you think of any reading material or examples I could research?

sentences:
Why aren't subsequent glDrawArrays showing up? I am attempting to redraw with the same arrays using glDrawArrays in a GLKView on iOS. When I comment out any two of these calls, the other draw call draws as I expect. My last hunch was that I was attempting to draw at the same depth, so I introduced a depth uniform and am setting the depth in the vertex shader like so:

gl_Position = vec4(position.xy, 0.1*depth, 1.0);

the depth coming in is a lowp vector with a value of 0, 1, or 2. This didn't have any effect.

Here is my drawRect: method

- (void)drawRect:(CGRect)rect
{
    glClearColor(0., 0.0, 0.0, 0.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Render the object again with ES2
    glUseProgram(_program);

    // the colors
    glBindVertexArrayOES(_vertexArray);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, _wheelMaskTexture);
    glUniform1i(uniforms[UNIFORM_TEXTURE], 0);

    glUniform1f(uniforms[UNIFORM_COLOR_DEPTH], COLOR_DRAW);
    glUniform1f(uniforms[UNIFORM_COLOR_ANGLE], _angle);

    glDrawArrays(GL_TRIANGLES, 0, 6);

    // the sat
    glBindVertexArrayOES(_vertexArray);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, _satMaskTexture);
    glUniform1i(uniforms[UNIFORM_TEXTURE], 0);

    glUniform1i(uniforms[UNIFORM_COLOR_DEPTH], SATURATION_DRAW);
    glUniform1f(uniforms[UNIFORM_COLOR_ANGLE], _satAngle);

    glDrawArrays(GL_TRIANGLES, 0, 6);

    // the bright
    glBindVertexArrayOES(_vertexArray);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, _brightMaskTexture);
    glUniform1i(uniforms[UNIFORM_TEXTURE], 0);

    glUniform1i(uniforms[UNIFORM_COLOR_DEPTH], BRIGHTNESS_DRAW);
    glUniform1f(uniforms[UNIFORM_COLOR_ANGLE], _brightnessAngle);

    glDrawArrays(GL_TRIANGLES, 0, 6);
}

My GLKView is set up with a drawableDepthFormat = GLKViewDrawableDepthFormat24. I haven't set up any transforms because what I'm drawing is basically a simple color wheel.

There is no world or model transform. I'm simply drawing the same square 3 times one on top of the other without transforming. There are 3 different mask images that are used to mask out the fragments that I care about in the fragment shader like so:

gl_FragColor = vec4(rgb, texture2D(wheelMask, texCoord).a);

Why wouldn't all three glDrawArrays calls draw as expected? As I mentioned early any one of them by themselves draws as expected. As it is, with all three, only the first glDrawArrays draws as expected.

sentences:
Unity 2D Hingejoints break under extreme force I have added a rope to my game that is made up of multiple small gameobjects, each connected to eachother by a HingeJoint2D. Since 1 unit of mass in Unity is supposed to represent 1 kg, I've made the player's mass 60 (60kg). When the mass of each rope segment (of which there are 40) is 20, the rope supports the player when they jump off a cliff.

Now 20 kg per rope segment sounds ludicrous. However when I make each rope segment weigh 1 (1kg) the hingejoints break completely and jitter around crazily. The force of the 60kg player against the 1kg segments seems to be too much.

I would much rather have the rope be lighter, so it doesn't move the player when throwing and being dragged as much. Any suggestions on how to fix HingeJoint2D's and make them act, as you know, a joint should?
EDIT: Increasing the Position and Velocity Iterations in File->Project->Physics2D menu from the default 3 and 9 respectively, up to a whopping 40 fixes this problem. This is a massive increase. Unsure if performance will suffer too much with these new settings.

sentences:
Handling multiple lights of different types in GLSL I want to be able to support multiple lights of different types (point, spot & directional). Note that I also want to be able to render transparent/translucent objects, which rules out deferred rendering.

This means that I will need a fixed upper limit on the number of lights. All of the implementations I have seen use a uniform array, for example:

struct PointLight
{
    vec3 color;
    float intensity;
    float radius;
};

uniform PointLight pointLights[8];

How can I best extend this to multiple types of lights? Two possible options are:

Create multiple uniform arrays, one for each type of light.
Define a struct that can be used for all three types of light and then have some way of differentiating the types of lights in the array (e.g. using start index and count uniforms or adding some kind of type flag to the struct).

Both have disadvantages. Both waste memory (although the first more so than the second) and the second either requires additional uniforms or flag checking.

What is the usual method for handling multiple lights of various types?

sentences:
Cascade(Waterfalls) particles animation - openframeworks, alternatives Has anyone tried to create a waterfall particles animation using openframeworks? Is it possible? Is it good?

If not, can you recommend any other frameworks for easier creation of cascade animation?

Thanks a LOT!

sentences:
How is the default value of ContactFilter2D.isFiltering true? I have a static ContactFilter2D like so:

protected static ContactFilter2D contact_filter;
protected float self_destruct_timer;
protected Vector3 direction;
private float xward;

protected virtual void Start ()
{    phys.velocity = transform.right * speed * xward;
     self_destruct_timer = Time.time + life_time;

     if (!contact_filter.isFiltering) contact_filter.layerMask = Public_Const.Solid;
     contact_filter.useLayerMask = true;
     ...
}

Every isFiltering_____ variable (i.e. isFilteringLayerMask) is set to false by default, therefore there should be no way that isFiltering should return a true value.
The whole point of checking to see if isFiltering is true is to check to see if the contact filter has already been initialized, so why won't it work?

sentences:
XNA running slow when making a texture I'm using XNA to test an image analysis algorithm for a robot. I made a simple 3D world that has a grass, a robot, and white lines (that are represent the course). The image analysis algorithm is a modification of the Hough line detection algorithm.

I have the game render 2 camera views to a render target in memory. One camera is a top down view of the robot going around the course, and the second camera is the view from the robot's perspective as it moves along. I take the rendertarget of the robot camera and convert it to a Color[,] so that I can do image analysis on it.

private Color[,] TextureTo2DArray(Texture2D texture, Color[] colors1D, Color[,]   colors2D)
    {
        texture.GetData(colors1D);
        for (int x = 0; x < texture.Width; x++)
        {
            for (int y = 0; y < texture.Height; y++)
            {
                colors2D[x, y] = colors1D[x + (y * texture.Width)];
            }
        }

        return colors2D;
    }

I want to overlay the results of the image analysis on the robot camera view. The first part of the image analysis is finding the white pixels. When I find the white pixels I create a bool[,] array showing which pixels were white and which were black. Then I want to convert it back into a texture so that I can overlay on the robot view.

When I try to create the new texture showing which ones pixels were white, then the game goes super slow (around 10 hz).

Can you give me some pointers as to what to do to make the game go faster.
If I comment out this algorithm, then it goes back up to 60 hz.

private Texture2D GenerateTexturesFromBoolArray(bool[,] boolArray,Color[] colorMap, Texture2D textureToModify)
    {
        for(int i =0;i < screenWidth;i++)
        {
            for(int j =0;j<screenHeight;j++)
            {
                if (boolArray[i, j] == true)
                {
                    colorMap[i+(j*screenWidth)] = Color.Red;
                }
                else
                {
                    colorMap[i + (j * screenWidth)] = Color.Transparent;
                }
           }
    }

        textureToModify.SetData<Color>(colorMap);

        return textureToModify;
    }

Each Time I run draw, I must set the texture to null, so that I can modify it.

 public override void Draw(GameTime gameTime)
    {
        Vector2 topRightVector = ((SimulationMain)Game).spriteRectangleManager.topRightVector;
        Vector2 scaleFactor = ((SimulationMain)Game).config.scaleFactorScreenSizeToWindow;

        this.spriteBatch.Begin(); // Start the 2D drawing
        this.spriteBatch.Draw(this.textureFindWhite, topRightVector, null,
           Color.White, 0, Vector2.Zero, scaleFactor, SpriteEffects.None, 0);
        this.spriteBatch.End(); // Stop drawing.

        GraphicsDevice.Textures[0] = null;
    }

Thanks for the help,

Anthony G.

sentences:
Should I amortize scripting cost via bytecode analysis or multithreading? I'm working on a game sort of thing where users can write arbitrary code for individual agents, and I'm trying to decide the best way to divide up computation time.

The simplest option would be to give each agent a set amount of time and skip their turn if it elapses without an action being decided upon, but I would like people to be able to write their agents decision functions without having to think too much about how long its taking unless they really want to.

The two approaches I'm considering are giving each agent a set number of bytecode instructions (taking cost into account) each timestep, and making players deal with the consequences of the game state changing between blocks of computation (as with Battlecode) or giving each agent it's own thread and giving each thread equal time on the processor.

I'm about equally knowledgeable on both concurrency and bytecode stuff, which is to say not very, so I'm wondering which approach would be best. I have a clearer idea of how I'd structure things if I used bytecode, but less certainty about how to actually implement the analysis. I'm pretty sure I can work up a concurrency based system without much trouble, but I worry it will be messier with more overhead and will add unnecessary complexity to the project.

sentences: How can I estimate the perfomance of graphics cards I don't have? I'm developing a voxel game with OpenGL and want to optimize the number of rendered faces. How can I estimate how many faces at most a modern graphics card of a certain brand is able to compute, while still managing to render at 60fps?

sentences:
How to access sprite sheet via row and column I'm currently designing a 2D game engine in C#, just had a quick question.

I have a SpriteSheet class that splits up a sprite into several different sprites (like a tileset for a example) and stores them in a list. Which is great, because now I can access sprites via it's corresponding index in the sheet.

However, I would really like to add a feature that will let me access a sprite by specifying the row and column it resides in (in the original sprite). I just don't know the equation to find where the sprite is in the list.

Here is what I have so far:

    public Sprite this[int index]
    {
        get { return this.sprites[index]; }
    }

    public Sprite this[int row, int column]
    {
        get
        {
            // Get the width and height of each individual sprite in the sheet.
            int cellWidth = this[0].Width;
            int cellHeight = this[0].Height;

            // Figure out and how many rows and columns are in the entire sprite sheet
            int rows = this.sprite.Width / cellWidth;
            int columns = this.sprite.Height / cellHeight;

            // Here is where I want to return the sprite located at the row and column specified.
            return this.sprites[ /* what do i put in here? */ ];
        }
    }

Also, I don't know if it will help but here is the method I use to fill the list with sprites:

    private void CreateSheet(Sprite sprite, int xOffset, int yOffset)
    {
        for (int y = 0; y < sprite.Height; y += yOffset)
        {
            for (int x = 0; x < sprite.Width; x += xOffset)
            {
                this.sprites.Add(sprite.Clone(new Rectangle(x, y, xOffset, yOffset)));
            }
        }
    }

sentences:
Unity network player synchronization issues with HingeJoint(s) I have a vehicle with custom wheels which are connected to it by the HingeJoint components. Everything works perfectly when using this car in single-player mode. Wheels are actually as Cylinders. They have HingeJoints attached through which they are bound to the vehicle's Rigidbody. Then I set JointMotor.force and the wheels are getting rotated and the vehicle is moving. It all works very naturally in terms of physics, I don't need to emulate anything.

Still, there is an issue with network synchronization in multiplayer mode and I have no idea how to solve it.

It's said that the proper way to sync the position of a physical object is to use rigidbody.MovePosition(), but any manipulation with Rigidbody leads to the collapse of the vehicle hinge-joints. The only method that works is setting transform.position directly. But this is not recommended for physics and it doesn't allow to synchronize the vehicle smoothly with no twitching. Is there a way to solve this somehow?

I'm using Photon for networking (if it matters in the question context).

sentences:
DirectX9 Drawing Sprites out of place due to offset This is my very first time into DirectX. Im trying to make a simple 2D game, just for learning the basics. And i've achieved that. The next step is to draw an animation using sprites.

For that, i downloaded SpriteBuddy, a very simple and user friendly software that helps you creating the metadata for your spritesheet.

Ok, now, the problem im having is that, the metadata that i get from spritebuddy (and i know is not the spritebuddy data that is wrong because i downloaded a few more software and the result was the same) come with a offset for every sprite.

Now, when im drawing, i said, lets add the offset to the position of the sprite, that should do it. Annnnnd it didnt, so i started to manualy change the metadata to see how bad was it. The result was that on the y axis, if you doubled the ammount in the metadata, the drawing was a lot less messy.

Is there something im doing wrong?

SpriteData* metadata = this->m_pXMLTraductor->getSpriteDimension(numFrame);//the number of the frame we want the dimensions
RECT temp = metadata->position;
D3DXVECTOR3 vCenter(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 vPosition(this->vPosition.x + this->metadata->offset.x, this->vPosition.y + (metadata->offset.y*2) , 0.0f);

this->m_pSprite->Begin(D3DXSPRITE_ALPHABLEND);
this->m_pSprite->Draw(
    this->m_pTexture->GetTexture(),
    &temp,
    &vCenter,
    &vPosition,
    D3DCOLOR_COLORVALUE(1.0f, 1.0f, 1.0f, 1.0f));
this->m_pSprite->End();
long long cont = 0;
this->numFrame++;
if (this->numFrame > this->m_pXMLTraductor->spriteCounter()){
    this->numFrame = 0;
}

This is how i render the model.

Is there any other way to do this? Srry about my english. Im working on it too ^^

sentences:
Unity shader to pick 1 of 2 base colors for individual instances (picture) I am building this scene in 3D using Unity 2019.3.13's Universal Render Pipeline. I have a block prefab that I want to instance, but I want to choose which are yellow and which are blue (you can see the materials are basically the same). How can I write a shader that will allow me to pick either yellow or blue in the editor for each one? Is this possible? What is the most optimal way to make dozens of identical blocks where the color is different for specific instances?

(I would prefer a script to a graph, something with a simple switch/boolean input and hex values:
yellow: e4c658
blue: 32676a

sentences:
How to map gamepad inputs for my platformer? With keyboard+mouse controls, we seem to have an unspoken control mapping standard, with keys be like WSAD for moving, E for use, mouse button for attacks or interactions, spacebar for jumping, and so on. But I'm unsure what conventions apply to gamepads.
I'm doing the typical platformer game, so my input would be:

movement
sprinting
jumping
attack
interacting
accessing main menu
accessing inventory menu.

How can I map these actions to a gamepad's buttons/sticks in a way that will be intuitive for my players?

sentences:
How to implement a mechanic of entering a town I am planning a game played on a 2-D map, where some spots are "towns". When the player walks into a town, he enters a high-resolution map of this town; when he exits the town, he returns to the low-resolution map of the world (as in e.g. Ultima 4). My question is how to implement this enter/exit mechanism in Unity? I thought of two approaches:

The world map and each of the town maps is a different scene. Entering/exiting a town is implemented by loading the appropriate scene using the scene manager.
There is a single scene, but the maps are geographically separted. For example, the world map is in coordinates 1...256, town A map is in coordinates 301...364, town B map is in 401...464, etc. Entering/exiting a town is implemented by moving the player and the camera to the appropriate map.

Is there a better approach? What approach is commonly used to implement this mechanism?

sentences:
Bullet Physics too many rigid bodies framerate drops I have a question regarding rigid bodies in bullet physics.

At the moment I have low-poly asteroids, which I create a convex Hull shape.
Then I add a motion state and give them a linear velocity.

Collision and everything is working fine, if its a low amount of asteroids (less than 5).

But as soon as the amound of objects in the world get higher, my framerate starts to drop under 1 FPS.

I have a Intel i56600k and a AMD Fury. Could it be related to my hardware?
Or is bullet limited in this regard? Or did I do something wrong in my program?

I'm writing the game in C++.

sentences:
Jumping to land x pixels ahead while not really moving (2D) The player object in my game has its x-axis locked. It can only jump on Y. It's the ground that constantly moves to the left so that it appears like the player is moving to the right.

The ground is moving left at a speed of 240 pixels per second.

Whenever the player falls and hits the ground, I want it to jump so that it hits the ground again when it has gone 180 pixels to the left.

So, it should jump, the ground should get to move 180 pixels and then the player should hit the ground at that moment and jump. Then repeat. 180 pixels each time.

Oh and, the jump height may be variable. Specifically, there will be two jumps: a small jump and a big jump. Both need to land after the ground has moved 180 pixels.

I'm bad at math, so I can't figure it out. I would appreciate any help!

sentences:
libgdx - Texture not appearing sometimes When I run the App the Ball moves sometimes downwards, but sometimes its not moving. I dont change anything on script.

What I want is the ball should come from top outside of the screen, but when its visible in screen it should get an random xSpeed.

To test it I added first the bomb in the middle of the screen. But as I said the Ball is not showing sometimes. I run the game on my samsung galaxy s6 edge and the ball is there. Then when I run again it's not there.

That's how I coded.

private static final int SPRITE_SIZE = 32; // It has 32px width and height
private static final int SPRITE_COUNT = 4; // there are 4 sprites
private static final float MAX_SPEED = 1f; // maxspeed
private static final float MIN_SPEED = 0.25f; // min speed

private Vector2 position;
private Animation anim;
private Random random;

private float speedX, speedY;

public Bomb() {
    random = new Random();
    int rand = random.nextInt(2);

    TextureRegion tmp = new TextureRegion(Asset.sprites, SPRITE_SIZE * SPRITE_COUNT, rand * SPRITE_SIZE);
    anim = new Animation(tmp, SPRITE_COUNT, 0.75f);

    position = new Vector2((MainGame.WIDTH/2) - (SPRITE_SIZE/2), MainGame.HEIGHT);
    speedX = 0;
    speedY = -MAX_SPEED;
}

public void update(float dt) {
    anim.update(dt);
    if(speedX == 0) {
        if(position.y + SPRITE_SIZE < MainGame.HEIGHT) {
            speedX = random.nextFloat() * (MAX_SPEED - MIN_SPEED) + MIN_SPEED;
    }
    position.add(speedX, speedY);
}

public void render(SpriteBatch sb) {
    sb.begin();
    sb.draw(anim.getFrame(), position.x, position.y);
    sb.end();
}

EDIT: Maybe here's a problem?

Asset.java

public class Asset {
    public static Texture sprites;

    public static void init() {
        sprites = new Texture(Gdx.files.internal("sprite.png"));
    }

    public static void dispose() {
        sprites.dispose();
    }
}

Animation.java

public class Animation {
    private Array<TextureRegion> frames;
    private float maxFrameTime;
    private float currentFrameTime;
    private int frameCount;
    private int frame;

    public Animation(TextureRegion region, int frameCount, float cycleTime) {
        frames = new Array<TextureRegion>();
        int frameWidth = region.getRegionWidth() / frameCount;
        for(int i = 0; i < frameCount; i++) {
            frames.add(new TextureRegion(region, i * frameWidth, 0, frameWidth, region.getRegionHeight()));
        }
        this.frameCount = frameCount;
        maxFrameTime = cycleTime / frameCount;
        frame = 0;
    }

    public void update(float dt) {
        currentFrameTime += dt;
        if(currentFrameTime > maxFrameTime) {
            frame++;
            currentFrameTime = 0;
        }
        if(frame >= frameCount) {
            frame = 0;
        }
    }

    public TextureRegion getFrame() {
        return frames.get(frame);
    }

    public void dispose() {
        for (int i = 0; i < frames.size; i++) {
            frames.get(i).getTexture().dispose();
        }
    }
}

sentences:
Unity - Bullet spawns in wrong position in client I am making a multiplayer game with prefab shooting, but unfortunately the prefab  sometimes spawns in the wrong position when I shoot from a client. The bullet tends to spawn in a location where the player was a few miliseconds ago, making that the bullet sometimes spawns inside of the player which killing the player in the process.

For shooting, I currently have this code setup to instantiate the bullet

void Update() {
    if (Input.GetMouseButtonDown(0)) {
        float angle = GetComponentInChildren<Weapon>().angle;
        CmdShootBullet(angle);
        rigidbody.AddForce(Quaternion.AngleAxis(angle + 180, Vector3.forward) * Vector3.right * (bulletPrefab.GetComponent<Bullet>().force / 7.5f));
    }
}

[Command]
void CmdShootBullet (float angle) {
    GameObject bullet = Instantiate(bulletPrefab, firePoint.position, Quaternion.identity);
    Bullet bulletScript = bullet.GetComponent<Bullet>();
    bulletScript.shotBy = gameObject;
    bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right * bulletScript.force);
    NetworkServer.Spawn(bullet);
}

And this is the setup for the location of the player and the gun. The top one is the player, the bottom is the gun.

My guess is that it has to do with lag, that the player position does not update soon enough, so how would I make it that the bullet spawns in the position of the player in the client rather than the position of the player in the host?

sentences:
How should we determine which portions of the game to develop first? We are developing an action RPG and have listed out the following modules/subsystems that we're going to need to make:

HUD(Heads-up Display) System
EXP/Leveling System
Combat and Navigation System
Character Controller System
Skill System
Monsters and NPC (AI)
Levels (Missions) System

The combat system is real time and we planned to include a puzzle type game in some (60%) of levels. We also have a game plot.  Which modules should we develop first?

sentences:
Why are 3d projections on a 2d screen not like what the human eye sees? Firstly, I'm sorry if this question doesn't make much sense or is poorly written - I have almost no experience with programming, and none at all with game development. I'm also not sure it's an appropriate question for gamedev stack exchange, so sorry if that's the case.

Anyway, the question is this - what are some ways of doing the vision in a fps game?

If I understand it correctly, the problem can be stated the following way - given a 3d environment given in 3d coordinates, and a camera with some direction and certain field of vision, our goal is to somehow project the environment, to a 2d screen, similar to how our eyes do it, or similar to how a camera does it.

One way to do this is the following - whatever is exactly in the direction of the camera will get displayed exactly to the middle of our 2d screen (let's presume the 2d screen is round for simplicity, with radius 1), and the rest in the field of vision will get projected linearly based on the angle. For example, if field of vision is 90 degrees (anything 45 degrees from the direction of the camera will be in the field of vision), then things 45 degrees away from the direction of the camera will get displayed to the outer circle/edge of the 2d screen, and things 22.5 degrees away will get displayed to the circle with radius 0.5. This might be similar to how a camera or our eye does it, but I'm not sure.

Now in reality, this doesn't seem to be how it's done. To give an example, if I take something like DOOM, or I think any modern fps game, and I were to stand in front of a very long wall that's of the same height everywhere, and I were looking perpendicularly towards it, the height of the wall will be the same everywhere in my 2d projection - in reality though, or a camera for example, would display the very furthest (furthest from the center of the vision) parts of the wall to be shorter in height.  But, given a small enough field of vision, the difference seems negligible.

Either way, it seems like fps games don't really consider this fact, and I want to ask - why? Maybe the difference is barely noticeable, but much more power demanding? Either way, I would appreciate an explanation or information concerning how exactly the human eye or camera projects 3d environment to a 2d picture.

sentences:
Curiosity on any Smartphones that Run on Android 2.3.3 with Different Screen Reoslution I have a question regarding about any smartphones that run only in Android 2.3.3. Is the size of screen or the screen resolution is always HVGA or does it have capable of running this OS (Android 2.3.3) on big screen size (4" to 5") at about 720x1280?

I'm thinking of the game's compatibility depending on the version of the Android OS and the screen resolution, which affects the change of coordinates especially for assigning touch buttons and drag-n-drop at exact location, before I'm gonna decide to make one. My program works on the Android 4 ICS and Jellybean, however, will that work on Android 2.3.3 in spite of precise touch coordinate or just dependent on the screen resolution (regardless how large it is) as the X and Y coordinate?

And take note, I'm using Eclipse IDE for Java developers.

sentences:
How can I move game objects using keyboard in the Unity scene editor? I know I can click on the "move" button

and use my mouse to drag the object around. How can I do the same using my keyboard?

sentences: GL_GENERATE_MIPMAP vs. GL_MAX_TEXTURE_SIZE If we generate mipmaps for a texture using GL_GENERATE_MIPMAP (or glGenerateMipmap), how big can the original texture be? Is it the size returned by GL_MAX_TEXTURE_SIZE, or half of it?

sentences:
Spawning random objects at random positions in the 3D world My main character can move horizontally and not vertically. It can move from x = -4 to 4 and z = -4 to 4 (a square area). I don't want objects to spawn where my character can move but every where else.
I wrote the following script. According to me it should have worked perfectly fine. But, I can't figure out why the objects are still spawning in the perimeter where the main character is present.

public class SpawnGameObjects : MonoBehaviour
{
    public float secondsBetweenSpawning = 0.1f;
    public float xMinRange = -25.0f;
    public float xMaxRange = 25.0f;
    public float yMinRange = -5.0f;
    public float yMaxRange = 0.0f;
    public float zMinRange = -25.0f;
    public float zMaxRange = 25.0f;
    public GameObject[] spawnObjects; // what prefabs to spawn

    private float nextSpawnTime;

    void Start ()
    {
        // determine when to spawn the next object
        nextSpawnTime = Time.time+secondsBetweenSpawning;
    }

    void Update ()
    {
        // exit if there is a game manager and the game is over
        if (GameManager.gm) {
            if (GameManager.gm.gameIsOver)
                return;
        }

        // if time to spawn a new game object
        if (Time.time  >= nextSpawnTime) {
            // Spawn the game object through function below
            MakeThingToSpawn ();

            // determine the next time to spawn the object
            nextSpawnTime = Time.time+secondsBetweenSpawning;
        }
    }

    void MakeThingToSpawn ()
    {
        Vector3 spawnPosition;

        // get a random position between the specified ranges
        spawnPosition.x = Random.Range (xMinRange, xMaxRange);
        spawnPosition.y = Random.Range (yMinRange, yMaxRange);
        spawnPosition.z = Random.Range (zMinRange, zMaxRange);
        if ((spawnPosition.z < 4 && spawnPosition.z > -4) || (spawnPosition.x < 4 && spawnPosition.x > -4))
        {
            MakeThingToSpawn ();
        }

        // determine which object to spawn
        int objectToSpawn = Random.Range (0, spawnObjects.Length);

        // actually spawn the game object
        GameObject spawnedObject = Instantiate (spawnObjects [objectToSpawn], spawnPosition, transform.rotation) as GameObject;

        // make the parent the spawner so hierarchy doesn't get super messy
        spawnedObject.transform.parent = gameObject.transform;
    }
}

sentences:
DirectX11 without window attached? I just wonder, if it's possible to initialize and use DX11 or DX9 for offscreen rendering only - meaning with no attached window.
My intention is to do some GPU benchmarking before opening actual window. In this benchmarking some test scene is rendered, but should not be visible. (Actually depending on the benchmark score different windows are opened)

sentences:
Separation of world state and animation in a turn based game How do you handle the separation of animation from the world state within a turn based game? I'm working on a 2D grid based game currently. The below code is simplified to better explain.

When an actor moves, I want to pause the flow of turns while the creature animates and moves to the new position. Otherwise, the screen could lag significantly behind the world state, which would cause weird visual appearance. I also want to have animations that don't block the flow of the game - a particle effect could unfold over multiple turns without affecting gameplay.

What I've done is introduce two types of animations, which I call blocking animations and non-blocking animations. When the player wants to move, the code that gets executed is

class Actor {
    void move(PositionInfo oldPosition, PositionInfo newPosition) {
        if(isValidMove(oldPosition, newPosition) {
             getGame().pushBlockingAnimation(new MoveAnimation(this, oldPosition, newPosition, ....));
             player.setPosition(newPosition);
        }
    }
}

Then the main update loop does:

class Game {
    void update(float dt) {
        updateNonBlockingAnimations(dt); //Effects like particle explosions, damage numbers, etc. Things that don't block the flow of turns.
        if(!mBlockingAnimations.empty()) {
            mBlockingAnimations.get(0).update(dt);
        } else {
             //.. handle the next turn. This is where new animations will be enqueued..//
        }
        cleanUpAnimations(); // remove finished animations
    }
}

...where the animation updates the screen position of the Actor.

One other idea I am implementing is to have a concurrent blocking animation, where multiple blocking animations would be updated simultaneously, but the next turn wouldn't happen until all of them were done.

Does this seem like a sane way to do things? Does anyone have any suggestions, or even references to how other similar games do such a thing.

sentences:
MonoGame not all letters being drawn with DrawString I'm currently making a dynamic user interface for my game and are setting up having text on my buttons. I'm having an odd issue where, when i use a specific piece of code to determine the text position, it will not render all of the text passed to DrawString. Even weirder, is if i insert another DrawString after this, drawing more text at a different place, different parts of the text will be drawn.

The code for drawing my button with the text attached is:

public override void Draw(SpriteBatch sb, GameTime gt)
{
    sb.Draw(currentImage, GetRelativeRectangle(), Color.White);
    sb.DrawString(font, text,
        new Vector2(this.GetRelativeDrawOffset().X + this.Width / 2 - font.MeasureString(text).X / 2,
            this.GetRelativeDrawOffset().Y + this.Height / 2 - font.MeasureString(text).Y / 2), textColor);
}

The methods in the creation of the Vector2 simply get the draw position of the button. I'm then doing some calculation to center the text.

This produces this when the text is set to 'Test':

And when i enter this piece of code below the first DrawString:

sb.DrawString(font, "test", new Vector2(500, 50), Color.Pink);

I should mention that that grey square is being drawn in the same spritebatch, before the button and the text.

Any ideas as to what could be causing this? I have a feeling it may be due to draw order, but i have no idea how to control that.

sentences: GLSL Shader Solution for Ambient Occlusion? For the iOS app I am writing I want to incorporate some aspects of ambient occlusion for photo manipulation. Can someone suggest a GLSL approach that will work. Realtime performance is not super critical. Under a second compute time is fine.

sentences:
Where have the cross and dot products gone in DirectX10? In D3D9 there were functions to deal with D3DXVECTOR3's in order to calculate dot and cross products. However these have disappeared from the math library in D3D10.

I assume they must have gone somewhere? My question is where and why?

sentences:
How Do I Play An Animation In Unity 5.3.4? I am confused on how to play an animation with the new unity version because the flag "Automatically Play Animation" is gone.  I cant have the animation connected to my GameObject because it plays right away.

using UnityEngine;
using System.Collections;

public class FPSCamera : MonoBehaviour {

    public float lookSensitivity = 5;
    private float xRotation;
    private float yRotation;
    private float currentRotationX;
    private AnimationClip walking;

    void Start() {
        // DONT KNOW HOW TO FIND AND START WALKING ANIMATION CLIP
    }
    void Update() {
        yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
        xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
        xRotation = Mathf.Clamp(xRotation, -90, 90);
        transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
    }
}

sentences:
How to create landscape image from 2D map? I created a 2D map using Perlin Noise. Based on the value on x,y, I determine an altitude and so a color to apply to my map (8 levels map).

Now, I don't want my player to see the map but I would like him to show him what he sees when he look North direction.

I'll explain the approaches I used to solve my problem and show you the results, then I'll ask my questions for some whom can help.

V1 - the pov approach

I tried a simple approach for the beginning. Based on my character, I start to add what I see in front of me and if I see something higher, i add it on top of the first thing I see + I increase my angle of view.

V2 - the layer approach

For my second approach, I started far from my player position and started to build layers from far to near him. This way I created a vertical cut (from east to west) and put it flat.

V3 - the layer shadowed approach

My third approach is based on the second one + I detected that two elements are one far from the other and I took it in count to generate "shadows" (darker borders).

V4 - the layer shadowed approach + adding pov alteration

Based on V3 approch, hard to explain, the near I am, the less the view is important. (reducing the map view).

Results

I like the way it evolved but I don't like some stuff (for example the cut mountain on first frame)
The second thing I didn't take in count is the altitude of my character.

Do you have any algorithms to solve this problem? I'm not looking for now for optimizations, just to get the best render. I also posted this article on reddit in /r/algorithms

sentences:
How to remove terrain in 3d? After the release of Minecraft I saw more and more rip offs of the game but some actually began to change it up a bit making the game have a organic look instead of the iconic blocky one that Minecraft does. If you'd like to look at the game that i'm referring to you can do so here. If you skip to around 50 seconds on the first video the steam page offers you can see the mining part that i'm wondering about.

I was wondering how this affect is achieved where they are able to remove part of the 3D object on collison with the players pick. I have heard about constructive solid geometry before and figured that could have been used but i'm not so sure.

sentences: Are there any video tutorials available for game programming with Max? Are there any videos on how to make a small game using Max? I mean is it only done in Max or are there other things used? I am a newbie in game programming.

sentences:
How can I convert a paid iOS game to a free game with in game purchases? I have developed a game for iOS that has had a decent amount of downloads, but I think I would get significantly more revenue if I were to convert the game to free to play, with in app purchases (especially since some competitors products are now free to download with in app purchases).

My question is what is the best way to go about converting to a free game with in app purchases without annoying the existing users?

On upgrading I'd like the people who previously paid for the app to have access to all the in-app purchases because I don't want to make them have to pay for content they previously had, and I don't want to make all the content (that is currently in the game) free.

sentences:
Is there any way to get PVRTexTool's version from the command line? I am to make an automated task which involves requiring the version of the PVRTexTool that comes with the Unity installed in a machine.

Is it possible to get the version of PVRTexTool on the command shell?

sentences:
What are spline input keys? There isn't a really adequate explanation of these anywhere on the internet, so I thought I'd ask this question here.

What are spline input keys in Unreal?
How are they represented in Unreal?

Also:

FindInputKeyClosestToWorldLocation returns a float.

What is this return value?
Why is it a float?

sentences:
Facebook Scores API Global and Daily Rank on Unity I need to implement 4 types of leaderboards on my Unity game:

All Time/Daily
Global/Friends

I'm using Scores API from Facebook and I achieved All Time Friends Leaderboards. I'm taking a look at the Scores API documentation and I'm not seeing Daily nor Global rank anywhere.

Is it possible? If yes, how?

sentences:
Indie devs working with publishers I'm an independent game developer considering working with a publisher.  This question is very informative however I have more questions.  Please give feedback on the following issues... I think this can be helpful to many indie devs in the same situation.

Source code: is it common for developers to give the publisher the source code?
Code quality:  does this matter when working with a publisher any more so than when just working on your own (or in a small team)?  Just wondering if developers working for the publisher might scoff at the code quality and perhaps influence the relationship between developer and publisher.
Unique game concepts: are publishers generally biased towards new/novel game concepts?
Intellectual property: if I send a playable demo to a publisher what's to stop them from just reproducing the new/novel game mechanic?  I think the answer is basically nothing... but I'm wondering if this is a realistic concern.
Revenue sharing: how does it work? what's a common ratio?  70/30?  30/70?
Flaky publishers: how common is it for a publisher to "string along" developers for a while then just drop them?  Can this be reconciled with a contract of some kind?

And any other issues you've encountered or heard of.

sentences:
Isometric 3d collision detection I'm making an isometric map for a game, I can draw it, but I don't know how to implement a sort of 3d collision detection without Threejs or other 3d library.

It is possible? Maybe make the block an Object can help? I have searched a lot on the web, but I found only libraries. Thank you!

This is my JavaScript code:

var canvas = document.getElementById('canvas'),
 ctx = canvas.getContext('2d'),
 width = canvas.width = window.innerWidth,
 height = canvas.height = window.innerHeight,
 stop = false;

var tw, th;
var player;

setup();
draw();

function setup(){
  ctx.translate(width/2,50);

  tw = 60; //tile width
  th = 30; // tile height
  player = new Player(2,3,2);

};

function draw(){

  ctx.clearRect(-width/2,-50,width*1.5,height+50);

    for(var i = 0; i < 5; i++){
      for(var j = 0; j < 5; j++){
        drawBlock(i,j,1,tw,th);
      }
    }

    if(!stop){
     requestAnimationFrame(draw);
    }
}

function drawBlock(x,y,z,w,h){

 var top = "#eeeeee",
     right = '#cccccc',
     left = '#999999';

 ctx.save();
 ctx.translate((x-y)*w/2,(x+y)*h/2);

 ctx.beginPath();
 ctx.moveTo(0,-z*h);
 ctx.lineTo(w/2,h/2-z*h);
 ctx.lineTo(0,h-z*h);
 ctx.lineTo(-w/2,h/2-z*h);
 ctx.closePath();
 ctx.fillStyle = "black";
 ctx.stroke();
 ctx.fillStyle = top;
 ctx.fill();

 ctx.beginPath();
 ctx.moveTo(-w/2,h/2-z*h);
 ctx.lineTo(0,h-z*h);
 ctx.lineTo(0,h);
 ctx.lineTo(0,h);
 ctx.lineTo(-w/2,h/2);
 ctx.closePath();
 ctx.fillStyle = "black";
 ctx.stroke();
 ctx.fillStyle = left;
 ctx.fill();

 ctx.beginPath();
 ctx.moveTo(w/2,h/2-z*h);
 ctx.lineTo(0,h-z*h);
 ctx.lineTo(0,h);
 ctx.lineTo(0,h);
 ctx.lineTo(w/2,h/2);
 ctx.closePath();
 ctx.fillStyle = "black";
 ctx.stroke();
 ctx.fillStyle = right;
 ctx.fill();

 ctx.restore();

}

function drawTile(x,y,stroke,col){

 ctx.save();
 ctx.translate((x-y)*tw/2,(x+y)*th/2);

 ctx.beginPath();
 ctx.moveTo(0,0);
 ctx.lineTo(tw/2,th/2);
 ctx.lineTo(0,th);
 ctx.lineTo(-tw/2,th/2);
 ctx.closePath();
 if(stroke){
  ctx.stroke();
 }else{
  ctx.fillStyle = col;
  ctx.fill();
 }

 ctx.restore();

}

function Player(x,y,z){
  this.x = x;
  this.y = y;
  this.z = z;
  this.w = 10; //width
  this.h = 10; //height
}
canvas{
  width:100%;
  height:100%;
}
<canvas id="canvas"></canvas>

sentences:
Frequently change TextMeshPro text without garbage allocation? Is there a way to frequently change a timer display created with TMP, without it generating garbage?

I'm currently using TMP.SetText(), which is supposed to not generate garbage, but it does.

sentences: Unity tilemap collider not colliding with rigidbody In the wireframe you can see the tilemap collider for this hill. The red circle falls right through however. The circle has a 2D rigidbody attached. Everything is on the Default sorting layer and on layer order 0.

sentences:
How is the "continues road" from 80's games called and done? i like to test the "continues road" effect from 80's racing games . i call it like this i have no idea how it really called
the effect that a car is in front of you , and the road is Approaching to you ,
some thing that can seen in games like :
http://www.myabandonware.com/game/turbo-1ti
http://www.myabandonware.com/game/angel-nieto-pole-500-sp-2le

where i can find example of implementing such alurithem ? c++ is prefered but dosn't have to be c++ .
Thanks !

sentences:
Effects of collisons: broken glass, damaged cars, how are they created? My question is related in particular to achieving the effects of collision in game engine, how is this done?

I have searched a bit, read from the internet and went through a few tutorials, and saw that one way to create one of the effects, explosion, or something breaking is to create the model in pieces, and apply force (in a game engine such as Unity 3D) to make the pieces fly off. It seems to be a solution, but it doesn't address the problem of items that are vaporized in a big explosion, with so many pieces. How is this done? Basic methods and tricks etc would be helpful.

Secondly, the problem of things bending and getting damaged on impact, such as a car's front end destroyed when it hits a wall? How is this done? One thing that comes into my mind is to create each component of a car in a different state as an animation in 3Ds Max or Maya, and then in the engine, according to the collision, switch the model state in the time bar. Is this how it is done?

Finally, what about materials, such as net of a basketball net, or a soccer goal net for example? Effects of ball hitting it can be calculated and applied in a script, but how to make the net bend and stretch with it? Is it done through models or materials?
Also what about a flag fluttering in the wind?

My questions are specific to game engines, particularly Unity3D. Some good links on the subject would also be helpful.

sentences:
LibGDX - Best way of scrolling background I'm new to LibGDX and i'm trying to implement a screen where i have a guy running and the ground under him scrolling to give impression he is really running in a sidewalk for example.

The ground should be interactive meaning it will not only change his colors or Texture but there will also be holes in it and so on.
As you can see from the picture below each brick is a Block Object and i'd like to keep it this way.

Do you think in this case the best thing is to move the camera so i can show the screen ahead or try to scroll the background elements editing their position?

Update

So to be more clear, each block is separated from the others so it is impossible to "scroll the background" since there is no a real background, also each block will have different properties, it means it can be a block or a hole or whatever, basically i see the possibility of the  scrolling camera as only solution.

sentences:
Unity Change Ball Direction after hitting paddle in a Pong game (like in dx-ball) I'm struggling with how to get the ball to change the bounce based on where it hits on the paddle. Normally in a pong game, the angle changes, depending on how far from center the ball bounces, and which direction of the center it bounces. I managed to do something like that:

//rb = rigidbody, velOnPaddleHit = predefined float
float dist = transform.position.x - paddle.position.x;
dist = transform.position.x > paddle.position.x ? dist : -dist;
dist /= paddle.localScale.x/2;
dist *= velOnPaddleHit;
rb.addForce(dist, 0,0);

But it's just not working / it's weird. Can anyone help me?

Edit: Here's the video showing this kind of behaviour. When the ball hits the left side of the paddle, it goes left, the velocity doesn't matter

https://www.youtube.com/watch?v=fHX_2DLDp1w

sentences:
Entity/Component System and UI "Entities" I'm still green to entity/component systems. I find that since I have useful components for drawing sprites (or spritesheets) and handling input (mouse/touch clicks), I naturally want to reuse these to create UI components (like buttons, eg. level-select screen).

This strikes me as very odd. I always understood entities as "game model" things like players, enemies, power-ups, etc. On the other hand, from a code-reuse perspective, reusing compnents for UI makes perfect sense.

How (and where) do UI/GUI concerns fit into an entity/component system?

(Note: this question is platform agnostic since it applies to multiple platforms/languages)

sentences:
For creating a distant moon in a 3D game, is it better to use a model or texture? I'm working on my indie game and I want to create a moon (it's a 3D game) however I am unsure if I should create a model and put it far away, or if I should use a texture on a plane and have it constantly move so the face of the plane is facing the player.

The problem I had last time I tried a model is the render view, as the model was really far away (as when I did it very small, you could sort of tell it was a tiny model rather then a far-away moon) and with the texture I'm not sure if it comes across as tacky.

I'd really like to hear the pros and cons of each, since I'm planning to use the 'render objects only when in view' method and basically want advice on which I should go with.

sentences:
Making classes available to others I'm currently working on a 2D game engine in XNA, and I am very interested in architecture, and how best to let my game objects communicate.

I know a lot of people use a Singleton design but I believe that this is more of a "counter-architecture" way of doing things, as every class will have access to the Singleton.

I was comtemplating using a Service-type architecture to allow for my Input, Sound, etc Manager classes to be available, but this is essentially the same problem as the Singleton as all the Classes are available to 'whoever' wants them.

I could of course pass references to the objects when they are needed, but this is bloated.

I wonder if making the 'Services' only allow certain objects to subscribe would be possible?

So is there a better way to make your classes available?

Or am I searching for an answer that doesn't have a question?

sentences:
Model too small in Orthographic view This must be super-basic, but I don't know where the problem is, since I just started with 3D-Programming.

Why is my model "ballTest" so small on the screen?

private Model _model;
private Matrix view, proj;

//Initialize()
_model = Content.Load<Model>("ball test");
view = Matrix.CreateLookAt(new Vector3(0, 0, 10), new Vector3(0, 0, 0), Vector3.Up);
proj = Matrix.CreateOrthographic(800, 480, 0.1f, 30.0f);

//Draw
_model.Draw(Matrix.Identity, view, proj);

sentences:
Unity: Controlling animation by switching between a GameObjects children I bought an asset the other day containing an Atlas of character parts (head, hairs, clothes, body-parts). It's great and allows me to tint each piece any color I want. However, The artist decided to devide up the character like this:

Each child is a fully setup character, facing a certain direction, with an Animator attached to it, inside each Animator Controller you find this:

Some sample animations, pretty self-explanatory.
However, I have never worked with sprites like this where its several parts, the entire character is maybe 30-40 parts (allowing for some fun animations).
I'm used to making Blend Trees (on a single GameObject) and have one animation for each direction.
The best solution for controlling these animations I could think of was something like this:

private void AnimControl() //call in update
    {
        if(direction != directionLastFrame) //do not run method if we are moving same direction
        {
            //standing still
            if (direction.x == 0 && direction.y == 0)
            {
                directionLastFrame = direction;
            }
            ////left
            else if (direction.x < 0.5f && direction.y == 0)
            {
                currentCharacterDirection.SetActive(false); //set current gameObject (which is a character facing a certain direction) inactive
                currentCharacterDirection = character.leftDirection; //change to correct direction
                currentCharacterDirection.SetActive(true); //set gameobject active again
                anim = currentCharacterDirection.GetComponent<Animator>(); //set the animation controller to the new gameObject
                directionLastFrame = direction; //set the new direction to check for
            }
            ////right
            else if (direction.x >= 0.5f && direction.y == 0)
            {
                currentCharacterDirection.SetActive(false);
                currentCharacterDirection = character.rightDirection;
                currentCharacterDirection.SetActive(true);
                anim = currentCharacterDirection.GetComponent<Animator>();
                directionLastFrame = direction;
            }
            ////down
            else if (direction.y < 0.5f && direction.x == 0)
            {
                currentCharacterDirection.SetActive(false);
                currentCharacterDirection = character.downDirection;
                currentCharacterDirection.SetActive(true);
                anim = currentCharacterDirection.GetComponent<Animator>();
                directionLastFrame = direction;
            }
            ////up
            else if (direction.y >= 0.5f && direction.x == 0)
            {
                currentCharacterDirection.SetActive(false);
                currentCharacterDirection = character.upDirection;
                currentCharacterDirection.SetActive(true);
                anim = currentCharacterDirection.GetComponent<Animator>();
                directionLastFrame = direction;
            }
        }

        anim.SetBool("Moving", playerMoving);
    }

I mean it works, but feels wrong? Anyone that can think of a better Idea here, worried this might be too slow. setting an object to active/inactive too often.

sentences: how to correctly scale box2d in libgdx I'm currently using 800x480 resolution and FitViewPort and I divided that by PixelPerMeter variable which is equal to 10 and that helped to move my box2d body faster. But when I tried to use fonts I could easily see pixels. What am I doing wrong and what can I do to fix that ?

sentences:
Unity 5 Animation attaching I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update ()
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

sentences:
Easiest Way To Implement "Slow Motion" and variable game speed in XNA? I have an XNA 4.0 game that I want to be able to switch into slow motion and back again to full speed every now and then.

So if you kill an enemy the game switches into slow motion as they explode and then goes back to normal.

What is the easiest way to do this in XNA 4.0 without having to alter all my existing code that relies on GameTime?

I have some code that relies on the TotalGameTime, which will be wrong unless I get XNA to slow down. Is there anyway to avoid refactoring that code?

Thanks!

sentences:
Unity3D: How to just center a mesh inside a character controller! Hi I have a simple character mesh and it's parented to my character controller-invisible-capsule object and all the moving code is applied to the parent (if that's relevant), but the point Is I'm trying to line up the mesh to be exactly inside the capsule to make it look like the player is walking ABOVE the ground (pretty normal ...?) So by default the character controller is origined in the center so I move it up by half of it's height to try to get it to line up with the character mesh, which has it's origin below it's feet a little, and this is the result:

as you can clearly see, his feet slightly go into the ground, I have no idea why this is happen, then should be just above the ground like any other normal feet! Here's the code for setting the capsule up half of it's width, since it starts by lining up the mesh in it's CENTER for some reason:

Vector3 tempPos = player.transform.position;

        tempPos.y += (capsuleSize.y / 2);// + chassidSize.y / 12;
        chassid.transform.position = player.transform.position;
        player.transform.localPosition = tempPos;
        chassid.transform.parent = player.transform;

and here's a picture of the mesh (which is just a blender file, easier for import):

As you can see, in the blender file, the origin is slightly below the characters feet, IN THE CENTER, so I don't know why it's not working as planned.

Also, you can see in the first picture that he's slightly moved to the center of the controller on the z(?) axis, but I want him to be completely centered in, any idea how to fix this?

sentences:
How to render multiple objects as a single object for fluid simulation? I'm trying to do fluid simulation using particles in 2d game. I have larger particles, which interactive each other physically, those particles collide with environment (e.g wall,obstacles) to simulate fluid.

However drawing things doesn't go well. I'm trying to figure out how to render the circles without the gaps in between. I've tried blurring the circles like so:

But the gaps remain. Also, blurring the particles causes the particles dimension to change visually every frame. Meaning the physics shape and the visual shape don't match up.

How can I render these objects as one?

finally, i got some effect like this, even artefacts exists:

here is my solution, steps as following:
1.draw water or fluid with SPH.
2. blur all of it.
3. does metaball with it.

sentences:
Animation inside GUI Good day.
I would like to create a "rich" GUI for my game.

How can i add a 3d model to a GUI Button (with continous rotation ) ?
If I can't add a 3d model to a GUI button, what is the best way to visualize a 3d model rotating ?

Maybe creating a video file or animated gif and adding it to my button ?

Thanks

sentences: What is the benefit of YCbCr? Why would someone want to store images as YCbCr instead of RGB in RAM or in GPU memory?

sentences:
Using box2d with starling In my game I have a Main class in which i am initializing starling framework by passing Game class like below

myStraling = new Starling(Game , stage);

In the game class I have Instances of Welcome class and InGame class these two classes extends starling.display.Sprite.I have a PhysicsHandling class seperately. Now i want to make instance of PhysicsHandling class  in the InGame class.
The physics handling class does not extend any class because it only does calculations. I have made its some variables public to position starling sprites accordingly.

My question is. Is it the right way to integrate physics in starling Performance wise .I mean is there a better way to do that

sentences:
The most popular Resolutions and Aspect Ratios in Android OS 2019 I develop the game with Libgdx framework. When I tried to deal with support multiple screen resolutions it turns out that Libgdx is not following Android approach how to deal with Screen sizes and densities (mdpi, hdpi, xhdpi, etc folders).

I found only one way to handle assets - ResolutionFileResolver.
I have to create folders with different resolutions and the Libgdx choose more appropriate texture for me automatically for each device.

Android platform has a huge amount of Phones and Tables with different screen resolutions. I have to find a good strategy on how to handle it.

For example let's take a look at the case where I have 2 folders in my game: "800x480" and "1440x2560". The device on which I run the game has "1280x720". In this case, "800x480" resolution will be chosen as more appropriate. It leads to bad quality of the Textures because of stretching.
At the same time, I can't leave only one asset with high quality. It leads to cut all older devices with a small amount of RAM.

The idea is to create 3 most popular resolutions for 3 categories:
low, middle and high resolutions.

Where can I find some statistic about the resolutions popularity of Android Devices? I know about the Android Developer Dashboard but it doesn't show Screen Resolutions.
Does anyone use Libgdx in 2019? How to deal with Multiple Screen Support in this framework?
Any real statistic about the most popular Aspect Ratio? Which aspect ratio you choose as "basic" in your games?

I would love to see any "best practice" how to cover as many devices as possible with the good quality of the view.

sentences:
Multiplayer turn based Android/iOS We're developing a mobile endless runner game, on Unity3d where you can challenge your Facebook friends. The only interaction between the players is the challenge - one player challenges the other, then each player plays when he wants, and after both players finish (when their character dies), their scores are compared to determine the winner.
What system would you recommend that would allow us to implement this functionality, considering scalability, cost and ease of use?
Thanks in advance!

sentences:
Word Puzzle: Less or more difficult I'm working on an app which is a Word Puzzle. Player has to arrange about 10 words in correct order to solve it.
I have two options to build it:

Give user feedback (right or wrong) when he has put each word
Give user feedback (right or wrong) when he has put all words

In first option, the player gets quick feedback (as early as putting first word). But it is easy to brute-force the puzzle and hence the difficult of the game is low.
In second option, the player has to wait for long time (until he/she puts all words). But the puzzle is difficult to brute-force and the difficulty of the game is high.
I'm not sure which option should I choose?

sentences:
How should I implement a timer in a strategy game? I'm developing a real strategy game for Android and want to implement timers. Those timers will represent the time remaining until some building is finished.

Say that i have a building in construction that takes 45 minutes to be completed.

How can I communicate this timer information between my client (Android app) my server and my database? Should I communicate to the server every second in which state my timer is?
Should I even do this on the server (i.e., should the timer run on the client)?

I'm inclined to assign this task to the server for security and integrity reasons, but i'm not sure on the way i can accomplish that.

sentences:
Can't use the hardware scissor any more, should I use the stencil buffer or manually clip sprites? I wrote a simple UI system for my game. There is a clip flag on my widgets that you can use to tell a widget to clip any children that try to draw outside their parent's box (for scrollboxes for example). The clip flag uses glScissor, which is fed an axis aligned rectangle. I just added arbitrary rotation and transformations to my widgets, so I can rotate or scale them however I want. Unfortunately, this breaks the scissor that I was using as now my clip rectangle might not be axis aligned.

There are two ways I can think of to fix this: either by using the stencil buffer to define the drawable area, or by having a wrapper function around my sprite drawing function that will adjust the vertices and texture coords of the sprites being drawn based on the clipper on the top of a clipper stack. Of course, there may also be other options I can't think of (something fancy with shaders possibly?). I'm not sure which way to go at the moment.

Changing the implementation of my scissor functions to use the stencil buffer probably requires the smallest change, but I'm not sure how much overhead that has compared to the coordinate adjusting or if the performance difference is even worth considering.

sentences:
Java and Eclipse setup properly, how do I install JOGL or LWJGL? I have my Java environment installed alongside Eclipse, and I was successfully able to create and run a new project (simple System.out.println("Yay I work!");

I have the OpenGL SuperBible, and I primarily want to code 3D things (I'll take my time using the book to learn how to draw shapes in 3D space, etc..)

Can you help me get setup with OpenGL in Java? I dont really need LWJGL, although I WILL make games eventually. I just can't even figure out with all of these terrible (and old) tutorials floating around on the net how to install either JOGL or LWJGL.

If you can give me a hand with that, I'd appreciate it. I'd like to feel I contributed by having this page show the answer to the question, so that other poor souls googling for this same information can benefit.

sentences:
A canvas to let through a given layer I have two canvases, both of them having a UI element on them.
At some point, both canvases will be active in the game (I just act like so, I want to make sure that my game works even if that's the case) and I want one of them to never block the other canvas's layer.

These two, let's say Canvas1 is on layer UI and is responsible for character jumping.
Canvas2 is on layer toggle time scale and it's job is to switch between timescale 0 and 1.
I want Canvas2 to be ALWAYS accessible, so its layer, toggle time scale is NOT blocked by the first canvas.
I tried messing around with the Blocking Mask but that didn't help, sometimes the ray still gets blocked out. How to set up those Blocking Masks for my canvases to work?

sentences:
Problem using glm::lookAt and glm::perspective I'm trying to change the code from the 22th tutorial at http://ogldev.atspace.co.uk/, using the GLM library, but the result seems wrong.
The problem is shown in the below picture:

While it should be:

This program displays a model onto the screen. The model is loaded using a library and I ensure that all of its vertices, normals, and texuture coordinates are loaded correctly. The problem seems to be at creating the Projection - model - view matrix. I searched for the use of GLM and use the below code to calcualate that matrix:

    glm::vec3 Pos(3.0f, 7.0f, -10.0f);
    glm::vec3 Target(0.0f, -0.2f, 1.0f);
    glm::vec3 Up(0.0, 1.0f, 0.0f);

    glm::mat4 viewMat = glm::lookAt(Pos, Target, Up);
    glm::mat4 perMat = glm::perspective(60.0f, (float)WINDOW_WIDTH/WINDOW_HEIGHT, 1.0f, 100.0f);

    glm::mat4 modelMat = glm::scale(glm::mat4(1.0f),glm::vec3(0.1f, 0.1f, 0.1f));
    modelMat = glm::rotate(modelMat, m_scale, glm::vec3(0.0f, 1.0f, 0.0f));
    modelMat = glm::translate(modelMat, glm::vec3(0.0f, 0.0f, 10.0f));

    //FINAL MATRIX
    glm::mat4 PVMMat = perMat * viewMat * modelMat;

After that, I supplied the matrix to the shader like this:

glUniformMatrix4fv(m_WVPLocation, 1, GL_TRUE, &PVMMat[0][0]);

Finally, in the shader, I calculate the gl_Position as below:

//vertex shader
void main()
{
    gl_Position = gWVP * vec4(Position, 1.0);
    TexCoord0   = TexCoord;
    Normal0     = (gWorld * vec4(Normal, 0.0)).xyz;
    WorldPos0   = (gWorld * vec4(Position, 1.0)).xyz;
}";
//Fragment shader
void main()
{
    FragColor = texture2D(gSampler, TexCoord0.xy);
}";

I tried my best for a few days and I can't see any error in the way I use glm::lookAt and  gml::perspective. This is exactly as in the manual on the GLM website. Could you suggest some reason for the problems I'm seeing, or some way for me to further investigate the error? Thanks so much. I hope to see your answer.

sentences:
2 Images, same object: tone difference and alignment I would like to know a software which helps in post-production to calculate the general color/tone difference of 2 images. The images contain the same object, but arn't shot from the same position. One image might be sunny, the other cloudy, so one is more orange/yellow, the other more grey/blue, but the same object.

How would you align the tone of the image?

Background info: i shoot a couple of hundreds of images to produce textures for my models, the objects are outside, so weather conditions can change at any time, shooting must continue. I do photogrammetry, so I use the images to project them on the geometry and bake them in a UV Map. So in general I have a chunk of images made in sunny condition and another in cloudy. I would like to apply a tone to all cloudy images, having similar tone like in the sunny images.

It's not about HDR.

sentences:
Problem with loading models with different shaders I am lerning opengl programming from http: //learnopengl.com .And i can load any model which i want.But if i want to load two models with different shaders,a problem occurs.
For example:
First i draw two models with same shader and there is no problem.

Model1.Draw(shader);
Model2.Draw(shader);

Then if i do this:

Model1.Draw(shader);
Model2.Draw(otherShader);

The first model is not drown.Only the second model is drown.
Here is my Model.h code and Mesh.h code:

Model.h: Model.h

Mesh.h Mesh.h

And if you want, these are my vertex and fragment shaders:

Shaders: http: //pastebin.com/d0v3Y4vU

Thank you for help!

sentences:
Memory dataflow for uniform variables? When a texture (2D) is supplied to a shader as a 'uniform' input, it is first uploaded to OpenGL using glTexImage2D() and then using glUniform1i() it is associated to shader uniform.

eg code :

Texture data

glTexImage2D(): is used to transfer texture data to the server side

glGetUniformLocation(): is used to access shader uniform handle

glUniform1i(): associates the data pointed by texture unit to the shader 'uniform'

but when we pass matrix (eg matrix4x4) to a shader as a 'uniform' input, when don't use any specific function to upload it to OpenGL.

(we just used to glUniform..() to associate the data with the shader input which we also used in the case of texture data)

Matrix data

glGetUniformLocation(): to access shader uniform handle

glUniformMatrix4fv(): to associate matrix data to the shader uniform input.

Where does the matrix data live in each step in the process of passing it to a shader as a uniform input?

Does matrix data always live on client side/ CPU accessible memory and fetched every frame by server side?
If it is uploaded to OpenGL:

which step/function call uploads the data?
where does the data live in OpenGL memory?
how its memory location is pointed?

sentences:
What are some standard stair dimensions for good level navigation? I am trying to establish some scale standards for a level. I have been following this guide: http://www.worldofleveldesign.com/categories/ue4/ue4-guide-to-scale-dimensions.php

So far I have walls at 3m high, doors at 2.1m by 1.1m, with the character standing at 1.82m by 0.6m. I am now trying to work out a "good" staircase size. I have tried the above guide's suggestion of 0.15m high by 0.3m deep for each step. To reach 3m however would require 20 steps with these dimensions, which means a single staircase would be 6m long! Visually this looks quite silly in my opinion. If I compare this to real life using the following calculator: http://www.calculator.net/stair-calculator.html,
using realistic step heights and depths the same staircase can be achieved at less than 4m length. This seems more realistic to me.

My main concern is not simply the visual appearance of the staircase, but how much space it will take up in a given building. If in each smaller building the staircase is taking up the majority of the floor space, this won't leave much for the more important elements. At the same time, I am concerned that if I make the staircase too steep it will have a negative effect on the gameplay and navigation. I understand that each level is different, however is there a good rule of thumb for getting started with this?

sentences: How do I get the number of online players in a Minecraft server from outside the client? I know that the Minecraft client can query the server for number of players and maximum players, even when the server properties has enable-query set to false, but how do I do this outside of the client? I am trying to implement this as part of a mobile (Android) app.

sentences:
How to limit click'n'drag movement to an area? I apologize for the somewhat generic title. I'm really don't have much clue about how to accomplish what I'm trying to do, which is making it harder even to research a possible solution.

I'm trying to implement a path marker of sorts (maybe there's a most suitable name for it, but this is the best I could come up with).

In front of the player there will be a path marker, which will determine how the player will move once he finishes planning his turn. The player may click and drag the marker to the position they choose, but the marker can only be moved within a defined working area (the gray bit).

So I'm now stuck with two problems:

First of all, how exactly should I define that workable area? I can imagine maybe two vectors that have the player as a starting point to form the workable angle, and maybe those two arcs could come from circles that have their center where the player is, but I definetly don't know how to put this all together.

And secondly, after I've defined the area where the marker can be placed, how can I enforce that the marker should only stay within that area? For example, if the player clicks and drags the marker around, it may move freely within the working area, but must not leave the boundaries of the area. So for example, if the player starts dragging the marker upwards, it will move upwards until it hits he end of the working area (first diagram below), but if after that the player starts dragging sideways, the marker must follow the drag while still within the area (second diagram below).

I hope this wasn't all too confusing. Thanks, guys.

Edit: In case this makes a difference, I'm using C++ with Marmalade SDK.

sentences:
How to manage in-game factions, alliances, federations, etc So this question is code or engine agnostic but, I’m looking for ideas on how a game can keep track of a pre-determined number of factions or alliances. For example, say I made a space game that has 2 major and 3 minor federations of planets. A planet may join or leave a federation, but the federation itself may have an alliance or be at war with another (actually, to keep it simpler, I think all these changes will solely be reliant on the player’s actions).
However, I would also like to keep track of such diplomatic endeavours on the ‘individual’ level as well. Say the player has joined one federation that is at war with another. If the player should encounter another ship of the opposing federation, that ship becomes hostile. On the other side, two ships have an alliance, they might help one another.
What is the best way to keep track of all this?
One way I was thinking was creating a manager that holds all the Federation classes (which hold the status it holds with all other federations — say less than 0 and the federations are at war; more than x-amount, there’s an alliance). Meanwhile, each player/ship holds similar data in its class, along with its current alliance to whatever federation. Is my thinking logical in this or are there better ways of managing such things? Many thanks.

sentences:
Optimizing Box2D for a couple hundred static bodies I searched but could not find anything similar (Yet) around the web, so here I am asking my question:
In my game I use around 3 to 4 hundred static bodies with like 10 dynamic bodies in the Box2D world. The problem is that after 100 static bodies it cant manage 60 frames / second. My understanding is that static bodies calculate faster then dynamic ones.
My rendering is pretty much bound to the iterator, so optimizing the game through removing objects entirelly is not really an option.
Is there a way I can speed up the physics sim for static bodies? I think about something like statics far from dynamics would be just jumped in the world step...
So generally I want to speed up the sim of static bodies, or completely not simulate them without removing them from the BodyIterator.
I am open to any suggestions.
Thanks for your help!

sentences:
What is the difference between OpenGL 1.x and 2.x? Is there a good tutorial that shows the difference between OpenGL 1.* and 2.*?

It would be very helpful to know which functions I should not be calling (like glBegin(), I assume).

sentences:
Unity: Resources folder empty in Build and public variables NullReferenceException I got 2 big problems that after a lot of research I´m unable to solve.

First problem: I got 5 xml files and a sub-folder inside the Resources folder but when I build my project, the Resources folder is empty (well, only two unity files in there: unity default resources and unity_builtin_extra. So I can´t access my xml files when I do: Resources.Load, anywhere on my code.

I post images to clarify:

Second problem: As Resources file was not working I decided to use public variables for my xml files declaring: public TextAsset myXmlDoc, but I realize that, only when I build this isn´t working as it gets NullReferenceException as if my public TextAsset variable wasn't assigned by me (wich is not true)

I post images and code to clarify:

public class LoadXml_Narrator : MonoBehaviour {

    NarratorTextClass narratorClass;
    public TextAsset file;

    void Awake()
    {

        print("Xml file " + file);
    }
}

This is the output log of my Build:

NullReferenceException: Object reference not set to an instance of an object
  at LoadXml_Narrator.Awake () [0x0001d] in D:\Projects\PC\Majorel_\Majorel_\Assets\Scripts\XML\Narrator\LoadXml_Narrator.cs:20

(Filename: D:/Projects/PC/Majorel_/Majorel_/Assets/Scripts/XML/Narrator/LoadXml_Narrator.cs Line: 20)

  Note: IN the editor everything works
  perfect. The issue is only when build
  and execute the project.

sentences:
POST HttpRequest doesn't send any data I've some trouble for sending a post request to my nodejs server.
I can receive data from the server with GET method, but when I try to send data with POST, I've an empty bracket on return on this function:
func _on_request_completed(result, response_code, headers, body):
    var json = JSON.parse(body.get_string_from_utf8())
    print(json.result)
    print(response_code)

And empty bracket on my JSON console.log on the server too.
My code:
extends CanvasLayer

func _ready():
    $HTTPRequest.connect("request_completed", self, "_on_request_completed")

func _on_Button_pressed():
    var data = {"name": "Godette"}
    _make_post_request("http://localhost:8080/", data, false)

func _on_request_completed(result, response_code, headers, body):
    var json = JSON.parse(body.get_string_from_utf8())
    print(json.result)
    print(response_code)

func _on_HTTPRequest_request_completed():
    pass

func _make_post_request(url, data_to_send, use_ssl):
    # Convert data to json string:
    var query = JSON.print(data_to_send)
    # Add 'Content-Type' header:
    var headers = ["Content-Type: application/json"]
    $HTTPRequest.request(url, headers, false, HTTPClient.METHOD_POST, query)

And this code return this in my console:
{}
200
Thanks for help :)

sentences:
fmod getWaveData() export to WAVE file help (C++) I am trying to export the current sound that is being played by the FMOD::System into a WAVE file by calling getWaveData(). I have the header of the wave file correct, and currently trying to write to the wave file each frame like so:

const unsigned int samplesPerSec = 48000;
const unsigned int fps = 60;
const int numSamples = samplesPerSec / fps;
float data[2][numSamples];
short conversion[numSamples*2];

m_fmodsys->getWaveData( &data[0][0], numSamples, 0 ); // left channel
m_fmodsys->getWaveData( &data[1][0], numSamples, 1 ); // right channel

int littleEndian = IsLittleEndian();

for ( int i = 0; i < numSamples; ++i )
{
    // left channel
    float coeff_left = data[0][i];
    short val_left =  (short)(coeff_left * 0x7FFF);

    // right channel
    float coeff_right = data[1][i];
    short val_right =  (short)(coeff_right * 0x7FFF);

    // handle endianness
    if ( !littleEndian )
    {
        val_left = ((val_left & 0xff) << 8) | (val_left >> 8);
        val_right = ((val_right & 0xff) << 8) | (val_right >> 8);
    }

    conversion[i*2+0] = val_left;
    conversion[i*2+1] = val_right;
}

fwrite((void*)&conversion[0], sizeof(conversion[0]), numSamples*2, m_fh);
m_dataLength += sizeof(conversion);

Currently, the timing of the sound is correct, but the sample seems clipped way harshly. More specifically, I am outputting four beats in time. When I playback the wave-file, the beats timing is correct but it just sounds way fuzzy and clipped. Am I doing something wrong with my calculation?

I am exporting in 16-bits, two channels.

Thanks in advance! :)

Reference (WAVE file format): http://www.sonicspot.com/guide/wavefiles.html

sentences:
Bounding boxes in octrees I've seen that octrees are often used for things like frustum culling and collision detection in 3D. But I'm just not sure how the algorithm works at all. Surely the whole principle of the octree breaks when you try to use bounding boxes, because any given box could be stored in one node but actually overlap the space represented by another node. In addition, I'm not sure how this can possibly work for looking up bounding boxes rather than points, because again, you could be stuck looking up into virtually all the nodes, defeating the purpose.

So how on earth do octrees cope with bounding boxes?

sentences:
Graphics API abstraction architecture I'm developing a 3D game engine in C# and I was just wondering what are the different ways I can approach designing a graphics API abstraction.

My original design was going to be something like this:

public interface IVertexBuffer : IDisposable
{
    void Bind();
}

#if DRIVER_TYPE_OPENGL_45

public sealed class OpenGLVertexBuffer : IVertexBuffer
{
    public void Bind()
    {
        // Bind buffer...
    }

    public void Dispose()
    {
        // Delete buffer...
    }
}

#endif

#if DRIVER_TYPE_OPENGL_ES30

public sealed class OpenGLESVertexBuffer : IVertexBuffer
{
    public void Bind()
    {
        // Bind buffer...
    }

    public void Dispose()
    {
        // Delete buffer...
    }
}

#endif

In C#, sadly pre-processors don't work the same way they do in C++, so I would have to compile two versions of my project, but that just seems hacky and I would much rather be able to switch between drivers types.

So, I had another idea to do something like this:

public interface IRenderDevice
{
    IVertexBuffer CreateVertexBuffer(float[] vertexData, int sizeInBytes);

    void DestroyVertexBuffer(IVertexBuffer vertexBuffer);
}

public sealed class OpenGLRenderDevice : IRenderDevice
{
    public IVertexBuffer CreateVertexBuffer(float[] vertexData, int sizeInBytes)
    {
        // Create vertex buffer
    }

    public void DestroyVertexBuffer(IVertexBuffer vertexBuffer)
    {
        // Destroy vertex buffer, or should I just call vertexBuffer.Dispose()?
    }
}

and then just use an enum to determine which render device to create, but I know this solution will quickly get out of hand when I begin to introduce other things like vertex arrays, index buffers, frame buffers, etc.

What other options do I have that will still maintain readable code and look native to C#?

sentences:
Alternative for using game object/prefabs for level generator I just finished the Unity Tutorial for creating a simple 2D roguelike Mobile Game. Now I wanted to make my level bigger; finding or creating my own algorithm isn't the problem. My problem is that creating a game object or using a prefab for every single floor or wall tile is a bad idea. (Map 200x200 = 40000 objects). A comment under the tutorial said that and I'm incline to believe it. That much I can understand, but I can't find a alternative. What can I use besides object/prefabs?

Sidenote: I have decent programming skills, but am beginner with Unity.

The tutorial I followed: https://www.youtube.com/playlist?list=PLX2vGYjWbI0SKsNH5Rkpxvxr1dPE0Lw8F
I want to make the maps there bigger, but then everything goes slow motion.

sentences:
Handling collision with 2D surfaces and player sprite What's the best way of representing surfaces in a 2d top down racing game? I'd like paved and dirt surfaces in my game to have different friction properties. Would you break up the map into a grid and simply check where in the grid the car is to determine the friction? Or is there a better way of managing it?

The roads and dirt are not self contained all or nothing tiles either, so I'd have to handle a grid section that contained some road and some dirt.

sentences: Where can I find some good 3D character artists? I am searching for 3D artists for a 3D iPad game. Is there a good place in the net, where I could find one? He or she should have created game models before.

sentences:
How can I pass a std::vector to my shader? I have a Vector3f type which has x, y, and z properties. I have a std::vector of these vertices which describe my terrain.

I would like to pass these values to a vertex shader through a uniform variable, but all the OpenGL functions expect GLfloat *. Which is the best way to this? I would like to avoid conversions if possible.

sentences:
Batching dynamic sprites in OpenGL I'm trying to wrap my head around how batching is done in a 2D sprite-based game.  My understanding is I'd get the vertices that represent each sprite I want to draw and stuff them all into a single mesh.  That way I'd only need a single draw call to render everything.

Does this apply when the sprites I render are different between frames, or when some sprites are moving?  Because it sounds like I'd then have to recreate my batch mesh each frame, using either glDrawArrays/glDrawElements or a streaming VBO I assume.  Does this sound correct?

sentences:
For the handling of buildings on a tile-based strategy game, what aproach should I use? On a tile-based game of the strategy genre, which allows the player to place buildings over the terrain tiles, there are multiple approaches that can be taken for handling such situation.

The ones that I immediately think about regarding that are:

Create two layers. One for the base tiles (terrain), and
a second for buildings. And, for handling (operations before rendering), iterate them.
Create a single layer, with the tile class having both the
reference to the base (terrain) and the building reference (null if no
building at that tile). And for handling, iterate just one
tile-map, but each iteration will then have to have an
if(building!=null){...} added to it.

EDIT:

As further specification, the situation is that the game will be more focused on management and sandbox (tough combat will still be present), and every building will have many variables that are independent from the other buildings (even of the same type of building). NOTE: You can use the game "Caesar 3" as an example of what I'm going for.

For example, for "housing" buildings, they will have leveling, with a growth (level-up) based on the meeting of the required resources needed for the next level (from "materials", like wheat and wine, to access to specific "infrastructure", like public bathhouses or religious buildings), as well as the handling of such resources (current amount of "material X" stored, max amount of "material X" to be stored, consumption-ratio of "material X").

Another thing is, I don't need to literally render buildings on top of terrain (render both), and actually, I think it's probably a bad thing...So instead, I'm trying to do the handling in a way that will also not do unnecessary rendering. On the rendering loop, the building is rendered when its present, or the terrain otherwise. (This might be a worse approach instead of a better one, tough. Please tell me if so!)

EDIT 2: Please regard the part above as a note. This question is not as related to rendering as it is to handling! I'm beginning to think about removing it.

For my exemple aproaches, both would have a separated logical layer for buildings, as a single building can occupy more than a single tile (a building can be 2x2, 3x3 or 4x8 terrain-tiles, for example).

So, regarding terrain-to-building relation, approach-1 would would go:

  2 iterating loops...

  BUILDINGS-loop: "You are currently iterating me; I am above the
  following terrain-tiles: 1,2,3 and 4; My current resources are: [...]"

  TERRAIN-loop: "(My coords are under a building, render that building instead!)
  || (I'm not under any buildings! Render me!)"

While approach-2 would go:

  1 iterating loop...

  TERRAIN-loop: "If you are searching for the building that was built
  over me, (it's null, render me!) || (its not null, proceed to
  the building's door, over there!)"

  BUILDING: "Terrain x-y sent you to my door? (Sorry, i have already
  been iterated, skip me) || (Hmm, and it seems I have not been iterated
  yet! Alright then! My current resources are: [...]; Render me!)"

Note: The "render" parts are to be considered as just flags to be used by the rendering loop that comes after all handling is done, thus, not as the actual time the rendering happens.

END OF EDIT.

The questions are...

Which is best overall? (why?)
Is either best for a specific matter? (EX: "This uses more
processing, but is less memory-heavy, because...")
And, are there other (better?) approaches?

sentences:
Counting point for a recursive domino-like game: Carcassone I have to build a 2D version of this game:

http://en.wikipedia.org/wiki/Carcassonne_(board_game)

counting scores for Towns and Roads seems easy enough (but I'm not sure), but for Lands I feel I don't have a clue.

I'm guessing I can define 3 "plugs" for each side, 12 for each tile, and then using pairs to create links between them inside a tile...

I remembered seeing that there is some book about graphes with boost, but I'm sure I don't need that...

sentences:
Word list for use in commercial game I need a word list to use in a commercial game (even though the game will be free to download)

Something like this

http://www.puzzlers.org/pub/wordlists/ospd.txt

Would be perfect (needs to be formatted .txt file) but obviously allowed to be used in a commercial game. I'm happy to pay if it's not too much.

Thanks for any advice.

UPDATE

After some more research (google), I came across this passage. Thought this might be useful for other people, although it still seems in contradiction to what the replies are saying on stack overflow here

"The nearest thing to a licence text for ENABLE, of which ABLE forms a part, is as follows.

The ENABLE master word list, WORD.LST, is herewith formally released
into the Public Domain. Anyone is free to use it or distribute it in
any manner they see fit. No fee or registration is required for its
use nor are "contributions" solicited (if you feel you absolutely
must contribute something for your own peace of mind, the authors of
the ENABLE list ask that you make a donation on their behalf to your
favorite charity). This word list is our gift to the Scrabble community,
as an alternate to "official" word lists. Game designers may feel free
to incorporate the WORD.LST into their games. Please mention the source
and credit us as originators of the list. Note that if you, as a game
designer, use the WORD.LST in your product, you may still copyright and
protect your product, but you may not legally copyright or in any way
restrict redistribution of the WORD.LST portion of your product. This
may under law restrict your rights to restrict your users' rights,
but that is only fair.

M Cooper and Alan Beale
"

From this site
http://www.quinapalus.com/dicts.html

Obviously I have no way of knowing if that's legit or not, so I was wondering what other peoples advice still is.

sentences:
Speech recognition in Unity 5 for Android I've been working on a game in which the player have to say particular words to perform various tasks. For example, if the player says "boat", a boat pops up in the game. The game I'm building is specifically for offline play, on an Android device. Just for reference, there is a game titled "Pah!" which implemented this offline speech recognition for one specific word. In this game, when you say "pah", the GameObject moves jumps.

I've tried everything from speech-to-text to forums, and even tried Google and used using Windows.Speech, but nothing works. From what I've learned, I need to use the Google speech API for Android speech recognition. I am a bit new, when it comes to Java. I gave it a try and created a basic script, which I thought might take at least one input in speech from the player, but Unity disagrees and says it couldn't recognize the script. I created another script in C#, by taking help from tutorials, but when I switch the platform from Windows to Android it doesn't work, because Unity.Windows.Speech is a Windows namespace

I am blank, and hence, this question. I have googled, visited forums, and even looked at YouTube videos for an answer. I came across a few Unity assets which I paid for, and they are all garbage. If anyone could help me, how do I implement speech recognition in Android, using Unity 5?

sentences:
From maya to c++ and opengl I want to load an object created with Maya in c++ with opengl, how could I do this?

Thank you.

sentences:
What happen if I try to run OpenGL 4.4 code on an unsupported graphic card? I'm learning OpenGL because I'd like to build my own engine.
I'd like to know what happens if I try to run OpenGL 4.4 code (the latest version at the moment of writing) on an unsupported graphic card ? (I mean for example a graphic card that support up to 4.1 OpenGL). Does it fails even to start ? or, it start but fails to render ?

Thank you very much.

sentences:
The rightmost part of the game screen is truncated in HTML I created a game that, when I play it in Unity, looks like this:

But when I build it in WebGL, the rightmost part of the screen (with the red player character in it) is truncated:

Play it in-browser on itch.io to confirm. It looks the same when I open the HTML file locally, so the problem is with the WebGL version and not with itch.

Only when I click the "full screen" button, the rightmost part is shown.

What am I doing wrong?

sentences:
Accelerating Missile guidence Background
I'm building a simple game where two ships are launching missiles at each other in space.
Stuff got complicated when the ships started moving in a frictionless environment and the missiles naturally needed to do the same thing.
Premises

A missile has a constant acceleration and is trying to hit a moving target in a frictionless environment.
Target is also constantly accelerating in the same frictionless environment.
The frictionless environment is only 2 dimensional
There is no gravitation affecting the missile

Question
What math should I use to determine the direction the missile should jolt in?
What i have right now
I've implemented this answer which works quite alright. I am not 100% sure of what a, b, c etc means and not sure which math is actually implemented here.
I modified above linked answer by making the missile mimmic its targets jolts and adding its own on top of those. It is an ugly solution to say the least.
Problem with current solution
The current solution requires to know the speed of the missile.
The missile is constantly accelerating, and it has no top speed.
Unless I know how far the missile will travel, I cannot know the average speed.
Above solution requires that I know the speed of the projectile.

sentences:
Does "Personal Use" mean I can earn from it? I'm almost done with my personal game. One of the reasons I started this is because of monetization. I plan to monetize it using Google Admob. However, I need some icons - essential part of my game.

And these icons are free, released by a certain company, and they say in their download page:

  These icons are free for personal use or commercial testing purposes.
  Otherwise, you'll need a Premium or Enterprise license. :)

Question is, does "Personal Use" mean I can earn from it?

Also, this "personal game" is actually "under" a group named, say "XXX".
The group "XXX" is merely a group name, not a company, not legal/registered, just literally a group name on Github. And this group is composed of 3 people and that includes me. Does this kind of setup go under the "personal use"?

sentences:
How to create polygonal or elliptical colliders by python tkinter? I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries.
My problem is colliders. I need to detect collisions of game objects. First I used a circle collider (it's easy). But using only circles in a game is not good, so I decided to use polygonal or elliptical colliders, but I don't know how to do it without external libraries such as pygame. Could anyone help me?

My question shorter:

How to detect polygons' or ellipses' collisions in python tkinter canvas using only standard libraries?

P.S. And how to detect collisions of an inclined rectangle?

sentences:
Saving a list of points into a text file I recently posted a question about this, but was not really sure where to go. I've gotten some progress, and have generated some simple noise here:

http://pastie.org/5408655

That works well enough for me, but I would really like to be able to save the points into an ascii text file. currently it's formatted so that something like this:

11111111

11111111

11111111

11111111

would create a square. I need to save in this format with the points(and lines connecting them) generated in the method above.

Essentially, I need to write the array of points created in the first example to a text file formatted like the second example.
EDIT:
I ended up using serialization. This method makes it un-editable, but works for my purposes, I can really have good terrain generation now. here's my code: http://pastie.org/5455624 Everything is working excellently. Thanks to all those who helped

sentences: Seamless transition between planet and space I have been curious about how this kind of seamless transition from space to planet can be implemented. It would be nice if someone could explain this as I can't really wrap my head around the solution.

sentences:
Unity 2D - scale sprite according to screen width So I have a square sprite (width == height) and I want to scale it so that both width and height are exactly one fifth of the width screen. To find the desired pixel width I do:
float desiredWidthPixels = Screen.width * 0.2f;
float desiredHeightPixels = Screen.width * 0.2f;

How do I apply these values to the sprite?

sentences:
Using Rigidbody.AddForce() twice seems to interfere with logic So I created a magnetic effect, where objects are "sucked" into my player.
It works great.

Now I want those same objects to get a little Impulse force when they spawn. This has somehow reversed my magnetic effect? The objects are now pushed away from the player...

All I did was add this Line in Start():

_rb.AddForce(_forwardThrust, _upThrust, _forwardThrust, ForceMode.Impulse);

Full Script here:

public class RandomMagneticForce : MonoBehaviour
{
    private bool _inside;
    private Transform _magnet;
    private Rigidbody _rb;
    private SphereCollider _sphere;
    float radius = 5f;
    [SerializeField]
    private float _delay;
    [SerializeField]
    private float _force = 70;
    [SerializeField]
    private float _upThrust, _forwardThrust;

    void Start()
    {
        _magnet = GameManager.instance.ActivePlayer.gameObject.transform;
        _rb = GetComponent<Rigidbody>();
        _sphere = GetComponent<SphereCollider>();
        _inside = false;
        _rb.AddForce(Random.Range(-_forwardThrust, _forwardThrust), _upThrust, Random.Range(-_forwardThrust, _forwardThrust), ForceMode.Impulse);
    }

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag(Constants.TAG_PLAYER))
        {
            _inside = true;
        }
    }
    void OnTriggerExit(Collider other)
    {
        if (other.gameObject.CompareTag(Constants.TAG_PLAYER))
        {
            _inside = false;
        }
    }

    private void Update()
    {
        if (_delay > 0)
            _delay -= Time.deltaTime;

        if (_inside)
        {
            if (_delay <= 0)
            {
                Vector3 magnetField = _magnet.position - transform.position;
                float index = (radius - magnetField.magnitude) / radius;
                _rb.AddForce(_force * magnetField * index);
            }
        }
    }
}

sentences:
Streaming 3d model --> unity android I want to include a feature in my game that allows me to host raw 3d models (.fbx/ .obj/ etc., not AssetBundles) on a server.
The game should download these files, save them to the device and load them into a scene.
I want to support multiple file formats, so writing my own parser is not an option!

First idea:Use the WWW class to load the model data, save it as a String in the player prefs, and load it if requested.(the last part is the problem)

Second idea:Use the WWW class to load the model data, extract the jar file containing StreamingAssets folder to the sdcard. Writing the model data into a new file in this directory. Creating a new ZIP..ah...JAR archive from the folder and replacing the old .jar file.Of course I would need an Android Plugin and a archive java library for that. Then the Models will be loaded from the Ressources.(this is a pretty weird idea and cannot be the right way)

Do you know, if that works?Has anybody ever done something like that?

UPDATE 1:

I tried to use the obj loader from samed-tarık-Çetİn's comment, but I got this error:

ArgumentNullException: Argument cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[System.String,UnityEngine.Material].get_Item (System.String key) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:136)
GeometryBuffer.PopulateMeshes (UnityEngine.GameObject[] gs,     System.Collections.Generic.Dictionary`2 mats) (at Assets/OBJ/src/GeometryBuffer.cs:145)
OBJ.Build () (at Assets/OBJ/src/OBJ.cs:236)
OBJ+<Load>c__Iterator0.MoveNext () (at Assets/OBJ/src/OBJ.cs:63)

Replacing line 145 in GeometryBuffer.css with gs[i].GetComponent<Renderer>().material = new Material(Shader.Find("Standard")); did resolve the runtime error and a Material, OBJ (Mesh Filter) and Mesh Renderer Component have been added, but it still show a model.

UPDATE 2:
I am behind a proxy so loading the model from the web didn't work.
Loading .obj files from file:///<path to obj> works perfectly fine though.

sentences: Should I finish high school or teach myself? I want to become a game developer, I am an A student in 11th grade and feel like I am wasting my time in High School. I'm thinking of switching to homeschooling so that I have more time to focus on learning game development on my own while finishing high school at home. Some people I spoke to about this say its better to stay in school and go to college, some say I can get my diploma through homeschooling and this way I can get a head start on what I love to do, and get hands on experience. I am not sure what to do and was wondering if there are any experienced programmers out there that can give me advice on what route I should take??

sentences:
Distance per mesh in HLSL directx I'm subdividing a sphere so when distance gets greater, the sphere is subdivided less to save memory.

The sphere changes to another sphere when the distance is 10. My problem is that only one triangle gets rendered at a time in the geometry shader. This makes the rest of the sphere the different and causes holes and cracks. like the image below

How can I render all the triangles at one time?

my geometry function code is

 [maxvertexcount(50)]
void GS(triangle VertexOut gin[3], inout TriangleStream<GeoOut> stream)
{

if(distance(gin[0]) < 10.0f)
{
VertexOut v[15];
Subdivide2(gin, v);
OutputSubdivision2(v,stream);

}
else if(distance(gin[0]) >= 10)
{
VertexOut v[6];
Subdivide(gin, v);
OutputSubdivision(v,stream);

}
}

sentences:
Network tilebased game updates design I have a top/down grid based multi-player game. So I have a 2D array on the server that holds the entire map and a much smaller 2D array on the client that holds only what the client needs to see of the bigger server map. For now we'll say the client 2D is 5x5 but the server is 400x400.

When the player starts, the server see's what tile it's on and gets the 5x5 area around the player (with the player being at the center of that) and sends the tile info to them. The client then updates their 5x5 array and draws the objects in the tiles. This is all great and working.

Now, when the player moves I want to basically always keep the 5x5 array updating around them, loading and unloading the objects in those tiles from the server. Now in reality it'll be bigger than 5x5 but I'm using this for testing purposes only since it's smaller to manage.

I don't want to always send the 5x5 array (will be larger in final version) to the player because it's a waste of bandwidth to do so. If the player moves right 1 tile then the majority of the information in their 5x5 array is still the same. Really it's only the right most column that changed and needs to be updated while every other column gets shifted 1 to the left. The same happens if they move up, down, left, or any of the diagonals.

The question I'm after would be around how the server can track and easily send just the changes of tiles for clients. So on the server I send tile updates once a second, NOT when they tell me they changed tiles. When I send them data I store their current position as last position, so this means I can get the 5x5 array from their last position (which this is what their 5x5 array looks like) and I can get the new 5x5 array from their current position. I the need to know what changed from the last position 5x5 array to this new 5x5 array and only send them those changes along with how to shift their 5x5 array around to match this new 5x5 array. Is there any neat tricks out there for comparing 2 2D arrays to find out such information? Does anyone have any other ideas on how to handle this situation? I'm open to new ideas around this.

sentences:
Position and rotate a 2D point array into a 3D world I have a set of 2D points (defining a flat 2D 'connect the dots' shape).
I want to calculate the 3D positions for these 2D points at a specific 3D position and rotation.

For example, say I have five 2D points forming the shape of a 2D hexagon. I want to place this hexagon shape at a specific location in my 3D world, at a specific rotation. I need to calculate new 3D coordinates for each of the 2D points.

If it matters, the 2D points will center around (0,0).

What magic formula do I need to do to accomplish this translation?
Is there a built in method (in Unity) to do this?

Each point will be perpendicular to the rotation angle/direction, so will I need to calculate the cross product?  Then somehow use this to remap each 2D point?

I should have paid more attention to this in school, all those years ago (I can't even remember if I actually learned this before!).

Any help will be appreciated. Thanks.

Here's some basic code to illustrate:

Vector3 position;     // Where in 3D to place the 2D shape
Quaternion rotation;  // What 3D rotation to apply to the 2D shape.  Should be a Vector3?
Vector2[] shapeIn;    // List of 2D points defining shape
Vector3[] shapeOut;   // List of updated 3D points at its new position and rotation

shapeOut = new Vector3[shapeIn.Length];

for (int p=0; p<shapeIn.Length; p++) {
    shapeOut[p] = MagicFormula(shapeIn[p]);
}

sentences:
Doubt about font inclusion (GAMEMAKER)? The default font of the GameMaker is arial, but it does not contain special characters that are present in the portuguese language.

Soon I had to add a new font, but I activated the ASCII option so that the characters I needed were included.

Hence come my doubt: Even the new font being arial I need to enable the option include in Asset Package for the game to work properly?

And if I have to enable it, where I put the file, and more. Does it need to have a specific name?

sentences:
Increasing chance of good loot after multiple tries I'm looking for a way to make chances of getting better loot increase the more you've looted. I do not want it to be possible to get a rare item the first 5 times and not being able to get an epic item the first 10 times.

However, the more the player loots, the better chance he should have of getting better items/less chance of getting nothing, normal, ...

This is my current code, but it is, as you can see, completely static. I know this might not be of much help, but at least it shows an overview of the items and the %-chance I have in mind.

var rand = random(100); // Random number 0-100
if(rand < 40){
    return LOOT_NOTHING;
}else if(rand < 70){
    return LOOT_NORMAL;
}else if(rand < 90){
    return LOOT_UNCOMMON;
}else if(rand < 99){
    return LOOT_RARE;
}else{
    return LOOT_EPIC;
}

The project is written in GML, but pretty much any language will suffice as an answer as it's not very language-specific.

sentences:
How can I boost cache performance when storing objects in a scene with managed languages? So, for reasons that I won't go into (has to do with my team more so than a good objective reason, unfortunately), I'm building a soft game engine in C# on top of SharpDX. C++ wasn't an option. I can't store objects contiguously in C# when it comes to reference types like classes, so I'm thinking about taking a data-oriented-design approach to storing objects in my scene. Thus, my scene looks a bit like this right now (all of the fields are structs because I can store them by value type, and thus contiguously):

public delegate void UpdateMethod (ref ModelData md, ref Transform t, ...)

class Scene
{
    ModelData[] models;
    Transform[] transforms;
    //...some other fields here
    UpdateMethod[] updateMethods; //delegate array

    void UpdateAll()
    {
         for (int i = 0; i < NUM_GAME_OBJECTS; i++)
        {
            if (updateMethods[i]!= null)
            {
                updateMethods[i](ref models[i], ref transforms[i], ...);
            }
        }
    }
}

The idea being that I can now store the objects contiguously as opposed to just an array of contiguous references to the data if I made each component a class.

Is this even a viable technique, or am I abusing the DOD paradigm? I'm storing all of my objects like this, not just my dynamic ones. Perhaps I could split it up into two sets of arrays for dynamic and non-dynamic, so I'm not tempting branch-predictor slow-downs on the if statement for UpdateAll()?

Will an approach like this create more issues than it attempts to solve? I will note that, while updating occurs here, I outsource the actual carrying out of the component functionality to other systems. For example, an input subsystem determines keys pressed, so an object could check in its unique update method denoted by the delegate; the update doesn't do everything, just behavior specific to that bundle of game object data.

This seems analogous to operating over columns in a row-major language, in that I'm killing performance gain of data locality; am I correct in concluding it would it be beneficial to wrap all of these fields into some GameObjectData wrapper struct, and just store those in an array?

sentences:
How to make a "GUI In Game"? My game is very GUI based, the way how it works is that I have a GUI class, which contains the basic GUI elements, a parent GUI object, and a copy of the main game's class object. The game starts out with the main GUI, which is the main menu, then when it wants to it takes something like the in game GUI, creates a object with the main menu's copy of the game and then the main menu object itself using this as the parent GUI. So when the in game GUI wants to, it can call back for the parent GUI to be used again.

Here is where the issue lays, the in game GUI needs to be a GUI, but also needs to contain this such as the level it's playing, the player, and all those things. How is this done?

Should I have approached my GUI based system differently? Because I can't somehow figure out of I would implement such a GUI without errors. How do you approach this? Or how would you approach this?

sentences:
Ecliptic rotation around parent object It seems to be answers.unity.com not working for a couple of days, so I ask my question here.

Well, I'm using Unity and I have two objects (A and B). Object A is a parent of object B and object B is rotating around object A executing RotateAround function.

And everything is fine until I rotate the  object A. In this situation I get a mess I can't explain because of lack of geometry knowledge.

But I have to be able to rotate object A with object B keeps its round ecliptical orbit around object A.

How can I do it in code?..

Sorry for a messy question and bad English. Hope those pictures help to understand what I want. Thanks to you all.

sentences:
Enabling Unity GUI drawtexture permanently? I'm trying to get an image to show in Unity based on a certain criteria.
I would like the position of the image to be randomized every time on play.

However since GUI.DrawTexture shows the image for a single frame only, I end up with the image flashing across the screen in random areas. I would the first location to be randomized and the image to remain still there.

Any advice on how to perform this will be greatly appreciated.

Code:

void OnGUI(){
 if(HP>=0.9f){
   GUI.DrawTexture(new Rect (Random.Range(0,1000), Random.Range(0,700), 500, 300) aTexture);
  }
}

sentences:
Rotating object along bezier curve: not rotating enough? I tried to follow the instructions from the threads on the forum (Cocos2d rotating sprite while moving with CCBezierBy) with Unity, in order to rotate my object as it moves along a bezier curve. But it does not rotate enough, the angle is too low, it goes up to 6 instead of 90 for example, as you can see on this image (the y eulerAngle is at 6, I would expect it to be around 90 with this curve) :

EDIT: here is the solution :

Vector3 v3 = newPos - oldPos;
v3.y = 0.0f;
transform.rotation = Quaternion.LookRotation(v3);

Here is the code (in c# with Unity) : (I am comparing x and z to get the angle, and adding the angle to eulerAngles.y so that it rotates around the y axis)

void Update () {
        if ( Input.GetKey("d") ) start = true;
        if ( start ){
            myTime = Time.time;
            start = false;
        }
        float theTime = (Time.time - myTime) *0.5f;
        if ( theTime < 1 ) {
            car.position = Spline.Interp( myArray, theTime );//creates the bezier curve
            counterBezier += Time.deltaTime;

            //compare 2 positions after 0.1f
            if ( counterBezier > 0.1f ){
                counterBezier = 0;
                cbDone = false;
                newpos = car.position;
                float angle = Mathf.Atan2(newpos.z - oldpos.z, newpos.x - oldpos.x);
                angle += car.eulerAngles.y;
                car.eulerAngles = new Vector3(0,angle,0);
            }
            else if ( counterBezier > 0 && !cbDone ){
                oldpos = car.position;
                cbDone = true;
            }

Thanks

sentences:
DirecX 11 R8G8B8 24bit format without alpha channel? This is maybe a stupid question but I can't seem to find texture format for simple 24bit R8G8B8? There is only 32bit R8G8B8A8, but some of my textures don't have alpha channel.

Is there any way to do this, or I'll just have to create alpha channel on every texture?

sentences:
How to avoid an applied force from effecting one particular Rigidbody2D I am creating a 2D side-scroller car race game with zombies. In this game, I set up a feature through which the player can shoot the zombies from the car, as well.

The problem is that when I apply force to shoot the bullet towards the right, the car also gets effected by that force, i.e it just moves a lot in reaction to the bullet shot. I don't want this behavior. I want the car to remain calm and just shoot.

Is there any way to exclude one particular rigidbody, i.e the rigidbody attached to the car, from applying the force the bullet rigidbody is using?

sentences:
How do I fix this unintentional chromatic aberration on a lightmap? Some strange rainbow halos (front and left) appear after computation of a lightmap for direct light. The formula is
dot * dot2 / ( dist * dist ) * dl->intensity

with gamma correction, lightmap is computed as vec3_t and ultimately cropped to 3 bytes. However, brightness of the region in question fit into 255 nicely, and even calculating in byte instead of float beforehand - result in just a subtle "oil painting" effect and does not produce such artifact across entire image.
My best guess is how this artifact appear from base change in a floating point math, but I don't know for sure nor do I understand what exactly is happening.

sentences:
Algorithm to generate multifaced cube? Are there any elegant soloution to generate a simple-six sided cube, where each cube is made out of more than one face? The method I have used ended up a horrible and complicated mess of logic that is imopssible to follow and most likely to maintain. The algorithm should not generate reduntant vertices, and should output the indice list for the mesh as well.

The reason I need this is that the cubes vertices will be deformed depending on various factors, meaning that a simple six-faced cube will nto do.

sentences:
How can I determine where to show a nameplate over a character? I'm working on a naming system that displays the name of enemies above their heads.

The problem is that I have some enemies that are larger or smaller than others. So I'm trying to use a function that gets the height of the enemy, and then uses that as the modifier for the name's position.

Here's what I'm doing (I should mention that the target is the enemy that is currently being targeted):

public Vector3 offset = Vector3.up;
...
thisTransform.position = cam.WorldToViewportPoint(target.position + offset);

What I'd like to do:

public float enemyHeight;
...
enemyHeight = target.collider.bounds.size.y + .5f;
thisTransform.position = cam.WorldToViewportPoint(target.position + enemyHeight);

But obviously it is giving me an error that I can't add a float to a vector. How can I accomplish this?

sentences:
How do I move the paddle with the arrow keys? I am making a pong game using gdi+ and c#. I want to move the paddle using the arrow keys by using the move variable, but it does not work; the paddle does move when I use the int move=0; global variable.

I am thinking about nesting my methods.

Is it possible to nest the Form1_Paint into the Form1_Keypress method?

    int move = 0;

    public void Form1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)56)//key 8
        {
            move--;
        }

        if (e.KeyChar == (char)50)//key 2
        {
            move++;
        }
    }

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        Graphics g = e.Graphics;
        SolidBrush blueBrush = new SolidBrush(Color.Blue);
        SolidBrush redBrush = new SolidBrush(Color.Red);
        SolidBrush whiteBrush = new SolidBrush(Color.White);
        Rectangle rect1 = new Rectangle(0, 250, 35, 100); //blue paddle
        Rectangle rect2 = new Rectangle(750, 250 + move, 35, 100); //red paddle
        Rectangle rect3 = new Rectangle(390, 290, 10, 10); //white ball
        g.FillRectangle(blueBrush, rect1);
        g.FillRectangle(redBrush, rect2);
        g.FillRectangle(whiteBrush, rect3);
        g.Dispose();
    }

sentences:
1 Texture For Multiple Models, Or 1 Model Using Different Textures For Each I'm creating some voxel flowers that are exactly the same, just different colours.  Is it better to create 5 models and use 1 texture that has the 5 different colours, or create 1 model and use 5 different textures for each colour?

Am curious as to which is more efficient in regards to performance, as there could be quite a few flowers on screen.

I'm playing around with MagicaVoxel and Unity.

sentences:
Speed up lighting in deferred shading I implemented a simple deferred shading renderer.
I use 3 G-Buffer for storing position (R32F), normal (G16R16F) and albedo (ARGB8).
I use sphere map algorithm to store normals in world space.
Currently I use inverse of view * projection matrix to calculate the position of each pixel from stored depth value.

First I want to avoid per pixel matrix multiplication for calculating the position. Is there another way to store and calculate position in G-Buffer without the need of matrix multiplication
Store the normal in view space

Every lighting in my engine is in world space and I want do the lighting in view space to speed up my lighting pass.

I want an optimized lighting pass for my deferred engine.

sentences:
Converting Frame-Dependent Movement to Frame-Independent I fine-tuned some movement physics for a 2D platformer in a frame-dependent manner and now I want to convert them to frame-independent.

I though this would be as easy as multiplying a few things by 60 (my FPS) and a few other things by a time delta.

Unfortunately, the resultant physics is not the same as the original, especially when I drop the frame rate from 60 fps to 30 fps.

Here's how the frame-dependent movement works in my Player class, simplified a bit for the purposes of illustration.

PLAYER_ACC = 1.5
PLAYER_FRICTION = -0.23
PLAYER_GRAV = 1.75
PLAYER_JUMP = 20

def get_input(self):
    if self.game.input("left"):
        self.acc.x = -PLAYER_ACC
    if self.game.input("right"):
        self.acc.x = PLAYER_ACC
    if self.game.input("up"):
        self.vel.y = -PLAYER_JUMP

def update(self):
    # reset acceleration
    self.acc = vec(0, PLAYER_GRAV)

    # process input
    self.get_input()

    # apply friction
    self.acc.x += self.vel.x * PLAYER_FRICTION     # The faster you're going, the more friction slows you down.

    # calculate velocity
    self.vel += self.acc

    # if the x-velocity approaches 0, set it equal to 0
    if abs(self.vel.x) < 1.5:
        self.vel.x = 0

    # downward velocity cap
    if self.vel.y >= 14:
        self.vel.y = 14

    # adjust position
    self.pos += self.vel + (PLAYER_GRAV * self.acc)    # Got this equation from a tutorial and I like how it feels.

Here's my attempt at making it frame-independent. My time delta is self.game.dt.

PLAYER_ACC = 1.5 * 60
PLAYER_FRICTION = -0.23
PLAYER_GRAV = 1.75 * 60
PLAYER_JUMP = 20 * 60

def get_input(self):
    if self.game.input("left"):
        self.acc.x = -PLAYER_ACC
    if self.game.input("right"):
        self.acc.x = PLAYER_ACC
    if self.game.input("up"):
        self.vel.y = -PLAYER_JUMP

def update(self):
    # reset acceleration
    self.acc = vec(0, PLAYER_GRAV)

    # process input
    self.get_input()

    # apply friction
    self.acc.x += self.vel.x * PLAYER_FRICTION    # The faster you're going, the more friction slows you down.

    # calculate velocity
    self.vel += self.acc * self.game.dt

    # if the x-velocity approaches 0, set it equal to 0
    if abs(self.vel.x) < 1.5 * 60:
        self.vel.x = 0

    # downward velocity cap
    if self.vel.y >= 14 * 60:
        self.vel.y = 14 * 60

    # adjust position
    self.pos += (self.vel + (PLAYER_GRAV * self.acc)) * self.game.dt

Unfortunately, the resultant physics did not feel the same as my original. Especially when I drop the frame rate from 60 fps to 30 fps.

I was thinking that maybe when I apply the friction to the acceleration, I need to raise it to the time delta, but this didn't help either. I am working at a small resolution (640x360) and I'm not sure if this is impacting anything.

My question is: How can I convert my current physics to frame-independent?

There are a few questions similar to this on Game Dev SE already, but none of them has led me to a solution.

sentences:
How to use styles in Monogame.Extended.GUI? So i was looking at the Monogame.Extended.GUI Project and used this instructions to set it up in a .net Core Project. So far everythings works fine. I followed the example of the demo and created a button like this

var button = new Button();
button.Content = "Button1";
button.BackgroundColor = Color.Transparent;

var demoScreen = new Screen
{
   Content = new StackPanel
   {
        Orientation = Orientation.Vertical,
        VerticalAlignment = VerticalAlignment.Centre,
        HorizontalAlignment = HorizontalAlignment.Centre,
        Items = { button }
   }
};

Now i want to give this Button a style, for example disable any mouse interactions like hover or mouse presses. The button has a HoverStyle and a PressedStyle property but i don't know how to use it.

   button.Hoverstyle = ???

sentences:
One SKSpriteNode with multiple PhysicsBodies? I am making a game similar to Lunar Lander, when you land with your ship on different objects, etc... The issue I am having is that I have a Player SKSpriteNode (my Ship) with a slightly complex collision system (bottom of the ship has different CategoryBitMask from other sides, etc.) and when I apply PhysicsBody(bodies: [physicsBodiesArray]) I cannot control CategoryBitMask for each element of the [physicsBodiesArray]... Because main PhysicsBody is applied to the Player it overrides all other Categories and such.

Here is my "createPlayer" function:

//Creating the player

    player = SKSpriteNode(imageNamed: "Bottle_02")
    player.size = CGSize(width: 130, height: 200)
    player.position = CGPoint(x: 0, y: 0 + player.frame.height / 2)

//Creating 2 collision objects and placing them

    var playerColTop = SKSpriteNode()
    var playerColBottom = SKSpriteNode()

    playerColTop = SKSpriteNode(imageNamed: "test_top")
    playerColBottom = SKSpriteNode(imageNamed: "test_bottom")

    playerColTop.position = CGPoint(x: 0.5, y: 0)
    playerColBottom.position = CGPoint(x: 0.5, y: 0 - playerColTop.frame.height / 2 - playerColBottom.frame.height / 2)

//Creating PhysicsBodies for the Array and assigning CategoryBitMasks

    let playerColTopPhys = SKPhysicsBody(texture: playerColTop.texture!, size: playerColTop.size)
    let playerColBottomPhys = SKPhysicsBody(texture: playerColBottom.texture!, size: playerColBottom.size)

    playerColTopPhys.categoryBitMask = PhysicsParams.Player
    playerColTopPhys.collisionBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    playerColTopPhys.contactTestBitMask = PhysicsParams.Ground | PhysicsParams.Walls

    playerColBottomPhys.categoryBitMask = PhysicsParams.PlayerScore
    playerColBottomPhys.collisionBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    playerColBottomPhys.contactTestBitMask = PhysicsParams.Ground | PhysicsParams.Walls

//Adding my PhysicsBodies and setting up the Player

    player.physicsBody = SKPhysicsBody.init(bodies: [playerColTopPhys, playerColBottomPhys])
    player.physicsBody?.categoryBitMask = PhysicsParams.Player
    player.physicsBody?.collisionBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    player.physicsBody?.contactTestBitMask = PhysicsParams.Ground | PhysicsParams.Walls
    player.physicsBody?.restitution = 0
    player.physicsBody?.friction = 1
    player.physicsBody?.mass = 5
    player.physicsBody?.affectedByGravity = false
    player.physicsBody?.isDynamic = false

    self.addChild(player)

Thanks in advance!

sentences:
Unity: Set LightProbes to "Off" on Static objects Since I use Light Probes for Indoor Scenes only I only need them to work on Dynamic Objects. Objects in Indoor Scenes are all Lightmap Static and baked, objects in outdoor scenes rely on real time lighting.

Most objects are not within range but sometimes the Lightprobes from inside interfere with Static objects outside and add light to them that should not be. It's really time consuming to disable LightProbes in every individual Mesh Renderer

I sort all Prefabs & Game Objects by Static, LightmapStatic and Dynamic. Turning Lightmapping on and off can be easily done in the hiearchy but turning off LightProbes needs to be done in every individual Mesh Renderer. Is that so, or am I overlooking something? If not this is really something that should get fixed.

My Version is 2017.3.1f1

sentences:
Registering InputListener in libGDX I'm just getting started with libGDX and have run into a snag registering an InputListener for a button. I've gone through many examples and this code appears correct to me but the associated callback never triggers ("touched" is not printed to console). I'm just posting the code with the abstract game screen and the implementing screen. The application starts successfully with a label of "Exit" in the bottom left hand corner, but clicking the button/label does nothing.

I'm guessing the fix is something simple. What am I overlooking?

public abstract class GameScreen<T> implements Screen
{
    protected final T game;
    protected final SpriteBatch batch;
    protected final Stage stage;

    public GameScreen(T game)
    {
        this.game = game;
        this.batch = new SpriteBatch();
        this.stage = new Stage(0, 0, true);
    }

    @Override
    public final void render(float delta)
    {
        update(delta);

        // Clear the screen with the given RGB color (black)
        Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(delta);
        stage.draw();
    }

    public abstract void update(float delta);

    @Override
    public void resize(int width, int height)
    {
        stage.setViewport(width, height, true);
    }

    @Override
    public void show()
    {
        Gdx.input.setInputProcessor(stage);
    }

    // hide, pause, resume, dipose
}

public class ExampleScreen extends GameScreen<MyGame>
{
    private TextButton exitButton;

    public ExampleScreen(MyGame game)
    {
        super(game);
    }

    @Override
    public void show()
    {
        super.show();

        TextButton.TextButtonStyle buttonStyle = new TextButton.TextButtonStyle();
        buttonStyle.font = Font.getFont("Origicide", 32);
        buttonStyle.fontColor = Color.WHITE;

        exitButton = new TextButton("Exit", buttonStyle);
        exitButton.addListener(new InputListener() {
            @Override
            public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
                System.out.println("touched");
            }
        });
        stage.addActor(exitButton);
    }

    @Override
    public void update(float delta)
    {
    }
}

sentences:
How can I apply a fullscreen shader on a specific layer? How do I apply a full screen shader on one layer of objects using LWRP/URP and shader graph? I want to pixelate only my particlesystems, but nothing else. I want the effect of pixelcamera, but only on particlesystems.

Normaly I whould have a seperate camera rendering the particlesystem and then pixelate only that camera, but I can't have a transparent background (dont clear) for some reason while using LWRP. If I have 2 cameras, the background only turns black and only renders the particles :(

sentences:
If statements seem to act as though the condition is always true I have other scripts in the same project using boolean if statements that work fine, but I've tried multiple methods of testing if the if statements below are working and none of them worked!

I don't really know what to ask because I don't know whats going on. I've tried placing theae statements in Update and Start, and in both instances the if statement completely ignored the check and just executed the contents of the block as though the check evaluated to true.

void OnTriggerEnter(Collider other) {
    if(other.gameObject.CompareTag("Player")); {
        working = true;
    }

    Extremity = false;
    if(Extremity); {
        Instantiate(Cannon, transform.position, transform.rotation);
        Extremity = !true;
    }
}

The false statement is only in there to show that even when the bool is set to false immediately before the check, it still runs the Instantiate method inside as though it were true.

sentences:
C++ formatted serialization I've decided it's time to implement serialization in my simple engine but this has caused me many headaches for the past couple of days/weeks. My engine uses an entity/component based approach similar to what is described in the T=Machine blog.

To keep it simple, my first goal was to implement serialization of entities. Since I'm going to use Lua for scripting, I thought it would be nice to serialize entities into Lua tables. Unfortunately, I find the information that is available on serialization in C++ is rather scarce. After many days of thinking I found one approach which is working for my implementation and is described here.

In essence, I have an EntityManager class from which I request new entities. This class holds entity as well as pointers of type BaseComponent from which all components derive. Because I store components as base pointers, I couldn't use a friend class for serialization, but had to make the BaseComponent inherit from a Serializable class, which has pure virtual serialization methods.

So, this is not that bad, I just have to inherit from the Serializable class and implement the serialization method. To support deserialization though, I have to do a few tricks according to the last link. That is, I have to include a static object inside each component whose sole purpose is to populate a map from component names to constructors. Here is a generic example (and please ignore any possible errors),

/* Base.h */
struct Base: public Serializeable{
    static std::map&ltstd::string, std::function&ltBase*(void)&gt &gt deriveds;
    virtual ~Base(void){}
};

/* Derived.h */
template&ltclass T&gt
struct add_map_entry{
    explicit add_map_entry(std::string name){
        Base::deriveds[name] = [](void) -> Base* {
            return new T;
        };
    }
}

class Derived: public Base{
public:
    int x;
    int y;
    Derived(void){
        std::cout &lt&lt "Derived created" &lt&lt std::endl;
    }
    void serialize(std::ostream&);
    static add_map_entry&ltDerived&gt adder_;
};

Then in the implementation file I also have to initialize the static map of the base class as well as the static object of each derived class.

I find this quite a mess and although it could probably be improved with the use of macros, I can't help to wonder if there are better ways. How do you handle this kind of formatted serialization?

PS: Please don't recommend changing to a more flexible programming language :) !

sentences:
Box2d Body to follow mouse movement I am trying a box2d body to rotate following the mouse. Here's an image to clarify what I mean.

The red and blue circles are current point of the mouse and the body (of corresponding color) moving/rotating to follow it. Basically the rectangle should rotate with its one end pointed towards where the mouse pointer is.

Here's my code so far,

 World world;
    Body body, bullet;
    Box2DDebugRenderer debugRenderer;
    OrthographicCamera camera;

    @Override
    public void create() {

        world = new World(new Vector2(0, 0f), true);
        debugRenderer = new Box2DDebugRenderer();
        float w = Gdx.graphics.getWidth();
        float h = Gdx.graphics.getHeight();

        BodyDef bodyDef = new BodyDef();
        bodyDef.type = BodyDef.BodyType.DynamicBody;
        bodyDef.position.set(10, 10);
        body = world.createBody(bodyDef);

        PolygonShape shape = new PolygonShape();
        shape.setAsBox(2, 5);
        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.shape = shape;
        fixtureDef.density = 1f;
        Fixture fixture = body.createFixture(fixtureDef);

        shape.dispose();

        Gdx.input.setInputProcessor(this);

        camera = new OrthographicCamera(200, 100 * (h / w));
        camera.position.set(camera.viewportWidth / 2f, camera.viewportHeight / 2f, 0);
        camera.update();

    }
 @Override
    public void render() {

        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(Gdx.graphics.getDeltaTime(), 6, 2);
        camera.update();
        debugRenderer.render(world, camera.combined);
    }

  @Override
    public boolean mouseMoved(int screenX, int screenY) {
        int mouseX = screenX;
        int mouseY = Gdx.graphics.getHeight() - screenY;
        float rotateAngle = MathUtils.radiansToDegrees * MathUtils.atan2((float) mouseY - (float) body.getPosition().y, (float) mouseX - (float) body.getPosition().x);
        body.setTransform(body.getPosition(), rotateAngle / 57.2957795f);
        return true;
    }

And here's a gif of how it appears now.

as you can see the body gets skewed and also doesn't rotate properly. What am I missing?

sentences:
Unity pixel art distorted sprites I have a problem rendering my pixel art sprites properly in Unity.
So far I have one character in a sprite-sheet I made, with frames of size 64x64. The actual sprite is roughly 32x32 but I left room for movement in animations.
I import the sheet following pixel perfection procedures I found on the internet using these settings:

As for the orthographic camera I set its size using this formula:

orthoCameraSize = screenHeight / (2 * 32)

If I zoom on the sprite in scene it looks fine but when in game it gets rendered quite poorly (in game / in scene pics below):

What could be the source of the problem? I applied every good practice advice I could find on the web...
Thanks for your help!!!!

sentences:
Get Specific depth values in Kinect (XNA) I'm currently trying to make a hand / finger tracking with a kinect in XNA. For this, I need to be able to specify the depth range I want my program to render. I've looked about, and I cannot see how this is done. As far as I can tell, kinect's depth values only work with pre-set ranged found in the depthStream.

What I would like to do is make it modular so that I can change the depth range my kinect renders. I know this has been down before but I can't find anything online that can show me how to do this.

Could someone please help me out?

I have made it possible to render the standard depth view with the kinect, and the method that I have made for converting the depth frame is as follows (I've a feeling its something in here I need to set)

  private byte[] ConvertDepthFrame(short[] depthFrame, DepthImageStream depthStream, int depthFrame32Length)
    {
        int tooNearDepth = depthStream.TooNearDepth;
        int tooFarDepth     = depthStream.TooFarDepth;
        int unknownDepth    = depthStream.UnknownDepth;
        byte[] depthFrame32 = new byte[depthFrame32Length];

        for (int i16 = 0, i32 = 0; i16 < depthFrame.Length && i32 < depthFrame32.Length; i16++, i32 += 4)
        {
            int player      = depthFrame[i16] & DepthImageFrame.PlayerIndexBitmask;
            int realDepth   = depthFrame[i16] >> DepthImageFrame.PlayerIndexBitmaskWidth;

            // transform 13-bit depth information into an 8-bit intensity appropriate
            // for display (we disregard information in most significant bit)
            byte intensity = (byte)(~(realDepth >> 8));

            if (player == 0 && realDepth == 00)
            {
                // white
                depthFrame32[i32 + RedIndex]    = 255;
                depthFrame32[i32 + GreenIndex]  = 255;
                depthFrame32[i32 + BlueIndex]   = 255;
            }

         // omitted other if statements. Simple changed the color of the pixels if they went out of the pre=set depth values

            else
            {
                // tint the intensity by dividing by per-player values
                depthFrame32[i32 + RedIndex]    = (byte)(intensity >> IntensityShiftByPlayerR[player]);
                depthFrame32[i32 + GreenIndex]  = (byte)(intensity >> IntensityShiftByPlayerG[player]);
                depthFrame32[i32 + BlueIndex]   = (byte)(intensity >> IntensityShiftByPlayerB[player]);
            }
        }

        return depthFrame32;
    }

I have a strong hunch it's something I need to change in the int player and int realDepth values, but i can't be sure.

sentences:
Unity Animator default values overwriten I have created a project to reproduce the problem I'm currently facing.
I'm running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can be done by adding an empty animation, that (since it does not change anything) simply writes the default values, thus returning our gameobject to its original position.

But here is where things get complicated: if the animator gameobject is set inactive while the animation is running, new incorrect defaults values will be saved when gameobject is activated, and I am unable to reset my gameobject position.

To reproduce this issue, run the attached project:
(Download from here)

Change the stop method to "PlayEmpty"
Hit Start Animation and watch the left "Hello world" text travel.
While it is traveling, click Disable Text GO. The left text disappears.
Click Enable Text GO and see the text comes back at its last location.
Click Start Animation and watch the left "Hello world" text travel.
Click Stop Animation - the text is returned to the position where it was when enabling the gameobject, rather than its original position.

Any help is welcome, suggestions on how to change the code to make the above scenario work.

Thanks,
Yaniv

sentences:
How can I implement a "disable ads" purchase in my game? I would like to add a "no ads" service to my game such that ads can be removed with a single payment. How can I implement this correctly?

If I just save the fact that the service was paid for locally on the device, the user would have to pay again if they somehow erase the application's data.

sentences:
ScaleX and Y for stretching MovieClip I'm developing a game, and the game has a shop.  In that shop there is an option for a house expansion.  This is a movieclip that I want the user to be able to spend their coins to increase their house in the following ways:

-> stretch house to right <- stretch house to left ^ stretch house upward v stretch house downward.

The thing is, I've been thinking of using ScaleX and ScaleY to accomplish this.  The only problem:  It stretches the left and right, I can't make it do one.  I'm sure there is a way to do this, but I haven't yet figured it out.  Any ideas?

sentences:
First person camera: problem I have created a simple camera class, moved it from my C# (XNA) source to C++ for d3d.

Commonly it is okay, but something is wrong with rotation.
If i increase its pitch/yaw values, according to received player's mouse delta (cursor move), it rotates incorrect. It rotates 'around' 'world center', not position. 'world center' is changed if i change camera position.

After i move mouse left, camera is rotated like around 0;0;0 instead of own position.

XMVECTOR m_vecPosition; // x,y,z camera pos
float m_fYaw, m_fPitch;// rotation

view matrix update function:

#define VectorForward       XMVectorSet(0,0,1,0)

XMMATRIX mtxRot = XMMatrixRotationRollPitchYaw(m_fPitch, m_fYaw, 0);
XMVECTOR vecPos = XMVector3Transform(m_vecPosition, mtxRot);
XMVECTOR vecLookAt = XMVector3Transform(VectorForward, mtxRot);//'forward' transformed
vecLookAt += vecPos;
XMVECTOR vecUp = XMVector3Transform(VectorUp, mtxRot);
m_mtxView = XMMatrixLookAtLH(vecPos, vecLookAt, vecUp);

In XNA project my camera worked fine, like in FPS games, but it is impossible to move it to C++, this code definitely not correct.

And another question about camera if some one could help me:) Do i need to limit(lock) picth,yaw abs to PI*2 ? Or i what i need to do with always increasing yaw, for example ?

My camera rotates around 0;0;0, not around its position. Rotation camera makes always its look-at in center of the world. If i move camera position, i can offset its 'relative world center'. I need to make my camera properly first person, or properly third person..

sentences:
Individual Skeletal Animation with OpenGL I have been able to implement a pipeline in OpenGL which reads Collada files and can animate them through interpolating the keyframes. However, as somebody brand new to graphics, I don't quite know how one would go about doing individual joint animation.

For example, if I have a sprite and I would like to move just their arm joint, none of that animation information is stored in a Collada file. How would I go about making a system that can move each joint independently?

sentences:
When the player collides with an entity, the player can no longer move Here is my collision code, any ideas on how I can improve it to fix the problem?

    public void collide(Entity entity){
    if(x + width >= entity.x && x <= entity.x + entity.width && y + height >= entity.y && y <= entity.y + entity.height){
        setShouldCollide(true);
    }else{
        setShouldCollide(false);
    }
}

sentences:
Alpha blending works when rendering to an FBO, but not when rendering to the screen buffer My rendering pipeline goes something like this-

Bind multisampled FBO

Render GameObjects

Render Transparent Objects

Blit multisampled FBO to normal FBO

perform any Post processing

Render a quad with the result

Render GUI

I've found I can render transparent objects in the "Render transparent Objects" function, but alpha blending against the post processing quad doesn't work. Is there any reason why this would be? This draw call is used regardless of whether it is being rendered to the FBO, or to the screen buffer
It is a button in particular I'm trying to render, here is the draw call:

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glFrontFace(GL_CW);

glUseProgram(thisConfig.guiShaders->getProgramID());

//Bind uniforms..... code skipped

glBindVertexArray(VAO);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);

glDrawArrays(GL_QUADS, 0, 4);

glFrontFace(GL_CCW);

Let me know if there is anything I need to provide to help. Again, same shaders are used in both cases, so I don't think the shaders are the problem, but here they are anyway:

#version 330
uniform sampler2D textureImage;

// input packet

in packet{
    vec2 textureCoord;
} inputFragment;

// output packet
layout(location = 0) out vec4 fragmentColour;

void main(void) {

vec3 gamma = vec3(1.0 / 2.2);
vec4 tempFragmentColour = texture2D(textureImage,     inputFragment.textureCoord);
    fragmentColour = vec4(pow(tempFragmentColour.xyz, gamma),     tempFragmentColour.a);
//  fragmentColour = vec4(tempFragmentColour.a);

}

I have tried writing in the alpha values manually in the shaders and I get the same effect.

Working with OpenGL 4.6 on PC with c++

sentences:
How do i writing timing function for lightning flash in C++? I need to write a horror scene with lightning flash. Unfortunately I am new to both C++ and OpenGL and I am looking for efficient way to mimic lightning timing in C++/OpenGL?

I don't need graphical implementation, just algorithmic implementation.

as such, the function should return a float representing lighting intensity and the delay of lightning flash should be random (5 seconds followed by 10 seconds then 3 seconds.. etc)

I hope I made everything clear!

sentences:
Why does Unity call certain methods "messages"? I just surprised that the Unity documentation calls methods like Update or Start or Awake "Messages" rather than methods.

Does that mean those methods are used to send a message to something?

sentences:
Why are some of my normals facing away from the camera? I'm trying to use WebGL to render some simple models, and I'm running into issues where pixels near the edge of my model are passing normals to my fragment shader that point away from the camera. This is of course messing with my attempts to use physically-based shading, because BRDFs are only defined in the hemisphere around the normal vector. These normals aren't just slightly pointing away from the screen; if that was the case, I would chalk it up to floating-point error and clamp to acceptable values. But some of my pixels have v-dot-n values of -0.5 or less.
This happens on pretty much any mesh I try to render. I have verified that my vertex normals point away from the mesh. I have backface culling turned on. This happens with both perspective and orthographic projections. I have tested in both Firefox and Chrome. Everything else about my render looks fine.
My vertex shader looks like this:
precision mediump float;

uniform mat4 M;
uniform mat4 V;
uniform mat4 P;

attribute vec3 vertexPos_model;
attribute vec3 vertexNormal_model;

varying vec3 pos_world;
varying vec3 normal_world;

void main() {
    gl_Position = P * V * M * vec4(vertexPos_model, 1.0);
    pos_world = (M * vec4(vertexPos_model, 1.0)).xyz;
    // We can use M here instead of its inverse transpose because it does not scale the model.
    normal_world = mat3(M) * vertexNormal_model;
}

And my fragment shader looks like this:
precision mediump float;

uniform vec3 cameraPos_world;

varying vec3 pos_world;
varying vec3 normal_world;

void main() {
    vec3 n = normalize(normal_world);
    vec3 v = normalize(cameraPos_world - pos_world);
    float vAngleCos = dot(n, v);
    // This will highlight pixels whose view vectors are outside of the hemisphere around n.
    gl_FragColor = vec4(vec3(clamp(-vAngleCos, 0.0, 1.0)), 1.0);
}

Rendering with the fragment shader above gives me results like this:

Apologies if I'm missing something obvious!

sentences:
LWJGL - Keyboard.next() not firing I am trying to make a class which will handle all of my inputs, however Keyboard.next() isn't returning true. Here is my code.

    while(Keyboard.next()) {
        if(Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
            if (Keyboard.getEventKeyState()) {
                System.out.println("Pressed");
            }else {
                System.out.println("Released");
            }
        }
    }

When I removed the while loop, it infinitely outputs Pressed/Released so I know that part of the code is working. Is there something that I am missing to make this fully work?

sentences:
How do commercial games engines organise the index/vertex buffers? Preface: This question is going to be coming from a Direct3D point-of-view, because that's what I'm familiar with.

Obviously we incur a slight overhead every time we change the vertex or index buffers in Direct3D (i.e. with IASetIndexBuffer). But I suppose if we allocate one giant index/vertex buffer we'll end up having to manage the memory manually, and sort of end up with a fragmentation problem (or pauses while we swap all the data around).

So how do commercial engines load/unload data? I'm sort of leaning towards a 'package' based approach, so a 'package' of models has its own vertex/index buffer that we can load/unload as the package is no longer needed; and then try to draw all instances from the same package together.

But I'd be interested to hear what the accepted/standard way of handling this is?

sentences: Does SDL_SetThreadPriority work with std::thread I'm trying to set the priority of my threads so that my UI thread can be given priority over background calculations. I noticed that SDL has a SDL_SetThreadPriority method, however I still prefer the standard std::thread syntax rather than SDL_CreateThread. Does SDL_SetThreadPriority work with threads created with std::thread, or do I need to update everything to use SDL_Thread?

sentences:
Finding line of best fit demarcating national borders Per title, what algorithms are available for defining borders for states (or other entities) based on certain nodes in the world (eg. cities or armies) with varying weights?

For example, there are three non-equidistant city-states and a bunch of military vehicles of varying strength nearby representing each city-states' military power. I would like to be able to draw a border that accounts for the fact city-state A has a huge great army on their outskirts, projecting their power outward.

Ideally the optimal algorithm would be able to calculate a series of connected lines with a high level of precision for multiple states and a large number of nodes (let's say three dozen, for the sake of argument). Speed isn't too much of a factor, since the results would be cached and I'd need to apply a function to 'curve' it anyway.

sentences:
How can I load a script once in LuaJit/Lua and use it across multiple VMs in different threads? So, I came across an interesting problem. I'm implementing some threaded game logic, and one of the things I decided to do was to use Multiple Lua VMs, with each worker thread containing its own VM.

I don't intend for the scripts themselves to actually handle any data across threads. For the most part, the VMs will very rarely use the heap - as most things will be handled on the stack. The VMs are basically workhorses that drives the logic of the game, while the C++ end handles all of the data.

One of the things I noticed very quickly, is that as I get more scripts, I'm basically increasing my memory usage by a multiple of however many worker threads I am creating. This is because each State needs to load a copy of a script.

Is there a way, and how can I handle this without flooding my memory with 4+ copies of the same script? As in, one state loads in all of the scripts at the start, and puts them in memory. Then all other VMs are able to access those scripts?

sentences:
Libgdx game lags on better phones I'm developing a candy crush game and it works just fine on desktop, my mobile (Honor9) and the one I'm using as emulator. But, for my surprise, it lags on my girlfriend's mobile, which is way better then mine (Samsung s10), when I'm doing the starting game animations (pieces falling to their position).
I believe the problem is not how I'm loading assets because it just lags on that specific animation. Does anyone know what I might be doing wrong?

sentences:
8-bit Game: To pre-scale images, or post scale my Cocos2d scene. Which is the better approach? I'm wanting to develop a game with an 8-bit feel. Since this game is mostly for my personal enjoyment, I've set a requirement that I want my game to have an 8-Bit feel to it that is most similar the 8-Bit systems of yore, on a lovely CRT TV.

This is also my first Cocos2d project so I don't know which approach is better.  I'd like the general advice of the community on how to render my game.  I've come up with two possible approaches.  Please advice which is better.

Approach #1

Create images for backgrounds and sprites using the "8-bit" resolution of my game.  After I'm done making an image, I scale it up and I save two variants; the standard sized one and the "@2x" variant.

When I render the game, everything looks very 8-Bit but I will still need to apply mathematics to every animation so that my virtual pixels always shift by 4 or 8 pixels (for retina displays) on the screen when they move.

This approach doesn't sound difficult but it seems like it could become a bit annoying and tedious.

Approach #2

Generate all content in my image designer at the exact resolution of my virtual screen.  When I generate my scenes in Cocos2d, I generate them all with the "virtual resolution".  When the scene is displayed on the iOS screen, I scale the entire scene up to the resolution of the device.

I think this could be the simplest approach since all of my sprite and background movement mathematics can just behave as normal.  However, I'm not sure that this approach is even possible.  Furthermore, I know that within iOS, graphic scaling has an anti-alias affect that gets applied to graphical objects as they scale-up.  Obviously, I'd want to cut this affect off and just use a "nearest neighbor" algorithm to scale-up my scene.

If I can't cut off the scaling anti-aliasing, I don't want to use this method.  However, if I can setup such a rendering system, I think this approach would be best.

So, my question is simple.  Can I use approach #2 and, if so, which approach is really easier to work with in Cocos2d and iOS?

sentences:
How to clear out a drawn texture from the screen in libGDX I am trying to clear out the drawn texture from the screen.

Lets take a classic game example - in many games when the character goes through the coins the coins clears out from the screen and displays a sweet animation like fade in and fade out the points collected from that coin(+10) and show the coin exploding animation on that position.

I want to do something similar to that.
I am using SpriteBatch to draw the texture region like below.

Setting texture Region:

(...)
 public Texture texture;
    public TextureRegion coin;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    coin = new TextureRegion(texture, 0, 336, 65, 73);
 (...)

   Drawing the texture into screen :

 public SpriteBatch batcher;
 batcher = new SpriteBatch();
 batcher.setProjectionMatrix(cam.combined);
  batcher.begin();
    batcher.enableBlending();
    batcher.draw(coin, x, y, 65,73);
    (...)
    (...)
  batcher.end();

The game character is also drawn using the same logic shown above.
Now when the game character will collide with the coin that I have drawn,the coin must be cleared(vanished) and some animation or big font like +50 must fadein and fadeout in that position.I tried but didn't find anything that would do this.
So how to do that ?

sentences:
Approximating Subdivision Surfaces with Gregory Patches for Hardware Tessellation I'm trying to implement the approach (http://research.microsoft.com/en-us/um/people/cloop/sga09.pdf).
Unfortunately I'm not quite clear regarding the formulas in chapter 3, I am hoping to get some answers.

I am unclear on the following points, did you figure them out?

what kind of value do I get, when I calculate T(u,v,w) (a point?) and
what do I do with the result?
do I recieve the values u,v,w from the domain shader SV_DomainLocation or are they calculated?
are the corner points in chapter 3.2 barycentric too?
does v get replaced by p0 in figure 5?
In chapter 3.3 Edge Points there is a formula for e0+, but none for e0-? For which edge is e0+ in figure 5? and how can I calculate e0+ for the other edges? It seems for me (figure 5) there are 5 edges, but just one e0+ is calculated, shouldn't there be 5 e0+?
Do you maybe have a diagram of the controlpoints in relation to the control mesh? I am having problems seeing the big picture...
In chapter 3.4: face points,  you mention different transversal vectors r, r0+ and r0- but there is only one formula for r0+.  Are r = r0+ = r0-?  If not, how do I calculate r and r0-?

I am hoping someone could point me in the right direction, thank you in advance!

sentences:
GetMouseButtonUp/TouchPhase.Ended doesn't work properly I'm trying to make a game where your tap doesn't count until you've released your click, or stop tapping.

The weird thing is, it doesn't work in game, but it works for animation.

public class Swipe : MonoBehaviour {

    public Animator anim;
    public bool tap, swipeUp, swipeDown, swipeLeft, swipeRight, hold;
    public bool isDragging = false;
    public Vector2 startTouch, swipeDelta;
    public float animTime;
    public Life life;

    private void Update()
    {
        tap = swipeUp = swipeDown = swipeLeft = swipeRight = false;

        anim.SetBool("Hold", isDragging);

        #region Standalone Input
        if (Input.GetMouseButtonDown(0))
        {

            isDragging = true;
            startTouch = Input.mousePosition;
            //Debug.Log("Tapped");
        }
        else if (Input.GetMouseButtonUp(0))
        {
            tap = true;
            isDragging = false;
            Reset();
        }

        #endregion

        #region Mobile Inputs
        if (Input.touches.Length >= 1)
        {
            if (Input.touches[0].phase == TouchPhase.Began)
            {
                // tap = true;
                isDragging = true;
                startTouch = Input.touches[0].position;
            }
            else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
            {
                tap = true;
                isDragging = false;
                Reset();
            }
        }

        #endregion

        //calculating the distance
        swipeDelta = Vector2.zero;
        if (startTouch != Vector2.zero)
        {
            if (isDragging)
            {
                if (Input.touches.Length > 0)
                    swipeDelta = Input.touches[0].position - startTouch;
                else if (Input.GetMouseButton(0))
                    swipeDelta = (Vector2)Input.mousePosition - startTouch;
            }
        }

        //did we cross the deadzone?
        if (swipeDelta.magnitude > 125)
        {
            //which direction?
            float x = swipeDelta.x;
            float y = swipeDelta.y;
            if (Mathf.Abs(x) > Mathf.Abs(y))
            {
                //left or right
                if (x < 0)
                {
                    swipeLeft = true;

                }
                else
                {
                    swipeRight = true;
                }
            }
            else
            {
                // Up or down?
                if (y < 0)
                {
                    swipeDown = true;
                }
                else
                {
                    swipeUp = true;
                }
            }
        }

        #region Animation
        if (Tap)
        {
            anim.SetTrigger("Tap");
        }

        if (SwipeDown)
        {
            anim.SetTrigger("Down");

        }

        if (SwipeUp)
        {
            anim.SetTrigger("Up");
        }

        if (SwipeLeft)
        {
            anim.SetTrigger("Left");
        }

        if (SwipeRight)
        {
            anim.SetTrigger("Right");
        }

        #endregion
    }

    public void Reset()
    {
        startTouch = swipeDelta = Vector2.zero;
        isDragging = false;
    }

    public Vector2 SwipeDelta { get { return swipeDelta; } }
    public bool Tap { get { return tap; } }
    public bool SwipeUp { get { return swipeUp; } }
    public bool SwipeDown { get { return swipeDown; } }
    public bool SwipeLeft { get { return swipeLeft; } }
    public bool SwipeRight { get { return swipeRight; } }
}

sentences:
How do I enfroce efficiency concerning thread granularity? Lately, I've been thinking of ways to use multi-threading to improve the speed of different parts of a game engine. What confuses me is the appropriate granularity of threads, especially when dealing with single-instruction-multiple-data (SIMD) tasks.

Let's use line-of-sight detection as an example.  Each AI actor must be able to detect objects of interest around them and mark them.  There are three basic ways to go about this with multithreading:

Don't use threading at all.
Create a thread for each actor.
Create a thread for each actor-object combination.

Option 1 is obviously going to be the least efficient method.  However, choosing between the next two options is more difficult.  Only using one thread per actor is still running through every object in series instead of in parallel.  However, are CPU's able to create and join threads in the granularity posed in Option 3 efficiently?  It seems like that many calls to the OS could be really slow, and varying enormously between different hardware.

sentences:
How does game asset file encryption work? How does file encryption in game assets work, for example the unreal engine has a .assest extension, or I also see a .dta extension in another game, are these .zip type packages which have a custom encryption algorithm set by the developer or how does it work?

Is it as simple as coming up with your own encrytion algorithm then extracting all the file such as in a .pk3 file?

sentences: Where can I obtain the latest stable aggregated builds of JOGL? I have checked many different sites including jogamp but couldn't manage to find any zipped,rared or jared collection of builds and javadocs.

sentences:
Bullets won't shoot out of barrel in top-down shooter So I am working on a top down shoot and have been stumped on why my bullets refuse to come out of the barrel of the gun. I know about the rotation equation which is

x2 = x * cos(theta) - y * sin(theta)
y2 = x * sin(theta) + y * cos(theta)

Here is part of my shoot method for my shotgun

    float dx = (float) (5 * Math.cos(direction) + 40 * Math.sin(direction));
    float dy = (float) (5 * -Math.sin(direction) + 40 * Math.cos(direction));

    //PlayState.effects.add(new MuzzleFlashEffect(x + dx, y + dy, (float) Math.toDegrees(-direction)));

    for(int i = 0; i < randNum; i++){
        float var = MathUtils.random(-accuracy, accuracy);
        float dir = direction + (float) Math.toRadians(var);
        PlayState.projectiles.add(new Bullet(this, x + dx, y + dy, dir));
    }

    bulletsInClip--;
    lastShot = System.currentTimeMillis();

The bullets always tend to shoot out of the left side and I don't have a clue why. The player sprite origin is the center and not the top left but I can't get it shooting out of the barrel.

Can someone explain why this is happening and how I can fix this. I have spent too many hours and losing my sanity.

Thanks in advance!

EDIT

Here are some pictures of the character shooting in different directions

RIGHT

LEFT

DOWNWARD

sentences:
How to set blur on mouse over and remove on mouse out in AS3? How can I do it? I want to active glow when the mouse is over a Sprite and remove it when the mouse is out. Is it possible?

I have the following code:

var myGlow:GlowFilter = new GlowFilter();
myGlow.color = 0xFFFFFF;
myGlow.blurX = glowMobilha.blurY = 20;
var miniatura:MovieClip = _scene.d1[link];
miniatura.addEventListener(MouseEvent.CLICK,
                           function(e:Event):void {
                               MainSoundManager._sm.stopAllSounds();
                               GameManager.loadSection(link, false);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });
miniatura.buttonMode = true;

I set the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });

How can I "hide" the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });

UPDATE
I think I found the solution in the following code:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                           glowMobilha.alpha = 1;
                           miniatura.filters = [glowMobilha];
                           _controle.visible = true;
                           _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                             function(e:Event):void {
                             glowMobilha.alpha = 0;
                             miniatura.filters = [glowMobilha];
                             _controle.visible = false;
                             _controle.gotoAndStop(1);
                           });

is it the best solution?

sentences:
How to prepare a game for localization? Many projects don't think about localization until the game is done. Then localization is done as a hack, and it's obvious that it was added on later. Some specific areas of concern:

Text strings (obviously)
Audio clips such as music and/or narratives
Text rendered on textures (e.g. a label on a crate)
Text rendered in frames in pre-rendered movies
Fonts/Character sets for different languages
Etc.

What are some good ways to prepare for these challenges in the initial development stages, so you can make it easier without incurring too much cost up front?

sentences:
What category would this asynchronous production economy game fall under? I'm thinking of getting into game development and my friend and I have this idea for a game. We want to do some research on similar games, and I have noticed that games seem to fall under certain categories like "platformer", "shooter", "racing games" or similar.

Our idea is a multiplayer, mobile game where you and around 4-5 other players are placed in a session.

Every player is given a different role in a market (like a farmer to grow crops, miller to make flour out of crops, baker to bake bread, etc.). The players are supposed to sell goods to each other in order to earn money (or similar). The resources are produced/generated over time, so it's like Travian and other city building games when it comes to stuff happening over time.

You own a production facility (like a farm, mill, etc.) and if you have enough resources/money it produces some good every 10 min (arbitrary time for the example).

This happens even when the user is not playing. Then once in a while, you can check in, put some of your goods up for sale that others can purchase.

So it's a passive loop that simply generates resources every x minutes, and in addition, the players can put up their goods for sale when they feel like it.

But the game is not "infinite". When one of the players reaches a certain goal, the game session ends and the players are ranked (or something, it's still a rough idea).

So in this regard, it's more like Wordfeud or Chess where your next move depends on what the other players do and there is a way to win the game (be it a winning condition or time running out).

So the question is, does this kind of game fall under a specific category that we can research?

sentences:
How can I generate random levels like in "Square it!" game? In this game, you have a 2d field with some free squares and two colored squares which you can move but only together (they'll move only if the spot is still "free"). And you have to fill whole free space.

Here is a video that demos how the game is played.

How can I generate random game levels like in that game?

sentences:
I can't jump when i press up, and left at the same time ///Get player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);
key_jump_held = keyboard_check(vk_space);
key_shoot = keyboard_check(ord("D"));

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x, y+1, Obj_Floor))
{
 vsp = key_jump * -jumpspeed;
}

if (vsp < 0) && (!key_jump_held) vsp = max(vsp,0)

//Horizontal Collision
if (place_meeting(x+hsp, y, Obj_Floor))
{
 while(!place_meeting(x+sign(hsp), y, Obj_Floor))
 {
  x += sign(hsp);
 }
 hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x, y+vsp, Obj_Floor))
{
 while(!place_meeting(x, y+sign(vsp), Obj_Floor))
 {
  y += sign(vsp);
 }
 vsp = 0;
}
y += vsp;

//Animate
if (move != 0)
{
 image_xscale = move;
}

if (place_meeting(x, y+1, Obj_Floor))
{

 if (move != 0)
 {
  sprite_index = CalvinWalking;
  image_speed = 0.07;
 }

 else
 {
  sprite_index = CalvinStanding;
  image_speed = 0.025;
 }
}

else
{
 if (vsp < 0) sprite_index = CalvinJumping
 else sprite_index = CalvinJumping
}

and

///Shooting with D
//Shooting direction
if (keyboard_check(vk_right))
{
 mpfacing = 0;
}

if (keyboard_check(vk_left))
{
 mpfacing = 180;
}

if (keyboard_check(vk_up))
{
 mpfacing = 90;
}

//Shooting
if (keyboard_check(ord("D"))) && (canshoot = true)
{
 instance_create(x+13, y-0.5, Obj_MP_Laser);
 canshoot = false;
 alarm[1] = 30;
}

is my code but for some reason when i press up, and move left, i can't jump when i press space. Which i don't understand because i can jump when moving left, and when i press up, but not when i press both.

sentences:
3ds Max Skeleton Import into Unreal Engine Fail I tried following the "Introduction to UE4 Animation and Rigging Tools" tutorial with maya but I dislike maya and don't under stand it so I tried importing the skeleton from the "3rd Person Game with Blueprints" tutorial into 3ds max and hoping I could just edit the mesh because I want about the same skeleton.

So I imported it and just made a basic mesh to test, Then removed the old mesh

Now I did it like this hoping I could use the existing animations for the original but when I try to play an animation with it in unreal engine 4.7.3 it says it does have any with the same skeleton, then when I tested it trying to ragdoll it stays rigid and just falls over.

Please help, am I importing it wrong am I missing a step? Why doesn't it work?

sentences:
How to merge 2D biomes? I'm making a map generation script which generates different biomes: "land", "beach", "ocean" using perlin noise but the problem is that each biomes is at different heights for example i use

height = (int)PerlinNoise (seed,x,90,10,15); //for land
height = (int)PerlinNoise (seed,x,70,10,5); //for beach
height = (int)PerlinNoise (seed,x,20,10,35); //for ocean

This is the method:

float PerlinNoise( int seed, float x, float height, float scale, float roughness){
    Vector2 originPoint = new Vector2 ((seed + mapSize.x / 2) * roughness / mapSize.x, 0);

    float xCoord = (seed + x) * roughness / mapSize.x;

    return (Mathf.PerlinNoise (xCoord, 0) * scale) + height;
}

But my problem is merging between biomes, when i generate the terrain each biome just jumps down/up to the required height how can i fix this? I've tried using a lerp function but the map is generated left-right. Is there a way i can implement this in the PerlinNoise method so that if i supply the previous height and a weight it returns the next height as if the biomes where going to merge.

sentences:
Dragging a Rigidbody2D without passing through obstacles I have this body of code written for an object that needs to be an obstacle and another object that is draggable.  I have colliders on both and a kinematic rigidbody on the draggable object, but the obstacle is still allowing the dragged object to be dragged through it.  This is all 2d.  I'm not sure what I'm doing wrong.

The part that I'm confused on is this - when you just add a collider to the obstacle sprite and a collider and rigidbody (all 2d) to the draggable sprite, if I don't add the script above, then the draggable sprite falls due to gravity on top of the obstacle and stop there, it doesn't fall through the obstacle sprite.  However when I add the above script which has the OnMouseDrag function, and I move the draggable sprite around because now I can, it falls through the sprite.

With no script the obstacle acts like an obstacle.  With this script the it does not.

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class Block : MonoBehaviour
{
    public GameObject Four_Object1;
    //public GameObject clone_Four_Object1;
    //private Vector3 screenPoint;
    //private Vector3 offset;
    private Rigidbody2D rb2d;
    private Vector3 screenPoint;
    private Vector3 offset;
    private Vector3 cursorPosition;

    public void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
        GetComponent<Rigidbody2D>().isKinematic = true;
    }

    public void OnMouseDown()
    {
        screenPoint = Camera.main.WorldToScreenPoint(Four_Object1.transform.position);

        offset = Four_Object1.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
    }

    public void OnMouseDrag()
    {

        Vector3 cursorScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        cursorPosition = Camera.main.ScreenToWorldPoint(cursorScreenPoint) + offset;
        transform.position = cursorPosition;
    }

    public void FixedUpdate()
    {
        rb2d.MovePosition(cursorPosition);
        Debug.Log("Update!");
    }

}

sentences: How can I create a bomb explosion in Farseer that pushes nearby objects away? I'm trying to create a bomb explosion in Farseer. I created a circle for the bomb. However, if the bomb explodes, the objects (bodies) that are around it should fly away because they're pushed back by the enormous force of the explosion. I'm not sure how to create that force, though - how can I do it?

sentences:
What should I set my managed stripping level to? I know the higher the Managed Stripping Level the smaller binary size but I also know the higher the level more issues you can run into so I have some questions about all this.

If I set my managed stripping level to high will I see the effect of that and be able to properly test it when running my game in the editor or would I have to compile to make sure everything runs alright?
Can issues with a high managed stripping level be platform specific (Meaning a high level is good on one platform but causes issues on another)?
Does managed stripping level only effect binary size or can it also effect performance? If it can effect performance would a binary with a high managed stripping level run faster than a binary with a low managed stripping level or would it be the other way around?

sentences: What is "streamlined" user interface? I have come across this term "streamlined" user interface, and I wonder how is it different from other user interface type? What is the different between "streamlined" and "non-streamlined" user interface?

sentences:
How to draw with OnPreviewGUI? I want to implement custom preview for GraphViz files.

I created CustomEditor stub for that based on this beautiful gist: https://gist.github.com/prodigga/53ab658e1a818cd4ddfd#file-meshfilterpreview-part2-cs

using UnityEditor;
using UnityEngine;

/// <summary>
/// Inspector for .SVG assets
/// </summary>
[CustomEditor(typeof(DefaultAsset))]
public class GraphVizEditor : Editor
{
    public override bool HasPreviewGUI()
    {
        return true;
    }

    public override void OnPreviewGUI(Rect r, GUIStyle background)
    {
        var path = AssetDatabase.GetAssetPath(target);
        if (path.EndsWith(".gv"))
        {
            var texture = new Texture2D(1, 1);
            texture.SetPixel(1, 1, Color.green);
            GUI.DrawTexture(r, texture, ScaleMode.StretchToFill, false);
        }
    }
}

I expect to see green preview area, but preview keeps having gray background:

How to fix this and actually draw custom texture to a preview area?

sentences:
Use heightmaps or direct vertex manipulation for runtime terrain editing in UE4? I am creating a terrain editor and creator for in our game, in which we should be able to create hills and dales, create different shapes(forms) in the terrain etc. I came up with 2 approaches on achieving what we want,

1. modify 2d heightmaps by darkening / lightening colours; update terrain vertices based thereon.

2.  Create a plane and modify the vertices of the plane to shape what we want.

So my question is, which way would be faster/better for a ingame terrain editor? And why would you recommend that?

Or, if you know of a better way, I would love to hear.

Thanks

sentences:
Make platform's visibility distinct from background I have a 2d infinite runner type game which background is changing its colors constantly. Meanwhile the color of the platforms stays the same. This way the platforms at some point(when their color is the same as the background's) become "invisible" for the player.

How can I creatively, shortly and conviniently avoid this problem with unity?

P.S. I've tried adding glossy material to it but it didn't work.

sentences:
GLSL variables as main function params vs on their own line? I am learning OpenGL and GLSL. I was taught that the in/out variables should be formatted like this:

in vec3 something;
out vec3 somethingElse;

int main()
{
    // etc...
}

However, I ran across code like this online (ShaderToy):

int main(in vec3 something, out vec3 somethingElse)
{
    Is there a difference?
}

Is there any difference?

sentences:
How is a DirectX Adapter Different from a Device? I'm relatively new to DirectX programming, and this is one of the more confusing issues I've encountered to date. According to the MSDN Documentation for DirectX 11:

  "A device is used to create resources and to enumerate the capabilities of a display adapter."

and from the MSDN Documentation for DirectX 9:

  "An adapter is a physical piece of hardware. Note that the graphics card might contain more than a single adapter, as is the case with a dual-headed display. "

From my neophyte perspective, these two concepts seem to overlap a fair amount. Am I correct in understanding that a device is an abstraction/encapsulation of a single adapter, which in turn is a software abstraction of a particular graphics card in the system?

sentences:
How do I convert a humanoid retargetted animation to a generic animation? In my game, I use a Generic Rig model called "hero_generic".
I have a pistol-shooting animation.
This animation was created for another rig, so I need to use Humanoid retargetting to use it on my model.
To try out how it looks, I copy my "hero_generic" character, name it "hero_humanoid" and create a Humanoid avatar for it. Then I set the animation to "Humanoid", put it on an animation controller and put the animation controller onto the "hero_humanoid".
It works, the animation is now playing on my Humanoid character, but I don't want my character to be Humanoid.
I want to bake the animation out for my hero_generic character.
Unity doesn't provide any built-in option to do that.
How can I turn this retargetted animation to a generic .anim file?

sentences:
How to update model transform of components when using physics? I implemented a high level components system for my renderer and am curious about the right way to update the transforms components of models that have a physics rigidbody attached. I am using bulletsharp. To clarify. Transformcomponents holds the model matrix that is used for rendering. Rigidbody holds the worldmatrix that is getting modified by step simulation of bulletsharp. I want my rigidbody and transformcomponents matrices to stay synced.

My idea is to do it like this per render loop:

Always use transformcomponent for rendering
Execute physics step simulation
Update all transformcomponents with new matrices from  rigidbody
Whenever transformcomponent gets a matrix update from user input and not physics... Update the matrices recursive for the attached rigidbody and all children
Render with matrices of transformcomponents

Is there a better way to implement rigidbody physics in a components system for rendering? I use the physics mainly for raycast picking and OBB collision detection.

And when I use the term "better", I mean more efficient in terms of least updates on scene components. Syncing two components matrices seems tedious and I want to know if there is a solution without syncing.

sentences:
Activating particle system after 2 triggers on enter I would like that

particle system must play indefinetely at some position after two triggers on collision are triggered on enter.
When game starts, particle system is deactivated.

I have make this script where I can attach particle system into prefab and I have set spawnpoint position.

1) Is it possible to activate particle system differently (without Instantiate) ?

2) How to make that two triggers on enter activate particle system? One trigger is not enough.

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class spawn_object : MonoBehaviour {

public Transform spawnpoint;
public GameObject prefab;

public int i=1;
// Use this for initialization

while (if <=2)
{
void OnTriggerEnter () {

    Instantiate (prefab, spawnpoint.position, spawnpoint.rotation);
            }
    i++;
}

}

sentences:
How to prevent constant adjustments form collision? I'm try to clone a popular 2D platformer as a project. For both the player character and enemies, whenever I constantly check to see if they are walking on the ground or floating platforms, they "vibrate" or "Bounce" instead of walking smoothly, as gravity pushes them downward, and the platform pushes them upward. I have tried searching for this problem, but can't seem to find anything relevant to my problems (which probably means I am searching the wrong thing because I'm sure everyone runs into this problem at some point.)

Essentially, the player and enemies are always effected by gravity, but the collision acts against it and pushes them upward. I tried having a boolean that was set once they appeared to be on solid ground, but this made them float artificially once they walked off of floating platforms.

Here is the code for enemy collisons:

public void EnemyBlockResponder(IEnemy enemy, IBlock block, Rectangle intersection)
{
    enemy.YLocation -= intersection.Height;
}

I'm currently assuming that a side collision with a block will never happen for debugging.

Here is the Update method for the enemy:

public void Update()
{
    if (currentDirection == Direction.LEFT)
    {
        xLocation--;
    }
    else if (currentDirection == Direction.RIGHT)
    {
        xLocation++;
    }
    if (NoFloor())
    {
        yLocation += 3;
    }

    goombaSprite.Update();
}

Where NoFloor is a method that checks all the blocks on camera to see if the enemy is colliding with any of them.

Where is this code causing the sprite to continually bounce? I appreciate any help and criticisms. Thanks.

sentences:
Designing an efficient neighbour-networking system I'm developing a game, which involves the use of nodes (buildings), and I need to implement neighbour networks that nodes can use to either directly or indirectly access other nodes. Nodes can be created, destroyed, or bridged to at any point in the game.

At the moment, I'm creating a list of all the nodes in a neighbour network, which is re-calculated whenever there is a new addition to the network. Each node in the network will hold a reference to this list. This system works, but I feel that there is a more efficient way to do this.

This is my current code for my node class

public class Node {
    public List<Node> directNeighbours;
    public List<Node> network;

    public void addNeighbour(Node n) {
        directNeighbours.add(n);
        recalculateNetwork();
    }

    public void removeNeighbour(Node n) {
        directNeighbours.remove(n);
        recalculateNetwork();
    }

    public void recalculateNetwork() {
        recalculateNetwork(new Network(), new HashSet<Node>());
    }

    void recalculateNetwork(List<Node> network, Set<Node> searched) {
        if (searched.contains(this)) return;

        network.add(this);
        this.network = network;

        for (Node neighbour : directNeighbours) {
            neighbour.recalculateNetwork(network, searched);
        }
    }
}

Is this the best way to keep track of direct and indirect neighbours? If not, could anyone please give me ideas on how to make this better?

sentences:
What C++ libraries can be used in game development I'm currently in the planning stage for my next game, and since I've been away from C++ for a while I have some questions about helpful libraries. I plan on making a 2D game with SDL, constructing my own simple 2D engine. I plan on making this game for the PC.

What libraries would you recommend to make this process easier?

What about unittests?

What about an enforce operator to throw exceptions?

int a = 1;
enforce(a == 2); //Throws an exception,

Specifically, i'm looking for general purpose libraries, that implement that make my life easier (like boost). Also, a helpful library for physics/collision, AI, XML file parsing (specifically working with the Tiled map editor), and any others that you guys have used that are useful in a 2D game.

sentences:
Problem with camera drag and draggable UI elements I implemented my camera drag using the following method:

 if (Input.GetMouseButtonDown(0))
        {
            dragging = true;
            followPlayer = false;
            oldPos = transform.position;
            panOrigin = Camera.main.ScreenToViewportPoint(Input.mousePosition);
        }

        if (Input.GetMouseButton(0))
        {
            Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition) - panOrigin;
            transform.position = oldPos + -pos * panSpeed;
            transform.position = new Vector3(Mathf.Clamp(transform.position.x, xMin, xMax), Mathf.Clamp(transform.position.y, yMin, yMax), transform.position.z);
        }

        if (Input.GetMouseButtonUp(0))
        {
            dragging = false;
            //  followPlayer = true;
        }

But i also have draggable UI components that implement the  IBeginDragHandler, IDragHandler, IEndDragHandler interfaces. Problem is of course while draging the item in the canvas the camera still moves. Any idea how to solve this besides the obvious setting of bools in the inplementation of the interfaces to prevent the camera drag code from executing. An other problem is that I have other non UI object in the game that I want to click so implementing a transparent UI element behind all other UI will not work for me.

sentences:
Is it possible to correctly catch up a particle system simulation based on long delta time between many frames? I have a particle system with a physics simulation integrator based on delta time (elapsed time between frames) which is implemented on the GPU in a compute shader. I also have a frustum culling system implemented on the GPU. The frustum culling gives me the possibility to cull away draw calls and the dispatch calls for the particle simulation. The culling of draw calls works well, I also don't have a problem with culling the particle simulation when the camera is looking away.
My problem happens when I want to catch up the particle system simulation when the camera looks back at the particle system after looking away for a while. What I do is accumulate the time passed while looking away, then I resume the simulation using all that accumulated time. The problem with this approach is that if the simulation is anything but a simple constant velocity change in one direction, the simulation just doesn't look the same as if the simulation was playing one frame delta at a time.
From what I have read this is a common issue with using time elapsed between frames to simulate physics. What I wonder is if there's a different approach that can actually allow me to correctly play back many seconds of simulation (let's say 20 seconds) the same as if it was played one frame delta at a time?

sentences:
Unity 5 Camera Functions Usage Error How to use functions like ScreenToRayPoint() in Camera class?

I have used this code:

Ray ray = camera.ScreenPointToRay(Input.mousePosition);

and it says

  Component.camera is obsolete, instead using GetComponent()

Then I tried these:

Camera cam = GetComponent<Camera>();

Ray ray = cam.ScreenToRayPoint(Input.mousePosition);

and it says

  Camera doesn't contain a definition of ScreenPointToRay and no extension method 'ScreenPointToRay' accepting a first argument of type 'Camera' could be found.

sentences:
Textures not displaying. Problem with fragment and vertex shaders Hi i have newbe question. I am sending to gpu textures unit and they dont display.
This is simple version of my fragment and vertexshader. (More complicated version also dont work with other textures than DDS but maybe simpler version will tell you what newbe mistake i made)

for (unsigned int i = 0; i < textures.size(); i++){
    glActiveTexture(GL_TEXTURE0+i);
    glBindTexture(GL_TEXTURE_2D, Textures[i]);
    // Set our "myTextureSampler" sampler to user Texture Unit 0
    glUniform1i(TextureID, i);
}

This is my simple fragmentshader

#version 330 core

// Interpolated values from the vertex shaders
in vec2 UV;

// Ouput data
out vec3 color;

// Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler;

void main(){

    // Output color = color of the texture at the specified UV
    color = texture2D( myTextureSampler, UV ).rgb;
}

This is my simple vertexshader

#version 330 core

// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec2 vertexUV;

// Output data ; will be interpolated for each fragment.
out vec2 UV;

// Values that stay constant for the whole mesh.
uniform mat4 MVP;

void main(){

    // Output position of the vertex, in clip space : MVP * position
    gl_Position =  MVP * vec4(vertexPosition_modelspace,1);

    // UV of the vertex. No special space for this one.
    UV = vertexUV;
}

EDIT this corrected version but still something dont work. If i had DDS everything was working OK but jpg textures all time i have problems.

EDIT i have correct number of textures but they looks diffrent than original

sentences:
Finding the normals of the planes of a View Frustum Say I have a perspective view matrix function that takes in aspect, fovy, near, and far... Transforming the view into a frustum. Typical OpenGL stuff, right. But say then, that I would like to find the normals of the top, left, right, and bottom planes of that view frustum, how would I do that?

Edit: I forgot, the camera has a vector position, and a vector direction ...

sentences:
Trouble Positioning Object In World I have a lightning effect that travels from point A to point B, I am having trouble placing placing point B correctly.

As you can see from the object hierarchy the points (LightningStart, LightningEnd) are nested 3 levels deep. _parentReaction.affectorWidget.transform.positionis the position I would like the object to be at.

As you can see below I have tried setting the position equal to the other widgets transform, I have also tried using transform.InverseTransformDirection and transform.TransformDirection in varying combinations, I have tried many options the code below is just me going back to basics to see what I missed.

I am not sure even which object I am supposed to call TransformPoint from, the Widget with the effect )(Point A) or the Widget at Point B?

Given the above scenario how would I position LightningEnd so that is at the same position as_parentReaction.affectorWidget.transform.position?

I understand this is a very common question and I have read many previous questions related to this but two hours later, I would just like to know how its done so I can understand where I am getting this wrong.

Thank you.

Edit: _controller is the Widget Running this effect, since it spawns as a child of this I dont need to worry about its position.

    public override IEnumerator Do(Widget _controller, WidgetReaction _parentReaction)
{
    effect = _controller.GetComponent<Widget_Effect_Comp>().AddEffect(effect);

    while (true)
    {
        start = effect.effectPrefab.transform.Find("LightningStart").transform;
        end = effect.effectPrefab.transform.Find("LightningEnd").transform;

        Debug.Log("End Position : " + effect.effectPrefab.transform.Find("LightningEnd").transform.position);

        //Debug.Log("Widget World Pos : " + _controller.transform.position);
        //Debug.Log("Widget Local Pos : " + _controller.transform.localPosition);

        //Debug.Log("AffectorWidget World Pos : " + _parentReaction.affectorWidget.transform.position);
        //Debug.Log("AffectorWidget Local Pos : " + _parentReaction.affectorWidget.transform.localPosition);

        effect.effectPrefab.transform.Find("LightningEnd").transform.position = _parentReaction.affectorWidget.transform.position;

        Debug.Log("End Position : " + effect.effectPrefab.transform.Find("LightningEnd").transform.position);

     yield return new WaitForSeconds(2f);
    }

}

public class WidgetEffect : ScriptableObject
{
    public string effectName;
    public GameObject effectPrefab;
}

public WidgetEffect AddEffect(WidgetEffect _widgetEffect)
{
    if (!activeEffects.ContainsKey(_widgetEffect))
    {
        GameObject go = Instantiate(_widgetEffect.effectPrefab);
        go.transform.parent = effectContainer.transform;
        go.transform.position = Vector3.zero;
        go.transform.localPosition = Vector3.zero;
        activeEffects.Add(_widgetEffect, go);

        return _widgetEffect;
    }
    return null;
}

Edit: Removed Extended Explanation not related to initial question!
[![enter image description here]]

sentences:
Libgdx Sprite rotation around specific point I made complex dynamic body that rotates around other body that is static. It works perfectly, however I got messed up with sprite position on that body.
Here's what I have now

and here's what I need to have

I will add my code

private Body createSide(float x, float y, Sprite tmpSprite, boolean sharp){
      BodyDef bDef = new BodyDef();
      bDef.type = BodyDef.BodyType.DynamicBody;

    PolygonShape shape = new PolygonShape();
    if(!sharp){
        shape.setAsBox(1.8f / PPM, 0.2f / PPM);
    } else {
        shape.setAsBox(0.2f / PPM, 1.8f / PPM);
    }

    FixtureDef fdef = new FixtureDef();
    fdef.shape = shape;

    bDef.position.set(x, y);
    Body body = world.createBody(bDef).createFixture(fdef).getBody();
    body.setAngularVelocity(-1f);
    tmpSprite.setPosition(bDef.position.x * 32, bDef.position.y * 32);
    return body;
}

private void createBody(int y, final int V_WIDTH){
        staticBody = createStaticBody(y, V_WIDTH);
        Body rightSide = createSide(5.5f, 15, sprites[0], true);
        Body leftSide = createSide(9.5f, 15, sprites[1], true);
        Body top = createSide(7.5f, 17, sprites[2], false);
        Body bottom = createSide(7.5f, 13, sprites[3], false);

        bodies[0] = rightSide;
        bodies[1] = leftSide;
        bodies[2] = top;
        bodies[3] = bottom;

...
...
...
    }

and here's my draw method

@Override
    public void draw(SpriteBatch sb) {
        for (int i=0; i<bodies.length; i++){
            sprites[i].setRotation(bodies[i].getAngle() * MathUtils.radiansToDegrees);
            sprites[i].draw(sb);
        }
    }

sentences:
GLSL Shader compiles, but source is empty I'm trying to compile a GLSL shader, to which I use the following code.

Initialization

SDL_Window* boringInitStuff(){
    SDL_Init(SDL_INIT_VIDEO);
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

    Uint32 windowFlags = SDL_WINDOW_OPENGL;
    SDL_Window* sdlWindow = SDL_CreateWindow("Boooring", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, windowFlags);

    SDL_GL_CreateContext(sdlWindow);

    glewExperimental = GL_TRUE;
    glewInit();

    return sdlWindow;
}

File parser

void readFile(std::string path, std::string& data){
    std::ifstream f(path.c_str(), std::ios::binary);
    data.assign((std::istreambuf_iterator<char>(f)),
                (std::istreambuf_iterator<char>()));
}

Main

int main(int argv, char** args) {
    SDL_Window* sdlWindow = boringInitStuff();

    std::string buffer;
    readFile("./compile_test.vert", buffer);
    const char* cBuffer = buffer.c_str();

    GLuint shaderID = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(shaderID, 1, &cBuffer, nullptr);
    glCompileShader(shaderID);

    while(!SDL_QuitRequested()){
        SDL_GL_SwapWindow(sdlWindow);
    }

    return 0;
}

But when I try to inspect the source code in gDEBugger, the source code is gone. Linking of course doesn't work aswell. The weird thing is, that the compilation error checking works.
EDIT: When I copy & paste the main part into another opengl project, it works.

sentences:
Why might my Object Attributes become linked after refactoring? As part of a game design class I'm taking this semester, I'm developing the basics of a game engine. I shared what I had in the GameDev chatroom, earlier, and everything was working as expected.

Then, because I knew it needed it, I started work on refactoring the core classes within my code. I modified the ancestor GameObject class, and after the tedious process of renaming all the method and field calls (I combined two float's, xPosition and yPosition into a single, Vector2d class - yes, I realize there are existing classes out there, but it was easier to simply write a new one, given that I can't make any assumptions on the installed libraries when it comes time for grading my work. I digress), prepared to test my newly refactored code.

The results were... perplexing. Suddennly, my SpawnPoint object was moving. Not only that, but it seemed attached to the PlayerEntity object itself, always matching the position of the controllable playerEntity (though it lagged a bit behind if you moved fast enough). And yet, I know that I never move the SpawnPoint, only the player entity; a quick search (ctrl+f) through my code confirmed that. But despite this, I had somehow managed to achieve quantum entanglement of these disparate objects.

I've reproduced both constructors below. Is this a case of passing by reference instead of by value? If so, is there a general way to avoid such troubles when instantiating objects with other objects as parameters?

Original Code:

public class PlayerEntity extends GameObject{

  SpawnPoint playerSpawn;
  public boolean isDead = true;
  float xVelocity;
  float yVelocity;

  //constructor, single dimension
  PlayerEntity(SpawnPoint spawn)
  {
    this.objClass = "entity";
    this.playerSpawn = spawn;
    this.xDiameter = 15;
    this.yDiameter = 15;
    this.xVelocity = 0;
    this.yVelocity = 0;
  }

  void respawn(){
   isDead = false;
   this.xPosition = playerSpawn.xPosition;
   this.yPosition = playerSpawn.yPosition;
  }

Refactored (Bugged) Code

public class PlayerEntity extends GameObject{

  SpawnPoint playerSpawn;
  public boolean isDead = true;
  Vector2d velocityVector;
  float xDiameter;
  float yDiameter;
  //constructor, single dimension
  PlayerEntity(SpawnPoint spawn)
  {
    this.objClass = "entity";
    this.playerSpawn = spawn;
    this.xDiameter = 15;
    this.yDiameter = 15;
    this.velocityVector = new Vector2d(0,0);
    this.positionVector = this.playerSpawn.positionVector;
  }

void respawn(){
   isDead = false;
   this.positionVector = playerSpawn.positionVector;
  }

The first thing first thing the PlayerEntity does in its update() method is call "respawn()" if isDead = true (which is why I think I got away without initializing the position in the first, working, code).

With the help of a debugger, I've narrowed down the method call which (unintentionally) modifies the spawnpoint's position. I'll probably edit that into the question when I have exactly identified the culprit.

Edit: Here is the method where the value is changing (though I don't know why), taken from playerEntity.

Original (working correctly)

void moveEntity()
      {

    this.xPosition += this.xVelocity;
    this.yPosition += this.yVelocity;
}

Refactored method (bugged behavior)

void moveEntity()
      {

    this.positionVector.xCor += this.velocityVector.xCor;
    this.positionVector.yCor += this.velocityVector.yCor;
  }

for whatever reason, this is causing the spawnPoint's positionVector to alter as well.

This program is written in Processing (which is just a java library, albeit one with its own IDE).

sentences:
Models loaded with Assimp have messed up UVs/normals I've been trying to use Assimp to load models and so far I got it to load a few obj models, but all of them have messed up UVs (and maybe normals).

Here's what it looks like :

I tried several combinations of Assimp's loading flags, but to no avail.

Here are the used flags :

const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_FlipUVs|aiProcess_GenSmoothNormals|aiProcess_ImproveCacheLocality|aiProcess_FixInfacingNormals|aiProcess_FindDegenerates|aiProcess_FindInvalidData|aiProcess_GenUVCoords|aiProcess_TransformUVCoords);

I'm only loading already triangulated (with Blender) obj models with no submeshes.

Thanks in advance for any help.

sentences:
Network latency compensation problem for laggy players with collision Say there are two clients connected to an authoritative game server, using input + state synchronization strategy. Client 1’s has a round-trip latency of 100ms and client 2 with 400ms latency. For now just imagine each player controls a ball that can collide and bounch off each other.

Client 1 executes command at t = 100 ms, proceeds with prediction for next 100ms (however many steps depending on timestep and framerate)
Client 2 also executes command at t = 100ms,  proceeds with prediction for the next 400ms (or capped at some max prediction timestep)
Server receives client 1’s commands for the next t = 100ms + dt, simulates up to t = 100ms + dt
Say server’s simulation is now at t = 500ms, and client 2’s command for t = 100ms just arrived. In this case I can think of two things to do:

a.  Rewind simulation back t = 100ms and re-simulate back to t = 500ms, if client 1 was affected by client 2’s command (such as collision) send correction to client 1. The results are that:

To client 2, everything looks fine
To client 1, his movement constantly rewinds bottlenecked by client 2 as long as client 2 is affecting client 1

b.  Simulate client 2’s command as if it was executed at t = 500

To client 1, everything looks fine
To client 2, his motion is constantly corrected (either jerky or the interpolation creates strange movements)

With this method you can really only have smooth gameplay for one person. Are there better methods for smoothing out the gameplay for all players? I understand that for FPS you can easily compensate for the the bullet latency because you don't actually see the bullet. But in the case where physics collision can occur between players this becomes troublesome.

Another idea that I have is spawning of a lava pit that is instant death for players. Lava pit spawning done using client side predication can instant kill the player and sync the state later, resulting in smooth gameplay for the client. But if the other player is lagging it will appear as if he is still standing in the pit (or with full prediction will kill him but he’s not actually dead). How do games handle cases like this?

sentences:
uNet - Client cant see server spawned objects I'm facing a problem where when I connect with the host, all the towers spawn. After I connect with a client only to find out there are no towers visible and I can walk through them when looking at the host screen.

My tower spawn script ( GameManager.cs ) :

public int numberOfDestroyedTopTowers = 0;
public int numberOfDestroyedMidTowers = 0;
public int numberOfDestroyedBotTowers = 0;

public GameObject[] topTowerSpawns;
public GameObject[] midTowerSpawns;
public GameObject[] botTowerSpawns;

public GameObject towerPrefab;

void Start() {
    CmdSpawnTowers();
}

[Command]
void CmdSpawnTowers() {

    for (int i = 0; i < midTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = midTowerSpawns[i].transform.position;
        currTower.name = "Tower [MID] " + i;
        NetworkServer.Spawn(currTower);
    }

    for (int i = 0; i < topTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = topTowerSpawns[i].transform.position;
        currTower.name = "Tower [TOP] " + i;
        NetworkServer.Spawn(currTower);
    }

    for (int i = 0; i < botTowerSpawns.Length; i++) {
        GameObject currTower = (GameObject)Instantiate(towerPrefab);
        currTower.transform.position = botTowerSpawns[i].transform.position;
        currTower.name = "Tower [BOT] " + i;
        NetworkServer.Spawn(currTower);
    }

}

The script is derived from NetworkBehaviour and it does have a Network Identity on it (Server Only checked). Also on my towerPrefab I also have a network identity with server only checked.
I have added my tower prefab under the network manager "Registered Spawnable Prefabs".

sentences:
How to implement marching cube algorithm for rendering clouds I would like to render clouds using C#, directX9.0

using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;

Now I have roughly add and render the vertex as per below:

As you can see, the vertex is added in a cubic structure. And what I need to do now is to change the cubic structure to curve structure so that the whole cubic structure should looks like a cloud.

I am not using any graphic library but to build this structure solely using Microsoft.DirectX and DirectX.Direct3D

I did some Google search, and it seems the cube marching algorithm is a useful method to be implemented on these kind of 3D rendering.

From what I researched, there are no ready source for C#, but only for C++ for cube marching algorithm.

So, I would like to ask, if I only want to do the cloud rendering, is the marching cube algorithm a must? Or are there other options to align the structure to let it look like a cloud?

I totally have no idea at all, hope could look for some snipshot of source code or any good reference in C# using DirectX.dll

sentences:
Why current scene in cocos2dx has no children when accessed from outside scene class? I want to access a sprite in a scene, but I cannot get the running scene from outside the scene class.

The scene is created using:

Scene* MyScene::createScene() {
    auto scene = Scene::create();
    auto layer = MyScene::create();
    scene->addChild(layer);
    return scene;
}

bool MyScene::init() {
    this->addChild(sprite,100, 1234);
}

But if I then access the running scene from outside the class, it has no children.

Director::getInstance()->getRunningScene()
//should be the MyScene instance with sprite children, but has no children.

I also tried giving the scene layer a tagname, but with the same result.

scene->addChild(layer,100,TAGNAME);
...
Director::getInstance()->getRunningScene()->getChildByTag(TAGNAME)
//returns NULL because getRunningScene has no children.

The only way I can access the scene is making a static reference in my AppDelegate, but this doesn't seem a proper way. How can I get the current scene correctly from outside the class?

sentences:
Screen Space reflections not tracing correctly - GLSL I've been trying to implement screen space reflections for the past couple of days, however it's been difficult finding specific implementation instructions or guides.

Most of the hits on the subject that I can find relate to UE4 or Unity, or a sample implementation in HLSL derived from GLSL work both using different coordinate systems for the y and z axes.

Following what little I could find, I've been using the following shader:

#version 430

layout (std430, binding = 2) buffer Camera_Frag
{
    mat4 pMatrix;
    mat4 InvPMatrix;
    vec2 ScreenSize;
};

uniform sampler2D ViewNormalMap;
uniform sampler2D DepthMap;
uniform sampler2D LightMap;

in vec2 TexCoord;
layout (location = 0) out vec4 FragColor;

vec2 RayCast(vec3 dir, inout vec3 hitCoord, out float dDepth)
{
    dir *= 0.25f;

    for(int i = 0; i < 20; ++i) {
        hitCoord               += dir;

        vec4 projectedCoord     = pMatrix * vec4(hitCoord, 1.0);
        projectedCoord.xy      /= projectedCoord.w;
        projectedCoord.xy       = projectedCoord.xy * 0.5 + 0.5;

        float depth             = texture(DepthMap, projectedCoord.xy).r;
        dDepth                  = hitCoord.z - depth;

        if(dDepth < 0.0)
            return projectedCoord.xy;
    }

    return vec2(0.0f);
}

void main(void)
{
    vec3 View_Normal            = texture(ViewNormalMap, TexCoord).xyz;
    float View_Depth            = texture(DepthMap, TexCoord).r;
    vec3 ScreenPos              = 2.0f * vec3(TexCoord, View_Depth) - 1.0f;
    vec4 View_Pos               = InvPMatrix * vec4(ScreenPos, 1.0f);
         View_Pos              /= View_Pos.w;

    // Reflection vector
    vec3 reflected              = normalize(reflect(normalize(View_Pos.xyz), normalize(View_Normal)));

    // Ray cast
    vec3 hitPos                 = View_Pos.xyz;
    float dDepth;
    float minRayStep            = 0.1f;
    vec2 coords                 = RayCast(reflected * max(minRayStep, -View_Pos.z), hitPos, dDepth);

    FragColor                   = textureLod(LightMap, coords, 0);
}

I get the scene projected further down, but it isn't upside down. Notice the vases and the plants on top of them. Its like the scene gets resampled and pushed downwards.

Can anyone help me understand why I'm not getting the expected results?
I've never done any raytracing before, so perhaps I'm misunderstanding how this is supposed to work.

sentences:
What are the performance and size tradeoffs of Eigen::Transform versus Eigen::Matrix4f? We finished migrating from DirectXMath to the Eigen math libraries for our 3D-Game Engine last week for portability reasons. After implementing transformations with matrices as we know them, we found out about Eigen::Transform, which seemed like a really cool idea at the time.

Now, after a lot of fiddling things still don't quite work and we don't seem to have as much control over the way that Transformations are made. With Eigen::Matrix4f, you're making the multiplications directly and can change in which order they are made. Eigen::Transform appears to be way less transparent and flexible.

So we thought about reverting to our commits from last week, and head on to work with matrices again. But there are a few things we are concerned about:

Saving things like translation in a 4x4 Matrix takes up more space than using Eigen::Translation
Generating a new Matrix4f for the complete transformation every tick seems like a tedious process

So I wanted to know how Transform compares to regular Matrix4f in terms of speed and if my impression that  Transform is not as flexible is actually true or not.

sentences:
Google play game services and Facebook integration in one game We are creating a cross platform game for iOS and Android. We have thought about how and with which services we should integrate achievements and scoreboards with.

For the iOS part, we are pretty sure that this how we want to do, in order from when the user opens the app for the first time:

Connect with Game Center (Should be automatic, the user shouldn't even notice?) We will also get the players nickname for public scoreboards here.
Ask if the user wants to connect with Facebook so that we can compare the players highscores with their friends.

We could add Google play game services there as well, but I don't feel like that adds anything to the experience for the end user.

Now comes the tricky part: Android

We thought that we could do just like for iOS, except that we replace Game Center with Google Play Game Services. However, unlike Game Center, Game Services will ask the user to log in to their Google+ account and allow us to access their account. So now, what we have is a double login, first with Google+ and then with Facebook. What will users think about that? Should we scrap Play Services entirely and just ask the user for a nickname within our app and user Facebook for achievements?

sentences:
Duplicating Images in SFML I was wondering how one would go about duplicating the same sprite in SFML, instead of having to create new sprites every time I would want have another sprite of the same image. Just some basic thought process or pseudo-code is what I'm looking for.

Thanks.

sentences:
Getting Position of a Player in a grid So I am making a pacman-like game. the game has tiles/grid. I keep the node data in a struct:

struct Node

{
    std::pair <int, int> node; // position of the node <x,y>
    float f = 0,
          h = 0,
          g = 0;
    std::pair <int, int> previous;
    bool iswall = false;
    sf::Vector2f rectCenter = sf::Vector2f(0, 0);
    sf::Vector2f position;

};

i use the struct to calculate a path, check if the cell is an obstacle (or not) etc.

now in the main I use the arrays and a for loop to draw the grid:

for (int i = 0; i<col; i++)
        for (int j = 0; j < row; j++)
        {
            /*default color is black*/
            box[i][j].setFillColor(sf::Color::Black);
            box[i][j].setOutlineColor(sf::Color::Yellow);
            box[i][j].setOutlineThickness(-1);
            box[i][j].setSize(sf::Vector2f(w, h));
            box[i][j].setPosition(sf::Vector2f(i*w, j*h));
            sf::FloatRect fbox = box[i][j].getGlobalBounds();
        }

[1

I also use the strcut to create specific nodes (current position, start node, end node)

and i draw it in the man like this:

        //displays the start node as green
        if (i == crntNodex && j == crntNodey)
        {
            box[i][j].setFillColor(sf::Color::Green);
                }

now the problem that I'm facing is making a function that can get the current node that the player (blue square on the green cell) is. My attempt for this was checking if the cell contained the player

std::pair<int, int> AIEnemy::getNodePosition(sf::RectangleShape * grid, int i, int j)
{

    if (box.contains(rect.getPosition().x, rect.getPosition().y))
    {
         return std::pair<int, int>(i,j);
    }
}

but It is not efficient (and also doesn't update). is there a way I can get game objects coord on a grid?

sentences:
RawImage texture change event? I have a RawImage and an AspectRatioFitter attached to it so I want to change the aspect ratio to fit the image in the texture field of the raw image.
But I need to avoid checking for it in the update as much as possible.
Is there an event for when the texture of a RawImage element has changed? Something like OnTextureChanged().

sentences: How does one load TMX files into a SFML game? How does one load .tmx files from Tiled into a SFML game?

sentences:
Converting data file of Sprite Atlas from JSON to Cocos 2D I have an existing Sprite Atlas with its data file in JSON format. How do I convert it for use with Cocos 2D and other frameworks ?

I tried poking around in Texture Packer which supports publishing to multiple formats. But I can't figure out how to convert from one format to another

EDIT : Is there any other software that is able to convert between different formats ?

sentences:
Obj Blender Export Recommendation for OpenGL C++ I have been modelling some objects inside blender, like a light bulb.
I finished the light bulb, and I got a question at the time of export it.

I want to export the light bulb in the wavefront format (.obj), but the light bulb is formed by different meshes, I mean, It's not joined in one mesh. If I export the obj that will be as different meshes inside the .obj

My final question is, for import it in the OpenGL C++ side, it's better to join all the meshes (vertexes) inside one or leave them as separated objects? There will not be any trouble on translating... resizing... etc, if they are not joined?

sentences:
How do I manage monster tables and item databases in my Android game? To learn more about AI during combat, I made a demo in Unity where a player would fight a creature in an arena. I started here because I plan to implement the system I'm working on in another game. In that game, there are a lot of different creatures a player has to fight.

These creatures have a body part set, a move list, an attribute set and a drop table for that type of creature. Currently I'm managing this by a big static class with drop tables, move tables, monster tables and item tables and so on in them. When a creature gets instantiated it copies monster data from that static class and when it dies items in the referenced drop table are instantiated, copying some data from the item table. Whenever a monster performs a move, the necessary information is looked up in that static class.

I could solve monster data by copying the necessary data into the monsters and then dispose of the class, but that leaves no option for items, which are referenced by ID and need to be looked up frequently. Serializing and deserializing the data wouldn't make sense if I would have to load the entire item table or unit attributes every time every time I access them. Keeping the entire game data loaded all the time doesn't sound like the best way to go about managing my data.

My own system is becoming unmanageable. Because I'm targetting Android, I'm also, to a lesser degree, worried that having such a big static class loaded all the time will become a burden once more features are added to the game. I have read this post but didn't find it of much help.

Which ways are there to improve from the current situation?  How could I handle a frequently used item table/database more efficiently. And on the other side, how could I handle a move table and monster table better? How did NetHack do it, for example?

sentences:
"Overloading" GameObject? I would like to show weapons and health items in an inventory grid.

The item can be rotated in the grid, and it occupies a certain region in the grid.

Currently I store this information (where the item is located, if it is rotated, etc.) in an additional array. However, this is not elegant and error prone.

I would therefore like to ask if it is possible to somehow store this additional information directly in the weapon or health GameObject.

Ideally I would like to be able to do something like this:

Pistol.GridProps.Rotation = 90
Pistol.GridProps.Row = 5
Pistol.GridProps.Col = 3

Is it possible to add something like "GridProps" to all my game objects?

Thank you!

sentences:
Why do tutorials use different approaches to OpenGL rendering? http://www.sdltutorials.com/sdl-opengl-tutorial-basics

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

These two tutorials use completely different approaches to get nearly the same result. The first uses things like glBegin(GL_QUADS). The second one uses stuff like vertexBufferObjects, shaders based on GLEW. But the result is the same: you get basic shapes.

Why do these differences exist?

The first approach seems much easier to understand. What's the advantage of the complicated second approach?

sentences:
AI pathfinding in mostly-free space I'm working in an action/strategy proyect. Consider it a RTS game. The game is in 2D (with LibGDX), and I have a lot of soldiers moving along. Now I have to implement the AI. Let me say some things about my current design:

The map has been constructed with tiles. However, I want to allow the soldiers to move in every direction -so using the tiles as graph for A* is not a good idea.
The obstacles are given by collision rectangles. Maps will have a lot of free space, and collision rectangles don't fit the tiles -that makes even worse the election of A* with tiles.
Waypoints, for the same reason, are not a good idea. I would need a very big net and soldiers would move in strange ways, as pointed out here: http://www.ai-blog.net/archives/000152.html
I've taken a look to the LibGDX-AI library. I would like to make soldiers follow the captain or use some kind of formation. Looks like this library is a good choice to make that.

Some things I know:

I also have read about potential/vector fields and navigation mesh. The fields look interesting, but I'm not sure of how to implement them for my case. They could be good for pahtfinding, but some soldier have to follow the captain and move in formation.
I think nav meshes won't solve my problem. As I've said, I have a lot of free space, and soldiers can move whatever they want, so the question "how to move the soldier inside the mesh?" remains.

QUESTIONS:

How to make a free-space AI pathfinding which avoid my collision rectangles?
How to make this compatible with formations like following the player across the map?
Is there any way to use LibGDX-AI to do this?

sentences:
pause or freezing game screen I have a question regarding the pausing/freezing a game while a window/pausemenu will appear at center of the screen. I've already created a pausescreen class which will be called each time the back key is being pressed.

My problem is that I don't know how to freeze or put the game to pause, this becomes a problem because whenever i tried to click on the outsides of the pause window the player could move around.

sentences:
how to instantiate UI image in unity2D I'm making 2d racing game .... and I'm using UI image in the canvas background (road) .my car and enemy cars and I have tried to instantiate enemy car with this script by attaching this script to empty gameObject then attaching the enemy prefab to the enemyCar image that in the script...but the strange thing is :the enemyCar is instantiated in the hierarchy but I can't see it in the game What is the wrong ? is the wrong related to the child and parent or what ? and how can I make that UI image a child of canvas in the script ?

using UnityEngine;
using UnityEngine.UI;
public class Generate : MonoBehaviour
{
public Image enemyCar;

// Use this for initialization
void Start()
{
 InvokeRepeating("CreateEnemy", 1f, 1.5f);
}

void CreateEnemy()
{
 Instantiate(enemyCar);
}
 }

sentences:
Bones are rotated wrong direction on play mode I made animations from Blender and exported as FBX.

However in Unity, default pose seems fine in edit mode.

But in play mode, spine bones are rotated wrong direction:

It's Humanoid type and each bones are set correctly without any error. There's nothing make change to those bones but why it has wrong rotation in play mode?

What am I missing? What should I check about this?

Any advice will very appreciate it.

sentences:
Measuring enemy "success" against player I've been toying with an idea for a game prototype where the player must defend against waves of enemies, but between each wave the enemies "evolve" to better combat whatever tactics the player is using. Essentially each enemy type has some genetic information that can be used to generate their health, speed, attack type and so on; with the more "successful" enemy types being mutated into new sub-types, while ineffective enemy types are phased out.

What I'm trying to figure out, is what is a good way of measuring "success" against the player?

EDIT: Although I don't really want to get too specific about the game mechanics, let's assume that the game world is complex enough that you cannot figure out if an enemy type will be effective against the player without testing it.

So far I've thought of two basic solutions:

Use heuristics like whether a certain
enemy deals damage to the player or survives a long time without
being killed.

The problem I have with this approach is that it can be exploited if (when) the player
figures out how the algorithm works. For example you would be able to
deliberately let the weakest enemies land a few free hits to trick
the game into creating more of them. It may be possible to improve this with better heuristics however.
Only use about half the pool of enemy types at once and
swap types in and out randomly between waves. Analysis could
then be performed on the player's performance throughout the wave and each participating enemy type would be considered equally successful/unsuccessful. After a number of waves the success of  enemy types would be varied enough to perform mutation/deletion.

This solution seems intuitively harder to exploit and it would also pick up on successful combinations of enemy types that might not be possible to detect by looking at individuals, however it might also result in anomalies where useless enemy types are considered successful because they happened to get assigned to waves with stronger enemy types backing them up.

To clarify, I'm not asking about the actual process of evolving enemies, just about how to measure which enemies are successful against the player.

sentences:
Unity rigidbody velocity In Unity, what is the correct way to move a game object by modifying the velocity of its rigidbody?
I'm having some issues with stuttering movement, so I just want to make sure I understand the basic idea. Is the following correct for moving an object vertically down the screen? Should this result in smooth, stutter-free movement?
using UnityEngine;

public class MovementTest : MonoBehaviour
{
    private Rigidbody2D rb;

    [SerializeField] private float speedY = -250;

    private void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void FixedUpdate()
    {
        rb.velocity = new Vector2(
            0,
            speedY *  Time.fixedDeltaTime
        );
    }
}

```

sentences:
Showing Unicode in XNA on Windows Phone 7 I am creating an application which downloads names from server. These names can be any  unicode language text which I need to render in XNA on WP7. The biggest problem I see here is WP7 xna system can't render unicode (especially complex script) well. I tried few asian scripts and it looks ridiculous. Some aisan scripts render a character differently depending on neighbor character (generally vowels). Spritefont just renders them one after another without giving any consideration to vowels.

I think I need something like freetype library to render vector fonts on runtime. I wish to know if there are any alternatives to overcome this issue.

sentences:
How do I efficiently choose the terrain chunks to render based on the player position? Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered.

The problem is that if I add all the terrains of the array to the list (let's call it toRenderList), my computer explodes because of the number of terrains.

What I've tried to achieve it's to add to the list ONLY the terrains that are into a certain range. This is what I've done:

private static Terrain[][] terrains;
private List<Terrain> toRenderList;
private static final int NUMBER_CHUNKS = 3; //Number of terrains that are added to the list.

public void update(Player player){
    if(player.hasChangedTerrainPosition()){
        toRenderList.clear();
        for(int x = player.getTerrainPosition()[0]-NUMBER_CHUNKS;
            x == player.getTerrainPosition()[0]+NUMBER_CHUNKS; x++){
            for(int y = player.getTerrainPosition()[1]-NUMBER_CHUNKS;
                y == player.getTerrainPosition()[1]+NUMBER_CHUNKS; y++){
                terrainList.add(terrains[x][y]);
                System.out.println("Terrain "+x+","+y+" added!");
            }
        }
    }
}

Just to clarify, the method player.getTerrainPosition returns a int[] with the current terrain coords in where the player is standing. The method player.hasChangedTerrainPosition returns true if the player has changed of  terrain.

The problem of this method is that for example if the player is in the position [0,0] it pops an error of ArrayIndexOutOfBounds because of a negative number.

I don't know if I've been specific. This is more basic Java than GamePrograming, but any help will be appreciated. Thanks!

sentences:
Offset a camera/render without changing perspective I need to offset a render so that the perspective / vanishing point doesn't change.  Or another way to look at it is that I need to adjust the vanishing point in my view so that instead of being at 0,0 xy it's where ever I want it to be.

Imagine a tall iPhone screen with some extruded 3d text at the top of the view.  You would see the bottom sides of the extrusion because the camera is below the object.  But now move the object to the bottom of the view.  Now you see the top sides of the extrusion because the camera is above the object.  Same if you move the camera instead of the object.  The vanishing point is at 0,0 in the window.

Now let's say I wanted to draw the 3d text as it would look at the top of the screen but I want to draw it at the bottom of the screen.  Forget about the cheat of rendering it to a texture and drawing that texture somewhere else.  How do I shift everything up or down without changing the perspective?  Is there an easy way?

In practice I only need to move the vanishing point up a little in my game.  Perspective is key to being able to play.  Basically when the ad banner is at the top of the screen the view is smaller height wise.  That moves the vanishing point down by half the size of the ad banner, and screws up the game play.

I'm using the standard camera look at matrix function and projection matrix function that is based on the fov...

lookAtMatrix(cameraPos, camLookAt, camUpVector, mView);
matrixPerspective(cameraFOV, near, far,  aspect, mProjection);

I'm assuming that I need to change my mProjection somehow.

sentences:
Need some advice regarding collision detection with the sprite changing its width and height So I'm messing around with collision detection in my tile-based game and everything works fine and dandy using this method. However, now I am trying to implement sprite sheets so my character can have a walking and jumping animation.

For one, I'd like to to be able to have each frame of variable size, I think. I want collision detection to be accurate and during a jumping animation the sprite's height will be shorter (because of the calves meeting the hamstrings). Again, this also works fine at the moment. I can get the character to animate properly each frame and cycle through animations.

The problems arise when the width and height of the character change. Often times its position will be corrected by the collision detection system and the character will be rubber-banded to random parts of the map or even go outside the map bounds. For some reason with the linked collision detection algorithm, when the width or height of the sprite is changed on the fly, the entire algorithm breaks down.

The solution I found so far is to have a single width and height of the sprite that remains constant, and only adjust the source rectangle for drawing. However, I'm not sure exactly what to set as the sprite's constant bounding box because it varies so much with the different animations.

So now I'm not sure what to do. I'm toying with the idea of pixel-perfect collision detection but I'm not sure if it would really be worth it. Does anyone know how Braid does their collision detection? My game is also a 2D sidescroller and I was quite impressed with how it was handled in that game.

Thanks for reading.

sentences:
Central renderer for a given scene When creating a central rendering system for all game objects in a given scene I am trying to work out the best way to go about passing the scene to the render system to be rendered.

If I have a scene managed by an arbitrary structure, i.e., an octree, bsp trees, quad-tree, kd tree, etc. What is the best way to pass this to the render system?

The obvious problem is that if simply given the root node of the structure, the render system would require an intrinsic knowledge of the structure in order to traverse the structure.

My solution to this is to clip all objects outside the frustum in the scene manager and then create a list of the objects which are left and pass this simple list to the render system, be it an array, a vector, a linked list, etc. (This would be a structure required by the render system as a means to know which objects should be rendered). The list would of course attempt to minimise OpenGL state changes by grouping objects that require the same rendering operations to be performed on them.

I have been thinking a lot about this and started searching various terms on here and followed any additional information/links but I have not really found a definitive answer. The case may be that there is no definitive answer but I would appreciate some advice and tips.

My question is, is this a reasonable solution to the problem? Are there any improvements that I could make? Are there any caveats I should know about?

Side question: Am I right in assuming that octrees, bsp trees, etc are all forms of BVH?

sentences:
Collision intepenetration and objects getting stuck (Unity) I am having what is probably a newbie problem with Unity, but for the life of me, I can't find a decent solution to it. In short: my rigid bodies collide, but sometimes, they interpenetrate and stay stuck.

I am looking for a solution that would either
1- stop the interpenetration from even happening
2- or at least eject the bodies to 'unstuck' the collision.

By making the physics fixed step 0.01 instead of the default 0.02, I can avoid some of the interpenetration. However, that hardly sound like the proper way to fix this problem.

Here is a screen shot of the bodies colliding. The car on the right is shown completely and you can notice that the ones behind have penetrated the others to some extent.

To give more information that could be relevant:

There is no gravity
All the objects have rigid bodies
Their sizes are 3.5 x 6.8 and they are moving at 8 to 50 m/s
Each object has a conpounded collider made up of 3 box colliders
If I change the fixed step to 0.01 there is a lot less more interpenetration (as I mentioned). Other physics settings do not seem to have any effect
The object is moved by setting its velocity in the FixedUpdate function with rigidbody.velocity = XYZ until there is a collision, then there is no more processing done in FixedUpdate at all. I detect the collision with OnCollisionEnter and set a flag.
I haven't set any collision material, but I can't see that being a factor?

Solved

Thanks to everyone who helped me with the issue.

There were a few factors in play. First, there was the scale. What I did to figure this one is create an empty scene and put 2 cubes in there. I varied the size and position of the cubes (from 68x35 to 0.65x0.35 for size and the position by factors or 10 as well) and attached a script to move them, with variation in speed by factors or 10 as well. So all else being equal (same size on the screen and time to cross it), the size of the objects elected a different response to collision: big object got interpenetration, small ones none. I am not familiar enough with Unity to explain the cause of that, but it is reproductible.

A possible second factor was the shape of my colliders and how it may be possible that they screwed up the ejecting part. The colliders I had were not overlapping, so I simplified them to 2 boxes in the shape of a cross.

Finally I was setting the position of the objects manually in FixedUpdate and that caused some problems with interpenetration at lower scale (at higher scale, it didn't appear to matter). I changed that to work with the body velocity and it helped.

sentences:
Raycast check for Collisions across XZ coords without Y rotations / Unity C# I'm really new to Unity/C# (I have a bit of experience in GML but far from professional) and I am currently building out my first prototype.
I originally copied THIS script to get a cube that rotates face-to-face along one of its bottom edges.
Currently, the state of the game is the cube "rolling" around on a 10x10 grid. The grid currently has a border of walls. I want the cube to shoot a rayCast in the direction the cube is moving towards, check if there is a wall, and decide whether the cube can move in that direction.
This is the way I had it set up previously:
Vector3 up = new Vector3(0, 0, 0.5f);
Vector3 right = new Vector3(.5f, 0, 0);
Vector3 down = new Vector3(0, 0, -0.5f);
Vector3 left = new Vector3(-.5f, 0, 0);
Vector3 currentDirection = Vector3.zero;

bool Valid()
{
    Ray myRay = new Ray(transform.position + currentDirection, transform.forward);
    RaycastHit hit;

    Debug.DrawRay(myRay.origin, myRay.direction, Color.red);
    if (Physics.Raycast(myRay, out hit, rayLength))
    {
        if (hit.collider.tag == "Wall")
        {
            return false;
        }
    }
    return true;
}

currentDirection is set to when movement keys "WASD" are pressed. I know one issue that I am running into is that transform.forward does not work because the Y-rotation of my cube never changes.
Gif format not supported so heres a link showcasing the problem:
Movement & Clipping: https://i.imgur.com/XxlEx1G.gifv
Overall, I was wondering how to get the raycast to shoot in the appropriate direction based on movement.
Sorry if the answer is incredibly easy and I'm just missing it.
Thanks for the help,
Kalfin

sentences:
UDK : Problem with Touching Actors In my game I am trying to see all touching actors of a particular DynamicSMActor and it does return only two Actors as touching Actors - Water Volume and Player Pawn. It is ignoring all the other DynamicSMActors that are touching. I actually tried different values for collision type, Blocking type, etc,. No success.

Any help is really appreciated.

sentences: Is there a way to start UI animation transition with code in unity? I have made an animation for a button in unity's UI prefab, but i want it to start only at certain times, when i command it with code. How can i do this?

sentences:
ScreenToWorldPoint problems in otherwise awesome Unity demo I am using this neat Unity demo I found on Stack Overflow, which demonstrates texture masking via RenderTexture:

Can you erase a texture in real time in Unity

But the mapping from mouse position to world space is wrong. This is the script that does the mapping:

using UnityEngine;
using System.Collections;

public class MaskCamera : MonoBehaviour
{
    public Material EraserMaterial;
    private bool firstFrame;
    private Vector2? newHolePosition;

    private void CutHole(Vector2 imageSize, Vector2 imageLocalPosition)
    {
        Rect textureRect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
        Rect positionRect = new Rect(
            (imageLocalPosition.x - 0.5f * EraserMaterial.mainTexture.width) / imageSize.x,
            (imageLocalPosition.y - 0.5f * EraserMaterial.mainTexture.height) / imageSize.y,
            EraserMaterial.mainTexture.width / imageSize.x,
            EraserMaterial.mainTexture.height / imageSize.y
        );
        GL.PushMatrix();
        GL.LoadOrtho();
        for (int i = 0; i < EraserMaterial.passCount; i++)
        {
            EraserMaterial.SetPass(i);
            GL.Begin(GL.QUADS);
            GL.Color(Color.white);
            GL.TexCoord2(textureRect.xMin, textureRect.yMax);
            GL.Vertex3(positionRect.xMin, positionRect.yMax, 0.0f);
            GL.TexCoord2(textureRect.xMax, textureRect.yMax);
            GL.Vertex3(positionRect.xMax, positionRect.yMax, 0.0f);
            GL.TexCoord2(textureRect.xMax, textureRect.yMin);
            GL.Vertex3(positionRect.xMax, positionRect.yMin, 0.0f);
            GL.TexCoord2(textureRect.xMin, textureRect.yMin);
            GL.Vertex3(positionRect.xMin, positionRect.yMin, 0.0f);
            GL.End();
        }
        GL.PopMatrix();
    }

    public void Start()
    {
        firstFrame = true;
    }

    public void Update()
    {
        newHolePosition = null;
        if (Input.GetMouseButton(0))
        {
            Vector2 v = camera.ScreenToWorldPoint(Input.mousePosition);
            Rect worldRect = new Rect(-8.0f, -6.0f, 16.0f, 12.0f);
            if (worldRect.Contains(v))
                newHolePosition = new Vector2(1600 * (v.x - worldRect.xMin) / worldRect.width, 1200 * (v.y - worldRect.yMin) / worldRect.height);
        }
    }

    public void OnPostRender()
    {
        if (firstFrame)
        {
            firstFrame = false;
            GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
        }
        if (newHolePosition != null)
            CutHole(new Vector2(1600.0f, 1200.0f), newHolePosition.Value);
    }
}

I fixed line 49 and 50 like so:

Vector2 v = GetComponent<Camera>().ScreenToWorldPoint(Input.mousePosition);
Rect worldRect = new Rect(0.0f, 0.0f, 16.0f, 12.0f);

So the script compiles and the worldRect is in the right place now. Through debugging I found that the world coordinates returned on line 49 are off. I also tried setting the z value of mousePosition to 10, even though the cameras are orthographic, like so:

Vector3 mousePos = Input.mousePosition;
mousePos.z = 10;
Vector2 v = GetComponent<Camera>().ScreenToWorldPoint(mousePos);

The mapping from the mouse to worldspace is still wrong though. Mouse coordinates within a small rectangle near the center are mapping to the full width and height of the image in world space.

sentences:
Search app store for similar games on pc I want to search the app store for similar games so I can see how much competition there will be for any apps I am thinking of designing.

Knowing how many clones/similar games there are plus there prices and success rate would go a long way in deciding which ideas to take forward.

Is there anyway to do this easily on a pc (I do not have an iPhone)

sentences: what is best iap unitypackage (Asset) for support google play+ amazon in unity 2019.1.9? I need a unitypackage easy and easy for In app purchasing in googleplay and amazon (for Android) Which unitypackage is best in unity 2019.1.9?

sentences:
When doing network programming, is it always a good idea to optimize packet size as much as possible? My question is relatively straightforward, but I haven't been able to find a concrete answer yet.

I'm programming a real-time networked multiplayer game, and I'm finding many examples of places where I could optimize packet size (i.e. minimize packet size) in small ways. As an example, one packet type stores player input (running, jumping, firing a weapon, etc.) along with an integer ID for that player. In practice, there will never be more than four players in a single game, meaning that ID could be represented with only two bits (four possible values) rather than the full 4-byte integer.

My question is, should I send only those two bits across in a network message or just send the full integer?

To clarify, I'm not referring to storing the ID in the main code itself. For that, I'm just using an int. I'm only curious about what I should be sending in a network packet. That's also just one example of a few I've run into.

The reason I ask is that this feels like a "don't prematurely optimize" scenario. Ordinarily, I know to not worry about optimization (within reason) until I've run profilers, but I'm less familiar with networking than "normal" programming. Is it better to optimize packet size as much as possible, or would that be overkill?

Thank you.

sentences:
OpenGL Depth Buffer/Coordinate issue with SFML For some reason, my coordinate system in OpenGL is getting all messed up with depth.  When I put something more than 1 unit away from zero (in terms of the Z coordinate), I can't see the object.  Furthermore, it seems as if the GL coordinate (-1, -1, 0) is in the lower left corner no matter what I do (and (1, 1, 0) is upper right).  I've used OpenGL in Java and in C++ with GLUT before and am now trying out SFML, and haven't had these issues before, so maybe someone can tell me what I'm doing wrong?

A minimal example as best I can do:

#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

#include <iostream>

int main()
{
    sf::ContextSettings settings;
    sf::RenderWindow window(sf::VideoMode(800, 600), "OpenGL Test", sf::Style::Default, sf::ContextSettings(24));

    settings = window.getSettings();

    std::cout << "depth bits:" << settings.depthBits << std::endl;
    std::cout << "stencil bits:" << settings.stencilBits << std::endl;
    std::cout << "antialiasing level:" << settings.antialiasingLevel << std::endl;
    std::cout << "version:" << settings.majorVersion << "." << settings.minorVersion << std::endl;

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);    // Black Background
    glDepthRange(-1, 1000);

    // run the main loop
    bool running = true;
    while (running)
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                // end the program
                running = false;
            }
            else if (event.type == sf::Event::Resized)
            {
                // adjust the viewport when the window is resized
                glViewport(0, 0, event.size.width, event.size.height);
            }
        }
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glLoadIdentity();

        // Comment this line to fix it!!?
        glTranslatef(-1.5f,0.0f,-6.0f);

        glBegin(GL_TRIANGLES);                      // Drawing Using Triangles
            glVertex3f( 0.0f, 1.0f, 0.0f);              // Top
            glVertex3f(-1.0f,-1.0f, 0.0f);              // Bottom Left
            glVertex3f( 1.0f,-1.0f, 0.0f);              // Bottom Right
        glEnd();                            // Finished Drawing The Triangle

        window.display();
    }

    return 0;
}

Update:
The glDepthRange() call was to make sure that wasn't the source of the problem.  Also I added the following code to the initialization, and I haven't seen any change in behavior:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, 800, 600);

glMatrixMode(GL_MODELVIEW);
...

Also, I'm using the 2.0RC version of SFML, and my OpenGL version is 4.3 (running on an ATI card).

sentences:
Is it ok to use copyrighted assets for educational purposes? A friend and I were wanting to create a Pokemon battle simulator in our mobile development class as our final project but are worried whether or not it would be permissible under "Fair Use" for educational purposes. We have no plans on doing anything with the game after the class and our presentation of the app, we just wanted to try to clone some very basic parts of it onto Android.

Edit: I'm located in the US.

sentences:
Fps independent rotation I'm trying in my game to have camera rotation speed idependent of fps. For keyboard it works without problems but not for mouse movoment. At 60 fps it works good but at 200 for example rotation is to slow.

mouse_dif is difference since last frame in pixels. Maybe thats a problem too, bigger screen resolution will rotate faster then smaller.

My code:

const float rot_speed = u.GetRotationSpeed(); // returns 5.f
float val = 0;

if(allow_input == ALLOW_INPUT || allow_input == ALLOW_MOUSE)
    val += float(mouse_dif.x)/200;

if(val > rot_speed*dt)
    val = rot_speed*dt;
else if(val < -rot_speed*dt)
    val = -rot_speed*dt;
u.rot += val;

How can I make it fps independent?

sentences:
Fixed distance increments between two Vector3 positions I have two Vector3 positions:

 Vector3 start = new Vector3(1f, 1f, 1f);
 Vector3 target = new Vector3(5f, 5f, 5f);

How do I transform gameobjects a fixed amount from start to target, say .1f?

This is easily done with percentages, because you can do:

var dist = target - start;
 var d = 5f; // 5 increments
 var step = dist / d;

 while (start != target) {
     start += step;
 }

How do you do this with Fixed, not percentage steps. Say I want to increment .1f in some direction:

 var dist = target - start;
 var step = new Vector3(.1f, .1f, .1f); //How do I determine the direction of the increment?

 while (start != target) {
      start += step;
  }

Thanks

sentences:
Determining which line to collide with I am making a platformer, where my player is represented as a circle and the ground is represented as lines. The actual collision detection and resolving works, it's just an edge case I can't find a solution for.

I check on which line the hero is by using the normal, and if the hero's center is between these normals I know he is on that line. That works except for the case in the image above.
When he get's in the 'Problematic Area' the algorithm will not detect any collision.

So how do I know which line to pick for the collision when the hero get's in this area?

Here is some code that shows how I test collisions (which again works, but does not consider the problem I actually have).

playerPointer:Vector2D = New Vector2D(position.x - line.x1, position.y - line.y1)
lineNormal:Vector2D = line.vector.Copy()
lineNormal.LeftHandNormal()
playerOnNormal:Float = playerPointer.ProjectionOn(lineNormal)
playerOnLine:Float = playerPointer.ProjectionOn(line.vector)

#Do we have a collision between the circle and the infinite line
If Abs(playerOnNormal) <= radius

  #Get the direction vector of the line
  Local directionVector:= New Vector2D(line.x2 - line.x1, line.y2 - line.y1)

  #Is the player inside the normals boundaries
  If (playerOnLine <= directionVector.Length) And (playerOnLine >= 0)

sentences:
Is there a way to view all colliders in a unity project at runtime (after the game have been deployed)? I'm have created a small Unity project but physics has weird behavior (bug). Unfortunately it only happens on some specific hardware (after build), not on development machine.

I don't know what is the reason it's probably due to different framerate. Viewing all object and their colliders would probably help me a lot.

Is there a possibility in Unity to view all colliders in the game at run time (some kind of debug mode). Something similar as Game tab view in Unity with Gizmos option enabled, but for all objects ?

sentences:
Failed to load QCARWrapper.dll I am using unity 5.1.0f(64 bit) and  Vuforia SDK Version: vuforia-unity-5-0-5

The web cam is operating normally in windows but in unity in Play Mode not.

I am getting an error message
"failed to load QCARWrapper.dll: expected 64bit architecture..."

Can anybody help out solving this issue?

sentences:
The state that is synced when a window is broken in a FPS game In order to better understand how state syncing works in games, I wanted to pose a specific example. Say you are in a FPS game with multiple players and someone breaks a window in some building. Wondering what happens in terms of state syncing. For example, there are these aspects:

Someone else is watching the player break the window in the game. So it should probably be a real-time update.
Someone isn't watching but they hear the sound of the window breaking.
Someone is out of range of hearing or seeing the window break, so wondering if it still updates their game world, or it somehow lazily picks up the changes when they go to the area with the broken window.

Wondering how it generally works in these different scenarios. Any FPS game is fine. For example, in (1), if they are sending each individual particle of broken glass over the internet, or somehow they just send the generic action "user x threw object y at window z" and it replays the action on everyone's computer who is watching. In which case somehow the game world is broken up into macro chunks rather than being composed of particles. In (2), maybe they divide the level into zones of seeing and hearing range, and somehow send just the right amount of state then (wondering what kind of state, and how much). Then in (3), if it is lazily picked up, then what sort of queue is kept on the backend. If the data is compressed when it is sent, etc.

sentences:
How to fade in and out a game object with two child game objects I have been fading game objects in and out using the following code. Now I want to fade out a game object with two child game objects. How can I do this?

    IEnumerator FadeToForGO(Material material, float targetOpacity, float duration, GameObject gameObj, bool isEnabled) {

    // Cache the current color of the material, and its initiql opacity.
    Color color = material.color;
    float startOpacity = color.a;

    // Track how many seconds we've been fading.
    float t = 0;
    if (isEnabled) {
        gameObj.GetComponent<BoxCollider2D> ().enabled = isEnabled;

    }

    while(t < duration) {
        // Step the fade forward one frame.
        t += Time.deltaTime;
        // Turn the time into an interpolation factor between 0 and 1.
        float blend = Mathf.Clamp01(t / duration);

        // Blend to the corresponding opacity between start & target.
        color.a = Mathf.Lerp(startOpacity, targetOpacity, blend);

        // Apply the resulting color to the material.
        material.color = color;

        // Wait one frame, and repeat.
        yield return null;

    }

    if (!isEnabled) {
        gameObj.GetComponent<BoxCollider2D> ().enabled = isEnabled;

    }

}

sentences:
How can I fix the "fisheye" distortion in my raycast renderer? I've just started making a 'raycast' engine, a pseudo 3D FPS engine similar to Wolfenstein/Doom. I haven't done much reading so my implementation is likely very naive.

My current working prototype has a 'fisheye' distortion [2nd image] which makes sense because the middle of the wall is closer than the far edges, but this is not how Doom looks.

What's the right way to do this? an orthogonal projection seems wrong because you would lose the foreshortening.

sentences:
Set object rotation according to the outer vertex in unity I am able to get the outer vertices of a mesh using this and able to generate cubes on outer edges of the mesh. Here is my code:
  mesh = GetComponent<MeshFilter>().mesh;
        Stopwatch sp = new Stopwatch();
        sp.Start();
        Vector3[] vertices = mesh.vertices;
        List<EdgeHelpers.Edge> edges =  EdgeHelpers.GetEdges(mesh.triangles).FindBoundary();

        for (int i = 0; i < edges.Count; i++)
        {

            Vector3 v3 = vertices[edges[i].v1];
            GameObject go1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
            go1.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
            go1.transform.localPosition = transform.TransformPoint(v3);
            //go1.transform.localEulerAngles = transform.TransformDirection(v3);
            //go1.transform.rotation = this.transform.rotation;
           // go1.AddComponent<CubeMakerOnEmptySpaces>();
        }
        sp.Stop();
        UnityEngine.Debug.Log(sp.ElapsedMilliseconds / 1000);

Now I want to change the rotation of each cube that each cube z should be pointing against the mesh direction (should be outside of the mesh). Maybe picture representation helpful here

Need to be like this:

sentences:
Check if a 3D mesh is a rectangular prism I have a mesh post-processor in Unity that automatically a convex mesh collider to objects that need one (mostly all).

Sometimes however there are objects that only need a box collider instead.

How can I detect if a mesh is a rectangular prism?

sentences:
Bullet Physics: Applying a force at the point of collision Suppose I want to simulate some kind of gripper with two "fingers" (such as pair of pliers, or two-fingered robot hand), picking up an object from the ground. Both the gripper and the object are dynamic rigid bodies.

I want to start with the object roughly in the centre of the gripper, and then move the two fingers towards the object, to determine the point at which they make contact with the object's surface. Then, I want to apply a certain force from the fingers onto the object, before finally lifting the fingers (and hence the object) upwards.

Is there any simple way to achieve this just by treating the two fingers as two individual rigid bodies? I want to just move the fingers towards the object to find the point of collision -- so can I treat them as kinematic objects (with zero mass so they don't fall under gravity, which is what I want), and move them manually by slowly changing the pose of each finger over time? But how will I know at what point the fingers and object collide, so that I should stop moving the fingers and start applying a force?

Thank you!

sentences:
Add points to a prefab in Unity I have a prefab that looks like this:

I have created a couple of 'points' in the Hierarchy using 'Create Element' and I would like to attach them to the prefab, however drag and drop over doesn't work. Why is that?

sentences:
Splitting logic into threads in Java tower defence game I'm making a tower defence game in Java!
It's my first game development.
I want to know how many threads Do I need to create in a game, to split logic..
I've made this one:

Main App thread  (adds component thread - add(screen))

1.1.1 Thread (graphic updates)
1.1.2 Bullets physic
1.1.3 Mobs physic
1.1.4 Towers physic

Is it normal to split this logic?

sentences:
How to store data in a data-driven RPG Possible Duplicate:
  Would it be better to use XML/JSON/Text or a database to store game content?

I'm working on a 2D data-driven RPG. I intend for it to be modabble; my intention is to expose all the major game data (eg. monster stats, item stats, pet stats) through some interface to allow tweaking by end-users with a tool.

First, my basic assumption is that there will be a "lot" of data (perhaps on the order of magnitude of megabytes). I have a few requirements that I'm trying to figure out.

How to efficiently store and load the data. For example, a SQLite DB would be faster than reading text files on startup.
How to make it version-control friendly (text-files wins here).
How to maintain data integrity. If it's just a text-file, you can put invalid values in it.
If possible, I would like to allow users to make their own tools to crunch my data.

Since maintaining version-control friendly data is important, I think having one or more text files with data in it will win. I can probably try to get people to use my tools to edit the data, and put lots of integrity checks in the actual code (eg. if totalHealth < 0, throw).

Are there better approaches to achieve these four goals?

I would also like input on the file format (eg. YAML vs. XML vs. JSON vs. whatever)

sentences:
How can I orbit a camera about it's target point? I'm drawing a scene where the camera freely moves about the universe.  The camera class keeps track of the view (or look at) point, the position of the camera, and the up vector.  These vectors/points are then passed into gluLookAt.

Pan and zoom are nearly trivial to implement.  However, I'm finding rotation about the look at point to be much more of an issue.  I want to write a function Camera.rotate that takes 2 angles, one that rotates up/down and one that rotates left/right along an imaginary sphere that is centered about the look at point.

Is there an easy way to do this?

I've (briefly) read about quaternions, but I wanted to see if there was an easier solution given the relatively simple construction of my scene.

sentences:
Health bar - calculating health bar's position from percentage I'm making a simple health bar in Unity 3D. Health bar UI is made from images. I'm having a problem with setting bar's position based on health percentage.
Here's a script part:

    percentHealth = (currentHealth / maxHealth) * 100; //get's health percentage.

    HealthBarHealth.transform.localPosition = new Vector3(healthBarCurrentX, 0); //moves health bar

I want healthBarCurrentX to be calculated from these values:

percentHealth - percentage calculated from max health and current.
healthBarMaxX = 0f - health bar's position at 100% health.
healthBarMinX = -273.5f - bar's position at 0% health.

So when health is 50%, currentX is at -136.65, etc.

sentences:
Libgdx: How to draw the score on the top left? I want to keep the score visible on the top left corner of the screen. I have the score talking care of. I just want to display it.

Score: x

The comment on the accepted answer on Stackoverflow suggests that BitmapFontCache is the best way to do it, inside the render method.

BitmapFontCache.draw() doesn't accept strings, so I cannot pass
Score:
BitmapFontCache.draw(batch, x, Align.topLeft); doesn't work either.
Do I have to keep updating the score position?

EDIT

  game.batch.begin();
        cache.setText("Score: " + score, 500,500);
        cache.draw(game.batch);

.........

or even if I placed it outside batch.begin, if I place it directly in, I get

E/AndroidRuntime: FATAL EXCEPTION: GLThread 172645
                  Process: com.mygdx.game, PID: 16727
                  java.lang.NullPointerException: Attempt to invoke virtual method 'com.badlogic.gdx.graphics.g2d.GlyphLayout com.badlogic.gdx.graphics.g2d.BitmapFontCache.setText(java.lang.CharSequence, float, float)' on a null object reference
                      at com.mygdx.game.GameScreen.render(GameScreen.java:129)
                      at com.badlogic.gdx.Game.render(Game.java:46)
                      at com.mygdx.game.Gam.render(Gam.java:20)
                      at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:459)
                      at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1647)
                      at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1352)
E/AndroidGraphics: waiting for pause synchronization took too long; assuming deadlock and killing

Even if I remove score variable and put everything outside batch.begin but inside render I keep getting the same error.

 public void render(float delta) {
        cache.setText("Score: " + 12, 500,500);
        cache.draw(game.batch);

sentences: Quaternion.AngleAxis smallest value? If I'm using an angle with a value of somewhat below 0.1 degrees in Quaternion.AngleAxis, the quaternion will not apply a rotation at all. Why is this?

sentences:
Calculating wall angle and sliding in 2D Got a new project recently where I don't use any physics engine, but it requires some basic phyiscs. Basically it's a 2d "top-down" game type. I would like to add a smooth wall collision which feels better than those "jumping" ones. So here is how bad it looks like, I easily calulated the collision point in this way:

Added the velocity to the player's position.
Checked whether the new position is in the wall or not.
Went backwards at that vector where it "came from" until reached the first non-colliding position.

Now that I have the blue position, I would like to modify the player's vector's angle with that purple angle (I guess). Because I want the next thing to happen when the player reaches that position:

The player gets the wall's angle and walks next to it (of course only if the player still presses the key to move upwards) like in most AAA 3D games. For example TESV:Skyrim. If you are moving toward a wall or an object in a non 90° angle, then the player keeps moving but next to the wall/object.

I have already searched for solutions on Google and here aswell, but none of them fit my needs.
Would appreciate any help. Thanks!

EDIT:

Green Line: Wall (Top one, the bottom one just for help)
Purple Point: Player old position
Blue Point: Player new position (next to the wall)
Red Line: Vector between new and old position

EDIT 2:
Can't get it to work properly, at the edges of the walls the calculations fail. The player keeps teleporting, at the program freezes sometimes. (due the while cycles which are checking for the edges)

sentences: Is there a plugin to integrate Face FX with Blender? Is there a plugin to integrate Face FX with Blender? I only see plugins for Maya, Max, SoftImage, and MotionBuilder on the Face FX website.

sentences:
Is replacing a struct field in a class generating garbage using C#? I am somewhat aware of the differences between classes and structs, when each is allocated on the heap vs the stack, what happens when calling methods etc.

As far as I know, the memory for a struct field in a class is located on the heap, since it is part of the class. What happens when the struct is replaced with a new instance though? Is the content in the area on the heap that the old instance pointed to simply replaced with the content of the new instance? Or is the memory of the old instance targetted for garbage collection and the new instance getting some fresh memory?

struct Vector2 { ... }
class Player
{
     public Vector2 Position;
     ...
}

void Main // Whatever
{
    var player = new Player();
    player.Position = new Vector2(); // <--- Will this cause garbage collection?
}

sentences: SDL 1.3 on Windows 7. Better hardware,lower FPS I've just moved from one PC to another.I've been developing a game in SDL with SDL_image and SDL_ttf for about one year. On my old pc, I had about 90 FPS on my game, but now I have about 30, witch I find very strange. My Question is: Why do my FPS dropped from 90 when I used an inferior PC (on windows xp) to 30 when I have a way better PC (on windows 7).

sentences:
A trigger collider in Unity doesn't allow the player to pass through It's my understanding that checking "Is Trigger" on a collider should allow rigid bodies to pass through without collision prevention, but my trigger isn't doing that consistently.  The player cannot pass through, but other objects can.

The trigger is a cube primitive with "mesh rendered" unchecked so that the cube won't be visible.  The cube has a box collider with "is trigger" checked, and also a script.  The script currently doesn't do anything except output from Debug.Log in OnTriggerEnter() as a test.

Primitives are able to pass through.  The test is just a basic Unity sphere with all the default settings, including a sphere collider.  The only change was that I added a RigidBody.

Imported models also pass through.  I have a simple .blend model with a rigid body and box collider.

The player does not pass through.  The main difference between the player's object and the other imported model is that the player is using a custom mesh collider which is different than the player's rendered mesh.  The rendered mesh is the game object and the low-poly collision mesh is a child of that object.

I've tried several variations, including switching the player from a mesh collider to a box collider, and also moving the box collider to the main mesh rather than a child mesh, but the results are the same.  The player stops moving as soon as he hits the location of the trigger's box collider.

Any ideas are appreciated.  Thanks in advance.

MORE INFO:

Here's a screenshot of the scene layout, with the invisible trigger collider selected.

Also pictured is the hierarchy showing that the trigger collider ("Jump Pad Trigger") has no children.  On the right is displayed every component that the trigger object has.  I've also moved the collider from its original location several times to prove that it's not another object in the scene that the player is colliding with.

sentences:
Do I have to use vertexArray in opengl GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);

As you can see from the above code, some tutorials use this before using opengl. But a tutorial that I am following, directly uses glGenBuffers  method and it works just fine. Hence I am totally confused what glGenVertexArrays. It is sad that it defines how buffer is used, but noone says in what way. Can you help me understand ?

sentences:
Difference between rotation methods? My question is in about rotate methods in android.graphics.Camera. In Docs, I saw these comments:

  public void rotateX (float deg) Since: API Level 1
  Applies a rotation
  transform around the X axis.

  public void rotate (float x, float y, float z) Since: API Level 12
  Applies a rotation transform around all three axis.

There is my question:What is difference between using rotate (float x, float y, float z) and a sequence of rotate methods? For example what's the difference between these two snippets A and B?

A)

camera.rotate (x, y, z);

B)

camera.rotateX (x);
camera.rotateY (y);
camera.rotateZ (z);

sentences: What legalese is required in a game installer? So I've seen a lot of installers, and on almost (if not every one, I don't keep track), all of them, there is a EULA, and specific items that are seen on all installers. However, I'm going to be making my own installer for a game, and I'm wondering if there's certain things that need to be included. Do I need a License Agreement? Should I have a license agreement? Etc.

sentences:
Binding the camera to the body of the skeleton It is necessary to design: "Only the body of the skeleton rotates with the camera"

Problem above

I'm not advanced. My hunch: Programming CapsuleComponent.h - inherit skeleton components. I could be wrong. Please help me find the right solution to the problem!

sentences:
How to calculate direction from initial point and another point? I'm making a simple game where I shoot things from a certain point on screen (A).

I tap the screen and shoot the projectile from initial point(A) to the tap point(B).

But I want the projectile to move along the same path instead and fly out of bounds of the screen.

How do I calculate a point that is on the same line that these two points, but further away?

This is a simple math, but I can't figure it out.

sentences:
How hard is it to edit an xml based database in a Unity3D game? I want to make an item database in xml for my game.

I was thinking about encrypting it, but I don't know how hard is it to edit the database.

I want my database to be moddable, but hard to screw up for average users.

(~I don't want kids to make the game unplayable, then unable to fix it)

Should I encrypt the database? Or will it just annoy the "modders", while the average players wouldn't find the database even when it isn't encrypted?

TL;DR How hard is it to get a raw xml file from a standalone build?

sentences:
Basic game loop, what does Update() and HandleInput() mean to you? I have been developing a game and until now I have been handling input like so:

Player presses a key
HandleInput() acknowledges a key is pressed calls a function within the Player class which increments the Players position by a pre-determined amount.
Update() sets the players sprite to be at the players position.
Draw() renders the players sprite.
Return to Step 1.

Now my question is this, should I continue to run my loop in this way or should I implement the following:

HandleInput() sets a state within the Player class which when Update() is called the Player object checks if it is in a state of motion and updates its location appropriately, before updating the sprite to its new location.

This question arose within me while I was altering my loop so that only the Update() function had a maximum refresh rate (60 cycles per second) and I realized I was unsure how I should appropriately communicate events to the objects on how they should act.

I did not include any code as we're discussing in pseudo-code if you feel some is required let me know.

sentences:
Effects for Programmers Does anyone have any good resources for creating special effects, aimed at programmers.
I'm not specifically interested in particle effects, but broader things like:

Fullscreen effects, blur, depth of field, damage
Explosions, shockwaves
Weapons, lasers, projectile
Environment - light "glows" and beams, water, bubbles, dust etc

I'm interested in these things from a technical perspective rather than an artistic one.

EDIT:
To clarify, I'm not interested in the low level details like "a method for doing depth peeling on SPUs" or "fast particle rendering with vertex textures", I'm interested in how people have combined various techniques into a recipe to show a special effect for the game.

For example - when rendering a "space" explosion:

Draw opaque bright sphere at center.
Draw alpha'd shockwave around a random axis.
Expand sphere and decrease alpha.
Expand shockwave and rotate UVs.
Spawn particles showering randomly from center.
Wobble camera when shockwave reaches viewer position.

sentences:
Are ambient, diffuse and specular light or material properties? Are ambient, diffuse and specular properties of light or material?

I am doing ray casting in OpenGL, I've managed to create lit sphere using formula

I = L Ka + L Kd (n . l) + L Ks (r . v)^n

but I entered values manually, now I'd like to create objects for light and sphere, but I don't know which of these properties (Ka-ambient, Kd-diffuse, Ks-specular) should be within the light object and which within the material (sphere) object

sentences:
Implementing multithreaded loading screens Ok, I have fairly little multi-threading experience, but i have done a similar thing before without issue...but this has me stumped.

This is in C++, Directx9 Visual Studio...

My game basically runs in one thread, apart from loading screens. When I want to load a new game, I fire up a new thread which goes through and does all of the simulation and asset loading stuff. Meanwhile, the original (base) thread displays an animated loading screen.
Once the loading is finished, the loading thread sets a flag in tjhe loading screen saying it's done, and during the loading screens Draw() it spots the flag, ends the 'loading' thread, and starts the main game.

All of this works perfectly, in debug and release.

Except fullscreen...

For some reason, if I run the game in fullscreen mode, it goes wrong. The game hangs at the end of loading, and it looks like the flag in the loading screen is never getting set. if I force a debug break into the base thread, it seems to always be inside the D3D flip().

I can't see what I'm doing wrong. The loading thread does zero rendering. It creates some directx assets but never uses them. The flag I'm using to communicate between threads is a simple int, and it's read/write should thus be atomic.
I've done a very similar thing in my previous games with no problems, but this has me stumped. Should I really be using CriticalSections etc for something this simple?
Help!

sentences:
How do I set the gravity of a plane world As you can see in the image, the character is set to move on a ground plane, however that causes an issue with Box2d's gravitational pull.
The player can go sideways, upwards and downwards on the plane.
Is there any way I can use gravity in this case?

sentences:
Basic DirectX app creates whistle noise I'm in the process of learning DirectX and in the book examples they have a very basic application which sets up DirectX and displays a blank screen. When I run this app however my computer starts making a whistling noise and I'm really curious as to why it does this.

If I maximize the screen the noise stops and this is the only time the noise happens. When I play normal games, run apps in XNA or do anything that doesn't involve directly using DirectX it doesn't happen.

The FPS is going up to 3000-4000 when the app is running and drops down to 1000 when the window is made to stretch the screen (and the noise stops). I'm taking a guess and saying it's something to do with that?

Anyway, does anyone have any ideas on what is creating this noise?

Thanks

sentences:
How to debug Android App Eclipse? Ok. So while this isnt a programming question. I wanted to know how do people debug apps? How do you view log cat, and where these exceptions are thrown etc? And do I need to run the app on the emulator to see all the stuff, or is there a way to view this after running the app on my phone(while not being connected to the computer)

Links to plugins and tips would be really helpful, as im gonna start work on my next game, and while the first one works fine, had a lot of problems while debugging.

sentences:
How do I put a game on miniclip or addinctinggames? I finished making a java game recently, and I would like to put it on a website such as Miniclip.com or AddictingGames. How would I do this?

I have one more question. I know these sites could run Flash games, but what about Java games? If they can't, is there any other website analogous to those that would?

My reason for this is that I am planning on launching this game on Android, and I would like to get some feedback for this game and have some people be familiar with the game before it launches.

sentences:
Simple collision detection for 2D match 3 gems game I'm building simple match 3 game.
I have the parts where I move the gems with the mouse only in the straight X or straight Y, up and down and both sides, no 45 degrees movements on grid.
I'm looking for simple collision detection algorithm for the situation when for example:

a gem is moved up or down or left or right and there is another gem.
How can it detect it touched a gem and which gem it is?

sentences:
manipulate textures in real time using GPU I'm looking for some way (tutorial, library or build in option) to draw texture on JMonkey in real time. So I have 2 images one a normal texture that is fairly big(4000x4000) and another much smaller texture (100x100) the second texture is white(or we can set alpha high) with something drawn on it (say a tree) now I would like said drawing (tree) to be drawn on the bigger texture in such a way that it does not massively slow down the system and that it easily ignores the unused pixels.

I already know I can use a for loop to change each value of a texture but that is a CPU computation I would much rather, if possible, offload this to the GPU.

sentences: My lighting stays the same when I go indoors? My problem can be seen here notice how the shadows don't change intensity or color when moving indoors to the cave. The only thing that changes is the highlights when I move under the directional light. I was thinking about adding global illumination but I don't think that would work with a toon shader. How can I get my lighting to become darker once I enter indoors e.g a cave. Thanks!

sentences:
How do I make hit damage a Gaussian distribution centered around a value? I'd like my character's attacks to on average 10 damage, but to vary anywhere from 0 to 20.

Instead of a linear spread, I would like a normal distribution, so most of their hits are between 10-15, but they can still hit between 0-20. How can I do this?

I am using PHP.

sentences:
Should I use one thread per game object? I developing a simple real-time strategy game in a small team with no experience, and we're considering using one thread per game object (tank, soldier, etc). Is this a good idea or is it overkill?

The thread would call each object on each instant change (game timer, not graphic engine timer)

We're using Python with the Panda3D engine, meaning the GIL is probably going to reduce a lot the possible speed improvements.

sentences:
Get shape of my bodies using Box2D I would like to get the shapes of my bodies, but I can't get anything, only null. Why?
Here is the relevant code section:

Body b;
while((b = box2d.physics.PhysicsWorld.world.getBodyList().getNext()) !=null) {
  Shape shape;
  while((shape = b.getShapeList().getNext()) != null) {

    Log.e("name",""+b.getUserData().toString()+" "+shape+" ");

    opengl.saveMatrix();
    Meshes.select(b.getUserData().toString())
              .translate((b.getPosition().x)*RATIO, (b.getPosition().y)*RATIO)
              .rotate((int) ((int) b.getAngle() * (180 / Math.PI)), 0, 0, 1)
              .draw(shape, 1, 1, 1);

    opengl.loadMatrix();

  }
}

shape = b.getShapeList().getNext() always returns null, and the log entry never ran.

sentences:
How can I keep track of which "rooms" characters and NPCs are in? I have a Unity 2D project which has a player character and numerous NPCs all potentially moving (top-down) at the same time during play. The number of NPCs is not to exceed 100 (and will be, probably, more like 40-50) but I'd still like to be performant.

The "rooms" are really just rectangles that correspond to sections of my tilemap. All the "rooms" are contiguous, and hence all characters will always be in exactly 1 "room". Like if you picture the floorplan of a house, you're in the "Hallway" or the "Living Room" or the "Front Porch" or the "Driveway", and so on.

My tilemap is not complete, so it would be nice to be able to easily move the rooms around in the Scene editor as I refine it.

I was thinking I could...

Create Rect objects (or maybe an AABE, although I just read very briefly about what this even is) for each room inside a "RoomsController" GameObject, and then on each Update() iterate through each and see who is within the bounds of each room. But that seems majorly wasteful, and pretty brute-force even if done every few frames.
Create a GameObject for each room with an appropriately-sized BoxCollider 2D, and look for collisions with NPCs, and have a script that handles changing the active room on the NPC when he "collides" with a new room. But this requires a RigidBody 2D for each room, and it feels like overkill.

Is there an existing "right way" to solve this problem?

sentences:
Unity - custom Export and Import FBX Data I am trying to write custom data inside a FBX file from 3dsmax at export time. This might be possible even if I don't know right now how to do that.
But my question would be how can I read those custom FBX data inside Unity on import.

Thanks a lot.

sentences:
Change flag if mousepress while on loop I have this program that starts a loop when the key is pressed

The problem is that when i start the loop, i want to be able to stop it halfway with my mousepress.

The problem is that it doesn't register my mousepress until my loop is done.

How do I stop it halfway if the mouse was pressed in my loop? I tried  a flag, if(mousePressed) but the flag doesnt change until the loop is done

sentences:
How can we view 3d objects from top down view in TD game I am making a tower defense game. I am working in x and y axis only. I have made a grid, snapped towers and made a pathfinding algo to run enemy. Initially I have worked with cubes and spheres in place of towers and enemies.

Now I am going to place real towers (3D). Note that I haven't used z axis up till now. The user will analyze the game from top down view.

I want the user to see towers placement with a little bit of 3d view but I have made my all code in 2d thing. Is there any solution to my problem that somewhat tower placement would view a 3D touch or you can say 2.5D ?? (like fieldrunners) or should I have to involve z axis and ignoring y axis ?

sentences:
LibGDX Tiled Map - how to get embedded objects I am using LibGDX to learn Game Development. I have reached the phase I am learning to use Tiled Maps.

In Tiled map editor, there is a feature where we can pick a tile in the tile set, go to View -> Tile Collision Editor, and add shape objects to a tile.

I can see that the shapes are saved in the tmx file and associated to the tile.

For testing purpose, I have also made the tile animated (similar option is available under view menu) and the OrthogonalTiledMapRendered automatically animated it (so this information is being accessed somehow).

I wanted to find out if there is anyway to retrieve other information embedded at tile level like the embedded shapes and objects.

Here is the sample xml from the tmx file.

<tile id="7">
    <properties>
        <property name="customProp1" value="customValue1"/>
    </properties>
    <image width="16" height="16" source="black_hole_swallow_4.png"/>
    <objectgroup draworder="index">
        <object id="0" x="0.25" y="0">
            <polyline points="0,0 15.625,-0.25"/>
        </object>
    </objectgroup>
    <animation>
        <frame tileid="5" duration="300"/>
        <frame tileid="7" duration="200"/>
    </animation>
</tile>

sentences:
Android development in Unreal with an existing project I am currently using an Unreal 3 project that has been targeted for multiple devices.  Originally, it was targeted for iOS and now I want to try and build it for Android. The project is capable of doing it and I am in the process of testing it.

I think I have everything I need in order to build it and launch it for an android device that I have set up and connected to my PC and is recognized by the Android SDK ABD. I am currently trying to build and launch the game through the Unreal Frontend but when I try, I am getting stuck at getting the Unreal Frontend to find my Android device as a platform to debug, like it would with a PC, Xbox360, or PS3.

Right now, I am just trying to launch the game to see if I can get it to simply run on an Android device, I'm going to worry about the packaging later.

So I have two questions:

Am I on the right track in looking at the Unreal Frontend to cook and launch the project on Android or should I look somewhere else?

How do I get Unreal to recognize my Android device as a platform to launch on?  I would even settle for recognizing an emulator, but that seems even harder.

sentences:
When an object is launched off-screen, is there any way to know if it's coming back? In this scene, the object becomes invisible and then comes back

In this scene, the object becomes invisible but does not come back

Is there any way I can tell if an object will come back when it becomes invisible?
Edit:
Thank you to S. Tarık Çetin for the solution
     private void Update()
     {
         if (isInvisible)
             if (IsNotComingBack())
                 OnInvisible?.Invoke();
     }

     private void OnBecameInvisible()
     {
         isInvisible = true;
     }

     private bool IsNotComingBack()
     {
         var pos = _cam.WorldToViewportPoint(_rb.position);
         var extents = _cam.WorldToViewportPoint(_spriteRenderer.sprite.bounds.extents);
         var isNotComingBack = pos.x + extents.x < 1 || pos.x - extents.x > 0;
         return isNotComingBack;
     }

sentences:
How can I make the background of my game move following my player? I'm starting with Libgdx and I would like to make my ParallaxBackground move following my player. I am using a TiledMap along with Scene2d, and have the camera follow the sprite of my player. I'm basing my ParallaxBackground on the example of the following link:

Link here

Best regards

sentences:
How to get a good Force Feedback .dll Feedback for Steering Wheels? || How to access Force Feedback without a .dll? I want to implement a steering wheel with Force Feedback to my game and I encountered this problem:
I couldnt do it with performance.
I have found a .dll for that online, but it had issues like:

It was not performant
It made my steering wheel react too delayed

Otherwise I was not able to access the steering wheel.
Is it even possible to make a performant steering wheel and force feedback game  with good performance?
How else can I access force feedback ?

sentences:
Predictive Collision Detection - Find Time Of Impact I have a green box at a starting position A. It can move along two paths

A to B is linear motion
A to C is under the influence of gravity (non-linear)

The thin vertical line is a fixed colliding wall. All objects are represented with axis-aligned AABB bounding boxes.

For the path A to B, if my understanding is correct, I (think I) can determine the time of impact (T0) on the wall based on swept-AABB collision techniques. this case simply reduces to motion along x-axis, and time of impact can be calculated easily.

My question is for path A to C. Under the influence of gravity how can I determine the time of impact (T1) relative to the starting time T at location A. (The motion of A to C can be predicted using the standard equations of motion)

Are there any techniques/algorithms available for this?

EDIT To clarify the vertical wall is illustrative - walls can be arbitrarily vertical or horizontal or both (like a corner). They will be stationary, and axis aligned though.

sentences: If someone is using JNI then are they are true user of NDK (c++)? As someone involved in the hiring of engineers that must have experience using NDK (I work for Unity and support the VR/graphics groups), I see quite a few resumes of people who claim to be using NDK and c++ but at the same time reference the use of JNI.  I thought JNI basically made it possible to use NDK using java without using c++.  Any thoughts?  ( I know I am a recruiter but I am not using stack overflow to recruit, rather, better understand the very technologies I am working around every day.  I appreciate your help in advance )

sentences:
How can I repeat only a portion of an image in Javascript? So I'm trying to repeat a portion of my spritesheet as a background. So far, I have attempted this:

var canvas = $("#board")[0],
    ctx = canvas.getContext("2d"),
    sprite = new Image();
    sprite.src = "spritesheet.png";
sprite.onload = function(){
    ctx.fillStyle = ctx.createPattern(spriteBg, "repeat");
    ctx.fillRect(0, 25, 500, 500);
}

As you can see, it repeat the whole image, not just a part of it, and I just can't figure out how to do that last part.

sentences:
Video game entity storage and structures I finally have all the working input/output of a game engine.

However, I'd like to be able to put an amount of about 2000 shots being simulated in a region, total. I have done other games where all the data was stored in a linear array and iterated every turn, and referenced by index number.
This method seems to be fast enough, grants random access instantaneously and I'd say it "just works". However, inserting a new element requires searching for an empty space, and iterating over the "inactive" shots.

Considering the amount of max shots, what would be the best approach to this? Am I thinking too much about this, perhaps, and the array is a good enough system?

The engine works in C99. Shots will be destroyed when out of "practical" range and collisions will be done around the player rather than the entire working map. The game is real-time action style so updating needs to be quick, and shots might need to be accessed by position, which is another weakness of the array approach (unless I add that information to "slices" of the main map, I guess).

To summarize. What would be the best data structure in terms of insertion speed, allowing random access and iterating without gaps? A name, if it exists,  would be enough.

sentences:
How to I rotate a triangle by dragging the mouse in libGDX? More specifically, I have rotation working in a way I don't like as follows:

    //Draw the triangle using this draw method
    //batch.draw(texture, x,                            y,                                          originX,                 originY,                                        width,               height,      scaleX, scaleY, rotation, srcX, srcY, srcWidth,   srcHeight, flipX, flipY)
    batch.draw(triangle, 240 - triangle.getWidth() / 2, (float) (400 - triangle.getWidth() * .289), triangle.getWidth() / 2, (float) ((double) triangle.getWidth() * 0.288), triangle.getWidth(), triangle.getHeight(), 1, 1, rotate, 0, 0, triangle.getWidth(), triangle.getHeight(), false, false);

    batch.end();

    //Touch input
    if(Gdx.input.isTouched()){
        Vector3 touchpos = new Vector3();
        touchpos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
        camera.unproject(touchpos);
        rotate = touchpos.x;
    }

This rotates the triangle around the center of the triangle that is at the center of the screen (the 0.289 corresponds to the height of the middle of an equilateral triangle according to its side length).

The rotation will be equal to the touch position on the screen which works great when the finger is dragged. However, what this code does is moves the rotation to the specific location whenever I touch the window with the mouse. What I would like it to do is to rotate the triangle when the mouse is dragged, but only based on its previous rotation, not its absolute rotation. For example, if I click and drag the mouse from the left side of the window to the right, the triangle will rotate accordingly. When I lift the mouse then click and drag it the same way a second time, I don't want it to reset it's position to my 2nd click, I want it to move the amount I dragged my mouse from it's previous rotation.

Can anyone help with this? I've been trying to wrap my head around it for hours. Let me know if you need any clarifications.

sentences:
How is Unity's GetComponent implemented in C# I'm just curious that what aspects of the C# language Unity's GetComponent method uses.

In the C# language we have reflection that lets programmers access a variable by its type. Is GetComponent just some type of reflection C# for certain Unity defined types?

sentences:
How to make a rigidbody come to rest faster I'm trying to move around a 3D rigidbody in Unity 2018.1.0f2 Personal. I am using a C# script with the basic vector3 and velocity stuff from a YouTube video:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour {
    [SerializeField]
    private Rigidbody playerBody;

    private Vector3 inputVector;

    private float xMovement;
    private float zMovement;

    [SerializeField]
    private float playerSpeed;

    private float maxSpeed;

    // Use this for initialization
    void Start () {
        playerBody = GetComponent<Rigidbody>();
        playerSpeed = 1;

    }

    // Update is called once per frame
    void Update () {
        xMovement = Input.GetAxisRaw("Horizontal")* playerSpeed;
        zMovement = Input.GetAxisRaw("Vertical") * playerSpeed;

        inputVector = new Vector3(xMovement, playerBody.velocity.y, zMovement);
        playerBody.velocity = inputVector;
    }
}

It works great with a cube I put it on, except for this: if I move the rigidbody and then stop, it takes a long time for it rotate from go only one of the edges or corners just touching the ground (screenshot of what I mean, another screenshot) to resting flat. How can I make it fall back to stability faster?

sentences:
Bitmap font engine: When is color modulation not supported? I am developing a bitmap font renderer for a 2D game using SDL 2.  (If it matters, I'm using Debian 8 "jessie".)  I had planned on storing the glyphs as a grayscale image, translating gray levels to alpha at load time.  I realized I would want to draw text in more than one color.  I had planned on coloring the rendered glyphs using SDL_SetTextureColorMod(glyphstex, r, g, b), with as a white texture. But the documentation for SDL_SetTextureColorMod states that this may not always work:

  Color modulation is not always supported by the renderer; it will return -1 if color modulation is not supported.

In what cases is color modulation likely to be unsupported?  In other words, how likely am I to need a fallback method in case the automatically chosen renderer does not support color modulation?  Or is it better to render entire lines of text using software rendering and then somehow efficiently convert gray to alpha later?  Or is it better to trace each glyph in FontForge in order to convert the bitmap font to an outline font for use with SDL_TTF instead of trying to make my own bitmap font renderer?

sentences: Does Facebook give new games any free promotion? I would like to understand, if Facebook gives some free out of the box promotion for new games? I see "New Games" section in Facebook App Center, does every new game gets in there?

sentences:
How to simulate car drivetrain (in Unity)? One of my hobby projects involves cars. Up until now I had a quick and dirty "one class" implementation of engine+gearbox+wheels, but I thought that this is ugly, and I want to go a bit more realistic. Sadly I couldn't find much on Google (either wrong search terms or there really isn't anything that is what I want). It seems like

Setup in scene: Four wheelcolliders attached to a big boxcollider.

Things that I want in the system:

Separate classes for engine, clutch, gearbox, differential and wheels (and whatever else does stuff with torque). Throttlecontrol with revlimiter (works!), steering (works too!), brakes (not yet made, but also not very complex and will likely work).

First thing I tried:

Mainly this rotates around how I tell the engine that the wheels are actually using or giving (engine braking) power to the system. so first I created all the classes each with their own updatemethod (not called directly by mainloop, but from a fixedupdate of a controllerclass). updatemethod of engine calculates engine torque from throttle, torque curve (animation curve) and engine friction. This is then used to speed up the virtual crankshaft which has its own inertia. But before speeding up the shaft, I decided to put some feedback torques on the engine torque, so if the wheels can't keep up, the engine can't speed up, or even slows down. Such a feedback torque is added for example by the gearbox, which in turn also has feedback forces from the differential and with that the wheels. The wheels calculate the torque needed to spin up to the speed of the shaft coming out of the gearbox and then it propagates all back to the engine over a few updates.

Problem was, the torque feedback didn't really do engine braking, but catapulted it to several million RPM in a split second. Dividing the feedback torque by 1000 did work, but then the car didn't move at all. So this is fail number 1.

Fail number 2:

Okay screw this, I thought, and tidied up all the stuff. This doesn't use several updatemethod anymore, but recursive updating. Basically I call update on the engine, which in turn then calculates what torque it has available. With that it tells the transmission that it has t torques at r RPMs. The gearbox changes the values according to the current gear and then again puts the values into the differential. The differential SHOULD split the torque between its outputs. To do this I calculate how much torque the output (in this case wheels) would need to speed up to r RPMs. I do this for each output and make a list of it for each output. I also save the sum of these values. With this I can get a value of 0...1 for each output, that determines how much torque each output gets in its updatemethod. Its basically an intelligent differential that gives the output which needs more torque, more torque. I guess modeling a real differential would involve some more complex stuff. Now the torque is at the wheels and gets put into the motorTorque property of the wheelcollider. Up until here it works. If I throttle up and then let go of it the wheels start turning backwards. It's basically another feedbackloop just like with the first try. So also fail

And fail 3:

Instead of returning the torque that's left, I tried backpropagating the RPMs to the engine instead. So I apply torque, and get RPMs back. But again everything tries to move the car in the opposite direction that I want it to go.

Here is where I'm out of ideas. I want a relatively realistic drivetrain, that is modular and can do enginebraking. A bought asset will most probably not solve my problem, and I also want to understand how it works, and not just use it.

Does anybody have experience with how to properly model a drivetrain?

If I forgot to mention something, please ask.

sentences:
Getting path of right click in unity 3D editor I want to create an extension for the Unity 3D Editor and have an custom asset type. During the process of creation this I recognized that I would improve the UX/usability if I can specify the path where I want to create the asset by using right click. But I fail to get the context path of the right click and I cannot find any hints on google or at the unity scripting api. Below you can see an image of the process I tried to describe above.

Here is the code that is responsible for handling the context creation "event".

[MenuItem("Assets/Create/Chat")]
public static void createChatViaMenu() {
    Chat c = Chatter.createDefaultChat();

    // This is the part where I want to insert the relative path.
    AssetDatabase.CreateAsset(c, "Assets/" + c.Title + ".asset");
}

If you need any more information please let me know.

sentences:
Achieving a fixed frame-rate with varying scenes I am working on an OpenGL 3D model viewer app for iOS.

I have to load, view and navigate extra detailled 3D models on an iPad. I hardly achieve 2 fps, if i load and navigate a very complex model. I tried some optimizations like view-frustum-culling, area in pixel space, back-face-culling etc but still i am unable to improve the frame rate.

I would like to set fixed frame-rate to some X fps for my app and drop-out all the objects which don't have enough time to render at run-time. I would like to know if there is any algorithm to achieve this fixed frame-rate. I would appreciate any ideas.

sentences:
How do I detect collision between an ellipse and a rhombus? I'm building a game in C/C++ (been alternating between the two), but one of the biggest problems I've run into is collision detection. The game is isometric and exists on a 2x1 grid (e.g. the base tile is 32x16px).

Most creatures in the game use ellipses as collision masks (similarly 2x1 sized, default size is 32x16), whereas static objects use rhombuses for masks (again, 2x1, 32x16 default). How do I detect the collision of these two distinct shapes? Also, how do I detect collisions between two ellipses and/or two rombuses?

I've looked at the Separating Axis Theorem, Voronoi diagrams, and all kinds of other things, but I am having trouble understanding them (which is a pretty essential step for C/C++). Can anyone help me to understand these techniques?

sentences:
How to change the virtual joystick Input direction depending on camera rotation so the player moves to its current forward direction? I have a scene set up where the player moves and rotates with Virtual Joystick Input. I have button which rotates the camera to the back of my player at that point I want to change the joystick input direction so it moves my player to towards its current forward direction.

  The joystick Scripts:

1) script to handle events:

public class joystickEvents extends EventSystems.EventTrigger{
  var position:Vector2=Vector2.zero;

  public var joyStickHolder:Transform;
  private var pointerUp:boolean=false;

  function Update(){
    if(position!=Vector3.zero && pointerUp){
       position=Vector3.Lerp(position,Vector3.zero,5*Time.deltaTime);

    }
  }
   public function OnDrag(data:EventSystems.PointerEventData){
      position=data.position-joyStickHolder.position;
   }
   public function OnPointerUp(data:EventSystems.PointerEventData){

     pointerUp=true;

    }
  public function OnPointerDown(data:EventSystems.PointerEventData){
     pointerUp=false;
  }

}

2) script for joystick movement:

   public class joystick extends MonoBehaviour{
    var joystickEvents:joystickEvents;
    var joystickHolder:RectTransform;
          var dir:Vector3;
    private var maxDist:float;
    private var direction:Vector3;
    private var magnitude:float;

     function Start(){
        maxDist = joystickHolder.sizeDelta.x;
        maxDist=maxDist/2.5;
     }

     function OnGUI () {

        if(joystickEvents.position.magnitude>(maxDist))
              magnitude=maxDist;

        else{
          magnitude=joystickEvents.position.magnitude;

        }
        direction=joystickEvents.position.normalized;

      transform.localPosition=direction*magnitude;
        dir=direction*(magnitude/maxDist);
    }
  }

The player controller script takes the variable dir to move around the world. I think this value must changed somehow to so that move the player moves towards its current forward based on joystick input when camera is rotated.

  Here some part of playerController responsible for player movement:

public class charcterController extends MonoBehaviour{
 private var controller  : CharacterController;
 private var moveDirection : Vector3 = Vector3.zero;
 var speed : float = 6.0;
 var joystick:joystick; //reference to the joystick script
  function Start(){
       controller = GetComponent.<CharacterController>();
    }
  function Update() {
        var joyInput:Vector3=joystick.dir; //the dir in joystick script
        dir=Vector3(joyInput.x,0,joyInput.y);
        if (controller.isGrounded) {
        moveDirection = dir;

        moveDirection *= speed;
        controller.Move(moveDirection * Time.deltaTime);
         rotate();
      }
  function rotate(){
      if(dir!=Vector3.zero)
          transform.rotation = Quaternion.LookRotation(dir);
      }
 }

sentences:
Casting Civilization V based Hex Grid on Unity Terrain and Select Certain Areas of Grid I am looking for approach for casting hex based grid on terrain which is for now pre-made but eventually it will be procedural for my exploration game where you can scan planet and elements will be highlighted/hex grid selected. What could be the approach towards making this kind of hex grid as my terrain will be un-even.

I have seen approaches like mesh creation, using tile-map, unity projectors but eventually I feel like this should be something using shaders but what about selection?

Can someone please guide me in a right direction.

sentences:
Draco encoder lossless, is it possible? I'm trying to use the draco library in a Unity project. I've a lot of obj files with models of a person in different positions. When I encode these models with the draco_encoder command I obtain a lossy conversion, and a lot of parts of my original models get lost.

I tried to play around the parameters -qp and -cl in order to change the quantization and the compression level, but also with qp at its maximum and cl to its minimum some parts get lost.

In this image the left model is the original one. The right model is the one converted with draco_encoder by using cl 0 and qp 21. As you can see some parts are missing.

Do you have any suggestion on how can I obtain a lossless (as lossless as possible) conversion?

sentences:
How to link assimp lib to universal app I cannot make assimp object loader work with universal app, and I got the same problem as this one: Assimp and directX12 universal apps

I tried the static library approach mentioned in the answer of that question.
In the Properties->Linker->Link Library Dependencies, 'Yes' was selected by default.
I also added the path of assimp.dll to Linker->General->Additional library directory, and added assimp.dll to Linker->Input->Additional Dependency. Yet no help.
I'm not sure if I did correctly to link it statically or it's just because it didn't work.

Or is there any other api can be used just like assimp?

sentences:
GLImpl.gldrawelements longer than usual I'm developing a little game engine for the Android platform and I'm trying to improve the performance of this one. (I'm not an OpenGL expert)
I can see a framerate drop sometimes, when using DDMS method profiling, I can see that the cause is a longer GLImpl.gldrawelements : the first one right after the eglSwapBuffers.

So my questions are : Do you have an idea why sometimes this call is longer?
It seems that GLImpl.gldrawelements is waiting for something, am I right?

Why the first GLImpl.gldrawelements call (between two eglswapbuffers calls) is longer than the followings?

sentences: How to make multiple levels game in XNA game studio 4.0? I am doing 2D game using XNA framework 4.0. I'd like the game to have multiple levels. Where do I store the levels and how do I implement a scoring system for the game? Can I use XML for storing data for that levels and scores? Finally, is there any code samples for a multiple level game in Windows phone 7 using XNA 4.0?

sentences:
Ray Tracing concers: Efficient Data Structure and Photon Mapping I'm trying to build a simple ray tracer for specific target scenes. An example of such scene can be seen below.

I'm concerned as to what accelerating data structure would be most efficient in this case since all objects are touching but on the other hand, the scene is uniform.

The objects in my ray tracer are stored as a collection of triangles, thus I also have access to individual triangles.

Also, when trying to find the bounding box of the scene, how should infinite planes be handled? Should one instead use the viewing frustum to calculate the bounding box?

A few other questions I have are about photon mapping. I've read the original paper by Jensen and many more material. In the compact data structure for the photon they introduce, they store photon power as 4 chars, which from my understanding is 3 chars for color and 1 for flux. But I don't understand how 1 char is enough to store a flux of the order of 1/n, where n is the number of photons (I'm also a bit confused about flux vs power).

The other question about photon mapping is, if it would be more efficient in my case to store photons per object (or even per Object's triangle) instead of using a balanced kd-tree.

Also, same question about bounding box of the scene but for photon mapping. How should one find a bounding box from the pov of the light when infinite planes are involved?

EDIT: I would like to add one more question. I've seen in some source codes, that are using russian roulette, scaling the photon's power by the material's diffusivity and dividing by the average color. Is this correct? I thought that the point of the russian roulette was to not have to do this and end up with photons with varying and small powers.

sentences:
Fix my Flow Field pathfinding I'm developing prototype of Tower Defense/RTS game and I've implemented simple Flow Field grid. Here is the example (link).

How to use example: First click on S50, this will spawn additional units, then wait till all of them clump together, click on SET_BASE button and click on a free space, this will move the base (red circle) and they'll move to the new location. The problem is that if you click to a relatevely diagonal position, they'll all go straight to the target, while if you give them new order at the same y coordinate, they'll start clumping.

If you click several times to move units around, you'll notice that they're moving pretty well when you order them to move diagonally and clump in a line when going horizontally or vertically.

I ran out of ideas what to do next to fix this, what are yours?

A bit more info about my flow field: I do one pass of "Dijkstra distance" and then do second pass of detecting lowest distance neighbor and assign "vector" to that neighbor.

Then, about units movement - every unit every update reads "desired movement vector" from it's current cell, predits its movement, then checks if it will hit the wall, updates movement vector, then checks if it will hit other units and finally updates movement vector.

EDIT: Here's the source code of movement logic.(link)

And source of flow field generation (link)

I'm sorry for shitty code and stupid comments, it's all "prototyp-ish" as possible.

What I want is to achieve less "diagonal-horizontal" difference, because at the current state it's really seem underwhelming and it's unaccetable that you can move all units faster by zig-zagging them to their destination.

sentences:
2D snake game ( how to rotate snake's head with movement ?) I want to know:

how to rotate snake's head with movement
how to make tail prefabs (body) follows head direction.

public class Snake : MonoBehaviour {

    bool ate = false;
    bool isDied = false;
    public GameObject tailPrefab;
    Vector2 dir = Vector2.right;
    List<Transform> tail = new List<Transform>();

    void Start ()
    {
        InvokeRepeating("Move", 0.3f, 0.1f);
    }

    void Update () {
        if (!isDied) {
            if (Input.GetKey (KeyCode.RightArrow))
            {
                dir = Vector2.right;
                //transform.rotation=Quaternion.Euler(0, 0, 180);
            }
            else if (Input.GetKey(KeyCode.DownArrow))
            {

                dir = -Vector2.up;
                //transform.rotation = Quaternion.Euler(0, 0, 90);
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {

                dir = -Vector2.right;
                //transform.rotation = Quaternion.Euler(0, 0, 0);
            }
            else if (Input.GetKey(KeyCode.UpArrow))
            {

                dir = Vector2.up;
                //transform.rotation = Quaternion.Euler(0, 0, 270);

            }
    }

    void Move() {
        if (!isDied) {
            Vector2 v = transform.position;

            transform.Translate (dir);

            if (ate) {
                GameObject g = (GameObject)Instantiate (tailPrefab,
                                  v,
                                  Quaternion.identity);

                tail.Insert (0, g.transform);

                ate = false;
            } else if (tail.Count > 0) {
                    tail.Last ().position = v;

                    tail.Insert (0, tail.Last ());
                    tail.RemoveAt (tail.Count - 1);
            }
        }
    }

    void OnTriggerEnter2D(Collider2D coll) {
        if (coll.name.StartsWith("Food")) {

            ate = true;

            Destroy(coll.gameObject);
        } else {
            isDied = true;
        }
    }
}

sentences:
What are good puzzle game interface design principles? I'm building a prototype puzzle game at the moment. I'm just curious as to the principles behind building graphic interfaces within games.
At the minute I'm looking at designing the graphics for an interface in something like Illustrator. I'm looking at one graphic (650 x 650 px) that incorporates the play area (400 x 550 px) as a blank square, with a nice border on the right hand side (vertically down the screen) and a border along the bottom too. I'm leaving a "blank" rectangle on the vertical border to incorporate a timer into it, and three "blank" squares along the bottom to incorporate icons to represent lives or power-ups or something, which I'll design later and animate later.
Is this an acceptable/sensible approach?

sentences:
A terrain with underground tunnels The Terrain tool in Unity is great for constructing 3-D landscapes that are open from above. I am working on a game that happens entirely inside tunnels (specifically, blood vessels in a human body. But it can also be tunnels in an ant nest, or sewers below a city). There is nothing "overground" - all movement is inside the tunnels. I am looking for a tool, similar to Terrain, for easily constructing this complex system of tunnels.
One solution I thought of is to construct a terrain with "half tunnels" (i.e., open from above), then duplicate it, rotate 180 degrees, and "glue" on top of the first copy. But it can only handle one layer of tunnels, and in addition, for some reason I could not rotate the terrain.
Is there a way to construct such underground tunnels with the Terrain tool, or with a different tool in Unity?

sentences:
How can you sync video files with animations within Unity? I'm wondering if anyone might be able to offer some advice regarding an issue I am currently facing in trying to sync video files with animations within Unity.

Ideally my aim is to have a video file play whilst an animated camera (exported from blender) moves in sync with the rendered video file. I've nearly got this working, however there is a very slight delay between the two in which at certain points (quick rotations of the camera) the animation lags behind the video.

I have attempted to solve this issue by creating a script in which for every frame of the video, the animation component is accessed and the animation file frame set to its equivalent time with regards to the video player position. To do so I made use of 'animationState.normalizedTime' (mapping the video frame from its current position to a value of 0 - 1, so as to fit within the requirements of the normalized time function).

I'm also trying to make use of 'videoPlayer.frameReady' in order to set the animation with each new frame, with the idea being to try to only set the animator once a new frame is displayed.

The result I'm currently getting is that the animation is linked to the playback of the video, and will match up regardless of speed of playback, however there are parts in which the animation does not match up to the video. These are particularly noticeable when the camera makes a sudden movement, or when it is rotating. My current thoughts are that perhaps this could have something to do with camera easing settings (from blender to unity) or with the animation component settings. I've tried to remove animation compression and keyframe reduction, however am still having these issues unfortunately.

Does anyone have any ideas as to how this might be solved?

I've included my code below :

public class animationSync1 : MonoBehaviour

{

// Animation component
private Animation animator;

// Video player (add via inspector)
public VideoPlayer vp;

// total frame count of video
private float totalFrame;

// current video frame
private float currentFrame;

// animation frame count
private float animationFrame;

// Start is called before the first frame update
void Start()
{

    // Animation component
    animator = GetComponent<Animation>();

    // get total number of frames from video file
    totalFrame = vp.frameCount;

    // start video playback
    vp.Play();

    // begin playback of animation
    animator.Play("Camera_entrance|Camera_entranceAction");
    // set animation speed to 0 in order to set the animation frame point manually in fixed update
    animator["Camera_entrance|Camera_entranceAction"].speed = 0f;

}

// Use of fixed update to call 30 times a second (to try to match up to video and animation playback)
void FixedUpdate()
{

    // get current video frame
    currentFrame = vp.frame;

    // get frame count between 0 - 1 from current video frame
    animationFrame = currentFrame / totalFrame;

    // set the animation position to that of the current video frame
    animator["Camera_entrance|Camera_entranceAction"].normalizedTime = animationFrame;

}

}

sentences:
XNA ModelMesh.Draw vs GraphicsDevice.DrawIndexedPrimitives I am using XNA 4.0 and I wonder if drawing models with multiple meshes is better by filling the vertex and index buffers first and calling GraphicsDevice.DrawIndexedPrimitives() or by simply using good ol' foreach(...) {ModelMesh.Draw()}.

Is it possible to add data to vertex/index buffers at all in order to pack all the models on the scene in them and then call Draw only once per frame?

I would appreciate a link to an in-depth explanation.
Thanks.

sentences:
XNA 4.0: Blender .fbx File Won't Display 3D Model So I followed the basic 3D model display tutorial found here:
http://msdn.microsoft.com/en-us/library/bb197293%28v=xnagamestudio.31%29.aspx

And while I know this is for XNA 3.1, I can still get the screen to show and the background color to change fine.  The model file seems to be accepted in the method below:

protected override void LoadContent()
    {
        // Used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        grudmud = Content.Load<Model>("Models\\Vikings_grudmud");

        aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
    }

The model was created in Blender, so perhaps I'm missing a step in creating a mesh or certain texture for it?  I have colored it in Blender and it's a simple blocky humanoid figure.  Is there a scaling I should check in Blender so the camera in XNA is not inside the object?

Here's where I actually draw the object and set out some basic properties:

protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.Aqua);

        Matrix[] transforms = new Matrix[grudmud.Bones.Count];
        grudmud.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in grudmud.Meshes) {

            foreach (BasicEffect effect in mesh.Effects) {
                effect.EnableDefaultLighting();
                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                   * Matrix.CreateTranslation(modelPosition);
                effect.View = Matrix.CreateLookAt(cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
                    aspectRatio, 1.0f, 10000.0f);
                effect.PreferPerPixelLighting = true;
            }

            mesh.Draw();
        }
        base.Draw(gameTime);
    }

The initial camera and player model positions:

Vector3 modelPosition = Vector3.Zero;
    float modelRotation = 0.0f;
    Vector3 cameraPosition = new Vector3(0.0f, 50.0f, 5000.0f);

I haven't even attempted to implement the face texture yet.

It seems to have a wireframe/mesh, I've just colored in the faces.  The model is pretty much centered around the origin.

Am I exporting it wrong?  Do I need to specify lighting/camera angles any further?

sentences:
Java game design question (graphical objects) I'm beginner in game development, in Java and here on this site too and I have a game design question. Please comment my idea:

I have a main loop which call update and draw method. I want to use an ArrayList which stores graphical objects, they have coordinate and image or text to draw and my game objects extends this class. In update, I can choose which objects should be put in the array and in draw method I'll display the elements of array on the screen. I'm using a buffer and draw first there.  Here is a simple (not full) code, only the logic:

public class GamePanel extends JPanel implements KeyListener
{
   ArrayList<graphicalObjects> graphArray = new ArrayList<graphicalObjects>();

   public void update()
   {
      //change the game scene, update the graphArray, process input etc.
   }

   public void draw()
   {
      //draws every element of graphArray to a JPanel
   }

   public static main(String[] args)
   {
      while(true)
      {
          update();
          draw();
      }
   }
}

My questions:

Should have I use interface or abstract class for graphicalObjects? graphicalObjects class and the ArrayList really needs or there is some better solution?
How to draw objects? They draw themself with their own method or in the draw method I have to draw manually based on graphicalObjects variables (x,y coordinates, image etc.)?
If this conception is wrong, please suggest another one!

sentences:
How do I listen for an Admob interstitial ad load event? I can show interstitial AdMob ads with the following code:

    if (GUI.Button(new Rect(10, 300, 150, 50), "Load Interstitials"))
    {
        interstitial.LoadAd(interstitialsRequest);
    }

    if (GUI.Button(new Rect(10, 400, 150, 50), "Show Interstitials"))
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
        }
    }

That's all working well.

Now I want to attach a listener for when the interstitial ad has loaded. I checked all the available source files, but can't find the right listener method.

void onAdLoaded()
{
    print("Interstitial Ad Loaded");
}

public void HandleAdLoaded(object sender)
{
    print("HandleAdLoaded event received.");
    // Handle the ad loaded event.
}

I use googleads-mobile-plugins for Admob ads.

What listener should I be using?

sentences:
How can I smoothly move from tile to tile? I've looked at other games with tile based movement. I am aiming to create a game like pokemon, where the player moves smoothly to the next tile.

I am using KeyAdapter, in my KeyInput class. This basically just sets a move speed which is added to the x position of my player in the player's tick function:

if(key == KeyEvent.VK_A && ((Player)object).velY == 0){
    object.setVelX(-3);
    ((Player)object).setDirection(Direction.LEFT);
}
//The other keys as well...

In my tick method, as I said it basically just adds it:

public void tick() {
    x += velX;
    y += velY;
}

And it renders in my render method through Awt Graphics. Anyways, I was wondering how I could make this have tile based movement. Each tile is 32x32 pixels. I've looked at other tutorials and they all seem to have different solutions, I'm not sure it will be compatible with what I'm using a KeyAdaptor. I assume I might have to use a modulus operator to make sure the movement is in tiles.

sentences:
Change game from portrait to landscape dynamically I have multiple classes that implement Screen.

I want to, say, have the Main Menu screen portrait, then the Play Screen landscape. Is there anyway of changing the orientation dynamically?

I thought I could just start another Activity and have the Play Screen extend Game. And the new Activity would intialize the Play Screen. But it appears that you can't call startActivity or the like, obviously, as LibGDX is platform independent.

I use Gdx.graphics.getWidth() and Gdx.graphics.getHeight() to align Sprites and Actors so it looks "right" on different devices.

I've also tried swapping the Gdx.graphics.getWidth() and Gdx.graphics.getHeight(), respectively, but can't seem to get the position of sprites and actors correct.

sentences: Minecraft Forge modding 1.8 instance changing tool/armor material + color I am developing a minecraft mod in forge, and I need to find a way to create tools and armor where individual instances of items would have different tool material properties, armor material properties, and hues in how they are displayed. If you can offer help for any of those things, or for how to achieve these dynamic properties in general, I would be very appreciative.

sentences:
How can I determine how much I need to rotate an object to face a point? I have an object located at (208,608) in my 480x800 screen (portrait orientation). I can touch anywhere on the screen (where y < 608) and I will get touchX and touchY.

What is the angle I need to apply to my object so the it will face the point (touchX, touchY)?

I tried

double alfa = (float) Math.atan2(touchY-608,touchX-208) * 180 / PI;
myObject.setRotation(alfa);`

but this doesn't seem to work if I touch one half of my screen. I also think this might be because the point is located in different quadrants reletive to my start point?

The angle I am trying to get is the angle determined by the two points and the horizontal axis from the first point.  What I am trying to do is something like a bow facing my moving finger on the screen. Can anyone help me get the right angle please?

EDIT: I found the answer:

// Calculates an angle a body has to have to face a certain point in space

public static float rotateFromPointToPoint(float pFromPointX,float pFromPointY,float
                pToPointX,float pToPointY) {

        float k1 = (float) (pToPointY - pFromPointY);
        float k2 = (float) (pToPointX - pFromPointX);

        float tan = k1 / k2;

        float angle = (float) Math.atan(tan);
        float rotation = (float) Math.toDegrees(angle);

        if (pToPointX < pFromPointX) {
                rotation = (float) Math.toDegrees(angle) + 180;
        }
        return rotation;
}

Maybe someone else will find this usefull.

sentences:
Downprojecting an imaginary 4D mesh to the screen As a mental exercise, I'm trying to imagine projecting an arbitrary 4D mesh onto the screen (2D).

I'm guessing a single 4D triangle would still consist of only 3 points, however each of those 3 points would be defined by column with 4 dimensions.

Would it make more sense to define a projection matrix to map 4D space to 3D space first and then have OpenGL do its own projection from that data to 2D space?

Or would it be best to just plan on projecting down from 4 to 2 directly?

Many thanks.

sentences:
How do I smooth janky movement over ground as rope length is reduced? Here is a video showing the type of movement I am talking about:
video

I have a configurable joint attached to the player which reduces in length every frame the player touches the ground. I do this so that the player has an easier time getting off the ground and it adds a bit extra velocity. The problem is that when the rope shortens it causes the player to bounce across the ground (because the player is pulled toward the anchor then gravity pulls the player back down) which can make the movement seem a bit unpolished. I see two possible ways to solve this, both of which I am unsure on how to do:

stop the bouncy movement
smooth the camera so the bounce isn't noticed by the player

Here is the code that shortens the rope:

if (_playerGameobject.isGrounded())
        {

            SoftJointLimit softJointLimit = new SoftJointLimit();
            ropeLength -= .1f;
            softJointLimit.limit = ropeLength;
            _playerGameobject.playerJoint.linearLimit = softJointLimit;
        }

Can someone give me some tips or ideas for this problem?

sentences:
shadow mapping and linear depth I'm implementing ominidirectional shadow mapping for point lights. I want to use a linear depth which will be stored in the color textures (cube map). A program will contain two filtering techniques: software pcf (because hardware pcf works only with depth textures) and variance shadow mapping. I found two ways of storing linear depth:

const float linearDepthConstant = 1.0 / (zFar - zNear);
//first
float moment1 = -viewSpace.z * linearDepthConstant;
float moment2 = moment1 * moment1;
outColor = vec2(moment1, moment2);
//second
float moment1 = length(viewSpace) * linearDepthConstant;
float moment2 = moment1 * moment1;
outColor = vec2(moment1, moment2);

What are differences between them ? Are both ways correct ?

For the standard shadow mapping with software pcf a shadow test will depend on the linear depth format.
What about variance shadow mapping ?

I implemented omnidirectional shadow mapping for points light using a non-linear depth and hardware pcf.
In that case a shadow test looks like this:

vec3 lightToPixel = worldSpacePos - worldSpaceLightPos;
vec3 aPos = abs(lightToPixel);
float fZ = -max(aPos.x, max(aPos.y, aPos.z));
vec4 clip = pLightProjection * vec4(0.0, 0.0, fZ, 1.0);
float depth = (clip.z / clip.w) * 0.5 + 0.5;
float shadow = texture(ShadowMapCube, vec4(normalize(lightToPixel), depth));

I also implemented standard shadow mapping without pcf which using second format of linear depth: (Edit 1: i.e. distance to the light + some offset to fix shadow acne)

vec3 lightToPixel = worldSpacePos - worldSpaceLightPos;
const float linearDepthConstant = 1.0 / (zFar - zNear);
float fZ = length(lightToPixel) * linearDepthConstant;
float depth = texture(ShadowMapCube, normalize(lightToPixel)).x;
if(depth <= fZ)
{
     shadow = 0.0;
}
else
{
     shadow = 1.0;
}

but I have no idea how to do that for the first format of linear depth. Is it possible ?

Edit 2: For non-linear depth I used glPolygonOffset to fix shadow acne. For linear depth and distance to the light some offset should be add in the shader. I'm trying to implement standard shadow mapping without pcf using a linear depth (-viewSpace.z * linearDepthConstant + offset) but following shadow test doesn't produce correct results:

vec3 lightToPixel = worldSpacePos - worldSpaceLightPos;
vec3 aPos = abs(lightToPixel);
float fZ = -max(aPos.x, max(aPos.y, aPos.z));
vec4 clip = pLightProjection * vec4(0.0, 0.0, fZ, 1.0);
float fDepth = (clip.z / clip.w) * 0.5 + 0.5;
float depth = texture(ShadowMapCube, normalize(lightToPixel)).x;
if(depth <= fDepth)
{
     shadow = 0.0;
}
else
{
     shadow = 1.0;
}

How to fix that ?

sentences:
From XML to class method I'm trying to implement a dialogue system for a game in Unity(c#). I'm going to use xml cause I want the dialogues to be editable/added from outside. I have a practical problem.

Let's say I got this line in XML:

<Action character="MC" name="giveItem" item="Potion" quantity="2"/>

This should tell to the inventory system of the main character that it has to give him 2 potions.

As example, not actual implementation:

MainCharacter.Inventory.giveItem("Potion",2)

The question is: With the name and parameters of the method from the XML, how do I call it? And how I call other methods that i'll need in my dialogue scripts? So far I've seen reflection and maybe a dictionary of delegates, but I'dont know is there is a better way and if those are bad practices.

sentences:
Add force towards a point in Unity3d? I have a Vector2 and want to move an object towards it...
(this vector2 is the mouse position when clicked and I made sure I get only one position when its clicked)

My initial thought was to apply

  Rigidbody2D.Addforce(my vector2)

but it acting strangely...
How can I push anything towards a point?

N.B: I wanna use physics for it.... because I want to get the pushing feel!

sentences:
How to get and copy font bitmap from WinGDI to a IDirect3DTexture9? I want to get the pixels (or other data) for any character of the available fonts and copy/build them into a D3D texture so I could make some cache of text rendering by mapping only the character coords in the d3d texture and other stuff I need to solve (and using ID3DXFont is not an option).

How is this normally achieved? Should I render the GDI font to a GDI bitmap and then copy the opaque bits from the bitmap?

I thought about GDI because I can use the fonts installed in the system that way, but I would also like to know which formats should I consider for storing my own fonts and how these formats work.

sentences:
Inheritance - accessing child class values I want to use the same variable for five different child classes. It is basically a boolean that is true when a player purchases an item(represented by a child class) and false when the player is yet to purchase that item. Then save the bool status.

Can someone tell me how to do just that?

Do I create five different bool variables each on their respective classes(the child classes), then access them individually when a player wants to buy the item?
If I change the bool value of a parent class, it'll change it across all of it's child class.

sentences:
Roulette Table Ball Movement Creation I am developing following type of game Roulette Royale.

I am basically ready with wheel and number table. When user move wheel table then ball also move on that table and stop at particular number and reply to number table with that number.

Right now I only used RotationModifier and there is no position change at present only ball rotate and stop at randomly selected number. This thing work well.

But I want ball start its movement from out side the wheel and slowly move inside in to the wheel. It perform rotation as well as smoothly move towards the center of the wheel. This functionality I don't able to conceptualise how to create?

I think there is no need to put any code snippet here because I need only concept how to perform this task. Thanks in advance efforts you take for me.

sentences:
Texture object and texture unit in GL As I understand texture usage consist of two parts

How to store this discrete data about texture internally. How much dimensions, channels, etc.
How to fetch/sample/filter

The question relative to OpenGL are:

q1: What parameters are stored in texture object (glGenTexture) and what parameters are store in texture unit (glActiveTexture) ?

q2: Does glTexParameter perform setup per texture object or per texture unit?

sentences:
Public variable changed in script isn't stored in playmode I have a public variable float x in script Foo.cs. I have a Bar.cs script with a function like this:

bar() {
    Foo foo = FindObjectOfType<Foo>();
    foo.x = 1f;
}

And a custom editor which calls bar() when a button is pressed. All of that works fine in the editor, my float x is changed to 1, but when I enter playmode the value changes itself. If I change it manually in the inspector it works fine too. So for example:

I set x manually in the inspector to 10.
I enter play mode, x is still 10.
I exit playmode and call the bar() function.
x has changed to 1 in the inspector.
After hitting "Play" x changes back to 10.

How can I fix this?

sentences:
How to Make GameObject move in Circular Motion I've been trying to work an enemy that moves in a circular motion for my RPG game, but for some reason, whenever I press play the GameObject instantly goes hundreds of units in the X and Y coordinates. It also move back to -1 on the Z axis. Here's the script to my enemy's movement:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyScript : MonoBehaviour
{

    private Rigidbody2D rb;

    [SerializeField]
    float rotationRadius = 2f, angularSpeed = 2f;
    float posX, posY, angle = 0f;

    // Start is called before the first frame update
    void Start()
    {
        // Gets the RigidBody2D component
        rb = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        Movement_1();
    }

    void Movement_1()
    {
        posX = rb.position.x + Mathf.Cos(angle) + rotationRadius;
        posY = rb.position.y + Mathf.Sin(angle) + rotationRadius;
        transform.position = new Vector2(posX, posY);
        angle = angle + Time.deltaTime * angularSpeed;

        if (angle >= 360f)
        {
            angle = 0f;
        }
    }
}

sentences:
Converting a GameObject method call from UnityScript to C# Here is the UnityScript implementation of the method i use to generate a randomly tiled background, the problem i'm having relates to how to translate the call to the newTile method in c#, so far i've had no luck fiddling... can anyone point me in the correct direction?

Thanks

#pragma strict
import System.Collections.Generic;

var mapSizeX : int;
var mapSizeY : int;
var xOffset : float;
var yOffset : float;

var tilePrefab : GameObject;
var tilePrefab2 : GameObject;

var tiles : List.<Transform> = new List.<Transform>();

function Start () {
    var i : int = 0;
    var xIndex : int = 0;
    var yIndex : int = 0;
    xOffset = 2.69;
    yOffset = -1.97;

    while(yIndex < mapSizeY){
       xIndex = 0;
       while(xIndex < mapSizeX){

                var z = Random.Range(0, 5);

                if (z > 2)
                {

                 var newTile : GameObject = Instantiate (tilePrefab, Vector3(xIndex*0.64 - (xOffset * (mapSizeX/10)), yIndex*-0.64 - (yOffset *  (mapSizeY/10)), 0), Quaternion.identity);
                 tiles.Add(newTile.transform);
                 newTile.transform.parent = transform;
                 newTile.transform.name = "tile_"+i;
                 i++;
                 xIndex++;

                 }

                 if (z < 2)
                {

                 var newTile2 : GameObject = Instantiate (tilePrefab2, Vector3(xIndex*0.64 - (xOffset * (mapSizeX/10)), yIndex*-0.64 - (yOffset *  (mapSizeY/10)), 0), Quaternion.identity);
                 tiles.Add(newTile2.transform);
                 newTile2.transform.parent = transform;
                 newTile2.transform.name = "Ztile_"+i;
                 i++;
                 xIndex++;

                }

       }

       yIndex++;
    }
}

C# Version [Fixed]

using UnityEngine;
using System.Collections;

public class LevelGen : MonoBehaviour {

    public int mapSizeX;
    public int mapSizeY;
    public float xOffset;
    public float yOffset;

    public GameObject tilePrefab;
    public GameObject tilePrefab2;

    int i;

    public System.Collections.Generic.List<Transform> tiles = new System.Collections.Generic.List<Transform>();

    // Use this for initialization
    void Start () {

        int i = 0;
        int xIndex = 0;
        int yIndex = 0;
        xOffset = 1.58f;
        yOffset = -1.156f;

        while (yIndex < mapSizeY)
        {
            xIndex = 0;
            while(xIndex < mapSizeX) {

                int z = Random.Range(0, 5);

                if (z > 5)
                {
                    GameObject newTile = (GameObject)Instantiate(tilePrefab, new Vector3(xIndex*0.64f - (xOffset * (mapSizeX/10.0f)), yIndex*-0.64f - (yOffset *  (mapSizeY/10.0f)), 0), Quaternion.identity);
                    tiles.Add(newTile.transform);
                    newTile.transform.parent = transform;
                    newTile.transform.name = "tile_"+i;
                    i++;
                    xIndex++;

                }

                if (z < 5)
                {
                    GameObject newTile2 = (GameObject)Instantiate(tilePrefab, new Vector3(xIndex*0.64f - (xOffset * (mapSizeX/10.0f)), yIndex*-0.64f - (yOffset *  (mapSizeY/10.0f)), 0), Quaternion.identity);
                    tiles.Add(newTile2.transform);
                    newTile2.transform.parent = transform;
                    newTile2.transform.name = "tile2_"+i;
                    i++;
                    xIndex++;
                }

            }
            yIndex++;
        }

    }

    // Update is called once per frame
    void Update () {

    }
}

sentences:
Animations / OpenGL (ES 2) in game menu (I am specifically asking for Android)

If you look at Angry Birds (and in fact many other games), you can already see a lot of animations & effects going in the main menu and in other places even before starting to play. I assume they are done with OpenGL, more precisely a FrameLayout is used and inside it a GLSurfaceView is somewhere at the bottom of the hierarchy; above the GLSurfaceView you have regular Android buttons and texts.

Is this how it's done*? Also would you reuse the same GLSurfaceView when running the actual game or should another one be created?

*I am aware an alternative approach would be to make absolutely everything in OpenGL. Of these two I prefer the FrameLayout one, but I don't know whether other developers agree.

sentences:
Bringing a Box2D, Physics Enabled game Online? Lets say, to simplify the problem of online games a bit, my goal would be to run a near identical simulation on multiple computers in sync. Would sending commands be a good idea?

Now if only sending commands is not good, should all the physics entities be sent every half second or so?

I'm wondering this because my game will essentially be a Box2D fighting game. Players can also spawn items, which must be added to the Box2D world.

What I'm wondering is how much and what kind of information should I send over the server?

Should I simply send key presses, and every half second snap back dynamic object positions to where the server thinks they should be?

Any helpful tips / articles regarding this would be a great help!

Thanks

sentences:
What OpenGL version(s) to learn and/or use? So, I'm new to OpenGL... I have general knowledge of game programming but little practical experience.

I've been looking into various articles and books and trying to dive into OpenGL, but I've found the various versions and old vs new way of doing things confusing.

I guess my first questions is does anyone know some figures about percentages of gamers that can run each version of OpenGL. What's the market share like? 2.x, 3.x, 4.x...

I looked into the requirements for Half Life 2 since I know Valve updated it with OpenGL to run on Mac and I know they usually try to hit a very wide user-base, and they say a minimum of GeForce 8 Series. I looked at the 8800 GT on Nvidia's website and it listed support for OpenGL 2.1. Which, maybe I'm wrong, sounds ancient to me since there's already 4.x. I looked up a driver for 8800GT and it says it supports 4.2! A bit of a discrepancy there, lol.

I've also read things like XP only supports up to a certain version, or OS X only supports 3.2, or all kinds of other things. Overall, I'm just confused as to how much support there is for various versions and what version to learn/use.

I'm also looking for learning resources. My search results thus far have pointed me to the OpenGL SuperBible. The 4th edition has great reviews on Amazon, but it teaches 2.1. The 5th edition teaches 3.3 and there are a couple things in the reviews that mention the 4th edition is better and that the 5th edition doesn't properly teach the new features or something? Basically, even within learning material I'm seeing discrepancies and I just don't even know where to start.

From what I understand, 3.x started a whole new way of doing things and I've read from various articles and reviews that you want to "stay away from deprecated features like glBegin(), glEnd()" yet a lot of books and tutorials I've seen use that method. I've seen people saying that, basically, the new way of doing stuff is more complicated yet the old way is bad   >.>

Just a side note, personally, I know I still have a lot to learn beforehand, but I'm interested in tessellation; so I guess that factors into it as well, because, as far as I understand that's only in 4.x?

[just btw, my desktop supports 4.2]

sentences:
How do you tell OpenGL ES 2.0 to use a texture as the depth buffer? I want to render a scene with an outline post processing effect in OpenGL ES 2.0.

First I render all the opaque objects. Then I use a post processing shader
for silhouette detection that uses the depth buffer as a texture.
 And now I want to render all the objects using alpha blending,
without writing to the depth buffer, but using depth testing with
the values from the depth buffer texture used for silhouette detection.

If I would have rendered the translucent objects before the post processing,
 the post processing would have rendered the outlines of opaque objects over
 them since they don't write to the depth buffer.

How do you tell OpenGL ES 2.0 to use a texture as the depth buffer?

Thank you

sentences:
Custom Editor for Map/Dictionary in Unity I'm trying to build my own little ResourceManager in Unity that will allow me to tag resources (ranging from materials to prefabs) to a label in the editor, and then access them in game.

The ResourceManager itself is really easy to write- it's just a Dictionary. However the Unity Editor doesn't seem to be able to serialize (and thus render) Dictionaries.

To get around this, I created a list of key-value pairs which gets loaded into the dictionary by unity. That way Unity gets its list and I get my Dictionary. However, when I try and run the code shown below, I can only add a single entry to the list. Any idea what I'm doing wrong?

ResourceManager.cs

using UnityEngine;
using System.Collections.Generic;

public class ResourceManager : MonoBehaviour, ISerializationCallbackReceiver {
    private Dictionary<string, Object> resources = new Dictionary<string, Object>();

    #region Unity
    // Unity doesn't know how to deal with maps, so we give it a list to work with
    public List<ResourceEntry> entries;

    // Dictionary -> List
    public void OnBeforeSerialize() {
        entries.Clear();
        foreach(string key in resources.Keys) {
            entries.Add(new ResourceEntry(key, resources[key]));
        }
    }

    // List -> Dictionary
    public void OnAfterDeserialize() {
        resources = new Dictionary<string, Object>();
        foreach(ResourceEntry entry in entries) {
            resources[entry.key] = entry.value;
        }
    }

    [System.Serializable]
    public class ResourceEntry {
        public string key;
        public Object value;

        public ResourceEntry() {}

        public ResourceEntry(string key, Object value) {
            this.key = key;
            this.value = value;
        }
    }
    #endregion

    private static ResourceManager instance;
    public static Object Get(string category, string key) {
        instance = instance ?? GameObject.FindObjectOfType<ResourceManager>();
        if( instance.resources.ContainsKey(key)) {
            return instance.resources[key];
        } else {
            return null;
        }
    }
}

ResourceManagerEditor.cs

using UnityEngine;
using System.Collections.Generic;
using UnityEditor;
using UnityEditorInternal;

[CustomEditor(typeof(ResourceManager))]
public class ResourceManagerEditor : Editor {
    private ReorderableList list;

    public void OnEnable() {
        list = new ReorderableList(serializedObject, serializedObject.FindProperty("entries"), true, true, true, true);
        list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
            SerializedProperty element = list.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;
            EditorGUI.PropertyField(new Rect(rect.x, rect.y, 60, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("key"), GUIContent.none);
            EditorGUI.PropertyField(new Rect(rect.x + 70, rect.y, 160, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("value"), GUIContent.none);
        };
        list.drawHeaderCallback = (Rect rect) => {
            EditorGUI.LabelField(rect, "Resources");
        };
    }

    public override void OnInspectorGUI() {
        serializedObject.Update();
        list.DoLayoutList();
        serializedObject.ApplyModifiedProperties();
    }
}

sentences:
Common ways to keep up with character state in a 2D game? I am currently developing a 2D Blockdude clone for learning purposes and am wondering about storing character state in the game. For example, the character can be facing either right or left. What are some common ways of handling character state? Unfortunately, the question is so broad none of my searches have come up with anything (or maybe I'm searching for the wrong terms). Should I be using a state machine?

How I'm doing it now using the "character facing" example (code is Java):

enum CharacterFacing {
    RIGHT, LEFT
}

class Character {
    CharacterFacing facing;

    Character() {
        // start with the character facing right
        facing = CharacterFacing.RIGHT;
    }

    // called when the player hits the left arrow
    void moveLeft() {
        facing = CharacterFacing.LEFT;
    }

    // called when the player hits the right arrow
    void moveRight() {
        facing = CharacterFacing.RIGHT;
    }
}

Because the "facing" state is so simple, I've also thought about just a boolean:

class Character {
    boolean facingRight;

    Character() {
        // start with the character facing right
        facingRight = true;
    }

    // called when the player hits the left arrow
    void moveLeft() {
        facingRight = false;
    }

    // called when the player hits the right arrow
    void moveRight() {
        facingRight = true;
    }
}

sentences:
'perfect' platformer base Xna When a player touches a ground peice in a game, he seems to sink through the ground then slowly rise back up, and when he has risen back up, he is very jittery.

 if (touchingTheGround())
 {
     player.velocity.Y -= 2;
     touchground = false;
 }

the collision method sets the variable touchground to true if the player touches a ground peice, and if i dont set it to false, the collision detection wont work at all. i set the players velocity to move 2 up because when he's not touching a platform, his velocity.Y += 1. How do i achieve a way so that the player

Does not sink in the ground before moving up
Stops jittering when its position is higher than the ground its touching

sentences:
UniRx: Subscribing to ReactiveProperty condition I'm trying to track a cold source with a contiguous range, and every example I've seen involves discrete increments or events that are already handled, so I'm vague on how to apply it.

Here's what I have:

ReactiveProperty<float> CurrentAlpha = new ReactiveProperty<float>(msg.GetComponent<CanvasRenderer>().GetAlpha());
CurrentAlpha.Where(x => x <= 0.0f).Subscribe(x =>
{
    Debug.Log($"CurrentAlpha == {CurrentAlpha} Observed");
    img.transform.SetParent(null);
    Destroy(msg);
});

I verified the alpha value, but never received notice when it reached 0. What have I mistaken?

EDIT: Found that it's actually subscribing to the value returned, which will always be 1. The value it receives is outside managed code, so there's no object property to observe, and CanvasRenderer itself doesn't observe it.

Is it possible to observe a method's return value?

sentences:
RuntimeInitializeOnLoadMethod only on certain scenes I'm using [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] to initialize a prefab that contains all the components required for the game to work propertly.
public class FrameworkInitializer : MonoBehaviour
{
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    public static void InitializeFramework()
    {
       Instantiate(Resources.Load("_GameEngine")) as GameObject;
    }
}

It works fine.
Now I'm creating some scenes to try out things before implementing them in the final game, and I don't really need the default prefab to initialize. I tried adapting the script to this:
public class FrameworkInitializer : MonoBehaviour
{
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    public static void InitializeFramework()
    {
        if (GameObject.FindWithTag("Framework Support") != null) return;
        if (GameObject.Find("NoFrameworkSupportRequired") != null)
        {
            Debug.LogWarning("Carla Framework initializer skipped because of NoFrameworkSupportRequired gameobject in scene.");
            return;
        }
        var framework = Instantiate(Resources.Load("_GameEngine")) as GameObject;
    }
}

But it's not working, because the scene is not loaded yet so it can't find any gameobject.
And if I change BeforeSceneLoad to AfterSceneLoad, some of the scripts that require the prefab in the Awake and onEnable cycle fails.
How can I make this script to run only on some of the scenes?

sentences:
Health zone heals player but I have a problem Hello I am creating a special health zone that gives the player health and my current scripts health is going up super fast and I want it to go up by 2 hp per second. How would I do this?
Here is the health zone script.
{
    public PlayerHealth playerHealth;
    public float healthGain = 2f;

    void OnTriggerStay2D(Collider2D other)
    {
        if (playerHealth.currentHealth < playerHealth.maxHealth)
        {
            playerHealth.currentHealth += (int)healthGain;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }

        if (playerHealth.currentHealth >= playerHealth.maxHealth)
        {
            playerHealth.currentHealth = playerHealth.maxHealth;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }
    }
}

sentences:
LibGDX viewport touch coordinates transformation I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me.
I have a game window of 840x480 units with FitViewport. If the screen resolution matches the aspect ratio of the viewport, the coordinates are unprojected correctly. If it doesn't and the viewport inserts black bars, the transformation is incorrect (see below):

I'd like for the shape to be drawn where the cursor is, since the current behavior makes touch input on Android absolutely useless...

Furthermore, on Android the viewport doesn't fill the entire screen and just produces a rectangle on the bottom left quarter of my 1920x1080 px display.

Here's the code that produces this:

public class MainScreen extends ApplicationAdapter implements InputProcessor {
OrthographicCamera camera;
Viewport viewport;
Vector3 worldCoordinates = new Vector3();
Shape shape, background;
public ShapeRenderer sr;

@Override
public void create() {
    worldCoordinates = new Vector3();
    camera = new OrthographicCamera(800,480);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
    viewport = new FitViewport(800, 480, camera);
    viewport.apply();
    sr = new ShapeRenderer();
    shape = new Shape(this, 20, 20, 0, 0);
    background = new Shape(this, 800, 480, 0, 0, Color.WHITE);
    Gdx.input.setInputProcessor(this);
}

@Override
public void resize(int width, int height) {
    viewport.update(width, height);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
}

@Override
public void dispose() {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void render() {
    camera.update();

    Gdx.gl.glClearColor(0, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    background.render();
    sr.setProjectionMatrix(camera.combined);

    shape.posX[0] = (int) worldCoordinates.x - shape.sizeX[0] / 2;
    shape.posY[0] = (int) worldCoordinates.y - shape.sizeY[0] / 2;

    shape.render();
}

@Override
public boolean mouseMoved(int screenX, int screenY) {
    worldCoordinates = camera.unproject(new Vector3(screenX, screenY, 0));
    return true;
}

@Override
public boolean keyDown(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyUp(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyTyped(char character) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    return false;
}

@Override
public boolean scrolled(int amount) {
    throw new UnsupportedOperationException("Not supported yet.");
}
}

And the Shape class:

public class Shape extends Element {
public Color background;
ShapeRenderer sr;
public Shape( MainScreen ms, int sizeX, int sizeY, int posX, int posY){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    background = new Color();
    background.set(1, 0.533f, 0, 1);
}
public Shape(MainScreen ms, int sizeX, int sizeY, int posX, int posY, Color background){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    this.background = background;
}

@Override
public void render(){
    sr.begin(ShapeRenderer.ShapeType.Filled);
    sr.setColor(background);
    sr.rect(posX[0],posY[0],sizeX[0],sizeY[0]);
    sr.end();
}
}

I have tried literally every option I could find without any result. Thank you for any help.

sentences:
XNA CustomModelAnimationSample problem I downloaded the official tutorial from:CustomModelAnimationSample
It works fine but when I try to replicate it in my project, it fails to load the Tag property in my model.

Is found that the probelm is in the line:

skinnedModel = Content.Load<Model>("DudeWalk");

This line loads the model from the DudeWalk.fbx file and with the custom SkinnedModelProcessor. It loads the animations data in the model. After the line the Tag property is full. I stepped into the method and it went to the custom ModelData class.

I copied everything from the projects CustomModelAnimationWindows and CustomModelAnimationPipeline to my solution and set all the references. I tried the same line of code and couldn't step in the method. It called the default method or model constructor and after the line the model's Tag propetry was null.

I have to load the model through my custom SkinnedModelProcessor class, but how I tell the game to use this class? In the tutroail CustomModelClass the line is changed to:

model = Content.Load<CustomModel>("tank");

So I assumed that I have to set the generic type to a custom model class, but the first example works without it.

If anyone has some useful advice or some other helpful link, I'll be happy to try it.

EDIT :

I tried this tutorial Creating a Custom Importer and Processor but it didn't work either.

I understand now that the binding of the custom pipeline processor is done at build-time and not a run-time. But my custom processor never gets bound nor called.

sentences:
Should I Open/Close SpriteBatch with different settings? I'm still new in game developpement, and I'm trying to complete my 1st game. Its a simple 2d game, but i'm trying to add lots of differents techniques in it.

It's all good when you take a single tutorial (I followed some tutorials for the screen managers, for diffuse lightning, for camera, HUD, particles, spritesheet animations, etc. )
It's all quite simple to get it to works and run in a simple game.cs file.

the problem I have is when its time to all mix it toghether. I cant find any good pointers on how I should handle the spritebatch orderings. Should I use different spritebatch, or reuse the same over and over ? I was told I need to utilise as little spritebatch as possible ...

** I KNOW i could test it and start to wonder about it only if I have a problem ... but instead I'd prefer to learn to do it right the 1st time I try it. If I get into a bigger project and this way of doing it only works on easy small 2d game ... its not much better than saying I've never done anything.

More specificly, I'm wondering if I keep my main Draw set up like this :

 graphicsDevice.Clear(Color.Black);

 spriteBat.Begin(paramteres set up for my camera);
   for each screen in screenmanager {
     screen.draw(spritebatch);
   }
 spriteBat.End();

  spriteBat.Begin(paramteres set up for my HUD);
     //draw hud stuff
  spriteBat.End();

....

and in my screens draw method ... i'll end up with :

void Draw(spritebat Spritebatch)
{
     //draw screen "normal" item affected by camera
  spriteBat.End();

  spriteBat.Begin(paramteres set up for particle);
    for each particlelist in particlemanager {
      for each particle in particleList
        particle.draw(spritebatch);
      }
    }
   spriteBat.End();

 spriteBat.Begin(paramteres set up for my light FX);
    //draw diffuse light and shadows stuff
 spriteBat.End();

 spriteBat.Begin(paramteres set up for my camera);
}

is this correct ?

sentences:
When do I copyright a game? I don't know how to copyright a video game idea.

I don't know if I should make a game document and get that copyrighted first or make the game then copyright it.

The main gist is.. I am lost.

sentences: Creating a playlist with LWJGL and OpenAL I'd like to know how to create a playlist for the music in my games. I use LWJGL, and know a bit of OpenAL, however I can't figure out how to test for when a song is over. I want to be able to play one song after another, and I want to do that without hardcoding a timer for each song.

sentences:
What Scala-oriented game frameworks exist? I'm looking into Scala game development, and wondering if there are any game frameworks oriented towards it, rather than Java.

Java has Slick2D and LWJGL, but they do not take advantage of Scala features.

sentences:
How far should I go in securing Groovy mod scripts? I am developing a game in java and plan to embed the Groovy script engine to allow for more robust modding options. This comes at a price, of course. Groovy can access anything java can by default, making it something of a security risk. At the moment, this doesn't worry me all too much, as mods for many other single player games such as minecraft already provide this level of access.

However, while the game does not currently have multiplayer support, I would very much like to change that at some point after the initial release. In this case, I would like to be able to allow servers to supply required mod files directly to the client. Is it safe to allow this sort interaction in any case?

My current plan of implementation for this would be to have the server supply mod files to clients, then have the clients pass the name of the mod to a public server I'd host, receiving back from me the expected hash value of that mod to compare against a locally computed hash of the files received from the client. They'd also be given the public rating and description of the mod, and be prompted from there if they wished to keep the mod or discard it.

Obviously this would still require me hosting a mod validation server, so that mods not on the server would be rejected by default. And I'd likely have to provide the ability to download mods directly from this server for users looking to get these mods in the first place, but the purpose of this is to allow players to easily connect to servers without planning out ahead of time what mods they'd need to download, while also decreasing some of the bandwidth overhead I'd have to deal with by having servers host the files and myself simply serving up short blocks of text and hashes.

In summary: Is this complete overkill? Can I even trust servers to host safe content? Can I trust servers to host safe content without checking up on the files they send? Is this not enough security? Do I need to sandbox groovy, or would I be wasting my time?

sentences:
Human vs human android chess game design First of all I am total amateur in game development and sorry for my poor English.
I want to make android human vs human chess game. So I am wondering how to design it?

scenario 1: User connect to server, find opponent and send moves to server using socket, so match is running on a server side. I think this is not good idea because move should be validated on client side - or do I have to validate moves on client side? I do not think this is good solution because game is seperated.

scenario 2: Using hole punching technique so server is needed only for connection between players, so game is running on android devices.

which approach do you suggest? Or is there any better solution? Which server is best to use?

sentences:
2D Physics library for multiplayer in c++ Im trying to create a top down shooter with multiplayer functionality.
So far im using Box2D for my physics Simulation.

The last few days I played around with syncing movement between Clients and Server without box2d. I now feel like Box2d might be too complex for my rather simple needs(players are the only moving bodys, the Rest of the scene consists of static polygons) and after reading online it seems like Box2D isnt the best pick to sync physics over a network.

Especially when thinking about implementing client side prediction and entity interpolation where I have to manually correct values and interpolate between others I feel like box2d might be more of a Problem then a help.

As I noted my physics Simulation isnt too complex(just polygon-polygon intersection and raycasting) and so im currently thinking about implementing the physics myself so I have complete controll over it.

Maybe somebody here has already used box2d and networking or can point me to another library? Maybe im wrong and box2d is the best solution for networked 2d physics? :D

What about my idea of implementing the physics myself?

sentences:
BUG in sprite GameMaker In the game you have an object called obj_Corpo, and your image is a 3x3 square. I use it by stretching it horizontally or vertically for 10 or 20 times. Here's an example:

Acontece que no jogo ele não aparece da forma adequada.

It turns out that in the game it does not appear properly.

Note that it only gives horizontal error. This began to happen a few days ago, with no explanation. I've tried other colors and the same thing happens (darkened edges).

sentences:
Math for 2d movement with max speed? I need some help with math in a 2d environment. I have a joystick that controls the acceleration vetor for the player figure.

Its suppose to look like the ground is slippery which makes the figure turn slowly and accelerate and decelerate slowly.

Now, I can do this without any problem if I remove the maximum speed, but Im having problem when using a speed cap.

This is my calculation:

func move() {
    if acceleration == CGPointZero && currentSpeed != 0 {
        direction *= 0.95
    }
    else {
        if self.currentSpeed > maxSpeed {
            // This is almost working, just a little buggy, please help here with quality mathamatics :)

            let angle = CGPointZero.angleToPoint(direction) // In Radians
            direction = CGPoint(cos(angle), sin(angle)) * maxSpeed
        }
        else {
            direction += acceleration
        }
    }

    self.center += direction
}

move() is getting called by a timer running at 32 fps. acceleration is a Vector pointing to the direction the user wants his figure to go. currentSpeed is calculated using Pythagorean theorem. direction is acceleration * speed. maxSpeed is a number. self.center is the centerpoint of the figure.

sentences:
how to choose the board design in a multiplayer game? I'm making a Nine Men's Morris board game in which players can play with other online players.

But my problem is in steps before starting the game between two players.

This is what I thought about:

  1- Player B requests to play with Player A

  2- If player A accept the request, the game will start.

I need a step in between, so that they can choose a board design, but I don't know who should choose it or how.

Is there any better way in maching two players or how to select a borad map? Any ideas is much appreciated.

sentences: How to get started with Unreal Engine for iPhone? OK i have decent amount of knowledge of C++. I want to make cool games for iPhone using unreal engine and I have access to UDN. But everything seems cluttered on UDN. I have downloaded source from there. It would be great if someone can provide information about How to get started and list of resources. Thanks!

sentences:
How AI is balanced across different type of races in RTS games? There are some real-time strategy games (like StarCraft 1 or 2) where AI needs to be balanced across different type of races (in SC it's Protoss, Terran, Zerg), so despite they've different type of troops to play, no specific type of opponent have any advantage. Not to mention that they need to consider different type of maps, so in overall each AI playing different race have the same changes of win.

How in general this balance can be achieved by gaming companies? Is it just by playing massive amount of games headlessly with different setups?

This study and this one plus this dataset may help answering it, but it could be not related.

sentences: OpenGL ES 2.0 facet lighting I am trying to figure out if there is a way to achieve facet lighting in OpenGL ES 2.0 without extensions. I know it is possible if I don't used indexed vertices but I don't really want to do that because it is a bit wasteful. I have seen people use dFdx and dFdy to achieve this in the shader but unfortunately they are only avaible with extensions here. Are the other options or is there perhaps a way to implement these functions manually?

sentences:
When to Use Collision Detection Methods I've done some research into different collision detection methods but I don't know when I should be using one over the others. Some I've seen are:

Continuous Collision Detection (CCD) or Raycasting
Quadtrees
Discrete stepping

So for example if I want to shoot a bullet which method would I use? Well I've herd CCD is the way to go for that. But what if I have an unrealistic machine gun that has a huge rate of fire making 100 bullets shot at any given time. I don't know if I should be using a quadtree or be consistent and use CCD or even use something else.

Could I get some clarification on what each method is best suited for? That way I'm confident I'm using the right method for the situation. Also if you know of any other good collision detection methods let me know. Oh and if the dimensions matter I'm talking 2D here.

Thanks.

sentences:
Unity - Hide GameObject that is behind UI I have the following example:

How can I prevent the part of the sprite that is highlighted in red and is behind the UI from being displayed on the camera, but having the background image still showing?

sentences: Pausing the game inside the game loop Inside the game loop, the game is paused by pressing P, meaning that the game loop does not run anymore. Problem is that after this loop is halted, P cannot be pressed again to resume the loop, since it was inside the loop itself. How to make it so that when P is pressed again it makes the loop work again?

sentences:
Mixing DirectX headers with C mod project not working I'm trying to add a DirectX 11 renderer (not sure if that is even doable in a "simple" manner) to the Return To Castle Wolfenstein source code and I'm having some problems. I have a rendering class in a header that I included in the project, and whenever I include it in one of the RTCW files I get this error:

1>c:\program files (x86)\windows kits\8.1\include\um\directxmath.h(17): fatal error C1189: #error:  DirectX Math requires C++

Now I am wondering what would be a way to use DirectX math functions/classes (and all DirectX classes actually) in a C project such as the RTCW code? Is it possible to change the entire project settings so it compiles as C++? I am using Visual Studio 2017.

This is my renderer class declaration in XD3D.h header:

#include <d3d11.h>
#include <DirectXMath.h>
#include "XGeomObject.h"
#include "XCamera.h"

using namespace DirectX;

#define GPA(d3dModule, func) GetProcAddress(d3dModule, func)

class XD3DRenderer
{
protected:
    HMODULE                     m_XD3DModule;
    ID3D11Device*               m_pD3DDevice;
    ID3D11DeviceContext*        m_pDeviceContext;
    IDXGISwapChain*             m_pSwapChain;
    ID3D11RenderTargetView*     m_pRenderTargetView;
    ID3D11Texture2D*            m_pBackBuffer;
    ID3D11Texture2D*            m_pDepthStencilBuffer;
    ID3D11DepthStencilState*    m_pDepthStencilState;
    ID3D11DepthStencilState*    m_pDisabledDepthStencilState;
    ID3D11RasterizerState*      m_pRasterState;
    ID3D11DepthStencilView*     m_pDepthStencilView;

    HWND                        m_wnd;
    int                         m_screenWidth, m_screenHeight;
    bool                        m_fullScreen;
    D3DXMATRIX                  m_world, m_view, m_proj;
    bool                        m_lightMapsOn;

public:
    XD3DRenderer();
    XD3DRenderer(HWND wnd, int screenwidth, int screenheight,bool fullscreen);
    ~XD3DRenderer();

    ID3D11Device* GetD3DDevice() { return m_pD3DDevice; }
    ID3D11DeviceContext* GetDeviceContext() { return m_pDeviceContext; }

    bool LoadDriver();
    bool CreateD3DDevice(HWND wnd, int screenwidth, int screenheight, bool fullscreen );
    bool CreateRenderTargetView();
    bool CreateDepthBuffer();
    bool CreateDepthStencilView();
    bool CreateDisabledDepthStencilState();

    bool Setup();
    bool ClearScene(const D3DXCOLOR& col);
    bool Render(XGeomObject*, XCamera*);
    bool ShowScene();
    void TurnOnZBuffer();
    void TurnOffZBuffer();
};

And I include it in the C project in the RTCW win_glimp.c file like this:

#include <assert.h>
#include "../renderer/tr_local.h"
#include "../qcommon/qcommon.h"
#include "resource.h"
#include "glw_win.h"
#include "win_local.h"

#include "../renderer/XD3D.h"

extern void WG_CheckHardwareGamma( void );
extern void WG_RestoreGamma( void );

... rest of win_glimp.c file omitted.

sentences:
LWJGL: Camera distance from image plane? Let me paste some code before I ask the question...

public static void createWindow(int[] args) {

    try {

        Display.setFullscreen(false);
        DisplayMode d[] = Display.getAvailableDisplayModes();
        for (int i = 0; i < d.length; i++) {
            if (d[i].getWidth() == args[0] && d[i].getHeight() == args[1]
                    && d[i].getBitsPerPixel() == 32) {
                displayMode = d[i];
                break;
            }
        }

        Display.setDisplayMode(displayMode);
        Display.create();

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }

}

public static void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GLU.gluPerspective(45.0f, (float) displayMode.getWidth()
            / (float) displayMode.getHeight(), 0.1f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

So, with the camera and screen setup out of the way, I can now ask the actual question: How do I know what the camera distance is from the image plane? I also would like to know what the angle between the image plane's center normal and a line drawn from the middle of one of the edges to the camera position is.

This will be used to consequently draw a vector from the camera's position through the player's click-coordinates to determine the world coordinates they clicked (or could've clicked).

Also, when I set the camera coordinates, do I set the coordinates of the camera or do I set the coordinates of the image plane?

Thank you for your help.

EDIT: So, I managed to solve how to calculate the distance of the camera... Here's the relevant code...

private static float getScreenFOV(int dim) {
    if (dim == 0) {
        float dist = (float) Math.tan((Math.PI / 2 - Math.toRadians(FOV_Y))/2) * 0.5f;
        float FOV_X = 2 * (float) Math.atan(getScreenRatio() * 0.5f / dist);
        return FOV_X;
    } else if (dim == 1) {
        return FOV_Y;
    }
    return 0;
}

FOV_Y is the Field of View that one defines in gluPerspective (float fovy in javadoc). This seems to be (and would logically be) for the height of the screen. Now I just need to figure out how to calculate that vector.

sentences:
Calculating the bouncing ball bounce height while on platforms I tried to calculate the bounce height for the bouncing ball however it ends up shaking against the moving platform after it finishes bouncing. grav_val in this case is 0.1872 to prevent it to shake from normal surfaces after it finishes bouncing as a temporary fix.
yspeed = -max(0,(rounding(abs((yspeed + platform) / 2) - (grav_val) , 0.1)) + platform);

What the rounding function does is just rounds by a factor of whatever the second argument's number is.
return (input / factor) * factor

Finally, platform is the vertical speed of the platform that moves up, so let's hypothetically say it's in the speed of two for example:
platform = 2;

So, basically I want it to fully diminish until it hits to zero regardless of yspeed adding itself because it does right now due to gravity and the platforms. Rewrites or new methods would be appreciated.

sentences:
Replay system: record inputs or events? I read this: How to design a replay system But it don't really answer my question.

My game is built with the client "view" of the game as a separate program from the server "model" and "controller". (a bit like a mmo, or any multiplayer game built this way).
The server side is always the "truth" of the game, it only accept action requests as input from the clients and output events and "current state" messages.

The game model and rules are fully deterministic with a fixed "tick" update cycle, so on the server side I can record both the events sent to the client views, and the action requests. Both are associated to specific cycle number.

The question is: in this case, to setup a replay system, should I use the input, or user action requests (as suggested in there) or the events?

It looks to me that both would give exactly the same output. The only differences I can see are:

Events gives the real output while action requests have to be processed to give events.
Action requests might be far less data to record.

Are there other things to consider?

sentences:
3D game engines for XNA games Before I start development of an XNA game, I need to choose a 3D game engine to develop upon. Is this belief unfounded? Does XNA have basic object transformation, lighting and mesh/texture importing functionality by which you can develop a decent 3D side-scrolling game?

Chances are I'm going to need a 3D engine such as Torque X to handle most of the special effects, animation and sound for me. What are the engines that you recommend building an XNA game with? What work reliably in your experience? Is XNA alone enough? do you have repositories of code that work directly with XNA to create effects and other game environments with sunlight, fog and rain?

sentences:
Query for users machine hardware When writing a game, you can do many things in many ways. But not all the machines the code will be ran on support all the ways of doing it.

How can you query for the capabilities of the machine hardware programmatically?

For example, there are ways in openGL to detect if certain openGL methods are supported by the GPU, you can also see if certain extensions are supported, query the openGL version, ect, but that still doesn't give you all the data (I'm pretty sure you cannot query the amount of VRAM the machine has).

Can you do a hardware query system-wide?
To ask for the number of cores, CPU frequencies, L2  cache size, amount of ram/vram, sound card capabilities and any other system specifics so you could instruct your code how to behave (for example, to not try to play sound on 64 channels if sound card supports only 32, if vram is limited use smaller textures, etc)?

It would be nice to query for such data on startup to see if machine supports minimum requirements and then have the data globally available to the code so certain feature can be turned on or off or substituted by maybe less efficient but supported code for that machine.

I remember GTA IV had a gfx menu where it showed the amount of VRAM available and the amount required for the selected setup.

Anyway, is there a way to do what I ask?

sentences:
Unity - Quaternion - Rotate / Unrotate Error I'm trying to un-rotate a quaternion, aligning it with the axis, and then rotate it back to where it was originally.
But with every iteration it seems to lose precision and just after 20 iterations the rotation disappears.
Here is an example, which is a simplification of my code:

Quaternion rotation = Quaternion.Euler (0f, 90f, 0f);
Debug.Log ("Before: " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

int iterations = 1;
for (int i = 0; i < iterations; i++) {
    var currentRotation = rotation;
    rotation = Quaternion.Inverse (currentRotation) * rotation;
    rotation = currentRotation * rotation;
}

Debug.Log ("After:  " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

With 1 iteration the output is:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071067, 0.0000000, 0.7071067) / Euler: (0.0, 90.0, 0.0)

With 5 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071019, 0.0000000, 0.7071019) / Euler: (0.0, 90.0, 0.0)

With 10 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7059279, 0.0000000, 0.7059279) / Euler: (0.0, 90.0, 0.0)

With 15 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.4714038, 0.0000000, 0.4714038) / Euler: (0.0, 90.0, 0.0)

And finally with 19 iterations

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.0000000, 0.0000000, 0.0000000) / Euler: (0.0, 0.0, 0.0)

At the 19th iteration the euler angles becomes zero, and at previous iterations altough the euler angles are still correct, if I rotate a vector with the quaternion its magnitude is changed.

I hope you can help me and sorry for my bad english!

sentences:
Day and Night mode according to user's real local time How do I make it so the texture of my plane is a black sky when it's night according to player's local time (say from 10 PM to 5 AM it's going to be black, and from 6 AM to 9 AM it's going to be a blue sky)?

Blue sky texture name is "bluesky"
Black sky texture name is "blacksky"

Thanks.

sentences:
Representing a high-resolution deformable solid in 3D I am currently working on a design that will incorporate an object that can change size and shape.

For an example, I'll use a brick of clay. It starts out with normal dimensions of 1"x3"x6", but that can be changed because it is a soft material that can be molded.

I'm looking for a way to represent the size and shape of that object, no matter what changes have been made to it. For example, if you push your thumb down into the clay causing a hole, how could I keep track of that (from a programmatic point of view).

I thought about going all the way down to a semi-molecular level, where each "molecule" (I'm not talking actual molecules, but units that are small enough that they can always be considered the same size regardless of the shape of the object -- the resolution if you will) is represented, but the amount of data that could generate for a decent-sized object seems to be staggering. Even if the units were always the same size, the location of every unit would constantly need updating, along with algorithms to determine where each unit would go in the case of a force. The problem seems to get out of hand at this point, which is why I'm looking for any suggestions.

sentences:
Unity Random.Range not repeat same position I have this code that generates blocks in random position and it works but some times it generates blocks at the same position ,how can I fix it?

 var dupeobject : GameObject;

 function Start(){
     yield WaitForSeconds(0);
     var position : Vector3 = Vector3(Random.Range(-50,10),Random.Range(-10,5),Random.Range(-100,20));
     Instantiate(dupeobject,position,Quaternion.identity);
     yield WaitForSeconds(0);
     //Destroy(gameObject);
 }

sentences:
Bullet: Get steepness or slope between positions In a CharacterController object, there is

setMaxSlope(btScalar slopeRadians)
The max slope determines the maximum angle that the controller can walk up.

But how about knowing it in advance? Like check if the position where the character will move next is walkable (i don't know the correct word) or not? Is that possible? Any suggestions on how should I go about this?

sentences: Move gameobject from fixed position to pointposition following curve Unity2d I want to move the object from the fixed position to the mouse position according to the curve as shown in the illustration. The altitude is the same and the horizontal distance is equal.

sentences:
C++ OpenGL Basic Binary Object File Loader I have looked around for a in-depth explanation on what is a binary file (For a Opengl Object), how to make them and also how to load them, but I can't find many references... Can someone point me in the right direction?

EDIT.
I'm wanting to load a models vertex positions from a file. I currently am using obj but I want to use something faster, such as binary files.

sentences:
Directional light shadow on terrain When player is walking on terrrain, around him Unity is rendering shadow coming from directional light.

But after some radius in the distance, shadows are not rendered.

Only when player walks close to some prefab, shadow is being drawn.

This is not very realistic. I would like that shadows are visible in the distance as in real terrain.

How to fix that ?

sentences:
Tile-based collision problem with corners I am currently making a tile based collision system. But I encountered a big problem I can't seem to figure out.

Use the image bellow for reference.

Gray lines represent the border between tiles. White square is void and grey square is a wall.
Purple is a collision box and red lines represent the collision tested.

Fig 1. is the way I'm currently testing for collisions. I test for the tiles adjacent to the box.

Fig 2. is my problem. If the box slightly enters a tile in a corner, the collision will not be tested. I see you coming and tell me to test for diagonal collisions. See Fig3.

Fig 3. If I test for diagonal collisions, then if the box slides along a wall, it will hit the diagonal tile and completely stop (green line)

So I'm not really sure what to do at this point. I tried to look for 2D based tile collision detection and resolution, but nothing I found could solve my problem.

sentences:
MultiSwipe in Libgdx I have some trouble with my GestureListener class i think. I'm just trying to detect swipe on two half screen. I'm creating two InputListener but I can't add them to InputMultiplexer. Actually, I added with no trouble but it is not working as how I wanted. How can I detect two swipe(fling or pan whatever) events simultaneously ?

Maybe this picture will help you that you understand it.

EDIT : It's from my Player1 class and the other class' contents are the same. (Player2)

private void listenInputs() {

    inputProcessor = new InputProcessor() {

        @Override
        public boolean keyDown(int keycode) {
            return false;
        }

        @Override
        public boolean keyUp(int keycode) {
            return false;
        }

        @Override
        public boolean keyTyped(char character) {
            return false;
        }

        @Override
        public boolean touchDown(int screenX, int screenY, int pointer, int button) {
            if (canMove) {
                lastTouch.set(screenX, screenY);
                firstD = screenX;
            }
            return true;
        }

        @Override
        public boolean touchUp(int screenX, int screenY, int pointer, int button) {
            canMove = true;
            distance= 0;
            return true;
        }

        @Override
        public boolean touchDragged(int screenX, int screenY, int pointer) {

            Vector2 newTouch = new Vector2(screenX, screenY);
            distance = screenX - firstD;

            if (firstD < CarcleGame.HALF_SCREEN) {
                if (Math.abs(distance) > 20) {
                    if (canMove) {
                        canMove = false;
                        Vector2 delta = newTouch.cpy().sub(lastTouch);
                        if (delta.x > 0.7f)
                            move(true); // if it's true then go to the direction right, else go left
                        else if (delta.x < -0.7f)
                            move(false);

                        lastTouch = newTouch;
                    }
                }
            }
            return true;
        }

sentences:
Log in by pressing enter while password text is in focus I have a very simple script which is supposed to Check if the return key is pressed while the password text is in focus.
The issue is that I've tried all 3 methods Input.GetKeyUp, Input.GetKeyDown and Input.GetKey and they all work when the user presses the Return key 2 times at least. I need to be able to log in on one press of the return key. Here is the code I'm using:

InputField _input;
bool focused;
public System.Action Callback = () => { };
void Awake()
{
    _input = GetComponent<InputField>();
}

void Update()
{
    focused = _input.isFocused;
    if (focused)
    {
        Debug.Log("Passowrd field is in focus");
        if (Input.GetKey(KeyCode.Return))
        {
            Debug.Log("ENTER KEY PRESSED via getkey");
            Callback();
        }
    }
}

sentences:
Java collision detection with rectangles I'm trying to get the collision between two squares. I've made a Rectangle object that overlays each one and updates the position every tick.

Then I made a collision method that checks whether they are intersecting or not. It just uses rectangle1.intersects(rectangle2);

That works fine, and it detects the collision, however I can't move when it detects it.

This is my move and collision method at the moment.

public void move(int xa, int ya, Player opponent) {
    if (collision(opponent)) {
        return;
    }

    this.x += xa;
    this.y += ya;

}

public boolean collision(Player opponent) {
    if (rectangle.instersects(opponent.rectangle) return true;
    return false;
}

The detection and stuff works fine, but I can't move. I see why I can't, because the method is returning before it moves anything, but I'm just completely lost for whatever reason on where to go with it. I'm sure it's an easy fix and I'm just not seeing something.

sentences:
Unreal Engine 4.18 - Knife (Weapon) collides with character capsule collision I have a character and he has a knife in his hand. When Run / Walk action happens hands move and so does knife, its collision collides with character's capsule collision and causes issue in movement.

More info:
Component Hierarchy looks like

sentences:
Ghost replay - storage and timing I am working on a car race game and just implemented a ghost sprite for replaying past races.
I use a physics engine and after much reading I came to the conclusion that the best way to store the ghost data for replay would be to record the car's position and rotation at given timepoints, as for example described here: https://gamedev.stackexchange.com/a/8380/26261.

But what would be a good way to find those timepoints during replay?
An example would be a record with this data:

time: +3.19932 (seconds since race start)
position:  180,40 (position at that time)
rotation: 30.4 (rotation at that time)

But I have several problems with that:

When I replay, it's unlikely that I reach the exact timepoint at 3.19932 again - more likely, I will have a timepoint around 3.1 and have to find the closest matching record. When interpolating, even the closest matching above and below. This sounds very inefficient and time consuming?
In which list structure could I store these records for a later replay? An array? Doesn't that mean that search time for records matching a certain time will increase the longer the race is?
Which frequency should I use for timepoints? Each frame would be -I guess- overkill, rather I should save i.e. every nth frame and interpolate in between, which makes the storage questions in 2. even more difficult.

So is this idea even the right approach? If yes, how could I efficiently store and retrieve the data?
Please note that I generally would like to go with using the data structure above, not deterministic gamestates and recording user input etc.

Thanks for any help!

EDIT:
I realise I should describe the environment I use: Cocos2D for iPhone.
There is a method update:(ccTime)delta. Ideally, this method would be called every 1/60 seconds, but there is no guarantee - delta is the actual time passed since the last gametick and could be a lot more or less than 1/60.
It is in this method where I would like to store the current gamestate.

sentences:
Adding mesh's\objects to procedural isosurface terrain Thanks again for reading!

So following on from my last question, I have my fully working isosurface terrain and now its time to add my trees and grass and whatever to the world.

The old way I was doing it was to cast rays in a grid faceing down over the terrain, I would then read the normal from the ray hit and place things if the normal was < as value.

I would do this at different grid resolutions for each plant\tree\grass time and offset there x, z and scale by some random value then adding the object to my 2d BV tree because I was only working with height map terrain so I only had one row of bounding volumes for the tree.

I can still use the above method but as you know it will only place objects on parts of the terrain that can see the sky.

Part of building my new terrain system involved making a real octree so I no that I will use that to store my objects but what is the best way to generate my object positons.

From what I have read around I should somehow use the voxels I build but I'm not really sure how I would go about it.

sentences:
XNA Automatic Collision detection from model? This is going to be a rather vague question xD

In XNA is there a way of working out if a point or rectangle is colliding with a 3D .x object? It is a big model, and would take a long time to map out all the rectangles for collision detection so I was wondering if there was a easier way of doing it :)

sentences:
How do I make the screen shake when the player takes damage? I am making a 2D game and I'd like a visual cue when the player gets hurt. Currently, I have a simple blinking red dot that shows up for 2 seconds after damage, but it's not very immersive.

Many games shake the screen to indicate damage. How could I implement such an effect?

sentences:
When do I need to call `glUseProgram`? Looking at examples at http://learnopengl.com/#!Getting-started/Hello-Triangle and many different places, I've found that the draw sequence usually goes like this:

// setup VBO, VAO, load shaders

while (true) { // game loop
  glUseProgram(shader);
  glBindVertexArray(someVAO);
  drawStuff(...);

  // ...
}

Now my question is, is there any reason why I'd want to repeatedly do glUseProgram(...) on each frame, unless I'm using multiple shaders (such as OpenGL clearing currently used shader after rendering?)?

Also, if I am using multiple shaders, do I need to glUseProgram before switching to a different VAO? I'm unclear on whether the VAO just gets set as active, or if it actually modifies the state of a currently used shader. I've tried looking this up in the OpenGL spec, but couldn't quite find it.

edit: Yes I did mean glUseProgram, sorry.

sentences:
How to smooth low-res sampling of noise for voxel terrain I am attempting to create a new terrain generator as part of a minecraft mod, which works very well if it samples at the full terrain resolution (16x256x16 voxels per terrain chunk). This is extremely laggy, so i attempted using a lower-resolution sample, x4x64x4, with an extra one sample on each positive axis to interpolate with (5x65x5, representing 20x260x20 space).

It all works fine until i try to smooth out the resulting 4x4x4 cubes of terrain. I have tried interpolating the noise value (0.0 to 2.0) of each block with the value next to it along each positive axis, each value weighted by how close the block is to it.

The result has some smoothing, but some of it seems to be rotated 90 degrees, and some areas are unsmoothed. I know this is possible, minecraft does it internally (the code is illegibly obfuscated and messy, about half a page, 20 variables and 6 loops).

Does anyone have any ideas about a reliable method for smoothing, only knowing the contents of the chunk and one sample to the north/east/top?

my current noise array generator:

protected double[] getNoise(float x, float z)
{
 // get a rough noisemap every 4 blocks, 1 more past the edge to round with
 double[] n = new double[1625]; // x65x5x5 3D space in order y,x,z  represents one chunk at 1/4 precision (1024 blocks plus 601 blocks padding along the positive-axis sides for rounding. Minecraft uses 825 doubles internally, 5x33x5)

 for(int lx = 0; lx < 5; ++lx)
   for(int lz = 0; lz < 5; ++lz)
   {
     // some extra noise that controls terrain thickness along Y
     double m = 32+(1f+SimplexNoiseGenerator.getNoise( (x+(lx*4))/256, (z+(lz*4))/256) )*32;

     for(int ly = 0; ly < 65; ++ly)
     {
       n[ (ly*25) + (lx*5) + lz ]= ( 1f+SimplexNoiseGenerator.getNoise( (float)(x+(lx*4))/512f, ((float)ly*4)/m, (float)(z+(lz*4))/512f ) ) * (1.5f-(Math.abs(32f-ly)/32f) ) ;
     }
   }
   return n;
}

Someone posted this on stack overflow, it is exactly the same problem and seems to be unresolved. https://stackoverflow.com/questions/35852194/smooth-lower-resolution-voxel-noise

sentences: How to get a reflex edge on a non-convex mesh I am trying to implement a convex decomposition and I need to find the convex vertex on a mesh. Is there a algorithm that I can use to find the convex vertex on a mesh.

sentences:
Unable to control trigger events for car animation collsion control I have different car animation running on the road which have imported from max. I want to make such an intelligent System that if car start to trigger from another car it become stop. So far I have tried this.

Added four collider (as you can see in Fig 1) with tag name car, carBack, carLeft, CarRight

car left/right contains this code. Added this script to car left,right collider that if this collider hit with car object then car become stop.(And on trigger exit it resume)

 void OnTriggerEnter(Collider c)
    {
        if (c.tag == "Car")
        {
            Debug.Log("collided with : carsideTriggerScript :" + c.transform + " - object Name to stop : " + gameObject.name);
            c.transform.gameObject.GetComponent<AnimationControlSpeed>().Speed = 0;
            //StartCoroutine(DecreaseSpeedGradually(transform.gameObject.GetComponent<AnimationControlSpeed>()));
        }
    }

    void OnTriggerExit(Collider c)
    {
        if (c.tag == "Car")
        {
            Debug.Log("Exi collided with :  carsideTriggerScript:" + c.transform + " - object Name to resume : " + gameObject.name);
             c.transform.gameObject.GetComponent<AnimationControlSpeed>().Speed = 1;
        }
    }

Added script which check that if car start to collide with carBack collider then stop (And on trigger exit it resume. Same script as above).

But a scenario is creating which you can see in fig 2.

I am enable to handle it. it seems that one car collider hitting  carRightCollider and same thing happen with another car so that both car become stop and unable to move again.
     How can i control it? as same scripts are attached to every gameobject with same OntriggerEnter and logic.

sentences:
Glenn Fiedler's fixed timestep with fake threads I've implemented Glenn Fiedler's Fix Your Timestep! quite a few times in single-threaded games.

Now I'm facing a different situation: I'm trying to do this in JavaScript. I know JS is single-threaded, but I plan on using requestAnimationFrame for the rendering part.

This leaves me with two independent fake threads:  simulation and rendering. Timing in these threads is independent too: dt for simulation and render is not the same.

If I'm not mistaken, simulation should be up to Fiedler's while loop end. After the while loop, accumulator < dt so I'm left with some unspent time (accumulator) in the simulation thread.

The problem comes in the draw/interpolation phase:

const double alpha = accumulator / dt;
State state = currentState*alpha + previousState * ( 1.0 - alpha );
render( state );

In my render callback, I have the current timestamp to which I can subtract the last-simulated-in-physics-timestamp to have a dt for the current frame.

Should I just forget about this dt and draw using the physics thread's accumulator? It seems weird, since, well, I want to interpolate for the unspent time between simulation and render too, right?

Of course, I want simulation and rendering to be completely independent, but I can't get around the fact that in Glenn's implementation the renderer produces time and the simulation consumes it in discrete dt sized chunks.

A similar question was asked in Semi Fixed-timestep ported to javascript but the question doesn't really get to the point, and answers there point to removing physics from the render thread (which is what I'm trying to do) or just keeping physics in the render callback too (which is what I'm trying to avoid.)

sentences:
Using a single square sprite to create tetris-like objects I'm currently working on a project in XNA, Visual Studio, where it is crucial I can create the classic tetris figures solely based on one square sprite (So I can return to each individual square at a later point, as I need individual squares highlighted at another point in the game).

I tried loading my square into my code, then use a matrix(Texture2D 2d-array) to draw one of my pieces:

centerPiece = new Texture2D[,] { { null, Content.Load<Texture2D>("square"), null }, { Content.Load<Texture2D>("square"), Content.Load<Texture2D>("square"), Content.Load<Texture2D>("square") }, { null, Content.Load<Texture2D>("square"), null } };

At first glance it seemed fine, but when I try to actually draw it using this method:

spriteBatch.Draw(centerPiece[,], screenView(), null, Color.White, 0f, IMGCenter(), 1f, SpriteEffects.None, 0f);

It can't draw it as an 2D array, or normal array for that matter. Neither is it able to draw the "nulls" I use in my first method, which also denies me of drawing it by the use of a nested for loop.

Am I completely on the wrong track, or am I just missing a slight detail?

sentences: Are lightmaps also considered textures? I want my game to support phones with max texture size of 1024 so my texture atlases are 1024. My question is: are lightmaps also considered textures and their max size must be 1024? Or they can have higher dimensions like 4096?

sentences:
LibGDX how to remove PointLight that is attached a destroyed Body I have this code:

@Override
public void beginContact(Contact contact) {
    fa = contact.getFixtureA();
    fb = contact.getFixtureB();

    if (fa == null || fb == null) return;
    if (fa.getUserData() == null || fb.getUserData() == null) return;

    final Body toRemove = contact.getFixtureA().getBody().getType() == BodyDef.BodyType.StaticBody ?
            contact.getFixtureA().getBody() :
            contact.getFixtureB().getBody();
    Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run () {
            world.destroyBody(toRemove);
        }
    });

}

It removes the FA body, but this body have a pointlight attached.
I want to remove this PointLight attached.
I have no idea how to do this :/.

sentences:
How can I use collision lines to implement line-of-sight in GameMaker? I am making a GameMaker game that involves the enemies having line of sight so that they don't target the player through a wall. I have this code that uses collision line to detect whether there is a wall between the enemy and the player, then sets CanSee to 1 if true.

if collision_line(x, y, obj_parent.x, obj_parent.y, obj_wall_parent, false, true)
    global.CanSee = 1;

However, this code does not ever affect the value of CanSee. Am I using this code wrong?

Edit:
Here is my room setup. The walls all have obj_wall_parentas their parent.

Here are some of the objects:

sentences:
2D collision resolution: works on each axis individually, but not with both combined My collision detection method is solid and detects box to box collision every time. Then comes the resolve part which I'm struggling with quite a bit. It works perfectly when I'm manipulating the x-axis and y-axis of the player (tile) but only happens to work when I move on any given axis individually. If I try to move on both axis then the whole thing breaks down and starts acting weird.

I'm trying to implement gravity. And so I keep a constant down force on my player tile. This is when I realized that when I'm applying force on both axis (because gravity is constantly applying force on the y-axis) and moving the player tile right or left on the same time my collision resolve method breaks down.

My collision is working great while moving along each axis individually. Here's the result:

How can I approach collision resolution in order to avoid this type of result?

I'm currently predicting the position the player will be at, then I'm checking every single collideable tile at that position. If I detect a collision, I move the player back along the axis the collision was detected in.

This is my current code with collisions working well on a single axis at a time:

void Tile_Player::Move(double delta, G3::Tile_Map *map)
{
    int xvel = (this->xDirection * (G3::TILE_STEP * (delta/1000)));
    int yvel = (this->yDirection * (G3::TILE_STEP * (delta/1000)));

    G3::xy_pos predictedPos;
    predictedPos.x = this->tile_location.x; predictedPos.y = this->tile_location.y;

    predictedPos.x += xvel;
    predictedPos.y += yvel;

    bool collision_status = false;

    for (int i=0; i< map->GetTotalTileCount(); i++)
    {
        G3::Tile *tempTile = map->GetTileAt(i);
        if (this != tempTile)
        {
            bool coll_bool;
            coll_bool =  this->CheckCollision(predictedPos, tempTile->GetTilePos());
            if (coll_bool)
            {
                //check collision on the left
                if (this->xDirection == -1)
                {
                    predictedPos.x = tempTile->GetTilePos().x+G3::TILE_SIZE+0.1;
                }
                //check collision on the right
                if (this->xDirection == 1)
                {
                    predictedPos.x = tempTile->GetTilePos().x-G3::TILE_SIZE-0.1;
                }
                //check collision on bottom(ground)
                if (this->yDirection == -1)
                {
                    predictedPos.y = tempTile->GetTilePos().y+G3::TILE_SIZE+0.1;
                }
                //check collision on top
                if (this->yDirection == 1)
                {
                    predictedPos.y = tempTile->GetTilePos().y-G3::TILE_SIZE-0.1;
                }

            }
        }
    }

    this->tile_location.x = predictedPos.x;
    this->tile_location.y = predictedPos.y;

    this->xDirection = 0;
    this->yDirection = 0;
}

sentences:
Interpolating positions in a multiplayer game In order to save bandwidth in my multiplayer game, I do not update every object every server tick, instead each object has an updateRate which tells the game that this object is expected to be updated every X server ticks.

When I receive an update message for an object I calculate the time I expect the next update to come in:

origin = serverCurrentPosition
diff = serverNextPosition - origin
arriveTime = now + timeBetweenTicks * updateRate

When I draw the object I calculate the time that's left till the next update and interpolate the position accordingly:

step = 100 / timeBetweenTicks * updateRate
delta = 1 - step * ((arriveTime - now) / 100)
position = origin + diff * delta

It works... but there's still a bit of jitter in the drawing, although in my theory every thing should work out fine, since the scaling should take care of some amount of lag, should it?

So the question here is, is this the best approach? Should I put actual lag into the computation? If so, how would I do that? I did some experiements, but the jitter only got worse.

sentences:
How to handle multiple game sessions where players turn can timeout, using Python and Socket.IO? I want to make a multi player card game, allowing several people to play with each other (each game session should be able to have between 5 - 10 players).

I'm doing this in Python (Django and Socket.IO).

Because you have to wait for all players to finish before you can move on to the next round, issues will arise if one player leaves his computer or is disconnected, thus leaving all the other players waiting.

To solve this, I want to give each player a time limit to act within.

If there are 1,000 games going on at the same time, and 5 players in each game, that would hypothetically mean that at one point, you could have 5,000 timers counting down at the same time (or if not timers, some other way of dealing with this issue).

What is the best way to do this in Python?
Spawn loads of threads with timers?
Have something more complex like a dictionary with 100 games in each dictionary, and for every second, iterate through the list and check each player? (seems a bit finicky)?

I really want to hear what the best approach to this would be.

sentences:
How to get started with making textures I have Photoshop CS6 (I haven't installed it yet), and I was wondering if there was a good book or tutorial on how to get started on making my own video game textures.

SIDENOTE: I saw a question on this, but it was outdated and from 2011.

sentences:
How to resize the child node fit inside SKSpriteNode when resizing? I am creating a virtual gamepad for my game, It has one main SKSpriteNode with circle image and four child node(up, down, left, right) with image. When I am using default size for all it looks perfect but it's big in size and when I tried to resize the main circle SKSpriteNode all it's child node are bigger then it's parent and I am unable to calculate size for child node that will fit for every condition(different size of Main node).

-(id)initWithJoystickImage:(NSString *)baseImage
                   upImage:(NSString *)upImage downImage:(NSString *)downImage leftImage:(NSString *)leftImage rightImage:(NSString *)rightImage
{
    if((self = [super initWithImageNamed:baseImage]))
    {
        SKSpriteNode *up = [[SKSpriteNode alloc] initWithImageNamed:upImage];
        up.position = CGPointMake(0, up.frame.size.height/2);
        [self addChild:up];

        SKSpriteNode *down = [[SKSpriteNode alloc] initWithImageNamed:downImage];
        down.position = CGPointMake(0, -down.frame.size.height/2);
        [self addChild:down];

        SKSpriteNode *right = [[SKSpriteNode alloc] initWithImageNamed:rightImage];
        right.position = CGPointMake(right.frame.size.width/2, 0);
self.size.height/2.5);
        [self addChild:right];

        SKSpriteNode *left = [[SKSpriteNode alloc] initWithImageNamed:leftImage];
        left.position = CGPointMake(-left.frame.size.width/2, 0);
 self.size.height/2.5);
        [self addChild:left];
    }
    return self;
}

sentences:
Assimp - Error loading .obj files I'm trying to load .obj files in my little game. I decided to use assimp as tool to import those models. But it seems that assimp does not import them correctly.

I looked for a simple cube mesh online and found this one:
http://cs.wellesley.edu/~cs307/tw/objects/cube-textures.obj

But when importing the model the number of faces is only 11 instead of 12. I then tested to load the model in the model viewer provider by assimp. But the problem is the same, one face is missing.

Is there anything I'm missing? Here is my loading code:

const aiScene* AssimpScene = this->AssimpImporter.ReadFile("C:/cube.obj",  aiProcess_CalcTangentSpace);

sentences:
Many OpenGL declarations are not occured in GLESv3 gl3.h I created a small OpenGL renderer in C++ and I want to move to Android so I prepared eclipse with all suitable platforms and create a Native Activity project then add the NDK to the includes and successfully executed and run a sample which color the screen, once I imported the files from the C++ project (copy them to jni folder) and fixed the includes I found many GL declarations are not occurred for example "Function 'glDrawBuffer' could not be resolved", I opened the gl3.h file and discovered that they are not occurred in that file, in my desktop version I use glew library and the file glew.h contains all those definitions so I tried to copy the definition from glew.h

GLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);

to gl3.h

GL_APICALL void GL_APIENTRY glDrawBuffer (GLenum mode);

but still have the same error.
is these functions and constants are not occurred in the ES version of OpenGL or I need to update something? I have NDK r 15, SDK 22, Eclipse neo and GCC compiler with Android Builder.

Edit:

I found this definition in the same file

GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);

I think it is the same function but different number of arguments so I can guess there are many differences between OpenGL and the ES3 so the is same code will not run and must be changed?

also is there a place where I can find the equivalent functions or constants?

sentences:
Is it possible to update the livetile in XNA WP7 game? ( I'm not sure if this question belongs here, but since it is related to game development and I have no idea where else I should post this, I will post this here )

As the title says, what I am basically asking is if it is possible to update the livetile of an pure XNA game ( not SL + XNA hybrid )?

I've been thinking something like that whenever user launches the game, I would create an texture dynamically and then update the livetile to show that texture. Even better would be if I could schedule this code to run for example once a day, without requiring user to even launch the game.

Is this possible in WP7 or in WP8 ( is the WP8 SDK even publicly released yet? ) in pure XNA game? What about in XNA + SL hybrid?

sentences:
multi-thread in mmorpg server For MMORPG, there is a tick function to update every object's state in a map. The function was triggered by a timer in fixed interval. So each map's update can be dispatch to different thread. At other side, server handle player incoming package have its own threads also: I/O threads. Generally, the handler of the corresponding incoming package run in I/O threads. So there is a problem: thread synchronization. I have consider two methods:

Synchronize with mutex. I/O thread lock a mutex before execute handler function and map thread lock same mutex before it execute map's update.
Execute all handler functions in map's thread, I/O thread only queue the incoming handler and let map thread to pop the queue then call handler function.

These two have a disadvantage: delay. For method 1, if the map's tick function is running, then all clients' request need to waiting the lock release. For method 2, if map's tick function is running, all clients' request need to waiting for next tick to be handle.

Of course, there is another method: add lock to functions that use data which will be accessed both in I/O thread & map thread. But this is hard to maintain and easy to goes incorrect. It needs carefully check all variables whether or not accessed by both two kinds thread.

My problem is: is there better way to do this? Or from practical view, the delay can be accepted because nothing will happen between 2 tick (the world is driven by continuous tick, all object will paused in 2 tick's interval) Generally, the interval is about 50ms to 100ms

Notice that I said map is logic concept means no interactions can happen between two map except transport. I/O thread means thread in 3rd part network lib which used to handle client request.

sentences:
Playing a sound on collision? I'm making a pool game. I've separated the gameplay logic and the physics into two systems, entities and physics. Each entity holds a reference to a body which the physics system uses. The body itself holds a reference back to it's owner. When an entity collides with another entity, the Collided(Entity other) method is called on both.

What I'm trying to do now is to play a sound when both entities colliding are of a certain subclass. I'm not sure how to do that. I could do it in the Collided method, but then the sound would be played two times at the same time, since the method was called on both entities.

How do you suggest I do this?

sentences:
How to ignore one unity package in source control I've just installed the Unity quick search package. This is an editor extension which each developer should choose if they want installed or not. My problem is that because this was added as a package it also made changes to my project which would end-up in our repository.
The changes are:
Project root/
|── Assets/
|   |── Assets.index
|   └── Assets.index.meta
|── Packages/
|   |── manifest.json
|   └── packages-lock.json
|── UserSettings/
    └── QuickSearch.settings

Questions:

Should this files be added to source control?
How can I ignore the changes in manifest.json and packages-lock.json without filters?

sentences:
Unity: objects behaving different when NetworkTransform is used to sync movement I am experimenting with some simple multiplayer/networking in unity. Currently I have a plane object as the ground, and a cube prefab as the player object. I have a network manager with round-robin spawn and the built-in HUD. The cube has simple movement control (up/down is forward/backward, left/right turns the cube).

I can successfully start a game, build it, and add a client from the built app. However, when movement gets sent over the wire, the non-local player cubes in the game appear to "tilt forward," seemingly from the drag that the cube creates against the plane while moving. Strangely, when moving the local cube, no such tilt is experienced.

Here is a gif which illustrates:

In the above gif, the cube being moved is in the foreground window. Notice how the cube is only tilting in the other window.

Here is Update function of the Cube controller script:

// Update is called once per frame
    void Update () {

        // Change translation
        float moveAmount = CrossPlatformInputManager.GetAxis("Vertical");
        Vector3 deltaTranslation = transform.position + transform.forward * movementSpeed * moveAmount * Time.deltaTime;
        localRigidBody.MovePosition (deltaTranslation);

        // Change rotation
        float turnAmount = CrossPlatformInputManager.GetAxis("Horizontal");
        Quaternion deltaRotation = Quaternion.Euler (turnSpeed * new Vector3 (0, turnAmount, 0) * Time.deltaTime);
        localRigidBody.MoveRotation (deltaRotation * localRigidBody.rotation);

        MoveCamera();

    }

The ground is a plane with a rigid body and doesn't have a network identity or transform.

How do I stop the dragging from occurring and have the behavior be consistent across both instances of the game?

The full code to this project as it is right now is here: https://github.com/andyperlitch/blocks-multiplayer

Thanks!

sentences:
How can I prevent false score reports to global highscore tables? Browser and mobile games commonly have global highscore tables. It's also common for those tables to contain scores of 2,147,483,647 — where people have figured out the webservice call that reports scores and used it to record a fictitious score.

For simple puzzle games, we can defend against this by including a record of every move the player made (and any random seeds used to generate the level) with the score-reporting call. The entire game can then be reproduced and verified on the server.

However, this quickly becomes infeasible for anything larger than Pac-man.

How else can cheating of this kind be prevented?

sentences:
XY Location scaling with varying density screens I have a phone with resolution H=1280,W=720,Density=2
I have a tablet with resolution H=1216,W=800,Density=1.331

I drew a rectangle on my phone with corners Left,Top (-1.6,1.55), Right,Bottom (1.6,-1.65).
If I want to draw very similar rectangle on tablet (the gap of edges from screen ends look almost same), what would the formula be to calculate the four corners?

Given:
* The origin is always at center of screen. (because I don't know how to change it in Opengl ES 2.0 :-/ )

Shader code:

String vertexShaderSource = "attribute vec4 a_Position; uniform mat4 uMVPMatrix; void main() { gl_Position = uMVPMatrix * a_Position; }";
String fragmentShaderSource = "precision mediump float; uniform vec4 u_Color; void main() { gl_FragColor = u_Color; }";

OpenGL setup code:

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
    this.W = width;
    this.H = height;

    glViewport(0, 0, width, height);

    //initialize rectangle...

    Matrix.setIdentityM(mProjMatrix, 0);
    Matrix.setIdentityM(mViewMatrix, 0);
    Matrix.setIdentityM(mMVPMatrix, 0);

    float aspect = width > height ? (float)width / height : (float)height / width;

    // Setup our screen width and height for normal sprite translation.
    // ortho is converting 3d to 2d - z is 0
    if (width > height) {
        Matrix.orthoM(mProjMatrix, 0, -aspect, aspect, -1, 1, 3, 7);
    } else {
        Matrix.orthoM(mProjMatrix, 0, -1, 1f, -aspect, aspect, 3, 7);
    }

    // Set the camera position (View matrix)
    Matrix.setLookAtM(mViewMatrix, 0,
                        0f, 0f, -3f, // eye
                        0f, 0f, 0f, // center
                        0f, 1f, 0f); // up

    // Calculate the projection and view transformation
    Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mViewMatrix, 0);
}

@Override
public void onDrawFrame(GL10 gl) {
    glClear(GL_COLOR_BUFFER_BIT);

    // view transformation
    glUniformMatrix4fv(_uMVPMatrix, 1, false, mMVPMatrix, 0);

    m_vertexBuffer.position(0);
    glVertexAttribPointer(m_a_Position, POSITION_COMPONENT_COUNT, GL_FLOAT, false, 0, m_vertexBuffer);

    glDrawArrays(GL_LINE_LOOP, 0, 4);
}

I do not have any formula. Has anybody got any idea?

sentences:
Unity 3D - Modify a Script on runtime I am about to make a programming game for children, hence I will use blocks  (like Scratch or Stencyl). My question is: Is there a way that you can modify a script (let's say, by adding a string attached to a code block)?

Also, could there by a way to delete just some text for that script (for when I want to "reset" the script to its default state)?

Thanks in advance.

sentences:
Perlin Noise Problem with Falloff I know this might be a bit of a noob question, but I can't figure out what I'm doing wrong, and the math that I have done should make this work correctly. I am trying to make a perlin noise map that is normal until a specific range, at which point it would decrease to where all the values trend towards zero, creating an island in an ocean. I am currently generating perlin "sample" values, and then dividing them by a factor which stays close to one up to a specific bound, and then increases polynomialy. The problem however, is that the noise stays stuck in the top right corner, and is darker than I would expect. Here is the mathematical function I am using graphed on Desmos where n is the boundary and x is the distance from the center of the map:

And here is the main body code I am using to generate the noise map:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenNoise : MonoBehaviour {

public int width = 256;
public int height = 256;

public float scale = 20f;

public float offsetX;
public float offsetY;

public float falloffRange = 100;
public float falloffPower = 10;

public void RenderNoiseMap()
{
    Renderer renderer = GetComponent<Renderer>();
    renderer.sharedMaterial.mainTexture = GenerateTexture();
}

Texture2D GenerateTexture () {
    Texture2D texture = new Texture2D(width, height);

    for (int x = 0; x < width; x++)
    {
        for (int y = 0; y < height; y++)
        {
            Color color = GenerateColor(x, y);
            texture.SetPixel(x, y, color);
        }
    }

    texture.Apply();
    return texture;
}

Color GenerateColor(int x, int y)
{
    float xCoord = ((float)x / width * scale) + offsetX;
    float yCoord = ((float)y / height * scale) + offsetY;
    float falloffFactor = FalloffFactor(x, y, width, height);

    float sample = Mathf.PerlinNoise(xCoord, yCoord);
    sample = sample / falloffFactor;
    return new Color(sample, sample, sample);
}

float FalloffFactor(int x, int y, int width, int height)
{
    float falloffFactor = 1;
    float centerX = (float)width / 2;
    float centerY = (float)height / 2;

    float distanceFromCenter = Mathf.Sqrt(Mathf.Pow(2, ((float)x - centerX)) + Mathf.Pow(2, ((float)y - centerY)));
    falloffFactor = Mathf.Pow(2, (Mathf.Pow(falloffPower, (distanceFromCenter / falloffRange)) + 1));

    return falloffFactor;
}
}

And Here is the code that I am using to generate the image in the editor:

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(GenNoise))]
public class NewBehaviourScript : Editor {
public override void OnInspectorGUI()
{
    DrawDefaultInspector();

    GenNoise script = (GenNoise)target;
    if (GUILayout.Button("Generate"))
    {
        script.RenderNoiseMap();
    }
}

}

Here is a picture of the result:

sentences:
Determine when a PIXI texture is loaded to clone it I'm in the latest PIXI v5, where my texture is made like let texture = PIXI.Texture.from(TEXTURE_URL).

The texture isn't loaded synchronously- Pixi just covers this up. That would be fine but when I try to apply a frame, the following error is thrown because the texture has no dimensions because it isn't loaded yet. I have no way of determining whether it's loaded or not!

Error: Texture Error: frame does not fit inside the base Texture dimensions: X: 8 + 8 = 16 > 0 and Y: 0 + 8 = 8 > 0

How can I get a promise for when a Pixi texture is loaded or clone it anyway?

sentences:
Basic equation for pure metallic reflectance I'm working on a live wallpaper that shows a pure metallic object. Since it's a live wallpaper, I can make a ton of approximations...this isn't a full blown scene in a game world. My shader only has to support this one material. People won't expect extreme detail, etc. So, for example, I don't even bother with diffuse since a pure conductive material barely has any.

So I'm trying to implement a reflective conductive surface that pulls the reflection from a cubemap representing the lighting environment. On a very basic level it looks like this:

vec3 fresnelSchlick (vec3 f0, float cosTheta)
{
    return mix(f0, vec3(1.0), pow(1.0 - cosTheta, 5.0));
}

//...
float NdV = dot(normal, viewDir);
vec2 brdf = texture2D(u_brdf, vec2(u_roughness, NdV)).rg; // from a LUT

vec3 reflection = textureCube(u_cubemap, reflect(viewDir, normal));
gl_FragColor = reflection * (fresnelSchlick(materialColor, NdV) * brdf.x + brdf.y);

The problem with my simple math here is that the range of possible final pixel colors does not produce a proper-looking range of hues. Suppose my material color is #0050ff and the environment is monochrome white. Then all of the possible colors that could be seen are:

This doesn't allow for bright looking reflections at the light sources in the envmap. I found this example material render for comparison. The cubemap in the example here is close to monochrome white. But at the bright areas of the reflection, there is a lot of red component in the color.

With my limited range of colors, my object looks dull and lifeless. Can anyone point out what I'm missing in my equation?

sentences:
Render-to-texture doesn't work on nvidia cards. OpenGL 3.3 I've implemented some postprocessing effects (DOF, HDR, Bloom) into my engine. I've tested it on AMD card which supports OpenGL 4.2. Yesterday I've made a test on NVidia card which supports only OpenGL 3.3. I tried to write my code to works also in OpenGL 3.3 but I was suprised when I saw something like on the screen:

It seems that textures are filled with random values and never change during app life (only when I'm changing dimensions of textures so basically recreate them). It happens mostly when I want downscale texture to some size (I use 2 textures to do that and a shader). Here is some examples of my code which implements Bloom effect:

Creating framebuffer:

if (!_p_buffer)glGenFramebuffers(1, &_p_buffer); // generate postprocess buffer
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _p_buffer);

    for (int i = 0; i < 2; i++){
        _lens[i].create(x / D.lensDownsample(), y / D.lensDownsample(), 0, IMAGE_16F_3, IMAGE_2D, true, FILTER_LINEAR); // create Lens Flare texture (with half resolution)
        glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT2 + i, GL_TEXTURE_2D, _lens[i].get(), 0);
    }

Render-to-texture:

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _p_buffer);

// first downsample image
glDrawBuffer(GL_COLOR_ATTACHMENT2);
glClear(GL_COLOR_BUFFER_BIT);

glActiveTexture(GL_TEXTURE0);
_aux[_aux_number].lock();

Shaders["ScaleBias"].set(true);
Shaders["ScaleBias"].set("scale", Vector4(1.2f));
Shaders["ScaleBias"].set("bias", Vector4(-0.4));
Shaders["ScaleBias"].set("texelSize", Vector2(1 / (float)D.x() * D.lensDownsample(), 1 / (float)D.y() * (float)D.lensDownsample()));

glViewport(0, 0, D.x() / D.lensDownsample(), D.y() / D.lensDownsample());
Quad();

ScaleBias shader:

void main() {
    FragColor = max(vec4(0.0), texture(col, gl_FragCoord.xy*texelSize) + bias) * scale;
}

What "create" method actually does here:

if(!_image)glGenTextures(1, &_image);

glBindTexture(GL_TEXTURE_2D, _image);

glTexParameteri(_gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(_gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(_gl_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(_gl_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(_gl_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, x, y, 0, GL_RGB,GL_FLOAT, NULL);

I used debug extension to check if there is any invalid parameters but debuging shows nothing interesting. I tried make G-Buffer textures as GL_FLOAT but they works ok. I tried make shader as simple as possible (return color texture) but error still was valid. I've observed similar problem on newer NVidia cards but the only difference was that textures are clear (black). But they still didn't update. Framebuffer doesn't output any errors.

Could you point me out the cause of this bug or give some clue?

sentences:
Is it legal to develop a game using other games skill names/flavor/mechanic? I am starting to develop a new game and i'm thinking about using some names for some features coming from other games (such as WoW and D&D).
I have already read this Is it legal to develop a game using D&D rules? and i know about Beholders and Mind Flyers (before reading this question) which i'm not going to use anyway in my game (neither specific D&D rules nor those monsters) and i'm not going to use an aready existing game system as i'm developing mine (which will use some classical RPG concepts but will have its unique flavor, at least i hope so...).

What i'm interested in is to know if i can legally use names those games use for skills, statistics, classes, enemies and so on...

I'm not talking about classic names such as Wizard, Mage, Warrior but more specific names you will find almost exclusively in that game (such as Bladesinger, Charisma, Power Attack or Warbringer...which apparently is a metal band and a monster in WoW and nothing else), these features won't be an exact copy of what you can find in other games, but will inherit just the "flavor" (sometimes not even that) of that feature

for example can i make a skill called "Power Attack" which gives you more damage per attack but a lower chance to hit (which is similar to D&D's power attack, though not exactly the same since mine will have a fixed % of damage increase and lowered chance to hit)?
What if this skill gives you more damage when using a weapon two-handed (which is a key feature of D&D's power attack in the 3.5 edition)?

I am aware that those are simple words and they can't be under copyright, what i'm more worried about is the flavor of a skill, statistic and so on and using a mechanic very similar to those found exclusively in other games

sentences:
Triangulation of "polygon with holes" for NavMesh Just for fun, I am working on a little side-project: As a first step, I want to be able to build a grid-based world (think Dungeon Keeper), generate a nav-mesh for this world and then let agents wander around it. I've already done plenty of googling and ended up following the instructions given in the answer to this gamedev question: How can I generate a navigation mesh for a tile grid?

Now, I've completed step 1 in that I now have iso-lines representing the outlines of the walkable area. This could look like this:

The blue lines are the generated outlines of the walkable area. As you can see, in this case there is one walkable areas defined by two lines because the area is a circle.

This is where I'm stuck: If it were a regular polygon I'd probably be able to implement some sort of triangulation algorithm (there's plenty of examples on the net, I guess), but how do I go about this case? Do you have any pointers for me?

sentences:
Why won't my integer go down when my function is called? I'm trying to implement a limited-use slow-mo power into my game using C#, but I can use it infinitely. Why won't my integer go down when my function is called?
using UnityEngine;

public class TimeManager : MonoBehaviour
{
    public float slowdownFactor = 0.05f;
    public float slowdownLength = 2f;
    public int slowmos = 5;

    private void Update()
    {
        Time.timeScale += (1f / slowdownLength) * Time.unscaledDeltaTime;
        Time.timeScale = Mathf.Clamp(Time.timeScale, 0f, 1f);
    }

    public void SlowMo()
    {
        if (slowmos != 0)
        {
            Time.timeScale = slowdownFactor;
            Time.fixedDeltaTime = Time.timeScale * .02f;
            slowmos--;
        }
    }
}

------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
------------------------------------------------------------------------

public class charcterMovement : MonoBehaviour
{
    public TimeManager timemanager;
    public Rigidbody rb;
    public float forwardForce = 1000f;
    public float rightForce = 100f;
    public float leftForce = -100f;

    // Start is called before the first frame update
    void Start()
    {
        rb.useGravity = true;
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        rb.AddForce(0, 0, forwardForce * Time.deltaTime, ForceMode.VelocityChange);
        //Set Speed To Cube

        if (Input.GetKey("d"))
        {
            rb.AddForce(rightForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
        }

        if (Input.GetKey("a"))
        {
            rb.AddForce(leftForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
        }

        if (Input.GetKey("space"))
        {
            timemanager.SlowMo();
        }
    }
}

sentences:
Question about CDLOD quad tree I have been digging and researching into CDLOD and there are some things I dont understand.

https://github.com/fstrugar/CDLOD/blob/master/cdlod_paper_latest.pdf states:

  The quadtree structure is generated from the input heightmap. It is of
  constant depth, predetermined by memory and granularity requirements.
  Once created, the quadtree does not change unless the source heightmap
  changes. Every node has four child nodes and contains minimum and
  maximum height values for the rectangular heightmap area that it
  covers.

Doe's this mean I calculate every node and child nodes to the finest level at the setup phase (i do not split and unsplit at run)? If so, what's the roughest level I start with? And how do I get the minimum and maximum height from my perlin noise height map for an node area?

Lastly how CDLOD would work, when I zoom in/out into a big planet (up factor)? Can get that into my imagination.

sentences:
How to implement Meshlab's rotation manipulator? I want to implement a rotation handle/manipulator mechanism that would enable user to rotate a 3D model exactly like Meshlab does.

Unfortunately I don't fully understand how does the rotation gizmo work. In particular I don't understand how to make the model rotate only around the Z axis. Open Meshlab and try rotating only the blue circle to see what I mean. Rotations around the X and Y axis are easy to understand for me though.

How does one recreate the rotation mechanism of Meshlab, i.e. how exactly does horizontal and vertical panning translate to changes in angles?

sentences:
Will I have an easier time learning OpenGL in Pygame or Pyglet? (NeHe tutorials downloaded) I'm looking between PyGame and Pyglet, Pyglet seems to be somewhat newer and more Pythony, but it's last release according to Wikipedia is January '10. PyGame seems to have more documentation, more recent updates, and more published books/tutorials on the web for learning.

I downloaded both the Pyglet and PyGame versions of the NeHe OpenGL tutorials (Lessons 1-10) which cover this material:

lesson01 - Setting up the window
lesson02 - Polygons
lesson03 - Adding color
lesson04 - Rotation
lesson05 - 3D
lesson06 - Textures
lesson07 - Filters, Lighting, input
lesson08 - Blending (transparency)
lesson09 - 2D Sprites in 3D
lesson10 - Moving in a 3D world

What do you guys think? Is my hunch that I'll be better off working with PyGame somewhat warranted?

sentences:
Orthographic Viewport whose bounds are equal to screen Window bounds? Ive been rattling my head trying to figure out how to do this. I am not working on a 3D application so I did not expect to need to understand transforms, projections, or viewports.

Essentially what I want to do is to setup my viewport, view, & projection so that whenever I call GraphicsDevice.DrawPrimatives() the values of the VertexPosition's position can be pixel values. For example, If I wanted to draw a rectangle that bordered the screen I would do:

VertexPositionColor[] vertices = new VertexPositionColor[5];
vertices[0] = new VertexPositionColor(new Vector3(0, 1080, 0), Color.Red);
vertices[1] = new VertexPositionColor(new Vector3(1920, 1080, 0), Color.Red);
vertices[2] = new VertexPositionColor(new Vector3(1920, 0, 0), Color.Red);
vertices[3] = new VertexPositionColor(new Vector3(0, 1080, 0), Color.Red);
vertices[4] = new VertexPositionColor(new Vector3(0, 1080, 0), Color.Red);

As of right now, if i do:

VertexPositionColor[] vertices = new VertexPositionColor[5];
vertices[0] = new VertexPositionColor(new Vector3(-1, 1, 0), Color.Red);
vertices[1] = new VertexPositionColor(new Vector3(1, 1, 0), Color.Red);
vertices[2] = new VertexPositionColor(new Vector3(1, -1, 0), Color.Red);
vertices[3] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Red);
vertices[4] = new VertexPositionColor(new Vector3(-1, 1, 0), Color.Red);

I get:

How do I set it up so that my VertexPosition coordinates are 1:1 with pixels?

sentences:
Moving and rotating to a position with forces and impulses Carrying on from this question, I'm still stuck trying to implement the behaviour mentioned in this tutorial. My movement has improved slightly thanks to the help I received:

But the character still does this weird loop after reaching one of the waypoints.

AiSystem::steerToNextNode() is the relevant function that I'm having the problem with. It's the one doing the rotation with impulses:

//a few possibly non-obvious things:
//angle = npcBody->body()->GetAngle()
//angularVelocity = npcBody->body()->GetAngularVelocity()
//inertia = npcBody->body()->GetInertia()
//pos = npcBody->getWorldCenter()
//targetPos = nextNode->pos()

#define DEGTORAD 0.0174532925199432957f
#define RADTODEG 57.295779513082320876f

void AiSystem::steerToNextNode(ComponentEntity *npc, QSharedPointer<Action> action) const
{
    Path *path = action->path();
    Q_ASSERT(!path->isEmpty());

    QSharedPointer<PhysicsComponent> npcPhysics = npc->component<PhysicsComponent>();
    Box2dBody *npcBody = npcPhysics->body();
    QSharedPointer<PathNode> nextNode = path->front();

    if (!isNextToTargetPos(npc, nextNode->pos())) {
        // We're not close enough to the next node (waypoint); keep going.
        // The following code is based off this tutorial: http://www.iforce2d.net/b2dtut/rotate-to-angle
        float desiredAngle = MathUtils::cartesianDirectionTo(npcBody->getWorldCenter(), nextNode->pos());
        desiredAngle = qDegreesToRadians(desiredAngle);

        // Take the current angular velocity into aaccount, as it affects future time steps.
        float frequency = 60.0; //Hz
        float nextAngle = npcBody->body()->GetAngle() + npcBody->body()->GetAngularVelocity() / frequency ;
        float totalRotation = desiredAngle - nextAngle;

        while ( totalRotation < -180 * DEGTORAD ) totalRotation += 360 * DEGTORAD;
        while ( totalRotation >  180 * DEGTORAD ) totalRotation -= 360 * DEGTORAD;
        float desiredAngularVelocity = totalRotation * frequency;
        // Allow 10 degrees of rotation per time step, to achieve a gradual turn.
        float change = 10 * DEGTORAD;
        desiredAngularVelocity = qMin(change, qMax(-change, desiredAngularVelocity));
        float impulse = npcBody->getInertia() * desiredAngularVelocity;
        npcBody->applyAngularImpulse(impulse);

        // This applies a force in the direction of the current angle (npcBody->body()->GetAngle()).
        PhysicsSystem::moveForward(npcPhysics);
    }
    // unrelated stuff...
}

I've also included functions that it uses in case I'm doing something wrong there:

float MathUtils::cartesianDirectionTo(const QPointF &source, const QPointF &target) {
    QPointF toTarget(target.x() - source.x(), target.y() - source.y());
    float facingTarget = MathUtils::clampAngle(qRadiansToDegrees(atan2(toTarget.y() * -1, toTarget.x())));
    return facingTarget;
}

static float32 stupidForce(float32 mass)
{
    return mass * 15.0f;
}

void PhysicsSystem::moveForward(QSharedPointer<PhysicsComponent> physicsComponent)
{
    float32 force = stupidForce(physicsComponent->body()->getMass());
    float rotation = physicsComponent->body()->rotation();
    QPointF directionVector = MathUtils::directionVector(qDegreesToRadians(rotation));
    physicsComponent->body()->applyForce(directionVector * force, physicsComponent->body()->position());
}

bool AiSystem::isNextToTargetPos(ComponentEntity *npc, const QPointF &targetPos) const
{
    const Box2dBody *npcBody = npc->component<PhysicsComponent>()->body();
    return MathUtils::fuzzyCompare(npcBody->getWorldCenter(), targetPos, mPathFinder.targetLeniency());
}

Can anyone spot any mistakes?

sentences:
Depth texture white in shader I am trying to implement shadow mapping into my project and am stuck at this problem: If I'm reading the shadow map values with glReadPixels and linearize those values, I am getting exactly the value I was looking for: ranging from 0 to 1. But when I am doing the exact same calculation in my shader, everything, where I rendered an object, is white.
Another thing I noticed(which i assume is directly linked to my problem) is that if I am changing glClearDepth to anything different than 1, the output of my shader is black and the output of glReadPixels after linearizing is not anymore the value I wanted but anything else.

Here is the code where I am creating the depth texture:

glBindTexture(GL_TEXTURE_2D, _textures[GBTEXTURE_DEPTH]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);

glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _textures[GBTEXTURE_DEPTH], 0);

And here is the fragment shader:

in vec2 fragUV;
uniform sampler2D tex;

float zfar = 1000.0f;
float znear = 1.0f;

float linearize(float depth)
{
    return (-zfar * znear / (depth * (zfar - znear) - zfar)) / zfar;
}

out vec4 finalColor;
void main(void){
    float depth = texture2D(tex, fragUV).r;
    depth = linearize(depth);

    finalColor = vec4(depth);
}

I am doing the exact same calculation on the CPU, with correct values as a result.

I hope I described my problem with enough details for you to help me.

sentences:
How do I get data from a WWW object without freezing my game? I am using Unity 3d to create a real time multiplayer game. I have a database set up that keeps track of player statistics and what in app purchases they have purchased. I have written a Database class that is used to access my database via php scripts. It all works pretty well, but I run into problems when I try to get values from the database and it doesn't return quick enough. My assumption is that I need to use a coroutine in order keep letting it run so that I can eventually get the value. How exactly would I do that though?

This is the code I currently have:

public string GetValue(string id, string valid)
{
    string hash = Md5Sum(string.Format("{0}{1}{2}", id, valid, secretKey));
    string url = string.Format("{0}id={1}&vid={2}&hash={3}", getValue, id, valid, hash);
    WWW www = new WWW(url);
    while (!www.isDone) { }
    return www.text;
}

I figured that by adding the while loop in the middle it would always return a value but it doesn't seem to work that way. Should this be in a coroutine? And if so how would I get my value back from it compared to how I currently do it where it just returns the string value I wanted.

sentences:
Beat detection and FFT I am working on a platformer game which includes music with beat detection. I am currently detecting beats by checking for when the current amplitude exceeds a historical sample. This doesn't work well with genres of music, like rock, which have a pretty steady amplitude.

So I looked further and found algorithms splitting the sound into multiple bands using FFT...  then I found the Cooley-Tukey FFt algorithm

The only problem I'm having is that I am quite new to audio and I have no idea how to use that to split the signal up into multiple signals.

So my question is :

How do you use a FFT to split a signal into multiple bands ?

Also for the guys interested, this is my algorithm in c# :

// C = threshold, N = size of history buffer / 1024
    public void PlaceBeatMarkers(float C, int N)
    {
        List<float> instantEnergyList = new List<float>();
        short[] samples = soundData.Samples;

        float timePerSample = 1 / (float)soundData.SampleRate;
        int sampleIndex = 0;
        int nextSamples = 1024;

        // Calculate instant energy for every 1024 samples.
        while (sampleIndex + nextSamples < samples.Length)
        {

            float instantEnergy = 0;

            for (int i = 0; i < nextSamples; i++)
            {
                instantEnergy += Math.Abs((float)samples[sampleIndex + i]);
            }

            instantEnergy /= nextSamples;
            instantEnergyList.Add(instantEnergy);

            if(sampleIndex + nextSamples >= samples.Length)
                nextSamples = samples.Length - sampleIndex - 1;

            sampleIndex += nextSamples;
        }

        int index = N;
        int numInBuffer = index;
        float historyBuffer = 0;

        //Fill the history buffer with n * instant energy
        for (int i = 0; i < index; i++)
        {
            historyBuffer += instantEnergyList[i];
        }

        // If instantEnergy / samples in buffer < instantEnergy for the next sample then add beatmarker.
        while (index + 1 < instantEnergyList.Count)
        {
            if(instantEnergyList[index + 1] > (historyBuffer / numInBuffer) * C)
                beatMarkers.Add((index + 1) * 1024 * timePerSample);
            historyBuffer -= instantEnergyList[index - numInBuffer];
            historyBuffer += instantEnergyList[index + 1];
            index++;
        }
    }

sentences:
OpenGL interleaved position and normal data I have an OpenGL question!

Say I have data, interleaved in the format

[vec3 normal, vec3 vert1, vec3 vert2, vec3 vert3]

all stored in one VBO (one set per triangle).
My vertex shader would have the following attributes:

in vec3 normal;
in vec3 position;

Is it possible to extract the data this way? Or would I need to duplicate the normal for each vertex (eg. [vec3 normal, vec3 vert1, vec3 normal, vec3 vert2, vec3 normal, vec3 vert3])?

sentences:
Get vector3 position of Cursor on a fixed 2D plane within a 3D scene How is it possible to get a cursors X and Y Location relative to the scene planes rather than using co-ordinates based upon pixels of screen height and width?

I have the start of a very basic game, picture with a few physical aids shown below.

I want to find out how far away the cursor is on the X and Y axis from an object in the scene.
The Z axis is irrelevant due to the nature and orientation of the game, so z = 0. (Note that in Unity, the Y axis is vertical)

Basically, the distance of the cursor from the cube on the X Axis upon clicking will define the power of an action.

Because of this. I want to get the cursor X position relative to the 0 point of the scene ( or the object ), not relative to the bottom left corner of the screen.

I could then use Vector3.Magnitude() to get the distance.

How is this possible?

sentences: Is it legal to publish a Noughts and crosses (tic-tac-toe) game? Is it be legal to publish a Noughts and crosses game?

sentences:
Player experience using a server in single player adventure to prevent cheating I'm making a game where the user can sell items he finds during the the "single player" adventure on an online, I was looking at ways to prevent any malicious user to create rare and expensive items from scratch to sell them on the net.

I tried obfuscation but soon or later someone will successfully break into my code and I can't afford that, for obvious reasons.

Items are stored in files, so I thought about making client add a digital signature to generated files but I have to keep the key on the client machine, so same problem: if someone finds his key he can apply digital signature algorithm to generate the valid key for any file he creates.

So I ended up think the only secure option was to make the single player adventure interact with the server (everyone around here tends to say this is the way to go, like this subject, in my opinion the accepted answer explains it well).

But what about the user-friendly aspect?

My game is divided in two parts. Firstly the "real" single player adventure, where you can cheat all you want because everything is stored on your pc and server won't ever use it (~24h), then you beat the final boss and you're notified you're able to go online to battle against other players with the stuff you acquired on the single player map. At this point of the adventure, my idea was to record everything the player is doing in singleplayer mode onto the server, so whenever he plays a tournament, his stuff is verified.

I can't verify stuff just before a tournament begins because overpowered items can be obtained but are very rare, I want to systematically know if it was hardly-obtained or cheated.

Do you think it would be acceptable for a player to play "single player mode using internet" if he was told this will allow him later to rank up online and be

The single player map will be kind of mixed with the multi player area, but maybe I can think about a feature to play totally offline but then you won't be able to use your "online items" during this time.

EDIT: My app might outputs txt file (representing an item) with its corresponding digital signature, so I just need a way to be sure that it's my app (and not a modified copy) that has created a given file. That's why I'm reading about Trusted computing and Memory curtaining right now, but maybe I should head to security.stackexchange?

sentences: Does bad AI lead to more sales? Games like HL2 and FEAR are legendary for having excellent AI. Recent titles (as of 2018) leave much to be desired. With improvements in our understanding of probability related state machines, and general machine learning (or AI as it's called sometimes) improves, it generally feels many commercial titles forego the development of good AI. Anecdotally, I have personally experienced in recent titles (where the AI is dumb as per say - far cry, wildlands, etc.). I feel having dumb AI may sell games more (giving a more accomplished feeling, pushing players towards multiplayer, etc.). So, let me pose the question, does any research show that bad AI leads to more sales?

sentences:
How to rotate to a target position over time I know how to do rotations to vectors, but how do I rotate over time?

For instance say I made a function

RotateTo(vec2 iPosition, float iTime);

so it rotates to iPosition over iTime - how would this look? Does anyone know simple algorithm?

sentences:
Check every body's position and delete or not (box2d performance specific) I have a simple game with a platform (a ground that's not infinitely long). During the game I have about 10-30 balls on average that'll fall off the platform. There's gravity so I think they'll keep falling until the end of the game. My question is should I put a function that check if position within boundary in the render() function,  render() function is called in every frame. Or should I leave those balls falling. And let box2d keep on calculating their speed and velocity etc?

So basically I'm wondering which cost less, checking every body's position or calculating dropping object's velocity and position. I think they happen with same frequency, once per frame.

Or is this trivial for 10-30 balls and I can ignore it?

sentences:
If "ResourceManager" classes are considered bad, what are the alternatives? I'm hearing conflicting opinions such as:

"Dedicated Manager classes are almost never the right engineering tool"
"Dedicated Manager classes are (currently) the best way to survive a large project with thousands of resources"

Let's take a classic ResourceManager class that has the following functionality:

Loads assets (textures, audio, 3D models, etc)
Ensures assets are only loaded once by keeping a cache
Reference counts assets to determine if they can be deallocated
Hides where the actual assets came from (e.g., could be one file per asset, or all assets in one package file, or assets could even be loaded over the network)
Can reload assets without restarting the program, which is extremely useful for the artists working on the game.

Let's also take the "singletons are bad" argument off the table by pretending these ResourceManager objects are not singletons, and instead are passed around via dependency injection.

Then there is the "use a factory" or "call it a factory" argument. My problem with this is that, yes, it is a factory, but it's also a cache and a reloader (for lack of a better word). Calling it a factory doesn't describe it properly, and if I make it a proper factory then where does the caching and reloading get implemented?

I agree that "Manager" classes are often a symptom of bad architecture, but in this particular case how could it be restructured and still retain all of the functionality? Is this a situation where a "Manager" class is actually appropriate?

sentences:
PlayerPrefs.SetInt Stops code below from running This is the code...

void storeStarData()
{
    // Code to store star data in PlayerPrefs...
    Debug.Log("Writing to PlayerPrefs");
    PlayerPrefs.SetInt("totStars", NumOfStars);
    int i = 0;
    Debug.Log("test");
    while (i < NumOfStars)
    {
        PlayerPrefs.SetString("starID" + i, StarIDID[(i)]);
        PlayerPrefs.SetString("starName" + i, StarName[(i)]);
        PlayerPrefs.SetString("starHIP" + i, StarIDHIP[(i)]);
        PlayerPrefs.SetString("starHD" + i, StarIDHD[(i)]);
        PlayerPrefs.SetString("starHR" + i, StarIDHR[(i)]);
        PlayerPrefs.SetString("starGL" + i, StarIDGL[(i)]);
        PlayerPrefs.SetString("starBF" + i, StarIDBF[(i)]);
        PlayerPrefs.SetString("starRA" + i, StarRA[(i)]);
        PlayerPrefs.SetString("starDec" + i, StarDec[(i)]);
        PlayerPrefs.SetString("starMag" + i, StarMag[(i)]);
        PlayerPrefs.SetString("starCI" + i, StarCI[(i)]);
        Debug.Log("star " + i + " complete");
        i++;
    }
    PlayerPrefs.Save();

    i = 0;
    int ok = 0;
    while (i < NumOfStars)
    {
        if (PlayerPrefs.GetString("starID" + i) != null)
        {
            ok++;
        }
        i++;
    }
    Debug.Log(ok);
}

And this is the Debug.Log output that I am getting...

As you can see, the program gets up to the First Debug Log Debug.Log("Writing to PlayerPrefs"); But then stops before the Debug.Log("test");.

After removing PlayerPrefs.SetInt("totStars", NumOfStars); The program gets to the Debug.Log("test");. So it is the PlayerPrefs.SetInt causing the issue.

How do I fix this?

sentences:
1:1 mapping of texels to pixels with DX11 and multisampling and linear interpolation Is it possible to get a 1:1 mapping of texels to pixels on a multisampled target in DX 11 with interpolation? It seems to me that the texture coordinate used in the shader is always one of the sub-pixels, not the center of the post-MS-processed pixel on my NVIDIA driver. With the reference renderer, however, the texture is correctly read from the center of the texels, which leads me to assume that my texture and point coordinates are correct.

This is, of course, only a problem when I enable some form of continuous interpolation. Point sampling easily circumvents the problem, so this is more out of curiosity.

I was just wondering if this is implementation-defined or possibly a hardware/driver bug? The issue makes it somewhat harder to implement correct GUI rendering, because you can no longer turn off multisampling via the rasterizer state in DX11 feature levels, and this small offset leads to bleeding-in of the neighboring elements in my texture atlas.

sentences:
How to find and manipulate a line on a mesh? In Unity I currently have a script that allows me to "grab" a vertex, move it, and then update the mesh accordingly. How would I grab a line (which is basically grabbing two vertices I think) and move it?

I have read the manual (the scripting reference on Unity's site) but I can't really seem to figure out how to go about doing it. I got a lot of help with the initial script that lets me grab and move a vertex but I, unfortunately, am in need of guidance on how to extend its functionality to do what I described above.

For reference here are how things currently are working. Linked it because it says my gif is too big. Below is the functionality I'd like to add (hover over for text for further explanation).

So how would I go about doing this? Also for the sake of keeping my project stable, I'm using Unity 5.3.2f1 but converting new to old code shouldn't be that big of a deal (or so I hope). Also I'mn doing this all at runtime.

sentences:
How can I make a GameScreen? I want to make game level select screen.

There are some stages which open, and some that are not.

So if you clear a second stage and quit the game for a while, when you come back, you can start at stage 3, 2 or 1 whatever you can click, but not from stage 4; you can't play it without completing stage 3.

I want to make something like this, but I have no idea how. What should I use to do it (boolean, database...)?

Can you give me some simple code structure?

sentences:
Unwanted begincontact callbacks at high velocity I'm having some issues with jump detection due to begincontact. I have a player entity made of 2 bodies, and it looks something like this:

Note how the circle below (a body connected via a revolute joint) is not quite as wide as the rectangle. This means that when the player is up against a wall, there is no contact between the circle and the wall.

However, if the player collides with a wall at high velocity, begincontact registers a contact between the circle and the wall. Is there any way around this?

sentences:
Affect of timeStep on PhysicsBodies in SceneKit In SceneKit, I had a problem on collision of two dynamic spheres, when the one strikes to another with fast speed, it was passing through inside of it. After i have reduced physicsWorld.timeStep value from 1/60 to 1/300, collision of Spheres becomes perfect. However in this moment, if sphere strikes to static wall, it started to slide along the wall (like sticky) instead of being reflected from wall. Ball started to lose so much energy after colliding to wall.

When timeStep was 1/60, ball was bouncing on the wall even in so low speeds, instead sticking to wall. What kind of parameters are affected in physicsBody of the wall or ball by the timeStep?

Wall Parameters;

let ballMass: CGFloat = 0.08
physicsWorld.timeStep = 1/300

let wallGeometry = SCNPlane(width: (maxX - minX), height: wallHeight)
wallGeometry.firstMaterial?.diffuse.contents = UIColor.red
wallGeometry.firstMaterial?.isDoubleSided = true
let shapeWallGeometry = SCNPhysicsShape(geometry: wallGeometry, options: nil) //su an lik bir ise yaramiyor

let wallNode = SCNNode(geometry: wallGeometry)

wallNode.position = SCNVector3( x: Float(xCenter), y: Float(minY-cushionHeight/2), z: Float(cushionHeight)/2 )

wallNode.physicsBody = SCNPhysicsBody(type: .static, shape: shapeWallGeometry)
wallNode.physicsBody?.restitution = 0.82
wallNode.physicsBody?.friction = 0.91

wallNode.physicsBody?.categoryBitMask = PhysicsCategory.WallType.rawValue | PhysicsCategory.GravityType.rawValue
wallNode.physicsBody?.collisionBitMask = PhysicsCategory.BallOneType.rawValue | PhysicsCategory.BallTwoType.rawValue | PhysicsCategory.BallThreeType.rawValue | PhysicsCategory.GravityType.rawValue
wallNode.physicsBody?.contactTestBitMask = PhysicsCategory.BallOneType.rawValue | PhysicsCategory.BallTwoType.rawValue | PhysicsCategory.BallThreeType.rawValue
self.rootNode.addChildNode(wallNode)

sentences:
Problem with Factory Method Pattern when I try to create a Weapon:MonoBehaviour I'm learning about Design Patterns using Unity and I'm not sure about how to solve the following problem with the Factory Method Pattern:

I want to read a XML file and using the Factory Method Pattern to create a Component (a Weapon) to add it to a GameObject which will be cointained on a Pool Manager, but Weapon "Is A" MonoBehaviour and for that reason It can't be instantiated using a "machineGun = new MachineGun();"

public abstract class WeaponFactoryMethod
{
    protected string fileName = "weapons.xml";
    public abstract Weapon CreateWeapon();
}

public class MachineGunFactoryMethod : WeaponFactoryMethod
{
    public override Weapon CreateWeapon()
    {
        string filePath = Path.Combine(Application.streamingAssetsPath, fileName);
        Weapon machineGun = null;
        XmlReader xmlReader = new XmlTextReader(filePath);
        if (xmlReader.ReadToDescendant("Weapons"))
        {
            if (xmlReader.ReadToDescendant("Weapon"))
            {
                do
                {
                    // I CAN'T DO THIS:
                    machineGun = new MachineGun();
                    machineGun.ReadXml(xmlReader);
                } while (xmlReader.ReadToNextSibling("Weapon"));
            }
            else
            {
                Debug.LogError("There aren't definition for Weapon");
            }
        }
        else
        {
            Debug.LogError("There aren't definition for any Weapon");
        }

        return machineGun;
    }
}

public abstract class Weapon : MonoBehaviour, IXmlSerializable
{
    public float AttackRange { get; set; }
    //Every weapons Shoots in a different way
    public abstract void Shoot();

    //Serialization
    public XmlSchema GetSchema()
    {
        return null;
    }

    public void ReadXml(XmlReader reader)
    {
        XmlReader childReader = reader.ReadSubtree();
        while (childReader.Read())
        {
            switch (childReader.Name)
            {
                case "AttackRange":
                    childReader.Read();
                    AttackRange = childReader.ReadContentAsInt();
                    break;
            }
        }
    }

    public void WriteXml(XmlWriter writer)
    {

    }
}

public class MachineGun : Weapon
{
    public override void Shot()
    {
        //Raycasting..
    }
}

At the end I want something like

GameObject (player)
 - Component (A Weapon script with the data from the xml)

Should I just create a GameObject (player) and do an "AddComponent < MachineGun >" and later copy the info from the xml file instead using the Factory Method Pattern??

Is there a better way??

Any suggestions, corrections or advice will be very grateful.

I'm sorry by my English.

sentences:
How can I apply a glow filter in Phaser? I'm trying to get the following effect, but as far as I know, a filter is the only sensible way.

Imagine some objects and background, and a fire ball passing through. The fireball glows. All objects (not the background) become brighter in color where they are under that glow. The glow effect could be described as a glow around a missile's fire.

This should be built-in to Phaser, as pixi.js has it.

sentences: Number of Impressions on Admob for Revenue Just curious for a rough estimate; how many impressions would it take to make 300 dollars, a day, in ad revenue?

sentences:
Unity3D GUI - what exactly it does when create controls and check their statuses? On unity3d website in the manual on this page: http://unity3d.com/support/documentation/Components/gui-Controls.html

I found an example of "GUI.changed" function usage(below). And it looks like it creates toolbar object on every frame. Am I right or not?

/* GUI.changed example */

// JavaScript
private var selectedToolbar : int = 0;
private var toolbarStrings = ["One", "Two"];

function OnGUI () {
    // Determine which button is active, whether it was clicked this frame or not
    selectedToolbar = GUI.Toolbar (Rect (50, 10, Screen.width - 100, 30), selectedToolbar, toolbarStrings);

    // If the user clicked a new Toolbar button this frame, we'll process their input
    if (GUI.changed)
    {
        print ("The toolbar was clicked");

        if (selectedToolbar == 0)
        {
            print ("First button was clicked");
        }
        else
        {
            print ("Second button was clicked");
        }
    }
}

sentences:
Box2dWeb: must fixtures be destroyed explicitly when destroying the body? I use b2WorldObj.DestroyBody(bodyObj) to destroy the body when it is not needed anymore. The body has one fixture attached to it.

Do I need to destroy the fixture before destroying the body? or should I assume that by destroying the body all its fixtures will be automatically destroyed?

Right now, I do not destroy the fixtures explicitly and the game runs fine. But my concern is more about memory leaks. I want to make sure that all the bodies and fixtures that are not used anymore are completely removed from the memory. How can I best achieve this?

Thanks!

sentences:
3D model exported from Maya behaving weirdly I have some 3-4 3D character models which are claimed to be exported with the same configuration from Maya by the 3d designers. Now, some of the models(animations) is working fine in Humanoid settings and not working in Generic mode and vice versa. The one which is working in Humanoid seems to have only one of its feet as crooked up. Though in maya, everything seems to work perfectly fine.

Now if there was some issue with the configurations while exporting, then it has to affect both its feet and not just one. I have also checked the T-Pose and automap settings in the Unity and everything seems to be fine.

Suppose for character A, all the animations work with Humanoid settings, then in Generic, for all animations it is kind of idle in a T-pose structure and do nothing not even simple walk animation.

I have been using Unity v5.0.1.

Please, if anyone could come up with any help would be highly appreciated.

sentences: Is There a Way to See Code Inside DnD Actions in Gamemaker Studio? I'd like to see the script inside the Drag & Drop actions in Gamemaker Studio. I figure it would be one of the easiest ways to learn GML, and generally a great reference, but I haven't come across any mentions of how to do that; is there a way?

sentences:
UNITY - Huge amount of GRAPHICS in RTS Tiled game after year of development and week of unsuccessful optimization I turn for a help from you, guys.

So, my game is turn-based strategy with hexagon map.
One hexagon consists of one texture for hexagon tile type and seven subtiles, which carry spriterenderer with graphics like piece of town. So if soldier steps on the subtile, the graphics of subtile hide.

On good machines like mine, if I zoom out maximally (45 orthographic size) on 1920x1080 and have visible around 18x16 tiles I get solid 160-200 FPS at MAX details, but on my laptop I barely get 25FPS on 1280x720 and LOW details. Each tile has resolution of 636x499.

I have tried:

Simple shader on SpriteRenderer supporting transparency, just merging    texture with color (This had those best results of 160-250FPS at    HIGH-END and 25FPS on LOW-END)
Creating separate material for each    subtile and replacing SpriteRenderer with Quad mesh, so those    subtiles are statically batched or GPU batched (but I guess they did    not batch at all, because frame debugger showed that sometimes more    fo the same pieces got rendered and then sometimes just one)

So this is just the 50x50 game, when I start large map, like 120x100, it's not really that worse, so I think the problem is just in the graphics and not in the amount of objects.

What are your suggestions I should try to get better performance on LOW-END devices? Do you think that manual GPU-instancing would make it faster? I think, there would be a lot of trouble maintaining which graphic to render and which not.

sentences:
Problem with Ogre::Camera lookAt function when target is directly below I am trying to make a class which controls a camera. It's pretty basic right now, it looks like this:

class HoveringCameraController
{
public:

   void init(Ogre::Camera & camera, AnimatedBody & target, Ogre::Real height);
   void update(Ogre::Real time_delta);
private:
   Ogre::Camera * camera_;
   AnimatedBody * target_;
   Ogre::Real height_;
};

HoveringCameraController.cpp

void HoveringCameraController::init(Ogre::Camera & camera, AnimatedBody & target, Ogre::Real height)
{
   camera_ = &camera;
   target_ = &target;
   height_ = height;

   update(0.0);
}

void HoveringCameraController::update(Ogre::Real time_delta)
{
   auto position = target_->getPosition();
   position.y += height_;
   camera_->setPosition(position);
   camera_->lookAt(target_->getPosition());
}

AnimatedBody is just a class that encapsulates an entity, it's animations and a scene node. The getPosition function is simply forwarded to it's scene node.

What I want(for now) is for the camera to simply follow the AnimatedBody overhead at the distance given(the height parameter), and look down at it. It follows the object around, but it doesn't look straight down, it's tilted quite a bit in the positive Z direction. Does anybody have any idea why it would do that?

If I change this line:

position.y += height_;

to this:

position.x += height_;

or this:

position.z += height_;

it does exactly what I would expect. It follows the object from the side or front, and looks directly at it.

sentences:
How can I achieve a good fire effect with alpha blending and particles? Using the following setting for the OpenGL particle effect:

SRC: GL_SRC_ALPHA
DST: GL_ONE

Creates an additive blend, which looks spectacular on a black background but terrible on brighter colours, as it begines to fade to white.

I then used alpha blending:

SRC: GL_SRC_ALPHA
DST: GL_ONE_MINUS_SRC_ALPHA

This allows other backgrounds to be used without affecting the color of the particles, but the particles themselves look dull compared to the additive blend.
How can I achieve a good fire effect with alpha blending and particles?

Additive:

Alpha:

UPDATE:

Following David's advice below, I created a separate texture and then used additive blend on the particle effect before drawing onto the texture. The problem with that is that drawing on an alpha=0 texture resulted in just the coloured parts of the particle appearing in front of my world map, since normally you have a black background instead. The trick was to use two textures. I created a black texture and then drew the particles on it. Then I removed the alpha layer of the particles from this texture, effectively removing all the surrounding solid black and fading out the partially visible particles, while leaving the underlying black as you'd expect when making additive blend particles on a black background. In short, a gruelling process, but I got there eventually:

Here's the thread where I posted my process: http://www.cocos2d-iphone.org/forum/topic/28707?replies=8#post-141528

Video: http://www.youtube.com/watch?v=JptGbEO3b5E

sentences:
How to decide how many textures to break an object into? So I am making a couple spacecraft in my game.  And I want them to look sharp and as photorealistic as possible.

How can I decide if a certain craft should be broken into multiple meshes to each have its own texture based on its size?

Is there a rule?  Like if you are using 4096 size  textures. Obviously a bicycle could be a single mesh with 1 texture.

But what about a small sports car?  An SUV?  A dumptruck?

sentences:
Voice input in games beyond voip chat Is there any cross platform libraries available for handling input from a microphone?

I am thinking beyond voice chat to noise / voice recognition.

I am putting together a plan for a role playing game and in thinking of features I was thinking it would be nice if the player could be standing in a crowded place and yell and have the npc's react to that and look at the player for example.

As I plan to make this an open source project I want to make it as cross platform friendly as possible.

sentences:
How can I identify feature regions in a procedurally generated world? I'm building an Island. I use the classical heightmap solution : with a hill-building function, avoiding the corners of the map, I make altitude. Then, perlin noise give me some climatic variables to handle the biomes.
Now, I'm facing two challenges who are, in some way, connected :

In Dwarf Fortress, one of the neat aspects of world generation is how the game seems to "know" areas, and give them names, though they are not rectangular shapes. I would like to be able to "recognize" my forests, my rivers, my hills... any idea what kind of algorithm I could use to scan my map and interpret its areas ? And how would you store that ? I'm using a basic C++ graph made out of a vector of vector of "tiles object".
This Island should be divided in political areas, not only purely natural regions. I could use mountains and rivers to make "natural borders", but my procedurally generated map doesn't garantee I will have nice "enclaves" that would form a kingdom ; I could find myself having a gigantic "ribbon-formed" political areas surounded by micro-kingdoms.
Another possibility would be to look for appropriate areas for a city or a castle. Then, "grow" a political area around it. But there again, I'd like to have some well-known algorithms before trying to devise my own.

This question could be interpreted as a bit too vague, so one way of rephrasing it would be : how to partition (without modifying !) a procedurally generated world into areas suitable for gameplay ? Thanks in advance for your help.

sentences:
How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile I know that in OpenGL I can do something like this

glReadBuffer( GL_FRONT );
glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer );

And its pretty fast, I get the raw bitmap in _buffer.
When I try to do this in DirectX. Assuming that I have a D3DDevice object I can do something like this

if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer))) {
   HResult hr = D3DXSaveSurfaceToFileA(filename, D3DXIFF_BMP, pBackbuffer, NULL, NULL);

But D3DXSaveSurfaceToFile is pretty slow, and I don't need to write the capture to disk anyway, so I was wondering if there was a faster way to do this.

EDIT: I am targeting only DirectX applications. Actually DX9 apps. I am doing this through a hook to Present. (I am using Detours if that is relevant), and I am doing this for every frame. I don't need (or want) a particular bitmap format like BMP PNG JPEG etc, and a colorspace of RGB24 is OK. Getting it as YUV480p would be better but definitely not necessary. Thanks everyone for the very helpful answers

sentences:
2D Platform character getting "unaligned" with the map I'm trying to make a 2D Platform game and so far I can have my character moving around in a tiled map and collisions are working too. So far so good.

The problem I'm having is that the character can get "unaligned" with the map if I spawn it without double checking the X coordinate. This means that, on certain conditions, the character could walk over a small gap (just large enough for it to fit in) on the floor.
This happens because the X speed is a constant value, so in one frame the character is standing before the gap but the next frame it's past the gap.

I can solve it by simply making sure the spawning coordinates will be aligned with the map (and the X speed allows it since the tile size is a multiple of it), but it does sound like a fishy solution to me since I may want to add power-ups in the future that increase the speed.

So I'm wondering if I'm missing something on how characters should move or maybe I should actually just double check the spawning coordinates? Or maybe it is a normal thing to happen in a game??

sentences:
How to pass array of dozens of floats to OpenGL 3.0 vertex shader? I use PyOpengl and Python 3.

I have 50 thousand vertices. Position of each vertex could be calculated in vertex shader as

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];
in vec3 v_coefficients[COEFFICIENTS_AMOUNT];
in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position + v_coefficients * coefficients_weights;
}

Amount of coefficients varies between 0 and 199 — it's not a problem  for me to generate 200 vertex shaders to cover each situation.
I need to change position of vertices tens of thousands times per application calls as fast as it's possible, so I cannot calculate them once on start.

Though, I cannot provide arrays for each vertex because documentation says:

  Attribute variables cannot be declared as arrays or structures.

I see following solutions of this issue:

(will not work) hardcode suffices of variables names to emulate arrays:

use vectors with names like coefficients_000, coefficients_001, ..., coefficients_199;
use matrices to have 4 vectors in each of variable — will it be better than previous solution with vectors (maybe performance of matrices product is faster than 4 products of vectors)?

calculate vertices positions by myself using C/NumPy;
calculate vertices positions by myself in parallel using OpenCL;
(will not work) store all coefficients in uniform int v_coefficients[COEFFICIENTS_AMOUNT*VERTICES_AMOUNT] and access needed ones according to vertex number, which will be stored in in int vertex_id;
store coefficients in textures (proposed by @HolyBlackCat).

Are there any other solutions of my issue? Is there optimal solution in proposed above?
Will I go out of memory if I will use 200 float 3-vectors for each vertex?

I imagine the solution with hardcoded indices as:

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];

in vec3 v_coefficients_000;
in vec3 v_coefficients_001;
...
in vec3 v_coefficients_199;

in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position
        + v_coefficients[0] * coefficients_weights_000
        + v_coefficients[1] * coefficients_weights_001
        + ...
        + v_coefficients[199] * coefficients_weights_199;
}

sentences:
Instantiation of multiple objects with varying velocities I am looking to multiple objects of the same prefab at the same time with varying velocities.

public GameObject prefab;
public float xDirection;
public float yDirection;
void Update () {
        GameObject prefab1 = Instantiate
        (prefab,transform.position,quaternarion.identity) as GameObject;
        GetComponent<RigidBody2D>().velocity = new Vector2 (xDirection,yDirection);
}

I want to create three instances at once, but have the x/y direction be different. I am looking at creating an instance at three separate velocities. I know I can do something like this using

void Update () {
if (Input.GetKey(KeyCode.space)){
    xDirection = 1f;
    yDirection = 1f;
    shootObject();
    xDirection = 2f;
    yDirection = 2f;
    shootObject();
    xDirection = 2f;
    yDirection = 2f;
    shootObject();
    }
}
void shootObject () {
    GameObject prefab1 = Instantiate
        (prefab,transform.position,quaternarion.identity) as GameObject;
        GetComponent<RigidBody2D>().velocity = new Vector2 (xDirection,yDirection);
}

but I feel like there is something else that I should be able to do to simplify this even further since this seems to be very messy code.

(I apologize if something seems a little odd. Have only been coding for around a few weeks.)

Thank you for the help!

sentences:
How can I generate a 2D mountain landscape procedurally? Every level in my game needs to have a different mountain landscape background generated automatically (but the landscape must be the same for each level).

How could I generate such a landscape procedurally? Maybe fractals?

Note: I am using LibGDX and Java on Android

sentences:
Circle to Circle collision, checking each circle against all others I'm currently coding a little circle to circle collision demo but I've got a little stuck. I think I currently have the code to detect collision but I'm not sure how to loop through my list of circles and check them off against one another.

Collision check code:

public static Vector2 GetIntersectionDepth(Circle a, Circle b)
    {
        float xValue = a.Center.X - b.Center.X;
        float yValue = a.Center.Y - b.Center.Y;

        Vector2 depth = Vector2.Zero;

        float distance = Vector2.Distance(a.Center, b.Center);

        if (a.Radius + b.Radius > distance)
        {
            float result = (a.Radius + b.Radius) - distance;
            depth.X = (float)Math.Cos(result);
            depth.Y = (float)Math.Sin(result);
        }

        return depth;
    }

Loop through code:

        Vector2 depth = Vector2.Zero;

        for (int i = 0; i < bounds.Count; i++)
            for (int j = i+1; j < bounds.Count; j++)
            {
                depth = CircleToCircleIntersection.GetIntersectionDepth(bounds[i], bounds[j]);
            }

Clearly I'm a complete newbie, wondering if anyone can give any suggestions or point out my errors, thanks in advance. :)

sentences:
How about fitting into gaming industry with Design and Development mindset and seeking for a masters degree? Might be the question is a bit weird but that's what I'm focused on and want to discuss about obtaining a masters degree to fulfill my dreams to work as both designer and developer.

I work as a programmer with 5 years of experience and I code in C, C++, C#. Back home I design Application UX, Logo, Banners, Website graphics, Write small software for personal needs or friends and yes I like to play games.

Now, holding a bachelor degree in Computer science and professional experience I want to opt for a Masters degree abroad(probably in Europe) with focused subject(may be Game design/development). Now my problem is that I do not like to do a formal Computer science masters as it would be a traditional process of learning computer systems. As well as I don't like mathematics in dept, having said that I do use calculation and business logic a lot in my programs but I'm not very much fond of them. So basically I'm a design creativity guy with developer mindset. I developed quite a few windows applications on my own and some of them are live on Softpedia.

So I like to pursue my future with the mix of both. Is there any way for me to fit into game industry? If not what would be better for me rather than continue only programming job profile?

sentences:
Can you write the current frame number to a text file? I am running an experiment in Unity 5 to see the effect increasing the particles of a particle effect has on FPS over time. (this is background work for a much larger piece of work). Currently I write the FPS count from the profiler to a log file and this shows the framenumber and its FPS at that frame. To a seperate log file I write the number of particles on screen and the time.

I have no way of linking these two files to draw up results.

So my question is, how do I write the current framenumber to a file? Can I do this?

UPDATE

I would like the same framenumber that the unity Profiler gives me in its log.

sentences:
Generating shaders from fragments / HLSL Dynamic Linking in older shader models In shader model 5 is a feature called dynamic linking which separates hlsl fragments by using interfaces and their methods implemented in classes.

I don't have any experience with this technique, my program uses about 10 shaders (10 separated files *.hlsl) and there are some identical parts in different shaders. So it will be good for me to separate a common logic (light for example) to its own file and just use it from other shaders.

I was always fascinated by modern game engines and their development kits capable of composing these shader fragments together by simple clicking in some internal editor. So a developer can create very complex scenes this way - choose materials, lights, particles, animations, etc. and it's very cool and productive I guess. If I omit some graphical editor and a sophisticated logic behind it, it is pretty what I want to achieve, isn't it? Just on a code level.

So with hlsl's dynamic linking in shader model 5 I have some idea how it can be done, but what about older shader models? When there was no shader model 5, what technique did engines use?

sentences:
Using unity app how to read the asset in android SDCard? I am trying to read one file from my android sd card from my unity application, but its not reading.

using the asset bundle i have exported my file and kept in my android device sd card  and i am trying to fetch it and show into my scene.

Here is the code i have used for this:

public string URL;
public string URLAndroid = Application.persistentDataPath+/cube.unity3d;
public string AssetName;

private string path;

IEnumerator Start() {

    //path = System.IO.Path.Combine (Application.persistentDataPath, "/cube.unity3d");

    // Download the file from the URL. It will not be saved in the Cache
    using (WWW www = WWW.LoadFromCacheOrDownload(URLAndroid, 1)) {
        yield return www;

        if (www.error != null)
            throw new Exception("WWW download had an error:" + www.error);

        AssetBundle bundle = www.assetBundle;

        if (AssetName == "")
            Instantiate(bundle.mainAsset);
        else
            Instantiate(bundle.LoadAsset(AssetName));

        // Unload the AssetBundles compressed contents to conserve memory
        bundle.Unload(false);

    } // memory is freed from the web stream (www.Dispose() gets called implicitly)
}

Here i have used the URLAndroid as a normal downloading method and  ihave tried to fethch the model using system.io method but its not happening.
I have created the corresponding folder in my android device and kept my assets eventhough its not happening.

Plesae help me to solve this issue.

sentences:
How to make goalKeeper move within post but not move towards to the player? Hello so basically I make a 2d top-down soccer game but I have to trouble with GK AI, I want to GK is followed the ball but not move toward on it
let say (Enemy = GK)

so when the player moves to the left or right the enemy will follow to the right or left not The Yaxis but in X-axis with guarding the post or Y=0
my default enemy movement is like this :
if (gameObject.CompareTag("GK"))
        {

            anim.SetBool("GKRun", false);
            gkballInRange = Physics2D.OverlapCircle(transform.position, gkballRange, playerMask);
            float distancePlayer = Vector2.Distance(target.position, transform.position);

            if (gkballInRange)
            {
                if (distancePlayer <= gkballRange)
                {
                    //Animation
                    anim.SetBool("GKRun", true);
                    transform.Translate(0, -speed * Time.deltaTime, 0);
                }
            }

        }

in that scrip, when the ball is on the range the GK is moving to the ball just that. maybe anyone can explain to me how to do it?

sentences:
Detect which tile in a tile palette a player is colliding with I have a megaman-style platformer that I've been working on for a while now. I'd like to have my scene set up so that when a player interacts with certain tiles, it will have some sort of effect on the player.

This could easily be achieved with creating individual sprites for the aforementioned interactables, but I'd ideally like to be able to have a portion of my script handle it so that everything besides the player and enemies would be tilemaps.

For instance, I have a tile that would act as a treadmill that moves the player along in one direction. Another tile would be bouncy, and another would deal damage.

I have the game set up right now to detect when the player is touching a tile, but I have no way of being able to tell which tile the player is touching. Is there a way to be able to compare programmatically which tile from a tile palette my player's hitbox is currently touching?

sentences:
How to show part of the world scaled to screen size? I have a world size of 100x100
I want to map this world size to screen size using this mapTo function
function mapTo(pos, from, to) {
  let n = pos / from;
  return n * to;
}

Now I want to show only a portion of this world scaled up to the screen size, let's call it view size of 10x10 now how should I map this world size of screen size with regards to view size?
I want to show 10x10 world units fit the whole screen.
I've tried to do:
let aWorldPosition = [0, 0];

let worldSize = [100, 100];
let viewSize = [10, 10];
let screenSize = [20, 20];

let r = mapTo(aWorldPosition, worldSize, viewSize);
r = mapTo(r, viewSize, screenSize);

but that doesn't work.
Also I want to be able to move the view so I can show portions of the world.
I've tried this and seems to be working but I don't know if it's correct:
let r = mapTo(aWorldPosition, viewSize, screenSize);

Here viewSize is in world coordinates.

sentences:
CS:GO workshop awp skin scrambles I was starting make my awp skin, but I was wondering that my skin at CS:GO looks bit different than on photoshop. So I came here for help. I will show just a test skin (fully red).

First I was save my skin with photoshop to .tga format (32 bits/pixel).

Then importing to VTF editor, but not changing any of these settings, they are default.

After that I checked only "No Level Of Detail", "No Mipmap" and "SRGB".

Opening CS:GO and workshop, awp is not fully red, there is some scrambles.

I hope for solution. :)

sentences:
Game (Physics) work in Unity Editor/Remote but won't on Android? I have a script attached to a car game object that allows the player to tap the screen and then accelerate, the game object has a RB2D and collider set to it , it works fine in Unity Remote , but when I download the APK , as soon as I tap the screen , collisions go completely bezerk and the car just starts ignoring collisions , what's going on? As I need this to work to complete my game , as the player can move side to side with the accelerometer but I also want them to move forward when they touch the screen. Also , my game is 2D. Plus , since then , when the car ( my object) collides with anything else in the scene , it ignores it ( the obstacles just have Box Colliders on them). I had to freeze rotation so it could stop spinning out when it hit soemthing , now it just won't recognize collision at all. What's going on?
The code I think is causing the error starts at line 32. I have obstacles the player has to dodge and they all have box colliders and an appropiate script attached to them as well ( so when they collide with my player , it destroys it)

I've figured it out , Collision works when I first start the game , but when the player dies and I press "Replay" , it goes crazy. Here's the script that controls the enemy cars spawning , what the hell do I do to fix this?

 Code (CSharp):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyCar : MonoBehaviour {
public float speed ;
public float acceleration = 0.5f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
    speed += Time.deltaTime * acceleration;
    transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime);

}
void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Coin")
    {
        Destroy(col.gameObject);
    }
}
}

I've done everything in the book trying to solve this , re-install unity , add different colliders etc. What's weirder is that it is FLAWLESS in Unity Remote and the Editor , these issues only arise when I test out the apk.

Here's how my game usually looks when the collisions work.

Now when it collides with a car ( on android) , it just ignores it and is slightly pushed back.

Help me!

Here is my script attached to enemy cars ( the cars that should destroy the player on Collision)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyCar : MonoBehaviour {
    public float speed ;
    public float acceleration = 0.5f;
 // Use this for initialization
 void Start () {

    }

    // Update is called once per frame
    void Update () {
        speed += Time.deltaTime * acceleration;

        transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime);

 }
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Coin")
        {
            Destroy(col.gameObject);
        }
    }
}

Also here is the inspector view of my Player Car

Here is the inspector view of an enemy car ( they all have the same things)

sentences: Why doesn't my android application rotate when I rotate my screen I am building a game in LibGDX and the game screen orientation is in landscape. I want it to stay in landscape but I still want the user to be able to flip the device onto the other side and the screen will rotate with it. My application refuses to do that and I don't know what to do to fix that. I tried turning on my accelerometer and compass (wasn't expecting anything from compass) but nothing changed. Any ideas?

sentences:
Compressing game save data I'm writing a game that needs to save a lot of detailed data (exact trajectories of some entities) to an external file. I want to save drive space and bandwidth by compressing it, but I've never done this, so I don't know if there is a preferred way to do it.

Of course the compression-decompression should not affect the speed of the game too much.

sentences:
E_FAIL: An undetermined error occurred (-2147467259) when loading a cube texture I'm trying to implement a skybox into my engine, and I'm having some trouble loading the image as a cube map.  Everything works (but it doesn't look right) if I don't load using an ImageLoadInformation struct in the ShaderResourceView.FromFile() method, but it breaks if I do.

I need to, of course, because I need to tell SlimDX to load it as a cubemap.  How can I fix this?

Here is my new loading code after the "fix":

public static void LoadCubeTexture(string filename)
{
    ImageLoadInformation loadInfo = new ImageLoadInformation()
    {
        BindFlags = BindFlags.ShaderResource,
        CpuAccessFlags = CpuAccessFlags.None,
        Depth = 32,
        FilterFlags = FilterFlags.None,
        FirstMipLevel = 0,
        Format = SlimDX.DXGI.Format.B8G8R8A8_UNorm,
        Height = 512,
        MipFilterFlags = FilterFlags.Linear,
        MipLevels = 1,
        OptionFlags = ResourceOptionFlags.TextureCube,
        Usage = ResourceUsage.Default,
        Width = 512
    };
    textures.Add(filename, ShaderResourceView.FromFile(Graphics.device, "Resources/" + filename, loadInfo));
}

Each of the faces of my cube texture are 512x512.

sentences:
How do I add corner tiles to infinitely generated terrain base tiles? I have a tileset as seen on the right and they make the images seen on the left:

In game I have placed the full grass and full stone tiles for each chunk (infinitely generated) using perlin noise as seen in the image below:

I am trying to find a way to determine what corner tiles to use and then place them.  As you can see there is so many possibilities that I don't know how to do it.  Using Lua with love2d engine by the way.

This question is different.  Everything I read about bitmasking with corners says that you need at least 48 tiles or more in a set to do corners.  I am wondering how and if it is possible to use the tile set at the right which doesn't need this many tiles to make any possible shape.  It only uses 14 original plus 2 existing tiles.  Here is a image of what tiles are used in bitmasking.

sentences:
Animal Crossing-like Map Data Structure I've been looking closely at how Animal Crossing (for GameCube) creates town maps, and as far as I can tell, it's something like this:

The town is made up of a 5x6 grid of acres. Each acre is 16x16 "tiles" in size.

That's the easier part. As for the actual map generation, it seems to use what I'll call "acre templates." That is, the acres seem to be selected somewhat randomly from a predefined list, with predefined layouts. So there are, for example 2 different layouts of what an acre containing the Museum will look like.

Or if an acre has a river running through it, top-to-bottom, there might be 3-4 different templates of how the river flows through that acre, with optional ponds nearby, etc.

The question is... What is a good suggestion or method for how to organize the data structure to handle all of this?

Another thing to keep in mind is that there's a "second layer" of objects on top of the basic terrain info, such as trees or rocks or inventory objects dropped/buried on/in the ground. How would I store that information in relation to the acre templates?

sentences:
Collision 100% avoidance implementation I'm an absolute beginner with game development and all I know about collision avoidance/resolution, I learnt it on or through this site in the past week... so don't hesitate to correct me if what I'm asking here is based on wrong assumptions / misunderstanding. I tried of my best to be clear, but that said, the subject is still novel to me.

Vehicles

In my game, I have vehicles that move autonomously. They are placed in a 3D space, and their motion is governed by a number of variables which are different for each vehicles. The one of interest here are primarily:

Only forward motion.
A speed that can vary between min & max, but whose min is not (even close to) zero.
A steering radius that is dependent from the speed (the higher speed, the larger radius)
Two maximum accelerations (for decreasing and increasing speed)

Goal

My goal is to implement some sort of AI that will a 100% accurate collision avoidance (i.e. I will be sure that the vehicles will never ever collide).

Design

Although I would prefer more the idea of having the AI "onboard" (i.e. each vehicle having it's own "collision avoidance AI", eventually querying and/or sending messages to other vehicles) it is also possible for me to implement the CA AI at a central level (dispatching commands to the vehicles).
In most of the cases, the vehicle will simply have to steer clear of each other in any direction, but under certain circumstances, they will have to avoid collision and going towards the same target

What I found so far and where I got stuck

Within the many many links I found in other questions on this very site, I found of particular use these ones:

Collision between pool balls
Unalligned collision avoidance
Queuing

While these three links "opened my eyes" in many ways, it is not immediately clear to me how to use that information in my case. In particular article #2 only "tries" to prevent collision (but collisions do happens time to time). While article #3 needs to stop vehicles sometimes to prevent collisions.

What I also noticed, is that the collision avoidance algorithms linked above use a "instant projection" of linear speed to check if something is on the way of the vehicle. I was wondering if this is enough in my case or if I had to project my position in a more realistic way (e.g.: If I am 60° into a steering 90° to the right, I should calculate my position for the rest of the 30° of the curve, and then assuming linear motion).

Finally, I am particularly afraid of deadlocks. In other words: although the density of vehicles in the world will be fairly low, I am worried that given a certain numbers of vehicles converging towards the same point, once they will realise they are on a collision course, any evasive manoeuvres will be impossible as it would bring the vehicle on a collision path with some other ones.

Question

How can I reach my "goal"? An in depth-explanation is of course very much appreciated, but links to external resources would also be of great help (I'm sure I'm not the first with this problem, but probably I used the wrong keywords to search the web?)

Thank you in advance for your help!

sentences:
What is an actor in game development? I am reading a book about game development (Game Coding Complete, Fourth Edition) and there is an "Actors" topic which just explains how to use them briefly instead of explaining what it is.

Here's how the book introduces these actors:

  Games are full of objects that bring your world to life. A World War
  II game might be full of tanks and planes, while a futuristic science
  fiction game might have robots and starships. Like actors on a stage,
  these objects are at the heart of the gameplay. It seems fitting that
  we call them “game actors” because that’s exactly what they are.

  A game actor is an object that represents a single entity in your game
  world. It could be an ammo pickup, a tank, a couch, an NPC, or
  anything you can think of. In some cases, the world itself might even
  be an actor. It’s important to define the parameters of game actors
  and to ensure that they are as flexible and reusable as possible.

  There are as many ways for defining a game actor as there are games.
  Like everything else in computer programming, there is rarely a perfect solution.

I could only understand a very few things: it is an abstraction of everything in the game which can perform actions; it has it's own state; it's behaviour is usually implemented as a state machine. This is it. I am coming with systems programming background to the game development, and so I would like to know in general, what the actor is in game development meaning, how to use it, how it is used in general, what problem it solves, how and why. I would like the explanation to be such that a kid could understand.

I have tried to find this information on google but it heads me to another "actors" instead: concurrent programming most of the time or game actors but without a good explanation of it.

sentences:
Language agnostic game programming books Possible Duplicates:
  Game programming books that don't teach programming?
  Must read game development books

Does anyone know any good language independent game programming books?

I don't currently know anything about game programming or practices - any good books on stuff like: scene-graphs, handling sprites, layers, collision detection, effects, events?

I'm a college student without the time to learn a new language so the concepts need to be language-agnostic enough they can fit into the languages I know: Javascript, Python, Scheme/Lisp and some light Vala (I'm considering using HTML5 or PyGame). I would use C# books but my OS is Linux and I don't know about the whole mono thing when most C# books use XNA.

Also I know that game programming is an extension of general programming, but I think I've got that down. Like is there a cookbook of some sort?

sentences:
Rotate a particle system Languages / Libraries in use: C++, OpenGL, GLUT
Okay, here's the deal.
I've got a particle system which shoots out alpha blended textures to produce a flame. The system only keeps track of very basic things such as, time alive, life, xyz and spread.
The direction in which the flames are currently moving in is purely based on other things which are going on in my code ( I assume ).
My goal however, is to attach the flame to the camera (DONE) and have the flame pointing in the direction my camera is facing (NOT WORKING).
I've tried glRotate for both x,y,z and I can't get it to work properly.
I'm currently using gluLookAt to move the camera, and get the flame to follow the XYZ of the camera by calling glTranslatef(camX, camY - offset, camZ);
Any suggestions on how I can rotate the direction of the flame with the camera would be greatly appreciated.
Heres an image of what I've got: http://i.imgur.com/YhV4w.png

Notes: Crosshair depicts where camera is facing
if I turn the camera, flame doesn't follow the crosshair
Also asked here: https://stackoverflow.com/questions/9560396/rotate-a-particle-system
but was referred here

sentences:
Using custom functions in HLSL shaders generates extra insructions? We use forward rendering so our main shader is pretty big (342 instructions). Recently I tried substituting every single custom function I call in the shader with the actual code from that function and the number of instructions generated dropped down to 311.

Am I doing something wrong with my custom functions? I tried passing variables into them with various predicates (in/inout/out/[nothing]) but it did not change the number of instructions even though Microsoft claims every instruction in HLSL is inlined.

UPDATE:
Example code:

void DirectionalLight(half4 Normal,
                half3 DirectionToCamera,
                half4 Combined,
                inout half2x3 light)
{
    half3 halfVector = normalize(DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    light[0] += DirectLight1.Color*lightParams.r;
    light[1] += DirectLight1.Color*litV.b;
}

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    DirectionalLight(Normal, input.DirectionToCamera, Combined, DirLightAccum);
    ...
}

Or this code:

half2x3 DirectionalLight(half4 Normal,
                half3 DirectionToCamera,
                half4 Combined)
{
    half2x3 light = (half2x3)0;
    half3 halfVector = normalize(DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    light[0] += DirectLight1.Color*lightParams.r;
    light[1] += DirectLight1.Color*litV.b;
    return light;
}

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    DirLightAccum += DirectionalLight(Normal, input.DirectionToCamera, Combined, );
    ...
}

Both generates 342 instructions. But the following code:

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    half3 halfVector = normalize(input.DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    DirLightAccum [0] += DirectLight1.Color*lightParams.r;
    DirLightAccum [1] += DirectLight1.Color*litV.b;
    ...
}

Only generates 339 instructions. Heavier functions (with more variables passed) generate more instructions. As I mentioned, when substituting ALL the functions with their actuall bodies I was able to reduce instruction count by 10%.

I tried making CastShadow a float function so that I can get rid of the "inout half shadow" argument but does not help.

I am just trying to figure out if it's a norm or I am doing something wrong?

sentences:
Optimizing isometric drawing function I need help optimizing my Draw(); function to draw only what is visible in the viewport. Currently I'm drawing the whole Map array in a diamond shape. How can I make my function store only what is visible?

Here is an image explaining it better:

Black tiles are X axis, White tiles Y axis. Green tiles are what I would like the function to store, and the Orange rectangle is the viewport.

I'll include the relevant part of my code aswell:

for(i=0;i<Map.length;i++) {
for (j=0;j<Map[i].length;j++) {
tileX = (i - j) * (tile.width / 2);
tileX += (canvas.width /* 2*/) - (tile.width / 2);
tileY = (i + j) * (tile.height / 2);
tileY -= (canvas.height /* 2*/);

    c.drawImage(tile, tileX, tileY);
}
}

I've been trying to figure out how to solve this, but since I'm no genius I can't. Help appreciated.

sentences:
Camera chasing player I want the camera to follow the player and lag a little bit and then catch up with the player when the player halts. When stopped the player is in the center.

At the moment im at the point where i get the camera to move with the player but i dont know how to get the lag effect!

On the camera object

    void Update () {
    var newX =  player.transform.position.x;
    var newZ =  player.transform.position.z;
    var y = transform.position.y;
    transform.position = new Vector3(newX, y, newZ);
}

sentences:
Is there a free and open source 3D engine for Android? Is there a free and unlimited open source 3D engine for Android? Something that is a direct, thin layer to the NDK?

I have only found two engines: Unity and Shiva 3D. But no free or open source ones.

sentences: Specific Physics Lessons and Reference for Game Development What "Physics stuffs" should I learn in game developments? I'm reading about Verlet Integration, and I'm wondering what other lesson should I learn and if there are available resources can you please provide some link or anything. Thanks.

sentences:
How do you restrict sideway movement in 3D endless runner in Unity? I have been making a endless runner 3d game and implemented 3 lane side way movement. It's working perfectly, although I want to restrict my movement for the 3 lanes only. If my character for example say on left lane, If I press left again it should not move to the side anymore since there's not lane beyond the left one. I did implemented a logic for this, though when I press either left or right in the borders of the lanes it freezes the side way movement. Any idea on how to stop this. This is my code.

PlayerMortor.cs

     private bool isChangingLane = false;
     private Vector3 locationAfterChanginLane = Vector3.zero;
     private Vector3 sideWayMovementDistance = Vector3.right * 2f;
     private float sideWaySpeed = 6f;

     void Update()
        {
            currentBaseState = anim.GetCurrentAnimatorStateInfo(0);

            if (controller.isGrounded)
            {
                verticalVelocity = -0.5f;
                if (currentBaseState.fullPathHash == locoState)
                {
                    if (Input.GetButtonDown("Jump"))
                    {
                        verticalVelocity = 18f;

                        anim.SetBool("Jump", true);
                    }
                }

                MoveLeftRight(); //Call sideway movement on update()

                if (isChangingLane)
                {
                    if (Math.Abs(transform.position.x - locationAfterChanginLane.x) < 0.1f)
                    {
                        isChangingLane = false;
                        moveVector.x = 0;
                    }
                }
            }
       }

    private void MoveLeftRight() //Sideway Movement function
    {
        if (controller.isGrounded && !isChangingLane)
        {
            isChangingLane = true;

            if (Input.GetKeyDown(KeyCode.A))
            {
                locationAfterChanginLane = transform.position - sideWayMovementDistance;
                moveVector.x = -sideWaySpeed;
            }
            else if (Input.GetKeyDown(KeyCode.D))
            {
                locationAfterChanginLane = transform.position + sideWayMovementDistance;
                moveVector.x = +sideWaySpeed;
            }
        }
    }

    private void OnControllerColliderHit(ControllerColliderHit hit) //Restriction when we move sideways beyond border
    {
        if (hit.collider.gameObject.tag == "Border")
        {
            Debug.Log("Border Hit");
            isChangingLane = false;
            moveVector.x = 0;
        }
    }

Any help would be appreciated. :)

sentences:
Access a Private GameObject in Unity Hope you bear with me, I'm a beginner! Maybe I should've paid better attention to the tutorials but they all seem to use public variables/game objects that we can then drag into using the Unity Editor. However, if I have a private Game Object, how can I reference that programatically? I have the following:

private GameObject menuCanvas;

void Start()
{
menuCanvas = GameObject.Find("menuCanvas");
menuCanvas.SetActive(false);
}

Where the menuCanvas is named such in the Unity editor. However, I usually get the following error:

"The variable menuCanvas of myScript has not been assigned."

myScript is attached to a different GameObject in the scene, but not attached to menuCanvas. What am I doing wrong? Thanks for the help!

Edit: another question - which is generally better to use?

Edit 2: Hi guys, I figured it out. I had to move some code around to the Awake() function, so it looked like this:

private GameObject menuCanvas;

void Awake()
{
menuCanvas = GameObject.Find("menuCanvas");
}

void Start()
{
menuCanvas.SetActive(false);
}

And that worked. I realized that myScript was attached to multiple objects, which would cause the menuCanvas to be set inactive more than once (but it could not be referenced inactive).

S. Tarık Çetin's answer worked just as well! Thanks for the help

Edit 3: As Jesse Williams answered, an internal definition keeps the variable hidden from the editor, but it can still be assigned via code.

sentences: Rules to start and naming a game studio I would like to know if there is any copyright related rules to name a game studio specially for android appstore. I searched at the U.S. Copyright Office website and found many matches for same names. None of them are game studios though. Is it legal to choose one of those names if none of them are game studios? Also, what are the rules I need to know for starting a new indi game studio?

sentences: How to use setInterval and clearInterval I have a game that I am making and cannot seem to get the setInterval and clearInterval methods to work.  When I debug it in the browser console it shows that the method is still being called over and over again. I am wondering how can I get it to actually stop and then restart afterwards without going faster than it was before (which often happens with setInterval and clearInterval).  Notice that when it goes back to the menu, and you click Start again that the timer is running multiple times on the money. Any help is much appreciated, please take a look at this fiddle demo: http://jsfiddle.net/Xn4qT/

sentences:
Script executes fine but randomly crashes with NullRefferenceExpectation using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Zombie_Spawn : MonoBehaviour
{
    public float timer = 0.0f;
    public bool m_spawn = false;
    public GameObject m_Zombie;
    Vector2 pos;

    void Update()
    {
        if (m_spawn == true)
        {
            timer += Time.deltaTime;
            if (timer > 2.0f)
            {
                pos = Camera.current.ViewportToWorldPoint(new Vector2(1f, 0.135f)); //this executes fine but will Null out randomly
                Instantiate(m_Zombie, pos, Quaternion.identity);
                timer = 0;
            }
        }
        else
        {
            timer = 0f;
        }
    }
}

sentences:
Unity: Failed to capture screen shot? I am capturing screenshots at every time step in unity using ScreenCapture.CaptureScreenshot. I am able to get the shots captured and saved in a certain folder but after approximately 50 timesteps the unity crashes and I get an error : Failed to capture the screen shot. Sometimes, unity crashes after 50 time-steps and sometimes after 70 time-steps, so crashing is random.
P.S I am running my unity simulation on the guest VMware virtual machine, I have already looked into the storage and it is more than needed.

sentences:
Render only a cross-section of a 3D scene in Godot I'm working on a 3D game where I sometimes want to display only a cross-section of the scene.  Ideally I would like this to be just the intersections of the scene with a plane.  But the only way I've been able to achieve this so far is by setting the near and far culling planes to be very close together.  However, there are two problems with this approach:

The result isn't actually 2D, the cross-sections have the thickness the size of the gap between the culling planes (this isn't a huge deal, but would be nice to fix)
Most objects become quasi-outlines since their fronts and backs are now culled by the camera.  I at least want this to be filled in (e.g. for a sphere I want a solid circle instead of just an outline).

Is there a way to make a very small gap between the near and far culling planes but filling in the interior of the objects, or is there another way to achieve this plane-intersection effect?

sentences:
How to make other semantics behave like SV_Position? I'm having a lot of trouble with shadow mapping, and I believe I've found the problem.
When passing vectors from the vertex shader to the pixel shader, does the hardware automatically change any of the values based on the semantic?

I've compiled a barebones pair of shaders which should illustrate the problem.

Vertex shader :

struct Vertex {
    float3 position : POSITION;
};

struct Pixel {
    float4 position : SV_Position;
    float4 light_position : POSITION;
};

cbuffer Matrices {
    matrix projection;
};

Pixel RenderVertexShader(Vertex input) {
    Pixel output;
    output.position = mul(float4(input.position, 1.0f), projection);
    output.light_position = output.position;
    // We simply pass the same vector in screenspace through different semantics.
    return output;
}

And a simple pixel shader to go along with it:

struct Pixel {
    float4 position : SV_Position;
    float4 light_position : POSITION;
};

float4 RenderPixelShader(Pixel input) : SV_Target {
    // At this point, (input.position.z / input.position.w) is a normal depth value.
    // However, (input.light_position.z / input.light_position.w) is 0.999f or similar.
    // If the primitive is touching the near plane, it very quickly goes to 0.

    return (0.0f).rrrr;
}

How is it possible to make the hardware treat light_position in the same way which position is being treated between the vertex and pixel shaders?

This differrence is almost exclusive to the Z component, as the X and Y values of light_position are behaving as expected.

EDIT: Aha! (input.position.z) without dividing by W is the same as (input.light_position.z / input.light_position.w). Not sure why this is.

EDIT 2: Dividing (output.light_position) by (output.light_position.w) in the vertex shader causes really odd behavior, where (input.light_position.z / input.light_position.w) will be either 0 or 1 based on the camera's position and angle.

EDIT 3: Moving the projection multiplication into the pixel shader doesn't seem to make any difference. This means that the hardware is doing something to the SV_Position semantic which is critical to make it work.

EDIT 4: (input.light_position.z / input.light_position.w) IS behaving like depth, it's just that the precision seems to have decreased unbelievably. Only does it approach 0 once it's primitive literally intersects the near plane.

sentences:
How to properly do top-down aRPG melee attacks? I'm reposting this from my own thread in reddit's gamedev community, since there were too few responses:

I've been looking for some info on that, but I mostly find articles on the design of such systems, which are very useful, but not helpful from the coder's point of view. My main idea is similar to what the 2D Zelda games used to do, but with more directional freedom. In Zelda, you can only face one of the cardinal directions and attack the enemy there.
My idea is to have the same but with any direction, since we now have analog sticks, or even mice. I'm pretty sure this has been done before, and a few Flash games come to mind, such as the Zombie Apocalypse game Dead Frontier (which is now done on Unity3D, but was Flash back when I played it)

I'm working with Unity3D (although I'm making a 2D game), and I'm not completely happy with where I'm going.

This:  is my current hacky solution for a Melee hit check. The green triangle is the player, the faint green circle is a trigger that checks if there are enemies in this trigger, and the red boxy thing is an enemy.
When the player presses the "melee attack" button, it picks one of the enemies in the trigger (by order of the first one to enter the trigger) and causes damage.

Among a few things I've added to that are: Slow down the player movement during an attack, so that they can't "run n' slash" through an entire level, and also limit how many attacks the player can do per second. An attack cannot start if the previous one hasn't finished yet.

This is looking a bit crude, though. I just kind of hacked it together and it doesn't feel as natural as in other games I've played.

Here's my hacky Melee Attack script in my prototype (it uses a few magic numbers, such as the attack duration):

void Update()
{
 //other logic
    if (Input.GetMouseButtonDown (0) && sec <= 0)
    {
        attackDuration = 0.5f; //setting how long the attack takes from start to finish
    }
    if (attackDuration > 0)
    {
        attackDuration -= Time.deltaTime;
        if (attackDuration <= 0.25f && !done) //cause the damage when the attack is halfway done
        {
            if(EnemiesInRange.Count > 0)
            {
                Enemy target = ((GameObject)EnemiesInRange[0]).GetComponent<Enemy>();
                target.health -= 10;
                if (target.health <= 0)
                {
                    EnemiesInRange.Remove(target.gameObject); //if the enemy dies, it's no longer a valid target.
                }

            }
            done = true;
        }
    }
    else
    {
        done = false;
        sec = 0; //attack over, reset it to zero (to avoid stuff like -0,001)
    }
//other logic
}

Meanwhile, in the CharacterMovement.cs script:

void Update()
{
//other logic
    if(gameObject.GetComponent<MeleeAttack>().sec <= 0)
    {
        lookAtMouse();
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * baseSpeed, Space.World);
    }
    else
    {
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * (baseSpeed*0.25f), Space.World);
    }
//other logic
}

What I'm doing here is stopping the player to change their facing during the attack as well as slowing the movement down to 1/4 the base speed.

Anyway, any advice? How could I make attacking and moving feel more natural? What about the hit mechanics themselves?

My biggest gripe right now is: I don't think "Pick an enemy in a small circular area ahead of the player" is really good.  What should I do?

sentences:
Imported FBX animations (exported from Blender) have different, messier keyframes than in .blend file? I imported an a character to Unity 2019.2.8 that I made in Blender 8.0, which was exported from that program in .FBX format. The animations play back the same (perceptually, but the keyframes are very messy and out of place by comparison.

What can be causing this? The animations in Blender and Unity are the same length (I checked) so what happened to the keys? How can I re-import these animations so that the keys match?

EXAMPLE:
(this all happens in Blender 8.1)

In Blender, have a rigged and animated character ready:

These animations (this animation in particular, "Battle_Punch") was recorded with the Frame Rate set to 60fps. That may not be true for all of them (hope not) but it is for this one.

Prior to export, I select all the objects in under the Luigi collection. I do that by right-clicking the Armature object in the Collections panel and selecting "Select Hierarchy".

Then I use the following FBX export settings:

Of particular note should be the options to export only what is selected.
I set the normals to "face" because once-upon-a-time, that worked well for me when the default did not.

Here are my FBX IMPORT settings inside Unity:

Model:

Rig:

Animation (only change is Import Constraints-YES and Anim. Compression-NONE):

(I'm sure the Materials settings are unimportant for this)

Here are they keyframes I get with Anim. Compression set to NONE:

...and here is what I get with the default setting (Reduced Keyframes). This result is the same as if I select OPTIMAL:

You can compare this to the keyframes in the first image and see that this outcome resembles shotgun fire better than it resembles my keyframes.

Now, an observation: Tinkering with the translation/rotation/scale error settings under Reduced Keyframes in the Animations import settings will give me more keyframes, but I can't confirm this is more consistent with what I started with because it will insert a keyframe for every position, not just where the original keyframes were.

How do I get keyframes ONLY where my original keyframes were?

sentences:
How do I construct the planes for my camera's frustum? I'm trying to get a handle on frustum culling, but I'm not quite there yet.

I have a camera in three-dimensional space

Camera
    position (cx, cy, cz)
    rotation (tx, ty, tz)
    fieldofview
    near-plane
    far-plane

and a quadtree containing my chunks of terrain

Quadtree
    Chunk
        bottomleft (x, y)
        width
        length
        heightmap

Currently, I am rendering every chunk within the quadtree. However, I would like to cull all chunks outside the six planes of the camera's frustum.

I am unsure how to:

Generate these planes given the information in the camera class.
Efficiently test for intersection using my quadtree. If one region of the quadtree fails, do all of its children (that seems reasonable, I just want to make sure)? What is the process for running through a quadtree for culling?
Perform the intersection test using the planes and my terrain chunks. How do I quickly tell if a piece of terrain (square with varying y values) lies within the 6 camera planes?

sentences: How to create words as objects in Unity? I am working on a game that has words as obstacles, i.e. the player needs to climb over and around them. There will be hundreds of words in the game therefore I need a way to automate the placement. I figured out how to create an object with a TextMesh in Unity but I can't figure out how to automatically generate a collider so that I can have the player interact with it. I know that there is a way to edit the verticies of Edge and Polygon colliders but I don't have a source for editing them. What would be useful is a getPoints method of the TextRender but it seems like there is no way to get that. Am I going about this the right way? Thanks in advance.

sentences:
Modern opengl for direct3d programmers I don't think this is quite the same questions as this one but if you disagree feel free to close this :)

With SteamOS being announced yesterday I can see that it's entirely possible that opengl will get a big boost in usage in the near future. Now I already know direct3d11 quite well but I think maybe it's time to learn opengl too.

Are there any good resource for learning modern opengl that are aimed at programmers who already know direct3d11 pretty well. So don't need any education on the concepts and math, just on how to use the API and any important differences?

sentences:
How can I manually call/fire OnTriggerExit() for colliders a trigger is inside of in Unity? In Unity, the OnTriggerExit() method is not called/fired (not sure if it's an event or not) when an object is disabled or destroyed within it's collider. In comparison to it being fired is an active object that was within it's collider no longer being inside the bounds of that collider on the next frame. I want to be able to call OnTriggerExit() on my triggers OnDisable() method as a workaround.

How would I go about calling/firing OnTriggerExit() manually?

sentences:
2D Platformer: add ability to jump on top of other character I want to add ability to jump onto a head of other character/player, but still be able to go through them horizontally.
There is one useful tutorial about one-way platforms, but that approach doesn't allow player to go through a platform from a side.

I tried to add sensor to foot and head of characters and enable contact in  preSolve method, but it doesn't look to work very well (sometimes bodies are thrown out from each other with additional impulse).

Do you have any ideas? Also it would be nice to not change sources of box2d as it was done in tutorial as I'm using it from LibGDX.

sentences:
SDL-2.0 library not working with codeblocks-13.12-mingw-tdm I started following lazyfoo's sdl 2.0 tutorials. This is the very first tutorial that explains how to set up SDL 2.0 with code::blocks - SDL 2.0 with code::blocks setup. I am doing exactly what it says but still getting this error:-

|121|fatal error: winapifamily.h: No such file or directory|
    ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

This is the code that I tried to run. I copied and pasted exactly as it is given in the source code for the tutorial :-

/*This source code copyrighted by Lazy Foo' Productions (2004-2015)
and may not be redistributed without written permission.*/

//Using SDL and standard IO
#include <SDL.h>
#include <stdio.h>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

int main( int argc, char* args[] )
{
    //The window we'll be rendering to
    SDL_Window* window = NULL;

    //The surface contained by the window
    SDL_Surface* screenSurface = NULL;

    //Initialize SDL
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
    }
    else
    {
        //Create window
        window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
        if( window == NULL )
        {
            printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );
        }
        else
        {
            //Get window surface
            screenSurface = SDL_GetWindowSurface( window );

            //Fill the surface white
            SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) );

            //Update the surface
            SDL_UpdateWindowSurface( window );

            //Wait two seconds
            SDL_Delay( 2000 );
        }
    }

    //Destroy window
    SDL_DestroyWindow( window );

    //Quit SDL subsystems
    SDL_Quit();

    return 0;
}

sentences:
Player appears in front of objects even if it's in the background I have a player in Z=0 and a fence object that I want it to be in from of the player so I set it to Z=1, it's a 2D game but in the 3D view I can see that the fence is actually in front of the player but in the 2D view the player is displayed in front.

Here are a couple of screenshots.

3D view, fence in front of player:

2D view, player in front of fence:

Any idea how to fix this?

sentences:
Unity, VRChat SDK3, Udon Graph (bug?) I'm trying to create a VRChat world in Unity, using VRchat World SDK3.
But I'm getting a strange behavior in Udon Graph assets (as shown by the arrows in the screenshot).
Steps I took:

I've installed the appropriate Unity version (2018-04-20f1) via the hub,
Then proceeded to importing VRChat SDK 3 (VRCSDK3-WORLD-2020.12.09.04.44_Public.unitypackage),
Then on the project tab, I navigated to the "Udon" folder, created a subfolder and inside it I created a Udon Graph Program Asset.
Finally, I opened Udon Graph and I added a public GameObject variable.

The result was as seen in the image seen bellow: the GameObject variable displays a buggy text (the text self (GameObject) shows up twice, superimposed on top of itself - as indicated by the arrows in the attached screenshot).

sentences:
Pygame surface rotation, rect rotation or sprite rotation? i seem to have a conceptual misunderstanding of the surface and rect object in pygame.

I currently observe these objects this way:

Surface

Just the loaded image

rect

the 'hard' representation of the ingame object (sprite). Used for simplifying object moment and collision detection

sprite

rect and surface grouped together

What i want to do is rotate my sprite. The only available method i found for rotation is  pygame.transform.rotate.

How do i rotate the rectangle, or even better, the whole sprite?

Below is the image of how i visualize this problem.

sentences:
Focus scene2d UI actors programmatically in libGDX I am trying to implement keyboard movement in game main menu which is libGDX Stage with UI-Actors. I'm also trying to code this feature myself since I can't neither find anything relevant to it in the docs nor find libraries for the feature.

I have a bunch of Buttons in the VerticalGroup. Using keyboard UP and DOWN keys, I want to somehow focus, highlight or hover buttons like the way that mouse hovering do. Hovewer, firing FocusEvent on children of the VerticalGroup do not change Button appearance.

So how do I focus these buttons or any other UI element (because there are other menus with more complex UI architecture) ?

Here is the code for the menu (Kotlin, using ktx-scene2d builders and ktx-actors event methods):

class MainMenuUi: Stage() {
    val root = verticalGroup {
        center()
        setFillParent(true)
        expand(true)
        space(spacing)
        fill(0.5f)
        wrap(false)

        textButton("Start")
        textButton("Settings")
        textButton("Exit")

        onKeyUp { key ->
            when(key) {
                Input.Keys.UP -> { /* ??? */ }
                Input.Keys.DOWN -> { /* ??? */ }
            }
        }
    }.also {
        addActor(it)
        keyboardFocus = it
    }
}

sentences: How How can I make a simple combo combat system in Unity I'v been trying to make a melee combo combat system in the Unity Animator, but I can't seem to get it right. I'm trying to go for a combo system that flows from Hit 1 to Hit 2 to Hit 3, ect, with clicks from my mouse, and if I don't click again it will go back to Idle. How would I go about making this combo attack system in the Animator with Unity and C#.

sentences:
How can I make actions that effect the position of another player appear responsive when my game server is authoritative? You are playing as Lucio in Overwatch. You boop another player and they immediately get booped away. It feels really responsive. But the server hasn't actually registered the boop yet. By the time your command reaches the server, that player might be in a different location and the result of your boop might be completely different. If we needed to wait for a server confirmation, we wouldn't see our boop for, say, 200ms. (assuming 200ms RTT.)
You are driving around in PUBG and see another player. You drive your car in to a player who is running around on foot. They appear to immediately die or at least get bumped away by the impact. You hit the player where you saw him but he is actually somewhere else on the server (you may have actually missed him!). If our game does not respond immediately, we would see the other player clip in to your car as they continue running, then, say, 200ms later they would die or get knocked around (again assuming a RTT of 200ms)

How are situations like these resolved? It seems like the result is simulated locally (prediction) but the outcomes could be so drastic that an incorrect prediction could result in a lot of confusion. (Running over a player who isn't actually in your way, booping a player to your left off a cliff, but they are actually in front of you and won't fall down the cliff)

sentences:
How do you handle loss aversion in probability-based games? The psychological phenomenon of loss aversion refers to how players feel losses twice as powerfully as victories.

For example, Bite Fight's PvP is a simulation based on probabilities related on character skills, and players voice this feeling many times per week in the community forums.

If you don't want to create a pay-to-win game, but you do want to let the worst players win often enough to feel good about it, how can you do that?

The question has two parts:

How do you handle it technically? Do you use some kind of math techniques or a memory based simulation to avoid many loses in the row for a certain player?
How do you handle it from the community point of view? What do you do about complaints like this on public forums?

sentences: Hi,how can I flip x a collider when the Sprite renderer rotates? I have been making a 2d platform game in unity.My main character has a box collider but when he rotates, the box dont rotates with him. Thanks!

sentences:
How do I use depth testing and texture transparency together in my 2.5D world? Note: I've already found an answer (which I will post after this question) - I was just wondering if I was doing it right, or if there is a better way.

I'm making a "2.5D" isometric game using OpenGL ES (JOGL). By "2.5D", I mean that the world is 3D, but it is rendered using 2D isometric tiles.

The original problem I had to solve was that my textures had to be rendered in order (from back to front), so that the tiles overlapped properly to create the proper effect. After some reading, I quickly realised that this is the "old hat" 2D approach. This became difficult to do efficiently, since the 3D world can be modified by the player (so stuff can appear anywhere in 3D space) - so it seemed logical that I take advantage of the depth buffer. This meant that I didn't have to worry about rendering stuff in the correct order.

However, I faced a problem. If you use GL_DEPTH_TEST and GL_BLEND together, it creates an effect where objects are blended with the background before they are "sorted" by z order (meaning that you get a weird kind of overlap where the transparency should be).

Here's some pseudo code that should illustrate the problem (incidentally, I'm using libgdx for Android).

create() {
    // ...
    // some other code here
    // ...

    Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);
    Gdx.gl.glEnable(GL10.GL_BLEND);
}

render() {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // ...
    // bind texture and create vertices
    // ...
}

So the question is: How do I solve the transparency overlap problem?

sentences:
maya: cannot rotate ik control in command I use maya default human ik example, see my gif, when i rotate in viewport, rotate work, but when i undo and rotate with same command in script editor, it cannot rotate, how to rotate ik control in command

I try maya 2018 and maya lt 2018, it has same problem

sentences:
3D Physics in Marmalade SDK I am trying to make an 3d  game in Marmalade. I am completely new to Marmalade.

How to add 3d physics, gravity, dynamic object, sensors, colliders in Marmalade.

I was going through the API and did not find anything. Can you guys let me know how to accomplish these things

sentences:
How can I generate isometric sprite sheets from 3D animations? I want to generate sprite-sheets for an isometric projection of various 3d assets purchased from the Unity3D asset store. I'd preferably also render the normal maps. I am a programmer, but new to 3D modeling software (Blender, etc.)

I found two tools for this; SpriteForge and SpriteWorks, but neither supports enough formats to be worth their cost.

There must be an efficient way of isometrically rendering various animations of a 3d assets in Blender—but I don't know how. How can I do this?

sentences:
How do I render Unicode characters that my font doesn't support? How would I go about rendering all Unicode characters?

Most font files don't include characters like these.

sentences:
Trouble creating fog and lighting in unity I am trying to create a model in unity that looks like this picture by Escher

I can create the lattice, however, I can not create the fog and background/lighting effect. When I adjust the fog in Lighting the cubes just get more of the supposed fog color. Also I don't know how to eliminate the sky and make the lighting more like it is in the picture. Does anybody know how to great the fog and lighting effect I am looking for Thanks
I previously posted this on unity Q and A and got no answer

I can not post my other image with no fog because i do not have enough reputations. It is basically the image I posted just with more shadow and gray cubes.

sentences:
My game is just about finished! What do I do now? I have an HTML5/canvas game just about finished and ready to launch. It's a 2d game in which you explore and disrupt a procedurally-generated landscape, crafting items and structures to survive. I have to finalize the 'ending' and fix a few bugs, but the game is pretty much ready for players.

The game will be free to play on the web, and I plan to begin working versions for iOS and the Mac App Store. I will also continue to add content to the game even after it launches.

Can anyone recommend things that I should remember to do before launching the game? Thanks!

sentences:
Creating a set of islands by subtracting gradient values from a Perlin noise The answers to this question explains fairly well how to create a big island in the center of the screen by setting up a gradient and then subtracting its value from a Perlin Noise.

Anyway they explain how to create only
one gradient at the center of the screen to create a big, sort of circular island.

But what if I want to create an island which has more than one gradient to create a less regular shape, or if I want to create multiple separated islands by setting multiple gradients in different positions? What value should I subtract from the Perlin Noise function for each point? The sum of the distance from each gradient to that point? The average?

Edit: Jon's method of multiplying and normalizing worked, got this result with 4 gradient points:

sentences:
Is it possible to prevent the collider 2D outline from hiding in Unity? Is it possible to prevent the collider 2D outline from hiding in Unity?
I am creating some animations in Unity. To create animations I select different parts of a hero and move them frame by frame. Now I am working on the run animation and would like to see the bottom collider during parts movement for the animation creation.
In my case the collider outline is red:

I don't want the red bottom line (which is the collider outline) to disappear while I am creating animations. Should I research the Unity extensions and maybe write my own which would prevent the collider from hiding or is it possible to achieve what I want out of the box somehow?

sentences:
Collectible Card Game Card Text To Code Association I am making a collectible card game using a command pattern for using card abilities and creating a class for each card text ability. The game is setup to work with an authoritative server structure. I have each cards stat values in a MySQL database. My question is what would be the best way to associate a cards text with the class that executes it?

For example, I have a Card class that pulls card stats from the database for the specific card. I would like to have an entry in the database for each card that determines what ability class the card has. Since, I'm limited to the basic data types in the database I'm trying to find the best way to associate a string or int to a class that executes the cards ability in my code.

My first solution is having each database entry for a card hold a string that holds the code for the class, and compiling that string on the fly. A second solution is having a giant switch statement class that associates each card name with the class of its ability. I feel like there should be a simpler way to get this accomplished though. Anyone have any insights? Thanks

sentences:
Displaying intersection by removing vertices I am using WPF, using the MeshGeometry3D class to build up my model.

I have 2 pipes intersecting each other, and I would like to remove the region of intersection (meaning erase the portion of pipe 1 that lies inside of pipe 2).

I have tried to solve the problem by solving for the points(vertices) that exist inside the pipe, and deleting it from the list of vertices.

However, it does not seem to work, since (i assume) that the primitives are represented by triangles, and if I were to remove the points, the triangles would no longer exist and the model will fall apart.

My question is that considering this, is there any method that I can try to remove the intersecting regions?

sentences:
Grouped enemy movement out of sync after changing directions Im working on a Galaxian/Space Invaders Inspired game. Im working on the enemy movement and am running into an issue where the enemies get out of sync when changing direction.

My setup is that I have a global variable enemyHorizontalDirection. Its initially set to left and any time an enemy hits the left or right side of the screen its set to whatever direction the enemies should go in. While this works Im running into an issue where the enemy that triggers the global variable enemyHorizontalDirection gets out of place. Below is a video of the behavior.
http://www.youtube.com/watch?v=3kRlT9_Dt1Q&feature=youtube_gdata_player

The enemies are created from left to right from a 2d array. Each enemy is added to a List at creation. I am looping through the list end to beginning at the moment. The problem occurs on the left side. When I loop through from beginning to end the problem occurs on the right side.

Here is the enemy Update Method:

if(groupedMovement)
{
    // When hitting right side of the screen set direction to left
    if(this.x > (Futile.screen.halfWidth - GMain.instance.gameScreenOffset) - (this.width / 2))
    {
        GMain.instance.enemyHorizontalDirection = "left";
    }

    // When hitting left side of the screen set direction to right
    else if(this.x < (-Futile.screen.halfWidth + GMain.instance.gameScreenOffset) + (this.width / 2))
    {
        GMain.instance.enemyHorizontalDirection = "right";
    }

    if(GMain.instance.enemyHorizontalDirection == "left")
    {
        this.x -= 4f;
    }

    if(GMain.instance.enemyHorizontalDirection == "right")
    {
        this.x += 4f;
    }
}

Here is where I loop through the enemies and call their Update();

for(int p = _player.Count-1; p >= 0; p--)
{
    Player player = _player[p];
    player.UpdateLocalVertices();

    Rect playerRect = player.GetTextureRectRelativeToContainer();

    if(_player.Count == 0) break;

    // Handle player/enemy collisions
    for(int e = _enemies.Count-1; e >= 0; e--)
    {
        GSpriteEnemyGameObject enemy = _enemies[e];
        enemy.UpdateLocalVertices();

        if(enemy.active)
        {
            Rect enemyRect = enemy.GetTextureRectRelativeToContainer();

            if (enemyRect.CheckIntersect(playerRect))
            {
                CreateEnemyDeathEffect(enemy, true);

                enemy.RemoveFromContainer();
                _enemies.Remove(enemy);
                PlayerHit();
            }
        }

        if(enemy.y < -Futile.screen.halfHeight)
        {
            enemy.RemoveFromContainer();
            _enemies.Remove(enemy);
        }

        if (_debug) DebugLineDraw.drawHitBox(enemy, Color.red);

        enemy.Update();
    }
}

Im hoping someone can point me in the right direction. Im not sure of the exact cause of this or how to approach a fix for it.

Any help much appreciated!

sentences:
How detect which OpenGL texture formats are natively supported? For example, how detect if my videocard doesn’t support "bgr8" and convert it to another format, such as "rgba8" in software mode.

UPDATE: Sorry for the confusion. This question more about situation when I set internalFormat in glTexImage2D to something like "bgra8" but videodriver internally convert data to another format, like "rgba8".

sentences:
Algorithm for securing a retro password system For a game I am working on, one of the build targets is the Unity Webplayer, which does not support saving file I/O at all.  However, as it's an action/adventure game based on Zelda 2: The Adventure of Link, I would like to provide my players the capability to save their game somehow.

In light of the webplayer limitations, I was going to circumvent it by creating a password system that the user could simply enter to resume where they left off.  Said password would convey various things about game state, such as event flags, and picked up item flags (true to the game this is based off of, loading a game restarts the player in a pre-determined location.)  This is also convenient for other modes, because the save system would be merely responsible for storing this password, as the password is a compressed version of the game's state.

My understanding is ideally, said setup would just entail creating a series of bits, represented by a complex character (such as, a digit or hexadecimal character) which could be stored in some larger value, then unpacked when entered by the user.

Of course, there's a problem, and that's security.  I have to assume some less-honest player knows the sequence of flags and how to recreate them.  From what I understand, a way to get around that is to append some sort of checksum to the bit sequence.  If that checksum fails, then the system knows that the code is bogus, and to do nothing at all.  Of course, I would also assume that the attacker would be aware of said checksum's existence.

Question: what are some good ways I would go about securing a save-state password as described above to make it less-able to be gamed by cheaters?

sentences:
Custom mesh format - yea or nay? In the process of writing my game prototype, I have found the OBJ format to be insufficient for my needs - it does not support any sort of animation, it doesn't support triangle strips (I'm targeting my ancient hardware). MD2 wouldn't fit the bill because it doesn't have support for named model pieces. MD3 would probably work, but like OBJ, it doesn't have support for triangle strips. Considering the limitations of the formats above, I've come to the conclusion that it may be necessary to write my own format to accommodate my requirements, but that feels like reinventing the wheel.

So, I need a format which can specify indexed tri-strips, supports textures, UV-mapping, collision data, can have multiple named segments and supports animations (have I forgotten anything?). Is there any format like that which already exists, or do I have to write my own?

sentences:
Create a website that lists all the game servers from a country I have seen some sites which shows servers(for online games) from various parts of world with there name and ip's. I am looking forward to develop something of same sort.

But the issue is how to get all the IP's of servers playing a certain game. Is there any criteria for the same. For eg: I want to list all online servers from US which are playing Counter Strike and also to get the players in it and other info.

sentences:
Unity RectTransformUtility.ScreenPointToLocalPointInRectangle What does the unity's RectTransformUtility.ScreenPointToLocalPointInRectangle do
I've read unity documentation but I didn't get the clear meaning.

sentences:
How to make a custom event system framerate friendly? I have a simple event system:

class GameEvent{
    float executionTime;
    Action action;
}

class EventMgr : MonoBehaviour{

    List<GameEvent> events = new List<GameEvent>();

    void Update(){

        float timeNow = Time.time;

        for(int i=events.Count - 1; i >= 0; i--)
        {
            if(timeNow >= events[i].executionTime)
            {
                exents[i].action();
                events.RemoveAt(i);
            }
        }
    }

    public void ScheduleEvent(float delay, Action action){
        events.Add(new GameEvent(){
            action = action,
            executionTime = Time.time + delay;
        });
    }
}

Then,

I schedule events like this:

eventMgr.ScheduleEvent(0.1f, () => {
    // EVENT A - should be fired first
};

eventMgr.ScheduleEvent(0.15f, () => {
    // EVENT B - should be fired second
};

Everything works fine when I play on 60 FPS. Update() is fired once every ~0.016s. When I play the game on a device with 20-40FPS - things got a little bit tricky. Events seem to run in an incorrect order (Event B fired before event A).

The only possible cause is of course the framerate itself.
If the game runs at 20FPS, Update() would be called less frequently and both of these events would be fired in the same frame - and then, the order of their execution depends on the list itself.

What to do here?
Is there any trick to prevent this, is there any pattern for accurate, ordered event system in games which is FPS friendly?

sentences:
How do I move a unit one grid-square-width per button press in Unity3D? I'm learning Unity. I'm making a 2D top down Frogger-esque game. I was wondering how you would go about making the player move x pixels per button press.

I have this code to move him, currently with a float for x and y inputs, so he moves slowly:

    Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    if (movement_vector != Vector2.zero)
    {
        anim.SetBool("isWalking", true);
        anim.SetFloat("input_x", movement_vector.x);
        anim.SetFloat("input_y", movement_vector.y);
    }
    else
    {
        anim.SetBool("isWalking", false);
    }

    rbody.MovePosition(rbody.position + movement_vector * Time.deltaTime);

sentences: Client side predicition tick implementation I've been reading about client side prediction and one question I have is what's the best way to implement the server tick. I thought about using the server frame count from the game engine I'm using as an authorative tick, is this advisable due to the changes with delta time or should I just use a simple timer on the server?

sentences:
Removing the circle outline rendered on Box2d CircleShape How can I remove the outline on the CircleShape below?

CircleShape circle = new CircleShape();
circle.setRadius(1f);

This is what I'm using to draw:

batch.draw(textureRegion, position.x - 1, position.y - 1, 1f, 1f, 2, 2, 1, 1, angle);

I use this to set the body for a Box2d collision but I get a silly circle shape around my texture in libGdx. My textured sprite (ball) has a circle over the top of it with a line running from center along the radius.

Any ideas on how to remove the overlying circle lines?

sentences:
Physics2D.IgnoreCollision not work when rb not moving I want to use Physics2D.IgnoreCollision for ignoring collision between enemy and player, when player have shield.
But I have enemy who some time is static and some time jump only on y axis. When enemy not moving Physics2D.IgnoreCollision not work and physics collision between player and enemy occur even Physics2D.IgnoreCollision is called. When i add some velocity to enemy in update method
Code (CSharp):
rb.velocity = new Vector2(0.1f, rb.velocity.y);

IgnoreCollision work like it should.
Can some one tell me why this happens?
Thanks

sentences:
What sorts of stats do games companies track when people play their games ? I've seen interviews with certain games companies where they talk about getting stats back from their users, particularly with games on facebook.
This data allows the companies to monitor and adjust the difficulty of levels, see what's keeping people engaged etc.
I am just wondering exactly what sort of data would they be collecting?
How common is this practice and would developers of Android and iOS games be involved in similar practices?

sentences:
OpenGL - Make two images blend together I have 2 images that are .png and they mix together, The problem is that one overwrite the other. I know that the draw order matters, but In that case I should redraw the icons 2 times ( there is a lot of them)

the black is in fact transparent and drawing a star on top of the other "cuts" a part of the underlying one, In other words, it overwrites with transparency

How I see it now

How I want to see it

My blending code :

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mMarcaDataHandle);

    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

    Matrix.setIdentityM(mModelMatrix, 0);
    aplicarRotacion();
    Matrix.translateM(mModelMatrix, 0, marcador.posX, marcador.posY, marcador.posZ);

    drawMarca();

    GLES20.glDisable(GLES20.GL_BLEND);

private void drawMarca()
{
    coordinate.drawMarca(mPositionHandle, mNormalHandle, mTextureCoordinateHandle);

    // This multiplies the view matrix by the model matrix, and stores the
    // result in the MVP matrix
    // (which currently contains model * view).
    Matrix.multiplyMM(mMVMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);

    GLES20.glUniformMatrix4fv(mMVMatrixHandle, 1, false, mMVMatrix, 0);

    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVMatrix, 0);

    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);
}

sentences:
How can I set a Steam achievement in Steam via LibGDX or native Java? Is it possible to set or 'unlock' a Steam achievement via LibGDX or with a native Java solution?

If so, how it this possible. Furthermore, what would be a good implementation for 'saving' achieved achievements when you were offline. For example, when I enable the airsafe mode on my laptop and then run the game, be really good at it and unlock an achievement, how can it be saved the next time I have WiFi?

sentences:
Can I make a multiplayer Android Game using Android Studio? I want to create a multiplayer android game, where the clients connect together via a web server.

My question is: Is it possible to make this kind of games using Android Studio with other libraries like LibGDX and Java sockets?

sentences:
Split vector vs matrix notation for transformation Some rendering engines like Ogre prefer to use a individual vector based
notation for transformations like the following

Split vector notation:
Net Transformation is represented by
Scale vector = sx, sy, sz

Transformation vector = tx, ty, tz

Rotation Quaternion Vector = w,x,y,z

Matrix notation:
There are other engines which simply use a net combined transformation matrix.

What are the advantages of the first notation over the second?

Also for animation interpolation does it work in the first notation that we interpolate across
the individual components and use the interpolated parts to get the net transformation?
Is this another advantage?

sentences:
How to transfer a variable from script to another in Godot I have 3 sprites A, B and C, each one has area2d attached to it and collision shape

the script for A

extends Area2D
var done = 0

func _input_event(viewport, event, shape_idx):
    if event.type == InputEvent.MOUSE_BUTTON \
    and event.button_index == BUTTON_LEFT \
    and event.pressed:
        get_parent().hide()
        done = 1

And all like that

Now the main node has a script attached to it

extends Node2D

func _ready():
    if get_node("lA").get("done")==1 && get_node("B").get("done")==1 && get_node("C").get("done")==1:
            get_tree().change_scene("res://scenes/scene2.tscn")

But it doesn't work, why?

The error when doing if get_node("lA").done == 1 is

Invalid get index 'done' (on base: 'Sprite').

What I'm trying to do is collect some items, when done, move to a new scene

sentences: How do I apply a force using the object direction and speed? I have a 3D object moving and I need to be able to apply forces to it such as gravity. In 2D, I would simply store its movement in dx and dy, but since this is in 3D, I am using a Vector3D direction and a float speed. How can I determine how much to rotate the direction and change the speed when by using something like applyForce(Vector3D force)?

sentences:
XNA Further faces are shown through closer faces I'm trying to draw a 'axis' model named 'XYZ'. The problem is that it is rendered wrong (screenshot below).

You can see that the blue face can be seen through the red face. The black, green and red faces have no problem.
Here is my code for drawing the axis.

protected override void Initialize()
    {
        this.IsMouseVisible = true;
        this.Window.Title = "3DRadSpace -Editor- 3dradspace.org";
        Tools Toolz = new Tools();
        Toolz.Show();
        // TODO: Add your initialization logic here
        base.Initialize();
        RasterizerState stat = new RasterizerState();
        stat.CullMode = CullMode.None; //Does nothing, the default does the same thing
    }
protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
            MS = Mouse.GetState();
            if (MS.X < 120 && MS.Y < 120 && MS.X > 0 && MS.Y > 0 && MS.LeftButton == ButtonState.Pressed)
            {
            }
            KB = Keyboard.GetState();
            if (KB.IsKeyDown(Keys.Left))
            {
                Cam = new Vector3(Cam.X -= 1, Cam.Y, Cam.Z);
                view = Matrix.CreateLookAt(Cam, new Vector3(0, 0, 0), Vector3.UnitY);
            }
            if (KB.IsKeyDown(Keys.Right))
            {
                Cam = new Vector3(Cam.X += 1, Cam.Y, Cam.Z);
                view = Matrix.CreateLookAt(Cam, new Vector3(0, 0, 0), Vector3.UnitY);
            }
            if (KB.IsKeyDown(Keys.Up))
            {
                Cam = new Vector3(Cam.X, Cam.Y, Cam.Z+=1);
                view = Matrix.CreateLookAt(Cam, new Vector3(0, 0, 0), Vector3.UnitY);
            }
            if (KB.IsKeyDown(Keys.Down))
            {
                Cam = new Vector3(Cam.X, Cam.Y, Cam.Z-=1);
                view = Matrix.CreateLookAt(Cam, new Vector3(0, 0, 0), Vector3.UnitY);
            }
            if (KB.IsKeyDown(Keys.Q))
            {
                Cam = new Vector3(Cam.X, Cam.Y+-1, Cam.Z);
                view = Matrix.CreateLookAt(Cam, new Vector3(0, 0, 0), Vector3.UnitY);
            }
            if (KB.IsKeyDown(Keys.E))
            {
                Cam = new Vector3(Cam.X, Cam.Y+= 1, Cam.Z);
                view = Matrix.CreateLookAt(Cam, new Vector3(0, 0, 0), Vector3.UnitY);
            }
            base.Update(gameTime);
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(75,75,255));
            DrawModel(axis, world, view, projection);
            spriteBatch.Begin();
            spriteBatch.Draw(MovX,new Vector2(0,0), Color.White);
            spriteBatch.End();
            // TODO: Add your drawing code here
            base.Draw(gameTime);
        }
        private void DrawModel(Model model, Matrix world, Matrix view, Matrix projection)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = world;
                    effect.View = view;
                    effect.Projection = projection;
                }
                mesh.Draw();
            }
        }

sentences: Create BGRA texture SFML I have a texture sfml but this texture have a format RGBA how i can change it to BGRA? Or how to create texture with need able format for me?

sentences:
How to annotate a BinaryFormatter packet with a header describing its length? I am working on a project that is sending data from pc to tablet via usb, using android adb. To serialize the data, we are using BinaryFormatter. The problem I'm running into is that the client is sending packets of size 1161 bytes.
Now I could hard code in 1161 as the length of the byte array on the receiving in, and this would fix my problem. But what I would rather do is put the length in the header of the packet being sent, so the receiving end can check that and create the packet according to the size, just incase we get a different packet type of a different size.
However, BinaryFormatter also encodes the names of the fields, so as far as I can tell, you can't determine the length the object will be before serializing it, at which point, it's too late to set the length property in the header.
Does any one know a solution to this that will elegantly handle different packet sizes, and packets over the size of 1024 bytes? Thank you!

sentences:
Game Loop delay the right way and game speed I am a newbie game developer. I am trying to find a right way to create my game loop.

Consider following example.
Simple Android Game
I have a game with a simple gameplay - bouncing ball.

I want to have a control of the ball speed.
Also I want my game to have the same framerate (framespeed) on all devices.

Where the speed logic should be implemented ? In my case I have simple ball object with a velocity vector. I can change the velocity vector properties in order to make my ball move faster or slower, am I right ?
The Main Loop. I have read a lot of about this part of a game. I found this article http://gameprogrammingpatterns.com/game-loop.html . And decided to use this code example

    double previous = getCurrentTime();
    double lag = 0.0;
    while (true)
    {
    double current = getCurrentTime();
    double elapsed = current - previous;
    previous = current;
    lag += elapsed;

    processInput();

    while (lag >= MS_PER_UPDATE)
    {
    update();
    lag -= MS_PER_UPDATE;
    }
   render();
   }

I have a lot of questions about this example.

I have the similar loop in my game.

 @Override
        public void run() {
            while (mIsRunning) {
                processGameInput();
                updateGameState();
                drawGame();
            }
        }

I cannot understand while update(); is called while waiting for a constant delay ? Why not the render method ?
Maybe I am missing something.

Here is how my update for the ball looks like.

   public void updatePosition() {
        mCenterX += mVector.x;
        mCenterY += mVector.y;
    }

As you could see, each time I increase the position of the ball by the value of the velocity vector.

But as can guess, in case of using the example from the article, the update method will be called for instance 100 times. And the render method only once per 100 update method calls.
So in this case I guess, I the ball will be changing its position lagging.

My goal is to control the speed of the ball, for example from 0.1s - 2s.

How can achieve this ?

Please help to understand this topic. Any help would be highly appreciated.

sentences:
How is the result returned in SharpDX.DirectInput.Device.Acquire()? The documentation of IDirectInputDevice8::Acquire says:

  Return Value

  If the method succeeds, the return value is DI_OK, or
  S_FALSE if the device was already acquired. If the method fails, the
  return value can be one of the following error values:
  DIERR_INVALIDPARAM, DIERR_NOTINITIALIZED, DIERR_OTHERAPPHASPRIO.

However, SharpDX's Device.Acquire() is a void. The documentation for this method  is not really helpful.

How can I know if a call to Device.Aquire() has succeeded or not?

Alternatively, where is the source for Acquire() located? I've tried looking at the contents of Device.cs, but not only it is not located in there, but Device is marked as partial, which means the source for Acquire() is probably in a different file, but I can't seem to find it.

sentences:
Problem with the Layer System/Tilemap Layer from Unity This is my first time using Unity (and my third time creating a game in general), so I hope I can provide the needed information to solve this problem.

My character overlaps with the upper wall, but doesnt with the lower wall. This is the right behaviour given the layers (seen in the picture). But I want him to be behind the lower wall AND in front of the upper wall.

Side Information:
 - The Wall Tile is one piece, which covers two tiles.
 - Movement is depended on the existents of a ground tile. The reason behind this is, that I wanted the character to always move one tile at a time. And since this is my first time with unity, that was the easiest way of doing it. So there is no actual interaction with the wall. No collsions or anything.
 - There are three Layers (Ground, Creature, Wall) and two tilemap layers (Ground and Wall) (see picture) and the character doesnt interact with the tilemaps at all, he just gets drawn above the ground tilemap layer.

What I see as answers:
 - Split the wall tile into two tiles and let the wall part be on another layer, then the roof part.
 - Split the character into two parts and do the same thing.
Both seem like a good way of solving it, but I dont even know where do start there. I think I can split the walls into two tiles, but I dont know if this is a good way to solve this issue. The other option, to split my character, there I really dont know where to start.

What I tried:
 - Trying around with layers and order in layers.
 - Trying around with the tile atlas (adding the sprite, removing tiles)

sentences:
how can i make a sprite from a spritesheet increase its size? I want to be able to increase the size of a sprite to give the illusion that it is walking towards you (or decrease in size to move away).
how do i manipulate the size of a loaded sprite off a sprite sheet (png format, if that matters)?

sentences:
Managing multiple references of the same game entity in different places using IDs I've seen great questions on similar topics, but none that addressed this particular method:

Given that I have multiple collections of game entities in my [XNA Game Studio] game, with many entities belonging to multiple lists, I'm considering ways I could keep track of whenever an entity is destroyed and remove it from the lists it belongs to.

A lot of potential methods seem sloppy/convoluted, but I'm reminded of a way I've seen before in which, instead of having multiple collections of game entities, you have collections of game entity IDs instead.  These IDs map to game entities via a central "database" (perhaps just a hash table).

So, whenever any bit of code wants to access a game entity's members, it first checks to see if it's even in the database still.  If not, it can react accordingly.

Is this a sound approach?  It seems that it would eliminate many of the risks/hassles of storing multiple lists, with the tradeoff being the cost of the lookup every time you want to access an object.

sentences:
Unity mouse input not working in webplayer build I have a button script with the following code

void OnMouseDown()
{
    animation.Play("button-squish");
    enlarged = true;
    audio.PlayOneShot(buttonSound);
}

void OnMouseUpAsButton()
{
    if (enlarged)
    {
        SelectThisButton();
        enlarged = false;

        animation.Play("button-return");
    }
}

void OnMouseExit()
{
    if (enlarged)
    {
        enlarged = false;
        animation.Play("button-return");
    }
}

It works great in the editor, but when I made a build and tested it in Chrome none of the buttons had any response.  Further testing revealed that it did work in Firefox.  Rather than telling people to change their browser if they want to play, I want to make the button code work.  How else can I get the buttons to know when they're being pressed if the built-in stuff isn't working?

sentences:
How should I setup a vector class for a 2D game engine? I'm at the beginning stages of building my first 2D game engine, and I'm not sure if I should setup my base 2D vector class as a vec3(x, y, z) or a vec2(x, y)

I might want to use a vec3(x, y, z) for adding z values, for ordering which objects would overlap other objects and still be visible. I'm also not sure if it's just easier to have a vec3 for working with the transformation matrices and graphics libraries like OpenGL. This is my first game engine project, and I don't really know what is required for the long haul, in a 2D game.

How should I setup a vector class for a 2D game engine?

sentences:
Will using a fixed point library in C++ give me 100% deterministic replays? I'm working on a scrolling arcade shooter in C++ with SDL2 and I'd like to have a replay function so players can save, share, and replay good runs. I understand that floating point math is not consistent from CPU to CPU, so saving inputs with frame counters won't give you stable replays. I saw someone mention that fixed point math is a possible solution, so I'm currently working on a C++ engine using Libfixmath fix16_t datatypes in place of anything that would be a floating point.
Should this give me 100% deterministic replays across hardware if I save the random seed? From my understanding of how a fixed point math library works that should be the case, but I would like some confirmation before I bank my entire engine around this. Really my only concern is that I'm using literal floats to set the starting values for some things, like fix16_from_float(1.2) to set the player's movement speed and I'm not entirely sure if CPU inconsistency could mess up that initial value and thus defeat the purpose. If so, could I solve the problem by using fix16_from_int() paired with some Libfixmath arithmetic to get the same non-integer values without ever using floats? I don't quite have a complete grasp on how literals are stored into a compiled program.
I am also a tad worried about performance with potentially hundreds of onscreen bullets using high level fixed point math every frame, but I'll have to see how much impact that has when I get to it.

sentences:
Rotating an object about a point (2D) using box2d i just started developing using box2d on flixel and i realise the pivot point of the rotation of an object in box2d is set to the center of an object.

i had read on forums and i found out that SetAsBox can change the pivot point of the object, however, i cannot seem to get it work to rotate about a point.

what i would like to achieve is to rotate an object about a point like earth revolving around the sun. any one can help me with it? really thanks a lot and sorry for the bad english

sentences:
Directx 11 full screen I build simple directx 11 application in c++ that draw square to screen.

Also check in the end of the program when I close the last peace of directx the number of free reference.

This work great in normal window but in full screen the reference count return 1.
I did some checks and I realised that if I destroy the window before I am closing the swap chain it works even in full screen.

My question is how can I close the swap chain with reference count of 0 without destroying the window before.

sentences:
Fully decentralized matchmaking? Most games that I know use a master server to connect players in multiplayer. If it ever gets shut down, without third-party software or master server, the game is effectively unplayable in multiplayer, sometimes not even in LAN. Temporary shutdowns can arguably be worse than permanent, because in the latter case you will likely have a community solution soon, in the former you have to wait for an unknown amount of time.

Assuming good intentions of the game developer, how can such a game be constructed so it remains playable? Can matchmaking be made fully decentralized? Do such solutions already exist?

sentences:
How does orbital math work? I'm writing a 2d space game, and I want the players to be able to 'orbit' objects and other players (if they're fast enough, of course), but I'm having trouble coming up with the right way to think about this physically (I never took physics, so this part is hard for me).

Note that this is not a 'realistic' space sim -- more like boats, really, so I don't want to do this by having the objects actually have enough gravity to force the orbit normally, because that'll make players that didn't press the 'orbit' button get sucked in and not be fun.

Also, do note that the objects players are trying to orbit may themselves be trying to orbit another object or even be mutual orbits.

I'm using the RK4 integrator right now, though if that needs to change, I'm totally up for it.

sentences:
Workflow for tagging a sprites with collision boxes I have some hundred of sprites and I need to mark collision boxes of them.

What kind of workflow can I use to help this proceed smoothly?

I've thought of using Tiled initially, however one of my requirements would be to not only mark multiple collision boxes per sprite but also to mark each one with a name or type category.

I would love to have final structure equivalent to:

<Bodies>
    <Body id="1">
        <CollisionBox>
            <Name>BODY_COLLISION</Name>
            <Vertices>
                <Vertex>12;13</Vertex>
                <Vertex>12;17</Vertex>
                <Vertex>11;17</Vertex>
            </Vertices>
        </CollisionBox>
        <CollisionBox>
            <Name>GROUND_DETECTOR</Name>
            <Vertices>
                <Vertex>12;11</Vertex>
                <Vertex>13;17</Vertex>
                <Vertex>14;17</Vertex>
            </Vertices>
        </CollisionBox>
    </Body>
</Bodies>

How can I build this data quickly & intuitively?

sentences:
How can I get six Xbox controllers to provide input to an HTML5 game? I'm creating a six player HTML 5 game designed to be played locally (Red Ice).

I've previous set up handling 7 Wiimotes using something along the lines of Joy2Key to map each input for each player to a separate keyboard key, but Wiimotes are pretty hard on the hands for these types of games and not very ergonomic so I thought I'd try and get Xbox controller support.

I don't believe that any simple key mapping solution will work due to the nature of the directional stick.

My inclination is that this will require a browser plugin and if so I'd prefer to write the plugin for Google Chrome.

How do I create a Chrome browser plugin to handle multiple Xbox controllers or is there some other way?

Please do not answer this question saying it can't be done, because it absolutely can.

EDIT: I don't believe any keymapping/mouse simulating solution will work unless it can reliably distinguish six axis of inputs, one per player.

sentences:
How can I create a heightmap for ocean surface simulation? I am working on a game that is based on boats fighiting each other. The game is finished but due to some license incopatibilities, I have to change how I simulate the surface of the sea.
What I used until now was a mesh with all the vertices of the sea, and I was setting each vertex's height using FFT (with a library that is the one I can't use). Now I don't have time to port it to another FFT library, so do you know any sine / cosine based formula or any other "easy" method that I can use to compute the height of each vertex which also keeps consistency between frames?
Having the game finished I need to keep some features of the previous implementation like it has to be CPU computed because the sea surface is affecting the boat's rotation.

sentences:
Do resolution settings have any impact or give any advantage in online FPS games? There is this crazy theory that has always bothered me. I am not after a technically but more theoretically (although technical knowledge is required to) answer;

Two friends are playing the same video game over the internet (say ... CS:GO). The only difference is that Bob is playing on a 640x480 but Mike on 1900x1600.

Does the different resolution give any of them any advantage?

sentences:
Finding all hexagonal grid coordinates inside cover arc I got a turret that points at the corner of hexagon (point A). It can shoot in cover arc that's shown here:

I need to check if my target lies within this cover arc.
From this tutorial: Hexagonal Grids I know how to get a hexgrid coordinate of my target by cliking on it.

How can I get coordinates of all the hexes in cover arc (not only red hexes but all that lie within CA)?

sentences:
Can I position a player avatar behind the camera based on rotation? I'm currently reverse engineering a video game where what's rendered on the screen depends on the proximity of the player avatar to the camera. As such, for my freecam to work properly, I need to bring the player avatar along with the camera.

Since I can't yet find how the player avatar is rendered to the screen, the next best thing I can think to do is to place the player avatar behind the camera at all times (I suppose essentially like making the player avatar orbit the camera, but always be behind it).

I just can't quite pin down how to make this happen.

The values I have are as follows:

Player Avatar:

X
Y (Up/Down)
Z

Camera:

X
Y (Up/Down)
Z
Pitch (In degrees natively, but converted to radians for my calculations)
Yaw (In degrees natively, but converted to radians for my calculations)

World Orientation:

To get my camera to move forward in the direction I'm pointing my mouse when pressing the Y key, these are the calculations I'm using (code is in Lua):

--//Camera XYZ values
local camCoordX = readFloat("[cameraBase]+990") --Camera X
local camCoordY = readFloat("[cameraBase]+994") --Camera Y
local camCoordZ = readFloat("[cameraBase]+998") --Camera Z

--//Camera pitch and yaw
local pitch = math.rad(readFloat("[cameraBase]+1540")) --Pitch
local yaw = math.rad(readFloat("[cameraBase]+1544")) --Yaw

--//Sine and cosine calculations
local sinOfYaw = math.sin(yaw) --Sine of Yaw
local cosOfYaw = math.cos(yaw) --Cosine of Yaw
local sinOfPitch = math.sin(pitch) --Sine of Pitch
local cosOfPitch = math.cos(pitch) --Cosine of Pitch

--//If Y key is pressed, write new camera XYZ values accordingly
if isKeyPressed(VK_Y) then
    writeFloat("[cameraBase]+990", camCoordX + (sinOfYaw * speed))
    writeFloat("[cameraBase]+994", camCoordY - (sinOfPitch * speed))
    writeFloat("[cameraBase]+998", camCoordZ + (cosOfYaw * speed))
end

Based on that information, is it feasible for me to accomplish placing the player avatar behind the camera at all times based on rotation? I'm open to other suggestions or options as well. Thank you for any help you can offer!

sentences:
Player choices affecting a massive online world Current generation MMOs are pretty static in that choices don't really affect the world for more than the scope of one or two quests -- but that doesn't give you a good sense of immersion, simply a temporary task.

I've had this idea of an MMO where whenever you make major decisions (such as burning down or sparing a village), you get teleported into an instanced version of the world with your changes (the village is burnt, the peasants are killed, etc) along with other players that have made the same choices.

The problem is that this requires a very large amount of instances, and players will be extremely fragmented and sparse throughout the world -- except in those areas that cannot be changed (for example, a central trading post.)

How do you solve this fragmentation problem, allowing more social interaction among players? It's hard to have an MMO with millions of players, each making different decisions.

sentences:
Performance optimization when changing Textures LibGDX In the main Screen class of my game there is a ListArray<Card> which makes up the deck of cards . The Card's texture is set in the constructor  like so :
cardTexture = new Texture(Gdx.files.internal("backface.png"));
and in the Card class there are 2 methods to show and hide the "CardFace"
public void hideCardFace() {
    cardTexture = new Texture(Gdx.files.internal("backface.png"));
}
public void showCardFace() {
    cardTexture = new Texture(("CardTextures/" + this.getFace() + this.getSuit() + ".png"));
}

(in the android\assets\CardTextures there are 52 .png files with a size of 500x726 and rangeing in filesize from 20-220 kb)
The problem is that when I have to show or hide the "CardFace" for the entire ArrayList like so :
for (int i = 0; i < deck.size(); i++) {
    ((Card) deck.get(i)).hideCardFace();
}

I experience a performance drop both on PC and Android to the point where the Game lags for 1-2 seconds until all the CardFaces are hidden or showed.(I did multiple tests and the FPS dips only when I call the 2 methods)
Is there any other way (better for performance) to change the CardFace?

sentences:
How can I save my game state so it can be resumed when my application resumes? I've found that after resuming my game the whole engine is reloaded and application is reinitialized. I want to save engine state and in "onResume," resume the game process from where it left off.

I've tried to save the engine (mEngine) and then after resume the game in "onLoadEngine" return saved engine. I think it is a bad solution and it doesn't work anyway.

What is the best solution for resuming my game (after the power key was pressed, for example) in AndEngine ?

sentences:
Input into a switch statement to change position of a character. I'm trying to make a simulation of Travelling sales man problem. So I got random circles spawning and each circle.

I want to make it so I can switch between the circles. Currently the player spawns to the first circle created which is in position (cir[0].x, cir[0].y). However, I'm trying to make an input so you can type in for example 12 and the position of the queen would now be (cir[12].x, cir[12].y). But, this seems to not work.

int number;
cin>>number;

if(number<NUMCIRC)
{
    switch(number)
    {
    case number:
        queenX = cir[number].x;
        queenY= cir[number].y;
        break;

    default: break;

    }
}

I was wondering as surely if I input the number and then press enter it should jump to the number. Assuming it's smaller than NUMCIRC, which is the number of circles that I have spawned.

sentences:
Is it possible to have FixedUpdate execute once every n frames? I'm currently building a small game, and I've created this simple character controller using FixedUpdate, which executes every frame.

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    /// <summary>
    /// Check for a key press, and if that key is pressed,
    /// move in a specified direction if there are no obstacles.
    /// </summary>
    private void MovePlayerOnKey(KeyCode keyCode, Vector3 direction)
    {
        Collider[] hitColliders = Physics.OverlapSphere(this.transform.position + direction, 0.1f);
        if(Input.GetKey(keyCode) && hitColliders.Length <= 0)
        {
            this.transform.position += direction;
        }
    }

    /// <summary>
    /// FixedUpdate is used to ensure that the player is
    /// moving in sync with the step of the Physics engine,
    /// and not executing a variable amount each frame.
    /// </summary>
    public void FixedUpdate()
    {
        this.MovePlayerOnKey(KeyCode.W, new Vector3(0, 1f, 0));
        this.MovePlayerOnKey(KeyCode.A, new Vector3(-1f, 0, 0));
        this.MovePlayerOnKey(KeyCode.S, new Vector3(0, -1f, 0));
        this.MovePlayerOnKey(KeyCode.D, new Vector3(1f, 0, 0));
    }
}

While the code itself works, the player moves much too fast for my liking, and I can't change the step of the player either, it has to stay at 1 in order for other game mechanics to function properly.

The only solution I can think of is changing how FixedUpdate runs by running it less often. Is it possible to make FixedUpdate run once every n frames?

sentences:
Unexpected results during collisions in Unity I've got a basic car-based game I'm starting in Unity.  Currently the scene has only a floor, a car (player-controlled), and one building.

Bumping into the building at low to medium speeds works as expected.  When getting the car up to max speed and smashing into the building, though, weird results happen.

Originally, the car was being pushed through the floor and falling off the map.  I changed the floor from a plane to a cube that was stretched to be broad and flat (scale 2 height), and that helped.  Now the car seems to clip right through the building at top speed, sometimes flipping itself into the air when it emerges.

So what gives?

The car and building are both imported .fbx models and both have box colliders stretched to the outer bounds of the models.  The car has a rigid body with gravity.  The building used to have a rigid body, but I removed it once I realized it was making the building fly into the air on impact (which was definitely not what I wanted).

Here are the relevant parts of the movement code:

  bool key_up = false;
  float top_speed = 1f;
  float current_speed = 0f;
  float acceleration = .01f;

  void Update ()
    {
    if (Input.GetKeyDown (KeyCode.UpArrow) && !key_up) key_up = true;
    if (Input.GetKeyUp (KeyCode.UpArrow) && key_up) key_up = false;

    if (key_up)
      {
      if (current_speed < top_speed) current_speed += acceleration;
      }

    else
      {
      if (current_speed > -.1f && current_speed < .1f) current_speed = 0f;
      if (current_speed != 0f) current_speed = current_speed * 0.9f;
      }

    transform.Translate (0f, 0f, current_speed);
    }

Update:

After switching the camera to a fixed position (rather than following the car), I've gotten better observations.  The car will clip right through at any speed if I keep pushing forward.  There's initial resistance from the collision detection and some stuttering from the car, but it always breaks through and then flips into the air on its way out.

I've added the following function to the car code:

void OnCollisionEnter (Collision collision_info)
  {
  current_speed = 0f;
  }

current_speed is what's being used to translate the car forward each frame.  This has slowed the bug down, but the car always eventually pushes through if I hold down the gas long enough.  It looks as if Unity's collision detection isn't moving the car back far enough on each frame that the car is colliding.  Must I handle that portion on my own?

sentences:
Scaling background without scaling foreground in platformer? I'm currently developing a platform game and I've run into a problem with scaling resolutions.

I want a different resolution of the game to still display the foreground unscaled (characters, tiles, etc) but I want the background to be scaled to fit into the window.

To explain this better, my viewport has 4 variables: (x, y, width, height) where x and y are the top left corner and width and height are the dimensions. These can be either 800x600, 1024x768 or 1280x960. When I design my levels, I design everything for the highest resolution (1280x960) and expect the game engine to scale it down if a user is running in a lower resolution.

I have tried the following to make it work but nothing I've come up with solves it so far:

scale = view->width/1280;
drawX = x * scale;
drawY = y * scale;

(this makes the translation too small for low resolution)

and

scale = view->width/1280;
bgWidth = background->width*scale;
bgHeight = background->height*scale;
drawX = x + background->width/2 - bgWidth/2;
drawY = y + background->height/2 - bgHeight/2;

(this makes the translation completely wrong at the edges of the map)

The thing is, no matter what resolution the game is run at, the map remains the same size, and the foreground is unscaled. (With a lower resolution you just see less of the foreground in the viewport)

I was wondering if anyone had any idea how to solve this problem?

Thank you in advance!

sentences:
Monogame - Screen transition with fading I'm trying to create a fade logic with Monogame for my screen transitions. I've read tutorials online but I'd like to work with Premultiplied Alpha for the fading. I've seen people add 1x1 pixels black images to their content, scale it to the screen's width/height (depending on aspect ratio) and drawing it with the alpha value first decreasing, and then increasing (fade in, fade out). So I would like someone to give me an example code to work with, preferably, 2 methods: FadeIn() and FadeOut in something like a Transition class. I should be able to call these at the begging and at the end of my screen classes. Keep in mind that I'm using the following enum code for screen state management:

public enum gameStates
{
    splashScreen,
    engineScreen,
    titleScreen,
    optionsScreen,
    playScreen,
    gameOverScreen,
    creditsScreen,
}
private static gameStates currentGameState = gameStates.splashScreen;
public static gameStates CurrentGameState
{
    get { return currentGameState; }
    set { currentGameState = value; }
}
// And then switch(currentGameState) in Update() and Draw()

So maybe FadeIn() and FadeOut() should take an enum value as a parameter? So that when they are called, the value is passed and inside them the currentGameState is accessed through the property in Game1 and is changed. Would this be the correct approach? Thanks!

sentences:
Is it a bad idea to store functions inside components in ECS? Say I have three entities: Player, Spikes, and Zombie. All of them are just rectangles  and they can collide with each other. All of them have the BoxCollision component.
So, the BoxCollison system would look something like this:
function detectCollisions () {
  // for each entity with box collision
    // check if they collide
      // then do something
}

The issue is, the sole purpose of the BoxCollision component is to detect collision, and that's it. Where should I put the game rules, such as "if the Player collided with Spikes, diminish its health" or "if the Zombie collided with Spikes, instantly kill the Zombie"?
I came up with the idea that each Entity should have its onCollision function.
Programming languages such as Javascript and F# have high-order functions, so I can easily pass functions around. So when assembling my Player entity, I could do something like:
function onPlayerCollision (player) {
  return function (entity) {
    if (entity.tag === 'Zombie') {
      player.getComponent('Health').hp -= 1
    } else if (entity.tag === 'Spikes') {
      player.getComponent('Health').hp -= 5
    }
  }
}

const player = new Entity()
player.addComponent('Health', { hp: 100 })
player.addComponent('BoxCollision', { onCollision: onPlayerCollision(player) }
// notice I store a reference to a function here, so now the BoxCollision component will execute this passing the entity the player has collided with

function detectCollisions () {
  // for each entity with box collision
    // check if they collide
      onCollision(entity)

onPlayerCollision is a curried/closure function that receives a player, and then returns a new function that wants another Entity.
Are there any flaws with this? Is it okay for components to store references to functions? What are other ways of avoiding game rules in components? Events?
Thanks!

sentences:
3D game with Pre-rendered background So a friend of mine and myself are starting to create our first game together.
We descided on doing a 2.5D kind of game, so a static camera that moves with the player but cannot rotate.

I got the collisions object from my friend which in unity looks like this:

Now I'd like to create an overlay with a JPG image which is going to cover the entire viewport and is going to "be" the map itself. I want to use this JPG as a kind of background image and then hide the collisions so the player will walk into the collisions and stop there but can't actually see them. In stead, he will see the image with buildings on it.

How can I do this correctly?
I've gotten as far as creating a second camera which will show me the image and then trying to create an Image (Create gameobject -> UI -> Image).

But I cannot find any way to continue on this.

Is this a good way to do this whole 2.5D kind of thing?

We want lightweight maps in our game and thought this was a good idea to go about this.

Edit

My friend and me are trying to create an isometric game like this.
The reason behind this is that the amount of work for the map is going to be massively reduced if we can do it like this since he can then just work in photoshop, in which he's super good.

This was he does not have to bother with the 3d design in detail and can make the collision blocks much faster.

So does anyone know how to get this to work? Maybe someone has a partial guide on this because I cannot seem to find anyone doing it like this but I imagine that ie Commandos is made like this.

It would be much appreciated!

sentences:
Mesa 9.2 does not support OpenGL 3 I'm trying to install OpenGL 3.0 for studying examples about GLUS , which require OpenGL 3 or 4.

I read on the official Mesa website that Mesa 9.2 support OpenGL 3.0, but after I installed Mesa 9.0, it only support OpenGL 1.4. This is the information  from the command line "glxinfo | grep "OpenGL" ":

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset
OpenGL version string: 1.4 (2.1 Mesa 9.1.4)
OpenGL extensions:

My question is how can I get OpenGL 3.0 in Mesa 9.2. I hope to see your answer!

sentences: Unity Applying Global Light Settings fog to a non-main camera Is it possible to apply fog to a non-main camera?

sentences:
How do I replicate the warp effect from Geometry Wars? I'm trying to achieve the warp effect that you see in games like Geometry Wars.

Can someone help explain what is going on here? I feel like the grid's z axis is manipulated in some way, any way, by the programmer, but is there maybe some known mathematical equation to really get the correct warping effect?

Edit: To be more specific, I mean the warping of the grid. How everything looks pulled towards the negative z axis and then bounces.

sentences:
FPS horizontal smooth camera rotation I have a problem, my camera is parented to the FPS Controller prefab, then there is a script I wrote for the rotation of the player horizontally by mouse movement, it all works but the rotation is very choppy and not smooth. How can I have the camera rotating smoothly or should I not parent my camera to the FPS Controller at all and make the rotation through scripting if so then how?

here's the script of character rotation:

void Update () {
    float rotationY = Input.GetAxis ("Mouse X") * 50f;
    transform.Rotate (0, rotationY, 0);

}

sentences:
using rperp or perp to find perpendicular of a vector i have code local coordinate

Vec2 velo = Vec2(100,0);
Vec2 Heading = velo.getNormalized();
Vec2 side = Heading.perp();
Vec2 trans = Vec2(12,12);

then i can generate toWorldCoordinate for trans vector:

word.x = heading.x* trans.x + heading.y * trans.y + pos.x;
word.y = side.x* trans.x + side.y * trans.y + pos.y;

im trying to apply example from book: game ai by example, using cocos2dx.
in cocos2dx we have rperp and perp for aplying perpendicular.
and in my POV,  cocos y is pointing up then we should use (-y,x) that is perp function.

but its seem the actor movement y is reversed then.
im realy confused with concept right hand / left hand. using rperp is fix the issue. but im still not understand why rperp should be used? afaik to make y pointing up we should use perp (-y,x) which is (1,0).perp = (0,1);// the destination is upward

sentences: How can I center a WebGL window in Unity? I have a WebGL build for my game, however, I'm getting frequent requests to center the image. Right now it is left justified. How can I center the WebGL game window?

sentences:
Apply new default transform values for gameobject I'm not sure if the title is correct. But how does one go about the following:

I imported a mesh created in blender.When i import the object it is at the desired rotation and scale, however, when i look at the properties of the transform the scale is 100 and the rotation is 89.9123xxxxxxx.

Is there any way i can rotate it to the desired rotation, scale it to the desired scale then tell unity that it should update the prefab and set this new rotation as 0,0,0 and the scale as 1,1,1.

Reason behind this, is i am tiling a few prefabs, and the rotations are being used.... after a couple of hundred tiles, there are floating point errors.

sentences:
How should I handle interrupting the current goal with goal-oriented action planning? I'm reading about goal-oriented planning for AI, but there I'm having difficulty finding an implementation so that I can address some questions that I have.  Specifically, I don't understand how to handle scenarios in which an agent is in the middle of a goal, but then another goal gets calculated as higher priority.  For example, suppose I have the following goals/subgoals/actions
MineGold (goal)
|--> MoveToGoldMine (goal)
|    |--> MoveToPosition (action)
|--> SwingPickaxe (action)
|--> TakeGold (action)
|--> DeliverGold (goal)
|    |--> MoveToTownHall (goal)
|    |    |--> MoveToPosition (action)
|    |--> DropGold (action)

AvoidEnemy (goal)
|--> MoveToHidingSpot (goal)
|    |--> MoveToPosition (action)
|--> Wait (action)

AttackEnemmy (goal)
|--> MoveToEnemy (goal)
|    |--> MoveToPosition (action)

When the game starts, my agent calculates its goal priorities and its highest priority is the MineGold goal.  So it pushes the list of subgoals and actions for MineGold onto its planning stack.
Suppose the agent moves to the gold mine, mines the gold, takes the gold, and then starts to move back to the town hall.  While it's moving back to the town hall, an enemy soldier gets close enough such that the AvoidEnemy goal becomes higher priority than the MineGold goal.  So now the agent pushes the AvoidEnemy subgoals and actions into its stack, ahead of the remaining DeliverGold subgoal.
While the agent is avoiding the soldier, an enemy assassin sneaks up on his team's commander.  The commander calls for help so the AttackEnemy goal becomes the highest priority.  So AttackEnemy is pushed onto the stack ahead of AvoidEnemy.
Eventually the assassin is killed, so the AttackEnemy goal is no longer valid and gets popped off the stack.  Now the topmost goal is AvoidEnemy to avoid the enemy soldier.  But if my agent just attacked the assassin, it would be weird for him to then start running away from the soldier (or maybe the soldier is already far away and I don't want to keep moving to a hiding spot), so I would rather him return to his original goal of DeliverGold.
Here are my questions:

Am I correct in assuming that I should be periodically recalculating the highest priority goal and switching to the highest priority goal if it's different than the existing goal?
Am I correct that when a new goal becomes higher priority than the current goal, then I should be pushing that new goal onto the stack ahead of the current goal, as opposed to overwriting the current goal with the new goal?
Assuming I'm correct that new goals are additive, how do I handle this situation where sometimes I don't want an agent to return to certain prior goals?  I know that I could accomplish this through a set of "mutually exclusive" flags or something, but that seems like an inelegant way and that it would start to return me to using finite state machines instead of goal-oriented planning.

sentences:
Creating a Pawn that simulates physics I'm trying to make a Pawn that I can raycast against. Starting from the DefaultPawn object, I can't find a way to have a StaticMesh cube that simulates physics. My raycasting code works with Actors, but I'd like to apply the same feature to moving objects now.

Any advice on how to achieve this?

sentences:
Libgdx rendering problems Have problems with rendering moving character using ShapeRenderer, it twitches while moving, and I don't understand where from comes the problem - bad game structure (do I need to override draw method from my actor,or just draw all entities in Stage's draw method) or troubles with movement logic.I'll add information if needed.

MainClass:

public class MFightGame extends Game {

@Override
public void create() {
    setScreen(new GameScreen());
}

@Override
public void render() {
    super.render();
}}

GameScreen:

public class GameScreen implements Screen {

private GameStage stage;

@Override
public void show() {
    stage = new GameStage();
}

public GameScreen() {

}

@Override
public void render(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.draw();
    stage.act(delta);
}

@Override
public void resize(int width, int height) {
    // TODO Auto-generated method stub
}

@Override
public void pause() {
    // TODO Auto-generated method stub
}

@Override
public void resume() {
    // TODO Auto-generated method stub
}

@Override
public void hide() {
    // TODO Auto-generated method stub
}

@Override
public void dispose() {
    // TODO Auto-generated method stub
}}

GameStage:

public class GameStage extends Stage {
private Creature creature;
private final float TIME_STEP = 1 / 300f;
private float accumulator = 0f;
private ShapeRenderer renderer;
private OrthographicCamera camera;

public GameStage() {
    creature = new Creature(100,100);
    addActor(creature);

    camera = new OrthographicCamera(800, 600);
    camera.position.set(camera.viewportWidth / 2f,
            camera.viewportHeight / 2f, 0);
    camera.update();
    renderer = new ShapeRenderer();
    renderer.setProjectionMatrix(camera.combined);
    Gdx.input.setInputProcessor(new InputHandler(creature));

}

@Override
public void act(float delta) {
    super.act(delta);
    accumulator += delta;
    while (accumulator >= delta) {
        accumulator -= TIME_STEP;
    }
}}

sentences:
Who has ownership of publicly developed projects? After seeing the comments on selling an idea to developer for a game, the general concencus is that without a game, or atleast a demo, it’s not going to happen. So…someone (yes, Noctrine, I am looking at you) suggested that it might me an interesting idea to turn it into a “public” project.

A few people have asked if I minded if they turned some of my concepts into models, something I always have agreed on. They tell me that it would be to use as work for their portfolio or for practice. Still waiting on those, but that is another story.

If I do this, set up a group to help starting modelers and programmers practice or get stuff for their portfolio, after everything is said and done, who has ownership of the project. I ask in case we end up with an actual demo and a studio get’s interested. Who do they buy it from?

I have no issue with paying accordingly to all participants, but in the legal aspect, who owns it before a publisher buys it?

sentences:
How rotate a 3D cube at its center XNA? I try to rotate a 3D cube on itself from its center, not the edge.
Here is my code used.

public rotatemyCube()
{
    ...
    Matrix newTransform = Matrix.CreateScale(scale) * Matrix.CreateRotationY(rotationLoot) * Matrix.CreateTranslation(translation);
    my3Dcube.Transform = newTransform;
    ....

public void updateRotateCube()
{
    rotationLoot += 0.01f;
}

My cube rotate fine, but not from the center. Here is a schematic that explains my problem.

And i need this:

sentences:
Effecient finding of long-range spotting targets I'm creating a top-down 2d strategy game, with a square grid map.
So far, I've used Bresenham's line drawing algorithm in a circle to determine what's in LOS of each unit, and then targedt one of the targets in the circle.
Now I find that this limits my units to shoot only at targets that they see. I want to extend my targeting algorithm to target any other unit in range of my weapon, even if they're out of sight range of this given unit, if they're "spotted" by another friendly unit. In other words, I want to enable usage of weapons with ranges longer than sight range.
Is there a better way than iterating over all sighted units and computing range and LOSto each of them?

sentences:
Cross-Platform CocosSharp Content Pipeline Project? Just getting started with CocosSharp and Xamarin.Forms and I wanted to move on from using Circles and lines to draw everything. It looks like setting up a MonoGame Content Pipeline project is the way to go.

I've got the tool installed (on my mac). My "game" is actually really simple and is more of a visualization. I want to load up a texture file for a background, an image or two for the foreground, and a largish pile of sound files.

Do I have to manage the exact same files twice, in a separate tool from Xamarin Studio in order to do this? It seems like I'm missing something, but the documentation doesn't talk about cross-platform sharing at all.

sentences:
Texture Editing with Multi-Threading So I have this giant Texture2D (4096 * 4096, don't ask why) and all its data stored in an array of Colors. When I hit left MouseButton I create a blue 64 by 64 square at the cursor's position using the following code.

        int dx = Mouse.GetState().X + (int)camera.Pos.X - graphics.PreferredBackBufferWidth / 2;
        int dy = Mouse.GetState().Y + (int)camera.Pos.Y - graphics.PreferredBackBufferHeight / 2;

        for (int x = dx; x < dx + 64; x++)
        {
            for (int y = dy; y < dy + 64; y++)
            {
                textureData[x + y * texture.Width] = Color.Blue;
            }
        }

        texture.SetData<Color>(lvlData);

Sadly this hangs the program for a split second. So I thought, maybe it's possible to run that piece of code in a different thread.

Is it possible to multi-thread that and if so, how would I go about doing that? Or is it another way to optimize this?

Thanks for any help!

sentences:
How can I use a display as a background in unity? I have a dancing game that I am trying to make and I have a stage where a character dances and a script to switch cameras inside that stage.
What I am trying to do is set those cameras to display 2 and use that display as a background for the place where the game actually takes place.
Is there a way to do that?

sentences:
Horizontal lines between vertices do not render Good day,

I am using LibGDX to try to render a mesh for a hexagon board. I can render the triangles, which is great, but I am having an issue rendering all of the line segments for the mesh and I can't figure out why.

Pictures

Here is an image of what it renders with the primitive type set to GL_TRIANGLES. The colours are just to help me troubleshoot/identify which triangles are where.

.

Here is an image of what it renders with the primitive type set to GL_LINES. Whether there is 1 triangle being rendered or 1 million, the horizontal lines do not get rendered.

.

Code

How I create the mesh:

mesh = new Mesh(true, MAX_VERTS, 0,
                new VertexAttribute(Usage.Position, POSITION_COMPONENTS, "a_position"),
                new VertexAttribute(Usage.ColorUnpacked, COLOR_COMPONENTS, "a_color"));

mesh.setVertices(verts);

renderable = new Renderable();
renderable.mesh = mesh;
renderable.primitiveType = GL20.GL_TRIANGLES;
renderable.meshPartSize = mesh.getNumVertices();
renderable.meshPartOffset = 0;

When I switch the renderable.primitiveType to GL20.GL_LINES I get the 2nd picture from above.

I've tried to set the renderable.meshPartSize a couple of different ways:

renderable.primitiveType = GL20.GL_LINES;

renderable.meshPartSize = mesh.getNumVertices(); // Doesn't work
renderable.meshPartSize = MAX_VERTS * 2;         // Doesn't work

Here is how I make a triangle:

void drawTriangle(float x, float y, float z, float width, float height, Color color) {
    // Counter-clockwise winding

    // Vertex 1: Top Left
    verts[idx++] = x;
    verts[idx++] = y;
    verts[idx++] = z;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;

    // Vertex 2: Bottom Left
    verts[idx++] = x;
    verts[idx++] = y;
    verts[idx++] = z + height;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;

    // Vertex 3: Top Right
    verts[idx++] = x + width;
    verts[idx++] = y;
    verts[idx++] = z;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;
}

Any help would be appreciated.

Thanks.

sentences:
What's the best way to make a game launcher? I am a new game dev, and would like to make a launcher for my games. All my games would be in ONE launcher, and it'd be similar to the Minecraft Launcher. I wanna do it for free too.
The main reason I wanna do it is to update my games. I don't have a file server, so the files would be on Google Drive.
Thanks!

sentences:
API agnostic bridges (ie. OpenGL/D3D/Whatever). Do you use them, how you make them. Pro's and Con's You are making a 3d engine. You want best of multiplatform worlds. Suddenly you realize that if you want to use Direct3D on Windows machines and OpenGL on OSX/Linux, you'll have to sacrifice supported features of both to least common denominator.

Some may use OpenGL across three OS', since it appears to be least common denominator by itself. All is good. Then, you have to port your graphics API backend to Nintendo's GX, you also have to make a PS3 and Xbox360 path.

What do you do? Do you design your own API which is least common denominator in itself and write backend implementations for it for each platform or do you write for each platform it's own branch?

If you opt to design your own API, do you use bridge pattern or your own voodoo? Where does madness stop where you realize everything and kitchen sink approach must stop and you basically have separate engine for each platform as a branch. Or you stick to everything and kitchen sink and keep platform specifics in backend module specializations for each platform.

sentences:
How do I play a sound after a given time is over? I have a sound effect in my game that I want to play every time there is a collision detected, the problem is that the collisions are very frequent and the sound plays many times and gets overlapped, which doesn't sound good.
The code is simple enough, I just put a walkSound.Play() in the OnCollisionEnter method.
I also tried using a coroutine but I don't get the desired result:
private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Ground")
        {
            StartCoroutine(WalkSound());
        }

    }

IEnumerator WalkSound()
    {
        walkSound.Play();
        yield return new WaitForSeconds(0.41f);
    }

The WaitForSeconds could be above the playing code, but then there is an unnecessary delay that I don't need.
Basically what I want to achieve is, to have code execute the Play() method only when the previous iteration of the sound reaches 0.41f seconds. This is similar to having an if statement that checks if the sound is already playing, but I want the sound to overlap at a given time.
Hope I was clear enough, any help appreciated. :)

sentences:
Cocos2D 2.0 - masking a sprite I have read this tutorial about how to mask sprites using Cocos2D 2.0. http://www.raywenderlich.com/4428/how-to-mask-a-sprite-with-cocos2d-2-0

But the author talks about OpenGL ES textures and vertices as they were common knowledge. My knowledge about OpenGl is zero raised to infinity.

All I want is to use a rectangle to mask a sprite to it. How I would do in Photoshop using a rectangle as mask (yes, I want to clip a sprite to the rectangle bounds and no, I do not want to use the ClippingNode solution, that do not works for animation/scaling etc.).

So, can you guys translate the klingon language used in this tutorial and tell how a solid rectangle can be used to mask a sprite in Cocos2D?

I am desperate, as my username states. I am searching this for a week and have tried several solutions without satisfactory results. Please help me.

Thanks!

sentences:
Why does Unity heavily blur edges of a single cube despite 8x antialisaing I was messing around a random project and everything was working perfectly, when all of a sudden jagged edges appeared on all objects. I've been trying to resolve this issue for the past two dails, only to no avail. I have tried changing various settings, when at last I've uninstalled unity and removed all projects. After re-installing it, however, the problem still persists:

What I've tried:

changing settings in Nvidia Control Panel (for example, settingantialisaing mode to application-controlled)
changing the Quality settings inside Unity
removing any normal/texture maps
changing metallic and smooothness of the material and removing specular highlights
reinstalling Unity

These pictures depict current settings/object properties:

Properties of material added to the cube

Camera properties:

Quality settings:

Graphics settings:

sentences:
Isometric camera movement My camera system has two objects: the isometric camera itself, and an empty object it's attached to which handles both movement and rotation. When the player drags the middle mouse button, the camera (or, rather, the empty object) moves like this:

Vector3 diff = lastFramePosition - currFramePosition;

float xchange = diff.x / 5;
float ychange = diff.y / 5;

//flips the direction of movement if the rotation of the object is a certain way
if (transform.rotation.y == 90 || transform.rotation.y == 180)
                ychange *= -1;

if (transform.rotation.y == 270 || transform.rotation.y == 180)
                xchange *= -1;

Vector3 pos = transform.position;

//moves the camera and restrains it within the limits of the map (core.mapx and core.mapy)
transform.position = new Vector3(Mathf.Clamp(xchange + pos.x, 0, core.mapx), 3, Mathf.Clamp(ychange + pos.z, 0, core.mapy));

It turns out, though, that since it moves the empty object along the X and Y axes, dragging up/down or left/right moves it along those axes instead of actually moving the camera view up/down and left/right. The best way I can describe it is like those old isometric games that do the exact same thing. Is there any way I can get it to move like this?

sentences:
How can I set 3d sound to my game in unity5? I have been working on a racing game in unity5. Now I want to set 3d sound so that if the game objects are far away from and coming towards the camera then it sounds like began to attenuate and then louder when closer to the game camera.

But I don't know how to do that.......if anyone knows then please help me out.
Thanks...!

sentences:
Phong shading blows out things close to white [OpenGL]; is there a way around this? I'm doing per-pixel lighting using the Phong shading model.

In pseudo code this looks like:

vec4 ambientColor = light.ambientIntensity * material.diffuse;
vec4 diffuseColor = light.diffuseIntensity * material.diffuse;
vec4 specularColor = light.specularIntensity * material.specular;
finalColor = (ambientColor + diffuseColor + specularColor);

And you can add in a shadow map or light attenuation easily. Even color the light via the light.xIntensity values.

My problem is that I have a cloud texture that's all white values with varying levels of alpha. This is textured on a sphere. When rendering, what happens is that at the very appex of the light, i.e. the point closest to the light source the following seems to be happening:

When my light.ambientIntensity is at 0.2,0.2,0.2,0.2 I get an ambientColor on the whitest parts of the texture is say 0.2,0.2,0.2,0.2 and on the darkest parts of the texture could be 0.2,0.2,0.2,0.0.
With a light.diffuseIntensity of 1,1,1,1 I will get diffuseColor ranging from 0,0,0,0 (when we're nowhere near the light, i.e. the other side of the sphere) through to 1,1,1,1 when we're on the tip closest to the light and the diffuse color of the material is also full white.
I can skip specular here. Because the end result is now 1.2,1.2,1.2,1.2. The problem is that I'm now losing some detail because any values that should have been 0.8,0.8,0.8,0.8 are now full opaque white.

I understand that this would be desirable under some situations, like using HDR, but in this particular case it's not the result I want.

I'm using OpenGL 4.4 but I assume this problem and a solution is API agnostic.

sentences:
How can I make a custom memory allocation for classes with virtual methods? I want to create a custom allocator that stores objects to the heap sequentially. The allocator itself is very simple. It just allocates a big chunk of memory and moves an offset as Allocate() calls happen.

The problem comes when allocating memory for custom types, especially classes with virtual functions.

SomeClassWithVirtualFunctions * address = array_allocator->Allocate(sizeof(SomeClassWithVirtualFunctions));
SomeClassWithVirtualFunctions->Init(...);

It throws a seg fault when the virtual function is called, since as i am given to understand, stuff that are initialized through the constructor (vtable for example) are now ignored.

However, if i do the following,

SomeClassWithVirtualFunctions * the_new_object = new SomeClassWithVirtualFunctions();
char * memory = array_allocator->Allocate(sizeof(*the_new_object));
memcpy(memory, the_new_object, sizeof(*the_new_object));
SomeClassWithVirtualFunctions->Init();

then the code works fine. I believe though that the above is a dangerous work-around trick.

The intend is to have a base class with virtual functions like Step() for example, that game classes like Player, Grass, Wall override to have unique behavior.

What is the best way to implement this? Do i use the custom allocator to store only primitive class members stuff, and classes are allocated normally?

Will overriding the new operator for SomeClassWithVirtualFunctions work?

void * operator new(size_t size) {
    char * address = array_allocator->Allocate(size);

    return address;
}

sentences: Typing text animation (dialogue) libGDX or in general Can anyone think of an efficient way to animate the typing dialogue text as found in pokemon? I have a vague idea of using string.length, and having a new letter drawn every .2 seconds or so, but rather than using a timer event, i was wondering if there is a better way to do this. for example an animation, but i can't find anything like that in libGDX. Any ideas?

sentences:
What's the fastest way to copy a texture to another texture in OpenGL? Here's the options I've found:

glBlitFramebuffer: Create framebuffers for the textures, bind textures as GL_READ_FRAMEBUFER and GL_DRAW_FRAMEBUFFER, call glBlitFramebuffer().
glCopyTexImage2D: My research so far says this method is probably slow.
Shaders: Make a framebuffer and render target, render the source texture to the dest texture.

sentences: Has piracy ever resulted in a developer getting shut down? Has piracy EVER resulted in a developer getting shut down? That is, has piracy ever been so detrimental that it brought about the downfall of a game studio? If I were to release a game, should I be extremely wary of pirates and plan accordingly, or is it safe to assume that it won't damage me or my studio whatsoever?

sentences:
Unity3d High level literature Is there any high level literature for mid professional programmers for Unity?
There are a lot of tutorials for beginners, but I can't find anything about main API, pipeline or engine architecture. Recommend, please!

sentences:
Can someone explain Flappy Bird's physics to me? I am having a difficult time trying to understand the Flappy Bird physics. I know it seems simple but I kind of suck at math. I am trying to see if I can make a simple game like this but it is just the dang physics that are throwing me off. I have something like gravity effecting the bird but when you click the screen and I add some amount to the y position but it doesn't look good. You guys have any ideas?

Stuff like:

velocity += -9.8 * Gdx.graphics.getDeltaTime();
position.y += 0.5 * velocity;

That is falling but when I tap the device I would like to know how to add upward force but when it loses it continue falling.

sentences:
Skeletal Animation with UV seams I have a UV-mapped model that I am about to animate and load into my game. Like most unwrapped models, I have several UV seams. In order to render the model correctly, I split each vertex along the seam into two vertices whose positions and normals are the same but whose UV coordinates differ. I do the same thing when I have more than one normal associated with a vertex.

This works fine for static models, but now I'm getting into the realm of animation. Technically since the two seam vertices occupy the same position in space they should use the same joint weights and joint IDs. Right now the simple way to do this is to just give them the same joint weights and joint IDs and then skin them separately. But to me this seems very wasteful because there are so many vertices along seams and so there will be many duplicate computations. It gets even worse since I need to render the animated model into the shadow map too.

Does anyone have any thoughts about improving this process? I've considered using something involving OpenGL transform feedback to save the results of the transformed vertices. This would at least help with computing transformed positions once and using the same results in the main render pass and shadow pass, but I still can't think of an elegant way to handle the duplicate computation along UV seams.

sentences:
Simulating probability Stupid stupid question but here we are..

so, I want to generate some random events for an iPhone game but I guess this could be applied to any game written with a framework that suppports calls to "C" functions as I am using CCRANDOM that calls the random(void) function from the C stdlib.h.

I have written a function "verifyEvents" that I call each time I load a particular view (game scene).

To associate a probability to an event I assigned a value to each event (e.g. kill player: 0.05, give extra bonus 0.08).

In the function I generate a random number using CCRANDOM_0_1() and if the number is less than the assigned value I trigger the event (below there is the code).

Is this the best approach or do you use something else in your games?

-(void) verifyEvents
{
    float value = CCRANDOM_0_1() ;
    float eventPValue = 0.05f;

    if(value<eventPValue){
        CCLOG(@"EVENT!");
    }
}

PS: CCRANDOM_0_1() is defined as following:

#define CCRANDOM_0_1() ((random() / (float)0x7fffffff ))

sentences:
Starcraft 2 Editor: I want to make two players share their income I have a scenario where there are 4 teams vs. a raging Zerg horde constantly attacking them. The idea was allow that player 1 & player 2 in the same team share their income, so that one player could focus on getting the income (SCV income as they deliver the goods) and the other defending.

I haven't gotten the trigger right yet. Anyone have some tips for me?

sentences:
Get position of tile in tileset How can I get the position of tile 14 (or any other) when only knowing the following:
Tile ID: 14
Rows: 4
Columns: 7

The end result should be 2x4.

sentences:
OpenGL Shadowmaps Limit I would like to render an OpenGL scene with an arbitrary number of point lights (at least 1024) with shadows enabled.

My current method of rendering shadowmaps, however, cannot do this.

Let me explain

There are only 32 textures you can pass to a fragment at a time.

I am using 31 of those 32 textures for shadowmaps at the moment.

pseudocode for my main code...

setShader("DepthBufferPointLight", -1); //the int is actually numlights, used for deciding whether or not to recompile a finalpass shader. Irrelevant in this stage and set to -1 for debugging purposes.
FBO fBO* = CreateFBOs[6 * numLights]
for (int j = 0; j < 6; j++)
for (int i = 0; i < 6; i++)
{
 setRenderTarget(fBO[i]);
 setupCameraforLight(j,i); //Move the camera to the right position
 renderSceneDepth(); //Textures aren't even rendered for this
}
setRenderTargetDefault();
setShader("FinalPass", numLights); //The shader dynamically recompiles for final pass calls if the number of lights has changed, because it will need to change how many uniform struct lights there are.
setLightTextureUnits(fBO, 6, numLights); //glActiveTexture calls and glBindTexture calls
renderSceneFinalPass(); //Textures and uniforms are all set up for this, also does the lights

and then in the shader pipeline I do my calculations using the shadowmaps.
My pseudocode is rough but you get the picture.

(SIDE NOTE: the dynamic recompiling is actually really simple and only changes one line of the shader, and I'm going to deprecate and remove the function once I figure out how uniform variable arrays work...)

my code breaks after numlights*6 is greater than 31.

Is there a better way to do this?

my ultimate goal is to render an arbitrarily high number of point lights using shadow mapping

sentences:
How to create a re-usable layout of text fields that can be bound to in world space? Current tools:

Unity 2020.3.2f1 (Win10)
UI Builder preview package

My end-goal is to do the following:

At varying intervals, change values for many data objects in the background, such as prices, resources, demand, supply, etc.
Display those values in a flat table/list (as they change) in world space to the player, e.g. on a TV screen (or a transparent panel hovering above it, etc.)
Have the ability to apply that layout (and its bindings) to another world space object of a different size, e.g. on a smaller or wider TV screen

Imagine an office with 15 desks, all with 3 monitors showing the same data feeds and changing statistics, except the monitors were all different shapes and sizes. How could you avoid building all 45 monitor layouts individually, and binding to each field separately? So my question is:
What is the "right" way to build a re-usable UI (ideally with UXML/USS), display it in world space, and have the ability to update the text in that layout?
I thought that UI Builder + UXML/USS would be the answer, but I am having trouble parsing how my end goal would be accomplished using that (or if that is even an appropriate use case for UI Builder). Fields that are displayed using UIDocuments are not exposed in the Hierarchy, and can't be dragged onto a script's input in the Inspector, for example. I'm able to project a UXML/USS layout onto a texture => material => object, but I'm not sure how to bind to the fields within the layout:

The screenshot above is my latest attempt, a POC of a live timer (on the right) manually being updated (using a TextMeshPro field, works great), and the yellow panel to the left is a UXML/USS layout pasted onto a texture/material that's applied to a panel (in a canvas). On the far left is that same layout being used as a HUD, just to confirm it works the same as the floating panel. In-game, this data will not be part of the HUD, it will only be in world space. As a POC, I have been trying unsuccessfully to get the timer value from the gray panel to bind to the "should be time" text in the UXML.
So, should I just bite the bullet and build each layout by hand using game objects (such as in the gray panel)? Or am I halfway there with the UXML and just misunderstanding how UIDocuments work? Or is there a new smarter way of doing this I haven't heard of yet? Not looking for a full code example or anything, just a push in the right direction.

sentences:
Do larger sprite sheets improve performance in html 5 games? I know when I did some game development with XNA they recommended that we try to group are sprites into fewer sheets because the graphic card could process it faster. Does this also apply to web based games?

Note: Not sure if this makes a difference but most of my artwork is pretty defined by separate levels. In other words I'm not really reusing artwork across levels, which kind of made me wonder if I should be loading sprites that never get used just for the sake of grouping them into a spritesheet.

sentences:
Sprite button not triggering "On Click()" event -Unity Hi have created some buttons from sprite and I added image and button components on it.

I am just using sprites because In my game the camera can be moved on x and y. But I don't want my button to move and since UI buttons move with camera that is why I am not using them.

Here is the GIF to explain the scene:

sentences: What is billboarding, and can/should it be used in 3D games to create special effects for weapon blasting effects? What is billboarding, and can or should it be used to create special effects for 3D games on weapon blasting effects?

sentences:
Is it feasible to create a game in godot using little to no GDScript I am trying to get more into game development, I have very little experience with it. I've been messing around a bit with the Godot engine and am slowly starting to understand it more. I have some experience with C# and C++, both of which can be used with Godot (to my knowledge, correct me if I'm wrong), and it also has its own language, GDScript. From what I've seen the language looks a lot different from any I've used (C#, C++, and Java), and I really don't want to learn it, I especially don't want to learn a new engine and a new language at the same time.

So basically would it be possible to create a game in Godot using very little to no GDScript without missing out on features or making life a whole lot harder? Another way to word it could be 'is there any thing that is impossible or very much harder to do in C# or C++ than if you were using GDScript?'

Sorry if this is too broad or anything, I'll try to fix it if need be

sentences:
How to build a static version of cocos2d-x and link it to my project Firstly, I'm using Cocos2d-x v3.6 for Win32 desktop + Visual studio 2013 and C++.

When building Cocos2d-x, always it has been built as a dynamic version not a static version as I want.

How to build it as static version ?
Then, How to bind it with the project ?

sentences:
Multi texture obj files? Im downloading some free 3d models off the internet to test things in my game. When I download the package, it gives me a bunch of texture files and the obj model. What I dont understand is what I do with those textures? Are they used as source image files within the object? If so how can I export the uv map of the model with all these textures on it? Ive been trying to get a working example of this and havent been able to. Can someone guide me in the right direction? I edit my files with blender, and realize this question is a little bit off topic, but im lost!

EDIT:

Example of the textures I am using now:

sentences:
Direct3D 12 STATE_CREATION ERROR #649: CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE Every time my constant buffer helper creates the "Constant buffer view" with the CreateConstantBufferView method i get an error which states:

D3D12 ERROR: ID3D12Device::CreateConstantBufferView: pDesc->BufferLocation 0x00000000a9df6000 does not belong to any existing Resource or Heap. [ STATE_CREATION ERROR #649: CREATE_CONSTANT_BUFFER_VIEW_INVALID_RESOURCE]

this makes no sense as the resource is created and used (just like in the previous working usages of this method) the only thing that is different is the descriptor heap and obviously the instance of the constant buffer helper.

Also it is used by a different command list and Pipeline state object (PSO), this may be the problem but I am unsure.

here is the relevant code for the creation of the constant buffer view:

D3D12_CONSTANT_BUFFER_VIEW_DESC desc = {};
desc.BufferLocation = cbvGpuAddress;
desc.SizeInBytes = size;
m_deviceResources->GetD3DDevice()->CreateConstantBufferView(&desc, cbvCpuHandle);
sizeInBytes = desc.SizeInBytes;

Below is for the creation of the descriptor heap and constant buffer helper:

 m_cbvSrvHeapManager = std::make_shared<DescriptorHeapManager>(DX::c_frameCount + 1, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, m_deviceResources);
    m_cbvDescriptorSize = m_cbvSrvHeapManager->GetDescriptorSize();

m_mvpConstantBufferManager = std::make_unique<ConstantBufferManager<Structures::ModelViewProjectionConstantBuffer>>(DX::c_frameCount, m_mvpConstantBufferManager->GetAlignedSize(), m_deviceResources, m_commandListManager);
    for (int n = 0; n < DX::c_frameCount; n++)
    {
        m_mvpConstantBufferManager->CreateBufferDesc(m_mvpConstantBufferManager->GetAlignedSize(), n, m_cbvSrvHeapManager, m_cbvDescriptorSize);

    }

Below is for the previous working usage of the creation of the descriptor heap and and constant buffer helper:

m_cbvSrvHeapManager = std::make_shared<DescriptorHeapManager>(DX::c_frameCount + 2, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, m_deviceResources);

m_cbvDescriptorSize = m_cbvSrvHeapManager->GetDescriptorSize();
    m_mvpConstantBufferManager = std::make_unique<ConstantBufferManager<Structures::ModelViewProjectionConstantBuffer>>(DX::c_frameCount, m_mvpConstantBufferManager->GetAlignedSize(), m_deviceResources, m_commandListManager);
for (int n = 0; n < DX::c_frameCount; n++)
{
    m_mvpConstantBufferManager->CreateBufferDesc(m_mvpConstantBufferManager->GetAlignedSize(), n + 2, m_cbvSrvHeapManager, m_cbvDescriptorSize);
}

sentences:
Server side random selection of players Assuming I have a simple client-server game, where the server picks random players on a very frequent base, I was wondering what is the best way to select a random player (According to the following constraints):

Solution must be high performance and highly scalable
Random spread should be relatively even (meaning if I have 3 players and pick 99 times, they will all be picked 33 times more or less)
Should only pick players who were active in the past X days (optional, but a big bonus)

The actual DB or data model used to store players isn't an issue here, as we'll select the technology in accordance to our needs.

However, high performance and scalability is (at the moment we have over 60,000 unique daily active players, and we plan on growing even more).

Thanks!

sentences:
Ray-tracing Moveable Objects I am fond of creating graphics and animations using the frameworks on the iOS platform; lately, I discovered that, in order to create better visual designs, those higher-level of frameworks do not provide enough controls to satisfy the needs of creating more advanced-level designs. Hence, I decided to invest my time in studying OpenGL ES.

Whilst doing so, I came across the ray-tracing topic; I have spent quite a bit of time studying the mathematics and topics related to it. And, I have been able to render simple stationary objects (geometrically) using this technique.

In order to learn deeper, I started to toy around with the idea of allowing these objects to have movements based upon user-interactions (I.e., when the user moves the object on the screen with her finger, the corresponding object will spin around or simply move to the respective location based upon the user's touch (on mobile device)).

According to what I have studied thus far on ray-tracing, however, this operation of allowing the objects to move based on user-interactions could be very costly in ray-tracing. To me, for example, it would mean that, if a rendered sphere were to spin around based on user's touch on the screen, I would need to ray-trace the whole sphere for every frames as the sphere spins.

Is my understanding correct here?

My question is, is it possible to perform ray-tracing on objects that are movable; if so, is there another ray-tracing technique specialized especially for this purpose, which could be less costly? Or, is ray-tracing more suitable for rendering only architectural objects, which are usually stationary?

Thank you.

sentences:
player keeps on firing (Javascript + Canvas) I'm brand new to game development (with Javascript)... I'm pretty sure my question is very simple, but I have a hard time to figure out myself... I'm starting at the very beginning, so this is pretty simplistic.

This is my whole code in javascript:

var fire = false;
function keyUp(evt) {
  switch (evt.keyCode) {
     case SPACE:
        fire = false;
     break;
     ...
  }
}
function keyDown(evt) {
  switch (evt.keyCode) {
     case SPACE:
        fire = true;
     break;
     ...
  }
}
function update() {
    ...
    if (fire) {
        playerHasShot = true;
        shot.x = player.x + player.w;
        shot.y = player.y + (player.h / 2);
        shot.vx += 2;
    }
    if (!fire) {
        playerHasShot = false;
    }
   ...
    shot.x += shot.vx;
   ...
    //Bullet
    if (playerHasShot) {
        playerHasShot = false;
    }
    if (!playerHasShot) {
        playerHasShot = false;
    }
    ...
    if (shot.vx > 4) {
        shot.vx = 4;
    }
    ...
    if (shot.x > canvas.width) {
        shot.x = player.x + player.w;
        shot.y = player.y + (player.h / 2);
        playerHasShot = false;
    }
    ...
    render();
    renderShot();
}

I hit the spacebar once, and that guy can't stop shooting... Would any of you mind telling me how to stop him, please ? I'm sure I'm close, but there's something I'm missing somewhere.... Thanks! :)

sentences: Box2d How to connect distance joint to the ground? I have a rectangular fixed size world. I want to connect a body inside it to any place(near that body) in the world with a b2DistanceJoint. Do I need to create a large static body with the size of the world that can't collide with anything? Or is there a better method? Will it slow down simulation speed if I have around 300 bodies moving on the surface of this static body?

sentences:
Orbiting a camera around the Y axis whilst remaining up I've been having difficulty with a problem which I thought was going to be a simple solution.

I have a camera facing downwards on a character. The can camera be lowered and when it's lowered it remains the same distance away from the character that it was (basically rotating around the X axis of the target). Now what I want it to be able to do is spin around the character on the Y axis as well, but to maintain the same distance and to remain upwards all the time. The problem I'm having is that if I do something similar to the way I did it on the X axis everything becomes a mess. First of all it doesn't remain facing up, as it spins the camera ends up upside down and i'm not really sure how to recalculate the up vector for it. But ontop of that it doesn't maintain the same distance from the character at all times.

This is what I have right now:

        cameraUp = new Vector3(0, 1, 0);
        cameraPosition = new Vector3(cameraOffset.X, cameraOffset.Y, cameraOffset.Z);
        cameraPosition = Vector3.Transform(cameraPosition - cameraTarget, Matrix.CreateFromAxisAngle(Vector3.UnitX, tippingAngle)) + cameraTarget;

//This is the part that I'm having difficulty with, the rest works fine.
        cameraPosition = Vector3.Transform(cameraPosition, Matrix.CreateFromAxisAngle(Vector3.UnitY, rotationAngle));

        view = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUp);

EDIT:

Thank you to everyone, all of your comments helped. The biggest issue was that somehow I let it slip past that the cameraUp value was wrong, I think it happened as a typo when I was tidying the code up. Anyway, after fixing that the code above was exactly what I needed. I had tried that before but because the up vector was wrong I was getting really weird results so thanks to everyone. :)

sentences:
Hide individual regions on a territory map I have a map of adjacent irregularly-shaped territories. It happens to be a county map, but that's not important. In the game, the player only sees a few to start, and as he progresses to new territories, the ones adjacent to it are revealed. It's a territory-scale fog-of-war.

I'm using Unity3D, and my inclination is to make a set of planes, each of which has an image of a single territory on it, and then arrange them manually like a jigsaw puzzle. It then is fairly easy to respond to a click on each region and also to mark the planes as visible or invisible, or even do clever things like fade or zoom on individual regions.

This sounds like an arduous task, and if we need to change the visual design of the territories, we'd have to cut up the main map all over again into each of the individual pieces.

Does anyone have a more elegant solution to this problem?

sentences:
What is the best way to check if there is overlap between player and static, non-collidable items in bullet physic engine I'd like to add non collidable objects (eg: power ups, items, ...) in a game world using Bullet Physics Engine and to know if there is collision between player and them.

Some info : there is a lot of items (> 1000), all are box shapes and they don't overlap.

Here is things i have tried :

btDbvt* bvtItems = new btDbvt(); //btDbvt is a hierachical AABB tree, used by Bullet
foreach(var item ...)
{
    btDbvtVolume volume = ... //compute item AABB;
    bvtItems->insert(volume, (void*)someExtraData);
}

Then, to find collisions between items and player :

playerRigidBody->getAabb(min, max);
btDbvtVolume playervolume = ... //compute player AABB
bvtItems->collideTV(bvtItems->m_root, playervolume, *someCollisionHandler);

This works fairly well (and its very fast), however, there is a problem : it only check items AABB against player AABB. That loss of precision is acceptable for items but not for player which is not a box. It would actually need another check to make sure player really collide with item but i don't know how to do this in Bullet. It would have been nice to have a function like this :

playerRigidBody->checkCollisionWithAABB();

After doing trying that, I discovered that a btGhostObject exist and seems to have been made for that.

I changed my code like this :

foreach(var item...)
{
    btCollisionObject* ghostObject = new btGhostObject();
    ghostObject->setCollisionShape(boxShape);
    ghostObject->setCollisionFlags(ghostObject->getCollisionFlags()
                                   | btCollisionObject::CF_NO_CONTACT_RESPONSE);
    startTransform.setOrigin(...); //item position
    ghostObject->setWorldTransform(startTransform);
    dynamicsWorld->addCollisionObject(ghostObject, btBroadphaseProxy::SensorTrigger,
                   btBroadphaseProxy:: CharacterFilter);
}

It also works ok, but there is a huge fps drop (almost ten times slower) which is not acceptable. Maybe there is something missing (forget set a flag) and Bullet is doing extra job for nothing or maybe all that ghostObjects are polluting broad phase and ghostObject is not the right thing for that.

Any help would be appreciated.

sentences:
What does everyone like to use for UI elements for their games on the iPhone? I'm asking this to get everyone's opinion -- I realize there isn't one "right way" to do this.  I've tried a few ways myself, including using Cocoa for everything including the game itself (good for simpler games, like card games for example), using Cocoa for the screens outside of the game and using my game engine to present game objects on the screen as UI.

What do people prefer to use for game UI?  I'm particularly interested in hearing about why you chose to go that way and if you found that your choice was a good one after implementing it.

sentences:
Is there a simple 2D Android barebones starter project? I'm looking at creating a tower-defence-style game on Android, developed in Java. I'm spending a lot of time trying to just get a background image (drawn onto a canvas) that pans/zooms within the bounds of the screen etc. that I will eventually draw my game onto.

It seems to be a lot of work just to get theses basics working correctly. Is there a simple barebones project that has this stuff taken care of that I can build my game on top of?

sentences:
16-bit PNGs in Slick2D I'm working on a project and I'm using some 3rd party sprites just to get it off the ground; recently I've come into a hitch. Slick2D doesn't seem to want to load my images. That is, it will warn me that images are the wrong bit-depth. All the images are in 16-bit PNG form (PNG is required for transparency). Is there any way I can disable the warning (being the bad guy programmer (the console print for each individual load REALLY SLOWS DOWN the image)) or is there another solution?

I was thinking about converting all images (using imagemagick) to .gif (with an alpha channel). Would there be any loss in quality between formats?

EDIT: I tried using imagemagick but some of the sprites use pure black so I can't do that without wrecking the image.

EDIT2: using "identify" on any of the images show them as being 8-bit.. but Slick2D won't load them. What the hell? D:

EDIT3: Issue solved (ish). If you are googling this then just disable the java png loader from slick by sticking this somewhere in your code (like the main method):

System.setProperty("org.newdawn.slick.pngloader", "false");

sentences:
How can I expose a property to Unity that should be treated like an asset path? I want to be able to do something like this:

public FileInfo XmlBehaviourFile;

And then use the asset browser in the Unity editor to select an asset. Ideally, I would like to limit it to XML files but that isn't too important.

I am aware of TextAsset but I can only access either a string or byte array of the contents. I can probably make this work, but at the moment, my library takes a FileInfo and handles the reading itself.

Is there a Type I can use that will make Unity let me choose a file in the editor and then simply store the path (ideally, it would handle making sure the path is relative and including the asset in the build).

Alternatively, would it be possible to write such a type that would work, I've not extended Unity, but I am aware it is possible.

sentences:
Can't remove JPanel from JFrame while adding new class into it Basically, I have my Frame class, which instantiates all the properties for the JFrame, and draws a JLabel with an image (my title screen). Then I made a separate JPanel with a start button on it, and made a mouse listener that will allow me to remove these objects while adding in a new Board() class (Which paints the main game).

*Note: The JLabel is SEPARATE from the JPanel, but it still gets moved to the side by it.

Problem: Whenever I click the button though, it only shows a little square of what I presume is my board class trying to run.  Code below for the Frame Class:

package OurPackage;
//Made By A.K. 5/24/12
//Contains Frame.

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;
import javax.swing.plaf.basic.BasicOptionPaneUI.ButtonActionListener;

public class Frame implements MouseListener
{
    public static boolean StartGame = false;
    ImageIcon img = new       ImageIcon(getClass().getResource("/Images/ActionJackTitle.png"));
    ImageIcon StartImg = new ImageIcon(getClass().getResource("/Images/JackStart.png"));
    public Image Title;
    JLabel TitleL = new JLabel(img);
    public JPanel panel = new JPanel();
    JButton StartB = new JButton(StartImg);
    JFrame frm = new JFrame("Action-Packed Jack");

    public Frame()
    {
        TitleL.setPreferredSize(new Dimension(1200, 420));
        frm.add(TitleL);

        frm.setLayout(new GridBagLayout());
        frm.add(panel);

        panel.setSize(new Dimension(220, 45));
        panel.setLayout(new GridBagLayout ());

        panel.add(StartB);
        StartB.addMouseListener(this);
        StartB.setPreferredSize(new Dimension(220, 45));

        frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frm.setSize(1200, 420);
        frm.setVisible(true);
        frm.setResizable(false);
        frm.setLocationRelativeTo(null);
    }

    public static void main(String[] args)
    {
        new Frame();
    }

    public void mouseClicked(MouseEvent e)
    {
            StartB.setContentAreaFilled(false);
            panel.remove(StartB);
            frm.remove(panel);
            frm.remove(TitleL);
            //frm.setLayout(null);
            frm.add(new Board()); //Add Game "Tiles" Or Content. x = 1200
            frm.validate();
            System.out.println("Hit!");
    }

    @Override
    public void mouseEntered(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseExited(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mousePressed(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void mouseReleased(MouseEvent arg0) {
        // TODO Auto-generated method stub

    }

}

EDIT: I also created a new Board Object(?) in my Frame class. Will I be able to resize it and such?

sentences:
Shader models, when to use "ps_4_0_level_9_x" instead of "ps_4_0" I've made a very simple post processing shader for my 2D game. It produces scanlines by dimming every other line. For this I use the position of the pixel on the screen.

When using ps_4_0_level_9_3, I receive the message:

shader model ps_4_0 feature level_9_3 doesn’t allow reading from position semantics

So I switched to just ps_4_0 and things work fine. I probably won't be using any advanced shaders in my 2D game.

My questions are:

By setting the pixel shader to 4_0 only, what impact does that have for my game (if any) - is it a mistake to 'downgrade' the pixelshader?
How do I know what pixelshader version to use? I found this: Direct3D featurelevels but I'm unsure when to use what shader? Is there a list like "for windows use this", "for mobile this" or is it, use the lowest version that supports the feature you need?

sentences:
Does the latest DirectX SDK support both Direct3D 9.0c and 11? 1) What is the latest version of DirectX SDK?

2) For my purposes I need DirectX 9.0c SDK and DirectX 11 SDK. Do I need to install these libraries separately or last DirectX SDK package contains both of versions?

sentences:
How to transition between states and mix states in a finite state machine? I don't understand how to use a finite state machine with the entity controlled by the player.

For example I have a Mario style game (2d platform). I can jump, run, walk, take damage, swim, etc. So my first thought was to use this actions as states. But what happens, if you are running when you take damage? Or jumping, taking damage and shooting at the same time?

I just want to add functionalities (actions) to the player in a clean way (not using it for all the actions in the entity update) .

sentences:
Optimization of rendering of cube world I have a world made of many cubes (like in Minecraft), they have only color (not texture). I am rendering them using OpenGL 3.3 core profile (GLFW3, GLAD, GLM). I am already have done some optimizations:

not rendering internal faces
backface culling
rendering faces using GL_TRIANGLES and indexing

But it's still a lot slower than Minecraft, but Minecraft is in Java and blocks have textures, there is bigger world (there are entities etc. too)! How can I optimize my program further?
It may be something with pre-computing. Player rarely change the world (only small part of ticks).
I am currently filtering faces with this code:
// for every block
if (blocks[x][y][z] != nullptr) { // nullptr means that block is air
    bool drawSides[6];
    if (world.GetBlockAt(BlockPos(x, y, z - 1)) != nullptr)
        drawSides[0] = false; // internal face, culled
    else
        drawSides[0] = true; // draw that side
    // other 5 sides
    // ...
    blocks[x][y][z].draw(sides);
}

sentences:
Having trouble with EOF in Xcode I'm getting an error that says "control may reach end of function" and I have gone through my code several times now and am not spotting the error. It may be something simple too.

// loop continually until the user gives a valid guess
FText GetValidGuess()
{
    EGuessStatus Status = EGuessStatus::Invalid_Status;
    do {
        // get a guess from the player
        int32 CurrentTry = BCGame.GetCurrentTry();
        std::cout << "Try " << CurrentTry << ". Enter your guess: ";
        FText Guess = "";
        std::getline(std::cin, Guess);

        // check status and give feedback
        Status = BCGame.CheckGuessValidity(Guess);
        switch (Status) {
            case EGuessStatus::Wrong_Length:
                std::cout << "Please enter a " << BCGame.GetHiddenWordLength() << " letter word.\n";
                break;
            case EGuessStatus::Not_an_isogram:
                std::cout << "Please enter a word witout repeating letters.\n";
                break;
            case EGuessStatus::Not_Lowercase:
                std::cout << "Please enter all lowercase letters.\n";
                break;
            default:
                return Guess;
        }
        std::cout << std::endl;
    } while (Status != EGuessStatus::OK); // keep looping until we get no error
}

sentences:
algorithm for Shooting objects that bounce off the wall I'm trying to make a 2D game where my Hero is standing in a 2D plan and surrounded by enemies(highest 3) that throwing balls. and my hero have a shield in hands and and will stop the balls...

well the problem is i'm not able to found the direction on which enemy shoot the ball to reach to the Hero...
i want to make enemy little bit smarter so they don't just shoot straight

as in picture the ball can bounce of the wall same as light bounce off wall, the indecent angle and refractive angle will be same(sorry image angles not perfect. i draw them in paint) so i know that slop of this path line will be same in whole path just interchange in negative and positive.

now i want to find the directions in which i can shoot like 2 coordinates of x,y or something where i can shoot and the ball reaches to the hero.

i not want just one direction... i want the all possible directions where my enemy can shoot and that hit to the hero

and also the ball will be gone after 4-5 times bounce

there is an android game "Stupid zombies" that have exactly this kind system in game

any algorithm and solution to archive this....i'm working in java so later i can port my game to android easily

i also tried below link but my ball hitting more then 2 times and i'm not able to find solution
https://softwareengineering.stackexchange.com/questions/290628/algorithm-for-calculating-a-bullet-path-to-a-target-with-max-2-ricochets

please edit if you found anything not properly asked ...i tried to make as simple as possible, but its my first time here.

sentences:
simple adventure game mechanics stored in database I plan to code a little adventure-like game. To be able to build multiple episodes without deploying new code I want to store any information possible in the database.

This includes stuff like

  if player examines item [cell phone], the contact [xxx] is added into his phone book and the item [cell phone] is replaced by [old nokia phone with scratches]

So something like "SCUMM lite".

Of course, [cell phone], [xxx] and [old nokia phone with scratches] are objects that already exist in the database. But while [cell phone] is of type [inventory-item], [xxx] is of type [contact], so there can't just be no simple link between some database-tables

I got a very basic idea about how I could achieve this but wonder if anyone has done that before and can give me a hint or even best practice

sentences:
Infinite detail inside Perlin noise procedural mapping I am very new to game development but I was able to scour the internet to figure out Perlin noise enough to implement a very simple 2D tile infinite procedural world.

Here's the question and it's more conceptual than code-based in answer, I think. I understand the concept of "I plug in (x, y) and get back from Perlin noise p" (I'll call it p). P will always be the same value for the same (x, y) (as long as the Perlin algorithm parameters haven't changed, like altering number of octaves, et cetera).

What I want to do is be able to zoom into a square and be able to generate smaller squares inside of the already generated overhead tile of terrain.

Let's say I have a jungle tile for overhead terrain but I want to zoom in and maybe see a small river tile that would only be a creek and not large enough to be a full "big tile" of water in the overhead. Of course, I want the same net effect as a Perlin equation inside a Perlin equation if that makes sense? (aka. I want two people playing the game with the same settings to get the same terrain and details every time).

I can conceptually wrap my head around the large tile being based on an "zoomed out" coordinate leaving enough room to drill into but this approach doesn't make sense in my head (maybe I'm wrong). I'm guessing with this approach my overhead terrain would lose all of the cohesiveness delivered by the Perlin. Imagine I calculate (0, 0) as overhead tile 1 and then to the east of that I plug in (50, 0). OK, great, I now have 49 pixels of detail I could then "drill down" into. The issue I have in my head with this approach (without attempting it) is that there's no guarantee from my Perlin noise that (0,0) would be a good neighbor to (50,0) as they could have wildly different "elevations" or p/resultant values returning from the Perlin equation when I generate the overhead map.

I think I can conceive of using the Perlin noise for the overhead tile to then reuse the p value as a seed for the "detail" level of noise once I zoom in. That would ensure my detail Perlin is always the same configuration for (0,0), (1,0), etc. ad nauseam but I'm not sure if there are better approaches out there or if this is a sound approach at all.

sentences:
Generate plane with script missing triangles I am trying to do a simple script to generate a plane from a script by creating a new mesh. After trying it, it seems like some of the triangles aren't showing up. I checked if they were in the list by making it publci and they are in it, so I dont understand why the last triangles aren't showing while the others are.
int size = 4;
Mesh meshy;
public List<Vector3> vert = new List<Vector3>();
public List<Vector2> uv = new List<Vector2>();
public List<int> tri = new List<int>();
void Start()
{
    vert = new List<Vector3>();
    tri = new List<int>();
    meshy = new Mesh();
    for (int x = 0; x < size; x++)
    {
        for(int z = 0; z < size; z++)
        {
            vert.Add(new Vector3(x, 0, z));
        }
    }
    meshy.vertices = vert.ToArray();
    for (int i = 0; i < ((size-1)*(size-1));i++)
    {
        tri.Add(i);
        tri.Add(i+1);
        tri.Add(i+size);
        tri.Add(i + size +1);
        tri.Add(i + 1 +(size - 1));
        tri.Add(i + 1);
    }
    meshy.triangles = tri.ToArray();
    for(int i = 0; i < ((size - 1) * (size - 1)); i++)
    {
        uv.Add(new Vector2(0, 0));
        uv.Add(new Vector2(1, 0));
        uv.Add(new Vector2(0, 1));
        uv.Add(new Vector2(1, 1));
    }
    meshy.uv = uv.ToArray();
    GetComponent<MeshFilter>().mesh = meshy;
}

sentences:
Advantage of Using Addressable Over Asset Bundles in Unity I have a project that already uses asset bundles. I download assets when the game starts and show them to the user when needed.
I see that Unity provides addressables as new solution for asset management. As its new (not very new as its accessible from 2018.2, but official docs dont say a lot) there is not so much about it on the web.
From what it seems, in addressables you dont need to care about the bundle version, or which asset is in which bundle. In addresables, Unity automatically uploads assets to your host, and Unity automatically correctly manages local caching or downloads from a server, so objects behave like they are in the main game package but you have to check if they are loaded or downloaded. Am I right?
Are there any other features that addressables offer?

sentences:
Restricting my horizontal slash attack I've been working on making this slash attack for my character in the unity engine. The whole point to this script is to put the damage range in sync with the slashing animation. The slash is completely horizontal and is scripted out make enemies bounce back. I have most of that but what I really need to restrict it on x axis. If I haven't explained it enough let me give you an example of what its doing. When an enemies in front of me but above the area my swing attack shouldn't be able to reach. I use my swing attack and it still does damage anyways. what I need is a way is restrict my hit detection range between two angles rolling around the x axis. I'm sorry if I didn't explain this so well just tell me if I need to make something more clear.

this is the code I've come up with what I've got it doings is it applies damage it can tell if an enemy is in front of it (uses the dot product for that) it can even knock said enemy backwards

void Knockback(){

     Vector3 grenadeOrigin = transform.position; // I'm building this controller using explode for knock back
// and this stuff was based off of a grenade script
     Collider[] colliders = Physics.OverlapSphere (grenadeOrigin, radius);
     foreach (Collider hit in colliders){
         Rigidbody rb = hit.GetComponent<Rigidbody>();
         if (rb){
             Vector3 dir = (rb.transform.position - transform.position).normalized;
             float direction = Vector3.Dot(dir, transform.forward);
             Debug.Log(direction);
             if (direction >0.1){// this is where i tell if something is in front of me
                 rb.AddExplosionForce(power, grenadeOrigin, radius, 0);
                 //This is where we apply force to our enemy and various other rigid bodies
                 hit.gameObject.SendMessage("Damager", Damage, SendMessageOptions.DontRequireReceiver);
                 //This is where we apply damage to the enemy
             }
         }
     }
 }

sentences:
2D sprite sorting and draw order relative to camera rotation I'm having trouble working out how to recalculate 2D sprite sorting / draw order based on camera rotation.

In the example below:

Screen 1 shows a non-rotated typical "top down 2D" scene, where the grey objects can be sorted based on their screen Y position, drawn from top to bottom, so in this case B, A, C.

Screen 2 shows the situation after the player/camera rotates clockwise, with the original screen up vector (green) and the new up vector (red). In this situation, sorting by object Y position will not work, because A should now be drawn after C.

What I need to do is to sort the objects not only by their Y position, but also relative to the new up vector and/or camera rotation, but I'm unsure how to handle this.

sentences:
How to calculate the distance between a Vector3 and a (3D polygon triangle)? How to calculate the distance between a Vector3 and a (3D polygon triangle)?

for example : " float DistanceToTrianale( Vector3 pos, Vector3 Edges1, Vector3 Edges2, Vector3 Edges3)

thanks in advance

sentences:
Peer-to-peer Multiplayer Game I built a casual game where the user answer the right word in random question. Now I want to make this game multiplayer (4 players) working on smartphones and tablets (Androird & iOS) where all the players are clients but one of them is Host/Client who receives the in-game answers to check who won and answer-back to the other three players (Clients) with the score.

However, I'm confused about HLAPI, LLAPI, dedicate server, PUN, Standalone, Local, LAN... I'm a mess right now. What should I choose? having on mind I only send/receive strings, and the game should work with and without Wi-Fi connection.

sentences:
How do you prepare for out of memory conditions? This can be easy for games with well defined scope, but the question is about sandbox games, where the player is allowed to create and build anything.

Possible techniques:

Use memory pools with upper limit.
Delete objects that are no longer needed periodically.
Allocate extra amount of memory at the beginning so it can be freed
later as a recovery mechanism. I would say around 2-4 MBs.

This is more likely to happen in mobile/console platforms where memory is usually limited unlike your 16 GB PC. I am assuming you have full control over memory allocation/deallocation and no garbage collection involved. That's why am tagging this as C++.

Please note that I am not talking about Effective C++ Item 7 "Be prepared for out-of-memory conditions", even though it's relevant, I would like to see an answer more related to game development, where you usually have more control over what's happening.

To summarize the question , how do you prepare for out of memory conditions for sandbox games, when you are targeting a platform with limited memory console/mobile ?

sentences:
Which platform and what strategies can I use There's this game, that I've been wanting to make for quite some time. It's a project that I've started and had to abandon in the middle a couple of times. However, this time I'm determined to finish it. I want to make a RPG (tile based) game, I'm okay with having it be 2D but am considering something in the middle of 2D and 3D. I would also like the game to be at least partially multilayer if not an MMO. I'm not a bad programmer, so I can work my way through any problems I might come across, I just don't have any experience making games, so I'm interested in any technologies I can use that I might not yet be aware of, or what type of architecture I can implement and what strategies I can use to make a decent (and secure game).

I made this game (2D tile based and partially multiplayer) before using MySql, PHP and JavaScript/Ajax. But now I would like it to be a bit more advanced with fluid graphics, and multiplayer where user's (or at least friends) can explore the maps together.

My first thought was to use Flash, PHP and MySql. Where Flash calls to a php file that returns an xml object with coordinates and etc., but I'm not sure how fast or efficient this will be.

With all that said, I'm wondering if anyone has any suggestions to what other technologies are out there that I can use. I would prefer that the game is browser based, but if it has to be run on the desktop I would like it to be at least cross-platform. I am familiar with HTML, JavaScript/jQuery, PHP, Flash, C#, WPF/XAML already and would prefer a combination of what I already know, but I don't mind learning something new either.

Any helpful links on this are appreciated as well.

Thanks in advance!

sentences:
How do I create a player movement system in Farseer? My group of students is helping produce a a 2D platformer. We tried making a pixel-based collision system which fell through. Now I am trying this physics engine on for size and see new ways to create and control my player. Like the obvious circle body player:

I was using a different type of player movement system like this XNA video example.

What system would work for a player that needs to be able to jump and move in mid-air (as in the above link), and can run up slopes like the circular body example?

I guess that the circular body can be made to do anything, but would like community input.

sentences:
How can I create a "wireframe" texture for a sphere in SceneKit? I've been struggling to figure this out. I would like to have a sphere in SceneKit that looks like this:

I think the easiest way would be to create a mostly transparent texture with the wireframe lines. I need some help figuring out how to create this texture.

I've been doing some trial and error with colored lines to try to figure this out, but it's a mess and I don't seem to be getting anywhere.

Eventually I want to procedurally generate the wireframe texture in a CALayer, but first I need to figure out where to draw the lines.

sentences:
How can I have cutouts in a texture? I want to be able to have a gameobject that's basically just a black box on top of everything else. Then I want to be able to place other gameobjects which are just gradients on top of that and they should "cut out" of the black texture like this:

How can I achieve this sort of effect?

Please keep in mind that I have pretty much no experience with shaders :)

Here's a video that might help explain what I'm trying to achieve
https://www.youtube.com/watch?v=L1dd4fkVSAM

sentences:
Question about save games format my question is about save-games format.

Look at this screenshot:

On the left I made a "simple" fake savegame (Ini format) and on the right there is a "complex" TR2 save game.

I'm wondering how does the complex one work, and why.

I thought that it was made this way to prevent from cheating-editing values, and the format was just a "simple" save encrypted with a key (like aes does).

I'm sceptic though, I don't think every game has implemented an encryption algorithm to save some data. Maybe I miss something, or maybe it's done this way.

Do you have some informations about this ? Have you ever asked yourselves how does this works ?
Thanks, have a good day !

sentences:
Should I be using Blender game engine as my first engine? I am new to game development. I was learning how to create 3d models in Blender to use in an Android game, but I was reading that you can use Blender game engine for creating android games.

Is it a good idea to use it since I couldn't find any reviews about it. Is it actually being used by developers to create Android games?

sentences:
Donut-shaped / inverse mask in Phaser I am trying to get a donut-shaped mask in Phaser (essentially the inverse of a regular mask). The mask shape is dynamic so it needs to be a Phaser.Graphics polygon object.

Desired result:

The blue shape is the sprite I want to mask, the hole in it is the mask itself.

I've searched the Phaser and Pixi v2 documentation and forums - found nothing though. Anybody who knows how I can do this?

If it is not possible, I am thinking of dividing the mask up into eight polygons:

How sound is that idea? Is that going to be expensive or would it be ok? Or any other ways to achieve this?

sentences:
Nothing drawn in Window, not even the clear color A few years ago I have followed RasterTek's Direct3D11 tutorials to create a simple application in C++. I'm not trying to convert this very simple sample to C# using SharpDX.

I've got the Window (which I create natively, exactly as in the tutorial) and message loop all set-up. Everything seems to be working. If I make the window's background gray I even see it being gray for a split second, before DirectX takes ownership of it and makes the Window contents black.

So it seems I've done something right, but not everything. Nothing is rendered to the window, not even the clear color. I've compared my code multiple times to my own C++ implementation (which works) and the tutorial's code, but there seems to be a bug in my implementation. Its probably related to how SharpDx wraps the Direct3D library. Maybe I've missed something?

Below are (what I believe to be) the bare essentials. Anyone spot the error? (Or alternatively anyone who can direct me to a good starters tutorial which covers the nuances of SharpDx?)

    private readonly SwapChain SwapChain; private readonly RenderTargetView RenderTargetView; private readonly Texture2D DepthStencilBuffer;
    private readonly DepthStencilState DepthStencilState; private readonly DepthStencilView DepthStencilView; private readonly RasterizerState RasterState;

    private readonly D3D11.Device Device;private readonly DeviceContext DeviceContext;

    public D3DObject(int screenWidth, int screenHeight, IntPtr hwnd)
    {
        // Set up the swap chain
        var swapChainDescription = new SwapChainDescription()
        {
            BufferCount = 1,
            Flags = SwapChainFlags.None,
            IsWindowed = true,
            ModeDescription = new ModeDescription(screenWidth, screenHeight, new Rational(0, 1), Format.R8G8B8A8_UNorm),
            OutputHandle = hwnd,
            SampleDescription = new SampleDescription(1, 0),
            SwapEffect = SwapEffect.Discard,
            Usage = Usage.RenderTargetOutput,
        };

        D3D11.Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, swapChainDescription, out this.Device, out this.SwapChain);
        this.DeviceContext = new DeviceContext(this.Device);

        // Get the backbuffer from the swap chain
        var backBuffer = this.SwapChain.GetBackBuffer<D3D11.Resource>(0);

        // Create a view of this backbuffer
        this.RenderTargetView = new RenderTargetView(this.Device, backBuffer);

        // Set the render target on the window
        this.DeviceContext.OutputMerger.SetRenderTargets(this.RenderTargetView);

        // Set-up the rasterizer
        var rasterizerStateDescription = new RasterizerStateDescription()
        {
            CullMode = CullMode.Back,
            DepthBias = 0,
            DepthBiasClamp = 0.0f,
            FillMode = FillMode.Solid,
            IsAntialiasedLineEnabled = false,
            IsDepthClipEnabled = true,
            IsFrontCounterClockwise = false,
            IsMultisampleEnabled = false,
            IsScissorEnabled = false,
            SlopeScaledDepthBias = 0.0f
        };

        this.RasterState = new RasterizerState(this.Device, rasterizerStateDescription);

        this.DeviceContext.Rasterizer.State = this.RasterState;
        this.DeviceContext.Rasterizer.SetViewport(0, 0, screenWidth, screenHeight);
    }

    // Called at the start of rendering
    public void BeginScene(Color4 color) // Color is CornFlowerBlue: {Alpha:1 Red:0,3921569 Green:0,5843138 Blue:0,9294118}
    {
        this.DeviceContext.ClearRenderTargetView(this.RenderTargetView, color);
    }

    // Note: nothing is rendered in between

    // Called at the end of rendering
    public void EndScene()
    {
        this.SwapChain.Present(0, PresentFlags.None);
    }

Note: I create the device with the DebugFlag, but I also see no debug overlay.

sentences:
Microsoft XNA Platformer Example, is the Collsion Detection implemented accurately? The example provided by Microsoft seems as if the collision detection (from what I can see) will have a small error. When the user collides with an Unpassable tile, the depth of the intersection is calculated. The smaller of the depth values X and Y is used to fix the position of the user so it no longer collides with the tile. But if the user was travelling diagonally could this result in the user not ending up in precisely the point where the character would first collide with the tile?

I'm probably wrong but that's just the way I see it.

   private void HandleCollisions()
        {
            // Get the player's bounding rectangle and find neighboring tiles.
            Rectangle bounds = BoundingRectangle;
            int leftTile = (int)Math.Floor((float)bounds.Left / Tile.Width);
            int rightTile = (int)Math.Ceiling(((float)bounds.Right / Tile.Width)) - 1;
            int topTile = (int)Math.Floor((float)bounds.Top / Tile.Height);
            int bottomTile = (int)Math.Ceiling(((float)bounds.Bottom / Tile.Height)) - 1;

            // Reset flag to search for ground collision.
            isOnGround = false;

            // For each potentially colliding tile,
            for (int y = topTile; y <= bottomTile; ++y)
            {
                for (int x = leftTile; x <= rightTile; ++x)
                {
                    // If this tile is collidable,
                    TileCollision collision = Level.GetCollision(x, y);
                    if (collision != TileCollision.Passable)
                    {
                        // Determine collision depth (with direction) and magnitude.
                        Rectangle tileBounds = Level.GetBounds(x, y);
                        Vector2 depth = RectangleExtensions.GetIntersectionDepth(bounds, tileBounds);
                        if (depth != Vector2.Zero)
                        {
                            float absDepthX = Math.Abs(depth.X);
                            float absDepthY = Math.Abs(depth.Y);

                            // Resolve the collision along the shallow axis.
                            if (absDepthY < absDepthX || collision == TileCollision.Platform)
                            {
                                // If we crossed the top of a tile, we are on the ground.
                                if (previousBottom <= tileBounds.Top)
                                    isOnGround = true;

                                // Ignore platforms, unless we are on the ground.
                                if (collision == TileCollision.Impassable || IsOnGround)
                                {
                                    // Resolve the collision along the Y axis.
                                    Position = new Vector2(Position.X, Position.Y + depth.Y);

                                    // Perform further collisions with the new bounds.
                                    bounds = BoundingRectangle;
                                }
                            }
                            else if (collision == TileCollision.Impassable) // Ignore platforms.
                            {
                                // Resolve the collision along the X axis.
                                Position = new Vector2(Position.X + depth.X, Position.Y);

                                // Perform further collisions with the new bounds.
                                bounds = BoundingRectangle;
                            }
                        }
                    }
                }
            }

            // Save the new bounds bottom.
            previousBottom = bounds.Bottom;
        }

sentences:
SDL2 render to texture support I'd like to use the function

int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture  *texture)

in my 2D game. At this point I am using only the SDL 2.0 API, and using openGL seems overkill to me. Rendering to an intermediate texture would greatly simplify the programming of a camera system and split-screen support. However, the (sparse) SDL wiki documentation states:

  Before using this function, you should check the
  SDL_RENDERER_TARGETTEXTURE bit in the flags of SDL_RendererInfo to see
  if render targets are supported.

This raises the question wether or not can I rely on the availability of this function. I was unable to find any information on the subject on the web.

sentences:
Significant frame drop upgrading from Unity 2019 to Unity 2020 I used to use Unity 2019.4.22f1, but now that 2020.3.0f1 has been marked as LTS, I've decided to switch to it.
For no apparent reason, it seems like my game is getting consistently lower framerate, precisely, almost like it's cut in half. I used to get 800-1000 FPS in my game but now its around 400-500. I've tested with multiple things that are even more demanding, and where I used to get 500 fps, I now get 200 fps.
It's clear that this is likely a configuration thing, but I don't know which settings to change, if any of them have been.
There is this SX article here which didn't get answered and seems to have the same problem: Link
And this article which seems to talk about a similar problem, though it is marked as fixed: Link

sentences:
Creating looping canvas animation (slot machine with reels) I have a small assignment to create something like slot machine with spinning pictures. I have to use HTML5 Canvas. I would like to hear some opinions how this can be made simply and performantly.

There are  symbols that would be spinning vertically while only 2 would be fully visible, next 2 are partially hidden and remaining 2 are not visible at all.

I have chosen CreateJS suite, but I have no experience with that, so I am just trying to figure it out. I made this for the start...

var reels = [160, 405, 648, 892, 1137]; // X offset of reels
var reelLines = [0, 317, 634]; // Y offset of symbols in the reel

var stage = new createjs.Stage('game');

for (x = 0; x < reels.length; x++) {
  for (y = 0, y < reelLines.length; y++) {
    bmp = new createjs.Bitmap('symbol').set({
      x: reels[x],
      y: reelLines[y]
    });
    stage.addChild(bmp);
  }
}

This displays 3 symbols in each reel and it looks good. Now I need to add some animation to it. I am thinking about it like having stack of symbol bitmaps at the top position where it's not visible yet. I tried to use Tween class like this.

createjs.Tween.get(bmp, {loop: true}).to({
  y: 808
}, 500);

It's basically correct, symbol rolls in and out and then it pops at top again. However this works for single symbol only. If I position three symbols as stated above and run same tween on them, each of them will go in different speed, because to call second argument is duration, not the speed.

I would really appreciate some ideas on this approach and if it's even correct one.

sentences:
Skeletal animation with multiple animations running at the same time I've spent a long time attempting to figure out how complex animations are done and wrote quite a few different skeletonish frameworks myself, but they've never really came out good enough to be properly used. So maybe someone here knows how complex things that can have lots of different animations are animated. I know that you can combine different animations to create one larger thing, but that takes A LOT of time and can't be organised properly, or even designed properly if you are attempting to design complex characters.

So I'm wondering whether anyone knows about known techniques for this, I'm willing to write my own implementation of it (Using a quite unpopular language, usually can't find libraries or anything for it). Or a software that you can write an implementation of your own in your own language.

TL;DR: Looking for software / animation theory that can handle applying multiple different animations of the same character.

Spine2D and spriter aren't what I'm looking for.

sentences:
How to draw a global day night curve I see many applications which have world-clock map, and I would like to make my own to enhance some of my mobile apps. I wonder if anybody has any knowledge where to start, how to draw a curved shadow representing the dawn and the sunset on the globe. See the example:

http://aa.usno.navy.mil/imagery/earth/map?year=2012&month=6&day=19&hour=14&minute=47

I think that this curve goes up and down and creates an artic day/night etc
Perhaps there is some acceptable approximation formula without a need to load data for each our and each global parallel and meridian...

sentences:
SDL 2.0 OpenGL not drawing anything except background My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code:

main.cpp

#include "src/App.h"

int main( int argc, char* args[] )
{
    App app(600, 400, false);
    app.Run();
    return 0;
}

App.h

#ifndef APP_H
#define APP_H

#include <SDL.h>

class App
{
public:
    explicit App(size_t win_width, size_t win_height, bool fullscreen_mode)
            : m_window_width(win_width), m_window_height(win_height),
            m_fullscreen(fullscreen_mode) {
        };

     void Run();

private:
    void Draw();
    void Update(double dt);
    void Resize(size_t width, size_t height);
    void ProcessEvents();

private:
    size_t m_window_width;
    size_t m_window_height;
    bool m_fullscreen;
    bool is_done;
    SDL_Window* m_window;
    SDL_GLContext m_glcontext;
};

#endif // APP_H

App.cpp

#include "../App.h"
#include <SDL_opengl.h>
#include <cassert>

void App::Run()
{
    SDL_Init(SDL_INIT_VIDEO);
    m_window = SDL_CreateWindow("Okno gry",
                                SDL_WINDOWPOS_CENTERED,
                                SDL_WINDOWPOS_CENTERED,
                                m_window_width, m_window_height,
                                SDL_WINDOW_OPENGL | (m_fullscreen?SDL_WINDOW_FULLSCREEN:SDL_WINDOW_RESIZABLE));

    m_glcontext = SDL_GL_CreateContext(m_window);
    Resize(m_window_width, m_window_height);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

    glClearColor(0, 0, 1, 0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_EQUAL);

    is_done = false;
    size_t last_ticks = SDL_GetTicks();
    while(!is_done)
    {
        ProcessEvents();

        size_t ticks = SDL_GetTicks();
        double delta_time = (ticks - last_ticks) / 1000;
        last_ticks = ticks;

        if (delta_time > 0 )
        {
            Update(delta_time);
        }

        Draw();
    }
    SDL_Quit();
}

void App::Draw()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glBegin(GL_TRIANGLES);
    {
        glColor3f(1, 1, 0);
        glVertex2f(1, 1);
        glVertex2f(0, 1);
        glVertex2f(0, 0);
    }
    glEnd();
    SDL_GL_SwapWindow(m_window);
}

void App::ProcessEvents()
{
    if (is_done) return;

    SDL_Event event;
    while (SDL_PollEvent(&event))
    {
        if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
        {
            Resize(event.window.data1, event.window.data2);
        }
        else if (event.type == SDL_QUIT)
        {
            is_done = true;
            break;
        }
    }
}

void App::Resize(size_t width, size_t height)
{
    m_window_width = width;
    m_window_height = height;

    glViewport(0, 0, static_cast<int>(width), static_cast<int>(height));
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrtho(0, 1, 0, 1, -1, 10);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

void App::Update(double dt)
{
    //printf("%d", dt);
}

Can anyone help? I don't know why it's not running.

sentences:
How to automate the game I am new to game development and I have a game where the car moves and picks the monster.But now I want to automate the game so it looks like it is played automatically.
The control keys are given by the update function which is as below:

update(){
        if (keys.ArrowUp) { // Player holding up
            this.y -= this.speed * frameTime;
            this.dir = Math.PI * 0; // set direction
        }
        if (keys.ArrowDown) { // Player holding down
            this.y += this.speed * frameTime;
            this.dir = Math.PI * 1; // set direction
          }
          if (keys.ArrowLeft) { // Player holding left
            this.x -= this.speed * frameTime;
            this.dir = Math.PI * 1.5; // set direction
        }
        if (keys.ArrowRight) { // Player holding right
            this.x += this.speed * frameTime;
            this.dir = Math.PI * 0.5; // set direction
        }
        if(Math.sign(this.speed) === -1){ // filp directio of second car
            this.dir += Math.PI; // set direction
        }

So Eventually I need this update function to be automated.Automated in the sense you can think of the one car moves 3 seconds straight and 3 seconds right and so on.But the other car follows a different movement.
Incase my code is not sufficient
the working pen is here and I just want to automate the process so that the cars move in different directions and the game is automated.

Any help is appreciated

sentences:
Changing scene while joining room and RPC buffer problem I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the OnJoinedRoom method. This works well, until I use the RPC call with buffers.

There are 5 spawn points in the game scene, and every time a player joins the room, they occupy a spawn point, so no-one else can spawn at that point.
So, I have list of spawn points in my code, and every time a player joins, it randomly picks a point from that list and "removes" it from the list. It does this via RPC call, so if a player joins the game late, it removes that point, too.

There is a problem with that RPC's buffer because of the "scene change". After OnJoinedRoom, the RPC buffers are called only when the player joins the room, and before the scene change. Because the scene hasn't changed yet, it has trouble finding the buffered photonview, and it throw outs an error. It doesn't update the list.

Can I delay the buffer calls, is there a better way to change my scene while joining a room?

sentences:
On screen enemy indicating arrow I am working on indicating on screen arrow to point towards the enemy. I have a environment which consist of a player and three enemy placed at different position on the environment.I need an arrow indicating the enemy,so that the player can move towards the enemy in the environment.

How can I do this?Can anybody please help me out.

I have got a script on searching.

public Texture2D icon; //The icon. Preferably an arrow pointing upwards.
public float iconSize = 50f;
[HideInInspector]
public GUIStyle gooey; //GUIStyle to make the box around the icon invisible. Public so that everything has the default stats.
Vector2 indRange;
float scaleRes = Screen.width / 500; //The width of the screen divided by 500. Will make the GUI automatically
//scale with varying resolutions.
Camera cam;
bool visible = false; //Whether or not the object is visible in the camera.

void Start () {
    visible = GetComponent<SpriteRenderer> ().isVisible;

    cam = Camera.main; //Don't use Camera.main in a looping method, its very slow, as Camera.main actually
    //does a GameObject.Find for an object tagged with MainCamera.

    indRange.x = Screen.width - (Screen.width / 6);
    indRange.y = Screen.height - (Screen.height / 7);
    indRange /= 2f;

    gooey.normal.textColor = new Vector4 (0, 0, 0, 0); //Makes the box around the icon invisible.
    visible=false;
}

void OnGUI () {
    if (visible) {
        Vector3 dir = transform.position - cam.transform.position;
        dir = Vector3.Normalize (dir);
        dir.y *= -1f;

        Vector2 indPos = new Vector2 (indRange.x * dir.x, indRange.y * dir.y);
        indPos = new Vector2 ((Screen.width / 2) + indPos.x,
            (Screen.height / 2) + indPos.y);

        Vector3 pdir = transform.position - cam.ScreenToWorldPoint(new Vector3(indPos.x, indPos.y,
            transform.position.z));
        pdir = Vector3.Normalize(pdir);

        float angle = Mathf.Atan2(pdir.x, pdir.y) * Mathf.Rad2Deg;

        GUIUtility.RotateAroundPivot(angle, indPos); //Rotates the GUI. Only rotates GUI drawn after the rotate is called, not before.
        GUI.Box (new Rect (indPos.x, indPos.y, scaleRes * iconSize, scaleRes * iconSize), icon,gooey);
        GUIUtility.RotateAroundPivot(0, indPos); //Rotates GUI back to the default so that GUI drawn after is not rotated.
    }
}

void OnBecameInvisible() {
    visible = false;
}
//Turns off the indicator if object is onscreen.
void OnBecameVisible() {
    visible = true;
}

}

The problem is start when I play the scene the arrow is seen at the start but its  get invisible soon

sentences: Gauss-Krüger system to Unity Coordinate Conversion In my recent project, I am getting an object file via a request to REST API and found that the OBJs (object file) are in Gauss-Kruger System. I want to know that how exactly I place the model as I have several objects so coordinate conversion should work between UCS(unity coordinate system) and Gauss Kruger System. Previously I am able to convert UCS to Lat Long via Unity GPS Conversion project.

sentences:
Do I need to learn any physics if I use a physics engine? Complete novice out here. Of course I know basic physics like mass and inertia. I don't want to make an engine I just want to make a game and use a physics engine made by someone else.

Do I need to learn any physics if I plan to use a physics engine?

sentences:
How do I run a headless Unity server in a Windows Docker (without GPU)? I am trying to run a headless Unity server on a Windows Docker.
On Linux, there is Xvfb, but I don't know how I could get similar results on Windows.
How would I do that?

sentences:
Issues upscaling pixel art with SampleState.PointClamp I'm developing a 2D game, and I'm striving to create a nice blocky low-res appearance for the game, yet allow it to be played at variable resolutions. So, I've researched resolution independency and have a nice system in place to have my game rendered at 640x480 to a RenderTarget2D, and then have the RenderTarget blown up on the back buffer. Anybody that's looked into this knows that by default scaled images will be antialiased, and to disable that, change the SampleState to PointClamp. So, I've done that, but now I'm having this issue where my sprites aren't upscaling properly. Certain pixels are becoming particularly chunky where they shouldn't be, and I'm not sure what the cause of this behavior is, and I haven't been able to find any documentation of anybody else having this issue, can anybody offer any insight?

The last image illustrates the image rendered in game at 2X the original size. A 2:1 ratio should be a pretty straightforward scale to render, but if you look closely, there are some pixels that are at half size the others.

Edit #2: Here's some code regarding the scaling.

First, the game is captured by the render target at 640x480 resolution, then it is drawn at the back buffer's resolution (in the second image, reslution is 800x600, in the third image, resolution is 1280x960, I haven't messed with alternate aspect ratios yet).

graphicsDevice.SetRenderTarget(RenderTarget);
spriteBatch.Begin();
spriteBatch.Draw(Texture,
            new Rectangle((int)location.X, (int)location.Y, frameWidth, frameHeight),
            new Rectangle((int)spriteLocation.X, (int)spriteLocation.Y, spriteWidth, spriteHeight,
            Color.White,
            0f,
            Vector2.Zero,
            effect,
            .826f);
spriteBatch.End();
graphicsDevice.SetRenderTarget(null);
spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null);
spriteBatch.Draw(RenderTarget, new Rectangle(0,0, backbufferWidth, backbufferHeight), Color.White);
spriteBatch.End();

Edit #3: Code involving the sprite's height and width.
First, in the class that my monster inherits from, is this little method that runs in the base class' Update() method. It just makes sure that if I have animations with non-uniform sizes, that the sizes are updating properly.

protected void UpdateFrameSizes()
    {
        frameWidth = animations[currentAnimation].Frames[animations[currentAnimation].currentFrame].SizeAndsource.Width;
        frameHeight = animations[currentAnimation].Frames[animations[currentAnimation].currentFrame].SizeAndsource.Height;
    }

Then, just to make sure that the Width and Height were correct in his animation class, I checked those:

idleFrame1 = new AnimationFrame(Texture, new Rectangle(154 * 0, 107 * 0, 154, 107), 1f);
        idleFrame2 = new AnimationFrame(Texture, new Rectangle(154 * 1, 107 * 0, 154, 107), 1f);
        idleFrame3 = new AnimationFrame(Texture, new Rectangle(154 * 2, 107 * 0, 154, 107), 1f);

All looks correct here, I even went to the source image and counted the pixels (Yes, I know, his sprite sheet's dimensions are weird, but they're accurate).

And then this data is all used in Edit #2's code snippet during the draw method.

sentences: How to assign a button in the main storyboard to launch the GameViewController.swift file I am quite new to swift and I have constructed a main menu in the main.storyboard file, how do I assign the 'Play Now' button to launch the GameViewController.swift file where I actually plan to program the game.

sentences:
Why is Unity 5.6 displaying launch image wrong on iOS? I updated from Unity 5.5.0p3 to 5.6.0f3, and I have no idea what's causing this. The iOS launch image which looked like this:

Now looks like this:

sentences:
DirectX11 pixel shader in pipeline is missing I'm writing a program which displays a MS3D model using DirectX, and unfortunately, the result shows nothing on the screen.
When I use the Graphics Debugger from Visual Studio 13, I notice that the pixel shader is missing from the pipeline, as it is shown in the below picture

This is my pixel shader source code:

 cbuffer SkinningTransforms
 {
    matrix WorldMatrix;
    matrix ViewProjMatrix;
 };
//--------------------------------------------------------------------------------
// Inter-stage structures
//--------------------------------------------------------------------------------
struct VS_INPUT
{
    float3  position        : POSITION;
    int4    bone            : BONEID;
    float4  weights         : BONEWEIGHT;
    float3  normal          : NORMAL;
    float3  tangent         : TANGENT;
    float2  tex             : TEXCOORD;
};
//--------------------------------------------------------------------------------
struct VS_OUTPUT
{
    float4 position         : SV_Position;
    float3 normal           : NORMAL;
    float3 light            : LIGHT;
    float2 tex              : TEXCOORDS;
};

Texture2D       ColorTexture : register( t0 );
SamplerState    LinearSampler : register( s0 );

//--------------------------------------------------------------------------------
VS_OUTPUT VSMAIN( in VS_INPUT input )
{
    VS_OUTPUT output;
    //Transform vertex and pass them to the pixel shader
    return output;
}

//--------------------------------------------------------------------------------
float4 PSMAIN( in VS_OUTPUT input ) : SV_Target
{
    // Calculate the lighting
    float3 n = normalize( input.normal );
    float3 l = normalize( input.light );

    float4 texColor = ColorTexture.Sample( LinearSampler, input.tex );

    float4 color = texColor * (max(dot(n,l),0) + 0.05f );
    return( color );
}

As I was known from Graphics Debugger, all of the graphics event are right. I listed in below important events, which might be relating to Pixel Shader:

106:(obj:4) ID3D11Device::CreateDepthStencilView(obj:24,NULL,obj:25)*
108:(obj:5) ID3D11DeviceContext::OMSetRenderTargets(8,{obj:1,NULL,NULL,NULL,NULL,NULL,NULL,NULL},obj:25)*
109:(obj:5) ID3D11DeviceContext::ClearRenderTargetView(obj:1,addr:21)*
111:(obj:5) ID3D11DeviceContext::ClearDepthStencilView(obj:25,1,1.000f,0)*
119:(obj:4) ID3D11Device::CreateSamplerState(addr:24,obj:27)*
134:(obj:4) ID3D11Device::CreatePixelShader(addr:27,21056,NULL,obj:30)*
135:CreateObject(D3D11 Pixel Shader,obj:30)
136:(obj:5) ID3D11DeviceContext::PSSetShader(obj:30,NULL,0)*
137:(obj:5) ID3D11DeviceContext::PSSetSamplers(0,1,{obj:27})*
139:(obj:4) ID3D11Device::CreateTexture2D(addr:28,addr:5,obj:31)*
140:CreateObject(D3D11 Texture2D,obj:31)
142:(obj:4) ID3D11Device::CreateShaderResourceView(obj:31,NULL,obj:32)*
143:CreateObject(D3D11 Shader Resource View,obj:32)
144:(obj:5) ID3D11DeviceContext::PSSetShaderResources(0,1,{obj:32})*
146:(obj:4) ID3D11Device::CreateRasterizerState(addr:29,obj:33)*
147:CreateObject(D3D11 Rasterizer State,obj:33)
152:(obj:5) ID3D11DeviceContext::RSSetState(obj:33)*
154:(obj:5) ID3D11DeviceContext::RSSetViewports(1,addr:30)*
156:(obj:4) ID3D11Device::CreateBlendState(addr:11,obj:34)*
157:CreateObject(D3D11 Blend State,obj:34)
159:(obj:5) ID3D11DeviceContext::OMSetBlendState(obj:34,addr:31,-1)*
162:(obj:4) ID3D11Device::CreateDepthStencilState(addr:32,obj:35)*
163:CreateObject(D3D11 Depth-Stencil State,obj:35)
165:(obj:5) ID3D11DeviceContext::OMSetDepthStencilState(obj:35,0)*

I debugged all of the function in the above list, and all of them return OK. Nothing wrong.
My question is what is the reason the pixex shader is missing from pipleline, which in turn may result in the empty screen.

sentences:
How to procedurally create an extruded cube mesh's indicies? I'm working on a tool that allows the user to create rails(basically an extruded cube) by placing 3d points where the  vertices of rail would be.
The picture below shows what I'm talking about. The orange points being  the user placed points and the black points being the vertices created around it.

I can create the vertices just fine the problem comes from creating the indices for the rail.

I tried using a for loop that goes through the user place points and creating  the triangle indices by using i as an offset for each indices, but it using vertices that didn't exist for indices.
Here's the code for the vertex and indices creation.

    List<Vector3> vertices = new List<Vector3>();
    List<int> triangles = new List<int>();
    for (int i = 0; i < points.Count - 1; i++)
    {
        Vector3 forward = -(points[i] - points[i + 1]).normalized;
        Quaternion rotation = Quaternion.LookRotation(forward);

        //bottom left
        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (-transform.up - transform.right)));
        //top left
        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (transform.up - transform.right)));
        //top right
        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (transform.up + transform.right)));
        //bottom right

        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (-transform.up + transform.right)));
    }

    for(int i=0; i<points.Count-1; i++){
        //left face
        triangles.Add((i*4)+4);
        triangles.Add((i*4)+1);
        triangles.Add((i*4));

        triangles.Add((i*4)+1);
        triangles.Add((i*4)+4);
        triangles.Add((i*4)+5);

        //top face
        triangles.Add((i*4)+5);
        triangles.Add((i*4)+2);
        triangles.Add((i*4)+1);

        triangles.Add((i*4)+2);
        triangles.Add((i*4)+5);
        triangles.Add((i*4)+6);

        //right face
        triangles.Add((i*4)+2);
        triangles.Add((i*4)+6);
        triangles.Add((i*4)+7);

        triangles.Add((i*4)+7);
        triangles.Add((i*4)+3);
        triangles.Add((i*4)+2);

        //bottom face
        triangles.Add((i*4)+0);
        triangles.Add((i*4)+3);
        triangles.Add((i*4)+4);

        triangles.Add((i*4)+4);
        triangles.Add((i*4)+3);
        triangles.Add((i*4)+7);

    }

sentences:
How to handle scripted events in a 2d java game? I'm in the planning phases of a 2D java game. The game is a tile-based platformer with some action-y parts to it, like a Metroidvania formula game.

The static portion of each stage is expressed as an x y grid of tiles - tile IDs correspond to drawable resources, and a boolean for collision (sky / air space doesn't cause collision with the player, but the ground or an elevated platform would for example)

Additionally, the game uses actors for dynamic things in the game - these could be monsters, boss mobs, moving platforms, checkpoints, powerups - anything that isn't a static tile.

I want to implement a java class ScriptedEvent, and include in each Level a linked list of scriptedevents for the stage.

ScriptedEvent may include a bool hasBeenActivated, bool canBeRepeated (for puzzle-like activities that may be re-ran by the player). I want each instance of ScriptedEvent to do an action, like MovePlayerTo(x,y), or combination of actions - SpawnEnemy(ID,x,y). Scripted events might also change the ID of a ground block to air, allowing the player to fall into a hidden room.

How do you accomplish this task in java? One thought would be to do eval() and have each event contain a string of steps. The steps then could be parsed out one by one from this large string, and interpreted as java code, handled by the main game logic.

Say a very simplfied example constructor might look like:

  ScriptedEvent ev1 = new ScriptedEvent("MovePlayer(200,0); PlaySound('teleport.wav'); SpawnItem(20,205,0);");

Where each function listed in the string would make the game logic do something.

Is there a better way to go about scripted events or should I roll with this solution? I don't really want to hard-code each event into a stage if I can avoid it.

sentences:
How to implement buffs / debuffs / temporary stat changes in an RPG? Possible Duplicate:
  What’s a way to implement a flexible buff/debuff system?

In the context of creating an engine for a RPG I want to implement a generic way to give effects / buffs / debuffs to the player, for instance:

strength boost : +15 to strength last for 10 mins
sickness : all attributes are divided by 2. Permanent until removed

Now the problem is that effects can stack upon each others but they can be removed independently. For instance you could have both above-mentioned effects and only remove the "sickness" one leaving the other one.

Are there any existing solutions to this problem? My idea is to always recompute the "final" statistics by applying each effect in chronological order to the "initial" stat, but I wonder: is there any downside?

sentences:
Shadow map shimmering, indexing outside the shadow map I have tried to reduce the shadow shimmering/flickering using the technique described here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324%28v=vs.85%29.aspx

It works as I want and shimmering is reduced but sometimes I have artifacts. It looks like my code tries to index space outside the shadow map. The article above writes about it but I didn't find a solution.

When I played with the code I also got black strips on the corners.

Code:

// reduce shadow shimmering/flickering
Vector2 vecWorldUnitsPerTexel = Vector2(D.x() / (float)D.shadowMapSize(), D.y() / (float)D.shadowMapSize());

// get only x and y dimensions
Vector2 min2D = min.vector2(),
                max2D = max.vector2();

min2D /= vecWorldUnitsPerTexel;
min2D = Round(min2D);
min2D *= vecWorldUnitsPerTexel;

max2D /= vecWorldUnitsPerTexel;
max2D = Round(max2D);
max2D *= vecWorldUnitsPerTexel;

min.set(min2D, min.z);
max.set(max2D, max.z);

// crop matrix based on this article https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch10.html
Vector scale;
Vector offset;
scale.x  = 2.0f / (max.x - min.x);
scale.y  = 2.0f / (max.y - min.y);
scale.z =  1.0f / (max.z - min.z);

offset.x = -0.5f * (max.x + min.x) * scale.x;
offset.y = -0.5f * (max.y + min.y) * scale.y;
offset.z = -min.z * scale.z;

Matrix4 m;
m.x = Vector4(scale.x, 0, 0, 0);
m.y = Vector4(0, scale.y, 0, 0);
m.z = Vector4(0, 0, scale.z, 0);
m.w = Vector4(offset.x, offset.y, offset.z, 1.0f);

I think that I should store in the depth map a slightly larger area but I'm not sure how to do this. I tried to change the scale of the crop matrix but it doesn't help.

EDIT:
It seems I've found a solution. When I'm rounding (or flooring) min and max values I subtract one from the min value and add one to the max value. This makes the shadow map contain a slightly larger area and I don't see any artifacts.

sentences:
JavaScript character direction delay I am developing a top down game and I'm having trouble with a delay in switching from one character walk direction to another, particularly if the previous direction key is still being pressed by the user.

Take the following user interaction:

User presses up arrow;
User presses right arrow (up arrow is still pressed);
User releases up arrow (right arrow is still pressed).

The problem I am experiencing is that there is a delay in the character switching from the "walk up" movement to the "walk right" movement.

requestId: 0,
settimeoutID: 0,
counter: 0,

move: function(keyCode) {
  var _this = this;
  // Frame per seconds
  var fps = 60;

  if (this.requestId === 0) {
    (function animationLoop() {
      // Control the timing of an animation with requestAnimationFrame
      _this.settimeoutID = setTimeout(function() {
        _this.render();
        _this.requestId = requestAnimationFrame(animationLoop, _this.move);
      }, 1000 / fps);
    })();
  }
},

changeAnim: function() {
  if (this.counter % 10 === 0) {
    if (this.currentFrame > 1) {
      this.currentFrame = 0;
    } else {
      this.currentFrame++;
    }
  }
},

render: function() {
  // Add some drawing
  this.counter++;

  if (keyCode === config.PLAYER_DOWN) {
    this.action = 'Front';
    this.newPos.y += 1;
  } else if (keyCode === config.PLAYER_UP) {
    this.action = 'Back';
    this.newPos.y -= 1;
  }

  if (keyCode === config.PLAYER_RIGHT) {
    this.action = 'Right';
    this.newPos.x += 1;
  } else if (keyCode === config.PLAYER_LEFT) {
    this.action = 'Left';
    this.newPos.x -= 1;
  }
  this.changeAnim();
  // Draw player logic
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
},

onKeyUp: function() {
  // Cancel the animation request
  if (this.requestId) {
    clearTimeout(this.settimeoutID);
    cancelAnimationFrame(this.requestId);
  }
  // Allow a new request to be called
  this.requestId    = 0;
  this.counter      = 0;
  this.currentFrame = 0;
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
}

Note: The function move gets called every time a new key is being pressed.

sentences:
Get points on a line between two points I'm making a simple space game in JavaScript, but now I've hit a wall regarding vectors.

The game view is top-down on a 2d grid.  When the user clicks on the grid, the space ship will fly to that spot.

So, if I have two sets of points:

{ x : 100.2, y : 100.6 }; // the ship
{ x : 20.5,  y : 55.95 }; // the clicked coordinates

If the game loop ticks at 60 iterations per second, and the desired ship velocity is 0.05 points per tick (3 points per second), how do I calculate the new set of coordinates for the ship for each tick of the game loop?

p.s. I do not want to account for inertia, or multiple vectors affecting the ship, I just want the ship to stop whatever it is doing (i.e. flying one way) and move to the clicked coordinates at a static speed.

sentences:
Optimizing Draw calls in MonoGame Android platformer I am working on a 2D platformer that is in the final stages of optimization. I have a few different devices for testing, and I am trying to get the best possible framerate on the weaker ones.

On a Nexus 5 I get a constant 60fps, with an occasional hiccup.
On a Galaxy S4 I also get a good 55-60fps
On an original Galaxy S (Vibrant) The frames drop to about 20-25

My question is, given the tile system described below, what can I do to increase the FPS on low-end devices?
And granted the Galaxy S came out years ago, should I even worry about it?

My background consists of 3 scrolling parallax layers.

The world I am drawing in a viewport of 25x15 tiles, at a size of 32x32px per tile, with 3 layers each (32x32x3px).  The camera already culls tiles that are out of view. All tiles are found in one texture, and this is done in a single SpriteBatch call that locates the correct texture location for the tile layer. Code is below:

public void Draw(SpriteBatch spriteBatch, bool upsideDown)
{
    int startX = GetCellAtPixelX( (int)Camera.Position.X );
    int startY = GetCellAtPixelY( (int)Camera.Position.Y );

    int endX = GetCellAtPixelX( (int)Camera.Position.X +
        Camera.ViewportWidth );
    int endY = GetCellAtPixelY( (int)Camera.Position.Y +
        Camera.ViewportHeight );

    for (int x = startX; x <= endX; x++)
    {
        for (int y = startY; y <= endY; y++)
        {
            for (int z = 0; z < MapLayers; z++)
            {
                if ((x >= 0) && (y >= 0) &&
                    (x < MapWidth) && (y < MapHeight))
                {
                    // ...

                    /// The very last parameter in this draw call is
                    /// the draw depth. This draw format will arrange
                    /// layers from front to back (0 = front, 1 = back)
                    /// so we subtract 1 from the z-index as a decimal
                    /// to get the appropriate location:
                    ///     Background      -> 0.7
                    ///     Middleground    -> 0.6
                    ///     Foreground      -> 0.5
                    spriteBatch.Draw(
                        tileSheet,
                        CellScreenRectangle(x, y),
                        TileSourceRectangle(mapCells[x,y].
                            GetLayerIndex((TileLayers)z)),
                        Color.White,
                        0.0f,
                        Vector2.Zero,
                        effect,
                        0.7f - ((float)z * 0.1f)
                    );
                }
            }
        } /// End y loop
    } /// End x loop
}

As you can see, it's not very complex code.  I have checked if my Update calls are slowing the game down, but it's very clearly in the Draw function. When I leave out my call to world.Draw(), fps shoot up to about 50 on the Galaxy S. Also, if I draw only a single layer, I get better performance around 42-45 fps.

I can discard one layer if necessary, but I need at least 2 tile layers. How else can I speed up the draw calls?

I am using MonoGame for Android (XNA)

sentences:
Multithreading: Each system on a different thread or a thread pool? I'm building a fairly involved game using OpenGL and C++. I've been thinking about how to implement multithreading, and the two options are:

1) Each system (Graphics, Audio, Physics, et cetera) gets their own dedicated thread that they run off of.

2) Implement a thread pool, that picks up a jobs from a queue (priority queue), executes it and gets re-inserted into the pool to wait for new available job.

I was wondering which one is generally considered better: in terms of performance, maintenance, scalability, code smell, et cetera.

sentences:
How to visually represent a time span? I am making a puzzle game. The puzzle in question needs to be solved in advance, with the final solution being given as a series of commands which will instruct an object to navigate a maze.

This means I need to be able to provide all the clues necessary in advance, as pure trial-and-error will be tedious for the player.

When it comes to rotation and distance, this is no problem. Rotation is visually obvious, and I can use regularly sized and evenly spaced blocks/objects for the player to count to work out distance.

However - my problem is finding a similar visual representation for time. At one point, the player will ride a lift/platform to 'a place', where the destination will be X seconds away. The player needs to wait this X seconds before continuing forward.

How can I communicate that time delay in an interesting/thought provoking way? I don't want signs next to each lift that simply state the time it will take.

sentences:
How do I make a cube move by rolling? I am learning jMonkeyEngine by making some small games with it. I have a simple rectangular cube that I want the player to be able to roll around the game world.

When he presses the arrow keys, the cube should make a roll in the direction of the key press. (So, for instance, pressing the right arrow key makes the cube roll 1 WU to the right.)

The problem isn't how to move the cube (I can do that with the move() method), but with how to make this rotation effect so it doesn’t look like the cube is moving to the destination, but is actually rolling.

The rolling effect should be like the cube in Bloxorz. (Here's a gameplay video.)

UPDATE

After I got some good help below, I have come up with a test solution, which I want to share with you.

Box box1 = new Box(1,1,1);
Geometry boxGeom = new Geometry("Box", box1);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Blue);
boxGeom.setMaterial(mat1);

//attach the cube to the pivot node
pivot = new Node("pivot");
pivot.setLocalTranslation(0.0f, 0.0f, 0.0f);
rootNode.attachChild(pivot); // put this node in the scene

pivot.attachChild(boxGeom);

//Translate the box so the pivot node is at the bottom right edge of the box
boxGeom.move(-1.0f, 1.0f, 0.0f);

And then rotate it like this.

@Override
public void simpleUpdate(float tpf) {
    //rotate along z-axis
    pivot.rotate(0.0f, 0.0f, -0.001f);
}

sentences:
Convert a quaternion from one coordinate system to another, which are not orthogonal to each other I found a similar question like this in the following link: https://stackoverflow.com/questions/18818102/convert-quaternion-representing-rotation-from-one-coordinate-system-to-another/18818267

In that question, coordinate system axes could be mapped to one and another directly because the coordinate systems are orthogonal to each other, but in my case the coordinate systems are not orthogonal to each other which prevents it to map directly. How can I convert the quaternion rotation in such case? Any help would be much appreciated.

sentences:
Preferred option for indicating player's movement choices on a hexagonal grid on touch I'm building a prototype turn-based game and I'm considering the best approach for user interaction with the game board. It's a hexagonal grid, where the user can select units and move to other cells on the board. The number of steps they can take in a single move is variable and depends on the unit.

I'm aiming this for use ontouch screen devices, so that will exclude hover-based indicators (which make the most sense in terms of interaction).

So, with that limitation, what methods are possible for indicating to the user the amount of cells they can move?

So far, I've come up with these options:

Allow the user to take their turn and move step by step, highlighting the nearest 1 neighbour cells each time.
Highlight all possible destination cells:

Highlight the outer ring of maximum distance:

Draw a line through the outer-most cells to indicate maximum distance:

Each of these has their own drawbacks. The first, will be done dynamically and will require creating the markers on the fly (not inconceivable) and will also look kind of strange when there are lots of options. The image shows a unit which can move 2 cells and already looks over-crowded.

The second would solve the problem of too many cells being lit up at once. Unfortunately, I'd be worried the user wouldn't understand that they could move to one of the non-highlighted cells within the ring.

The last has the same problem as the second where I'm not sure they'd understand where they can move. It would alleviate the need to create multiple markers and store temporarily as I'd only have to store a single hexagon of varying size.

So, any ideas? Am I over-thinking this one?

NOTE: I've made the images above from this extremely useful site: http://www.redblobgames.com/grids/hexagons/

sentences:
Entity System creating Components Over every entity system I see implemented in C++, or even in Java/C# (e.g. the Artemis framework). I see components not allocated via a new operator (or something similar, e.g. std::make_shared). For example:

entity.addComponent(new Position(32, 4, 5));
entity2.addComponent(new Position(5, 6, 7));
// those two position components that were just created
// may/may not be together in memory

// or even:
// how can you avoid using new here? (in the implementation)
entity.addComponent<Position>(32, 4, 5);

Doesn't this harm performance, as there would be cache misses (since new can allocate data anywhere from the heap)? How would you implement a system in such a way that the components of each type are allocated contiguously in memory, so you avoid cache misses? I mainly want to know how one would do so in C++.

sentences: Why do my NPC's fall through the world when I select them as triggers? I'm making a game in Unity where when the player comes into contact with an NPC it will switch scenes. I have the code for it and made sure all NPC's have rigidbody as well as using gravity and convex. They do not fall through the world but as soon as I click the trigger box on the mesh collider they start falling straight through the world. The switching scenes code works fine - I tested it and it does switch the scene.

sentences:
Java Tetris - Matrix Rotations I'm building Tetris in Java and am trying to use linear algebra to rotate a piece composed of 4 tiles.

My friend was explaining the way to do it is:

He said:

  "To clarify, you do need to rotate each point -- that is you need to
  rotate one point for each Tile in a Piece. But NOT four corners for
  each Tile in a Piece. The origin is like if you stuck a pencil through
  a piece of paper and spun the pencil around.. the spot where the
  pencil is is the origin."

  "So if you have a T on your board with Tiles at (7,9) (8,9) (9,9),
  (8,10) and its origin is at (8,9).."

So I'm doing it with coordinates (1, 3) (1, 2) (1, 1) (2, 2)… with origin (1, 2)

Then he said:

  "You translate the Tiles to be relative to the origin. That is, you
  treat the origin as the new (0, 0) for this rotation. That's as easy
  as just subtracting the origin from each coordinate, giving you (7-8,
  9-9), (8-8, 9-9), (9-8, 9-9), (8-8, 10-9) or (-1, 0) (0, 0) (1, 0) (0,
  1)"

Subtract origin (1, 2) from each coordinate

(1-1, 3-2) (1-1, 2-2) (1-1, 1-2) (2-1, 2-2) =

(0, 1) (0, 0) (0, -1) (1, 0)

Then he said:

  "Now rotate these four coordinates using the rotation matrix
  multiplication, like we have been talking about."

Finally he said:

  "Then add the origin coordinates back to each resulting coordinate,
  and now you have your four rotated Tile coordinates."

From the matrix above, I have (0, -1) (0, 0) (0, 1) (-1, 0)… so I add these to the origin coordinates like he says
(1-1, 3+0) (1+0, 2+0) (1+0, 1+1) (2-1, 2+0) =

Rotated coordinates: (0, 3) (1, 2) (1, 2) (1, 2)

But, looking on my rotated shape... it's completely wrong:

Any thoughts why?

Thanks!

sentences:
How can I move objects on to positions declared by their clicking order? I'm trying to create a quiz game with clickable letters. How can I move them to another area based on their clicking order?

Though you probably already understand what I'm trying to ask, lets clarify:
If I was to click the "H" letter first, it would move to the first white box, clicking "O" after that, would move it to the second white box etc.

sentences:
Easing equations with moving end points Usually easing equations have 4 parameters:

time
duration
begin point
end point

For example:

public static float EaseOutQuad(float currTime, float begin, float end, float duration)
{
    currTime /= duration;

    return -end * currTime * (currTime - 2f) + begin;
}

Now afaik begin and end point are fixed values.
In my game I have an object oscillating between 2 points on its local X axis. I'm interpolating its position using easing equations, but I would like to be able to modify the end point dynamically avoiding discontinous or abrupt changes.

Is it possible to do this using easing equations or something similar?
Any suggestion?

sentences:
How do I find out if this particular puzzle can still be solved? A while ago, I made a simple game that involved swapping birds to combine them and release them to create points. The idea is that eventually, the birds would get stuck and your game is over, but I found it tremendously hard to think of a way to detect a game-over, so I published it without such an algorithm and just hoped people would see it for themselves. However, I'm still very interested in a solution and hoped someone could help me.

The game works as follows:

6 different kinds of birds are distributed over an n x n (usually 4 x 4) grid.
For every two birds of the same type, if they would form a perfect rectangle together, they merge into one bigger bird of the same type. This means you can have birds that are, for example, 4 x 1 or 3 x 2.
Birds that are big enough can be removed from the grid, generating points. What's 'big enough' depends on the type of bird, some only need to cover 1 square on the grid, others 2 or 3.
Empty squares on the grid will get filled up with new, random birds falling from above. That is, of course, as long as other birds don't block the way. All birds always fall down when they can, and moving a bird upwards is therefore impossible (though, swapping upwards is allowed).
Two birds can swap places if they are of the same width when swapping vertically, or of the same height when swapping horizontally, but only when they are aligned perfectly. A bird can always move to an empty spot, given that its new position would be large enough to contain it and that the new spot wouldn't deny gravity.
Eventually, groups of 2 tall/wide birds will prevent anymore progress. Some birds can still be swapped, and maybe some would even become big enough to be removed when combined with certain others, but they will never get near each other, resulting in a game over.

I'm not too sure whether this is clear enough. I don't really want to post a link to the game here because I'm really only interested in the algorithm, not new downloads. Also I'm not too sure if I'm allowed to, as it could be seen as an advertisement. But please request more clarity where needed!

sentences:
Ignoring collisions without using physics layers Trying to ignore collisions between certain prefabs, but in this case I don't want to use layers since these are specific object pairs that I want to not collide, and creating a layer for each prefab would complicate the layer matrix more than I want to.

What I tried so far:

public void OnCollisionEnter(Collision collision) {
    if (collision.gameObject.tag == "Bullet") {
        Physics.IgnoreCollision(collision.collider, collider);
    }
}

So I tried ignoring the collision in the OnCollisionEnter, but this only worked partially. The objects did go one through the other, but they both slowed down. My guess is that the first frame of the collision, the one that generated the call to OnCollisionEnter, was calculated regardless of the ignore command.

Any ideas how I can make all bullets not collide to one another, without putting them in a separate layer?

sentences:
OpenGLHow to fit a texture to a curved plane with GL_CLAMP I'm trying to fit a texture on a curved plane made from some triangles  with GL_CLAMP, because GL_CLAMP_TO_EDGE is not available in my OpenGL version, but the texture (512 x 512 pixels) appears so small when render:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); // If the u,v coordinates overflow the range 0,1 the image is repeated
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // The magnification function ("linear" produces better results)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //The minifying function

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,  GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

I load the texture like this:
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECR );
glTexImage2D(GL_TEXTURE_2D, 0, 4, infoheader.biWidth, infoheader.biHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, l_texture);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, infoheader.biWidth, infoheader.biHeight, GL_RGBA, GL_UNSIGNED_BYTE, l_texture);

sentences:
Occasional lag-spikes in performance in heavily optimized game (profiler screenshots included) So I've been working on a mobile-based platformer for a few years now. I've spent more than a year optimizing the game for mobile as much as I could. Almost every single one of my meshes are using Mobile/Diffuse shader. When I test the performance of my game (on my phone) with the profiler, the frame rate stays at clean 60 fps for the most part. The CPU time fluctuates between 16 ms and 17 ms. The rendering statistics are also excellent, with draw calls fluctuating between 18 and 25, triangles fluctuating between 1.0k and 2.0k and vertices fluctuating between 2.0k and 3.1k. Below is a screenshot of the Rendering profiler when the game is running smoothly. I believe that for a mobile device, these should be very good numbers.

However, every now and then, I see a spike in the profiler window (see below):

According to the profiler, the spike is being caused by Render.OpaqueGeometry.

Under normal scenarios (when the performance is smooth), Render.OpaqueGeometry takes between 1 ms and 2 ms of CPU time. However, as you can see in the screenshot above, Render.OpaqueGeometry is taking 5.36 ms of CPU time and the total CPU time has jumped to 24.16 ms.

Based on my observations, this spike shows up once or twice per minute. Sometimes, several minutes go by without any spikes. And in very rare occasions, the spike can show up 3 times in a single minute (although I don't think that happened the last couple of times I tested it).

So why do you guys think this is happening despite the game being heavily optimized? I read in a post in Unity Answers that Render.OpaqueGeometry spikes are frequent in all games and it's nothing to worry about. But do you think 2 spikes per minute is too frequent for a simple platformer?

sentences:
Patterns for racing AI behaviour So let's say you've got a spline-based racing AI.  Assume it can already handle the basics of braking and steering around the track.

How would you structure and implement collision avoidance, overtaking, drafting, blocking and other behaviours so your cars remain competitive but make interesting races?

Links to papers/implementations would be awesome.

sentences:
vertex array with smoothness I'm using vertex array to draw 2d geometry,
but I can't achieve smoothness.

This is the code I'm using:

glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

glColorPointer(4, GL_UNSIGNED_BYTE, 0, shared_colors);
glVertexPointer(3, GL_FLOAT, 0, shared_vertex);

glDrawArrays(GL_LINES, 0, shared_counter);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_BLEND);

Some advice?

sentences:
How do I find voxels along a ray? I am making a voxel engine, and I want to make it possible to create and destroy voxels with the mouse. I use C++ and OpenGL, so C++ examples would be best.

So far, I have the camera position and appropriate angle as Vector3 values. I need to find voxels along a ray extending from the camera position along the angle. I tried to solve it myself, and essentially came up with a slow, 3D version of Bresenham's line. This would be okay, but it skips diagonals, meaning if I point toward the edge of a voxel, it usually misses.

The "bad" line skips over where the line crosses diagonals, while the good line hits them. I currently have the bad, but I want the good:

I have tried reading around this, but most of what I find relates to sparse octree rendering.

sentences:
Profiling the GPU of a tablet We are working on a tablet game in Unity Pro (for the first time). Unity's profiler works great for probing the CPU, but the tablet's GPU isn't supported in the profiler, so we have no idea where the rendering bottlenecks are.

Are there any other means of profiling the GPU of an android tablet? (We are working with a Samsung galaxy tab 2 10.1 ) How do other mobile devs do this?

We are basically looking for any ways of getting info from the gpu as we're running the game. Benchmarking software wouldn't help; we don't need benchmark scores.

Cheers!

sentences:
Can DrawIndexedPrimitives() be used for drawing a loaded model mesh-wise? I am using DrawIndexedPrimitives() for drawing a loaded 3D model by drawing each mesh part, but this process makes my application very slow. This is perhaps because of a very large number of vertex/index buffer data created in video memory.

That is why I am looking for a way to use the same method for each model mesh instead. The problem is that I don't know how I will set the textures of that mesh. Can anyone offer me some guidance?

sentences:
Optimizing HTML5 canvas transformed drawing in Javascript I am trying to optimize my HTML5 game engine and have noticed that currently a majority of the time taken in the game loop can be taken when drawing transformed tiles.  I think this is because each transformed tile saves the state of the canvas, applies a transform, draws the tile, then restores the state of the canvas.  Fortunately I have (at least) 2 classes of tiles, and if I am only drawing un-transformed tiles, the game runs quite smoothly.  Take a look:

Slow with transformed tiles in the background: http://sgdk2.enigmadream.com/ben/JavaSampleo.html
Faster with no transformed tiles in the background:
http://sgdk2.enigmadream.com/ben/JavaSample.html

Sure you could say that drawing the extra tiles alone is responsible, but I have used Chrome profiling to confirm that XFrame (transformed frame) is consuming more than 50% of the time.  So here's the drawing code for XFrame:

XFrame.prototype.draw = function(ctx, x, y) {
   ctx.save();
   ctx.transform(this.m11, this.m12, this.m21, this.m22, this.dx+x, this.dy+y);
   ctx.drawImage(this.imageSource, (this.cellIndex % this.graphicSheet.columns) * this.graphicSheet.cellWidth,
      Math.floor(this.cellIndex / this.graphicSheet.columns) * this.graphicSheet.cellHeight,
      this.graphicSheet.cellWidth, this.graphicSheet.cellHeight, 0, 0, this.graphicSheet.cellWidth, this.graphicSheet.cellHeight);
   ctx.restore();
};

Now one thing I can imagine improving this is if I could determine that many of the tiles I was drawing were using the same transformation, and make the single transform span the drawing of many tiles.  It would be a challenge given my current design, but I might be up to it if it would make a difference.  However that is of little use because the position of the tile has to become part of the transformation if I want the location of the tile to be excluded from the transform operation, I think.  For example, if I want to draw a tile rotated 90 degrees at a coordinate of 64,32, I can't simply apply the rotation matrix and then draw at those coordinates because 64,32 will get transformed to something like 32, -64 (right).  So I have to apply the offset as part of the transform for all transformed drawing operations.  And since each tile is drawn at a different location, that means a different transform for each tile.

Any suggestions for optimizing tile drawing operations where transformations may be applied at the tile level in real time?

sentences:
LibGDX with SoundPool I'm developing a game for Android using LibGDX in Android Studio.
I recently found out that some sounds in my game fail to play. I noticed that every time a sound fails to play, these are the logs:

04-12 10:49:51.784 24234-24283/com.gadarts.parashoot.android E/AudioTrack: AudioFlinger could not create track, status: -12
04-12 10:49:51.785 24234-24283/com.gadarts.parashoot.android E/SoundPool: Error creating AudioTrack
04-12 10:49:52.503 24234-24283/com.gadarts.parashoot.android W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 4, track 44100 Hz, output 48000 Hz

This is the code I use to play the sounds:

public long playSound(SFX fileName, boolean loop, float volume, boolean randomPitch) {
        if (GameSettings.SOUND_TOGGLE) {
            try {
                Sound sound = prepareSound(fileName);
                if (randomPitch && GameSettings.SOUND_RANDOM_PITCH) {
                    return setRandomPitch(loop, sound, volume);
                }
                if (loop) {
                    return sound.loop(volume);
                } else {
                    return sound.play(volume);
                }
            } catch (GdxRuntimeException e) {
                e.printStackTrace();
            }
        }
        return -1;
    }
private Sound prepareSound(SFX soundFile) throws GdxRuntimeException {
        try {
            String soundPath = SFX.fileAttribute.SFX_FOLDER_NAME.getValue() + "/" + SFX.fileAttribute.SOUNDS_FOLDER_NAME.getValue() + "/" + soundFile.getParentDir().getValue() + "/" + soundFile.getValue() + "." + soundFile.getFormat().getValue();
            Sound sound;
            if (!sounds.containsKey(soundFile.getValue())) {
                sound = Main.getAssetsManager().get(soundPath, Sound.class);
                sounds.put(soundFile.getValue(), sound);
            } else {
                sound = sounds.get(soundFile.getValue());
            }
            if (sound == null) {
                throw new GdxRuntimeException("preparing sound failed - sound not found.");
            }
            return sound;
        } catch (GdxRuntimeException e) {
            throw e;
        }
    }

The sound files are in WAV format.
Any ideas how to fix it? Thanks in advance!

Update: I've found out that this problem appears only on my Nexus 5X. I tried it on Xiaomi Redmi Note 4X and it didn't happen.

sentences:
How to ensure that a 3D coordinate at Z=1 act like a 2D coordinate (using perspective projection) Possible Duplicate:
  OpenGL ES 2.0: Mixing 2D with 3D

The title probably is not that clear but please help me out here. I am going to write a (mostly) 2D game using OpenGL ES 2.0 so if I have a vertex at (5,10,1) I want it to be drawn at the (5,10) pixel on the screen. But I can't use orthogonal projection because I'll still use some few real 3D objects on it to give a cool effect, and I want to preserve the perspective distortion on their vertices with Z > 1.

How should I set up my view/projection matrices to achieve this?

note: I am so sorry if this sounds like a noob question, but please take in account that I am a noob myself...

sentences:
Can COLLADA be used for partial animations / animation blending? I am making a game engine, using the COLLADA format for my models. Part of the requirement for my models is partial animations, for example if the model was a person, an animation could only affect the upper body and have no effect on the lower body.

I would guess this is accomplished by having a scalar value associated with each animation-bone pair that represents the weighting of the animation applied to the bone, but in the COLLADA documentation I didn't notice any such field. So is it possible to do this with COLLADA?

And as an ancillary question, is blender able to create and export such animations?

Basically, what all do I need to know to have this type of feature in my engine?

sentences:
Painting terrain with a selection circle I don't mean putting a circle under a unit like done in an RTS, that's fairly simply done with a scenegraph(-like structure). What I'm referring to is selection circles for things like Area of Effects that are painted on the terrain.

It seems relatively simple until I think about it.

Here are some images for reference:

http://i.stack.imgur.com/iXWXB.jpg
http://im.tech2.in.com/images/2009/jan/img_116282_initialthreat_640x360.jpg

The first image gets the idea across, but not the full scope. Basically, the floor is painted with a decal detailing the region that will be affected by the spell.

The second image gets it across much better, it's not just a flat painted circle, it wraps along the mesh.

At first I figured to use some sort of object selection, and then in the vertex shader draw the texture on the correct vertices based on... some criteria that I'm still working out. Most likely based on distance and angle from the intersection point. The difficulty seems to come in that the methods wrap onto objects that seem to be completely different meshes.

I can't find an image that shows it (and don't play WoW anymore so I can't take a screenshot), but say you have a terrain mesh and a house on top of it and I select a point very close to the house's wall. Instead of continuing on the terrain mesh, the selection circle will go as far along the terrain mesh as it can, and then wrap up onto the wall of the house. It also ignores certain objects (players, etc), but that's pretty easy to ignore with correct collision tags/callbacks.

It's not so much that I can't think of a way to do this, but all the ways I can think of would probably lag your game out or turn your processor into slag. Somehow I have to:

Draw a texture
With no breaks
Wrapping on multiple objects according to the terrain
Centered at a given point
Completely dynamically (so no pre-baking it into a bunch of dummy textures)
Quickly enough to be computed every frame

Is there a standard method for this? Am I just overthinking it?

My best guess is rather than do one ray cast and selecting that point as the "center" I do a bunch of casts and in each case select the nearest vertex and bind the appropriate UV coord to that vertex, but it seems messy and potentially performance heavy to select that many vertices that way at the CPU frame-by-frame level. Especially since ray casts in general are expensive, even with a good physics engine.

It also doesn't seem particularly portable to anything other than a selection circle. A similar case would be like drawing the movement arrow over the terrain in Total War games, a thick arrow is drawn between the unit and its destination (see here: http://webguyunlimited.com/pixelperfectgaming/wp-content/gallery/total_war_shogun_2_rise_of_the_samurai/total_war_rots_screenshot_014.jpg ), this would seem to be a very similar technique to the AOE selection circle, but the ray cast method I mentioned wouldn't really work for it. There are, of course, numerous other examples too (such as trajectory markers).

sentences:
Detect click on Triangle and Circle buttons How can I detect clicks on a texture (which will be a button in my game) which has the form of a triangle or circle. I only know the rectangle solution which uses the position, width, and height; which won't work because clicks will be detected on transparent pixels.

I have heard of pixel-perfect collision, would that be the right way to do this?

It would be great if someone could give me a example for such a solution.

sentences: RTS engine tick rate I've seen some varying tick rates used for RTS engines. Supreme Commander ran at a super-low 10 ticks per second. Is this normal for RTS engines, or do they normally have a higher tick rate?

sentences:
MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt.

What I have so far is:
- randomly generated tile set with items on SOME tiles
- one creature spawner that spawns up to 5 creatures which can be controlled by the player
- the ability for creatures to pick up items and bring them back to the spawn and store them for later use

What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt.

If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you.

thanks for reading!

I have my draw method like this:

GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

spriteBatch.Begin(SpriteSortMode.BackToFront,
          null, null, null, null, null,
          camera.GetTransformation());

worldEntity.Draw(spriteBatch);

guiManager.DrawGUI(spriteBatch);

spriteBatch.End();

base.Draw(gameTime);

for the world entity...
its draw method systematically goes through each tile in the world and calls its draw method.
the tile draws itself using

Vector2 topLeftOfSprite = new Vector2(this.X, this.Y);
Color tintColor = Color.White;
spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor);

and then proceeds to call the draw method of any items on it.

creatures and items have very similar draw methods.

the gui also draws itself in a similar fashion.

what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?

sentences:
How do I find the name of the current audio clip being played? I have a title scene and a credits scene that use the same music. When I start my game the title scene music plays, and I have my game set up so the audio manager is not destroyed on load. When I enter my credits scene I do not instruct any new music to play, but each time I reload my title scene the title music restarts because a script in the scene tells it do so.

How can I get the name of the current audio track so that I will only play audio if it differs from what's currently being played?

This is my "LevelMaster" script which is responsible for handling the audio in each scene.

public class LevelMaster : MonoBehaviour
{
private AudioManager AudioManager;

[SerializeField]
private string trackName;

private void Start()
{
    AudioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();
    AudioManager.Play(trackName);
}

public void PlaySound(string soundName)
{
    AudioManager.Play(soundName);
}

public void StopSound(string soundName)
{
    AudioManager.Stop(soundName);
}

sentences: How to Refresh Dependencies after Adding FreeType Extension in Android Project I'm planning to use FreeType fonts in my game (LibGDX and Android Studio) and I already added the freetype dependencies in my project. How can I refresh the dependencies after adding them? I have found few similar questions regarding this topic but didn't offer much help. Here is an image of the dependencies:

sentences:
Anti-Aliasing Issues in MonoGame My anti-aliasing is not working in MonoGame.  I'm not sure if I'm doing something wrong.  See the image below (rotating the screen -- coordinates are all overlapping/adjacent, so should blend them):

http://imgur.com/a/xIj7C

On the ctor of my Game, I have the following:

        Graphics = new GraphicsDeviceManager( this )
        {
            PreferredBackBufferHeight = 720,
            PreferredBackBufferWidth = 1280,
            PreferMultiSampling = true
        };

        Graphics.ApplyChanges();

Which, should enable Anti-Aliasing.  Further, I have:

                GraphicsDevice.RasterizerState = new RasterizerState()
                {
                    CullMode = CullMode.None,
                    MultiSampleAntiAlias = true,
                };
                TileMeshEffect.CurrentTechnique.Passes[0].Apply();
                GraphicsDevice.SetVertexBuffer( TileMeshVertexBuffers[Coordinate] );
                GraphicsDevice.DrawPrimitives( PrimitiveType.TriangleList, 0, TileMeshVertexBuffers[Coordinate].VertexCount / 3 );

Right as I'm rendering the Mesh, which should, I would think, do everything necessary.  I was able to confirm via debugger that both are set, and that furthermore, the number of passes was 4 (GraphicsDevice.PresentationParameters.MultiSampleCount).

Any clue what I'm doing wrong?

sentences: Moving Sprite With Physics Frame Normally, a physics frame in pink (see image below) gives the body for detecting hit signal. It usually either falls down or lifts up depending on the gravity orientation. The question is: Is it possible to move or manipulate sprite through X and Y coordinate without needing to use the gravity code from a physics engine like bodyeditor-loader-sources.jar (e.g. ballBody.setGravityScale(100.1f);) so that I can move simply either by dragging, change the value initially, or moving it by D-pad?

sentences:
What is a good rule for blocking projectiles on a square grid? Suppose we have a square grid, and each tile may or may not be occupied by an object. Some of those objects can be a unit that can launch a projectile at another unit. However, that projectile should be blocked if a third unit is "in the way" of the projectile path.

What I want is a rule for whether a projectile path is "blocked" from one tile to another, based on possible intermediate tiles blocked by an object. The blocking rule should satisfy the following criteria:

1) It should be based only on the information about the relative position on the grid of the two tiles, and the occupation of tiles by objects. Details such as which object is occupying a tile should not matter. Imagine the same rules would apply with placing stones on a Go board

2) It should be as obvious to the player as possible what the projectile blocking rules are. Imagine they could move a ranged unit to a tile to get a shot, and that movement is irreversible. If they later find out that the shot they wanted to make is blocked, they essentially got screwed over by a game mechanic. I don't want people to lose a game because of opaque mechanics. It should be as obvious as possible to the player that the shot they want to make form a tile is blocked before moving to that tile.

3) The rule should be generally applicable, not just a heuristic for a non-general set of possible scenarios. Given any two integer coordinates, {X1, Y1} and {X2, Y2} we should automatically be able to name the coordinates of all tiles that block those two coordinates.

4) The rule should be invariant to 4-way rotation, translation, and reflection along either axis.

Some rules would be obvious. For example, if your shot is completely horizontal/vertical (rook movement) or completely diagonal (bishop movement) and something is directly in that path, it should be blocked.

But there are cases that are not completely obvious to me, and different rules have been followed in different games. For example, what if the projectile launcher and target are separated by a knight's path? Is an object blocking the projectile if it lies on one of the two tiles that sit between the launcher and target along the long axis of separation? I have seen that being a valid block in the game Hero Academy, though it's not obvious to me that it should be.

EDIT: I realize that point #2 can be addressed with a nice UI that can inform the player of whether a path is blocked before they commit to their move. However, even if the UI does that, I still want it to be obvious to the player, independent of the UI. (If the player has to play a few games to learn how it works, that's fine, as long as it's easy to learn.) This aligns with my general philosophy that one should maximize the proportion of cognitive effort that goes towards strategic decision making, and minimize the proportion of cognitive effort that goes towards figuring out game mechanics on the spot.

sentences:
How to fill with empty space with retangles I have a 'square' class with the representation of its limits from the variables x1, y1 and x2, y1 these variables define points 1 and 3 of the same, in this case the coordinates would be (0,0), (10, - 10):

From this drawing I want to insert rectangular areas, also defined through x1, y1, x2, y2 coordinates, within that area. In this example case I will use the following values (input):
area1 = (0,0)(3,-3),
area2 =  (4,-2)(6,-4),
area3 =  (8,-1)(10,-4),
area4 =  (1,-5)(6,-7),
area5 =  (7,-6)(9,-9)

How to obtain a function from there that returns the rectangles (coordinates) of the largest possible areas within the remaining empty areas and not occupied within the main square, as shown in the visual representation?

Notice, the output of the function in this case should be:
outputArea1 = (3,0)(8,-2),
outputArea2 = (8,0)(10,-1),
outputArea3 = (3,0)(4,-3),
outputArea4 = (6,-2)(8,-4),
outputArea5 = (6,-4)(10,-6),
outputArea6 = (0,-5)(1,-7),
outputArea7 = (6,-6)(7,-7),
outputArea8 = (9,-6)(10,-10),
outputArea9 = (0,-7)(7,-10),
outputArea10 = (7, -7)(9,-9),
outputArea11 = (7,-8)(9,-10)
The following code demonstrates the implementation without the requested function:
class Retangle {

borderLimitX1 = 0;
borderLimitX2 = 10;
borderLimitY1 = 0;
borderLimitX2 = -10;

static void Main() {

    List < Retangle > areas = new List < Retangle > ();

    ///areas.Add(x1,x2,y1,y2)

    areas.Add(0, 0, 3, -3);
    areas.Add(4, -2, 6, -4);
    areas.Add(8, -1, 10, -4);
    areas.Add(1, -5, 6, -7);
    areas.Add(7, -6, 9, -9);

    List < Retangle > remainingAreas = CalculateRemainingAreas(areas);

}

List < Retangle > CalculateRemainingAreas(List < Retangle > originalAreas) {

    List < Retangle > remainingAreas = new List < Retangle > ();

    ///// --> Algorithm to calculate Remaining Areas   <-- ///

    return remainingAreas;
}
}

  internal class Retangle {
int x1,
y1;
int x2,
y2;

Retangle(int x1, int y1, int x2, int y2) {
    this.x1 = x1;
    this.y1 = y1;
    this.x2 = x2;
    this.y2 = y2;
}

}

sentences:
Questions about scaling in a 2d game in unity Okay, so:

I am making an android game. I want everything to scale to the size of the screen I'm using. Further, my static background needs to scale (as well as every other object), but if the aspect ratio is less than the AR of the background image I want the image to be cut off at the edges.

Further, I have a game object I need to always be at the corner of the screen. I'm guessing I should use a script to determine the width of the screen and place it a few coordinates up and right of that on start?

The game is only in landscape mode if that matters. How do I go about this? I previously had the background as a plane with an image on it but it didn't take up the whole screen and I think it might not be the right thing to do? Maybe use a quad?

How do I test to make sure that this works? I only have my one android phone to test it on.

sentences:
Unity3D: AI follow player script for prefab enemy? So I am having an issue, I have an enemy prefab that is created when the new wave happens(think of Nazi Zombies from Call of Duty, same system) but every script I have found that deals with ai following player always involves a public transform variable. The issue is that the object I put in that variable in the inspector does not save with the prefab, rendering the script useless. Is there anyway I can get the enemy prefab when the enemy spawns to follow the player?

He is a script I tried and failed due to the issue:

    //The target player
public Transform player;
//In what time will the enemy complete the journey between its position and the players position
public float smoothTime = 10.0f;
//Vector3 used to store the velocity of the enemy
private Vector3 smoothVelocity = Vector3.zero;

private void Start()
{
}

//Call every frame
void Update()
{
    //Look at the player
    transform.LookAt(player);
    //Move the enemy towards the player with smoothdamp
    transform.position = Vector3.SmoothDamp(transform.position, player.position, ref smoothVelocity, smoothTime)*Time.deltaTime;

}

sentences: How to handling touchpad? I have a touchpad.  I tried touchpad.getKnobX> 0 and <0 (when swiping the knob left and right) the sprite still displayed but when I put touchpad.getKnobY> 0 and <0 (to swipe knob up and down) the sprite didn't show.  Why is that?

sentences:
Project 3D points to a plane, then project their bounding box back to 3D I have a table in 3D space, represented by a plane.

I want to project arbitary points representing an object (cup, toy, etc) onto that table, run 2D principal components analysis to get an oriented bounding box (https://www.sciencedirect.com/topics/computer-science/oriented-bounding-box)

This gives me 2D oriented bounding boxes (defined by 8 corner points) that lie along the table plane. Now, I want to project these points back to 3D somehow so I can get 3D bounding boxes that are aligned with the plane.

The projection from 3D to 2D plane is not invertible.. so how do I do this?

sentences:
Using Unity built-in sprites programatically I'm trying to figure out how to use the "Panel" built in resource in a game I'm making. I've been able to figure out some potential solutions, but I can't quite figure out how to put all of the pieces together.

panelImage.sprite = UnityEditor.AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/InputFieldBackground.psd");
panelImage.sprite = Resources.GetBuiltinResource(typeof(Sprite), "Resources/unity_builtin_extra/Background.psd") as Sprite;

The first produces the button sprite, which is almost what I want, but not quite. The second doesn't work at all. I'm missing some small piece of what it takes to make this work, but I can't quite figure it out. How can I use the panel background programmatically?

sentences:
Cocos2d-x supporting multi-resolution using density independent pixels Is there a way to use Density Independent pixels(dp) in cocos2d-x?

I am developing an Android game using Cocos2d-x 3.0.

The Android reference http://developer.android.com/guide/practices/screens_support.html tells me not to use pixels in code but use dp when supporting multi-resolution support. It also tells me to provide different images for different screen size groups and different density groups.

However, cocos2d-x tutorials use pixels for multi-resolution support. If I were to use pixels, I think it means I need to have images for all these different resolutions:

240x320, 240x400, 240x432
320x480
480x640, 480x800, 480x854
600x1024
640x960
1024x600, 1024x768
1280x768, 1280x800
1536x1152
1920x1152, 1920x1200
2048x1536
2560x1536, 2560x1600

Even if I don't support every screen resolutions, I think this requires more work than following the Android reference's best practice.

Am I missing something on how supporting multi-resolution works or do I indeed do need to do much more work using cocos2d-x?

sentences:
player does not collide with walls unity 5 I just started a new proyect with a personalize first person controller, like arrow move style, it worked, but when I tryed to collide it with walls it did not happen, I tryed adding a capsule, then adding the camera, rigidbody, character controller and my script to that capsule , then if you can see there are two walls one with box collider trigger the other one unchecked, it walks around but it does not collide at all, i'll add my controller script + scereenshot, thanks for you time

#pragma strict

public var speed = 100.5;

function Update () {
//rotate
var horizontalDir = parseFloat(Input.GetAxis("Horizontal") * speed * Time.deltaTime);
transform.Rotate(0, horizontalDir, 0);

//move backward and foreward
var verticalDir = parseFloat(Input.GetAxis("Vertical") * (speed / 10) * Time.deltaTime);
transform.Translate(0,0, verticalDir);
}

sentences:
Spatial data visualization level of detail I have a 3D point cloud data set with different attributes that I visualize as points so far, and I want to have LOD based on distance from the set. I want to be able to have a generalized view from far away with fewer and larger points, and as I zoom in I want a more points correctly spaced out appearing automatically.

Kind of like this video below, behavior wise:
http://vimeo.com/61148577

I thought one solution would be to use an adaptive octree, but I'm not sure if that is a good solution. I've been looking into hierarchical clustering with seamless transitions, but I'm not sure which solution I should go with that fits my goal.

Any ideas, tips on where to start? Or some specific method?

Thanks

sentences:
Create vertices + indices for cylinder with triangle strips I'm trying to create vertex and index buffer for a cylinder (in OpenGL, but it shouldn't matter). I think my vertex buffer is fine (I checked drawing with GL_POINTS). Here's the code that builds it:

int sides = 10, slices = 40;
float radius = 3.5 * 10.0;

numVertices = sides * slices;
Vertices = malloc(sizeof(Vertex) * numVertices);

int angleincs = 2*M_PI/sides;
int cs_angleincs = 2*M_PI/slices;
float zval;
float zstep = height / (float)sides;

float i;

for(int m=0; m<slices; m++)
{
    int index = (m*sides);
    for (int n=0; n<sides; n++)
    {
        Vertices[index + n].Position.x = cosf(i);
        Vertices[index + n].Position.y = sinf(i);
        Vertices[index + n].Position.z = zval;

        i += angleincs;
    }

    zval += zstep;
}

I'm stuck at the index buffer generation. Any help on how to build it? I tried to adapt some code from a torus generator, and I get something that apparently resembles a cylinder but it's a bit weird and has a few extra weird triangles.

numIndices = (2 * (sides+1) * slices + slices);
Indices = malloc(sizeof(GLushort) * numIndices);

int n=0;
for (int i=0;i<slices; i++) {
    for (int j=0; j<sides; j++) {
        Indices[n++] = i * sides + j;
        Indices[n++] = ((i+1)%slices) * sides + j;
    }

    Indices[n++] = i * sides;
    Indices[n++] = ((i+1)%slices) * sides;
    Indices[n++] = ((i+1)%slices) * sides;
}

Thanks in advance.

sentences:
Is IDirectInput8::FindDevice totally broken on Windows 7? I'm developing on Windows 7, and using DirectInput8 for my input needs.
I'm tracking gamepad additions and removals (that is, GUID_DEVINTERFACE_HID devices) using the DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE messages, which works fine.

However, what I've come to find out is that no matter what I do, passing the received values from DBT_DEVICEARRIVAL to IDirectInput8's FindDevice method, it will always fail to identify the device, returning DIERR_DEVICENOTREG.

DirectInput still clearly knows about the device, because I can enumerate and create it just fine.
I've tried with three different gamepads, and the error persists, so it's not about that either.
I also tried passing some alternative interface GUIDs for the RegisterDeviceNotification call, didn't help.

So, has anyone else faced the same problem, and have you found a usable workaround?
I'm afraid I'll soon have to stoop down to re-enumerating all devices when something is added or removed, but I'll first give this question one last shot here.

EDIT: For the record, I've also tried pretty much every single HID API & SetupAPI function for alternative ways of figuring out the needed GUIDs, with zero success. So if you're facing the same problem as me, don't bother  with that route. I'm pretty sure those GUIDs are made up by DirectInput itself somehow. Short of reverse engineering dinput8.dll, I'm truly out of ideas now.

sentences: controll mouse cursor movement speed in unity Im searching for a way to lower my mouse movement cursor speed and not to let the user move it fast but i dont know how. i searched in internet but could not find something Usefull. thank you for helping.

sentences:
Unity - Setting Script Execution Order inside a package When working inside of a Unity project, to set up the execution order for all the scripts is quite easy. It can be done under "Project settings". But when working developing a package, this option is not available, since we are not developing actively a Unity project.

But at the same time, I wish that every project that imports my package executes its scripts in the right order, without the user needing to set it up manually for every project.

How can this be achieved?

sentences:
How are Uniform Layout Qualifiers in GLSL spaced out So for attributes the spacing between indexes is vec4, so if I had 2 matrix as an attribute, they'd be layout (location = 0) in mat4 a and layout (location = 4) in mat4 b

If I did the same for 2 uniform matix, what would the index of matrix b be?

Side note: with OpenGL 4, are VBOs also attributes, there isn't a key word for vertex?

sentences:
3D game: is a spatial index necessary? I'm working on a 3D space simulation game in C++.

I've read that in many cases games use spatial indexing (hashing) that allows to quickly detect collisions, find out what entities to draw and so forth.

Is this really necessary for my game, considering that collisions between entities can happen, but are very rare? Is there any viable (and simpler) alternative?

sentences:
How can I use Cross Platform Input in Unity 2019? I am trying to use CrossPlatformInput in Unity 2019 to follow this tutorial to use it on iOS:

https://www.youtube.com/watch?v=Auj1mrsfXDE

However, I have no item in the top bar for "Mobile View" like in the tutorial, and I do not know how to enable it. I have Standard Assets imported already. Is there an example project I can download with CrossPlatformInoput that works with iOS or a way for CrossPlatfromInput to work in modern versions of Unity?

sentences:
What is the difference between Vector2.Transform and this method? I've been working on some steering behaviors and ran into trouble with my logic for converting points in world space into points in local space. I had this (it's not optimized for multiple points yet, but that is not the point of my question):

public Vector2 WorldPointToLocal(Vector2 point)
{
    var tx = -Vector2.Dot(this.Location, this.Heading);
    var ty = -Vector2.Dot(this.Location, this.HeadingPerpendicular);
    var rotationMatrix = new Matrix
    {
        M11 = this.Heading.X,
        M12 = this.HeadingPerpendicular.X,
        M21 = this.Heading.Y,
        M22 = this.HeadingPerpendicular.Y,
        M31 = tx,
        M32 = ty
    };

    return Vector2.Transform(point, rotationMatrix);
}

This did not work. The returned point was always well outside the expected range. I had collated most of the mathematics from various sources and began to suspect that Vector2.Transform wasn't doing what I thought it was supposed to do. I found an alternative implementation in C and translated it into C#:

private Vector2 VectorTransform(Vector2 vector, Matrix matrix)
{
    var tempX = (matrix.M11 * vector.X) + (matrix.M21 * vector.Y) + matrix.M31;
    var tempY = (matrix.M12 * vector.X) + (matrix.M22 * vector.Y) + matrix.M32;

    return new Vector2(tempX, tempY);
}

When I used this implementation instead of Vector2.Transform, everything worked perfectly.

However, I don't want to leave it at that. I'd like to understand why Vector2.Transform does not do the same thing, and whether there's anything I can do to leverage it instead of writing my own. The API documentation doesn't help at all and I'm a bit clueless when it comes to matrix mathematics.

sentences:
OnTriggerExit() called when game object with collider component gets re-parented I have an object Hand, with a rigid body attached to it. In every Update() call, the user's hand controller rotation and position are tracked.

In my scene, there is an object Pin, with a mesh collider attached to it.

In OnTriggerEnter() (inside the Hand class), Pin becomes re-parented to Hand. (Pin's original parent is something else.)

My scene also contains other objects with colliders. However, these other objects do not get re-parented -- only Pin does.

Once this re-parenting takes place, OnTriggerExit() (in the Hand class) is called immediately. This is surprising to me -- I had expected OnTriggerStay() (in the Hand class) to be invoked instead, since Hand is still in contact with Pin.

Is such behaviour by design? Is there an elegant way of working around such behaviour?

UPDATE:

In response to this comment:

  Does the pin object have a parent before it becomes a part of the
  hand?

Yes. As mentioned in my post, Pin's original parent is something else.

  Or is it placed inside another collider? And does the pin leave any of
  these collider areas when the parenting takes place?

As mentioned in my post, Pin itself has a mesh collider component attached to it. Perhaps I am not understanding the question correctly...

  You can prevent the hand's script from getting this OnTriggerExit by
  adding a seperate rigidbody to the pin.

I added a separate rigid body to the pin (setting isKinematic to true), but OnTriggerExit() inside the Hand class is still called immediately after Pin gets re-parented.

MORE INFORMATION:

Pin's original parent (before it gets re-parented to Hand) does not itself have a collider component.
When OnTriggerExit(Collider collider) gets called immediately after the re-parenting takes place, the collider argument passed to the method is the Pin itself.

sentences:
Creating a full-screen window in Windows API I've got a Windows API Window. I've managed to make it windowed, and "fullscreen windowed". But I can't seem to make the window just full-screen- for example, even if I specify WS_POPUP, I can still freely move the cursor to my second screen. However, if I launch full-screen games, they don't permit it, and exist only exclusively or minimized. How can I make a window that behaves this way?

Edit: Excuse me. Limiting the mouse movement was just one example of how a full-screen window behaves differently to a non-fullscreen window, I'm not looking for how to limit the mouse movement.

Or is this set in the D3DPRESENT_PARAMETERS, rather than just communicated?

sentences:
When two moving objects collide, which one sends the message, and which one recieves it? I am writing a platform game using an entity-component system. Entity-World collisions are robust and work very well, and I'm now working on collisions between entities.

Just to be clear, in my code an Entity is a collection of Attributes (data) and a collection of pointers to Components (logic).

My Entity class has a sendMessage(messageType type, char* messageData) member function, which adds the messageType and messageData to a queue which is then used by the component interested in that message type. So in this example CollisionMessage is used by CollisionComponent and processed at the end of the tick with other messages (after normal collision checks).

My problem is that with every collision, I have two messages sent per collision, from each Entity to the other. This means that either I need to halve the forces I apply since it applies to each entity twice or I need to set up some Entities to only send collision messages and some to only receive collision messages.

So far things work fine when a player collides with an item, as it just gets picked up and removed from the world, but collisions between players and enemies are proving troublesome.

Is there a better way, or is there anything fundamental I've missed?

Thanks.

sentences:
Is there a standard camera position / orientation? I've come across a need to position a camera for an arbitrary (unknown) scene. The camera can be updated later, but I thought I'd give it a reasonable default, and the thought crossed my mind that there may be a decent "standard" for this.

At the very least, a given modeling program (Maya, 3dsMax, blender...) ships with a default position / orientation for a camera.

A default light would be useful too; is there a similar standard for this?

In the lack of any good suggestions here, I thought I'd try to orient the camera so that an object of approximate diameter of 2 (such as a unit circle) would fit well in the scene and provide a directional light in the direction of the camera.

Edit: while we're at it, what about:

camera FOV / frustum
light color / intensity / etc

sentences:
Euler adjustments between two quaternions I have two quaternions, q1 and q2. If my object's current rotation is at q1, but I need to get it to q2, what would be the process to figure out how much rotation I apply to x, y, and z in order to get there?

In this example, x=right, y=up, z=forward

I've tried getting the delta between the two quaternions and unwrapping that into Eulers and moving the x, y, z the amount of the unwraped Vector3f, but that does not seem to give the correct values. Current implementation in pseudo code:

var dQuat = Quaternion.Inverse(prevRotation) * target.rotation;
dChange = dQuat.eulerAngles;

This approach gives me only positive changes. If I rotate forward on x, I get positive lower numbers and if I rotate backwards on x, I get larger positive numbers.

I'm looking for, in order to get to q2 from q1, rotate n degrees along your x, y, z...

Thanks in advance for any help!

sentences:
Set parent by property In the editor's hierarchy, if I drag and drop one object onto another, the second becomes the parent of the first, and moving the parent will cause the child to move. I see I can set this relationship in code by setting the transform.parent property. So I wrote a component to help with doing that from code:

public class ParentTo: MonoBehaviour
{
    public GameObject _parent;

    public GameObject Parent {
        get { return _parent; }
        set {
            this.transform.parent = value.transform;
            this._parent = value;
            Debug.Log("Set parent");
        }
    }
}

So to test it, I have 2 cubes in the scene. On cube 2 I put the ParentTo script, leaving it with no parent set, then start the game and use the editor to drop Cube 1 on that field in the inspector. According to the inspector, it seems to have been set right, but the debug statement doesn't appear in the console and moving Cube 1 doesn't move Cube 2. What am I doing wrong?

sentences:
I can't create a "trap" block So, I am trying to make a "trap" block. It should kill the entity that will stand on it(or walk as in the code, if somebody knows how to make that it will do something while an entity stands on it, it will be helpful). Here's the code for the block:

package com.daniel_sl.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

public class Trap extends Block{

  public boolean isDead;

  protected Trap(Material material) {
    super(material);
  }

  public void setDead()
  {
    this.isDead = true;
  }

  public void onEntityWalking(Entity Entity){
    if(Entity instanceof EntityLiving){

      Entity.setDead();
    }
  }
}

When I stand on the block it doesn't do anything.

sentences:
I do not understand the code version of time based sprite animation? I'm Universo and for the longest time had coding issues around the concept of time-based sprite animation basically, do not know how to implement it and any code or explanation simple or complex that I've found has been extremely confusing to me and was hoping to have a kind person walk me through the code step by step, explaining exactly how this is implemented correctly.
Here's what, I believe to know about the concept and or idea for time-based sprite animation it is to construct a delay or halt of some code statement using time of some kind in milliseconds with a collection of moving images and or sprites however any attempts from the tutorial's or my own brain have resulted in inaccurate various speed sprite animations and not the consistent stable speed, Id appreciate and be grateful for here's some code to show my progress and perhaps help you understand my position in this mess baring in mind, I prefer my code be as extremely simple and speedy as possible within the limitations, of course:
JavaScript with HTML5 Canvas
window.onload = function () {

var canvas = document.getElementById("canvas"); // get the canvas object

var ctx = canvas.getContext("2d");
/* make sure we have a context for that canvas so we can draw stuff */

var FrameSize = 120; //120 pixels
var FrameNumber = 0; //obvious
var img = new Image(); // make a image object
img.src = 'sprite_ani.png'; // url to the image
var last = 0; // no idea

function Render() {

  ctx.clearRect(0,0 ,640,480); // clear screen
  now = performance.now(); //to get the current timestamp in milliseconds
  delta = now - last; // last is 0, how does this work?
  last = now; // last is now, why?

  if(delta > 20 //what does this value represent??) {
     FrameNumber += FrameNumber + 1;

   /* increment FrameNumber by 1 could have been FrameNumber++ */

     delta = 20; // No idea why I need to keep this the same number??
  }

  if(FrameNumber>=4){   //just to make sure this is the end of the frame number sequence
     FrameNumber = 0; // to reset the frame number
  }
     ctx.drawImage(img,FrameSize*FrameNumber,0,120,120,0,0,120,120);

     /*
     perticularly draw a sequence of images and switch each individual image
     in that sequence based on the equation

     FrameSize
     (number to multiply the pixels by)
     * // multiply operator symbol
     FrameNumber
     (the pixels for the FrameSize to multiply with)
     */

     window.requestAnimationFrame(Render); // do the Raf stuff part one
}
window.requestAnimationFrame(Render);  // do the raf stuff part two
}

As you can see, it's extremely simple yet, I'm still struggling to not only understand it but extremely simply implement it, I'm not a fan of over-complicated coding hence why I ditched c++ ages ago.
Could someone in extremely simple english guide me through time-based sprite animation in the context of JavaScript preferably, Id also really appreciate various time-based sprite animation methods being explained too in extremely simple terms but not holding out, I thank you for reading this far.

sentences:
XNA - multiple VertexBuffers? I'm trying to learn how to use VertexBuffers in XNA 4.0. I can render wireframe shapes and I can render textured shapes. However, I'm having some trouble rendering them both at once.
 I'm initializing the buffers like this:

vertexBuffer1 = new VertexBuffer(graphics.GraphicsDevice, vertexDeclarationWireframe, numPointsWireframe, BufferUsage.None);
vertexBuffer1.SetData<VertexPositionColor>(pointList1);

vertexBuffer3 = new VertexBuffer(graphics.GraphicsDevice, vertexDeclarationTexture, numPointsTexture, BufferUsage.None);
vertexBuffer3.SetData<VertexPositionTexture>(pointList3);

The above code fails during Draw() because the vertex buffers are using two different types of vertexDeclarations, one for wireframe (VertexPositionColor) and one for textures (VertexPositionTexture). I tried moving the call to VertexBuffer.SetData() to just before the relevant geometry is drawn but that didn't work.

I've also tried setting my Effect object TextureEnabled = false when wireframe is being rendered and resetting it when the textured geometry is rendering, but that didn't work either. The effect seems to be expecting a TextureCoordinate regardless.

What's the proper way to do this?

sentences:
How to reset scene (stage1) when selecting it from Level stagemain menu Good day I have a problem when the player finish stage 1 the screen look like this

Then going back to selecting level

When I try to play the stage 1 again. I want to reset the stage 1 so i can play it again.
I only use
Scene.LoadScene("stage1") in main menu to go to stage1 and
Scene.LoadScene("mainmenu") to back to main menu

sentences:
Where and how to check if game was developed with bought Unity3D licence (not cracked app)? We hired an external team from Eastern country. They built our mobile game app using Unity3d which we paid a lot of $K. We asked them to only use the software with bought license, not cracked one, and they said they will do it.

Now, we're ready to publish apps to official stores and I read on the net that guys from unity3d can always check if the app was made via bought license or via cracked software. If they discover it's been made with cracked software, they will ban the app and probably prosecute us.

Where can we find such tool to confirm that our software was indeed made by 100% licensed unity3d piece of software?

sentences:
Container classes in tile-based games. I've recently begun working on a tile-based tactical game, and I have questions regarding a couple of key moments.

Is it feasible to organize the tilemap as an array of containers, which can hold the game objects? What are the pros and cons of such an approach? Should I make a single container class for all the game objects, such as characters, walls, and terrain, or try to break it down to separate container types for every single game object class?

Any examples of a container capable of storing objects of several different classes will be greatly appreciated.

sentences:
Pitfalls in designing a coop dialog system I like the complex, branching structure of games like visual novels and RPGs like Mass Effect. But I also like multiplayer cooperative games. So I thought, "What if there was a multiplayer dialog system?"

My thoughts on several ways it could work:

At a decision point, all players put in their vote on what to do. Out of the winning side, randomly pick one of the players who actually "speaks" the line.
At a decision point, a player is randomly selected to make the decision for the group.
At a decision point, a player is selected on a cycle to make the decision for the group.
Award the decision to the player with the most relevant skill set (ie. Rogues get the thiefly dialog options)

Clearly this could get complex. But I still want to explore this idea some.

I worry about balance in a few fundamental ways:

one player dominates the choice pool (boring for other players)
the dialog feels forced upon unrelevant players (breaks immersion)
players get the party into big trouble if they pick poor options, even if the majority of the party would choose a better option (tyranny of the minority)
a player most often gets outvoted (tyranny of the majority)

Which of my mechanics suggestions best avoid the pitfalls I mentioned? Or is there a better idea I haven't considered? Please also highlight mechanics that could annoy players.

sentences:
Server-side Architecture for Online Game basically I have a game client that has communicate with a server for almost every action it takes, the game is in Java (using LWJGL) and right now I will start making the server.

The base of the game is normally one client communicating with the server alone, but I will require later on for several clients to work together for some functionalities.

I've already read how authentication server should be sepparated and I intend on doing it.
The problem is I am completely inexperienced in this kind of server-side programming, all I've ever programmed were JSF web applications.

I imagine I'll do socket connections for pretty much every game communication since HTML is very slow, but I still don't really know where to start on my server.

I would appreciate reading material or guidelines on where to start, what architecture should the game server have and maybe some suggestions on frameworks that could help me getting the client-server communication.

I've looked into JNAG but I have no experience with this kind of thing, so I can't really tell if it is a solid and good messaging layer.

Any help is appreciated...
Thanks !

EDIT:

Just a little more information about the game. It is intended to be a very complex game with several functionalities, making some functionalities a "program" inside the program.
It is not an usual game, like FPS or RPG but I intend on having a lot of users using these many different "programs" inside the game.

If I wasn't clear enough, I'd really appreciate people that have already developed games with java client/server architecture, how they communicated, any frameworks, apis, messaging systems, etc.

It is not a question of lack of knowledge of language, more a question for advice, so I don't end up creating something that works, but in the later stages will have to be rewriten for any kind of limiting reason.
PS: sorry if my english is not perfect...

sentences: How can I tell how much of a "scratch card" has been revealed? I have developed scratch card effect.I am now working on reward system, so my question is how will I go on and implement logic which will let me know that the object behind scratch card is now visible??

sentences:
Zoom camera on player I am developing a simple side scrolling game. I want to target and zoom camera on player when he dies. But it rotates the screen, and I want to prevent it. I'm copying the snippet of code here :

IEnumerator ZoomIn()
{
    while (GameCamera.orthographicSize > 2) {
        yield return new WaitForSeconds (0.01f);
        GameCamera.orthographicSize -= 0.2f;
    }
}

public void ZoomCamera()
{
    CameraZoomSource.Play ();
    StartCoroutine (ZoomIn ());
}

public void TargetPlayer()
{
    transform.LookAt (PlayerTransform);
    GameCamera.orthographicSize = 3;
    GameCamera.transform.Rotate (0, 0, -2);
}

Should I change anything in this?

sentences: How to unpause a particular gameobject in unity? Say, I have a GUI Menu attached in a game scene. The game will be in pause state by default. I did it by setting "Time.timescale=0.0f"; I want my game to unpause only when Play button clicked. My question is how to access game scene from the script? And, what I to write on "OnClick" event? Your any suggestion will be highly appreciated. Regards

sentences:
How do I get a Metal texture ID to render to it with Ogre? I looked in the documentation, but I don't know how to get the texture ID.

void* texPtr = SixDegreesSDK_GetBackgroundTexture();
            if (texPtr != nil) {
                id<MTLTexture> mtlTexture = (__bridge id<MTLTexture>)texPtr;

                id<MTLDevice> device = [mtlTexture device];
                // !!! Not fond of creating a new command queue for every texture
                id<MTLCommandQueue> commandQueue = [device newCommandQueue];
                id<MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
                id<MTLBlitCommandEncoder> blitEncoder = [commandBuffer blitCommandEncoder];

                NSUInteger textureWidth = mtlTexture.width;
                NSUInteger textureHeight = mtlTexture.height;
                NSUInteger rowbytes = mtlTexture.bufferBytesPerRow;
                MTLPixelFormat  pixFormat = mtlTexture.pixelFormat;
                CVPixelBufferRef _CVPixelBuffer = NULL;
                NSDictionary* cvBufferProperties = @{
                                                     (__bridge NSString*)kCVPixelBufferOpenGLCompatibilityKey : @YES,
                                                     (__bridge NSString*)kCVPixelBufferMetalCompatibilityKey : @YES,
                                                     };
                CVReturn cvret = CVPixelBufferCreate(kCFAllocatorDefault,
                                                     textureWidth, textureHeight,
                                                     kCVPixelFormatType_32RGBA,
                                                     (__bridge CFDictionaryRef)cvBufferProperties,
                                                     &_CVPixelBuffer);
                const IOSurfaceRef surface  = CVPixelBufferGetIOSurface(_CVPixelBuffer);             // available in ios11 sdk, ios4 runtime

                MTLTextureDescriptor* textureDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixFormat
                                                                                width:textureWidth
                                                                                height:textureHeight
                                                                                mipmapped:NO];
                id<MTLTexture> metalTexture = [device newTextureWithDescriptor:textureDescriptor
                                                                          ioSurface:surface
                                                                              plane:0];

                MTLRegion region = MTLRegionMake2D(0, 0, textureWidth, textureHeight);

                [blitEncoder copyFromTexture:mtlTexture
                                 sourceSlice:0
                                 sourceLevel:0
                                sourceOrigin:region.origin
                                  sourceSize:region.size
                                   toTexture:metalTexture
                            destinationSlice:0
                            destinationLevel:0
                           destinationOrigin:region.origin];

                [blitEncoder endEncoding];
                [commandBuffer commit];
                [self.mEAGLContext texImageIOSurface:surface target:GL_TEXTURE_2D internalFormat:GL_RGBA width:textureWidth height:textureHeight format:GL_RGBA type:GL_UNSIGNED_BYTE plane:0];

sentences:
2D fighting bounding boxes I'm prototyping a 2D platformer/brawler game for uni and I'm having some trouble with creating collision/bounding boxes. This is most likely going to end up on a Vita so I do have some library constraints as well as performance implications.

None of this has yet been implemented but is all theory.

My idea was to have the artist create a sprite sheet for the character animation and then a second identical sprite sheet with the corresponding  collisions in a solid colour (e.g green for where the character can be hit and red for dealing damage, near the foot if kicking etc.)

With this, I would then parse the collision sheet and generate the various collisions required storing them in the character model. This is the point I feel would be most inefficient.

While I think this is a possible solution, I was wondering if there was a more standard way of doing this or a more efficient way as I feel this would have severe performance problems.

sentences:
glTranslate, how exactly does it work? I have some trouble understanding how does glTranslate work.
At first I thought it would just simply add values to axis to do the transformation.

However then I have created two objects that would load bitmaps, one has matrix set to GL_TEXTURE:

public class Background
{
    float[] vertices = new float[]
        { 0f, -1f, 0.0f,
          4f, -1f, 0.0f,
          0f, 1f, 0.0f,
          4f, 1f, 0.0f };

    ....
    private float backgroundScrolled = 0;
    public void scrollBackground(GL10 gl)
    {
        gl.glLoadIdentity();
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glTranslatef(0f, 0f, 0f);
        gl.glPushMatrix();

        gl.glLoadIdentity();
        gl.glMatrixMode(GL10.GL_TEXTURE);
        gl.glTranslatef(backgroundScrolled, 0.0f, 0.0f);
        gl.glPushMatrix();

        this.draw(gl);
        gl.glPopMatrix();

        backgroundScrolled += 0.01f;
        gl.glLoadIdentity();
    }
}

and another to GL_MODELVIEW:

public class Box
{
    float[] vertices = new float[]
        { 0.5f, 0f, 0.0f,
          1f, 0f, 0.0f,
          0.5f, 0.5f, 0.0f,
          1f, 0.5f, 0.0f };

    ....

    private float boxScrolled = 0;
    public void scrollBackground(GL10 gl)
    {
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(0f, 0f, 0f);
        gl.glPushMatrix();

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(boxScrolled, 0.0f, 0.0f);
        gl.glPushMatrix();

        this.draw(gl);
        gl.glPopMatrix();

        boxScrolled+= 0.01f;
        gl.glLoadIdentity();
    }
}

Now they are both drawn in Renderer.OnDraw. However background moves exactly 5 times faster. If I multiply boxScrolled by 5 they will be in sinc and will move together. If I modify backgrounds vertices to be

    float[] vertices = new float[]
        { 1f, -1f, 0.0f,
          0f, -1f, 0.0f,
          1f, 1f, 0.0f,
          0f, 1f, 0.0f };

It will also be in sinc with the box.
So, what is going under glTranslate?

sentences:
Moving objects colliding when using unalligned collision avoidance (steering) I'm having trouble with unaligned collision avoidance for what I think is a rare case. I have set two objects to move towards each other but with a slight offset, so one of the objects is moving slightly upwards, and one of the objects is moving slightly downwards.

In my unaligned collision avoidance steering algorithm I'm finding the points on the object's forward line and the other object's forward line where these two lines are the closest. If these closest points are within a collision avoidance distance, and if the distance between them is smaller than the two radii of the two object's bounding spheres, then the objects should steer away in the appropriate direction.

The problem is that for my case, the closest points on the lines are calculated to be really far away from the actual collision point. This is because the two forward lines for each object are moving away from each other as the objects pass. The problem is that because of this, no steering takes place, and the two objects partially collide.

Does anyone have any suggestions as to how I can correctly calculate the point of collision? Perhaps by somehow taking into account the size of the two objects?

sentences:
DX11 Handle Device removed I get the DXGI_ERROR_DEVICE_REMOVED error on some machines. According to this (https://msdn.microsoft.com/en-us/windows/uwp/gaming/handling-device-lost-scenarios) MSDN article this can happen and it should be handled by your application.

I've managed to recreate the device but I'm unsure how to handle all content. It seems I have to create all vertex buffers and textures again, which essentially means I have to reload almost the entire scene. Is this really the correct way?

sentences:
Bodies are colliding but refusing to rotate in Box2D I'm running box2d in C++ and hooking it up to C# via p/invoke. All physics stuff occurs in C++.

My problem is that bodes know when they are colliding and do so with great precision. However if I have two boxes which are 10x10 units, one located at the origin and is static while another is set 30 units in the sky 4 units across and is dynamic, when the dynamic box falls and hits the static one it stops falling but doesn't turn and slide off the edge.

Here's a screenshot of what I mean:

The box on top is as far to the left as it possibly can be, any further left and it will fall past the box on the bottom. There is barely a pixel overlap that's keeping the top box there. As you can see it's not rotating to fall off.

This also happens (again only the lowest most box is static, the rest fell down a distance to get there),

Any ideas what I'm doing wrong?

My code for creating boxes is as such:

extern "C"
int CreateBox(b2Vec2 dim, b2Vec2 pos, bool dynamic, int worldid)
{
    dim.x /= 100.0f;
    dim.y /= 100.0f;
    pos.x /= 100.0f;
    pos.y /= 100.0f;

    World &g = GetWorld(worldid);
    b2BodyDef bodef;

    bodef.type = b2_staticBody;
    if(dynamic)
    {
        bodef.type = b2_dynamicBody;
    }
    bodef.position = pos;
    bodef.angle = 0;
    b2Body* pBody = g.m_pWorld->CreateBody(&bodef);

    b2PolygonShape groundBox;
    b2Vec2 center = b2Vec2(-dim.x / 2.0f, -dim.y / 2.0f);
    groundBox.SetAsBox(dim.x / 2.0f, dim.y / 2.0f, center, 0);
    for(int i = 0; i < b2_maxPolygonVertices; i++)
    {
        b2Vec2 vert = groundBox.m_vertices[i];
        vert.x += dim.x / 2.0f;
        vert.y += dim.y / 2.0f;
        groundBox.m_vertices[i] = vert;
    }

    b2FixtureDef fixtureDef;
    fixtureDef.shape = &groundBox;
    pBody->CreateFixture(&fixtureDef);
    //fixtureDef.density = 10;

    pBody->SetUserData((void*)++g.m_actorid);

    g.m_bodies.push_back(pBody);

    if(dynamic)
    {
     //   pBody->SetAngularVelocity(0.5f);
    }

    return g.m_actorid;
}

and I create the boxes in C# like so:

m_worldid = CreateWorld(ToB2(new Vector2(0, -1.8f)));

m_boxID1 = CreateBox(ToB2(new Vector2(50, 50)), ToB2(new Vector2(-51,300)), true, m_worldid);
m_boxID2 = CreateBox(ToB2(new Vector2(50, 50)), ToB2(new Vector2(0,0)), false, m_worldid);

Using the box ids I grab positions and rotations from the C++ code (and the get functions take into account that I've /= 100 the dimensions), it all works fine on that front, code here for those interested:

extern "C"
ActorTransform BodyTransform(int bodyid, int worldid)
{
    World &g = GetWorld(worldid);

    for(int i = 0; i < g.m_bodies.size(); i++)
    {
        if( (int)g.m_bodies[i]->GetUserData() == bodyid)
        {
            ActorTransform c;
            c.Position = g.m_bodies[i]->GetPosition();
            c.Rotation = g.m_bodies[i]->GetAngle();
            c.Position *= 100.0f;

            return c;
        }
    }
}

Another interesting thing to note is if I set an angular velocity on the box it actually is physically represented on screen and it can cause the box to fall off, setting rotatens on bodes also seems to work.

Actually continuing on from setting angular velocities. I found that if I set an angular velocity just once the velocity doesn't go away, even after it lands on the static box it continues to rotate as if it were a motor or something. I'm guessing this has something to do with my core problem since bodies aren't meant to maintain an angular velocity that was set on them just once..

so any ideas?

sentences: GtkRadiant to unity? i just chose unity as my game engine an i don't like the level editor, and i really enjoy gtkradiant, its really easy and fun to use. I was wondering if someone knows a way i can use my gtkradiant levels in unity, since i know gtkradiant is meant for id tech 3, but i heard there is some way you can import your radiant levels to unity, does anyone know how? also, if you guys dont know how, can you please tell me how to get id tech 3? i would enjoy using that engine knowing how great the graphics can be if you mod it the right way.

sentences:
How can I create a fast, real-time, fixed length glowing ray? Similar to the disintegrate skill in Diablo 3. It should not light other objects in scene. Just glowing and animated. Like in this video http://www.youtube.com/watch?v=D_c4x6aQAG8.

Should I use pack of pre-computed glow sources textures for each frame of ray animation like in this article http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html and put it in bloom shader?

Is there any other efficient ways to achive this effect? I'm using OpenGL ES 2.0.

sentences:
Create a physics body with hole : bullet physics I am writing an iOS game, using bullet for physics, blender to create models, cocos3d as the game engine.

I have a model like this

Basically there is a plane, with a hole, and a UVSphere. Both were created in blender. What I am trying is to create a physics body along the vertices of the plane. So that when the UVSphere goes over the hole, it should fall through.

I am using btBvhTriangleMeshShape to create physics body along the vertices of this plane. code is given below

//GPlane stands for groundPlane :)
CC3MeshNode* gPlaneNode  = (CC3MeshNode*)[self getNodeNamed:@"GPlane"];

/*Get Vertex and indices data out from the .pod*/
float *gVertexData       = (float*)((CC3VertexArrayMesh*)gPlaneNode.mesh)
                                .vertexLocations.vertices;
GLushort* gIndices       = (GLushort*)((CC3VertexArrayMesh*)gPlaneNode.mesh)
                                .vertexIndices.vertices;
int gIndiceCount         = ((CC3VertexArrayMesh*)gPlaneNode.mesh)
                                .vertexIndices.vertexCount;

/*Create triangle mesh*/
btTriangleMesh* gTriangleMesh = new btTriangleMesh();
for (int i = 0; i < gIndiceCount; i+=3)
{
   unsigned int index1 = gIndices[i] * 6;
   unsigned int index2 = gIndices[i+1] * 6;
   unsigned int index3 = gIndices[i+2] * 6;
   gTriangleMesh->addTriangle(
      btVector3(gVertexData[index1] , gVertexData[index1+1], gVertexData[index1+2]),
      btVector3(gVertexData[index2] , gVertexData[index2+1], gVertexData[index2+2] ),
      btVector3(gVertexData[index3] , gVertexData[index3+1], gVertexData[index3+2]));
}

/*Create  a rigid body using this triangle mesh*/
btBvhTriangleMeshShape *gTriMeshShape   =   new
                          btBvhTriangleMeshShape(gTriangleMesh,true);
gTriMeshShape->setMargin(0.1);
btDefaultMotionState *groundMotionState =
                new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1)
                                           ,btVector3(0,0.0,0)));
btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0
                   ,groundMotionState,gTriMeshShape,btVector3(0,0,0.0));
groundRigidBodyCI.m_restitution = 0.3;
btRigidBody *groundRigidBody = new btRigidBody(groundRigidBodyCI);
dynamicsWorld->addRigidBody(groundRigidBody);

And I am adding the sphere to the scene like this

sphereNode    =   (CC3MeshNode*)[self getNodeNamed:@"Sphere"];
btCollisionShape *fallShape = new btSphereShape(1);
btDefaultMotionState *fallMotionState = new btDefaultMotionState(btTransform(
           btQuaternion(sphereNode.location.x,sphereNode.location.y
              ,sphereNode.location.z,1), btVector3(0,0,0)));
btScalar mass = 1.0;
btVector3 fallInertia(0,0,0);
fallShape->calculateLocalInertia(mass, fallInertia);
btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass
                      ,fallMotionState,fallShape,fallInertia);
fallRigidBodyCI.m_restitution = 1.0;
fallRigidBody = new btRigidBody(fallRigidBodyCI);
fallRigidBody->setDamping(0.3,0.8);
dynamicsWorld->addRigidBody(fallRigidBody);

To view the physics body, I use bullet physics debug drawing method and this is how it is drawn

As far as I can tell, physics body looks fine, the hole is there alright.

My problem

It is simple. My ball just slide over the hold instead of falling through it. I expect with a mass and negative Y gravity, the ball to fall through the hole.

Ball is falling of the edge of the plane alright. So gravity is there.

Any idea?

sentences:
Best way to play footstep-sounds of character? I am developing an XNA-Game, which is pretty much a runner game (side-scrolling).

Now I am in the middle of adding sounds to my game. And as it turns out, I am having quite some problems with the footstep-playback.

The following is in C#, but I am quite sure that anyone will understand it:

 public static void StartStepTimer()
 {
     _stepTimer = new DispatcherTimer();
     _stepTimer.Interval += TimeSpan.FromMilliseconds(500);
     _stepTimer.Tick += _stepTimer_Tick;
     _stepTimer.Start();

     _step = _content.Load<SoundEffect>("Sound\\World\\Summer_1");
     _stepInstance = _step.CreateInstance();
     _stepInstance.Volume = 0.4f;

 }

  private static void _stepTimer_Tick(object sender, EventArgs e)
  {
      _stepInstance.Play();
  }

As you can see, I am playing the footstep based on a timer. I am using this method, since the gamespeed gets higher during gametime (I can change the interval in that case).

But this method isn't really working. The playback lags.
I thought of making a prerendered 10s soundfile and looping that in gametime, but than the playback won't fit when the gamespeed rises.

Any suggestions?

sentences:
How can I make my Camera's RenderTexture output have a transparent background? I'm writing a 3D game using Unity 2017.1.0b1.  I have a disabled Camera that takes a "snapshot" of the current scene and stores it in a RenderTexture when a button is clicked.  I then display the RenderTexture in a RawImage within my scene.

This works, except that the output from the Camera into the RenderTexture doesn't take into account the alpha value of the Camera's clear color.

Here's a snapshot of how my disabled Camera is configured.  Notice the Background property has an alpha value of 0:

Here's a snapshot of what the RenderTexture (displayed using a RawImage) looks like in the game.  The blue square is the RenderTexture:

How can I make the Camera render into the RenderTexture with a transparent background?  I didn't expect the blue background to show up in the RenderTexture since its alpha value is 0.

sentences:
How to render a field of view of over 180 degrees? In most 3D renderings, a view frustum is used.
This has the problem, that things get stretched out towards the edges.
At "normal" fov (field of view) of about 60 degrees, the effect is not very noticeable, unless compared side by side (example) but at a higher fov of something like 120 degrees it's really noticeable by making things near the edge look way larger/closer (example).
A fov of anything near or over 180 degrees breaks the rendering completely.
So far, I couldn't find anything on how to render in such a way that fixes this or even how it's called.
The ultimate goal would be to be able to render up to 360 degrees (ignoring the hardware needed, to display it) without any distortion, relative to other parts of the image.
So, how would I approach rendering that? Is there already some open source software, I can take a look at?

sentences:
Debug Render In Cocos2d Android I want to implement debug render for cocos2d android.So I can view how bodies are created.
Right now I use gdx.jar file for box2d and load that jar file following way.

static {
      System.loadLibrary("gdx.jar");
}

All the desire bodies are created but I need box2d debug renderer. I have search many place for this question but I could not found anything. So please anybody has knowledge regarding this then suggest me.

sentences:
Dynamic thruster balancing of space ship The space ships in my game a meant to be player-built with an arbitrary amount of thrusters attached anywhere with any rotation. I currently have some dirty code to rotate the ship to a given angle (accelerating and decelerating).

Here's an example of a symmetrical ship facing where the red line points, being told to rotate left.

However, as you would imagine, depending on where the player has put the thrusters, sometimes undesired linear forces are affecting the ship. In this case, the ship starts moving forward.

I'm elaborating on whether it's possible to find the maximum thrust a thruster can apply to cause no linear velocity. (In the above case that would be none since there's nothing to counteract the forces from the rear thrusters, and the front ones kill eachother).

What I've come up with so far is a formula to determinate the "turn efficiency" e.g. how much rotation is caused in relation to linear movement.

a - position vector to thruster a
b - position vector to thruster b
v1 - force from thruster a
v2 - force from thruster b

efficiencyDelta = a.cross(v1) / |v1|  -  ( a.cross(v1) + b.cross(v2) ) / |v1 + v2|

, basically "a.cross(v1 * t) / |v1|" is supposed to be the turn efficiency. And then we subtract it by the turn efficiency of the thrusters combined, to see if firing the new thruster is worth it.

Problem arises when I realize that thrusters aren't surposed to be on/off, but can vary their thrust from 0 to 1. And how to go about when the player wants the ship to go forward. Ofcourse, there would need to be a balance of how much to rotate/move.

I'm no rocket scientist so I'm hoping there's someone who can tell me if it's even possible to calculate the throttle of each thruster this way and give me a push in the right direction.

Thank you for taking the time! / Kim

sentences:
Multiplayer oriented game engine object (C++) for a personal project i started making a 2d game engine in C++ that uses sfml. The idea is having base "game object" classes from which a game will inherit.

Right now i have:

Game_engine class which has a run method that takes care of the game loop (fixed timestep loop). The loop consists in:

dequeuing SFML window events
step

dequeue networking events
call step function for each Object instance

draw

call draw update function for each Object instance
call draw function for each Object instance

Resource_manager class which takes care about loading and holding resources and holding animations.

Animation and Animated_sprite, where animation exists only once per animation, has a pointer to the texture and a list of the frames, while animated sprite is a child of sf::Sprite and there's one instance per each instance of a game object. Animated sprite points to its animation and frames are updated when Object's draw_update is called.

Logger class, which queues up strings from the engine thread and uses a second thread to write the strings to file without the main thread suffering from write-to-disk delay

Networking_client class, which queues up networking packets in a secondary thread, and returns the queue to the Game_engine when it requires it for the networking part of the step.

Object class which is the basis on which an actual game's objects will be built. It has by default vertical and horizontal speed variables, and function to set them both as vertical and horizontal components or as speed and direction. It has both a sprite with its coordinates and its own coordinates. Sprite's coordinates are used by sfml to draw and will be updated with interpolation when draw_update is called. The own coordinates are updated when the step function is called, which in an actual game will take care of checking collisions and stuff like that.

Up until that point i really did everything kinda by instinct, but now i don't know how to design networking managed objects.
Ideally i would have a server which runs the game without the drawing part, only the fixed steps, and holds information about all connected clients. My issues are not about lag compensation right now, but about how to deal with these classes.

When i shoot on my client, i would tell the server i shot, the server creates a projectile and its creation is sent to all clients together with an id that identifies the networking object for future updates (changes in direction, destruction). However this adds a delay in the client when it's shooting its own projectile. If i create the projectile in the client first and tell the server about its creation, the client can cheat about its coordinates. If i create the projectile individually in both, once the client receives the information "create projectile" from the server it can't tell it's its own already existing projectile and not someones else's.
Same issue when a client is changing it's controlled object's direction...

Can i get help designing that? I did something like that in javascript (without lag compensation it was a teleporting fest) but idk i'm finding it harder to design now, because i'm making it more generic, while my javascript project was directly with the actual game objects.

Before anyone tells something like "use an existing engine", part of my interest is actual making my own, after all it's an hobby and i'll likely never publish any game with that, i just enjoy writing such things and overcomplicating my life in a way that ends in never having any concrete result whatsoever.

sentences:
Calculate ticks for animation delay Hi guys I am trying to calculate the correct elapsedTime for each frame in my animation.

Example I have a sprite called stance that has 20 frames I want to give each frame a tick delay property that determines how long that frame will last until next frame.

the question is how do I use the gameTime.elapsedTime to calculate the current elapsedTicks say for example the first frame has 20 ticks then

currentElapsedTicks += gameTime.ElapsedTime.Ticks?

sentences:
How does the use of marching square and wave function collapse differ in a auto tiling? I am discovering the techniques of procedural generation.
I struggle understanding on the usage of those two techniques:

Wave Function Collapse
Marching Squares

As I understand, both can be used to populate neighbourhood of a tile based on rules.

In the case of a game map editor where a user can "paint" a dungeon. When would you use one versus the other?

sentences:
Why does 'SpriteRenderer.drawMode' virtually change from Tiled to Simple when 'SpriteRenderer.size' exceeds some value? Given:

texture size = 225x225

2D sprite object;
SpriteRenderer.drawMode = SpriteDrawMode.Tiled;

Now if SpriteRenderer.size is changed to 286x286 the sprite is rendered as if its drawMode were Simple (no tiling):

If SpriteRenderer.size is reduced to 285x285 it is rendered again as expected (tiled):

Specific SpriteRenderer.size values after which it stops rendering in the Tiled mode depend on the texture size, so if you try it with a different texture the SpriteRenderer.size limit will be different from 286x286 as well.

Why it happens?
I can only guess that there some technical limitations related to the texture size that I am not aware of.

sentences:
Game states affecting each other's objects If I had given this question any other title it would have immediately looked like a dupe of this one. Although that has some nice ideas none of the answers actually address what I need.

I'm refactoring my game state system a bit. I already have a stack system, not to share data, but so you can leave a pause menu and return to gameplay as it was. There is also a transition type that clears the stack completely, so you can go from the title, to a menu, to in game, and those aren't stacked on each other.

I have three big state types (handlers) right now: gameplay, menus, and cutscenes. The latter two have a lot in common so they share a base class. I'm stuck right now because of how they handle entities (gameplay objects), which all three can use.

Many games have cutscenes that don't leave gameplay, they just take control and start puppeteering the characters currently on the screen. My handlers currently have their entities separate from each other, and there's no data sharing. The only affect they can have on each other is deciding whether the previous one should keep updating / drawing or not. I need to refactor things so that I can support that kind of cutscene when it's pushed on top of the gameplay state.

How should I organize my states so that they can share entities?
I'm considering splitting my handlers in half, one side to hold objects, the other for logic to manipulate those. Then I could mix and match them, or just swap one logic for another without changing out the data. Will this work? Maybe another approach is better.

Again, I know this sounds a lot like the other question but those answers were either things I'm already doing or didn't match my situation.

sentences: Modifying UV's origin on shader (OpenGL) Is there a way to change the UV's origin (bottom-left) on shader?

sentences:
Player won't move correctly due to gravity force pushing him into the ground I am making a tilemap platformer with pygame ad I defined the X and Y movement for the player and also a Y force that represents the gravity force to make it jump correctly. However, when my player falls off to the ground and the game begins, it doesn't move correctly neither to the right nor to the left direction due to the gravity force that keeps pushing him to the down. In addition to that, when the player jumps and i move it to the right, it's like it doesn't recognize the collision with the bottom rect of the wall (see gif below for a visual explanation of that).

I tried disabling that gravity force when the player hits the ground and enable it when the player jumps but it didn't work as expected and I've got problems managing collisions (also, it doesn't make sense to disable gravity, right?)

Here's a gif of the issue i'm facing with:

Here's my Player class:

class Player(pg.sprite.Sprite):
    def init(self, game, x, y):
        self.groups = game.sprites
        pg.sprite.Sprite.init(self, self.groups)

    self.game = game

    self.image = pg.Surface((TILESIZE, TILESIZE))
    self.image.fill(GREEN)
    self.rect = self.image.get_rect()

    self.move_left = self.move_right = False

    self.pos = pg.math.Vector2(x, y)
    self.acc = pg.math.Vector2(0, GRAVITY)
    self.vel = pg.math.Vector2(0, 0)

def jump(self):
    self.vel.y -= 3

def update(self):
    self.vel.x = 0

    if self.move_left:
        self.vel.x = -PLAYER_SPEED
    if self.move_right:
        self.vel.x = PLAYER_SPEED

    self.vel += self.acc

    self.pos += self.vel
    self.rect.x = self.pos.x * TILESIZE
    self.rect.y = self.pos.y * TILESIZE

    if self.vel.y > 0.5:
        self.vel.y = 0.5

    hits = pg.sprite.spritecollide(self, self.game.walls, False)
    if hits:
        if self.vel.x > 0:
            self.pos -= self.vel
            self.rect.right = hits[0].rect.left
            self.vel.x = 0
        if self.vel.x < 0:
            self.pos -= self.vel
            self.rect.left = hits[0].rect.right
            self.vel.x = 0

    hits = pg.sprite.spritecollide(self, self.game.walls, False)
    if hits:
        if self.vel.y > 0:
            self.pos -= self.vel
            self.rect.bottom = hits[0].rect.top
            self.vel.y = 0
        if self.vel.y < 0:
            self.pos -= self.vel
            self.rect.top = hits[0].rect.bottom
            self.vel.y = 0

sentences:
Why does my first person camera attached to a rigid body vibrates? I'm trying to make a first-person character with a rigid body. I need a rigid body because I want to add areas where the gravity comes from different directions so I also need to rotate the character accordingly. And as far as I know you cant rotate a character controller.

So I wrote a script for movement and camera rotation.

The problem I now face is that the camera vibrates. I recorded this video to show it.

Why do I get this and how do I fix this?

Movement code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovementRigidBody : MonoBehaviour
{
    public float speed = 10.0f;
    public Rigidbody rb;
    public LayerMask groundLayers;

    public float jumpForce = 7;
    public CapsuleCollider col;

    float transelation;
    float straffe;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        rb = this.GetComponent<Rigidbody>();
        col = GetComponent<CapsuleCollider>();
    }

    // Update is called once per frame
    void Update()
    {
        transelation = Input.GetAxis("Vertical") * speed;
        straffe = Input.GetAxis("Horizontal") * speed;
        bool jumping = Input.GetKeyDown(KeyCode.Space);

        transelation *= Time.smoothDeltaTime;
        straffe *= Time.smoothDeltaTime;

        /*if (IsGrounded())
        {
            rb.useGravity = false;
        }
        else
        {
            rb.useGravity = true;
        }*/

        if (IsGrounded() && Input.GetKeyDown(KeyCode.Space))
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }

        if (Input.GetKeyDown("escape"))
        {
            Cursor.lockState = CursorLockMode.None;
        }

    }

    void FixedUpdate()
    {
        transform.Translate(straffe, 0, transelation);
    }

    private bool IsGrounded()
    {
        return Physics.CheckCapsule(col.bounds.center, new Vector3(col.bounds.center.x, col.bounds.min.y, col.bounds.center.z), col.radius * .9f, groundLayers);
    }
}

Mouse look code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseLookRigidBody : MonoBehaviour
{
    public float mouseSensitivity = 100f;

    public Transform playerBody;

    Rigidbody rig;

    float xRotation = 0f;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        rig = this.transform.parent.gameObject.GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    public void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);

    }
}

sentences:
How to make obstacles spawn randomly but still leave a way for player to pass? I'm trying to make a game like Crossy Road:

In this game, you control the character(the frog in this case) to go across the streets, and you have to prevent your character from being hit by a car.

There are also  "footpaths". On the footpaths there are trees act as stationary obstacles and you can't go through them.

I tried to make a similar game but I have a problem:

The obstacles prevent the player from getting further. What can I do to make sure that the player always has at least one way to pass through?

sentences:
Texturing (or seeing through) the back of a plane I've got a basic textured quad forming a plane. When I move the camera or rotate the plane to see the back of it, there is no texture there.

The effect I want is as if the plane were a clear piece of glass, so that I'd be seeing the texture from through the other side. I was hoping this was going to happen automagically. Is there an easy way to accomplish such a thing, or am I going to have to manually flip the texture and assign it to the back?

Thanks!

sentences: How can I apply steering behaviors to a car controlled with turning and acceleration? I feel like I've got my head around steering behaviors,  but I've having trouble applying them to a car. The steering behaviors return forces that one could apply to an object that can move in any direction, but a car can essentially only move forward and turn. I'm having trouble determining how hard the car should turn or how much it should accelerate forward based on the steering force. How can I translate a steering force into the car's input?

sentences:
Three js raycaster WITHOUT camera I seem to find only examples to use the raycaster with the camera, but none that just have a raycaster from Point A to Point B.

I have a working raycaster, it retrieves my Helpers, Lines etc. but it seems it does not recognize my sphere.

My first thought was my points are off, so i decided to create a line from my pointA to my pointB with a direction like so:

var pointA = new Vector3( 50, 0, 0 );
var direction = new Vector3( 0, 1, 0 );
direction.normalize();
var distance = 100;

var pointB = new Vector3();
pointB.addVectors ( pointA, direction.multiplyScalar( distance ) );

var geometry = new Geometry();
geometry.vertices.push( pointA );
geometry.vertices.push( pointB );
var material = new LineBasicMaterial( { color : 0xff0000 } );

var line = new Line( geometry, material );

This will show a line from my point (50 0 0) to (50 100 0) right trough my sphere which is at point (50, 50, 0) so my pointA and direction values are correct.

Next i add a raycaster:
To avoid conflicts with any side effects i recreated my points here:

var raycaster = new Raycaster(new Vector3( 50, 0, 0 ), new Vector3( 0, 1, 0 ).normalize());
var intersects = raycaster.intersectObject(target);
console.log(intersects);

Seems pretty straight forward to me, i also tried to use raycaster.intersectObjects(scene.children) but it gives Lines, helpers etc. but not my sphere.

What am i doing wrong? I am surely missing something here.

IMG of the line and the sphere:

sentences:
Change from Bullet/OgreAnim to Havok? I have been working on a game in Ogre for the last 6 months or so. It started as a learning project, and after a few rewrites it actually turned into a real game project. Physics scared me, and using Bullet with its lack of documentation was a nightmare, but I was able to atleast get some basics added and learned a lot. So as of now I am using Ogre with its default animation system (fairly basic) and Bullet Physics.

I had always wanted to use Havok when I started out, but due to lack of integration information on the Ogre forums, and lack of tutorials on the net, I decided against it. Now that I am actually at the point where Bullet is just too much of a headache to proceed with (staring at forum threads praying someone answers) and the Ogre animation system is so basic, I am considering switching to Havok for Physics and Animation.

The Physics system looks extremely polished and easy to use. The animation system looks incredible with the retargeting/blending/etc. The documentation is incredibly detailed as well (I guess when you come from Bullet, any documentation looks amazing)

So my question is, as I am still somewhat of a 'newbie' to game development, should I just stick with what I am using now or should I make the switch over to Havok? The physics looks like I could get my project back to where it is now with minimal effort, and be able to expand much faster. The animation aspect looks extremely daunting as far as integrating it with Ogre.

sentences: How can I edit collisions in Unreal Engine? I made a concave house model. When I import it to Unreal Engine it generates a simple box collision that covers the full mesh. I need a collision that only covers the walls. How can I generate one or edit the collision? (I'm using Maya.)

sentences:
How to disable present function when window is invisible to user. Win32 & DXGI When my game window is hidden say by minimising it or hitting Ctrl, Alt, Del. I get the DXGI error:
0x087A0001 : The Present operation was invisible to the user.
I've tried wrapping the present function inside an if statement to check whether the window is visible, this comes from: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-iswindowvisible
And looks like this in my code:
bool Graphics::WindowVisible() const
{
    if (IsWindowVisible(hWnd) == TRUE)
    {
        return true;
    }
    return false;
}

I've created the function in my window object too, and applied it to my EndFrame() call but this doesn't work either.
The function never seems to return false. Any ideas on the best way forward would be gratefully received. If using a check for visibility isn't on the cards, Is there a way to simply disregard the DXGI error and simply throw the frame away and would that be a good idea.

sentences:
Is it possible to have a fixed camera without a CameraSubject? I have created a very simple script to set up a fixed camera with no subject.  In other words, I want a camera in a static position looking down at the world (a top-down style camera that doesn't follow anything), but regardless of what I do, the camera always attaches to a "Humanoid".

Is there a way to prevent this?

For reference, here is my script, which I name CameraScript and place in the StarterPlayerScripts group:

local cameraHeight = 150

local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer

repeat
        wait()
until player.Character

local function setupCamera()
    camera.CameraType = Enum.CameraType.Fixed
    camera.CameraSubject = nil
    camera.CFrame = CFrame.new(Vector3.new(0,cameraHeight,0), Vector3.new(0,0,0))
    print(tostring(camera.CameraSubject))
end

setupCamera()

sentences:
Detecting Units on a Grid I am making a little turn based strategy game in pygame, that uses a grid system as the main map to hold all the characters and the map layout. (Similar to Fire Emblem, or Advance Wars)

I am trying to determine a way to quickly and efficiently (i.e. without too much of a slow down) check if there are any characters within a given range of the currently selected character.

So to illustrate:

O = currently selected character
X = squares within range

Range of 1:

    X
  X O X
    X

Range of 2:

     X
   X X X
 X X O X X
   X X X
     X

Range of 3:

      X
    X X X
  X X X X X
X X X O X X X
  X X X X X
    X X X
      X

Now I have to tell the user who is in range, and I have to let the user choose who to attack if there are multiple enemies in range.

If I have a 5x5 grid, filled with " " for empty and numbers for the characters:

[ ][ ][ ][ ][4]
[ ][1][ ][ ][ ]
[ ][ ][ ][ ][ ]
[ ][ ][2][3][ ]
[ ][ ][ ][ ][ ]

Depending on which character the user selects, I would like to show the user which other characters are in range. So if they all had a range of 3:

1 can hit 2
2 can hit 1 or 3
3 can hit 2
4 cannot hit anyone.

So, How do I quickly and/or efficiently run though my grid and tell the user where the enemies are?

PS- As a bonus, if someone could give an answer that could also work for a minimum distance type range, I would give them a pat on the back and a high five, should they ever travel to Canada and we ever meet in life.

For example:
Range of 3 to 5: (- is out of range)

          X
        X X X
      X X X X X
    X X X - X X X
  X X X - - - X X X
X X X - - O - - X X X
  X X X - - - X X X
    X X X - X X X
      X X X X X
        X X X
          X

sentences:
Enemy clones don't target player In a small game that I'm making enemies multiply when you kill them, however when clones are instantiated they don't chase the player like the original prefabs do (example: http://gfycat.com/VastActualElver)

Here is relevant part of my code:

 #pragma strict
    var moveSpeed : int = 3;

    var player : Transform;
    var MaxDist = 10;
    var MinDist = 1;

    function Update () {
        if(curhealth <= 0){
            Dead();
        }
        transform.LookAt(player);
        if(Vector3.Distance(transform.position, player.position) >= MinDist){
            transform.position += transform.forward * moveSpeed * Time.deltaTime;
        }
    }

function Dead () {
    Destroy(gameObject);
    var posx = Random.Range(-10, 10);
    var posz = Random.Range(-10, 10);
    Instantiate(enemys, Vector3(posx, 0.5, posz), transform.rotation);
}

What am I missing?

sentences:
Collision Detection doesnt work because some things move more than 1px at a time I'm writing a 2d scrolling game in javascript using canvas and since I'm limited to setInterval running at minimum once every ms, I need to have some objects moving at greater than 1 pixel a second. I have this for collision detection between objects:

// ** oversee collisions
collisionsInterval = setInterval(function() {

    // outter object
    for(i = 0; i < objectsToCollision.length; i++) {

        // inner object
        for(j = 0; j < objectsToCollision.length; j++) {

            // dont compare an object to itself
            if(i==j) continue;

            // check if they touch on x axis
            if(Math.abs(objectsToCollision[i].centerX - objectsToCollision[j].centerX) <= (objectsToCollision[i].halfWidth + objectsToCollision[j].halfWidth)) {

                // check if they touch on y axis
                if(Math.abs(objectsToCollision[i].centerY - objectsToCollision[j].centerY) <= (objectsToCollision[i].halfHeight + objectsToCollision[j].halfHeight)) {

                    // a collision was detected, do something useful
                    alert();

                }

            }

        }

    }
}, 1);

The problem is, since it wont alert() when two things are about to touch because my objects move at more than 1px at a time. The problem is, some objects might move 3px at a time, some might move at 8px at a time, and I also have gravity occurring so in the Y direction especially the velocity of my objects will really vary.

In my code above objectsToCollision is an array which contains all the objects I'm checking for collisions with. I've modelled what I've done so far after this https://gamedev.stackexchange.com/a/587 but it doesn't discuss how to solve the problem I'm experiencing!

sentences:
How to justify text that appears character-by-character I'm currently using the latest version of phaser framework and I have a problem to which I haven't been able to figure out how to approach.
I need to have a block of text appear letter by letter and also be justified as a block.
(I'm working on a text-based game project).
Text typed letter by letter is functional, but my issue is with justification: it has issues like some words first appearing on a line and then being removed and placed in the next line.
This is my code so far:
    addTextParagraph(text) {
    //  We check the current GAME STATE.
    //  During exploration (SCOUTING_STATE), text is in typewriter mode.
    if (gameState === SCOUTING_STATE) {
      this.typewriteText(text);
    }
  }

  typewriteText(text) {
    let delayedCallback;
    let length = text.length;
    let i = 0;

    this.time.addEvent({
      callback: () => {
        this.textParagraph.text += text[i]
          ++i
        // Callback after typewriter text is complete.
        // Delay before the choices appear in the screen (in ms)
        if (i >= length) {
          i = 0;
          delayedCallback = this.time.delayedCall(200, this.addChoiceArray, [], this);
        }
      },
      repeat: length - 1,
      delay: 40,
    })
  }

Thanks.

sentences:
View Matrix to Texture Matrix I'm converting view coordinates to texture coordinates for both my shadow maps and Screen space reflections.
I keep seeing this conversion in examples:

            var T = new Matrix
            {
                M11 = 0.5f,
                M22 = -0.5f,
                M33 = 1.0f,
                M41 = 0.5f,
                M42 = 0.5f,
                M44 = 1.0f
            };

            Matrix m = view * projection * T;

What is T and why does this "work"? I'm saying "work" because I not satisfied with the result but the problem may not lie here.

I would like to use and inverted view and projection and then adjust the coordinates from -1,1 to 0,1. But that doesn't work at all.
What have I misunderstood?

sentences:
When creating a game engine, how should I define the position of objects? I'm building a custom game engine, in C++ using SDL, and I'm not sure how I should define the position of my game objects. I tried googling a bit, but I wasn't sure how to refine my search terms to get what I'm looking for.

Should I define the position (x, y) of my object to be the top left of the object, for ease of rendering? Since my game is tile based, it also makes sense to have the position of the tiles as the top left position.

Perhaps I should define it to be the center of the object, which seems to make more sense, logically? If we use width/2 and height/2 to calculate it, does the slightly-truncated integer for even-sized objects matter?

How do other games do this? Right now, my objects are defined by the top left corner, and it's annoying to do operations that find the center of the object.

sentences:
Help designing Board game using LibGDX Hi i'd just like to preface this by saying i'm new to game development and currently learning the ins and outs of libGDX.

I want to create the board game scrabble however i'm having trouble figuring out how i would display the board and the pieces each player has.

So in my game the board will probably be 14x14 , each player (4 maximum) at the start of the game will have about 6 letter tiles in their hand. The player whos turn it is , is able to place letter tiles from their hand onto the board and do so until a word is spelt on the board. The player should also be able to pick up individual letter tiles that they have placed down.

From searching on the internet I figured out that i should probably make the board a 2d array of either actors or buttons. For example, the player would click on the letter tile and then click on the board and the tile would be placed. However, as there is limited information online about libGDX in the form of tutorials I do not have a complete solid understanding of this. If anyone could help me understand how I would go about implementing my ideas i'd really appreciate it.

sentences:
Fastest way to look up an entity with a set of components? I'm currently trying to implement an ECS system, but I've sort of ran into a problem trying to fetch all of my entities that have a specific set of components. I currently have a Dictionary that maps a component name to a list of Guids (entities), so I have no problem fetching a list of entities if I were to query for just one component. But if I were to query entities for more than one component (e.g. all entities that have Render and Transform component), I run into a problem where it's no longer a constant time lookup.

I could probably loop through the entities to see if they contain that set of component names (they are stored in a dictionary that maps Guid to a list of strings), but I was thinking that there could be a faster way of doing this?

sentences:
Fire Emblem/Advance Wars/Turn Based Strategy like Artificial Intelligence I have made a Fire Emblem/Advance Wars like game, and I was wondering if there are any particular techniques in the AI's in those games.

I was wondering how to let the AI make the best decisions. I have the tiles a unit can move to, I have the enemy unit positions and I have formulas to calculate battle outcomes, now I want to add those together so that, for example, the AI attacks the weakest unit, blocks a chokepoint or just moves closer to the enemy if nobody is in range.

What is the best approach to this?

sentences:
Input of mouseclick not always registered in XNA Update method I have a problem that not all inputs of my mouse events seem to be registered.
The update logic is checking a 2 dimensional array of 10x10 .
It's logic for a jewel matching game.
So when i switch my jewel I can't click on another jewel for like half a second.
I tested it with a click counter variable and it doesn't hit the debugger when i click the second time after the jewel switch. Only if I do the second click after waiting half a second longer.
Could it be that the update logic is too heavy that while he is executing update logic my click is happening and he doesn't register it?

What am I not seeing here :)? Or doing wrong. It is my first game.

UPDATE :
I changed to Variable time step, then i saw after the reindex of my jewels (so after the switch) i see the elapsedgametime was 380ms. So I guess that is why he doesn't catch the short "Press" of my mouseclick because update method is still busy with executing the reindexing code. Anyone knows how I can deal with this .. Or do I have to start using threads because my update of reindex takes too long?

SOLVED :
The problem was that in my reindexing code I got out of bound exceptions which I catched and then continued. That catching of exceptions caused a massive lag each time a reindex happened. Now everything runs smoothly and I do not have to worry about a slow Update. But I'm still asking the question.. what should you do If you have really heave update logic where the time to process the logic takes almost a 0.5 second? I guess you need to execute your game logic in multiple threads to reduce the update time? I'm also thinking i'll never have to worry about this for a jewels game :p. It's more for a problem for a heavy physics game with alot of game objects ?

My function of the update methode looks like this.

 public void UpdateBoard()
        {
            currentMouseState = Mouse.GetState();
            if (currentMouseState.LeftButton == ButtonState.Pressed &&
                prevMouseState.LeftButton != ButtonState.Pressed)
            {
                debugCount++;
                if (debugCount == 3)
                {
                    int a = 4;
                }

                leftButtonPressed = true;
            }
            if (this.IsBoardActive() == false)
            {
                UpdatingLogic = true;
                if (leftButtonPressed == true)
                {
                    // this.CheckDropJewels(currentMouseState);
                    this.CheckForSwitch(currentMouseState);
                    if (SwitchFound == true)
                    {
                        reIndexSwitchedJewels = true;
                    }
                    this.MarkJewel(currentMouseState);
                }
                if (CheckForMatches == true)
                {
                    if (this.CheckMatches(5) == true)
                    {
                        this.RemoveMatches();
                        reIndexMissingJewels = true;
                    }
                    else
                    {
                        CheckForMatches = false;
                    }
                }

                UpdatingLogic = false;
                if (currentMouseState.RightButton == ButtonState.Pressed &&
                    prevMouseState.RightButton != ButtonState.Pressed)
                {
                    this.CheckMatches(5);
                }

                this.ReIndex();
                leftButtonPressed = false;
            }

            prevMouseState = currentMouseState;
            this.UpdateJewels();

        }

sentences:
File saved to IndexedDB lost unless we change scenes Our game includes an in-game level editor. When the user saves a custom level, the level is serialized and written to a file:
public void SaveFile<T>(T obj, string path) {
    if (!typeof(T).IsSerializable) {
        throw new ArgumentException("Tried to save non-serializable type " + typeof(T).Name);
    }

    FileStream fs = null;
    try {
        fs = new FileStream(path, FileMode.Create);
        DataContractJsonSerializer serializer = GetSerializer();
        serializer.WriteObject(fs, obj);
    } catch (Exception ex) {
        Debug.LogException(ex);
    } finally {
        if (fs != null) fs.Close();
    }
}

Serialized files can be loaded like this:
public T LoadFile<T>(string path) {
    if (!typeof(T).IsSerializable) {
        throw new ArgumentException("Tried to deserialize non-serializable type " + typeof(T).Name);
    }

    if (!File.Exists(path)) return default(T);

    FileStream fs = null;
    T result;
    try {
        fs = new FileStream(path, FileMode.Open);
        DataContractJsonSerializer serializer = GetSerializer();
        var result = (T)serializer.ReadObject(fs);
    } catch (Exception ex) {
        Debug.LogException(ex);
        throw ex;
    } finally {
        if (fs != null) fs.Close();
    }

    return result;
}

When displaying a "Load" menu, we enumerate the saved files like this:
public List<T> LoadFiles() {
    if (!Directory.Exists(path)) {
        Debug.Log("No save files found");
        return new List<T>();
    }

    var files = Directory.EnumerateFiles(path);
    Debug.Log("Found " + files.Count() + " files");

    List<T> result = new List<T>(files.Count());
    foreach (string file in files) {
        Debug.Log(file);
        T obj = LoadFile<T>(file);
        if (obj == null) Debug.Log("File at " + file + " loaded null");
        if (obj != null) result.Add(obj);
    }
    return result;
}

I have omitted a lot of code for brevity, but what is shown above should cover the important parts.
In the Editor, everything works perfectly. However, in WebGL builds (where files are saved to/loaded from the browser IndexedDB), there is a strange quirk: the file doesn't remain in IndexedDB unless the user changes to a different scene after saving.
Scenario 1:

In the level Editor, Bob presses "Save"
The file is saved, and the browser console shows the log entry File saved to /idbfs/abc123/CustomLevels//FileName
Bob refreshes the webpage
Bob clicks "Load"
The game searches IndexedDB but does not find the file saved in step 2

Scenario 2:

In the level Editor, Alice presses "Save"
The file is saved, and the browser console shows the log entry File saved to /idbfs/abc123/CustomLevels//FileName
Alice returns to the main menu scene
Alice refreshes the webpage
Alice clicks "Load"
The game searches IndexedDB and does find the file saved in step 2

The browser console log suggests that after Bob refreshes the page in Scenario 1, the file no longer exists. If this was the only scenario that Bob had saved, we see the message "No save files found". If Bob had previously saved other scenarios and used the workaround of returning to the main menu scene, those previously saved files will appear in the console and save list, but the most recent file is missing.
Why would the save file disappear from the IndexedDB if the user leaves the webpage without changing scenes, but remain in the IndexedDB if the user returns to the main menu scene before leaving the webpage?

sentences:
How can I store additional attributes on DCEL edges? I am currently working on a city generator, and I've ran into some issues with data storage while working on the roads. I currently use a doubly-connected edge list (DCEL for short), to store the road data. Each road would consist of two half edges, each connecting to a vertex.

The advantage of a DCEL is that I can easily access the space partitions of the roads, or the faces contained by the half edges. However, I am running into trouble storing additional data for roads.

I currently store (alongside the DCEL) a vector that simple contains all the roads as simple pairs of the indices of their beginnings and ends. However, I only use this vector to access data in bulk (for a bounding box test or rendering), nothing specific.

I want to store additional information about roads as some struct, but I don't know where to store it. I would need to access it easily through the DCEL, but I don't want to duplicate the data between the two half edges. What should I do?

sentences:
Implementing Turn based Combat Using Node js I am creating a browser game that allows players to fight monsters using Nodejs, Socket.io and Express. However I can't seem to figure out how to implement the turns of combat.

My train of thought and workflow is as follows:

The player declares an attack on a monster (Client makes a Post request.) -
Working
The server get's the player's stats as well as the monster's. - Working
The player selects his action and attacks, then it's the monster's turn and so on. - Can't figure this out

How would such a functionality be implemented?

sentences:
Playing Sounds and removing instances once they have played -- Android I am playing sounds in my application I have the following code

sounds = new HashMap<String, MediaPlayer>();

Then when guys are created on screen they are given a sound.

sounds.put("sounds"+Integer.toString(ncount), MediaPlayer.create(this, R.raw.hit));

I want to remove the MediaPlayer from the hashmap like I do the enemies when they die

sounds.get("sounds"+Integer.toString(ncount)).setOnCompletionListener( new MediaPlayer.OnCompletionListener() {

    public void onCompletion(MediaPlayer mp) {

        sounds.remove("sounds"+Integer.toString(ncount));
    }

});

This errors out... how would I reference the sounds hashmap to remove the associated MediaPlayer when sound is complete?

Thanks!

sentences:
Get perpendicular vector from another vector I should clarify that I understand there is an infinite amount of 'perpendicular' vectors in 3D space. I am creating an electricity effect, and to do this the ability to have any number of perpendicular vectors is a good thing. The hard part is how to select any random one of these vectors - how would I do that, given a base vector "direction" which has been normalised?

Keep in mind that I want the resultant vector to be random, not just always up and down on the y-axis or anything.

sentences:
Unity IVRRenderModels_006 SteamVR Error I get this Error in Unity when I imported SteamVR :
"Failed to Load IVRRenderModels Interface Version IVRRenderModels_006"
I looked after on it but nothing really solved the problem.
Why is this happening and what could be the solution?

sentences:
Convert bones by bone matrix I have a 3d-models from old game.
They have the following structure:

Model {
    List<Vertex> Vertices;
    List<Bone> Bones;
}

Vertex {
    // point
    float x;
    float y;
    float z;
    // normal vector
    float nx;
    float ny;
    float nz;
    // texture
    float u;
    float v;
    // bones info
    byte boneIndex1;
    byte boneIndex2;
    float weight;
}

Bone {
    float[,] matrix = new float[4,4];
}

I want to convert models to any other format that is supported by 3D editors.
I learned how to convert a mesh (to obj, fbx). But I can't convert the bones.
As I understand it, a 4x4 matrix is enough to form a bone. The role of the bone index is performed by their index in the array. Unfortunately, as I understand it, there is no data on the hierarchy of bones.

I looked at various specifications of file formats, but I did not find one where the bones can be specified as a matrix.

Maybe there are some formats that support such a recording of bones in the form of matrices?
Maybe I just misunderstand something and I need to look for something completely different?

sentences:
How to save/persist a GameObject with incremental levels? Dictionary? List? I create buildings and they have child Text objects that will reflect the building level.

The Problem:

What can I use to store the buildings a player has built so the data can be persisted?

I've looked at Lists, but when I upgrade a building, how would I update the list so that particular building has its new level reflected?

I'm working on a dictionary so I can update the key with the new value (level) but running into a problem with the keys and names. If I have lets say 10 "Farms" and try to add them to the dictionary, even though they have different properties, I get an error that I have a duplicate.

Currently I am learning how to persist that data through scenes;

GameManager.CS

public class GameManager : MonoBehaviour
{

public static Dictionary<Building, int> playerBuilt = new Dictionary<Building, int>();

public void SaveState()
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/EmpireGame", FileMode.Open);

        SaveClass sc = new SaveClass()
        {
            food = Player.food.amount,
            buildingList = playerBuilt
        };

        bf.Serialize(file, sc);
        file.Close();
    }
}

[Serializable]
class SaveClass
    {
        public int food, wood, iron, stone;
        public Dictionary<Building, int> buildingList = new Dictionary<Building, int>();
    }

Building.CS

public abstract class Building : MonoBehaviour, IUpgradable {

    public int ID;

    //level this building is
    public Text levelText;
    public int level = 0;

    //starting cost to amplify the upgrade cost
    public int foodBase, woodBase, ironBase, stoneBase;

    //Upgrade cost
    public int foodCost, woodCost, ironCost, stoneCost;
    public float BuildingCostPercentage = 5f;

    public void UpdateDictionary()
    {
        if (GameManager.playerBuilt.ContainsKey(this))
            GameManager.playerBuilt[this] = level;
        else
            GameManager.playerBuilt.Add(this, level);
    }
}

Note: I have not tested the save function so I expect errors.

sentences:
Smooth seams and banding of overlapping lights in deferred rendering I have finally managed to get on screen multiple lights with a deferred renderer, but the result is somehow disappointing. In particular I have severe banding problem

Other than having clear banding for a single light, the seam of overlapping light volumes are in some case disturbing.

Currently my bounding sphere scale is calculated solving the quadratic equation with a min light intensity of 0.01 and using the attenuation terms of each light source (in the screen above, every light have an equivalent volume).

The attenuation in the shader is simply  1 / (const + linear * dist + quadr * dist * dist) . The position is reconstructed from a 32bit depth buffer and the lighting is in view space.

The light passes are blended together with simply

glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE,GL_ONE);

Is there a way to fix this issue easily?

Thank you!

sentences:
How to prevent character from jumping multiple times I just started learning Unity yesterday, Ive asked in many forums/servers this question but no one gave me a solution for my problem (in the title) so here's my code:

public class scr : MonoBehaviour
{
    public float speed = 1f;
    private Rigidbody rb;
    public float jumpforce = 1f;
    private bool isGrounded;
    public float disToGround = 0.5f;

    //Vai obter o rigid body do character
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    //Movimentaçao do character
    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal, 0f , moveVertical);

        rb.AddForce(movement * speed);

        if (isGrounded == false && Input.GetKeyDown(KeyCode.Space))
        {
            rb.AddForce(Vector3.up * jumpforce, ForceMode.Impulse);
        }
    }
}

sentences:
How do I perform my "String.Format" call with correct localisation? I am currently using this to create a string of a certain length from an integer variable. This is the only way I know of, at the moment; but Android Studio complains, saying it won't work work in all countries.

I will soon have some games that I might release on to the Play Store, and I wouldn't want there to be any unnecessary problems like this.

Is there a better way to achieve the same thing without reams of new code?

timeRemainingLabel = new Label(String.format("%03d", worldTimer),
        new Label.LabelStyle(font, Color.WHITE));

sentences:
How to develop a good game project? I have enough experience in both C++ and Java, since I've been working on them a lot. My graduation project is, in my case, a game (I still have almost 8 months remaining). I already took down the basic ideas behind it, but I'm still unsettled on how to implement the whole project. The best method, in my opinion, was to perform low level operations such as window handling and OpenGL rendering using libraries implemented by me in C++ and more game-oriented features with Java.

So, basically I'm headed to create the game engine with C++ and any game related code with Java, through the use of the Java Native Interface to perform engine calls from the JVM. Can this be considered a good idea or it is that bad?

sentences: What does a game programmer and graphics programmer do? I'm quite the novice in terms of my knowledge of game development, and I'd incredibly appreciate any further insight on this. To be a bit more specific, I encountered this video, (https://www.youtube.com/watch?v=_GyFRMr4uf4) and It documents the roles of game programmers and graphics programmers at Naughty Dog but even with the descriptions, I'm still uncertain of what those jobs actually entail. Sorry If this wasn't a suitable place for the post, but for any help thanks in advance.

sentences:
Maximum sensible audio sample rate I work as a multi-purpose engineer/developer at a very small startup game company. Recently, I've been asked to help out with audio development and editing, and I've been mostly able to hold my own.

I'm unfamiliar with sample rates though: I understand what they are, and I know 44100 Hz is considered a safe default because it's CD Quality.

However: Is there a practical max sample rate above which the human ear can no longer hear an improvement? In graphics, we have a guideline that humans cannot tell the difference above 60 frames of animation per second (although some people are starting to say 75-90 Hz, I think). Is there a similar upper limit in audio development?

sentences:
How to design the attack class in an RPG game? I am in the planning phase of a small RPG style game.

The character will have have a set of attributes, like strength, agility, etc which are represented as integers. The character also will have a set of attacks represented as an attack class.

On each attack I want it to do damage based on the characters attributes, eg: the attack "sword slash" will do 10 dmg + the value of the characters strength.

The way I was thinking to do this is to have an abstract attack class, which has an abstract Attack method, and for each attack I create one class that implements the Attack method.

public class SwordSlash:Attack
{
    public void Attack(Character attacker, Character defender)
    {
        defender.DoDamage(10 + attacker.Strength);
    }
}

I see that this will make it a nightmare to maintain.

Does anyone have an idea of how I can accomplish this in a nicer way?

What I think is the main problem is how to input the correct attribute, based on the attack.

sentences:
Are spritesheets worth it? Is a zip a good alternative? I was wondering if spritesheets are worth it.
I am making a game with pixi.js and was thinking about optimization, beginning with asset loading. I currently have an arraya of all files and use PIXI.loader, but I know this is not good because it will make a web request for all files which takes long, so I should figure out a way to load them in one web request. The first thing I thought of was a spritesheet but then I thought "what if I just zipped everything and loaded it with something like JSZip?" I knew it was possible already (from this project that loads pixi textures from a zip) and listed what I think are potentials good and bad things:
Zip good points:

Compression meaning faster loading of assets
Compression meaning smaller build size when making a build with electron

Zip bad points:

Requires loading a separate library meaning increased loading time and using more RAM
Requires decompressing in-memory meaning increased loading time

Spritesheet good points:

Doesn't has the headers of all individual image files
Is much used so it is a proven technique

Spritesheet bad points:

No compression (or at least not comparable to zipping)
More than one network call due to phone limitations preventing sometimes files over 2024x2024px making it necessary to split spritesheets
Empty holes as all images are not the same size and there is almost always a bit of space left in the spritesheet, meaning useless pixels that are still transfered over the network

I am not a very experienced developper, so I have a few questions:

Did I miss a point above?
Are spritesheets generally worth it?
Which technique of both is more worth it? I could do both but I want to focus on one first and leave the other in a nice to have list.

sentences:
Score vs. Kills in a casual game I am making a simple phone game and having a conceptual argument with my partner. The argument might end up being inconsequential, but I would like to hear some opinions from actual devs who are making games.

This will be a pretty standard beat-em-up style game where you beat up lots of easy enemies and build up a huge kill count. There will be many different types of enemies. The question emerged when we had to put up some display on the UI.

Should the kill count be represented as a 1:1 number? For example, on your HUD, it will constantly show:

Kills: 15

--or--

Defeated: 31

Or, should it be represented by a score? For example: 1 enemy = 100 points and it will display something like this:

Score: 1200

This may be a matter of taste in the end. But, for the casual games market, what do you think a mainstream audience will enjoy more? I think people love big numbers, in general, what do you guys think?

sentences:
Opening an executable process in background from unity I am trying to make a chess engine run in the background from an interface i designed

    Process stockfish;
        stockfish = new Process {
            StartInfo = new ProcessStartInfo {
                FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",
                Arguments = "",
                UseShellExecute = false,
                RedirectStandardOutput = true,
                RedirectStandardInput = true,
                RedirectStandardError = true,
                CreateNoWindow = true
            }
        };
        try{
            stockfish.Start();
        }
        catch (Exception e) {
            print (e);
        }

The code is throwing an exception

System.ComponentModel.Win32Exception: ApplicationName='E:\Narsun Projects\Ahmad's Projects\CoachChess\Narsun-CoachChess-Unity\Assets\Scripts\Stockfish\stockfish.exe', CommandLine='', CurrentDirectory=''
 at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
 at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
 at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()

sentences:
Player field of view, Physics.overlap, onTrigger performance I would like to ask you what is the best way to accomplish my problem.
I have a player who can detect ennemy with raycast in a zone, or in a certain angle, like in this picture:

As you see I want to get only green one.

I'm in topDown view. I was thinking about using Physics.OverlapSphere first, and then try Angle between player and target. But: In the picture I don't want to get the Purple one.

Also: what is the best way to do that with the best performance ?

sentences:
Unity: how do I make an input only available to the code? I have a simple function attached to a button. I then decided to change it by adding an input. The problem is that the function won’t run unless I specify the input in Unity via the inspector. I don’t want to do that because it will affect the function and I have already changed it inside. I already set the input when I run the function so there’s no need to set it again in Unity; this is a problem because the input is going to be different depending on different scenarios. How can I overcome this?

public void Eruption(string biome)
{
    if (biome == “sea”) {
        // do something
    }
}

sentences:
Rotate Rigidbody to face away from camera with AddTorque I have a camera that rotates around an object with "Look At" .

I want the object to rotate to face the direction the camera is pointing (Camera.main.transform.forward) using AddTorque, but I can't understand how.

I tried to create a rotation in which the more the object's forward vector rotates towards the camera, the more it should slow down the rotation until it stops. But it only works in sections, when I use the rotation of the camera the object rotates and then stops, as if it detects only one part of the rotation, while the other is a blind spot.

What equation can I use to rotate the object well?

var currentR = rb.rotation.y;
var targetR = Camera.main.transform.rotation.y;
rb.AddTorque(transform.up * 1000f * (targetR - currentR));

@DMGregory♦
I put your script as it is in a separate new script on a new object, equipped with a rigidbody.
I post the script how I entered it. At "targetOrientation" I gave the value of "Quaternion.LookRotation (Camera.main.transform.forward);" because I want the object to follow the direction of that camera.
The result is that all the axes of the rigidbody are influenced by the rotation (if I lift the camera the object turns towards the ground, etc.), and above all that the rotation works even if I block the axes with Freeze Rotation, and with this script the object is no longer affected by external forces.

public class rotation : MonoBehaviour
{
    private Rigidbody rb;
    public Transform direction;
    // Start is called before the first frame update
    void Start()
    {
      rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {

     Quaternion targetOrientation = Quaternion.LookRotation(Camera.main.transform.forward);
    Quaternion rotationChange = targetOrientation * Quaternion.Inverse(rb.rotation);

    rotationChange.ToAngleAxis(out float angle, out Vector3 axis);
    if (angle > 180f)
        angle -= 360f;

    if (Mathf.Approximately(angle, 0)) {
        rb.angularVelocity = Vector3.zero;
        return;
    }

    angle *= Mathf.Deg2Rad;

    var targetAngularVelocity = axis * angle / Time.deltaTime;

    float catchUp = 1.0f;
    targetAngularVelocity *= catchUp;

    rb.AddTorque(targetAngularVelocity - rb.angularVelocity, ForceMode.VelocityChange);

     }
    }

I set a command [if (Input.GetKeyDown (KeyCode.T)) rb.AddTorque (transform.up * 5500f, ForceMode.Impulse);] to rotate the object with an impulse and this does not work when your rotation script is active.
I also place a video where you see the object before activating the rotation script, and after it is active, to see how it does not react to the impulse with T, and how it rotates reacting on all rotation axes, while I want only that the rigidbody only rotates its Y-axis of rotation, in the direction of the camera (as a person does when turning in one direction). In the video The axes of rotation X and Z are on freeze (otherwise without fixed the rotation the object falls moving).
I also put a video of the desired effect taken from a game so as to explain me better.

My video
desired rotation

sentences:
Is "entity component system" a principle or a pattern? Since the ECS follows the principle Composition over Inheritance, and it  makes the behavior of game objects can be changed in the runtime.

If ECS is a principle, from my memory of design patterns of GoF, the following patterns can accomplish the principle well:

Decorator pattern
Composite + Visitor

But I'm not sure about that ECS is a pattern like the above or a principle like Open Closed Principle, I've tried to find a video which explains ECS well but found nothing clear.

Current resources I found:

gamedev.net ECS

sentences:
Generating spritesheet(s) on load I would like to reduce the size of the spritesheet I am loading by only loading the specific sprites I need.  Is there a way to crop and splice images at runtime using javascript?  Creating separate spritesheets for each level is not ideal, as that would mean lots of repeated sprites.

edit for clarification: Say I want to replace the 5 sprites in the top right corner of my spritesheet based on user input.  Is there a way to remove the sprites that are there and replace them with some from a different file?

sentences:
AI and shapes in 2D Grid I'm working on a grid- and turn-based strategy rpg. My problem is concerning finding best position for my AI to use a skill. But lets start at the beginning.

My plan is to make each skill an action for my AI. It checks for each action how effective it would be, chooses the best and does it.

Each skill has a usage and a affect area that can be circular or shapes like

[
 [1,1,1,1,1],
 [0,1,1,1,0],
 [0,0,1,0,0]
]

which can be used in 4 directions.

The most simple solution would be to just check the affect area for each position and direction of the movable and usage area. But as these checks can get quite intensive I want to minimize them as far as possible.

One approach would be to combine the circular movement area with the skills usage and affect areas and find all target entities in it. So I have a list of all entities that could be targeted by the skill. The next step would be to group these entities by the skills affect area to rate it higher when the skill hits multiple targets. And as the new position and direction should get into that rating as well I have to check all possible positions for each group.
And I've no idea on how to effectively do that.

1) Does this AI approach makes sense?

2) Is there a better way to define such grid-shapes and apply them to the checks later on?

3) Any ideas on how to group the targets by the skills usage area or minimize the positions and directions to check by the knowledge of where the target entities are?

Thanks for reading!

EDIT: After this is not going to get answered I have to ask another question: Am I bad in asking for help? In the 10 year's I'm developing now there were like five times were I really couldn't get further without a tip. But unless which way I try to ask for help (in the internet, asking the few developers I know or someone outside of the industry for understanding problems) I've never got any. To be fair I'm only coming with real problems after being stuck for days. But as I see the internet full of perfectly answered questions I begin to think: Is that my fault? What makes this question not worthy for an answer?

sentences:
How do you get the player's last car in GTA IV? I am developing a car control plugin for GTA IV and everything is working except the lock/unlock doors feature.

Despite using the Player.LastVehicle handle, the code only works while the player is in the car. How can I get the code to work when the player is inside or outside the car?

Here's what I have so far:

'Lock/Unlock
        If e.Key = Keys.OemPipe AndAlso e.Control Then
            'Lock Codes: 1 - Unlocked; 2 - Locked (Player & NPCs); 3 - Locked (Player); 4 - Locked (Player, Inside); 7 - Locked (Can Break Into)
            If DoorLock = False Then
                Player.LastVehicle.HazardLightsOn = True
                Wait(1000)
                Player.LastVehicle.HazardLightsOn = False
                Native.Function.Call("LOCK_CAR_DOORS", Player.LastVehicle, 2)
                DoorLock = True
                Game.DisplayText("Vehicle Locked")
            Else
                Player.LastVehicle.HazardLightsOn = True
                Wait(2000)
                Player.LastVehicle.HazardLightsOn = False
                Native.Function.Call("LOCK_CAR_DOORS", Player.LastVehicle, 1)
                DoorLock = False
                Game.DisplayText("Vehicle Unlocked")
            End If
        End If

sentences:
Faking 2d light using shader (Unity, Shaderlab) Since the concept was difficult to explain in words for someone who's not quite familiar with shader, I described it in pictures.

I'm currently using Unity and it seems Shaderlab is the best choice to accomplish this.

To shader masters, this seems like quite a simple trick, but as beginner, I've been struggling to find right keywords and tutorials to accomplish this.

I wish someone could explain the concept behind this shader trick.

Thank you in advance.

sentences:
Character doesnt move along with his rotation Decided to change my character movement from transform.Translate to a rigidbody movement, the only problem is that my character is not moving to where he is facing, also it falls really slowly in the Y axis. Heres the code related to the movement:

    float moveHorizontal = Input.GetAxis("Horizontal") * rotSpeed;
    float moveVertical = Input.GetAxis("Vertical") * speed;

    rb.velocity = new Vector3(0, 0, moveVertical);
    transform.Rotate(0,moveHorizontal, 0);

sentences:
Can I use "Creative Comons BY-NC" licences music in my Freemium game? According to creativecommons.org, a CC BY-NC license stands for

a creative commons license that prohibits you to use the material in "Commercial Purposes"

...and for the Commercial Purposes they have defined it in this way:

A commercial use is one primarily intended for commercial advantage or monetary compensation.
(emphasis mine)

As Freemium games can be played without spending even a penny, and the in-app purchases are only meant to accelerate the process, is this game still intended as a Commercial project with the definition given above, and thus should I ignore using such music?
My interpretation is that my use the song is not intended for a commercial purpose.

sentences:
Fighting aliasing on specular highlights MSAA does a good job removing aliases on mesh edges, but it does not help with aliased specular highlights:

Notice the aliased specular highlights on the doors and windows.

I believe the reason for this lays in the way normals are filtered after being sampled from their maps, so I wonder if there are some known methods how to make highlights more smooth?

sentences:
"aim at" in 3D space algorithm I'd to calculate the cartesian rotate values of "aiming" one point at another in 3D space.

For example, assuming rotation order of XYZ:
Point A is at [0, 0, 0]
Point B is at [2, 2, 0]

If point A was "aiming" at point B with primary (aim) axis X, secondary (up) Y; point A's rotate values would be [0, 0, 45]. These values are what I'd like to calculate.

sentences: Resize big sprites in good way How to resize 2D sprites in the size of like 400px to 64px or 32px in a way that doesn't make it look pixelated and weird?

sentences:
Why might a body suddenly stop while moving on continue platform? I have a 32x32 sprite and I make some to be platform like this

for (int i = 0; i < 15; i++) {
    attachChild(new Ground(32 * i, 200, regPlatform, vertexBufferObjectManager, physicsWorld));
}

And I have another sprite (32x32 also) moving over those platforms (A player object)

attachChild(new Player(10, 10, regPlayer, vertexBufferObjectManager, physicsWorld));

And the physicsWorld connects the player like this (Where move=1 when user click right button, and move=2 when user click left button)

physicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, false) {
    if (move == 1) {
        body.setLinearVelocity(new Vector2(8, body.getLinearVelocity().y));
    } else if (move == 2) {
        body.setLinearVelocity(new Vector2(-8, body.getLinearVelocity().y));
    }
}

The Player moves smoothly form left to right and reverse. But sometimes, it is blocked.
If the player move back a bit, and back again where it is blocked, it isn't blocked any more at the same place.

Anyone has any idea to fix this? Maybe it is a bug of andengine and box2d and I need some trick here? Please help me. (The two sprites above are just normal png with 32x32px)

Player image:

Platform image:

sentences:
How to sync towers and enemies in Tower Defense? I'm going to build a tower defense (like) game.

In a heavy tower defense, it takes time to processing.

So, if i set a time interval, it costs interval+processing time so it's not fair.

If i make a processing unit run every 100ms and process all things, it'll be fair but it costs more. And this is not good for flying weapon(like bombs).

Any another way or just use 100ms process unit?

sentences:
Storing player data for multiple players in libGDX I'm working on a game (in libGDX) that would allow multiple player accounts. I need to store some simple user data (several key-value pairs).
I think JSON is the best for my needs, but I'm wondering how this data should be organised. I'm thinking about two possibilities:

single file for each player seems better design-wise, but I'm not sure if real-time file creation won't lead to issues
one big file with player id as key and organised array of values - safer, but would require loading data for all players on initial read and each update (although there shouldn't be that many accounts on a single game instance). Also harder to maintain due to necessity of keeping values in proper order, etc.

Perhaps there are better ways to do it, that I didn't think about.

sentences:
Render texture seems to ignore camera background type I'm currently trying to pull a fog of war for an rts game, and planned it like this. (Unity 2020.2.7, URP 10.3.1)

Use units field of view to generate a texture of what is seen (alpha 0).
Create other render texture to generate fog (alpha > 0  && alpha < 1) by not clearing camera buffer.
Use the mask made between the two textures to cut the fog of war (alpha 1).

Now i'm currently stuck at the 2nd step. Please check the image

As you can see, the camera is doing what I want, but the render texture somehow clears the buffer, which  just gives me the "Use units field of view to generate a texture of what is seen (alpha 0)." part again.
This whole buffer thing has been hard to understand, i'm not sure if this implementation is right or not.
I would be really thankful for any pointers given! :D
Cheers guys!

sentences:
Problem with Animating on local position Unity Currently, I am having a Cube that needs to be animated to roll on its edge. Using unity built-in animation feature, I created 4 animations (RotateUp, RotateDown, RotateLeft, RotateRight). At the end of each animation I would put an Event to call a method on my script. To be able to move the object every time the animation is played, I put the cube with animator attached inside a parent object.
Below is the script attached to my cube.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RedCubeBehavior : MonoBehaviour
{

    Animator anim;

    bool isMoveTriggered = false;

    void Start()
    {
        anim = gameObject.GetComponent<Animator>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            MoveUp();
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            MoveDown();
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            MoveLeft();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            MoveRight();
        }

        if (isMoveTriggered)
        {
            if (IsBackToIdle())
            {
                transform.parent.position = transform.position;
                transform.localPosition = Vector3.zero;
                isMoveTriggered = false;
            }
        }
    }

    void AnimationFinished()
    {

        anim.Play("IdleState");

    }

    public void MoveUp()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveUp");
            isMoveTriggered = true;
            anim.Play("RotateUp");
        }
    }

    public void MoveDown()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveDown");
            isMoveTriggered = true;
            anim.Play("RotateDown");
        }
    }

    public void MoveLeft()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveLeft");
            isMoveTriggered = true;
            anim.Play("RotateLeft");
        }
    }

    public void MoveRight()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveRight");
            isMoveTriggered = true;
            anim.Play("RotateRight");

        }
    }

    bool IsBackToIdle()
    {
        return anim.GetCurrentAnimatorStateInfo(0).IsName("IdleState");
    }

}

Every time the arrow key is pressed the object would rotate but in the end when AnimationFinished() is called, the cube would just roll back to its starting position (because of playing IdleState). It will only work (the object didn't return to its starting position) if I pressed the arrow twice quickly.

I've tried to not call the IdleState (which is only an empty state), but what happens next is it just won't play another animation again when triggered.

What should I do in order to get it work without having to press the key twice?

sentences: Counting no.of bodies present in certain area in box2d? I am stuck on it:how can i count or find the no.of bodies present in any area in as3?would be thankful if any guys help me out.....

sentences:
Creating Font Textures in Direct3d without D3DX Update: The completed solution using Nathan Reed's answer is posted in my answer below

A few open source programs I've seen that render installed fonts do something like this...

Create a texture for the font
Draw font to texture using native calls
Store the coordinates for each character
Create a vertex buffer with a quad for each character
Render the vertex buffer using the font texture

But I'm really having trouble getting this to work consistently. GetTextExtentPoint32A() for Win32 font sizes which does NOT include italic support and seems to cut off some of the stranger fonts.

Here is an example output from my code. Notice the cut off edge of the Q and a few other characters. A much more exaggerated version happens when rendering italics.

http://i30.photobucket.com/albums/c308/thentsc/font_test.jpg

The code looks something like this...

for (uint8 c = 0; c < 127 - 32; c++)
{
    str[0] = c + 32;
    SIZE size;
    GetTextExtentPoint32A(hDC, str, 1, &size);
    if (x+size.cx+1 > m_TextureSize)
    {
        x  = 0;
        // 1 pixel vertical margin
        y += size.cy + 1;
    }

    uint32 Diff;
    ExtTextOutA(hDC, x+0, y+0, ETO_OPAQUE | ETO_CLIPPED, NULL, str, 1, NULL);
    m_fTexCoords[c].Left = x/m_TextureSize;
    m_fTexCoords[c].Top = y/m_TextureSize;
    m_fTexCoords[c].Right = x+size.cx/m_TextureSize;
    m_fTexCoords[c].Bottom = y+size.cy/m_TextureSize;

    // 1 pixel horizontal margin
    x += size.cx;
}

The image above is actually just a render of the whole texture stretched from -1,-1,0 to 1,1,0 not using the stored texture coordinates to show clipping due to GetTextExtentPoint32A.

Again this works fine for some fonts but looks terrible for others and doesn't support italics.

It is designed to work in a system like this...

cFont* g_Font;
cTextObject g_TextObject;

Setup()
{
    g_Font = SetupFont("Arial", BOLD | ITALIC, 24pt);
    g_TextObject = CreateTextObject("The quick brown fox...", g_Font, X, Y);
}

OnRender()
{
     g_TextObject->Render();
}

So in general I guess my question is what is the correct approach for this issue?

Should I just let each text object have a texture and on text object creation use the GDI to render all text to it (which would bypass the italics and font face problem)?

But then wouldn't texture memory usage get out of hand?

sentences:
Love2D : How can I keep up with lots of small sprites' collision data? So I'm using a SpriteBatch to keep up with lots of small pieces for a falling-piece puzzle game. I have an array of Quads (for different color blocks), and they are randomly added to the aforementioned SpriteBatch. Right now, the game determines when the current piece has hit the ground, then that piece is stopped and a new piece spawns that the player now can control.

In order to figure out when to stop dropping the piece, I need to do a collision check. This shouldn't be hard, because I should only have to check the falling piece (unless the current falling piece causes a chain reaction). But, what type of data structure should I use? I can't use the position data of the individual Quads, because the boundary boxes will actually be a different size/shape than the pieces (think triangle pieces, but I will need to use a slightly skinnier rectangle to fit upside-down pieces in between right-side up pieces).

Should I just duplicate the (x, y) pairs using offsets with a width and height, and store them in an array, or am I missing a more obvious/efficient way? I'm guessing that the play screen could fill up with several hundred of these pieces, and if I add two player mode, double that.

EDIT: Here's what the Quad size issue is all about:

sentences:
How to make object move in exact gametime in Monogame, XNA? I have recently started learning monogame. The big question i faced is how to make object move, when gametime variable has an exact value.

//Update method in Game.cs
     float delta = (float)gameTime.ElapsedGameTime.Milliseconds / 1000f;
        if (CurrentState != null)
            CurrentState.update(delta);

     if (Keyboard.GetState().IsKeyDown(Keys.Enter))
            SetState(new GameState());

    //GameState.cs, there is a box that's need to be moved in 5 seconds
    Vector2 boxpos = new Vector2(800, Game1.graphics.PreferredBackBufferHeight / 2 - 100);
    float olddelta = 0;
    public void update(float delta)
    {
        float newdelta = delta;
        if (newdelta - olddelta >= 5)
        {
            boxpos += new Vector2(0, -200);
            olddelta = newdelta;
        }
    }

I've drawn a box in my gamestate's draw method using spritebatch.Draw(Box, boxpos, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);, but it's position remains constant.
I really have no idea how to do it in a right way. Hope can receive some help.

sentences:
Side scroller terrain generating and scrolling I am creating a side scroller game for android devices but I encountered a problem. The game looks like this:

The black dot is a player. Player's x doesn't change, only the y does. When the player collides with the green terrain the game is over.

I have a problem with how should I handle a map storing and drawing. What I did is store the level file in a large png file (like 1k px height and 20k px width), same with the collision mask (basically the same file but with black colored collision terrain). I guess this approach isn't to good beacuse I was getting the out of memory exceptions due to large bitmap on some devices. I've learned that some people use tile based maps but with this sinusoidal map it could be to hard for me to do small tiles and collsion masks for them. I want the map to be as long as possible and if it's possible random-generated but I don't know what's the best approach to do this with this kind of terrain and how to handle pixel perfect collisions when doing so.

sentences:
OpenGL 4D textures with bilinear interpolation I want to use and interpolated 4D texture in OpenGL, i.e. a texture that is accessed with a texture coordinate vector (s, t, p, q) and interpolated linearly in every texture coordinate.

The extension GL_SGIS_texture4D does exactly this. However, it is unsupported on literally every GPU I have access to.

If the was a GL_TEXTURE_3D_ARRAY, I guess I could sample the appropriate 2 layers of a 3D array texture with the (s, t, p) coordinates and then manually interpolate in the q coordinate. However, there are only "ordinary" GL_TEXTURE_2D_ARRAY texture arrays. A possible solution is to treat the texture array as 2D array of 2D texture, sample the appropriate 4 layers with (s, t) and then manually interpolate in p and q. This method is somewhat constrained by GL_MAX_ARRAY_TEXTURE_LAYERS. I am also afraid of the relatively large number of 2D texture fetches required to fetch a single 4D texture value.

Is there a simpler way of achieving 4D interpolated textures?

sentences: Setting the cursor's location in JavaFX Is there a way to set the cursor's location in JavaFX while the window is in focus? I've searched the possibility of the Scene's cursor object, but that leads to a dead end.

sentences:
How to do you separate or do you separate a Player/Non Player movement, action, behavior states in one or more component? Assume we are using Finite State Machine, what is the best way to organize states?

Given I have current StateComponent, all states are here.

MOVEMENT (Parallel) - Can be for player and non player
        [stand, walk, run]
        [forward, backward]
        [left, right]
        [jump, attack]
BEHAVIOR - For non player only
       [patrol, follow, chase, evade]

sentences:
Importance of scripting engine at Cocos2d Game Engine Each Game Engine is different and solves different problems in different ways, so the engine design does vary greatly from engine to engine (even though a lot of principles are shared from engine to engine).

Cocos2D is a great product on it’s own, but it doesn’t expose engine functionality to a scripting Language like Lua, JavaScript etc.

My Question: How much important to integrate a Scripting Engine at Cocos2d?

sentences:
Trying to set up a simple swapping system to swap two game pieces using a button press I am trying to set up a system that will move two objects. This is a puzzle game with a cursor to visualize where the player is. I need to get the position of the cursor's left and right half, send that to a function that will then switch the two blocks when a key is pressed.
I have code that will move the cursor around but cannot figure out how to swap two blocks based on the position of the cursor.
I do not know if the code that is currently attached to the cursor will be of any help, but I can provide if necessary.
I am more or less looking for a general solution that I could apply to swapping two blocks.
I do not know if I need to be sending the positions of the cursor to the swap function in order to swap. How would I connect this to the tiles themselves? The code below is located in the board classv2 class. I am not very good with Unity as of yet. Any additional help would be appreciated.
 void Update()
    {
        if (Input.GetButtonUp("Swap"))
        {
            swapTiles(cursorLeft.transform.position.x, cursorRight.transform.position.x);
        }
    }

void swapTiles(float x1, float x2)
{

}

Game pieces are created and have an x and y number associated with a game board I created.
The Game pieces have a move routine. I can't seem to get the pieces to actually swap.
public void Move(int destX, int destY, float timeToMove)
{
    if (!m_isMoving)
    {
        StartCoroutine(MoveRoutine(new Vector3(destX, destY, 0), timeToMove));
    }
}

//Moves the piece.
IEnumerator MoveRoutine(Vector3 destination, float timeToMove)
{
    Vector3 startPosition = transform.position;

    bool reachedDestination = false;

    float elapsedTime = 0f;

    m_isMoving = true;

    while (!reachedDestination)
    {
        //if we are close enough to destination
        if (Vector3.Distance(transform.position, destination) < 0.01f)
        {
            reachedDestination = true;

            if(m_board != null)
            {
                m_board.PlaceGamePiece(this, (int)destination.x, (int)destination.y);
            }
            break;
        }

        //track the total running time
        elapsedTime += Time.deltaTime;

        //calculate the lerp value
        float t = Mathf.Clamp(elapsedTime / timeToMove,0f,1f);

        switch (interpolation)
        {
            case InterpType.Linear:
                break;
            case InterpType.EaseOut:
                Mathf.Sin(t * Mathf.PI * 0.5f);
                break;
            case InterpType.EaseIn:
                t = 1 - Mathf.Cos(t * Mathf.PI * 0.5f);
                break;
            case InterpType.SmoothStep:
                t = t * t * (3 - 2 * t);
                break;
            case InterpType.SmootherStep:
                t = t * t * t * (t * (t * 6 - 15) + 10);
                break;
        }

        //move the game piece
        transform.position = Vector3.Lerp(startPosition, destination, t);

        //wait until next frame
        yield return null;
    }
    m_isMoving = false;
}

sentences:
Get the position of a GUI.Button and instantiate in its position I am trying to instantiate a GUI.Box in the position of my GUI.Button when it is clicked but I just cant seem to get the position of the button. The button does change position.

Here is the code of my button in my Editor script:

void OnGUI () {
     GUI.Button(new Rect (5,95, 300, 100), "Hello");
}

sentences:
How can I randomly choose a monster from an array of monsters? I have a problem dealing of how can I call the values inside the arrays correctly. First of all, I am into making an array of monsters and a set of hp for them. I made it this way:

string monsterlist [] = {"Imp", "Orc", "Troll", "Gnome"};
float monsterhealth [] = {5.0f, 8.0f, 9.0f, 10.0f};
int monsterlife;
int monsternumber;

wherein, since i can not call the variables correctly, I made a very simple way to do it, which is:

srand(time(0));
monsternumber = 1 + (rand() % 3);
if (monsternumber == 1)
    cout << monsterlist[1];
else if (monsternumber == 2)
    cout << monsterlist[2];
else if (monsternumber == 3)
    cout << monsterlist[3];
else if (monsternumber == 4)
    cout << monsterlist[4];

Is that correct? I know it might be not the proper way. This is what I wanted:

I want to create a random number generation from 1 to 4 and store that variable in monsternumber. The next thing that will happen is, if the monsternumber is equal to 1, for example, should make the monster Imp and 5.0 as its health, seen from string monsterList and monsterHealth.

Is there a proper way to make this simplier or rather the correct way of doing it?

sentences:
How should my creatures see the world? This may not be the best forum for this question, but I know a lot of you have dabbled in the field of general AI for games so here it is.

I'm doing the cliche population evolution of creatures in a simulated ecosystem (with some cool irrelevant twists) where each creature is its own neural network. Specifically, I'm using the NEAT algorithm to evolve creature brains over generations.

My problem is that I can't figure out what to feed as input to the creature neural networks. I haven't found any relevant literature on it either.

The world right now is composed of prey/predator creatures and grass for the prey to eat. I want all creatures to see all three objects (prey, predators, and grass). The other important point is that the populations are not fixed. Prey can become endangered, grass can become limited, etc.

Initially I was going to have a list of all objects as relative positional vectors within a radius of a given creature as input, but variable sized inputs are basically a no go for neural networks. My second idea was just show everything in the scene (even if it may be a sensory overload), and when an object dies just replace it with a -1 hot vector. But that would just confuse the ANN.

I'm out of ideas and flailing in the water. Any thoughts are appreciated.

sentences:
XNA Advanced font rendering (outline, shadows, etc) I am looking for a tool that will output spritefonts for XNA consumption that have an outline effect. I know that this can be done by rendering the text multiple times, but I'd like to take care of it in the content pipeline.

The options that I was able to find reference to were hosted at sites that are now offline. I know Nuclex has a vector font option, but again, I'd like to stick with sprite fonts and handle the rendering at compile time.

If anyone can link to an archived copy of those free tools, it would be appreciated.

sentences:
Spherical / Relative Gravity I'm working on an Ogre3D + Bullet project that involves planets in a solar system. For all intents and purposes, I'm looking to give each planet it's own gravity sphere.

So far, all I've found are ways to change the "general" gravity Vector3 for the entire scene, but that's it.

While I'd hope to add air friction and other physics later on, for now I just want "prioritized" gravity, like in this video.

You'll note that the floor in the video has gravity, but when he jumps near the sphere, he is attracted to it sphere instead. That's exactly what I'm going for.

The video is very low quality and doesn't explain how any of it is working, besides the fact that it uses Ogre3D and Bullet.

The planets themselves are on pre-generated paths around the Sun - I'm not looking to apply "real" physics to the solar system itself; just for the planets themselves and eventually "generated gravity" for ships in space.

sentences:
How can I make a self-updating game launcher? I have been creating a game with java, and before I release it I wanted to make a launcher that is connected to the game's website.

Basically I need to make a launcher that updates itself when I have changed the content.

Unfortunately I have no idea on how to do this. There would be a description in the main launcher which only I can change, and a large play button that will close the launcher and run the game. If I have changed the description, then it will change on the website download, and on the copy that anyone else owns (anywhere).

So, because of my lack of knowledge on this topic, does anyone know how I'm supposed to do this, and how it would work?

sentences:
ClientDisconnected due to error: Timeout UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate() Why am I getting this error. I think it has problem with port so I change port number and still getting same error. yesterday it was working fine but when I start today it giving me error like this.

  ClientDisconnected due to error: Timeout
  UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

I refer this question but, there is not any answer presence for this error.

sentences:
Correctly bitmasking path tiles based on existing paths Currently, I have a bitmasking implementation that sometimes incorrectly bitmasks the tiles. Conventionally, it is done correctly, and the math/etc is sound, but it achieves results such as the following:

This is similar to what you might expect, and looks fine when doing simple x-shaped crossings. However, I would like for the images to remain unchanged in some of these cases. For instance, the parallel paths in the third image would remain parallel paths instead of being bitmasked into many crossings. In the first and second images, only the parts of the path highlighted in the following images would be bitmasked (Different parts of path labelled for clarity.)

If I purely update only the tiles that make up the newest path, I again get good results in simple x-shaped crossings, however I get results such as those demonstrated in the following image:

What could I do to achieve results where this would not occur? I have though about adding some sort of flag to the tile to indicate that it is a crossing, but how could I detect that?

sentences:
How to write AI bots that can autoplay a shoot 'em up game? In a shoot 'em up game I want to have AI bots that can take up the player's slot and play the game (such as in this video). However they should come with different flavors (varying competency and playstyles). The problem is the related maths and AI programming are very new to me. Where should I start?

Suggestions for existing sample code/libraries/tools, reading materials or advice on architecture/algorithms are all welcome. Thanks in advance!

sentences:
Unreal Engine Niagara Write to Texture or Data Structure In the Niagara system, is there any way to write to a texture? I want to write the position of each particle into a texture. So the 2d grayscale texture has its intensity as the number of particles in the pixel.

Or, is there any data structure that I can use to store the particle positions? Something like 2d or 3d array?

sentences:
Maya users; how can I create my own particle emitter in Maya? (Originally posted in the Programmers Stack Exchange, but was told to ask here instead. Whoops.)

Before you answer this with "well, use the built-in particle emitter", read further.

For one of my university assignments, I have to build a scene involving a Catherine wheel (a spinning firework, basically) attached to a fence post in Maya 2015. I had intended on using Maya's built-in particle emitter, but my lecturer has told me that he would prefer me to create my own.

I have only a vague idea of what to do. I know that I need to assign a position, velocity, lifespan and a trigger flag that re-spawns each particle (all of which are arrays that depend on the number of particles the user wishes to spawn), but I don't know how to arrange them.

Any tips and advice would be appreciated.

Thanks

sentences:
game server - fault tolerant If you have for example an MMO with 2000 players, and players are constantly removing / creating / swapping items (and doing some other important things that can't be lost).

If the updates are saved instantly in the database, since they are too many, the database dies. If you save them every "x" minute, there's a window where if your server app dies, players may lose items, and sometimes they may be expensive, let's say 100$, so that can't happen.

Is there a design or a guide I could read that handles this issue? The games I play today do not have that problem.

sentences:
Resize font when screen resizes desktop Libgdx I create my font using the following code:

public BitmapFont createFont(FreeTypeFontGenerator ftfg, float dp)
{
    FreeTypeFontParameter f = new FreeTypeFontParameter();
    f.size = (int)(dp * Gdx.graphics.getDensity());
    f.color = Color.BLACK;
    f.minFilter = Texture.TextureFilter.Nearest;
    f.magFilter = Texture.TextureFilter.MipMapLinearNearest;
    ftfg.scaleForPixelHeight((int)(dp * Gdx.graphics.getDensity()));
    return ftfg.generateFont(f);
}

myFont = createFont(new FreeTypeFontGenerator(Gdx.files.internal("Fonts/Roboto-Black.ttf")), 16);

I have some labels to which I set the font using:

Label myLabel= new Label("Text", uiSkin);
        myLabel.setWrap(true);
        myLabel.getStyle().font = myFont;

How I create the stage:

Stage collectionStage = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getWidth()));

I also tried with no viewport or with other viewports.

In my resize method:

public void resize(int width, int height) {
    Viewport viewport = collectionStage.getViewport();
    viewport.update(width, height, false);
    viewport.apply();
}

The problem is that when I resize the window on Desktop the font gets distorted. Do I have to create another font in the resize method, and then for each label that I have, reassign the new font? Or should I do something else?

sentences:
How should I arrange collision primitives around characters for a top-down, oblique game? I'm planning to develop a top-down oblique mobile game (like the one in the screenshot below), but I'd like to understand something before I start:

When I'm working on collisions, where should the fixture for collision be? Should it be at the character's feet, or elsewhere?

sentences:
Textures "don't work" when I don't specify any texture parameters. Is this a driver bug or intended behavior? Whenever I try to use textures, I have to at least specify the sample filtering parameters (GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER) for textures to work at all. If I don't, sampling the textures in a shader will usually just return a value of 0 for all texels in the texture, even though glReadPixels return the correct values, and rendering to the textures actually works. Debugging tools like Nsight and gDebugger confirm this.

I tested this on two NVIDIA GPUs (GTX 970, GT 555m) with the latest driver versions (347.09), and the behavior is the same.

However, I can't find any reference to this in docs like this or this

I assumed that not specifying these parameters just made them take on their default values. So is this actually intended standard behavior (probably meaning "undefined behavior") or can I assume this is a driver bug?

sentences:
How can I Implement KeyListeners/ActionListeners into the JFrame? I'll get to the point:  I have a player in my game that you control with the keyboard yet the key methods in the player class and ActionListener w/ KeyAdapter in the Board class don't seem to fire.

So far I've tried adding these key methods into the JFrame, doesn't seem to let me move him even though other objects that I have (enemies) can move fine.

Here's part of the JFrame class with the event listeners:

    frm.addKeyListener(KeyBoardListener);

    public void mouseClicked(MouseEvent e)
{
        nSound.play();
        StartB.setContentAreaFilled(false);
        cards.remove(StartB);
        frm.remove(TitleL);
        frm.remove(cards);
        frm.setLayout(new GridLayout(1, 1));
        frm.add(nBoard); //Add Game "Tiles" Or Content. x = 1200
        nBoard.setPreferredSize(new Dimension(1200, 420));
        cards.revalidate();
        frm.validate();
}

    public KeyListener KeyBoardListener = new KeyListener()
{
    @Override
    public void keyPressed(KeyEvent args0)
    {
    int key = args0.getKeyCode();

    if(key == KeyEvent.VK_LEFT)
    {
        nBoard.S.vx = -4;

    }
    if(key == KeyEvent.VK_RIGHT)
    {
        nBoard.S.vx = 4;
    }
    if(key == KeyEvent.VK_UP)
    {
        nBoard.S.vy = -4;
    }
    if(key == KeyEvent.VK_DOWN)
    {
        nBoard.S.vy = 4;
    }
    if(key == KeyEvent.VK_SPACE)
    {
        nBoard.S.fire();
    }

    }

    @Override
    public void keyReleased(KeyEvent args0)
    {
    int key = args0.getKeyCode();

    if(key == KeyEvent.VK_LEFT)
    {
        nBoard.S.vx = 0;
    }
    if(key == KeyEvent.VK_RIGHT)
    {
        nBoard.S.vx = 0;
    }
    if(key == KeyEvent.VK_UP)
    {
        nBoard.S.vy = 0;
    }
    if(key == KeyEvent.VK_DOWN)
    {
        nBoard.S.vy = 0;
    }
    }

    @Override
    public void keyTyped(KeyEvent args0) {
        // TODO Auto-generated method stub

    }
    };

sentences:
Take an image and cut it up into a tile map So I am attemping to make a game in Phaser.

I am trying to think of the best way to cut this image up and make it in to a tile map OR do I try and lay this entire image as a back ground to the game and just determine where the mouse was clicked.

I believe the images have a width of 140 and a height of 160 or 162.  Then I would have to make the four corners of the image transparent so I can overlay them to create the map.

If I want to go with a scrollable background, I am not sure how to proceed, would I overlay hot spots on to the screen and would I have to do a point to hex conversion as I would not have the tile coordinates

sentences:
Pre-calculate physics in unity I have a self contained physics simulation (eg fragments of a building crumbling) which is known to be the same, excepting floating point precision errors, every time it is run.

Is there a way to improve performance by pre-calculating/recording the simulation?

It would seem that the build in physics engine does not support this, but are there other engines that do?

Or alternatively, would recording the transformation of each Rigidbody in the simulation, and then playing back those transforms, be a sensible approach to increase performance?  It would remove a lot of Rigidbodies, joints and enable flattening the hierarchy.

sentences:
Texture being stretched when using D3DTADDRESS_CLAMP I'm trying to create a skybox using a cube and using one of this textures: http://forum.unity3d.com/threads/mundus-skybox-pack-01-released.202748/

I've got it working well, but I noticed there are some bugs on the edges of the cube, as it can be seen here:

I found that this could be fixed using clamping, so I set D3DSAMP_ADDRESSU and D3DSAMP_ADDRESSV to D3DTADDRESS_CLAMP. This, however, produced the following result:

Half of the cube wasn't being shown and the other half was only showing a one-pixel wide texture region.
I saw this similar question (which uses wrapping though), but I'm already using 4 vertices per face.
So, what could be causing this?

sentences:
Rotate quaternion around plane normal How can one rotate a quaternion so that the rotation is around a plane normal?
A graphic/diagram I made below gives more detail about what exactly I am implying.  Note that the tip of the quaternions in the diagram are that of the quaternions local, upwards direction, symbolizing roll (the quaternion's w component).

English describing the diagram:
The rotation is around plane normal (vector) N with amount θ.  The global axes are X, Y, and Z (Y is up).  The plane normal and quaternion are both in global space.  Notice how the beginning and end of the operation does not use any reference to the global axes, only the plane.
The angle between the start quaternion (q) and end quaternion (q') and the plane is equal (a = a').  If you were to draw lines from the tips of the quaternions to the plane, the angles of intersection would be equal.  In other words, the roll of the quaternions are preserved in relation to that of the plane.

EDIT 6/21/2020:  Thanks to Theraot, this is possible simply by doing this in your favorite engine with quaternions:
quaternion qPrime = quaternion.AxisAngle(normal, θ) * q;

As Theraot states in his answer, order of multiplication does matter, and some engines may do the opposite operation compared to other engines.  For Unity's Mathematics package, the above pseudo-code holds true.  The formula for AxisAngle can be found by a simple google search.  The following Gif shows it working while proving that all angle requirements I stated above are satisfied.

sentences:
Do I have to explain the mechanical superiority of the player-character within the fiction of the game? For quite a while I wonder how to formulate this concept, which seems to be common, yet barely addressed within games. It is about the concept of player controlled characters (PC) being consistently superior to generic non-player controlled characters (NPC). This also must not depend on the actual player skill (defined as what the player can actively do), and instead be inherent to the PC itself.

Now for RPGs it's usually something like destiny, magic, superior skill, backstory, better (enchanted) equipment, having a rare power.

But what if it's about space ships with equal size, type and equipment? How could I explain that a player can repeatedly and easily grind through 5-10 space ships which he himself is using without having much room for player skill due to weapons and thrusters working automatically? Effectively pushing a button to start attacking just as his opponents are doing. Let's say it's the early phase of the game, just to keep this abstract. Also let's assume a standard, futuristic setting with no special lore-based elements like psi powers or crystals.

What guidelines or concepts exist which can be used to justify PC superiority in general? In a mathematical sense, do I have to explain -75% damage taken and +300% damage dealt as baseline for all PCs in a credible way? Or is that a silently accepted premise of games in general?

sentences:
How can I blend up to 3 textures on a polygon without blend maps? For my voxel game I need to blend up to 3 textures in the same polygon.
It would be preferable if I could specify a texture id for each vertex, but other solutions are accepted as well.

Here's an illustration of what I want.

How can I achieve this type of blending?

Multi texturing with blend maps is NOT a solution.
Also please notice that there will be a lot of different textures.

sentences: Fire simulation using java and opengl i'm newly working with opengl. I'm trying to create a simple program that will simulate fire. My question is what are the ways other than particle effects to simulate fire. And can fire simulation really be done without particle system effect??

sentences:
OpenGL assets and new OpenGL context So I have a bunch of meshes, materials, etc and then all of a sudden the window needs to be torn down and then recreated (such as switching on fullscreen with GLFW) which means I will get a new OpenGL context and my old OpenGL data is invalid.

What is the best way to reload all my OpenGL assets - do I save all the mesh and material data in system RAM (which is quite a waste isn't it? if you do not recreate the window during the game, it does absolutely nothing for alot of RAM) -OR- do you map the filepaths to all assets, and then re-read from disk when you reload them? (could lead to alot of file i/o)

Or is there a better alternative? What is the best-practice here?

sentences:
Load uncontrolled 3D asset at runtime in Unity I'm trying to load assets at runtime in Unity.
I can load images this way: https://docs.unity3d.com/455/Documentation/ScriptReference/Texture2D.LoadImage.html

But how can I do the same with 3D assets? From what I read, loading .fbx/.obj and alike need importers. But importers are created by users, and support might be bad.

I read you can import using https://docs.unity3d.com/ScriptReference/WWW.html
But that seems only to work with unity3D files

Or do I follow the wrong track? Is there another way to do this?

sentences:
When is it the right time to start teaching collision detection? I and a friend of mine started a game development club in our school two months ago and everything is going well for now. We are following McKesson's tutorials which I find comprehensive and well-built.

We have come to the point where we started making simple prototypes of easy-to-do games, like 3D Pong (not as polished as the referenced version), and soon we are going to finish the second part of the tutorials (the Positioning of objects). We have ideas for prototypes which involve little more complex collision detection and I started wondering is it a good place to look in depth at this topic of game programming? And should I also include the BSP, quadtrees, octrees and other partitioning algorithms with it?

sentences:
Project location to perspective fake 3D view I am trying to implement a perspective view in a 2D soccer game, such like Nintendo World Cup. In this case, the soccer pitch will look like a isosceles trapezoid, but not a rectangle in real.

Here is my solution:

I separate the game logic location and the final rendering location. In the game logic part, the pitch is still a rectangle, so we can make easy collision detection, player area change, out-of-bound checks, goal check, etc.. Just like an answer to Stack Overflow question Implement a projectile motion and collision detection - response in a 2D top-down game said:
Then I just project players', ball's location into final screen location, so that player can fit in pitch (because the exact pitch image is a trapezoid like the screenshot)

I tried to do like that post said, but the result is wired, so I am thinking do I need to make a perspective projection like in a 3D game, but I do not know how. A 3D perspective projection needs to know the camera position, camera angle, near plane, but these do not exist in a 2D game.

How do I solve this problem?

sentences:
Overdrawn pixels vs many polygons, which affects performance the most? I know that having overdrawn pixels is not desirable as well as having many polygons since they can decrease performance.
Often when I model I have an option to decrease the number of polygons by having disconnected polygons over. For example, considering this:
Let's imagine it has more turns that are not visible in this picture.
I can decrease the number of polygons by having a pathway as a single disconnected face:

As a result I would have less poly-count, but the bottom geometry would be overdrawn in many areas.

Or I can model this as a single continuous mesh. As a result I would have more poly-count, but no overdraw:

I very often have similar situations and I'm wondering which of these would be more performance efficient and cause less performance decrease on mobile devices?

sentences:
Parameter 'Blend' doesnt exist I want to animate my character, but i got this error: Parameter 'Blend' doesnt exist.

if i use 1d Blend Type it works fine no bug nothing.

But if i change the Blend type

in the animation panel working fine the animation but if i run the game i get this error: Parameter 'Blend' doesnt exist and my character is freeze in one position what can cause this problem ?

parameters

sentences:
What are some Game Development Publications that accept outside articles What Are some Game Development publications (electronic or otherwise) that aren't so large that there is no chance to potentially get included in the publication after a few well-written articles sent their way.

Looking for publications geared towards developers, not gamers, and can be any aspect of the game process, design, development, business, etc.

sentences:
Convert linear velocity to angular velocity for a ball / sphere (Rolling Ball Maths) I have a ball moving on a flat plane. I cannot use RigidBody physics, so my object in Kinematic and I am manually handling speed/acceleration. The linear movement of the ball is fine, however as the ball does not rotate, it looks odd.

Given a speed Vector3, where I am moving on the X & Z, I need to figure out how to make the ball "roll".

I think I a running into Euler / Gimbal lock issues by trying this:

transform.Rotate(
  180.0f *  speed.z / (Mathf.PI * radius) * dt,
  0,
  -180.0f * speed.x / (Mathf.PI * radius) * dt
);

This formula is loosely based on the angular velocity formula and converting to degree's per second, with dt (deltaTime).

My gut instinct says that the solution may lie in Quaternions somewehere...?!

sentences:
help animating a player in Corona SDK Working on a game in the Corona SDK with Lua and I need help so the player animates on the line drawn. Right now he animates at the beggining and the end but not on the line.

Here is the player code:

function spawnPlayerObject(xPlayerSpawn,yPlayerSpawn,richTurn) --spawns Rich where we need him.
-- riches sprite sheet and all his inital spirites. We need to adjust this so that animations 3-6 are the only ones that animate when moving horizontally
    local richPlayer = sprite.newSpriteSet(richSheet1,1,6)
    sprite.add(richPlayer, "rich", 1,6,500,1)
    rich = sprite.newSprite(richPlayer)
    rich.x = xPlayerSpawn
    rich.y = yPlayerSpawn
    rich:scale(_W*0.0009, _W*0.0009) -- scale is used to adjust the size of the object.
    richDir = richTurn
    rich.rotation = richDir
    rich:prepare("rich")
    rich:play()
    physics.addBody( rich, "static", { friction=1, radius = 15 } ) -- needs a better physics body for collision detection.
end

And here is the code for the line:

function movePlayerOnLine(event)
    --for the original image replace all rich with player.
 if posCount ~= linePart then
    richDir = math.atan2(ractgangle_hit[posCount].y-rich.y,ractgangle_hit[posCount].x-rich.x)*180/math.pi
    playerSpeed = 5
    rich.x = rich.x + math.cos(richDir*math.pi/180)*playerSpeed
    rich.y = rich.y + math.sin(richDir*math.pi/180)*playerSpeed
        if rich.x < ractgangle_hit[posCount].x+playerSpeed*10 and rich.x > ractgangle_hit[posCount].x-playerSpeed*10 then
            if rich.y < ractgangle_hit[posCount].y+playerSpeed*10 and rich.y > ractgangle_hit[posCount].y-playerSpeed*10 then
            posCount = posCount + 1
        end
    end

I don't think anything has changed recently but I have been getting an error when testing of "attempt to upvalue "rich" a nil value" on the second line, richDir = etc.

sentences: Why Change from one coordinate system to another? When dealing with affine transformations, why do we need to change from one frame to another? What are some reasons. What are the pros and cons of doing this and the limitations if this was not possible.(Change of Coordinate Transformations)

sentences:
Create a crosshair openGL How do I draw a white crosshair in the middle of screen in openGL, it's all well and good knowing how to render objects in 3d space, but I have literally no idea on how to draw something that sticks on the screen no matter what

Would this require a shader? one that does not take into account model view projection matrix? at what point would i draw the cross? after everything to coincide with the painters algorithm? Or do I give it a z value?

sentences:
Libgdx : point that scrolls on the edge of a circle I'm not very familiar with libgdx vectors. I want to create my own joystick-controller and I want to know how can I find the coordinates of B by using Vectors. I can calculate the radius and I have the center.

Thank you.

sentences:
How to store the state of the world for a fixed time step? Most of the posts on fixed time steps say something like this:

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;   // note: max frame time to avoid spiral of death
     currentTime = newTime;

     accumulator += frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );

How do they calculate and save a State snapshot of the whole world?  do they just make memcpy's or something?  I'm working in Flash and don't have that kind of cloning capability.

sentences: LWJGL Collision Detection I cannot find LWJGL collision detection with a camera and walls. Like making it to where you can not walk through walls and other different shaped rectangular prisms and cubes. How do I set up LWJGL collision?

sentences:
Physics for curved edges? I'm learning how to program simple two-dimensional games in C++ using SFML, I've done a relatively simple pong game already I would like to ask how I could go about creating the physics for a curved edge such as one on an air hockey table Such as this:

Do I have to code a type of reflection of xVelocity/yVelocity for every single point or what? How do I even add a curved edge such as that in the first place?

sentences:
Canvas enabling is not working I have a canvas with two buttons in it and I want to enable it on the button click, but when I try to enable it, it doesn't work. However, when I try to disable it on button click it does work.
Here is my code:

 public GameObject mycanvas;
  public  void onClick() {
     mycanvas.SetActive(true);
}

Can someone please tell me what I am doing wrong?

sentences: HaxeFlixel, Font gets fuzzy android upscale I made a simple game for android with a small native resolution (320x480). When text gets upscaled it loses its sharpness. Tried having anti aliasing on and off and both results were fuzzy. The size of the text is 16 (read that with some fonts the size should be dividable by 8). Also tried different fonts, but had the same result. Any solutions to that?

sentences:
How does directX API implement supersampling in GUP layer?Does it allocate a scaled-framebuffer other than user-specified framebuffer? For example,if I create a backbuffer of size 800 * 600 and turn on 4x-supersampling, is it the case that the graphics driver actually allocates a backbuffer of size 3200 * 2400 under the hood then downsamples to samller buffer?
PS:3200 calculated from 800 * 4,   2400 calculated from 600 * 4

sentences:
Relational Databases vs XML vs public static finals: Pros and Cons I'm working on a game (single player, metroidvania type, Java) and I'm torn as to how data should be stored. For example, monster stats, dialogues, flavor text for weapons, gear stats... there is all kinds of fixed data that needs to be loaded.

I've tried 3 ways of handling this:

Apache derby database
XML (or JSON or CSV) files
Java classes with a long list of "public static final" Strings/floats

Hands down I love #1 the most, but I wonder if it will affect performance. I hate #2 because it requires a lot more work to organize everything, plus I have to do encryption and remove said encryption when debugging. #3 works fine but feels... unprofessional or sloppy.

I want to hear from someone with experience, since I'm new at this, what are the pros/cons of each, and is there a "best way", for simple single player games?

sentences: Visual studio alternatives for unity as intellisense not working I am new to unity and unity tools for game dev are unavailable in vs community,i also tried vs code.So what are some alternatives for vs for unity scripts for a beginner?

sentences:
Collision detection C++ I'm currently trying to make a small ball-like game in C++. I have two disc-like objects with varying radii. Let's say Disc 1 is on coordinates (100,0) and Disc 2 is on coordinates (400,0). Now Disc 1 has a velocity vector of (300,0) and Disc 2 has a velocity vector of (-300,0). In my program, the Discs just swap places and no collision happens.

Now how do I program in the collisions? Do I have to program my own manual raycasting or something?

sentences:
How can I get started programming OpenGL on Mac OS X? I'm trying to start OpenGL programming on a Mac, which brings me into unknown territory on a lot of things.

During the day, I'm a Web Developer, working in C# and before that in PHP and Delphi, all on Windows.

During the night, I try to pick up Mac/OpenGL skills, but everything is so different. I've been trying to look for some books, but the OpenGL books are usually for iOS (tons of them out there) and the Mac Books usually cover "normal" application Development.

I want to start simple with Pong, Tetris and Wolfenstein.

I see that there are a bunch of different OpenGL Versions out there. I know about OpenGL ES 1&2, but I don't know about the "big" OpenGL Versions - which ones are commonly supported on 10.6 and 10.7 on current (2010/2011) Macs? Are there any up to date (XCode 4) books or tutorials?

I don't want to use a premade Engine like Unity yet - again, I know next to nothing about any Mac development.

sentences:
Default Controller Mapping? It seems like different controllers have their buttons mapped differently. I was wondering if there was some sort of standard. X is the first button, then A, then B, then Y. I looked and couldn't find any standards anywhere.

EDIT: I'm specifically talking about controllers used with computers. Usually with 2 joysticks, a hat, 4 letter buttons, 2 triggers, and 2 bumpers.

sentences:
How to calculate tangents in beam data to fit given trajectory I'm currently trying to create a trajectory effect (in UE 4.25.1) similar to one from the last of us:

I have created a beam with niagara, which lets me determine the starting point of the beam, endpoint and the tangents for both of them:

I am happy with the look of it, but I don't understand the math behind the tangent values. My goal is to make the line overlap the actual trajectory of the projectile (arrow), which is calculated in a BluePrint.
Most examples I found online either just use the Debug-Line from the Predict Projectile Path by Trace Channel, which looks rather bad or they spawn some kind of mesh every x interval on the trajectory line, which is not the kind of indicator I want to create.
Right now, the arrow is being shot from a starting point (bow) with a given velocity and a direction (camera angle). Unreal then calculates the drop of the arrow according to gravity and velocity.
So, the starting position of the beam would be the same as the starting position of the arrow and the angle/rotation would be equal, as well. I can also determine the endpoint for the beam (endposition of the arrow).
However I don't understand how I could calculate the required tangents for the beam to represent the trajectory of the arrow (dropping)? I am new to UE and math is not my strongest point to say the least. Is this even possible with the way I set things up?

sentences:
How to import .obj file from server without using asset bundle in unity3d I want to import .obj file from a server on run time in unity3D, read lot of questions/answers but not able to find a suitable solution.
Using WWW in unity I am able to get .png file and store it in local repository but this thing not works for .obj file.
Following is the code I used to get image from server

public string url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg";
    IEnumerator Start() {
        WWW www = new WWW(url);

        while (!www.isDone)
            yield return www;

        if (www.isDone)
            Debug.LogError ("Done");

        File.WriteAllBytes("C:\\Users\\Admin\\Downloads\\conan\\test1.jpg", www.bytes);
    }

ans similarly I tried to get .obj file but it not works test .obj file created but without any data

public string url = "https://drive.google.com/open?id=0B5_UUyYa_2XdZUpuNlE4Z3pqWUk";
    IEnumerator Start() {
        WWW www = new WWW(url);

        while (!www.isDone)
            yield return www;

        if (www.isDone)
            Debug.LogError ("Done");

        File.WriteAllBytes("C:\\Users\\Admin\\Downloads\\conan\\test.obj", www.bytes);
    }

Kindly give me help in this regard.

sentences:
How can I avoid false positives with "blow" input? I’m working on a game which uses blow functionality to move an object in the game screen.
This screen also has background music in it.

The problem is that the microphone is detecting the BGM as blow input and the object is being moved without any actual user input.

How can I avoid this kind of false positive?

sentences:
Is game development a super elite club? We all read job vacancies via the internet like GitHub jobs or StackExchange Careers 2.0 for example. You know, web app development, iOS/Android jobs and many other things. We even read about jobs ads in Google, Apple or any other big company.

Why don't we read about "Game Developer" vacancies? Is the demand for game developers so low? Or are game developers really rare?

How are companies like EA, Konami or Activision are getting their developers?

How can I overcome this response to an application: "You can't work for us because you don't have experience in developing games." How am I supposed to get experience if I'm not able to work in the field?

sentences:
XNA tiling a sprite with a camera.viewmatrix in the Draw method I'm looking for help fixing a small problem that I have with my XNA game project.

I currently have:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
            null, null, null, null, camera.ViewMatrix);
        spriteBatch.Draw(Stone, TestPosition, Color.White);
        spriteBatch.Draw(Person, playerPosition, Color.White);
        spriteBatch.End();

and

spriteBatch.Begin(SpriteSortMode.Deferred,
              null, SamplerState.LinearWrap, null, null);
        spriteBatch.Draw(Grass, grassPosition,
             new Rectangle(0, 0, Grass.Width * 60, Grass.Height * 1),
             Color.White);
        spriteBatch.Draw(Stone, StonePosition,
             new Rectangle(0, 0, Stone.Width * 60, Stone.Height * 10),
             Color.White);

        spriteBatch.End();

I am looking to combine these two spriteBatch so that the stone and grass in the second spriteBatch will be affected by the viewmatrix.

I have tried:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
                SamplerState.LinearWrap, null, null, null, camera.ViewMatrix);
            spriteBatch.Draw(Grass, grassPosition,
                 new Rectangle(0, 0, Grass.Width * 60, Grass.Height * 1),
                 Color.White);
            spriteBatch.Draw(Stone, StonePosition,
                 new Rectangle(0, 0, Stone.Width * 60, Stone.Height * 10),
                 Color.White);
            spriteBatch.Draw(Stone, TestPosition, Color.White);
            spriteBatch.Draw(Person, playerPosition, Color.White);
            spriteBatch.End();

However when I go to run the code, I get the following error:

XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two.

I hope that someone can help me achieve this,
Thank You.

sentences:
Greedy Meshing : Slow to rebuild when updating chunk I've a problem with my voxel based game. The game is sliced into chunks (Like Minecraft), each chunk is 16x256x16 blocks.
When I started the project, I used a basic culling system when hidden blocks where not sent to the chunk buffer. It was running well, the only problem was my memory usage, even with the culling algorithm, the amount of vertices was incredibly high and it has a real impact on the memory (16x16 chunks loaded -> 2-3go ram in usage).
So I decided to move with the greedy meshing algorithm, after the implementation the memory usage problem was solved (16x16 chunks loaded -> 200-300mo), however a new problem appears and I don't really know how to solve it.

Each time I place/break a block, I need to update the chunk mesh in order to recalculate each vertex position. But greedy algorithm is not as fast as the culling one. So when I place/break a block, the game freezes for less than 0.1ms. I know the greedy meshing algorithm is a slow process, especially with a 16x256x16 sized chunk.

Here's where my greedy algorithm come from :
https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/

So, do you think the problem come from the fact that my greedy algorithm is not optimized ?
Does the greedy algorithm is really necessary ?

Hope one of you can help me !

Thank you guys !

sentences:
Create a stack driven coroutine based state machine for Unity I am working on a game where I am using a coroutine based state machine which is mostly a multi class implementation of this link. I am using it because it allows me to create multi frame sequences.

I wanted to know how would I go about making a stack based machine, so that I can overlay game states such as when I want to pause the game to show a menu i can run a pause menu state pausing the running game state, while still allowing the state objects to be rendered in the background

Here is the code I am using for a state:

public abstract class State {

[Inject]
MonoBehaviour gameObject;

[Inject]
public EventSystem eventSystem;

StateMachine parent;

public State(StateMachine p)
{
    parent = p;
}

public abstract IEnumerator Enter();

public abstract IEnumerator Exit();

public abstract IEnumerator Update();

public IEnumerator Run()
{
    yield return gameObject.StartCoroutine(Enter());
    while(parent.CurrentState.GetType() == GetType())
    {
        yield return gameObject.StartCoroutine (Update ());
    }
    yield return gameObject.StartCoroutine (Exit());
}
}

State machine run function

 State Current //The current state , the one at the top of the stack
 while(Current!=null)
        {
            yield return Component.StartCoroutine(Current.run());
        }

The problem with this approach is as soon as the state machine's current state changes (That is when i push it down the stack adding a new state on top) , the while loop in the Base state class's run method will end and will call the exit coroutine causing the state to end which is undesirable as according to the stack pattern the state should be paused

Moreover as coroutines work in unity, the yield return statement(in the state-machine) wont return until the previous started coroutine exits , which is currently as of now responsible for starting the states .

My question is how do i alter this code so as to pause the previous state (that will be pushed into the stack) instead of exiting it and starting anew state

this implementation works fine if there is to be only a single state in the memory

sentences:
Level editing using a 2D map for a 3D game We're trying to make a level editor for a 3D game that involves walking around outdoor environments. In many ways a heightmap satisfies the game's needs, but it also falls short in several ways, so we're considering various enhancements to the heightmap concept, but it's proving difficult to find a simple solution to this problem.

For a start, a heightmap has great difficulty with sharp edges. As long as everything is smooth a heightmap looks wonderful, but it becomes jagged around vertical cliffs, along the edges of roads, and anywhere the resolution of the heightmap becomes relevant. The obvious solution to these issues is to add a layer of vector drawing on top of the heightmap, so we can preciously define the curves of vertical cliffs and roads, and use this to insert specialized polygons into the terrain's mesh. A vertical cliff can even be a simple gap in the terrain mesh that can be filled by another mesh which allows us to render the cliff face however we like, bypassing the limitations that heighmaps usually have.

Another issue with heightmaps is the difficulty of drawing smooth slopes by hand. For the purposes of the game, terrain should either by a gentle slope or a vertical cliff, so there is no ambiguity over whether the player can traverse through it. We could scan the heightmap to detect overly steep slopes and show an error message, but what we really want to do is give the user drawing tools that will only draw acceptable slopes. But how can this be done?

Perhaps the traditional raster heightmap is causing more problems than it is solving, so an entirely different kind of heightmap is called for. Perhaps instead of adding a vector drawing layer, the whole heightmap was done as a vector image and represented as a set of polygons with each polygon having a certain elevation. This way we get smooth curves automatically, and creating meshes for vertical cliffs and flat land is trivial, but representing slopes in the editor and rendering them becomes a challenge.

We've considered a blending tool that would draw polygons on a second layer, and wherever these blend-polygons appear the underlying terrain polygons would smoothly merge together. Polygons that have shared edges would from a slope perpendicular to those edges at an angle that makes the slope walkable. Unfortunately working out the geometry of the resulting mesh is difficult, and it means that cliffs are the default for every change in elevation.

Since it seems more natural for the user to draw lines to block the player's passage rather than drawing the places where the player can traverse, another approach is to have the user draw the cliff lines in another layer just as with the raster heightmap, but now those cliff lines would act to stop the terrain from smoothing itself into pure rolling hills. Imagine each polygon of the heightmap as a pillar of sand with vertical sides, and when a mesh is formed from the map the sand flows out of its pillars, forming smooth slopes in every direction except where it encounters a cliff line and is forced to flow around. Everywhere except the cliffs need to be a gentle enough slope to walk up, so when there is a gap in a cliff the sand needs to flow through and spread out on the other side. We have some ideas about how this might be done, but it's still a major challenge to implement.

Finally, we could just use a grid with sloped blocks to represent slopes. Editing would be easy, generating the mesh would be easy, all the problems would be solved, but being confined to a grid would surely sacrifice the freedom we'd hoped to have. We don't want to be constrained to being axis aligned unless no other solution is practical.

Ultimately the question is: are there practical ways to implement any of the approaches we're considering, or are we coming at this from entirely the wrong direction?

sentences: How do you remove a tile from a scene in stencyl? I have added tiles to a scene in stencyl. Now I have changed my mind and I can't seem to remove them! What do I click? I don't see the instructions in here.

sentences: Do you need to pay just to put your game as a closed beta on steam? I'm currently working on my game, and we are planning on releasing a closed beta pretty soon. I would like to use Steam to make it, as it has a key generator to give people access, but I can't figure out or find out anywhere if you need to pay for the Steamworks partner, just to make a closed beta.

sentences: Is Font Squirrel for real? I found Font Squirrel, and while it claims to have fonts free for commercial use, i can't find a license or legal pages anywhere. Are these fonts really usable for commecial use like they say?

sentences:
How to create complex Physics scenes with the Havok Content Tools For example, Havok Content Tools allows you to define physic bodies, properties, connections, etc in Maya, 3d Studio Max, etc.

For creating full scenes/levels is this really the correct approach or is there some better way to do things.

sentences:
How can I move a sprite in the direction it is facing? I'm using Java/Slick 2D. I'm trying to use the mouse to rotate the sprite and the arrow keys to move the sprite. I can get the sprite to rotate no problem, but I cannot get it to move in the direction it is supposed to. When I hit "forwards", the sprite doesn't necessarily move towards the mouse. Actually, it will only move towards the left of the screen really. I'm sure there has to be some standard code for this since many games use this style of motion. Can anyone help me out with what the trig is supposed to be? Thanks

EDIT: Here is the rotation code (which does something else weird: https://stackoverflow.com/questions/12610320/why-is-my-image-rotating-off-center)

int mX = Mouse.getX();
        int mY = HEIGHT - Mouse.getY();
        int pX = sprite.x;
        int pY = sprite.y;
        int tempY, tempX;
        double mAng, pAng = sprite.angle;
        double angRotate=0;

        if(mX!=pX){
            mAng = Math.toDegrees(Math.atan2(mY - pY, mX - pX));
            if(mAng==0 && mX<=pX)
                mAng=180;
        }
        else{
            if(mY>pY)
                mAng=90;
            else
                mAng=270;
        }

        sprite.angle = mAng;
        sprite.image.setRotation((float) mAng);

And the movement code. I can only move towards the left of the screen...

double ang = sprite.angle;
            Input input = gc.getInput();

            if(input.isKeyDown(sprite.up)){
                sprite.x += Math.cos(ang)*sprite.moveSpeed;
                sprite.y += Math.sin(ang)*sprite.moveSpeed;
            }if (input.isKeyDown(sprite.down)){
                sprite.x += -1*Math.cos(ang*Math.PI/180)*sprite.moveSpeed;
                sprite.y += -1*Math.sin(ang*Math.PI/180)*sprite.moveSpeed;
            }if (input.isKeyDown(sprite.left)){
                sprite.x -= Math.cos(ang*Math.PI/180)*sprite.moveSpeed;
                sprite.y += Math.sin(ang*Math.PI/180)*sprite.moveSpeed;
            }if (input.isKeyDown(sprite.right)){
                sprite.x += Math.cos(ang*Math.PI/180)*sprite.moveSpeed;
                sprite.y -= Math.sin(ang*Math.PI/180)*sprite.moveSpeed;
            }

sentences:
How do I get the GUI to draw above the kinematic bodies when their z_index is changed? Currently the Labels in the GUI are below the player and other objects, so the player appears above them.
How can this be fixed?

extends Node
var load_1 = true

    onready var level = preload("res://scenes/levels/Level.tscn")

    var Level = null

    func _ready():
        Level = level.instance()

        add_child(Level)
        move_child(Level, 0)
        VisualServer.canvas_item_set_z_index($GUI/Label3, 4000)
        print("I'm here")

    func _process(delta):
        getallnodes(self)
        pass

    func set_z_index(node):
        for N in node.get_children():
            if N.get_class() == "KinematicBody2D":
                N.z_index = N.position.y

    func getallnodes(node):
        for N in node.get_children():
            if N.get_child_count() > 0 and N.get_class() != "RigidBody2D" and N.get_class() != "KinematicBody2D" and N.get_class() != "StaticBody2D":
                getallnodes(N)
            else:

                if N.get_class() == "KinematicBody2D" or N.get_class() == "RigidBody2D":
                    setZOrder_kine(N)
                    print("- "+N.get_name())
                if N.get_class() == "StaticBody2D":
                    setZOrder_kine(N)
                    print("- "+N.get_name())
                elif N.get_class() == "Sprite":
                    setZOrder(N)
                    print("- "+N.get_name())

    func setZOrder_kine(node):
        for N in node.get_children():
            if N.get_class() == "Sprite":
                var myPos = N.get_global_transform().get_origin()
                var mySize = N.get_texture().get_height()
                var bottomOfSprite = (mySize*N.get_scale().y * N.get_parent().get_scale().y)/(2 * N.vframes)
                N.get_parent().z_index = (myPos.y+bottomOfSprite)

    func setZOrder(N):
        var myPos = N.get_global_transform().get_origin()
        var mySize = N.get_texture().get_height()
        var bottomOfSprite = (mySize*N.get_scale().y)/(2 * N.vframes)
        N.z_index = (myPos.y+bottomOfSprite)

    func _physics_process(delta):

        if(Level.get_node("Player")):

            $GUI/Label.text = "Velocity: " + str(Level.get_node("Player").velocity.length()) + ", " + str(Level.get_node("Player").velocity.x) + ", " + str( Level.get_node("Player").velocity.y)
            $GUI/Label2.text = "Position: " + str(Level.get_node("Player").position.x) + ", " + str(Level.get_node("Player").position.y) + ", " + str(Level.get_node("Player").z_index)
            $GUI/Label3.text = "Sword: " + "rotation " + str(Level.get_node("Player").rotation)
            $GUI/Label4.text = "stamina" + str(Level.get_node("Player").stam.current) + "attack_charge: " + str(Level.get_node("Player").stab.charge.current) + "countdown: " + str(Level.get_node("Player").stab_countdown[0]) + "cooldown: " + str(Level.get_node("Player").stab_cooldown[0])

sentences:
Lots of bouncing balls sink into each other I'm trying to model a system that simulates an arbitrary number of bouncing balls with some gravity. So far I've come up with a solution that can be seen here: https://github.com/ahahalol/BouncingBalls

It works fine if the number of balls is small (a few dozens) or if I do not set any gravity. But once I turn gravity on and set the number of balls to a few hundreds, the balls "on the bottom" start sinking into each other over time as new balls fall on them "from the top".

Here's a picture that shows lots of sinking balls when I have gravity and hundreds of balls:

I want a system that perfectly simulates rigid balls physics: no matter how many objects "on top" push the ones "on bottom", nothing should ever sink. How can I achieve this?

sentences:
Make a platform appear and disappear constantly I am building a platformer. In this game, I need one of my platforms to constantly activate and deactivate.

Here is how I have tried to code this so far, but it causes Unity to freeze:

void Update(){
    for (i = 0; i <= 2; i++) {
        platform.SetActive (false);
        if (i >= 1 ) {
            i--;
            platform.SetActive (true);
        }
    }
}

sentences:
Figuring out if two objects overlap on screen I want to figure out if 2 3D models overlap on screen. My general idea is:

Compute the bounding box of each model
Transform the bounding box to the View Volume using the ViewProjection matrix
Check if bounding boxes overlap in the view volume, ignoring the Z-axis

For step 1 I've used the answer to this question. But I'm having problems implementing step two.

I wrote the function below but its giving me inconsistent results. The numbers seem good for corners that fall inside the view volume (after multiplying by the ViewProjection matrix). But if an object falls off the screen the numbers seem incorrect. What am I doing wrong?

public static BoundingRectangle ProjectBoundingBox(BoundingBox box, Matrix viewProjection)
{
    var minX = float.MaxValue;
    var maxX = float.MinValue;

    var minY = float.MaxValue;
    var maxY = float.MinValue;

    var corners = box.GetCorners();

    foreach (var corner in corners)
    {
        var projectedCorner = Vector4.Transform(corner, viewProjection);
        projectedCorner /= projectedCorner.W;

        minX = Math.Min(minX, projectedCorner.X);
        maxX = Math.Max(maxX, projectedCorner.X);

        minY = Math.Min(minY, projectedCorner.Y);
        maxY = Math.Max(maxY, projectedCorner.Y);
    }

    return new BoundingRectangle(minX, maxX, minY, maxY);
}

Edit: the numbers

If you see the attached screenshot you see two semi-transparent stained glass windows.

Fully visible window:
    Bounding Box: Min( -43.62131  25.6  -10.32131 ), Max( -37.38873  34.4  -4.08873 )
    Projected Coordinates: Min(-0.7539723,-0.5401732), Max(-0.2793865, 0.27869606)

Partially visible window:
    Bounding Box: Min( -40.5142  25.6  -1.2 )  Max( -40.5  34.4  7.6 )
    Projected Coordinates: Min(-32.07214, -23.4672337), Max(47.5241241, 0.334790081)

As you can see the projected coordinates for the only partially visible window are gigantic. I would expect MaxX to be something like -0.9 and MinX maybe -5. But the numbers are way off.

The culprit seems to be some of the corners of the bounding box. For example (-40.5142  34.4  7.6) is transformed to (47.52412  -12.65482  1.539964). What is interesting here is that the W coordinate is negative and less than 1  (-0.18), while for the corners that do seem correct w is positive and larger than 1.0.

Edit #2:

Here's a second picture where I've added a visualization of the projected rectangle. On the left you see the exact scenario where it goes wrong. The right side of the rectangle for the partially visible window is incorrect, while if I slightly wiggle the camera either way you get the result on the right with the correct rectangles around the models.

sentences:
Using a switch command in one shader vs multiple shaders If you have multiple shaders, could you instead of switching between shaders all the time just have one shader with a switch and each case will send you along to another shader function which you require for that specific object? ( And  you would send an enumerated value through your constant buffer for that specific object)

I guess the real question is. What would take up the most performance, the switch or the switching between shaders?

Example:

BigShader(){
   switch(a){
      case 0 :
        { return transPSShader();}
      case 1:
        { return nonTransPSShader();}
ect.
}

sentences:
Calculating other objects based on the transform of another What I want to do is create my graphics to be independent of the game framework. So basically the graphics won't know anything until it is told where things are. so the thought was that every GameObject would hold its own transform like here, but then I would also want to calculate the camera, and say a directional light based on these as well.

My thought was to in an update method:

receive a container of objects,
step through them to get the needed data to be rendered (full transform matrix, and enums resulting in model to be rendered, and texture/material to be applied)

3.0 put that data into something like a stack.
3.1. when the player object is found calculate the position of the camera behind/above the player at a determined downward angle, and a directional light in front of the player at the same orientation.

4.in the render method pop the information off the stack to be rendered to the screen.
5.possibly using the frustum of the camera to ignore some objects (can be overlooked)

I have gotten steps 1, 3.0 and 4 completely working, step 2 I can get the enums out, but I still don't know how to apply the transform matrix to be usable (answers to above link would be greatly appreciated), and then 3.1 is a total mystery to me. as stated 5 would be nice, but can be overlooked if not possible (formatting edit requested)

sentences:
GetPixel() doesn't return properly the values So I'm trying to use GetPixel() function to get which colors is the texture as a value of x and y. So far it works well but it only return 1 color, being unable to get the rest of the colors of the copied texture.

Let's consider this texture, my one is quite similar, I'll update as soon as I can. But it will work as example, basically, GetPixel() is only returning the red value while the rest are like doesn't exist at all. I leave here the code:
EDITED CODE

public Texture2D oldTexture = GetDistortedGradient(1f);

public Texture2D GetTexture(){
   var texture = new Texture2D(width, height);
   var pixels = new Color[width * height];

   for(var x = 0; x < width; x++){
      for(var y = 0; y < height; y++){
         Color newPixels = oldTexture.GetPixel(x, y);

         if(newPixels == hotest){
            pixels[x + y * width] = Color.red;
         }
         else if (newPixels == coldest){
            pixels[x + y * width] = Color.blue;
         }
         else{
            pixels[x + y * width] = Color.white;
         }
      }
   }

   texture.SetPixels(pixels);
   texture.Apply();

   return texture;
}

What I'm trying to do is whenever that texture is "color1" set the new texture as a red color on the specified x and y coordinate, then check again and if the texture is "color2" on the news x and y, set to blue, and so on.
However, this is only returning color1 for the correctly x, y coordinates and after that it jumps to the else function, like if color2 never existed on the old texture.
Btw, as this is an example, the oldTexture is generated procedurally but the colors are set in the inspector, so I just take the color I've set, but i don't why it only keep returning 1 of many colors, when basically it check for all colors.
Am I missing anything or am I not understanding GetPixel() function and how it work? Any help will be appreciated!

UPDATED WITH OLDTEXTURE CODE

public Texture2D GetDistortedGradient(float noiseStrength)
{
    var texture = new Texture2D(heatMap.Width, heatMap.Height);
    var pixels = new Color[heatMap.Width * heatMap.Height];
    for (var x = 0; x < heatMap.Width; x++)
    {
        for (var y = 0; y < heatMap.Height; y++)
        {
             float noise = GetNoise(x, y);
             int shift = Mathf.RoundToInt(noise * noiseStrength);
             pixels[x + y * heatMap.Width] = GetGradientColor(x, y + shift);
        }
    }

    //And apply texture ofc
}

//And here the colors to get

Color GetGradientColor(int x, int y) {
if (y <= southPoleCap || y >= northPoleCap)
    return coldest;
else if (y > southPoleCap && y <= southArcticCap || y < northPoleCap && y >= northArcticCap)
    return colder;
else if (y > southArcticCap && y <= southArcticOuter || y < northArcticCap && y >= northArcticOuter)
    return cold;
else if (y > southArcticOuter && y <= southMiddleOuter || y < northArcticOuter && y >= northMiddleOuter)
    return template;
else if (y > southMiddleOuter && y <= southTropic || y < northMiddleOuter && y >= northTropic)
    return hot;
else if (y > southTropic && y <= southMiddleInner || y >= northMiddleInner && y < northTropic)
    return hotter;
else
    return hottest;
}

I'm not at home right now, so I can't give the new code I've got for that, but that's the proper base, just few really small changes
So, once the GetDistortedGradient texture is done, it should go to the GetTexture and create based on whatever colors there's on the distorted texture

sentences:
What are the pros/cons of using a 3d engine for 2d games? What pros or cons should a beginner be aware of when deciding between a 2d game engine (like Slick2D/Flixel/FlashPunk) and a 3d engine (like Unity) for 2d game development?

I am just getting started in indie game development, though I have dabbled a bit with Game Maker, Flash, and XNA in the past. I've heard a lot of positive things about Unity, and its cross-platform nature makes it appealing, but as I understand, it's a 3d engine at its core.

For a strictly 2d game, are there any compelling reasons to work with a 3d engine like Unity? Or would it just add unneeded complexity to my initial learning experience?

sentences:
FIx color banding in unity I create archviz in oculus using unity. I didn't use any texture, just simple solid white color. But inside the room there is gradient from light to dark where i can see the color banding. i'm using baked GI and a single directional light. This banding effect is visible in 3d scene window and when i run on oculus as well.
What setting do i have to modify to fix it ?

sentences: How to follow a car with correct rotation I am making a game where car will follow a user car. I am moving use car using keyboard keys it is working fine running on my game environment roads smoothly. To follow enemy car i am using nevMesh, it correctly following but the following car/enemey car rotation is not correct. I am surprise that how do i control it? or is there any other way to acheive this thing

sentences:
2D map/plane with nodes overlayed that supports panning, scaling and clicking on nodes I'm trying my hand at Android development and seem to be running into an invisible ceiling in trying to get what I want accomplished. Basically I'm trying to create an app that renders a 2D surface map that I can (pinch) zoom and pan. I'll have to place nodes on the surface of the map that will scale/zoom and pan in relation to the surface.

I started out with a 2D ImageView approach and got as far as pinch zoom, pan and laying nodes as relative ImageViews, but all the methods I tried to get X,Y,W,H for the 2D surface were always off for some reason. Additionally, I was never able to scale the node ImageViews correctly, and as a result never got far enough to try and work out their X,Y scaled offset.

So I decided to get back to 3D rendering. Conceptually pan/zoom is camera manipulation, so I don't have to mess with how to scale the 2D map or the nodes. But I need a starting point or sample to get me going that's close to what I'm trying to achieve. A sample on a translucent spinning cube isn't helping as much as I need it to.

Any tips? Links, insults and sympathy are all welcome!

sentences:
LibgGDX drawing two separate Textures in FrameBuffer So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the TextureRegions originate from the same Texture object/file but as soon as I try to combine TextureRegions with different textures of origin, only the TextureRegions from one texture file are drawn. The TextureRegions with different textures of origin do not get drawn.

For example I have two textures:

Texture tex1 = new Texture(path to texture 1);
Texture tex2 = new Texture(path to texture 2);

TextureRegion reg1a = new TextureRegion(region from tex1);
TextureRegion reg2a = new TextureRegion(region from tex2);

TextureRegion reg1b = new TextureRegion(another region from tex1);

I set up my FrameBuffer like this:

buffer = new FrameBuffer(Pixmap.Format.RGBA8888, WIDTH, HEIGHT, true);

In my draw method I do the following:

buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg2a, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

Using the above draw method, ONLY reg2 is drawn. reg1 does not show up at all.

buffer.begin();
batch.draw(reg1a, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

Using this draw method reg1 IS drawn, so there is nothing wrong with the textures.

buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg1b, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

This draw method renders BOTH reg1a and reg1b because they both come from the same Texture object/file.

What I want to be able to do is draw to TextureRegions from different Texture objects in the same FrameBuffer and have them both show up.

I have tried having everything from one Texture in one FrameBuffer, and the other in another FrameBuffer, then drawing those two FrameBuffers into a new FrameBuffer, but that produces the same problem.

Any help would be greatly appreciated!

sentences:
Sprites on scrolling tmx map (LibGDX) I have .tmx map loaded, and a camera to see it. The map is bigger than the camera viewport, so I need to move that viewport scrolling the camera.
Now I want to draw a sprite on the map. To do that, at the beginning I used the batch.draw() method, trying to calculate the position relative to the camera, but it didn't worked. After that I found that I could add this line:

batch.setProjectionMatrix(camera.combined);

using an Sprite class to draw my object. Howevert, it won't draw on screen; I don't know why.
Here's my code:

MOVING CAMERA:

private void controlCamera()
    {
        if (Gdx.input.isKeyPressed(Keys.RIGHT) && camera.position.x <= mapPixelWidth + camera.viewportWidth/2)
        {
            camera.position.x += mapSpeed;
        }
        else if (Gdx.input.isKeyPressed(Keys.LEFT) && camera.position.x > camera.viewportWidth/2)
        {
            camera.position.x -= mapSpeed;
        }
        else if (Gdx.input.isKeyPressed(Keys.UP) && camera.position.y <= mapPixelHeight + camera.viewportHeight)
        {
            camera.position.y += mapSpeed;
        }
        else if (Gdx.input.isKeyPressed(Keys.DOWN) && camera.position.y > camera.viewportHeight/2)
        {
            camera.position.y -= mapSpeed;
        }
    }

Note that I'm moving the camera between viewport/2 and viewport/2 + map size, since the left down corner is situated at (viewportWidth/2, viewportHeight/2). That's the default position where my .tmx map is drawn.

SPRITE RENDER METHOD:

public void render(SpriteBatch batch, float stateTime)
    {
        currentFrame = anim.getKeyFrame(stateTime, true);
        sprite.setPosition(getDrawCoords().x, getDrawCoords().y);
        sprite.setSize(currentFrame.getTexture().getWidth()/2, currentFrame.getTexture().getHeight());
        sprite.setRegion(currentFrame);
        sprite.draw(batch);
    }

GETDRAWCOORDS METHOD:

public Vector2 getDrawCoords()
{
    int x =  (int) (map.camera.viewportWidth/2 + map.tilePixelWidth * xMap);
    int y = (int) (map.camera.viewportHeight/2 + map.tilePixelHeight * yMap);
    return new Vector2(x,y);
}

I really don't know if I wrote the sprite.setPosition correctly. I tried with lots of things but it never get drawn.

MAIN CLASS RENDER METHOD:

public void render() {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        map.update(); //Include camera mov
        stateTime += Gdx.graphics.getDeltaTime();
        map.render(); //draw the map. Include camera.update()
        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        units.get(0).render(batch, stateTime); //render my unit
        batch.end();

    }

Using a batch.draw() with the texture draw well the sprite in the initial position, but when I try to move the camera it goes crazy. I tried to write the vector position in terms of the other vector, but it doesn't work, and I'm pretty sure of my vector calculus. I'm trying with the sprite and using the projection matrix because I read it give a position relative to camera, but now I can't get my sprite drawn.

Any help is appreciated. Thank you!

sentences:
How are the scripts connecting? I been following the playlist in brackeys for unity for beginners and it gets a little fast and complicated at the end and just curious about if a script makes a reference like:

FindObjectOfType<GameManager>().EndGame();

With GameManager being a empty and EndGame being a function to another script.

It runs it but does it connect to the script through the GameManager object since it's connected to the script?

I just want to know how it's getting to the script function and that is the only mention of GameManager in the whole script.

sentences:
Additive Scene Loading Buttons not Becoming 'Active' I'm quite new to Unity but I'm making a game, and have created a simple Pause menu, when a key is pressed (escape), I just load a Pause scene, additively, and set that Pause scene to the active scene, however, only the buttons on the previous 'game' scene are interactive.
The mouseEnter, exit etc aren't triggering on the pause menu buttons, despite the pause menu being overlayed on top of the 'game' scene; the Pause scene being the active one and the 'game' scene buttons are still the interactive ones (i.e. register clicks, mouse overs etc).
Obviously when I open the pause menu, I want the pause menu buttons to be the interactive ones (registering clicks, mouse over etc), not the previous 'game' scene buttons.
The pause menu scene interacts perfectly when loaded additively with a scene that had no buttons.
Many thanks.

sentences: Hiding pixels inside a Shape I have a player wich is a png image and I want a part of him to be able to go behind things, so I need to know how to hide pixels that are inside of a shape

sentences:
Unity - Easier way to resize group of buttons to the same size I have a canvas with buttons, with a script attached to each button. This script creates an array for buttons and resizes every button to the same size as the longest one in that array (the button with the longest line of text in it). Everything works, but I was wondering: is there is an easier, more automatic way for this instead of having to drag every button in every array in the Inspector tab?

Any ideas would be greatly appreciated

UnityPackage: https://transfer.sh/6BCDG/buttonwidth.unitypackage

public Image[] otherbutton;

void Start () {

    for(int i = 0; i < otherbutton.Length; i++)
    {

        if (otherbutton[i].rectTransform.sizeDelta.x > gameObject.GetComponent<Image>().rectTransform.sizeDelta.x)
        {
            gameObject.GetComponent<ContentSizeFitter> ().enabled = false;

            gameObject.GetComponent<Image>().rectTransform.sizeDelta = new Vector2( otherbutton[i].rectTransform.sizeDelta.x, otherbutton[i].rectTransform.sizeDelta.y);

        }
    }
}

sentences:
How to simulate early politics? I'm making a historically accurate game where the player can interact with past times and shape the future. The entire game is scientifically generated with math and real physics. (no, it won't have dragons! lol) The game will run real time and simulate the entire Earth (at first, then at level 56 the player unlocks universe mode where the whole universe is simulated). The player can build anything they want and it will use physics to simulate each creation based on the materials it's made of. Like they could build a rocket with solid fuel and it will launch realistically, as long as they shaped the nozzle correctly.

Anyway, I'm at the point where I'm simulating the dinosaurs and I want to make it accurate. I know we can't know exactly what the political structure of the dinosaurs was since most of the writings were destroyed in the comet strike, but most people know that our political system is based off theirs.

I was considering just modeling our political system and then applying mathematical regression to the algorithm to regress it 100 million years. However, I'm worried about the limitations of floating point numbers and I think that errors will compound. That would leave me with a political system that's really inaccurate.  What strategies can I use to develop a political system from scratch?

P.S.
I'm mostly talking about American dinosaurs, because they had the most impact on world politics.

sentences:
A motion blur technique which can cover curve movement path? I am looking for a motion blur technique for real-time games.

I know two techniques, velocity map and accumulation buffer. Velocity map shows very good quality, but doesn't work correctly if objects are moving along curvy path. Accumulating frame-buffer does work, but consumes too much power to get acceptable quality.

Is there any other motion blur technique which can cover this situation?

sentences:
Show only some parts of a point cloud. OpenGl4 I am developing an opengl 4.0 app which is showing a point cloud. In the other hand, I have an array "pos" where I have some x,y,z positions:

pos[number of pos][3] , where 3 refers to [0]:x [1]:y [2]:z

I would like to show only the points of the point cloud which are inside of a sphere of radius R for any of the positions I have in the array pos. I was thinking in sending the array pos to the vertex shader that draws my cloud point and there, do a loop for each position and check if the distance between any of the positions and the vertex is less than a radius R. If so, I put an alpha colour of 1.0. If not, an alpha colour of 0. Something like:

Vertex:

#version 460

uniform mat4 viewMatrix, projMatrix;
uniform float Radius;

in vec4 position;
in vec3 pos[N];

in vec3 color;

float d;

out float Color;
out float AlphaC;

void main()
{
    Color = color;
    AlphaC = 0.0;

    for ( int i = 0; i < pos[i].length; i++ ) {
        d = distance(vec4(pos[i],1),position);
        if (d<Radius) {
            AlphaC = 1.0;
            break;
        }
    }

    gl_Position = projMatrix * viewMatrix * position ;
}

Fragment:

#version 460

in float Color;
in float AlphaC;

out vec4 outColor;

void main()
{
    outColor = vec4(Color, AlphaC);
}

But I am not sure how to send this pos array since this matrix is an Nx3 with N depending in the file of positions that I am using. Any idea? Does N has to be defined before compiling?

sentences:
Multiplayer game server headerless (Unreal/Unity) vs Custom Maps I've been pondering about different approaches that a multiplayer game server can be managed and programmed.

For instance some of the big engines like UE4 & Unity provide a 'build' flag that can enable them to run headless meaning it'll just be the calculations that are enabled for that mode and will handle a ton of the game state sync, object references, hit detection, cool downs etc..But what I'm wondering is if this is the best approach? From my current understanding for each game running there would need to be a new instance of the headless game.exe running that will then create new connections for users into the game, sync up the players and start. This sounds very resource heavy (I might be overthinking it).

EDIT:
In the case of custom game server what would be a good approach into integrating the map data so that UE4 client map can be simulated on the back-end?

I can think of a simple solution looking at it from a 2D prospective, since it's just X,Y we can create a bitmap/grid of position that are available, where walls are etc via simple tile tools that can be easily mapped 1:1 to the client and use that information. However when it comes to 3D I don't see a solution on how to have a 3D map, collision detection and physics simulation.

sentences:
What tools do you use for 2D art/sprite creation? What cheap/free tools do you use for 2D art and/or animation?

I don't really like Gimp's interface, Paint.NET is limited and GraphicsGale is sort of archaic. Cosmigo ProMotion looks like it could be good, anyone use it? Seems a bit pricey at $78/92 but of course cheaper than Photoshop.

I used to like Jasc Paint Shop Pro 7, but the newer versions Corel makes are more for photos.

2D Bones support would be handy also.

sentences:
Why is concept art not signed by the author? I am a starting concept artist who would like to enter the gaming industry. I noticed that some AAA titles show their concept art with no artists signature (only a reference to game the game, such as for Star Wars The Old Republic: 2013 ALL RIGHTS RESERVED BioWare, LucasArts).

I  asked myself a question, what possible harm could my autograph cause on the public concept art if I am not a well known concept artist such as Adam Adamowicz (who did concepts for Skyrim). Why would a prospective boss tells me not to leave my "finger print" on the picture despite, the fact that I am a very talented artist?

sentences:
Converting world space coordinate to screen space coordinate and getting incorrect range of values I'm attempting to convert from world space coordinates to screen space coordinates.

I have the following code to transform my object position

Vector3 screenSpacePoint = Vector3.Transform(object.WorldPosition, camera.ViewProjectionMatrix);

The value does not appear to be in screen space coordinates and is not limited to a [-1, 1] range.

What step have I missed out in the conversion process?

EDIT:

Projection Matrix

Perspective(game.GraphicsDevice.Viewport.AspectRatio, nearClipPlaneZ, farClipPlaneZ);

    private void Perspective(float aspect_Ratio, float z_NearClipPlane, float z_FarClipPlane)
    {
        nearClipPlaneZ = z_NearClipPlane;
        farClipPlaneZ = z_FarClipPlane;

        float yZoom = 1f / (float)Math.Tan(fov * 0.5f);
        float xZoom = yZoom / aspect_Ratio;

        matrix_Projection.M11 = xZoom;
        matrix_Projection.M12 = 0f;
        matrix_Projection.M13 = 0f;
        matrix_Projection.M14 = 0f;

        matrix_Projection.M21 = 0f;
        matrix_Projection.M22 = yZoom;
        matrix_Projection.M23 = 0f;
        matrix_Projection.M24 = 0f;

        matrix_Projection.M31 = 0f;
        matrix_Projection.M32 = 0f;
        matrix_Projection.M33 = z_FarClipPlane / (nearClipPlaneZ - farClipPlaneZ);
        matrix_Projection.M34 = -1f;

        matrix_Projection.M41 = 0f;
        matrix_Projection.M42 = 0f;
        matrix_Projection.M43 = (nearClipPlaneZ * farClipPlaneZ) / (nearClipPlaneZ - farClipPlaneZ);
        matrix_Projection.M44 = 0f;
    }

View Matrix

        // Make our view matrix
        Matrix.CreateFromQuaternion(ref orientation, out matrix_View);

        matrix_View.M41 = -Vector3.Dot(Right, position);
        matrix_View.M42 = -Vector3.Dot(Up, position);
        matrix_View.M43 = Vector3.Dot(Forward, position);
        matrix_View.M44 = 1f;

        // Create the combined view-projection matrix
        Matrix.Multiply(ref matrix_View, ref matrix_Projection, out matrix_ViewProj);

        // Update the bounding frustum
        boundingFrustum.SetMatrix(matrix_ViewProj);

sentences:
Calculate the intersection depth between a rectangle and a right triangle I'm working on a 2D platformer built in C#/XNA, and I'm having a lot of problems calculating the intersection depth between a standard rectangle (used for sprites) and a right triangle (used for sloping tiles).  Ideally, the rectangle will collide with the solid edges of the triangle, and its bottom-center point will collide with the sloped edge.

I've been fighting with this for a couple of days now, and I can't make sense of it.  So far, the method detects intersections (somewhat), but it reports wildly wrong depths.  How does one properly calculate the depth?  Is there something I'm missing?

sentences:
Unity: How to draw 2D lines directly on a UI canvas? The title pretty much tells my issue. I want to simply draw a few lines from a script controlled by start- and endpoint coordinates directly on the UI canvas (so the lines will move at runtime).
From what I could read up so far, there are these options:

LineRenderer:

Works in 3D space. Since I want this on the UI it seems a bit overkill and also to performance hungry for such a simple task. Further, I will have to add a virtual camera and calculate the positions in 3D space (no problems with that part). My data model represents the positions in 2D Pixel coordinates, it would be quite a lot simpler to directly use those coordinates to place the lines on the screen.

GL.Line():

Also works in 3D space, furthermore there is no freedom in terms of line thickness.

Asset Store:

I tried out a ui-extension package briefly, however it left me with several warnings not connected to the actual functions I used. However if someone knows a lightweight asset, I'm happy to test!

It kind of baffles me that there is nothing provided in Unity for something seemingly so easy. Or am I missing something fundamental here?

sentences:
Scaling/Zooming a SpriteBatch I am working on my first game with LibGDX and coming from ActionScript3 I am used with the possibility of scaling things more or less the way I want. I know it works different in LibGDX, but I can't seem to figure out exactly how to achieve what I am trying to do.

I have a camera set up (OrthographicCamera), a SpriteBatch where I render different items(textures) and what I want is to be able to scale and move a group of items, while the rest remain intact. I know that I can zoom the camera itself, but this applies to all the elements int he SpriteBatch.

If you worked with ActionScript before, imagine you have the stage (this is my SpriteBatch) where I render different DisplayObject. Some DisplayObjects have other DisplayObjects inside. I calculate these offsets (item.x is parent.x + offsetInParent). Now what I want is to be able to scale one such DisplayObject with ease.

Thanks.

sentences:
Basic AI FSM - Handling state transition I'm starting to study on how to implement game AI, and it seems to me that a very simple FSM for my Pong demo would be a nice way to start.

My vision on implementing this would be to have a basic state interface and a class for each state, then the NPC would have an instance of the current state. The class should have an update method and directions on wich state to go next, depending on the event received.

The question is: How do I handle this event? Should I have a regular addEventListener and a costum event system? Or should I check on update for the things that could change the current state?

I'm feeling a bit lost, I feel I have a good grasp on the FSM concept but a good implementation seems tricky, thanks in advance.

sentences:
GLSL - one-pass gaussian blur It is possible to implement fragment shader to do one-pass gaussian blur?
I have found lot of implementation of two-pass blur (gaussian and box blur):

http://callumhay.blogspot.com/2010/09/gaussian-blur-shader-glsl.html
http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
http://www.geeks3d.com/20100909/shader-library-gaussian-blur-post-processing-filter-in-glsl/

and so on.

I have been thinking of implementing gaussian blur as convolution (in fact, it is the convolution, the examples above are just aproximations):

http://en.wikipedia.org/wiki/Gaussian_blur

sentences:
Do I need to be careful about PPU and Camera size and Device Resolution even if I'm not creaing a pixel art 2d game? I was reading this blog post
https://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/
and was wondering if I need to be super careful about those numbers, although my game's art is not pixel art.

sentences:
Mafia kill algorithm I'm making an Omerta clone/mafia game and trying to work out a kill algorithm. Just a basic formula to decide how many bullets player A needs to kill player B.

The inputs are: players rank (out of 10), and a players kill skill (out of 100). The algorithm needs to return how many bullets are needed for that player to win.

If you're shooting someone a higher rank, or higher kill skill, it should require more bullets.

Anyone ever done anything like this and can offer some tips?

Example chart:

sentences:
Image effect console error I have imported image effects from asset store in my project.
When imported, I've got 5 error messages :

Assets/Standard Assets/Effects/TonemappingColorGrading/Editor/TonemappingColorGradingEditor.cs(370,134): warning CS0618: `UnityEditor.TextureImporterFormat.AutomaticTruecolor' is obsolete: `Use textureCompression property instead'

What to do ?

sentences:
How to debug pyglet/opengl bus errors I'm using pyglet for game development, and sometimes encounter "bus errors". They are not consistently repeatable, and whenever I try to do simple debugging (eg move/remove variables, etc), the errors will eventually disappear entirely. I feel like I am encountering the notorious "heisenbug" class of errors.

Intuitively, I feel like the problem is likely due to pyglet/opengl/video card interaction, but of course this is only a hunch. So my question is: how do I debug this kind of problem?

sentences:
if rotation  -140 issue I have a problem with this if statement.

If the rotation is < -45. And > -140

Then this statement would be true when the rotation is = -90?

And it would be false if the rotation is = -170?

I'm using the negative values because unity rotation goes from -180 to +180.

I tried using a full 360 scale, that also didnt work.
that Statement looked like:

if the rotation is > 245 & < 325

Then do stuff

If you can change where the 0 value of the rotation is from the West point to a different one would also be a useful option

Thanks for any help

Code that is being executed:

        if (transform.rotation.z > -140 && transform.rotation.z < -45)
    {
        if(rotationSpeed < 150f)
        {
            rotationSpeed += 150f * Time.deltaTime;
        } else
        {
            rotationSpeed = 150f;
        }
        print("135");

    } else
    {
        if(rotationSpeed > 70f)
        {
            rotationSpeed -= 150f * Time.deltaTime;
        } else
        {
            rotationSpeed = 70f;
        }
        print("246");
    }

sentences:
Texturing issues in cry engine sdk Sup?

I've been working on a new environment scene inside 3ds max. It looks something like this -

When I used the cry engine exporter to export my assets onto my level, I've been getting very weird shadow/texture problems. Do any of you know why that's happening? I'm pretty new to all of this, especially cry engine. Here's a screenshot of the same environment inside of cry engine sdk. If you look to the left of the environment, you can see how I'm getting weird results. The area I'm having issues with is highlighted with a faint blue line.

sentences:
What architecture should I use to support extensions in my game? What is the proper architecture for the game, that support extension modules, written in other languages?

I mean I have a simple game - written in Groovy (basically Java), heavily relying on Game object pattern (resources, configurations, part of game logic), which have a couple classes with certain logic.

I want to provide an ability to override that logic, using external modules written in another language (ideally I want to support any language). Also I want to have an ability to add additional logic.

What is the proper architecture for that?

sentences:
Calculate gears rotation for a realtime simulation I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
See the animated gif:

The biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);

for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint.
EDIT:
I am using radians for rotations and I think this is OK.
My main problem is that I want to achieve a perfect joint between teeth like this example. My teeth are overlapping in some odd way.
EDIT
a working example can be found here: http://www.openprocessing.org/sketch/83665

sentences:
How do you determine where the user wants to place a block in a 3d scene? I am still in the think-ahead-and-plan stage of a project where I'll want the player to be able to drag-out blocks - tiles but a minecraft-like 3D block-world.

So my question is: how can you determine where the user wants to place a block?

Here's a random minecraft screenshot I found on the internet:

My game will not be first-person camera; the user will be able to click anywhere to place a block.

If the user clicks on the centre of that green cross I've marked, which just misses the stonework to its right, where should the block be placed?

Technically determining the ray under the mouse cursor is trivial.

Given a ray and computing its distance / intersection with all existing block faces, and knowing the blocks that have previously been placed e.g. the last placed block, how can you 'do the right thing' with regards ambiguous movement?  What rule set can you use?

sentences:
How can I make the screen scroll only when the character is close to the edge? On the internet, I saw videos and tutorials about screen scrolling. But those only show how to keep the player always in the center of the camera.

I want my camera to scroll over the level, following the character, only when the character is within the 20% border of the screen.

So, when the player is not close to the edge of the window then the camera stays in place and not follow the player and when the player crosses this "scrolling line" the camera should smoothly follow hit. Let's say that my game window is 1000px wide and 500px high, but the game map is 3000px wide and 3000px high.

sentences:
First time working on 3D game: exporting steps after designer finishes 3D characters? First time making a 3D game so could use advice. The designer is creating 3D characters with Cinema 4D (https://www.maxon.net/en/products/cinema-4d/overview/).

What steps are required to go from his 3D models to generate the files and texture maps (e.g., diffuse, normal) required to render the characters on iOS?

Is this export done within Cinema 4D, or does there need to be an intermediary step?

Does the process change if the characters are animated?

sentences:
C++ map isn't finding key even though it exists I am in the process of learning C++ for the Unreal engine.
I am trying to figure out why when I use the [] operator on a map<Vector2, ControlNode> with a value that I know is in the map, it returns nullptr.
Here are the relevant pieces of code:
Vector2
**Vector2.h**
class MAGICGAME2D_API Vector2
{
public:
    Vector2(float x, float z);
    Vector2();
    float X;
    float Z;

public:
    friend bool operator< (const Vector2& c1, const Vector2& c2);

};

**Vector.cpp**
bool operator< (const Vector2& c1, const Vector2& c2)
{
    return (c1.X < c2.X ||
        c1.Z < c2.Z);
}

Creating the map:
for(auto values : *data->getAutomata()) {
    auto pos = values.first;
    shared_ptr<ControlNode> node = make_shared<ControlNode>(pos,values.second);
    controlNodes.emplace(pos,node);
}

And this is the place I make the call to check if the value is in the map:
shared_ptr<ControlNode> node = (*(*data).getControlNodes())[pos];

The data variable is a pointer, that points to an object that holds a shared_ptrstd::map<Vector2,shared_ptr<ControlNode>>. So that is why I am double dereferencing that part of the code.
This call to retrieve from the map acts a bit odd. Sometimes it will work. For example, where pos = Vector2(0,0). But then it will fail where pos = Vector2(0,25), and it will return a nullptr. The weird thing is that I have confirmed that pos = Vector2(0,25) is already in the map.
Is there something I am doing wrong with the call to retrieve the shared_ptr<ControlNode>?

sentences:
Extracting tiles from a tileset programatically? How do I programatically extract tiles from a tileset such as this one:
http://opengameart.org/sites/default/files/grassland_tiles.png

I want to use these tiles in my game. I see that some tiles here are of different sizes (or maybe all tiles are a multiple of some fixed size). For example, if I want to use one of the tree tiles in my program, how can I figure out what offset into the tileset image I must use, and how big of a sub-image i must extract? I don't see any metadata associated with any of these tilesets that I can use.

Thanks!

sentences:
Object pools for efficient resource management How can I avoid using default new() to create each object?

My previous demo had very unpleasant framerate hiccups during dynamic memory allocations (usually, when arrays are resized), and creating lots of small objects which often contain one pointer to some DirectX resource seems like an awful lot of waste.

I'm thinking about:

Creating a master look-up table to refer to objects by handles (for safety & ease of serialization), much like EntityList in source engine
Creating a templated object pool, which will store items contiguously (more cache-friendly, fast iteration, etc.) and the stored elements will be accessed (by external systems) via the global lookup table.

The object pool will use the swap-with-last trick for fast removal (it will invoke the object's ~destructor first) and will update the corresponding indices in the global table accordingly (when growing/shrinking/moving elements). The elements will be copied via plain memcpy().

Is it a good idea? Will it be safe to store objects of non-POD types (e.g. pointers, vtable) in such containers?

Related post: Dynamic Memory Allocation and Memory Management

sentences:
What formula is commonly used in rpg based games to calculate gained currency? Assuming I have an RPG game with monsters, a game you can fight any amount of monsters at any time - What are my options for a gained currency from a battle formula? I've been trying to use Google for any ideas, but couldn't find something solid.

Currently I have the enemy level * user level * 0.1

Pretty sure I need something more realistic and randomized, Hope someone can share any idea about it.

Thanks in advance!

sentences:
Tile based game engine for WP7? I showed my friend a demo of what I was doing with the farseer physics engine on the windows phone and he wanted to know if farseer would be good for a game he wants to develop. It's a tile based game so I said I don't think farseer would be the best choice (correct me if i'm wrong).

Are there any tile game engines for windows phone? Think tile based like the original Zelda.

sentences:
ArrayList of Entites Random Movement I have an arraylist of entites that I want to move randomly. No matter what I do, they won't move. Here is my female class:

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.util.Random;

import javax.swing.ImageIcon;

public class Female extends Entity {
static int femaleX = 0;
static int femaleY = 0;
double walkSpeed = .1f;
Random rand = new Random();
int random;
int dir;

Player player;

public Female(int posX, int posY) {
    super(posX, posY);

}

public void update() {
    posX += femaleX;
    posY += femaleY;

}

public void draw(Graphics2D g2d) {
    g2d.drawImage(getFemaleImg(), posX, posY, null);
    if (Player.showBounds == true) {
        g2d.draw(getBounds());
    }
}

public Image getFemaleImg() {
    ImageIcon ic = new ImageIcon("res/female.png");
    return ic.getImage();
}

public Rectangle getBounds() {
    return new Rectangle(posX, posY, getFemaleImg().getHeight(null),
            getFemaleImg().getWidth(null));
}

public void moveFemale() {
    random = rand.nextInt(3);
    System.out.println(random);

    if (random == 0) {
        dir = 0;
        posX -= (int) walkSpeed;
    }
}

}

And here is how I update the female class in the main class:

public void actionPerformed(ActionEvent ae) {
    player.update();

    for(int i = 0; i < females.size(); i++){
        Female tempFemale = females.get(i);
        tempFemale.update();
    }
    repaint();
}

If I do something like this(in the female update method):

public void update() {
    posX += femaleX;
    posY += femaleY;

    posX -= walkSpeed;

}

The characters move with no problem. Why is this?

sentences: Unity3D: Convert all game objects to same size irrespective of it's scale Suppose I have a reference GameObject, Cube, with scale (1,1,1). There is another GameObject with scale (1,1,1), but the size is 3 times bigger than the Cube. How do I dynamically change the scale of the Game objects to fit the size of the Cube?

sentences:
How to change XNA coordinates directions? Usually XNA increases X coordinate to right and Y to down. Like this:

But in my project i have 2D map. Drawing tile with bigger Y coodinate below OX looking strange (usually people imagines these tiles above OX).

Yeah i can just use

spriteBatch.Draw(Turf.Texture, new Rectangle(Turf.X*32, Turf.Y*32*-1),Color.White);

//32 is width and height of tile, also code simplified

But it makes a code harder and uglier. Don't XNA have any setting \ variable to make spritebatch counting Y to top?

sentences:
Creating LOS zones on a 2D grid for chase AI I have a 2D grid, around 20x20, stored as an array. Each grid cell can contain an opaque object or not. I also already have an algorithm to calculate LOS between any two squares via Bresenham.

I want to implement an AI that chases the player in a step-time game. The current rules I have are (re-evaluated with this priority each step):

If we can see the player go get them (a step at a time with Dijkstra/A* pathfinding).
If we can't see the player go to where we last saw them.
If we can't see the player and are where we last saw them, give up and head home.

But I want to add a further rule:

If we can't see the player and are where we last saw them, but there is only one way they could have gone to now be hidden without coming past us, go that way.

This turns out to be really hard to detect. What I have wondered about doing is to assign each grid square one or more zone numbers, such that every square that is in a given zone can see all other squares in that zone; then if there is only one neighbouring zone than the guard has not visited the guard will move into it. However, the zones overlap and a ridiculously large number of them are generated for even simple maps (due to, for example, different parts of a room gradually becoming visible as you walk down a corridor into it) which makes this awkward or difficult, and the generation algorithm seems to be at least O(n^2) or worse. Alternatively the zones could be calculated as a navigation mesh but this seems very difficult to compute from a grid map.

Is there any way to do this without manually putting hints on the map?

sentences:
Can Bullet Physics (or another 3d physics engine) use callbacks in my engine to check static geometry? I'm wondering if it's possible to use or hack Bullet 3d Physics (or another free 3D physics engine) so that I don't need to "import" my static geometry into Bullet - instead I want to do it the other way, so Bullet uses some sort of callback system to check geometry properties of my mesh/polygons.

Sort of like that Bullet would expect a method in my static geometry classes "checkRayIntersection" or similar, and I take care of the details and optimizations myself. The meshes are immovable, so the only thing that I expect Bullet to care about is intersections and their normals, but I might be missing something..

EDIT: as an example, consider a 10 million polygon terrain mesh which is changing all the time. You probably don't want to keep parallel data structures in the render-engine and in the physics engine for this. You don't want to use an approximation for the physics either.

Bullet uses something called MotionStates to solve this problem for its output - I was hoping there was a similar design pattern for passing geometry input.

sentences:
Calculating delta time I'm trying to calculate deltaTime, but it's not correct.

What's wrong in my code?

//declared outside
private long timeSinceStart = System.nanoTime() / 1000;
private long oldTimeSinceStart = 0;
public static long deltaTime = 1;

while(running)
  timeSinceStart = System.nanoTime() / 1000;
  deltaTime = timeSinceStart - oldTimeSinceStart;
  oldTimeSinceStart = timeSinceStart;

sentences:
What's the easiest way to fill my 3d enviornment with temporary graphics? Currently I am starting a 3D game with C# but I don't have a designer yet nor any images or anything or any money to invest on it.

I would like to develop it using some sort of placeholder or whatever to fill the graphics so I can make at least the basics of it and later simply switch for the real thing.

Should the place holders be actual sample images or can I use for example a ball to represent a body (what will be the impact of it later when I switch to the actual body it self)?

sentences:
Objective-C Moving UIView along a curved path I'm not sure if I am approaching this the correct way. In my app, when a user touches the screen I capture the point and create an arc from a fixed point to that touch point. I then want to move a UIView along that arc.

Here's my code:

ViewController.m

//method to "shoot" object - KIP_Projectile creates the arc, KIP_Character creates the object I want to move along the arc

...

//get arc for trajectory
    KIP_Projectile* vThisProjectile = [[KIP_Projectile alloc] initWithFrame:CGRectMake(51.0, fatElvisCenterPoint-30.0, touchPoint.x, 60.0)];
    vThisProjectile.backgroundColor = [UIColor clearColor];
    [self.view addSubview:vThisProjectile];

...

 KIP_Character* thisChar = [[KIP_Character alloc] initWithFrame:CGRectMake(51, objCenterPoint-5, imgThisChar.size.width, imgThisChar.size.height)];
    thisChar.backgroundColor = [UIColor clearColor];
    thisChar.charID = charID;
    thisChar.charType = 2;
    thisChar.strCharType = @"Projectile";
    thisChar.imgMyImage = imgThisChar;
    thisChar.myArc = vThisProjectile;
    [thisChar buildImage];
    [thisChar traceArc];

in KIP_Projectile I build the arc using this code:

- (CGMutablePathRef) createArcPathFromBottomOfRect : (CGRect) rect : (CGFloat) arcHeight {

    CGRect arcRect = CGRectMake(rect.origin.x, rect.origin.y + rect.size.height - arcHeight, rect.size.width, arcHeight);

    CGFloat arcRadius = (arcRect.size.height/2) + (pow(arcRect.size.width, 2) / (8*arcRect.size.height));
    CGPoint arcCenter = CGPointMake(arcRect.origin.x + arcRect.size.width/2, arcRect.origin.y + arcRadius);

    CGFloat angle = acos(arcRect.size.width / (2*arcRadius));
    CGFloat startAngle = radians(180) + angle;
    CGFloat endAngle = radians(360) - angle;

    CGMutablePathRef path = CGPathCreateMutable();
    CGPathAddArc(path, NULL, arcCenter.x, arcCenter.y, arcRadius, startAngle, endAngle, 0);

    return path;

}

- (void)drawRect:(CGRect)rect {

    CGContextRef currentContext = UIGraphicsGetCurrentContext();

    _myArcPath = [self createArcPathFromBottomOfRect:self.bounds:30.0];

    CGContextSetLineWidth(currentContext, 1);
    CGFloat red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
    CGContextSetStrokeColor(currentContext, red);
    CGContextAddPath(currentContext, _myArcPath);
    CGContextStrokePath(currentContext);

}

Works fine. The arc is displayed with a red stroke on the screen.

In KIP_Character, which has been passed it's relevant arc, I am using this code but getting no results.

- (void) traceArc {

    CGMutablePathRef myArc = _myArc.myArcPath;

    // Set up path movement
    CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    pathAnimation.calculationMode = kCAAnimationPaced;
    pathAnimation.fillMode = kCAFillModeForwards;
    pathAnimation.removedOnCompletion = NO;
    pathAnimation.path = myArc;
    CGPathRelease(myArc);

    [self.layer addAnimation:pathAnimation forKey:@"savingAnimation"];

}

Any help here would be appreciated.

sentences:
Load destructible mesh at runtime Using the tutorial: Components and Collision as a guide, to dynamically load a SphereShape the following is done:

AClass::AClass()
{
    // Create USphereComponent
    USphereComponent *sphere = NULL;
    sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Root"));
    sphere->InitSphereRadius(1.0f);
    sphere->SetCollisionProfileName(TEXT("PhysicsActor"));
    sphere->SetSimulatePhysics(true);
    sphere->WakeRigidBody();

    // Create UStaticMeshComponent
    UStaticMeshComponent *mesh = NULL;
    mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    mesh->SetupAttachment(RootComponent);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Sphere.Shape_Sphere")
    static ConstructorHelpers::FObjectFinder<UStaticMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        mesh->SetStaticMesh(asset.Object);

    RootComponent = sphere;
}

Now, when I try the same set of steps, but this time for an Actor that has a UDestructibleComponent instead of a USphereComponent:

AClass::AClass()
{
    // Create our UDestructibleComponent
    UDestructibleComponent *destructible = NULL;
    destructible = CreateDefaultSubobject<UDestructibleComponent>(TEXT("Root"));
    destructible->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
    destructible->SetSimulatePhysics(true);
    destructible->SetEnableGravity(false);
    destructible->WakeRigidBody(NAME_None);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Cube_DM")
    static ConstructorHelpers::FObjectFinder<UDestructibleMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        UE_LOG(LogTemp, Warning, TEXT("It worked!"));

    RootComponent = destructible;
}

I receive the following errors:

ConstructorHelpers.h:105:20: error: cannot initialize a parameter of type 'UObject *' with an lvalue of type 'UDestructibleMesh *'
ValidateObject( Object, PathName, ObjectToFind );
                ^~~~~~

ConstructorHelpers.h:29:19: error: incomplete type 'UDestructibleMesh' named in nested name specifier
UClass* Class = T::StaticClass();
                ^~~

I've also tried adding .Shape_Cube_DM to the end of the string, similar to how the first asset was imported, but no luck. What is the correct way to load a DestructibleMesh from the filesystem and apply it to the UDestructibleComponent?

sentences:
Has anyone got the Krypton Lighting Engine working in MonoGame for Windows 8? I've converted the core of the Krypton Lighting Engine so that it's compatible with Windows 8.

The trouble I'm having when actually using it is that it can't load the KryptonEffect.xnb file.  I'm aware that MonoGame doesn't have XNA content processors, so I'm compiling the KryptonEffect.fx file in an XNA Content project.

When I try to load the Effect, I get an exception saying The MGFX file is corrupt in the ReadEffect method in MonoGame.  The header should be MGFX but it's a seemingly random byte array.

I then came across this page that says to use a tool named 2MGFX.  I tried this, but the tool reports: The effect must contain at least one technique and pass.  From what I can see from KryptonEffect.fx the file, it does.

Has anyone got the Krypton Lighting Engine working on MonoGame for Windows 8? Or has anyone been able to load any kind of Effect file under Windows 8?

sentences:
Game programming course materials: What should it include? I am tasked to create the course materials for a game programming class, and I’d like your opinion on what aspects and areas of game programming, such as game state management, game object storing or simple AI, should I include in it? The course is intented to be the first step into game programming for students with novice skills in programming.

There will be mathematics as well, but I found that there are multiple questions, with good answers, on that subject already.

sentences:
Why do console games not allow completely custom key bindings? So I plugged in my PlayStation 2 for the first time in ten years and realized that I could not customize my key bindings, only pick from select pre-sets that the developers put in, which I thought was strange. So I checked through a few of my games on Xbox 360, PlayStation 2, and Nintendo 64 and realized that none of them had customizable controls, only control schemes (if even that)!
Why is this? Is it a limitation of the consoles or is it policy from Sony's and Microsoft's part that games should only offer select pre-sets, not completely customizable key bindings? The same games have customizable key bindings on PC and have no issues with binding to my Xbox 360 PC controllers.
I don't own any more modern consoles, so maybe it's different nowadays. If so, why did the old consoles have these limitations that the new ones do not have?

sentences:
How should I position and move objects in my 3D world in relation to terrain I'm drawing a heightfield as a piece of 3D terrain using the fairly 'dumb' method of drawing triangles, like everyone does when learning this sort of thing. There's no fancy LOD, scenegraphs or other things, it's deliberately simple and low poly because that's the look of the game. A section of X,Y height data is turned into a mesh of triangles and drawn on the screen.

I now want to scroll the heightfield in the Z axis (not the X or Y, I just want to move 'forwards' through it).

I have a player object with a 'camera' attached to it. When the player wants to go 'forwards' should I

keep the player at the same Z position and scroll the terrain towards the viewer to simulate movement
actually move the player in the Z axis and draw the relevant bit of terrain under them (because the camera is 'attached' to the player it looks like they stay in the middle of the screen, and the gameworld and gameplay will limit how far the player can go forwards)

I'm doing the first one at the moment and it works well... until I want to interact with the terrain or place stationary objects on it at specific points. It seems a bit backwards since all the 'moving' objects stay still, and all the stationary objects need to be moved towards the viewer at the same rate as the terrain is. Also the maths to translate the terrain's scrolled amount and the player's pretend location is somewhat complex.

sentences:
Is using something like MakeHuman frowned upon while developing 3D games? I came across this interesting application called MakeHuman, and I was wondering what developers in the gaming community thought about creating and exporting characters to Unity using this application. I'm not an artist, so a tool like this helps me create characters without having to pay someone else to model them from scratch.

If I were taking a class in game development, would it be permissible to use something like this to create characters rather than create them myself (in Blender or Maya, for example)? What benefits are there to consulting an artist rather than using tools like this?

sentences:
Unity Tilemap's WorldToCell always return with (0, 0, 0)? Based on a Vector2 I want to know the coordinate of the tilemap at that position.

But for some reason, it always returns (0, 0, 0). Why?

Why?

var position = new Vector2(1.5, -0.5);
for (int i = 0; i < 8; i++)
{
    position += new Vector2(1, 3);
    var coordinates = tilemap.WorldToCell(position);
    Debug.Log(position + ", result: " + coordinates);
}

sentences:
How efficiently use SDL_RenderFillRects? For the sake of learning C++, I would like to optimize a "Game of life" project I made.
In my first attempt, I used a bunch of SDL_RenderFillRect to draw the board squares.
In my second attempt, I used a single SDL_RenderFillRects to avoid the cost of calling the GPU a lot of times.

However, I am probably wrong in my second implementation because it is not faster than the first one (or barely 5%). Moreover, my implementation is all but elegant.

In the two cases, I only draw the living cells.

The SDL_RenderFillRect solution:

SDL_Rect fillRect;
for (int column=0; column<array_width; ++column)
{
    for (int row=0; row<array_height; ++row)
    {
        if (board[column][row]) // // Checks if the cell is alive
        {
            fillRect = {column*CELL_SPACE,row*CELL_SPACE,CELL_SIZE,CELL_SIZE};
            SDL_RenderFillRect(gRenderer, &fillRect);
        }
    }
}

The SDL_RenderFillRects solution:

SDL_Rect fillRect;
static SDL_Rect rect_list[120000]; // The list of squares to be drawn
int array_index_count = 0;
for (int column=0; column<array_width; ++column)
{
    for (int row=0; row<array_height; ++row)
    {
        if (board[column][row]) // Checks if the cell is alive
        {
            fillRect = {column*CELL_SPACE,row*CELL_SPACE,CELL_SIZE,CELL_SIZE};
            rect_list[array_index_count] = fillRect; // Adds the cell to the array
            ++array_index_count;
        }
    }
}
SDL_RenderFillRects(gRenderer, rect_list, array_index_count);

I am not happy with the way I use SDL_RenderFillRects.
First, I don't know in advance how many living cells there will be, forcing me to declare an oversized array.
Second, I indeed avoided a lot of SDL_RenderFillRect calls, but at the price of long iteratings over the rect_list array.

How to use the SDL_RenderFillRects function properly?

sentences:
How to draw 2d road similiar to Outrun, Lotus, Pitstop, Cisco Heat games? * UPDATED 23/05/2018 *

I've managed to implement road generation and curves using the techniques described here

I made a short gameplay video.

Hope it helps to anybody looking for answers.

sentences:
DirectX 11 Mouse Picking Problem I'm trying to do mouse picking and actually it works but when I scale the object and click that point on the image it picks wrong one, this happens only after scaling an object and I'm sure matrices are correct, any idea?

    DirectX::XMFLOAT4X4 projection;
    DirectX::XMStoreFloat4x4(&projection, Graphics::projectionMatrix);

    float viewX = ((2.0f * Input::GetMouseX()) / MainWindow::GetDisplayResolution().width - 1.0f) / projection(0,0);
    float viewY = (1.0f - (2.0f * Input::GetMouseY()) / MainWindow::GetDisplayResolution().height) / projection(1,1);

    DirectX::XMMATRIX inverseMV = DirectX::XMMatrixInverse(nullptr,DirectX::XMMatrixTranspose(entity->Renderer_->MV_Matrix)); //MV is column order

    DirectX::XMVECTOR rayOrigin = DirectX::XMVector3TransformCoord(DirectX::XMVectorSet(0.0f,0.0f,0.0f,1.0f), inverseMV);
    DirectX::XMVECTOR rayDirection = DirectX::XMVector3Normalize(DirectX::XMVector3TransformNormal(DirectX::XMVectorSet(viewX, viewY, 1.0f, 0.0f), inverseMV));

    for (const auto& subMesh : entity->Renderer_->mesh->GetSubMeshes())
    {
        float distance = 0.0f;
        if (subMesh.AABB.Intersects(rayOrigin, rayDirection, distance))
        {
            for (unsigned int i = 0; i < subMesh.GetIndexCount(); i += 3)
            {
                DirectX::XMVECTOR p1 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i]]);
                DirectX::XMVECTOR p2 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 1]]);
                DirectX::XMVECTOR p3 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 2]]);

                if (DirectX::TriangleTests::Intersects(rayOrigin, rayDirection, p1, p2, p3, distance) && distance < minDistance)
                {
                    minDistance = distance;
                    *pickedEntity = entity;
                }
            }
        }
    }

sentences:
How to detect whether an Object came to sleep at a specific position? I'm currently writing a small game with box2dweb and I need some direction for this: I'm throwing a Box and have to hit a specific place and trigger an event when the object that's been thrown isn't moving anymore, "fell asleep" so to say.

What's the proper way / best practice for this?

I'm currently thinking of asking the b2World whether an Object is within a specific AABB and then wait a few seconds, check if it's still there and then trigger the event. But this seems to me like the roundabout way and the object might still be moving inside of that AABB and eventually even drop out of the AABB.

sentences:
Change of direction after Collision I am having a pickup image which is moving at random direction and have to change the direction after collision with some tiles, which are a rectangle. I've my own algorithm for detecting the collision, but I couldn't accurately calculate new direction. Please have a look at my code for collision detection.

void PickUpManager::CheckPickUpToTileCollision(){
CIwArray<_TILE*> tiles=m_GAME.m_Datamine->m_Tile;
uint16 tileTop,tileLeft, tileBottom, tileRight, pickTop,pickLeft, pickBottom, pickRight;
for(uint32 i=0;i<tiles.size();i++){
    tileTop=tiles[i]->m_TilePos.y;
    tileLeft=tiles[i]->m_TilePos.x;
    tileBottom=tiles[i]->m_TilePos.y+tiles[i]->m_TileSize;
    tileRight=tiles[i]->m_TilePos.x+tiles[i]->m_TileSize;

    pickTop=m_Pos.y;
    pickLeft=m_Pos.x;
    pickBottom=m_Pos.y+pickHeight;
    pickRight=m_Pos.x+pickWidth;
    //Collision from Top of Tile
    if(pickBottom>=tileTop && pickBottom<=tileBottom && pickRight>=tileLeft && pickLeft<=tileRight &&!yFlag){
        yDir=-PICK_SPEED;
        yFlag=true;
    }
    //Collision from Bottom of Tile
    if(pickTop<=tileBottom && pickTop>=tileTop && pickRight>=tileLeft && pickLeft<=tileRight &&!yFlag){
        yDir=PICK_SPEED;
        yFlag=true;
    }
    //Collision from Left of Tile
    if(pickBottom>=tileTop && pickTop<=tileBottom && pickRight>=tileLeft && pickRight<=tileRight &&!xFlag){
        xDir=-PICK_SPEED;
        xFlag=true;
    }
    //Collision from Right of Tile
    if(pickBottom>=tileTop && pickTop<=tileBottom && pickLeft<=tileRight && pickLeft>=tileLeft &&!xFlag){
        xDir=PICK_SPEED;
        xFlag=true;
    }
    if(xFlag && yFlag)
        return;
}
}

void PickUpManager::Move(){
xFlag=false;
yFlag=false;
CheckPickUpToTileCollision();
    m_Pos.x+=xDir;
    m_Pos.y+=yDir;
}

The problem is the tiles are like bricks making a wall. So if the pickup hit the tile from top left, it changes it's x and y both direction, while the change of direction should be only in the x direction, as there's another tile which ended before this tile. I know it's some stupid problem, but still couldn't make it out.

sentences:
How can I create a tile set that will allow me to render a soccer pitch in perspective? I am making a soccer game that needs a large pitch image (the whole play field area is about 3300 * 1200 pixels).

I know I should use the Tiled map editor to create a tile map so that I can create the whole soccer pitch by using just a few tiles, but I'm not sure how I can create a tile set that will allow me to create good-looking fields like in these games:

As you can see, the soccer pitch is not a rectangle but more of a trapezoid, so it changes the way we draw border and grass stripes. The grass stripes are sloping, and the slope changes the closer they are to the goal. That makes it very hard to replicate in a limited amount of tiles.

Currently, I have 3 layers for my field. Each tile is 64 * 64 in size, and I create them this way:

The border tiles. Since the border is not repeating, I take the border, cut it up into tiles, and add them to the tile set. It's fussy, but it seems this is the only way.
Light colored grass. I have a single, repeating 64 * 64 tile that is used to cover the base layer of the field.
Deep colored, sloping stripe grass. This is the one I can't figure out how to create.

How can I create that last set of tiles or otherwise achieve my effect?

sentences:
Camera movement in Super Hexagon I do realize there is no camera in OpenGL ES 2, but from my understanding you can simulate one using view and projection matrices. I'm using Android, by the way. Here's a video of the game, in case you are not familiar with it: https://www.youtube.com/watch?v=5mDjFdetU28

I am trying to understand how the world/camera is rotated and tilted. Is that done purely by rotating and tilting the view matrix? So you'd have a tilt and rotationSpeed fields that you'd use each frame in something like rotate(viewMatrix, angle + rotationSpeed) followed by rotate(viewMatrix, tilt)? How would you achieve a similar effect?

sentences:
Need help in getting sequential impulse method working i have made a very very simple physics system based on sequential impulse method - with single contacts only and no angular rotation at all. Contact points are calculated using separating axis theorem.

Unfortunatly with small gravity my test-simulation is stable, but with increasing gravity it gets more and more unstable. My player and my moving elevator just goes crazy...

The solver is basically the same as box2d, but without any angular rotation at all - so no need for clipped contact points.

It does the following:

Integrating the external forces (gravity, player input)
Calculating all contact points using SAT for each unique body pair.
Solving movement iteratively by applying impulses so it just touches the surface (restitution is set to zero)
Integrating the new velocity to get a new position
Re-calculate contact distances
Solving position errors iteratively by applying impulses to the position by using baumgarte stabilization method

All the solver code is nearly a port of box2d Box2D/Dynamics/b2ContactSolver.cpp.
Even the coefficients are set to the same values and the world uses meters as units.

Does someone know this stuff and could help me to learn this properly please?
Since months i am fighting with this kind of physics programming and has always issues :-(
Unfortunatly i dont have any algebra knowledge, even though i understand the most of it.

Here is the short code in a javascript environment:
http://jsbin.com/xoqiquxoyo/1/

sentences: How can I switch between texture atlases based on the iOS version? How can I switch between atlases (with different resolutions) in Unity based on the runtime iOS version?

sentences:
Why does physics interpolation give me periodic jumps/flickers? I have seen this question but it didn't solve the problem.

I have followed the same steps as in this article.

What I notice in my Android game is that my interpolation alpha (or fraction or accumulatorRatio) varies with this pattern as frames progress:

0.13
0.22
0.31
0.45
0.49
0.62
0.81
0.94
0.03
0.1

The above is an illustration but the point is that it goes from 0 to 1 and cycles back to 0 periodically. I believe this is due to the game frame rate being slight faster than the physics update interval.

Every time the interpolation alpha cycles around, it gives me a jitter (or jump).

Here is a log file: http://pastebin.com/3Yb7nVxX

The two columns are (i) interpolation alpha (ii) physics step count

The "jumps" happen roughly in lines 262 to 266 in the log.

Here is the code: http://pastebin.com/vWC7yNGM

What is causing these periodic "jumps"?

EDIT: Here is more detailed code: http://pastebin.com/PSZrntZP

sentences:
Creating an in-game time system only works with real time I'm trying to create an in-game time system. Thus far it only works properly if you use 1440 minutes to the day (realtime), but I would like to be able to alter the day length to something like 10 minutes for example.

When adjusting it to 10, 20, etc, the clock starts to increment extremely rapidly to the point that an entire week passes in less than a second if you set it to one minute, or a day passes in about 12 seconds at around 10 realtime minutes to the day.

public float DayLengthInMinutes = 1440;// How long a day is in real world minutes
public int HoursToTheDay = 24;       // How many hours there are in a day
public int MinutesToTheHour = 60;    // How many minutes there are in an hour
public int SecondsToTheMinute = 60;  // How many seconds there are in a minute

public float _dayLength;                // Day length in seconds
public float _hourLength;               // Hour length in seconds
public float _minuteLength;             // Minute length in seconds
public float _secondLength;             // Seconds length in seconds
private float timer;                    // Timer that will be tracking game time

void Initialize () {
    timeSinceStart = Time.realtimeSinceStartup;
    _dayLength = _dayLengthInMinutes * 60;  //get seconds to the day
    _hourLength = _dayLength / HoursToTheDay; //determines how long an hour is
    _minuteLength = _hourLength / MinutesToTheHour; //determines how long a minute is
    _secondLength = _minuteLength / SecondsToTheMinute; //determines how long a second is
}
void CalculateTime () {
    if (timer >= _secondLength) {
        currentSecond++;
        timer = 0;
    }
    if (currentSecond >= _minuteLength) {
        currentMinute++;
        currentSecond = 0;
    }
    if (currentMinute >= _hourLength) {
        currentHour++;
        currentMinute = 0;
    }
    if (currentHour >= HoursToTheDay) {
        currentDay++;
        currentHour = 0;
        currentMinute = 0;
        currentSecond = 0;
        dayOrNight = "AM";
    }
}

EDIT: I'm actually basically finished with the while thing, it just isn't very user friendly yet. If people are interested I can answer with the two scripts it is currently running as. I haven't managed to get it into one without Unity crying and I'm not certain why.

sentences:
optimal pixel-read back strategy I need to render certain scenes and read the whole image back in main memory for further processing which is not suitable for rewriting into shaders of CUDA, and saving to disk. I've search for this and it seems that most video cards will accelerate the rendering but the read-back will be very slow. After a bit of research i only found this card mentioning "Hardware-Accelerated Pixel Read-Back"

The other approach would do software rendering and the read-back problem doesn't exist, but then the rendering performance will be bad.

Likely, i will have to implement both in order to be able to find the optimal trade-off, but my question is about what other alternative can i have hardware-wise; i understand Quadro is for modelling and designer market segment, which is precisely the client target of this application, Does this means that i'm not likely to find better pixel read-back performance in other video card lines? i.e: Tesla or Fermi, which don't even have video outputs btw

sentences:
Is learning OpenGL 2.1 useless today? I'm new to 3D OpenGL/DirectX world and I found out that OpenGL 4.1 and GLSL specifications were just released today.

A friend of mine gave me the Red Book for OGL v2.1 but, as far as I've read, 3.x and 4.x differ a lot from 2.x and a lot of things are deprecated now.

Can I use the book to start learning the basics of 3D and CG or is it better to find a newer copy?

sentences:
Manipulating Perlin noise output to create different ore veins in different depths I am developing a simple project using Java, for Android. It is a side-scroller with a procedurally generated, infinite world. Most of the generation will be working on underground but I expect the same principles would apply to features that would be above the ground.
I have 2 coordinates. X goes Left-Right and Y goes Up-Down. I have managed to generate a density map using Perlin. What I do is looping through X and Y values, putting them in a noise function, and evaluating the resulting float to decide whether to place a specific tile or not. I have successfully created a uniform tile distribution. However I need something a bit more specialized.
You see, in order to make this interesting, I need to place various resources (Coal, Iron, Silver, Gold) as well as monster spawns in the map. I am thinking that it would be more realistic to place different resources in different depth levels. So for example, I need coal to appear between Y = -20 and Y = -50, Iron between -40 and -100, ogre spawners between -40 and -300 etc.
However, if I set these boundaries with a simple if statement like:
if (y<-20 && y>-50) {
    // Generate coal
    noise = perlin.getnoise(x,y,7);
    if (noise>=threshold) map.put(x,y,TILE_TYPE_COAL);
}
if (y<-40 && y>-100) {
    // Generate iron
    noise = perlin.getnoise(x,y,7);
    if (noise>=threshold) map.put(x,y,TILE_TYPE_IRON);
}

This generates sharp edges between those boundaries, like this:
http://imgur.com/wmllU5o
I need the noise to somehow generate resources that, when digging down, would gradually appear more often, and then gradually less so. Ease in and ease out.
For example, if I set the boundaries for coal to be between -20 and -50, most of the coal should appear in the middle of this ribbon, -35, while it should appear less in -20 and -50 levels. Perhaps I need a Gaussian distribution? I don't know where to start.
To put the question in a more mathematical form:
How do I manipulate the output of a Perlin noise function depending on one of the inputs (Y) in a non-abrupt, natural way, in order to gradually increase or decrease density for specific ranges of Y?
Thanks in advance

sentences: How do I change the material of an object with Script in Unity? I was making a game with Unity and I want to change an object's material using UnityScript when the player collects 5 collectables that I made. The collectables get stored in an int variable called Score.

sentences:
How do I calculate the path of something in orbit around one or more bodies? I need to figure out how to calculate the orbit of an object around one or more bodies for a game that I am making (built on Cocos2D-Swift). The game is in two dimensions, so it's a two-dimensional orbit I am calculating. I currently have it set up so that, in the update loop, it calculates the force of each of the bodies on the object, the acceleration due to that force, and the change in velocity due to that acceleration. This would probably work fine if I were going through the update loop a thousand times per second, but on the iPhone 6+ simulator, I'm going through it approximately thirty times per second, which is a discretization so wide that it makes the orbit of the object very unstable.

As a result, I am looking for an equation that tells me the position of the orbiting object as a function of time; therefore, the force, acceleration, and velocity are not discretized, so the simulation is accurate. An example of what I am looking for is how Kerbal Space Program calculates the orbital paths ahead of time. Any thoughts? Thanks.

sentences:
How do I get the number of Steam friends online programmatically? How can I get the current number of Steam friends online in order to insert it into a script or program? I'm looking to use this value to do something like changing an LED colour or for providing data for a desktop widget etc.

Is this possible? How do I get access to that number?

P.S. I got my idea from here: Xbox Live Traffic Light Notifies You When Friends are Gaming

sentences:
Why aren't my 2D primitives visible using a custom effect? I'm working with Monogame and rendering a triangle using the following code.

vertices = new []
{
    new VertexPositionColor(new Vector3(100, 200, 0), Color.White),
    new VertexPositionColor(new Vector3(200, 100, 0), Color.White),
    new VertexPositionColor(new Vector3(300, 200, 0), Color.White),
};

graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1);

Ordinarily I'd apply a BasicEffect before the draw call, but this time I'm using a custom effect. For testing, I wrote the following shader code to return solid green for each pixel within the triangle.

struct VertexShaderInput
{
    float4 Position : POSITION;
    float4 Color : COLOR;
};

struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Color = input.Color;
    output.Position = input.Position;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR
{
    return float4(0, 1, 0, 1);
}

technique Technique0
{
    pass Pass0
    {
        VertexShader = compile vs_4_0_level_9_1 VertexShaderFunction();
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
};

The problem is that, although the shader compiles successfully, nothing shows up.

Why is my triangle invisible using this shader?

Based on my understanding of vertex and pixel shaders, the above HLSL code should work correctly. In the vertex shader, since (for the moment) I'm working in strictly 2D without a camera, no transformations need to be done on the vertices (i.e. they're already in screen space). From there, the pixel shader simply returns solid green for each pixel. I've also ruled out potential backface culling issues by swapping the order of vertices, and I've tried using different semantics on my HLSL structure variables. No luck.

Shaders still feel uncomfortable to me, but I feel my logic is correct based on what I've read. If that's the case, there must be some weird quirk I'm not aware of in having these HLSL shaders work at all, apart from the logic. What am I missing? Is there a better way to debug these problems short of changing random variables and hoping for the best?

sentences: Creating a large amount of sprites and animations For my AP U.S. Government and Politics class, I am making a spinoff of Mortal Kombat. Because of time constraints, I'm using an open source version of the game and want to create new characters.  I have about two weeks to do the project and can invest about 1-4 hours most days. I want it to look as nice as it can with the limited knowledge, skill, and time that I have. What programs or techniques would be best for a beginner with my time constraint?

sentences:
is there any method to simply ignore some files in unity build? as im trying to build my new app on unity android specially when i want to use gradle, there is always some conflict with manifest or libraries and .....

for debug and problem exploration i need to ignore some folders to check for those bugs instead of need to move them somewhere else.

i just thought about git branching but it can cause lots of branches and maybe not efficient

sentences:
How can I pass an array of matrices to a VertexShader I'm trying to learn how to use OpenGL but I'm having problems trying to pass an array of matrices to my VertexShader. I think the problem is in the VertexShader because it seems the values in modelvalue are passed correctly to the components of model, but for some reason at the end only one of the three cubes I've created is drawn. Here's the Main code.

glm::mat4 model[3];
GLint ModelLocation = glGetUniformLocation(MyShader.program, "model");
vector<GLfloat> modelvalue;
const int n = int(sizeof(model[0]) / sizeof(GLfloat));

for (int i = 0; i < 3; i++) {
    model[i] = glm::translate(model[i], cubePositions[i]);

    for (int j = 0; j < n; j++) {
        modelvalue.push_back(glm::value_ptr(model[i])[j]);
    }

}
glUniformMatrix4fv(ModelLocation, 3, GL_FALSE, &modelvalue[0]);

The VertexShader:

   #version 400 core
  layout (location = 0) in vec3 Position;
  layout (location = 1) in vec2 texCoord;
  out vec2 TexCoord;
  out vec4 position0;
  out vec4 position1;
   out vec4 position2;
  uniform mat4 model[3];
  uniform mat4 view;
  uniform mat4 projection;
  void main()
  {
  position0 = projection * view * model[0] * vec4(Position,1.0f);
  position1 = projection * view * model[1] * vec4(Position,1.0f);
  position2 = projection * view * model[2] * vec4(Position,1.0f);
  TexCoord = vec2(texCoord.x,1-texCoord.y);
   }

And the FragmentShader:

  #version 400 core

  layout (location = 0) in vec3 Position;
  layout (location = 1) in vec2 texCoord;

  out vec2 TexCoord;
  out vec4 position0;
  out vec4 position1;
  out vec4 position2;
  uniform mat4 model[3];
  uniform mat4 view;
  uniform mat4 projection;
  void main()
  {
  position0 = projection * view * model[0] * vec4(Position,1.0f);
  position1 = projection * view * model[1] * vec4(Position,1.0f);
  position2 = projection * view * model[2] * vec4(Position,1.0f);
  TexCoord = vec2(texCoord.x,1-texCoord.y);

sentences:
Explaining Asteroids Movement code I'm writing an Asteroids Atari clone, and I want to figure out how the AI for the asteroids is done.

I have came across that piece of code, but I can't get what it does 100%

if ((float)rand()/(float)RAND_MAX < 0.5) {
        m_Pos.x = -app::getWindowWidth() / 2;
        if ((float)rand()/(float)RAND_MAX < 0.5)
            m_Pos.x = app::getWindowWidth() / 2;
        m_Pos.y = (int) ((float)rand()/(float)RAND_MAX * app::getWindowWidth());
    } else {
        m_Pos.x = (int) ((float)rand()/(float)RAND_MAX * app::getWindowWidth());
        m_Pos.y = -app::getWindowHeight() / 2;
        if (rand() < 0.5)
            m_Pos.y = app::getWindowHeight() / 2;
    }

    m_Vel.x = (float)rand()/(float)RAND_MAX * 2;
    if ((float)rand()/(float)RAND_MAX < 0.5)
    {
        m_Vel.x = -m_Vel.x;
        }

    m_Vel.y =(float)rand()/(float)RAND_MAX * 2;

    if ((float)rand()/(float)RAND_MAX < 0.5)
        m_Vel.y = -m_Vel.y;

sentences:
Extract formula from vector drawing I am creating a game with HTML5 canvas for browser. I want to create animations with many shapes, which would be drawed with canvas, not from spritesheets.

The problem i face now is - to create formulas for so many shapes. I need them resizeable, also different width/height ratio. I was drawing chess pawn, but took 1 week to complete it right using arc's.

This is that pawn formula:

function pawn_shape(ctx, xx, yy, fill, stroke, grid_size) {
  var g = grid_size / 100;
  g *= 0.8;
  ctx.lineWidth = grid_size / 10;
  xx += g * 12;
  yy += g * 10;
  ctx.fillStyle = fill;
  ctx.strokeStyle = stroke;
  ctx.lineJoin = "miter";

  ctx.beginPath();

  var x = xx + 50 * g;
  var y = yy + 25 * g;
  var radius = 10 * g;
  var startAngle = 0.8 * Math.PI;
  var endAngle = 2.2 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 55 * g;
  y = yy + 48 * g;
  radius = 15 * g;
  startAngle = 1.6 * Math.PI;
  endAngle = 2.4 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 50 * g;
  y = yy + 97 * g;
  radius = 35 * g;
  startAngle = 1.7 * Math.PI;
  endAngle = 1.955 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 30 * g;
  y = yy + 92 * g;

  ctx.lineTo(x, y);

  x = xx + 50 * g;
  y = yy + 98 * g;
  radius = 35 * g;
  startAngle = 3.055 * Math.PI;
  endAngle = 3.3 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 45 * g;
  y = yy + 48 * g;
  radius = 15 * g;
  startAngle = 2.6 * Math.PI;
  endAngle = 3.4 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);
  ctx.stroke();
  ctx.fill();
  ctx.closePath();
}

This is only 1 pawn. I need many more figures as configurable formulas.
What would be the ways to get faster such formulas?

So far I am thinking about a new open source project, where people could draw shapes and these would be converted into such formulas. Or maybe even extract formulas from simple images, like programs do image to vector.

Another idea was to find out how does normal vectors work - what formulas they have. Maybe i could reuse and modify that? No idea, hoping to find answer here..

sentences:
Unity: Z-position issue on gameobject with subcomponents I'm following this tutorial from Ryan Miller on how to create a rig of sorts from a sprite atlas sheet.

My intention was to put the panda behind a bamboo, but this is what happened:

The bamboo's Z-position has been set to 2, whilst the Panda's has been set to 6.

Here's a 3D look at the problem:

How do I fix this?

sentences:
WWW request does not connect using webgl platform I use request like code below:

string url = "http://localhost:51820/Home/login/" + end+"/";
        WWW www2 = new WWW(url);
        StartCoroutine(waitForLogin(www2));

It works fine in the editor but the html build shows a connection problem. message of www error is only "unknown error"

sentences: How can I draw a simple 2D line in XNA without using 3D primitives and shders I would like to be able to draw arbitary lines in my sprite based 2D XNA game. How can I draw a simple line on screen in XNA without dealing with vertex arrays or shaders.

sentences:
C++ inheriting functions problem So I am creating a game with C++ and SDL.
I have a "gameobject" header file and no cpp (I do not need it) the game object has 2 functions void render() & tick().

The player class inherits from the gameobject. the problem is I don't know how to inherit functions. I tried virtual but I still can't figure it out.
I am used to Java so C++ is quite complicated.

My code:

gameobject.h :

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "game.h"

class gameobject
{
    public:
        virtual ~gameobject();

        void virtual tick() = 0;
        void render();

    protected:

        int width = pos.w;
        int height = pos.h;
        int posx = pos.x;
        int posy = pos.y;

        float velox;
        float veloy;

        SDL_Rect crop;
        SDL_Rect pos;
};

#endif // GAMEOBJECT_H

player.h:

#ifndef PLAYER_H
#define PLAYER_H

#include "gameobject.h"

class gameobject;

class player : public gameobject
{
    public:

    private:

        player(SDL_Renderer* renderer,int pwidth,int pheight);
        ~player();
};
#endif // PLAYER_H

player.cpp :

#include "player.h"

player::player(SDL_Renderer* renderer,int pwidth, int pheight)
{
    this->pos.w = pwidth;
    this->pos.h = pheight;
};

void player::tick(){} /// the problem here

sentences:
Pygame Updating Display Without Being Told To The following (abridged) bit of code is inside the main loop. What I expected to happen was the entity's position to update due to velocity, then update again if it's touching a static object before drawing rects and updating the display, but when run, an entity approaching a static will always visibly intersect with the static for one frame before moving back out, like it's running ent/stc.load() (a method for drawing rects) and pygame.display.update() multiple times during each loop.

    pygame.Surface.fill(window,(100,0,0))
    for stc in statics:
        stc.load()
    for ent in entities:
        ent.vel[0]+=ent.acc[0]
        ent.pos[0]+=ent.vel[0]
        for stc in statics:
            if ent.rect.colliderect(stc):
                if ent.vel[0]>0:
                    ent.acc[0]=0
                    ent.vel[0]=0
                    ent.pos[0]=stc.rect.left-ent.box[0]
        ent.load()
    clock.tick(60)
    pygame.display.update()

sentences:
Collision detection in multiplayer games This a followup to my previous question: How to implement physics and AoE spells in an MMO game?.

There, we concluded that all physics have to be done on the server, and that I should use cylinders for calculations.

Now, how can I check for collision detection on a ground-to-player basis on the server? It's fairly easy if the ground is a flat space, I just check if the player's z coordinate is lower than some value and voila, but, what if the map/ground itself is a model? How do I know where hills are on the server-side? How do I know when object collisions happen?

I'm using node.js and socket.io.

sentences:
FB.Init() is not accepting in my c# Script I am trying to connect fb with my game. its first time i am connecting fb with game. i downloaded fb SDk  7.3.0 and i am using unity 5.2.1f1. i imported the sdk in my game asset. then i created a new c# script "FBholder". in Awake() i tried to use FB.Init(). but its not accepting. all other scripts used inside the game are calling correctly, only the scripts came with fb sdk is not working.

 using UnityEngine;
 using System.Collections;

public class Fbholder : MonoBehaviour {

// Use this for initialization
void Awake() {
    FB.Init (SetInit, OnHideUnity);// This line is not accepting
}
}

i Used this Video for my referance

sentences:
OpenGL VBO and VAO Confusion I would like to present here my Question about VBOs and VAOs.
Basically from what i understand you can have different VAOs each of which can contain up to several VBOs , and by binding to the VAO's ID you can draw from the VBOs stored inside.

I have Wrote a simple class that reads a obj file then creates vertices, normals and uvs vector lists and upload those in 3 VBOs (vboID 1,2 and 3)

void Model::loadToVBO()
{
glGenVertexArrays(1, &vaoID);
glBindVertexArray(this->vaoID);

glBindBuffer(GL_ARRAY_BUFFER, vertexID);
glBufferData(GL_ARRAY_BUFFER, this->vertices.size()*sizeof(vec3), &this->vertices[0], GL_STATIC_DRAW);

glBindBuffer(GL_ARRAY_BUFFER, normalID);
glBufferData(GL_ARRAY_BUFFER, this->normals.size()*sizeof(vec3), &this->normals[0], GL_STATIC_DRAW);

glBindBuffer(GL_ARRAY_BUFFER, uvcoordID);
glBufferData(GL_ARRAY_BUFFER, this->uvs.size()*sizeof(vec2), &this->uvs[0],      GL_STATIC_DRAW);

glBindVertexArray(0);
}

if I do that in the render function i try to Bind to vaoID , and draw elements , but it would not work. To make it work i have to RELOAD vbo data every frame in Render Function (that happens because i have 2 models each model's constructor calls loadVBO , and obviously the second model overrides the first vbo's 1,2 and 3 ID positions(i was assuming that the vao generated from the first object will be entirely separate from the vao generated from the second model and each vao will have its own 3 VBOs). So maybe my code doesnt setup VAOs properly. Was reading something about how glEnableVertexAttribArray and glVertexAttribPointer
are used to set up current vbo state into vao , but could not understand it really well. Maybe because i use the same functions to bind to shaders variables ....

This code below is in the shader class and it loads the vbo data into shader's variables

void StaticShader::loadAttribute(GLuint bufferID, string variable, GLuint size)
{
GLuint variableID;
variableID = glGetAttribLocation(this->shaderProgramID, variable.c_str());
glBindBuffer(GL_ARRAY_BUFFER, bufferID);
glEnableVertexAttribArray(variableID);
glVertexAttribPointer(variableID, size, GL_FLOAT, GL_FALSE, 0, 0);
}

The Model Render Functions looks like that.
The loadToShader function loads: all model matrices + vertices + normals + uvs
This function calls the function loadAttribute for v, n and uvs ( i assume thats not where its supposed to be ... maybe)

void Model::Render()
{
glBindVertexArray(vaoID);
//loadToVBO();
loadToShader();
glDrawArrays(GL_TRIANGLES, 0, this->vertices.size());
glBindVertexArray(0);
}

My question is - Is it Bad (performance wise) to load VBO data every time render is called (i assume YES). Second part - Should i reload model data(meaning v/n/uvs) in shader every time its called to be rendered ?

sentences:
What's the difference between Textures and VertexTextures in XNA? The GraphicsDevice class of XNA has the properties Textures and VertexTextures.

What is the exact difference? I don't really understand what MSDN tells me about this.

I usually use Effect parameters to pass textures to my HLSL shaders. What are the differences between these methods, which is faster?

sentences:
How AAA games use this texture in the tone-mapping shader? I found that Battlefield 3 as well as Saint's Row the Third use this texture in their final tone-mapping stage. Can anyone share a link to an article about how this texture is used?

UPDATE: As there are hardly any examples of Color Grading implementation on the net, I will post my quick and dirty sample for XNA 4.0. This does nothing but builds the default 2d colormap from scratch on GPU, copies it's contents into a 3d texture on CPU and performs the actual color-correction with the shader code from the article provided in the answer.
XNA 4.0 Color Correction Sample
If you want to know what you can do with this, look here:
http://the-witness.net/news/2012/08/fun-with-in-engine-color-grading/
In short the author explains there, how you can basically make a screenshot of your normal in-game image with the default color grading palette on top, perform screenshot color correction in photoshop, cut and copy the deformed color correction palette into the engine and have that color correction applied for every in-game scene automatically.

sentences:
Embed IF text parser in another game? Are there any existing interactive fiction text parsing engines that I can embed in another game or application?

I'm looking to use something as a library. I can pass it the available objects and verbs from my own side. It will parse the sentences from the user and give me back some sort of structure/AST describing what the user asked for. Then my own code can then act upon that request.

I don't need something SIRI level. The simple sentences and actions that current IF games support is fine. But I'm not looking to write a whole text/sentence parser myself.

This isn't an If game and I can't write it entirely in an interactive-fiction language like inform 7. Unfortunatly, I can't seem to find any examples of anyone using the text parsing capabilities of these engines without writing the entire game in that engine's language.

sentences: Manual per-glyph rendering with SDL_TTF I'm trying to create a font atlas with SDL_TTF. My idea was to create an SDL_Surface for every character using TTF_RenderGlyph_Blended() and use TTF_GlyphMetrics() to get glyph metrics so that I can position the surface relative to a baseline. I'm struggling with a correct positioning of a glyph. It looks like SDL_TTF creates a surface with height which is at least the height of the font and width which is at least advance of a glyph, so the surface is bigger than just the glyph. How do I extract glyph's rectangle from the created surface? How do I position the glyph correctly relative to the base line on the screen? I thought y position of the glyph it should be baselineY - maxy (where maxy is from TTF_GlyphMetrics), but that places glyph too high above the base line.

sentences:
Help developing grid maps I have been working with Tiled and Cocos2d lately but am having problems understanding how Im suppose to be doing the maps.
Tiled is not an image editor, so I create my tileset in Gimp.  However it seems impossible for me to get grid lines that are the same as Tiled and so I dont know prior to importing the image (into Tiled) where the grid lines will be.

See the image below.  Both Tiled and Gimp's grid lines are set to 32px however the grid lines are nothing alike between the two programs

How can I get the grid lines to match so that I can draw stuff knowing how many tiles it will take.  Is there a better program for creating tileset or another way to do it?

sentences:
Incosistent jump, stuttering I've written this C# code to handle movement in my testing project. The game is supposed to be 2D, some kind of a platformer, just to get me started with Unity. However, it seems there's something odd going on. The movement isn't particularly smooth (especially in Editor, it's a bit better when built and ran as .exe file) and jumping is very inconsistent, meaning sometimes it jumps to a certain height and sometimes it jumps ridiculously high. Seems random.

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float MaxSpeed = 10f;
    public float JumpForce = 700f;
    public Transform GroundCheck;
    public LayerMask WhatIsGround;

    bool facingRight = true;
    bool isOnGround = false;
    float groundRadius = 0.2f;

    void FixedUpdate()
    {
        isOnGround = Physics2D.OverlapCircle(GroundCheck.position, groundRadius, WhatIsGround);
        if (isOnGround && Input.GetAxis("Jump") > 0)
        {
            rigidbody2D.AddForce(new Vector2(0, JumpForce));
        }

        float move = Input.GetAxis("Horizontal") * MaxSpeed;
        rigidbody2D.velocity = new Vector2(move, rigidbody2D.velocity.y);

        if ((move < 0 && facingRight) || (move > 0 && !facingRight))
            Flip ();
    }

    void Flip()
    {
        Vector3 scale = transform.localScale;
        scale.x *= -1;
        transform.localScale = scale;

        facingRight = !facingRight;
    }
}

Can anyone tell me what's wrong? There are just two simple platforms and one character, everything done in 2D mode with 2D psychics. The funny thing is that every tutorial handles movement differently and as a beginner in game development I'm kinda baffled by it.

Oh, and the version of Unity is 4.5.3f3, if that changes anything... I'm considering trying the newest beta of 4.6 to see if it is any better, because they're bragging about the new GUI and better 2D physics..
Also, I'm using Windows 8.1.

sentences:
Copyright information / issues (if any) for game I have always been a fan of the game Heroes of Might and Magic 3 (let's call it simply HOMM3), which shined long ago, around 1998.

For more information, this game was created by the 3DO company - which sadly went bankrupt in 2003. Then in 2015, somehow it was 'revived' (a rendition, actually) as HOM3-HD edition by Ubisoft.

Now, I'm thinking of my own game that uses the theme from this game (well, at least use the game characters and audio for example), which might be published onto Google Play and/or App store.

So I'm wondering: would there be any issues (e.g. risks of being sued, for example by Ubisoft) if I try to use HOMM3 (the original one, as I called it above) art and audio ? For audio, I still own a copy of HOMM3 so I have access to the audio (MP3) files directly from the game folder. For arts, there are spritesheets like this: spriters-resource, which seem to be freely available to use.

These are two versions (owned by 3DO vs owned by Ubisoft), but things could get complicated if we are not prepared, so better be safe than sorry.

sentences:
how to detect Unity UNET errors? I'm working on a simple multiplayer online game. and I use UNET and Networkmanager.

In my game I have some rooms and players that they can join to this rooms by connecting to specific server.exe file that I runned on a dedicated server.

My problem is when I use port 7777 for first server, if I run another server, then this error Appear :

  Cannot open socket on ip{*},and port{7777}

For now I solved this issue by building servers with specific ports.
for example in server1.exe I used port 7777 by default.
and server2.exe , 7778 and same for other servers .

But I want to do this automatically. I mean when the server recognize port 7777 is busy , then increase port number.

I want to know can I use try catch for this kind of errors ?
because I used try catch but it's not work.
I don't know how to use it. this is part of my code :

try
    {
        StartServer();
    }
    catch(Exception ex)
    {
        networkPort++;
        //then change port number and run server again
    }

I just looking for a way that my servers run by choosing right port automatically.

sentences:
Am I experiencing a gimbal lock problem when rotating my cube? So I'm trying to build a simple mechanic where the player see's 3 sides of a cube at a time: top, left and front(I called the front-side "Right" in my code, due to the orthographic view). The player can click on the front side or left side of the cube to rotate the cube so that the side that was pressed moves and becomes the top face. I want to smooth/animate the rotation.

The red faces are the faces that the user can click on.

My Logic seems to work quite well when I click on the left face (Rotating along the x axis), but doesn't seem to work well for the front/right face(It usually works once and then does weird stuff on the next click, this is on the z-axis)

public class CubeRotator : MonoBehaviour
{
    private const float STOP_THRESHHOLD = 0.1f;
    private const float ROTATE_AMOUNT = 90f;

    [SerializeField, Header("Touch Quads Colliders")]
    private Collider touchQuadLeft;
    [SerializeField]
    private Collider touchQuadRight;

    [SerializeField, Space(10)]
    private float timeToRotate;

    private bool mustRotateLeft = false;
    private bool mustRotateRight = false;

    private float targetX = 0.0f;
    private float targetZ = 0.0f;

    private float xVelocity = 0.0F;
    private float zVelocity = 0.0F;

    int layerMask;

    private void Start()
    {
        layerMask = LayerMask.GetMask("Touch Quad");
    }

    void Update()
    {
        ListenForTouch();
        RotateCube();
    }

    private void ListenForTouch()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector2 touchPoint = Input.mousePosition;
            RaycastHit rayCastHit;
            Ray ray = Camera.main.ScreenPointToRay(touchPoint);

            if (Physics.Raycast(ray, out rayCastHit, 150f, layerMask))
            {
                if (rayCastHit.collider == touchQuadLeft)
                {
                    mustRotateLeft = true;
                    targetZ = targetZ - ROTATE_AMOUNT;
                    zVelocity = 0f;
                }

                else if (rayCastHit.collider == touchQuadRight)
                {
                    mustRotateRight = true;
                    targetX = targetX + 90f;
                    xVelocity = 0f;
                }
            }
        }
    }

    private void RotateCube()
    {
        float zAngle = transform.rotation.eulerAngles.z;
        float xAngle = transform.rotation.eulerAngles.x;

        if (mustRotateLeft)
        {
            zAngle = Mathf.SmoothDampAngle(zAngle, targetZ, ref zVelocity, timeToRotate);

            if (Mathf.Abs(zVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateLeft = false;
            }
        }

        if (mustRotateRight)
        {
            xAngle = Mathf.SmoothDampAngle(xAngle, targetX, ref xVelocity, timeToRotate);

            if (Mathf.Abs(xVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateRight = false;
            }
        }

        transform.rotation = Quaternion.Euler(xAngle, 0f, zAngle);
    }
}

Inspector Values:

I've tried several things, the only problem I can think of is, gimbal lock. Thanks in advance.

sentences:
Follow behaviour with transform.LookAt on Unity2d So i've been trying to make an enemy follow my player on Unity2d using transform.LookAt.
While it does follow the player, It also rotates the enemy as well in 3D but my sprite is made for 2d so the sprite just vanishes. Any ideas?

//follows player
transform.position = Vector2.MoveTowards(transform.position, target.position, speedEnemy * Time.deltaTime);

//make enemy look towards player
transform.LookAt(target);

sentences: What's the recommended bitrate for Background Music in iPhone Games? What is the recommended bitrate for Background Music in iPhone Games?

sentences:
How far do I take Composition? (Although I'm sure this is a common problem I really don't know what to search for. Composition is the only thing I could come up with.)

I've read over and over that multiple inheritance and subclassing is really, really bad, especially for game entities. If I have three types of motions, five types of guns, and three types of armoring, I don't want to have to make 45 different classes to get all the possible combinations; I'm going to add a motion behavior, gun behavior, and armor behavior to a single generic object. That makes sense.

But how far do I take this?

I can have as many different types of behaviors as I can imagine: DamageBehavior, MotionBehavior, TargetableBehavior, etc. If I add a new class of behaviors then I need to update all the other classes that use them. But what happens when I have functionality that doesn't really fit into one class of behaviors? For example, my armor needs to be damageable but also updateable. And should I be able to have use more than one type of behavior on an entity at a time, such as two motion behaviors?

Can anyone offer any wisdom or point me in the direction of some useful articles?

Thanks!

sentences:
Why do I get a blank material in Unreal Engine 4? When I'm adding a material to a box in UE4, the material loses its textures.
I want to add this material

To this

After I'm trying to drag & drop the material into the scene above (like in UDK) the material loses its textures and does not apply:

When opening the material in Material-builder, the same thing happens: the material loses its textures and I've got these two errors on "Stats":

[SM5] (Node TextureSampleParameter2D) Param2d> Requires Texutre2D
[SM5] (Node TextureSample) TextureSample> Missing input texture

I've searched and found a thread where they say I need to save the material again to get things right. When I click the save button, I have this error:

The current material has compilation errors, so it will not render correctly in feature level SM5.

NOTE: Using DepthFade node + Lerp and changing the blend to translucent didn't resolved my issue.
Any idea?

sentences:
SDL Detect change score I have this in my loop , it works but I get verry low fps and game is working in slow motion :

while (!done)
    {
        //Check for events
        done = processEvents(window, &player);
        updateLogic(&player);

        sprintf(buffer, "SCORE: %d", player.currentScore);

        textSurface = TTF_RenderText_Solid(font, buffer, color);
        text = SDL_CreateTextureFromSurface(renderer, textSurface);

        SDL_QueryTexture(text, NULL, NULL, &textW, &textH);
        SDL_FreeSurface(textSurface);

        doRender(renderer, &player);
        SDL_DestroyTexture(text);
    }

I think I need to update those 2 only when score is changing , not every frame..and I don't know how to do it.

textSurface = TTF_RenderText_Solid(font, buffer, color);
text = SDL_CreateTextureFromSurface(renderer, textSurface);

sentences:
Android APK export duplicating libgdx assets folder I'm developing a game using libgdx targetting Java desktop and Android. For the assets I have a "data" folder inside the "assets" folder in the Android project. Then, I link it from the desktop project.

My problem comes when I export, my .apk contains:

assets
com
lib
data
META-INF
res
AndroidManifest.xml
resources.arsc
classes.dex

This means my data files are duplicated in "assets/data" and "data" being the first one the only relevant one. This increases my APK size from 5 to 10MB which is kind of annoying. In my file system I only have the "assets/data" folder, no trace of the intruder there.

Does someone have any ideas why is this happening? How can I solve it?

PS: I've tried deleting the intruder manually opening the apk with 7zip but that destroys the checksum and prevents updates to be properly installed (needs complete reinstall).

sentences:
How do I change a LÖVE2D game executable's icon? I merged my game.love file and the love.exe with the command copy /b love.exe+app.love game.exe. But the resulting executable has the default LÖVE2D icon.

Is there a way to change that icon to another one?

sentences:
Can learning how to do empirical research help a game developer? I know this may be an odd question, but I have the opportunity to take a graduate class that teaches how to do empirical research.

I've taken a Human-Computer Interaction class in the past where it was important to perform empirical studies to find out how users interact with your application and study what improvements can be made. I can see where doing the same type of empirical studies might be useful when developing a game.

Also, we get to choose the type of empirical research we do which I would choose to do on either computer graphics or game development. Would a class like this potentially be helpful for a wanna-be indie game developer?

sentences:
Why does this collision detection & resolution code only work for one side? I am having a bit of trouble with my collision detection. It only works correctly for the right side, meaning, if I enter the tile from any other side, it brings me to the right side.

Here is my code:

const float spriteWidth = 5.0f;
const float spriteHeight = 14.0f;

float x = position.X;
float y = position.Y;

if (bounds.Intersects(tileBounds))
{
    if ((x + spriteWidth) > tileBounds.Left)
        position.X = tileBounds.Left - 5;
    if (x < tileBounds.Right)
        position.X = tileBounds.Right;
    if ((y + spriteHeight) < tileBounds.Bottom)
        position.Y = tileBounds.Bottom;
    if (y > tileBounds.Top)
        position.Y = tileBounds.Top - 14;
}

I just don't see why it would do that. I am calling this function from the Game1.cs Update function, FYI.

And it only works for one tile out of a possible many, but that's for a later question...

Does anyone have an idea why it would do this? Thank you very much.

sentences:
Split tile based map file into multiple files I have a gigantic map file (1440x1080) that I wish to split into smaller files (45x45) for faster client reading.  I plan to split offline (when running DEV server) so I am not too worried about speed.  Picture the below as my source file:

5, 5, 5, 4, 5, 6, 5... 5
...
5, 6, 2, 44, 5, 66, 5... 5

I am getting the file to be slightly off towards the end - having trouble doing the math I suppose.  I am totally open to changing the code, but here is what I had so far:

int filesAcross = mapWidth / 45;
int acrossCount = 0;
int filesDown = mapHeight / 45;
int downCount = 0;
int totalFileCount = filesAcross * filesDown;

//create a bunch of stringbuilder holders to split the large file into
StringBuilder[] sbGroundLayerHolders = new StringBuilder[totalFileCount];
for (int kk = 0; kk < totalFileCount; kk++) {
    sbGroundLayerHolders[kk] = new StringBuilder();
}

int countt = 0;
while(scanner.hasNext()){
    int fileCounter = (acrossCount / 45) + ((downCount / 45) * filesAcross);
    //  LOGGER.info("fileCounter: " + fileCounter + "   acrossCount: " + acrossCount +
    //"   downCount: " + downCount + "   countt: " + countt);
    try {
        sbGroundLayerHolders[fileCounter].append(scanner.nextShort());
        sbGroundLayerHolders[fileCounter].append(",");
        acrossCount++;

        countt++;
    } catch (InputMismatchException e){
        scanner.nextLine();
        downCount++;
        acrossCount = 0;

        countt++;
    } catch (ArrayIndexOutOfBoundsException e){
        LOGGER.fatal("Array Out of Bounds on ground Layer - count:" + countt, e);
        System.exit(1);
    }
}

//write array contents into files
for (int kk = 0; kk < totalFileCount; kk++) {
    String s = sbGroundLayerHolders[kk].toString();
    s = s.substring(0, s.length() - 1);
    String[] sSplit = s.split(",");

    StringBuilder q = new StringBuilder();
    for (int jj = 0; jj < sSplit.length; jj++) {
        q.append(sSplit[jj]);

        if (((jj+1) % 45) == 0 && jj != 0) {
            q.append(System.lineSeparator());
        } else {
            q.append(",");
        }
    }

    LOGGER.info("map string(" + kk + "): " + q);
    //createFileLocally(folderPath, filename, text);
}

Here is a sample image of what I want to do (smaller scale).  Start with the big grid 6x6 and split into files 2x2.

sentences:
Triggering animation in character OnTriggerEnter? I've been stuck on this for hours.

I have a character whose animations are based in mecanim to transition based on the bool variable ShivaEnter. One invisible cube is set to change the bool value from false to true and vice-versa OnTriggerEnter.

The code is as follows:

using UnityEngine;
using System.Collections;

public class PontyAnimations : MonoBehaviour {

  //[SerializeField]
  private Animator animator;
  //private GameObject ponty;
  //private GameObject ponty;

  void Awake () {
    animator = GetComponent <Animator>();
  }

  void OnTriggerEnter (Collider other) {
    if (other.gameObject.tag == "Player") {
      animator.SetBool ("ShivaEnter", true);
    }
  }

  void OnTriggerExit (Collider other) {
    if (other.gameObject.tag == "Player") {
      animator.SetBool ("ShivaEnter", false);
    }
  }
}

sentences:
Why can a certain DirectX mode produce display lag? I have written two small test games using DirectX 9. One uses

presentParams.Windowed = false;

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

and the other one uses

presentParams.Windowed = false; // same results with true

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

Both use exactly the same window position, size and style. Both are written to cover the screen completely, even when using "Windowed = true".

In the latter game, to vsync and avoid tearing, my code waits until a certain scan line is passed. My tests showed: On different PCs it has to wait for different scan lines to avoid tearing completely. This is a drawback, since it has to be tweaked individually by the user. Is this technique used in any games?

And, compared to this technique, why does DirectX produce a display lag when "Windowed = false" is used with D3DPRESENT_INTERVAL_ONE?

To clarify where the lag occurs:

Windowed = false + INTERVAL_ONE => LAG

Windowed = false + ...IMMEDIATE    => no lag

Not mentioned in the question but tested:

Windowed = true;  + INTERVAL_ONE  => no lag, tearing

Windowed = true; + ...IMMEDIATE     => no lag

sentences:
Unity: Animation With Motion Now running in place I am new to unity.  I am trying to assemble a character that walks forward, stops, and walks forward again when I maneuver the joystick (ps4 controller) accordingly.

I have the whole thing pretty much set up...

However, my animations broke at some point.  Initially, when I added the animations to my character, the character moved with the animation according to the motion encoded in the animations (all of which were auto-rigged at Mixamo...so I am almost certain the bug is downstream in something I did or enabled somehow).

Now, every animation has the character running, turning, jumping etc. in place. Meanwhile, the animation subscreen (when I inspect the clip) shows the character running forward.   I tried implementing some fixes I found online;  I changed the root motion node to Root Transform, for instance...and that is when the most confusing thing happened: a few of the animations started working...but all of the animations showed the character running in place in the subscreen...so now I have no idea what is happening.

Additionally, the animation clips which do not move the character actually transform the character back to the starting position (actually, that isn't correct--I moved the character into the air to test this; the clips without motion transform the character back to the starting position on the ground).

I have disabled all scripts...so have I somehow broken the animations...??? Re-Importing the animations does not fix them either.

Here are the images of my character settings, then the controller, and then an animation clip which shows the character moving forward in the sub-clip and where motion information is clearly present...

sentences:
Make Enemies Walk Next to the Player I know the A* algorithm but if I have a long range (firing) enemy 20 metres away in 2D-land and I want it be about 3 metres away from its target (aka the player).

Is there an algorithm for choosing an appropriate path and square?

sentences:
ETC1 Support on android alpha problem (GLSL cocos2d-x) I want to support etc1 in my game, but somehow it doesn't work
(I'm using cocos2d-x

C++

 GLProgram* glp = new GLProgram();

glp->initWithVertexShaderFilename("testv.vsh", "test.fsh");
glp->addAttribute(GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::VERTEX_ATTRIB_POSITION);
glp->addAttribute(GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::VERTEX_ATTRIB_COLOR);
glp->addAttribute(GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::VERTEX_ATTRIB_TEX_COORD);
glp->link();
glp->updateUniforms();

Texture2D* tex = Director::getInstance()->getTextureCache()->addImage("MenuButton_alpha.pkm");

GL::bindTexture2DN(1, tex->getName());
GLuint t1Location = glGetUniformLocation(glp->getProgram(), "tex1");
glp->setUniformLocationWith1i(t1Location, 1);

MySprite->setShaderProgram(glp);

.vsh

attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D tex1;

void main()
{
    gl_Position = CC_MVPMatrix * a_position;
    v_fragmentColor = a_color;
    v_texCoord = a_texCoord;
    v_texCoord2 = v_texCoord;

}

.fsh

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord2;

uniform sampler2D tex1;

void main()
{
    vec3 tex = texture2D(CC_Texture0, v_texCoord).rgb;

    float alpha = texture2D(CC_Texture1, v_texCoord2).a;

    gl_FragColor = vec4(tex.rgb,alpha);
}

Somehow it shows my sprite in the middle but the transparent part is black.
can anyone help me?

sentences: How to edit specific mipmap images in a DDS? I am looking for a way to edit individual mipmaps within a DDS file. To my knowledge, the NVidia Plugin only lets you create the largest image and then computes the smaller ones automatically. However, the problem is that after long tests with the different available algorithms and sharpening strengths I still think that at least the 2nd and 3rd of the smaller mips could look better if created manually. Is there a way to do so?

sentences:
How can I disable Unity's default cursor functionality? Not too sure how to ask this, I'll try my best.

Currently, I'm working on a First-Person Controller. I'm adding functionality for a pause menu so that when you press escape, it will open the pause menu, unlock the cursor, and make it visible. If you press escape again, while the pause menu is open, it will do the opposite: hide the cursor and lock it again.

The problem I'm running into is that Unity already kind of does this. It doesn't matter if you're in the editor or if your game is built: whenever you press escape, it will unlock the cursor and show it, so you can exit the game (in a built application) or get out of play mode (in the editor).

I'm 99% sure this is Unity's default functionality. I have looked in Unity itself and haven't found a way to turn it off, and I have also looked online. Any help would be greatly appreciated.

sentences:
testPoint not working - libgdx I'm making a game like angry birds with LibGDX and box2d in which I want to drag a ball (instead of the bird) back before releasing it.

I deploy with testPoint function: when I touch down the screen, I check if the point is within the body of the ball or not but testPoint function never works exactly. Here's what I'm trying thanks so much:

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    for(Fixture fixture:bird.getBody().getFixtureList()) {
        if(fixture.testPoint(screenX/100, (mapHeight-screenY)/100)) { //100 is scaled parameter
             draggedBird = true;
             return true;
         }
    }
    return false;
}

sentences:
Activate and Deactivate Collider with Click I'm having some trouble working with this, it's basically a sword that points toward your mouse position, and when you Left-Click, a Trigger Collider is activated and then deactivated, but I can't get it to work.

Here is my code :

void Attack()
{
    //Activates the Sword Collider
    polygonCollider2D.enabled = true;
    //Debug Line
    Debug.Log("Collider Active");
    StartCoroutine(Wait(0.1f));
    polygonCollider2D.enabled = false;
}

IEnumerator Wait(float seconds)
{
    yield return new WaitForSeconds(seconds);
}

I did it this way hoping that the Wait method would give the game enough time to react to an active collider, and using some Debug.Log(). I know that the collider actually activates, but it does not react to other colliders.

I keep wondering if this is the proper way of working with this. If it's not, do let me know.

sentences:
2D Boxes/Vertices merging I want to optimize my colliders geometry, at the moment is composed by boxes (it's a tile based game) of the same dimensions, i want to remove the inner vertices to have, at the end, only the shell.
Does anyone knows or can point me out to the right direction/algorithm? The only way I can think about it's some kind of region growing with coordinates updating in a recursive way.

sentences:
Powerup Best practices In a turn based game each player has a set of properties, e.g attack, defence, speed and these can all be used to work out who should go first and how much damage should be dealt. That all works fine, but the problem I'm having is with edge cases where a player receives a power-up for one turn that lets them move first. How should I handle this? Should I increase the speed value and then somehow remember to reduce it next turn or should I implement some sort of object which holds modifiers that is checked every turn?

I'd also need to be able to scale this to different things like temporary poison etc.

Basically I'm very confused and help would be appreciated!

sentences:
Generating a map in runtime for a simple top-scrolling racing game I'm creating a simple top-scrolling racing game. The concept is quite simple - the player controls the car, which goes on a dynamically generated field with square blocks. Once the car hits a car, the game ends.

My first implementation was simply to put a few random blocks in each row being generated on the top of the screen, but this does lead to maps where going through is impossible.

What is the best algorithm for generating such type maps? My platform of choice is XNA and C#, if that's important.

EDIT: Here's an illustration: (pic)

In this case, there's no possible way for the player to pass.

sentences:
How would one get the pixel value of a texture under the cursor? I have a requirement to detect which pixel of a texture is under the cursor in the 3D world. I assume that Ray casting is involved however, after that I'm not sure how one would accomplish this.

Can anyone please point me to an example? Preferably one that does not require a PhD to understand... lol

sentences:
Where should I store an object? - QuadTree I'm designing a QuadTree to scene partitioning, I've read theory and seen some code examples.

When a node has more than 4 objects, it will be splitted into 4 sub-nodes and its objects will be put into them, but if an object is on the edges of any sub-node, it will be placed in the parent node. Why should I do this?

I think it's better put it on every sub-node where it's colliding. Am I wrong?. I've designed a pattern to achieve this ;).

sentences:
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

sentences:
Saving with PlayerPref problems I'm having troubles saving how much of an item I have in my game. Right now I have it so the price goes up the more items you buy, that works, but every time I reset the game, the count goes back to 0, while the price acts as if the count is at a higher number.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ItemManager : MonoBehaviour {

public UnityEngine.UI.Text itemInfo;
public GPS gps;
public Click click;
public float cost;
public int tickValue;
public int count = 0;
public string itemName;
private float baseCost;
private Slider _slider;

void Start()
{

    Load ();
    baseCost = cost;
    _slider = GetComponentInChildren<Slider> ();
}

void Update()
{
    PlayerPrefs.SetFloat ("Count", count);
    PlayerPrefs.SetFloat ("Cost", cost);

    itemInfo.text = itemName + " (" + count + ") " + "\nCost: " + cost + "\nGold: " + tickValue + "/s";

    _slider.value = click.gold / cost * 100;

    if (_slider.value >= 100) {
        GetComponent<Image> ().color = buyColor;
    }else{
        GetComponent<Image>().color = standard;
    }
}

public void BuyItem()
{
    if (click.gold >= cost)
    {
        click.gold -= cost;
        count += 1;
        cost = Mathf.Round (baseCost + Mathf.Pow (2f, count));
    }
}

public void Load()
{
    count = PlayerPrefs.GetInt ("Count");
    cost = PlayerPrefs.GetFloat ("Cost");
}
}

I've tried to figure this our for hours, and I just don't know what to do with this.

sentences:
Scripting: Loading all scripts at runtime vs loading scripts when needed I'm using Boo as a scripting language in my C#/.NET game via the in memory compiler with it and I really love it, however I'm having trouble deciding when I should load my scripts.

This is my first time using a scripting language with a game and my first time implementing one into anything.

Currently I load scripts as needed - this works well. However I end up with a lot of assemblies loaded(one per file currently, as I'm just loading each when it is needed) and realized as my game expands this could turn into a large number of assemblies - is this bad? I guess I could get around this by managing appdomains and loading/unloading after scripts haven't been used for a long time. I currently don't use any appdomains for my scripts at all so I end up with a lot of appdomains due to them getting recompiled while working on them.

Loading all scripts at the same time would be a big overhead when loading as my loading times are quite fast right now, rather big memory usage due to them all being loaded at the same time, and if I want to dynamically recompile scripts when they're changed while the game is running I have to recompile all of them. Currently I can just recompile them one file at a time. The benefits of this is that I obviously have a lot less assemblies loaded.

I guess my real question is having a lot of small assemblies loaded in C# a bad thing compared to one large assembly, and compiling scripts during gameplay vs a big loading screen?

sentences:
Model View Controller linking dynamic model to view I currently an implementing a game roughly using a model-view-controller setup. A single game controller instantiates a model and view. The model and view then instantiate child models and views, respectively passing references to the need models and view between them.

That works fine if the models and view are known at runtime (e.g. things that are guaranteed to exist such as the main character). My problem is when the model spawns game object models at certain times during gameplay (e.g, a randomly generated pickup). There needs to be a way for a view to also be created and the model passed as a reference to it. Of course, the model shouldn't have access to the view, but the view does have access to the model. What's a clean way to implement a system so that views can be dynamically generated and linked to their model counterparts?

One idea I had was the model can contain an array of "new" models that have not had views assigned to them already. When the view updates, it creates new views for each element in the array, assigns the models to themselves, and removes the element from the array. Thoughts? Thanks ahead of time.

sentences:
How would I delete lazers out of bounds I have a list of lazers(bullets) that i would like to delete specific instances from.  How would I go about doing that with the code I have now?
I first tried to pass in the player to a lazer instance and if that lazers out of bounds delete by indexing the lazer table with its id and setting that to nil.  But then the lazers stopped working with that logic.  Setting lazer to nil inside its own update function doesnt work either.(self = nil)
Lazer = Class("Lazer")
Lazer.isLazer = true
Lazer.count = 0
function Lazer:init(x,y,speed,rax,ray)
    self.position = Vector2(x,y)
    self.speed = speed
    self.velocity = Vector2(rax,ray):unit()
    self.id = Lazer.count
    Lazer.count = Lazer.count + 1
end
function Lazer:update(dt)
    self.position = self.position + self.velocity * self.speed * dt
    if not isPointWithinRect(self.position.x,self.position.y,0,0,windowWidth,windowHeight) then
       --what do i do here?
    end
end
function Lazer:draw()
    love.graphics.setColor(255,255,0)
    love.graphics.circle("line",self.position.x,self.position.y,5,5)
end

Player = Class("Player")
Player.isPlayer = true
function Player:init(joystick,x,y,speed)
    self.joystick = joystick
    self.position = Vector2(x,y)
    self.velocity = Vector2(0,0)
    self.speed = speed
    self.acceleration = acceleration
    self.terminal_velocity = terminal_velocity
    self.lazzer_speed = speed + 25
    self.lazers = {}
    self.timer = 0
end
function Player:update(dt)
    self.timer = self.timer + dt
    local lax,lay = self.joystick:getAxes()
    self.velocity.x = lax
    self.velocity.y = lay
    if math.abs(lax) > .1 or math.abs(lay) > .1 then
        self.velocity = self.velocity:unit()
    end
    self.position = self.position + self.velocity * self.speed * dt
    self.position.x = clamp(self.position.x,0 + 20,windowWidth - 20)
    self.position.y = clamp(self.position.y,0 + 20,windowHeight - 20)
    local _,_,rax,ray = self.joystick:getAxes()
    if (math.abs(rax) > .1 or math.abs(ray) > .1) and self.timer > .1 then
        table.insert(self.lazers,Lazer(self.position.x,self.position.y,self.speed + 250,rax,ray))
        self.timer = 0
    end
    for _,v in pairs(self.lazers) do
        v:update(dt)
    end
end
function Player:draw()
    love.graphics.setColor(255,255,255,255)
    love.graphics.circle("line",self.position.x,self.position.y,15,30)
    for _,v in pairs(self.lazers) do
        v:draw()
    end
end
```

sentences:
Words to describe stat stacking behavior? A character has a series of attributes.

Char {
    BaseStrength 1
    BaseHealth 100
    BaseLuck = 50
    BaseCharm = 20
}

and items will grant them modifiers

item0 {
  Modifier {
    Charm: + 1
  }
}

itemA {
  Modifier {
    Strength: ++ 1
  }
}

itemB {
  Modifier {
    Health: * 2
  }
}

itemC {
  Modifier {
    Luck: ** 1
  }
}

The way I was planning the operations + ++ * ** to work
was if a player has 2 of each type of item. it would stack as follows.

finalCharm = BaseCharm + item0.Charm (no stacking)

finalStrength = BaseStrength + itemA.Strength + itemA.Strength

finalLuck = BaseLuck + BaseLuck*(itemC.Luck + itemC.Luck)

finalHealth = BaseHealth + (BaseHealth * itemB.Health) + (BaseHealth * itemB.Health)

All except charm could be considered 'stacking' buffs.

itemA stacks additively, items B & C stack multiplicative.

How can I describe the stacking behavior differences between B & C to the player using words?

sentences: How to capture video of my mobile game? I've been keeping a blog for my current Android game and as I get closer to an actual playable version of the game, screenshots just aren’t enough to show new progress anymore. What I need is video. The problem is, my game won’t run on the current emulator (uses OpenGL ES 2.0), and my computer couldn’t run the emulator if it wanted to anyways. So desktop video capture is out of the question. The only real idea I have is holding the phone in front of the only video camera I own: a webcam… yeah. Does anyone know a better (preferably free) way to capture video from an Android device?

sentences:
2D Box Collision Trouble Hello I am trying to handle some simple box collision (axis-aligned) in my top-down 2d game, but running into a problem.

My game is running at a fixed time step, and checks for player-wall collision on each iteration. It retrieves some collision data (if it collided & what side of the bounding box) and adds some offset (dir) to the players position depending on the overlap amount.

// Check player with walls
        CollisionData col = testBoxCollision(m_player->getCollider(), wall.getCollider());
        if (col.isCollided){
            Vec2f dir(0.0f, 0.0f);
            if (col.left)
                dir.x -= (m_player->getCollider().getPosition().x + m_player->getCollider().getHalfSize().x) - (wall.getPosition().x - wall.getHalfSize().x);
            else if (col.right)
                dir.x += (wall.getPosition().x + wall.getHalfSize().x) - (m_player->getCollider().getPosition().x - m_player->getCollider().getHalfSize().x);
            if (col.top)
                dir.y -= (m_player->getCollider().getPosition().y + m_player->getCollider().getHalfSize().y) - (wall.getPosition().y - wall.getHalfSize().y);
            else if (col.bottom)
                dir.y += (wall.getPosition().y + wall.getHalfSize().y) - (m_player->getCollider().getPosition().y - m_player->getCollider().getHalfSize().y);

            m_player->GameObject::setPosition(m_player->GameObject::getPosition() + dir);
        }

The testBoxCollision function:

CollisionData testBoxCollision(const Collider& a, const Collider& b)

{
    CollisionData c{ false, false, false, false, false };

float w  = a.getHalfSize().x + b.getHalfSize().x;
float h  = a.getHalfSize().y + b.getHalfSize().y;
float dx = a.getPosition().x - b.getPosition().x;
float dy = a.getPosition().y - b.getPosition().y;

if (abs(dx) <= w && abs(dy) <= h)
{
    c.isCollided = true;

    float wy = w * dy;
    float hx = h * dx;

    if (wy > hx)
    {
        if (wy > -hx)
            c.bottom = true;
        else
            c.left = true;
    }
    else
    {
        if (wy > -hx)
            c.right = true;
        else
            c.top = true;
    }
}
return c;

}

The Problem

When two walls produce a corner, and I push my player up to the corner, the player goes through the wall. Not Ideal!

Clearly I've overlooked something and another set of eyes would be very helpful. Thanks.

Below is a snapshot of what's happening.

EDIT: I'm led to believe this is a math error, because it only happens on some corners at a consistent frame rate.

sentences:
How to orient a surface normal to a cubic surface The immediate question is: in HLSL, how can I orient a surface normal generated in UV space so that I can apply it to a cube face?

The overall project is that I'm trying to build a procedural planet generator.  I'm using a cube projected to a sphere where each face is a quad-tree.  The intermediate project is that I want to generate a normal map for the terrain.  I think the best way for me to do this (and understand what I'm doing) is to generate the normals for the cube version first, then work out the transformations to warp those normals to the sphere.

Ideally the method would not involve branching code based on which face I'm working on (i.e., if we're on the top side of the cube, then U = X and V = Y).  In other words, what I'm hoping for is some math-magic like "Oh, just cross multiply the terrain normal by the dot product of the cube face normal and blah blah blah".

9/20/10 ETA:

I know how to calculate normals for a flat surface.  My subsequent problem is two-fold:

How do I rotate the normal map so it is oriented correctly on each of the cube faces?
how do I warp the flat normal map so that it wraps the sphere?

I've found one solution that uses a Jacobian matrix, but I can't get it to work.  Even when all of the normals are pointing straight up (i.e. a flat surface), the HLSL code involving the Jacobian totally messes up the lighting--so it makes me not trust my implementation of the solution.

sentences:
Packet/Event-Based Entity-Component-System I know what one of the big commonalities I see in ECS projects is that there is a main game loop that iterates through systems and calls their respective update methods (for example, RenderSystem).

I'm a bit stumped on how this applies to an event-based game where the client sends packets of information and you update from there. For example:

MovementPacket

Read incoming movement packet and send to appropriate packet handler, which makes changes to appropriate components regarding entity through systems.
Packets are then sent back through the systems (which work with components to access the data needed to write these packets).

Now, I'm not sure where a game loop really comes in here, since everything seems to be event-based. I'm scared that most of the work I'm doing ultimately for ECS just isn't being done right. My systems are typically becoming "containers that do logic and stuff, but don't operate within a game loop."

In fact, the game itself doesn't have a game loop, since we haven't really found an area to insert it in.

Is the approach just wrong? Is my approach towards interweaving ECS with this packet-based game for the most part incorrect?

sentences:
Substance Painter: Fix color addition Substance Painter appears to add colors together wrongly when selecting "Normal Blending Mode"
The right side is what photoshop does correctly, meaning R+G+B values in the border region never exceed 255. On the left side is what Substance Painter does incorrectly, the green dot appears to have a glow around it.

If there is no quick way to fix this, I will have to export Red and Green and Blue layers individually and blend them together in Photoshop.

sentences:
Swing GUI for games (performance) I'm developing a game in Slick2D and I'm trying to make GUI.

I've already tried TWL library, but it seems to me a bit complicated and it doesn't cover what I need. In my own implementation of GUI I've encountered a problem with positioning of components. That's why I'm interested in Swing. I would use only its layout system and I would render components on my own (in Slick render loop).

So I'm asking, is it good for performance to do so? May I encounter other problems with Swing?

sentences: ActionScript 3.0 and iOS In Adobe CS5 you can export games to iOS, but all my research in the past indicated that Apple was not going to support Flash. It's my understanding that Adobe and Apple were working on this at one point and then Apple terminated the project. I was chatting with some other developers about this and one mentioned they were porting an AS3 project to their iPhone. Is there a way to get a Flash App on to the iStore? I don't think so.

sentences:
What is the best way to manage 'state' in Phaser? I have heard that this is not the best way to manage state in phaser

var game = new Phaser.Game(800, 600, Phaser.CANVAS,'YourGameName');
game.state.add("Boot", Boot);
game.state.add("Preload", Preload);
game.state.add("MainMenu", mainMenu);
game.state.add("Play", Play);
game.state.add("GameOver", GameOver);
game.state.start("Boot");

so what is the best way to do it. I am newbie in Phaser game development.

sentences:
Road / river generation on 2d grid map This is a newbie question, but here it goes:

My map is a 2d grid, and I want to generate roads and rivers. The route from the starting to ending point must not be the optimal route in number of tiles. Instead, they should have a certain level of randomness (turns).

Is there a standard algorithm for this kind of thing?

Cheers!

UPDATE:

This is the result of playing with weights on the grid, and applying a shortest path algorithm (Bellman-Ford) using the jgrapht library. I went with Donutz' answer after all.

http://pastebin.com/AGQGK5ik

sentences:
Effects to make a speeding spaceship look faster I have a spaceship and I've created a "boost" functionality that speeds up my spaceship, what effects should I implement to create the impression of high speed?

I was thinking of making everything except my spaceship blurry but I think there would be something missing. Any ideas?

Btw. I am working in XNA C# but if you aren't familiar to XNA describing some effects is still useful.

The Game is 3d and i've attached some printscreens of the game

This is in normal mode ( none boosted )

and here is the boosted mode ( the craft speeds up forward while the camera speeds in its normal speed , the non boosted speed )

sentences:
Determing an object's position along a curve over time I have some objects in my game which are "thrown". At the moment I am trying to implement this by having these objects follow a parabolic curve. I know the start point, the end point, the vertex and the speed of the object.

How can I determine at any given time or frame what the x & y co-ordinates are?
Is a parabolic curve even the right curve to be using?

sentences:
resizing directx control so that more of my object's environment is visible I'm very new in 3D. I have a DirectX control which I want to be able to resize. A 3D object is shown in the control. On resize, I would like that object to stay the same size, only more of its environments should be visible. As I understand, I only need to change the FOV for this, and I tried to deduce how from the second image here http://msdn.microsoft.com/en-us/library/windows/desktop/bb206341(v=vs.85).aspx.

My "solution" is:

    float newFov = (float)(2 * Math.Atan((height / prevHeight) * Math.Tan(fov / 2)));
    projection = Matrix.PerspectiveFovLH(fov, width / height, zNear, zFar);

(fov is the vertical fov here before the resize, height is the control's NEW height, width is its NEW width)

Problem is, this is not working, if I change the control's width only it looks OK (but then FOV really doesn't change, only aspect ratio), but if I change the height too my object is scaled. I'm starting to think that something in my thinking is fundamentally wrong. I would appreciate any help from you 3D gurus out there.

sentences:
How can I prevent cheating in a distributed multiplayer game? A problem I've been thinking about recently is how it might be possible to create a multiplayer game without a centralised game server.

Is it possible to distribute "server" responsibilities across players? I feel like it would be too easy for modified/hacked clients to change the multiplayer experience, are there any ways around this?

sentences:
Flex Build error Error of java WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.common.base.internal.Finalizer (file:/C:/computer/AIRSDK_Compiler/lib/guava-r08.jar) to field java.lang.Thread.inheritableThreadLocals
WARNING: Please consider reporting this to the maintainers of com.google.common.base.internal.Finalizer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Anybody can explain this error in the Flex?

sentences:
How do I let players control which key does what? New to coding so this is probably super simple, but I can't find the answer. I'm using Unity 5.4.0 and coding in C#.

Is there a variable for input keys?

I have a game I'm making and it is working good, but I want the players to be able to choose which key does what, but I don't know how to make the key presses changeable. I am using both Input.GetKeyDown(Keycode."KEY") and Input.GetKey(Keycode."KEY").

My question is: is there a variable I can use in place of the keys that I can make changeable by the players?  Like a float, but instead of numbers, it uses key codes.

sentences:
Rotate smoothly object to angle (Y axis) of the collided object Well, let's say I have two planes, one which I am moving, and another one that I collide with, that has a different y rotation. I want to make that, once both planes collide, the plane the user controls changes it´s rotation to the collided plane rotation.I´ve achieved it simply equaling both planes transform.rotations, but that was just a testing, i would like to rotate the plane smoothly. I have tried with eulerAngles, and Quaternion.Lerps, but it doesn´t work, or I am not following well the sintaxis. I know that a rotation and the eulerAngles are different values. There seems to be a solution with the dotween scripts, but I would like to learn the right approach to do it, rather than make it directly with dotween. Here I paste the trigger enter code, with the methods I tried (are commented). I guess that the rotation origin would be another issue.

void OnTriggerEnter(Collider col)
{
    if (col.gameObject.tag == "Plane")
    {
        Debug.Log ("Yup...Angle: " + col.gameObject.transform.rotation.y);
        //this.transform.rotation = col.gameObject.transform.rotation;

        /*newAngle 0 (this.transform.eulerAngles.x, col.gameObject.transform.eulerAngles.y, this.transform.eulerAngles.z);
        this.transform.eulerAngles(newAngle, 2 * Time.deltaTime);*/
        this.transform.rotation = Quaternion.Lerp (this.transform.rotation, col.gameObject.transform.rotation, Time.deltaTime * 0.1f);
    }
}

sentences:
What type of Collider should I add to a LineRenderer? I am currently building a game where I need to generate some wires (as Bézier curves) using LineRenderer. After changing the width of each line

lineRenderer.SetWidth (0.15f, 0.15f);

I am attaching an EdgeCollider2D to the same game object (specifying the same points used in generating the Bézier curve). This seems to work. However, I would like to be able to know if the Mouse Pointer is at any time over the EdgeCollider2D (something similar to the popular Fruit Ninja game). I'm using Raycast as follows:

void CastRay() {
    Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, Mathf.Infinity);

    if (hit) {
        Debug.Log (hit.collider.gameObject.name);
    }
}

I'm calling the CastRay method inside the Update method. Because EdgeCollider2D does not have width (as expected), the log message is never produced.

Do I need to use a different type of Collider? Do I need to call CastRay somewhere else?

sentences:
How to show a float with no decimals I want to show the current health and stamina of the player using GUI.Label. All is working fine however it shows the values with decimals to the millionth (example: http://gfycat.com/SkeletalSinfulKouprey). How would I go about showing only the whole number?

My code:

 var cur_stamina : float;
    var cur_health : float;

    var staminaRegenRate : float = 5;
    var healthRegenRate : float = 1;

    //regen
    if(cur_stamina < max_stamina){
        cur_stamina += staminaRegenRate * Time.deltaTime;
    }
    if(cur_health < max_health){
        cur_health += healthRegenRate * Time.deltaTime;
    }

    function OnGUI(){
        GUI.Label(Rect(1,1,100,20), "Health: " +cur_health);
        GUI.Label(Rect(1,15,1000,20), "Stamina: " +cur_stamina);
        GUI.Label(Rect(1,30,100,20), "Ammo: " +cur_ammo);
    }

sentences:
How do I apply Ambient Occlusion in Forward Rendering to the ambient term only? I want to integrate Ambient Occlusion into my rendering which is a forward renderer.
How do I apply Ambient Occlusion to the ambient term only and thus not as a "post process"  over the entire image (i.e. frambuffercolor * ambient occlusion)?

sentences: Model in Blender GLSL to XNA HLSL Is it possible to make model in Blender, with enabled GLSL, add multiple textures, etc, and then just load it in XNA, where's own HLSL? Will it work?

sentences: Unity - Modify basic dissolve shader graph to dissolve from bottom up I have this dissolve shader made in shader graph which works fine, however I would like it to dissolve from bottom up, how would this be done?

sentences:
How to create a curve from a set of points that passes through said points? What is the best way to create a smooth curve path from a set of points? For example:

I've seen Bezier curves before, but those try to smooth out the path from the set of points, like this:

sentences:
Simple framerate counter? I'm making a first person shooter, and I've seen questions like this before, but the answer is either overly complicated or they're using SDL, GLFW, GLUT, or something else. I'm not using any of that. OpenGL, C++, and GLEW for me.

I am just a little confused on how to do a framerate counter, so if I could get pseudo-code or some code-snippets that would point me in the right direction, that would help.

sentences:
How do I bring a child object in its original position after it is translated and rotated? This is the original position of the cube and its child object cone.

Over here, I have translated the cone for 2 units

Now I have rotated the parent cube around 25 degrees wrt to the Y-axis

If we translate the cone 2 units back again, it's not in the original position

What formula do I need to apply to the cone while translating it back to bring it back to it's original position?
Code: The below code is a coroutine for translating the child object
  IEnumerator MoveToNewPos()
 {
       Vector3 newPos += Quaternion.Euler(0, 0, 135) * Vector3.left * distance;

    float t = 0;
    float animTime = 30;
    isMoving = true;
    for (; Vector3.Distance(transform.position, newPos) > 0.001f; t += Time.deltaTime)
    {
        float p = t / animTime;
        transform.position = Vector3.Lerp(transform.position, newPos, p);
        yield return null;
    }
   isMoving = false;
}

sentences:
Unity: Disable push on dynamic Rigidbody2D objects I have a player, and several NPCs.
I also have several static colliders in the world (trees, water, fence, etc), I want my NPCs to collide with this, so the Rigidbody2D needs to be dynamic, since kinematic does not collide with static colliders (colliders without a rigidbody).

My problem is that since both player and NPC have dynamic rigidbodies, they push each other when they collide.
I could disable this by setting the following in the NPC script:

void OnCollisionEnter2D(Collision2D other){
    if (other.gameObject.name == "Player") {
        isMoving = false;
        myRigidBody.isKinematic = true;
    }
}

However, the NPC still gets pushed a few pixels before it stops, its barely noticable, but it is noticable, and if you keep colliding with the NPC you could move it as far as you wanted (tedious, but possible).

I've spent a few hours looking and cannot find a good solution to this.
I want my NPC to collide with static colliders, but I don't want them to get pushed by the player. How can I solve this?

sentences:
The animation state could not be played because it couldn't be found! If I try to use animation.Play() or have Play automatically ticked in the inspector on the animtion object, it gives me the follwing error:

The animation state could not be played because it couldn't be found!

I searched around the web and everywhere they say you need set the animation type to 'legacy', but I already changed type to legacy and it did NOT fix the problem.

Thanks in advance.

sentences:
Tracking small moving targets in Vuforia I am trying to track up to two small moving objects the size of a small toy car (about 7x4x4 cm / 3x2x2”)  from a 75cm / 2ft distance. I’m aware that the distance/size ratio is about 20, which is off by factor compared to the by Vuforia recommended ratio.

I've tried frame markers and while frame markers are super fast close up, they don't work well at a distance. I'm hesitant to use expensive object recognition on moving targets. I’ve tried black and white QR codes and AR markers as image targets but Vuforia seems to have trouble recognizing them, even though the QR code has a five star rating.

I’m considering two more options:

1) an optimized 4x4cm color image target

2) add LEDs to the objects and track the LEDs, for example like this: https://www.youtube.com/watch?v=IoL0bIGk_uE

My questions:

1) Are there specific tips for creating small image targets (I have read the generic image target optimizations tips assume not all those tips apply to small targets)

2) Is there an easy way to track LEDs in Vuforia?

sentences:
How do I smooth out latency jitter in my netcode? I'm developing a multiplayer game and I'm following some articles I've found online to create an authoritative client-server model.

Reading this article, Valve says that every time a message is received, the client assumes the "current" time is the time in the latest packet, in the article they state it:

  It is assumed in this paper that the client clock is directly synchronized to the server clock modulo the latency of the connection. In other words, the server sends the client, in each update, the value of the server's clock and the client adopts that value as its clock. Thus, the server and client clocks will always be matched, with the client running the same timing somewhat in the past (the amount in the past is equal to the client's current latency). Smoothing out discrepancies in the client clock can be solved in various ways.

And interpolation of remote entities:

  Each update contains the server time stamp for when it was generated
  From the current client time, the client computes a target time by subtracting the interpolation time delta (100 ms)
  If the target time is in between the timestamp of the last update and the one before that, then those timestamps determine what fraction of the time gap has passed.
  This fraction is used to interpolate any values (e.g., position and angles).

Now obviously due to jitter, my interpolation looks terrible as I will receive time + latency jitter. So my question is, is on this part: "Smoothing out discrepancies in the client clock can be solved in various ways."

What would be a good way to smooth out any discrepancies?

sentences: Unity shaders and textures not transferring properly when using github We have the game code on github, when we try to clone onto different machines the shaders and textures do not transfer over properly. Has anyone else noticed this problem using gitHub?

sentences:
Do I need Texture Units when NOT using shaders? Does calling glActiveTexture() even make sense when not using shaders?

I only have to switch the textures before drawing a buffer with glBindTexture(), right?

sentences:
Tutorial System in Unity C# I am having trouble creating a tutorial level for my game in Unity. The first problem is efficiency. I have a script below, which displays the dialogue. And I want to know the best way to create goals that the player can meet without excessive amounts of script.

using UnityEngine;
using System.Collections;
using System.IO;
using System;
using UnityEngine.UI;

public class TutorialSystem : MonoBehaviour
{
bool canSpeak = true;
protected StreamReader reader;
public Text Dialogue;
string sLine = " ";
public string SourceName;
string[] lines;
ArrayList arrText = new ArrayList();
int i = 0;

void Start()
{

    reader = new StreamReader("Assets/Resources/" + SourceName + ".txt");
    while(sLine != null)
    {
        sLine = reader.ReadLine();
        if(sLine != null)
        {
            arrText.Add(sLine);
        }
    }
    reader.Close();
    sLine = arrText[i].ToString();
    StartCoroutine(Typewrite(sLine));
    i++;
}

void Update()
{
    if(Input.GetButtonDown("Submit") && canSpeak)
    {
        sLine = arrText[i].ToString();
        StartCoroutine(Typewrite(sLine));
        i++;
    }
    if (Input.GetButtonDown("Submit") && !canSpeak && i == arrText.Count)
    {
        Dialogue.text = null;
    }

}

IEnumerator Typewrite(string message)
{
    canSpeak = false;
    Dialogue.text = null;
    foreach (char letter in message.ToCharArray())
    {
        Dialogue.text = Dialogue.text + letter;

        yield return new WaitForSeconds(0.01f);
    }
    canSpeak = true;
    if (i == arrText.Count)
    {
        canSpeak = false;
    }
}

}

The second problem is how to I make it expandable, currently the text reads a .txt file line by line. Does anyone have a suggestion on how I can change this to be used in situations such as character interaction or should I just make another script entirely for that?

Many thanks in advance.

sentences:
Blurry text in Unity UI at default scale I'm working on a VR (GoogleVR Cardboard) game, and need to include UI elements within it.

Ever since I first learned how to use Unity's UI elements, I've been limping around what seems to be a major problem: at the default (1,1,1) scale, literally everything involving fonts that I add to a world-space Canvas ends up looking like scaled, blurry bitmaps.

I can kludge around the problem by manually changing the scale of everything UI-related to (0.1, 0.1, 0.1) and multiplying the dimensions of everything by 10... but I can't believe this is how Unity's UI editing is intended to work by design.

Somewhere along the line, I must have overlooked something major. The question is... what? Is there an option somewhere to either make Unity render fonts at a higher resolution, or to at least change the default scale for new items from (1,1,1) to (0.1, 0.1, 0.1) & multiply all the default dimensions for new UI items by 10?

sentences:
How to manage game objects, npcs, items? i'm making a small 2D game, designed the maps with Tiled, and adding "basic" world object/items/npcs/mobs to test it a bit and have fun.
Now i have encountered a relatively huge problem, with further development of the world, as our small team has grown by 3 volunteers we have to cover large amounts of
(note most of this data, other than AI, is JSON)

quests
items
npcs
mobs
skills
armor
weapons

we tried to keep track of the editing with revisions, comments, we also used milestones for patching/fixes/hotfixes, and so on.

Our basic tools:

Spreadsheet, which has served well but we discovered that we can't do much with revisions of on a game item or weapon.
we also tried Redmine, but other than issues, this doesn't serve our needs

Can some suggest and alternative way of managing this, or any opens-source tool? that will just make our development a bit easier, than the pain that its right now.

Or is one of those situations that we need to develop a specific tool for our needs?

sentences: Does the Facebook app need to be installed to use Facebook for Game Developers? I just learned about Facebook for Game Developers. I would like to know if I need to have the Facebook app installed in my phone to use Facebook for Game Developers (like I need to install Google play games services in android).

sentences:
OpenGL : sluggish performance in extracting texture from GPU I'm currently working on an algorithm which creates a texture within a render buffer. The operations are pretty complex, but for the GPU this is a simple task, done very quickly.

The problem is that, after creating the texture, i would like to save it.
This requires to extract it from GPU memory.

For this operation, i'm using glGetTexImage(). It works, but the performance is sluggish. No, i mean even slower than that. For example, an 8MB texture (uncompressed) requires 3 seconds (yes, seconds) to be extracted. That's mind puzzling. I'm almost wondering if my graphic card is connected by a serial link...

Anyway, i've looked around, and found some people complaining about the same,
but no working solution so far. The most promising advise was to "extract data in the native format of the GPU". Which i've tried and tried, but failed so far.

Edit : by moving the call to glGetTexImage() in a different place, the speed has been a bit improved for the most dramatic samples : looking again at the 8MB texture, it knows requires 500ms, instead of 3sec. It's better, but still much too slow. Smaller texture sizes were not affected by the change (typical timing remained into the 60-80ms range).

Using glFinish() didn't help either. Note that, if i call glFinish() (without glGetTexImage), i'm getting a fixed 16ms result, whatever the texture size or complexity. It really looks like the timing for a frame at 60fps.

The timing is measured for the full rendering + saving sequence. The call to glGetTexImage() alone does not really matter. That being said, it is this call which changes the performance.

And yes, of course, as stated at the beginning, the texture is "created into the GPU", hence the need to save it.

Edit 2 : I've also tried to use glReadPixels(), instead of glGetTexImage(). But it's worse unfortunately. Approximately twice slower.

Edit 3 : Here is the code. Note that it uses a "framework" that i've not developed. So some of the function calls here are not OpenGL standard. But they are nonetheless quite self-expressive.

glDisable(GL_BLEND);

// Simple construction, for test : the resulting texture is output into render buffer
renderbufx1.bind();
    clear(0,0,0,0);
    simpleDiffShader.bind();
    simpleDiffShader.setTexture("TextureRef",img.tex,0);
    simpleDiffShader.setTexture("TextureDown",renderbufx2.getTexture(),1);
    img.tex->drawPart(-1,-1,2,2,0,0,1,1);
    simpleDiffShader.unbind();
renderbufx1.unbind();

// Not really useful, but just in case, the result is copied into another render buffer.
// renderbufx1 is going to be displayed, and i want to avoid any access conflict
savebufx1.bind();
    clear(0,0,0,0);
    renderbufx1.getTexture()->bind();
    renderbufx1.getTexture()->drawPart(-1,-1,2,2,0,0,1,1);
    renderbufx1.getTexture()->unbind();
savebufx1.unbind();

savebufx1.getTexture()->bind();
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_BYTE, t.data);  // <-- This is the line
savebufx1.getTexture()->unbind();

glEnable (GL_BLEND);

renderbufx1.getTexture()->bind();
renderbufx1.getTexture()->drawPart(tex2x,-1,w,h,texSpan,texSpan,fact,fact);
renderbufx1.getTexture()->unbind();

Timing measured encompasses all this (and a few other things, which do not really contribute to the total).

Edit 4 : (on course for the most edited question of the week)

The native texture format of the GPU is supposed to be retrieved through the function glGetTexLevelParameter. More precisely, i've used this line of code :

glGetTexLevelParameteriv ( GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &iTexFormat);

The result of the function (within iTexFormat) is 32856.
32856, decimal, is 0x8058, and within gl.h there is :

#define GL_RGBA8 0x8058

sentences:
In a JRPG Battle system. Who executes the selected action? Throughout the JRPG history, we've seen the introduction of many a battle system type. Like the classic turn-based. The ATB. The action battle system  (Most Notable is Kingdom Hearts)

In these systems, there's a variety of skill handlers like a queue or gauge to determine turn. My question put simply is who handles the executing of skills? Is it the Battle system? The Players? The Skill queue if there is one?

Right now I'm working on an ATB styled Final Fantasy in Unity. I'm leaning towards either the player or the battle system executing the commands. I have my players with each a separate state machine (WAIT, COMMAND, ACTION) And a command queue that holds the queued up actions. I can either have the player in the ACTION state and the battle system process the logic(Execute whatever queued up action). Or the player handle that.

Outside of that. I'm curious how it works for the other types of battle systems since I hope others in the future with a similar question can see this.

sentences:
Unity WebGL responsive I am trying to embed Unity WebGL to a web page.

I wonder, is it possible to make this responsive, so it will always fit whatever the screen size? How to do that?

Thank you for answering.

sentences:
Getting a uint color array from a portion of a Texture2D I'm currently using the Farseer tools to create a body from a Texture2D. However, my texture is a spritesheet and I need to get the uint array containing the colors from a portion of the full Texture2D.

Let's say may texture is 200x200 big and I need to get the colors in the Rectangle(20, 20, 40, 40). I know that there is a GetData() overload and I'd imagine I have to call it like this:

        uint[] subData = new uint[40 * 40];
        polygonTexture.GetData(0, new Rectangle(20, 20, 40, 40), subData, 0, 40*40);

However, I always get a System.NotImplementedException, probably due to MonoGame. Is there another easy way to do this? Or do I have to create a Subtexture and then get the Colors from that subtexture?

sentences:
Andengine Rotate Wheel with fast acceleration I have a Wheel sprite and i am rotating it using Physics RevoluteJointDef. Its rotating.
But problem is how i can make wheel to start moving fast. It took the speed after sometime like real.

// Create body for green rectangle (Static)
    final Body greenBody = PhysicsFactory.createBoxBody(pw, greenRectangle, BodyType.StaticBody, PhysicsFactory.createFixtureDef(0, 0, 0));

    // Create body for red rectangle (Dynamic, for our arm)
    final Body redBody = PhysicsFactory.createBoxBody(pw, wheel, BodyType.DynamicBody, PhysicsFactory.createFixtureDef(1, 0.5f, 0.1f));
    pw.registerPhysicsConnector(new PhysicsConnector(wheel, redBody, true, true));

    // Create revolute joint, connecting those two bodies
    final RevoluteJointDef revoluteJointDef = new RevoluteJointDef();
    revoluteJointDef.initialize(greenBody, redBody, greenBody.getWorldCenter());
    revoluteJointDef.localAnchorA.set(0,0);
    revoluteJointDef.localAnchorB.set(0,0);

    revoluteJointDef.enableMotor = true;
    revoluteJointDef.motorSpeed = 100;
    revoluteJointDef.maxMotorTorque = 1000;

    pw.createJoint(revoluteJointDef);

    registerUpdateHandler(pw);

sentences:
Screen transition effect like subway surfers I would like to know how can I achieve this kind of screen transition effect ? The effect is screen independent.

https://www.youtube.com/watch?v=Muh7QFisCfE#t=01m57s

sentences:
Playing NSF music in FMOD.net So, as the title says, I want to be able to play NSF files using FMOD, because my project already uses FMOD and I'd rather not replace it. This will involve figuring out how existing players and emulators work and porting it. I haven't yet found an existing player that uses FMOD.

My starting point is the MyNes source from http://sourceforge.net/projects/mynes/. There are two big steps between here and what I'm looking for.

MyNes plays from a ROM, not NSF. So, I have to rip out the APU and get it to play NSF files.
The MyNes APU uses SlimDX, so I have to convert that to FMOD.NET.

I am really stuck about how to go about either of these, because I'm not that familiar with audio formats and it's hard finding resources online. So here are a few questions:

From what I can tell from the NSF spec at http://kevtris.org/nes/nsfspec.txt, it's just contains the relevant memory section of the ROM, plus the header. If anyone can verify or correct this that would be great.
The emulator APU uses data from the rest of the emulator to play, including things like cycle counts. I'm not sure what replaces this in a standalone player. Can't I just load all the music data at once into a stream and play it?
Joining #1 and #2, does the header data from the NSF substitute for some of the ROM data in the emulator code?
Using FMOD, will I be following the usercreatedsound example for loading a stream? And does this format count as PCM? Specifically MyNes says PCM8. Any tips on loading / playing the stream in FMOD are appreciated.

As an aside, I don't really understand the loading / playing sections of the spec I linked at all. It seems to apply to 6502 systems / emulators only and not to my situation.

I know it's a long shot for anyone here to have enough experience in this area to help, but anything you can provide is definitely appreciated. A link to an existing .NET library that does this would be even better, but I don't believe one exists.

sentences:
How to handle the top of a slope in a 2D tile-based platformer? I'm working on a 2D tile-based platformer that supports 45-degree slope tiles.

There are several questions on the topic, but none seem to cover this precise problem that I have. This excellent article covers almost everything I'd want to know. I'll copy the salient bits:

  Make sure that you step X position before Y position.
  During collision detection, the slope only counts as a collision if its closest edge is the taller (smaller y coordinate) one. This will
  prevent characters from “popping” through the slope from the opposite
  side. [...]
  A full obstacle tile adjacent to the slope the character is currently on should not be considered for collision if it connects to
  the slope, that is, if the character (that is, his bottom-center
  pixel) is on a {0, *} slope, ignore left tile, and, if on a {*, 0}
  slope, ignore the right tile. You may have to do this for more tiles
  if your character is wider than two tiles – you might simply skip
  checking on the entire row if the player is moving towards the upper
  side of slope. The reason for this is to prevent the character from
  getting stuck at those tiles (highlighted yellow above) while still
  climbing the slope, as his foot will still be below the “surface
  level” by the time he comes into contact with the otherwise solid
  tile.

So if the character is going uphill, we essentially allow him to penetrate the slope after we've stepped the x coordinate, and then rectify that when we step the y coordinate. Let's assume we're using one contact point for the characters feet:

However, when the character reaches the top of the slope, at some point he'll step into the next tile:

As per the last bullet point above, we allowed him to move into the solid tile because it's ajacent to the slope. But now we're inside the floor, which needs to be fixed somehow.

What logic is needed to correctly resolve this situation? Simply saying "if we penetrate a solid tile, move up until we're out of it" doesn't always work, because there might be another solid tile on top of it, and we don't want the player to be teleported all the way to the top.

Can this be done without any communication between the x update and the y update, or do we need to keep some state like "I was on a slope at the start of this frame"? What is the most robust and elegant way to handle this?

sentences:
How to calculate the ideal hit of arrow? I am trying to make the AI shoot an arrow and always hit the target. Assuming that the target is within his range I am stuck what the correct way is to do this. I search and found some solutions but they do not seem to work 100% perfectly in my code
(How can I shoot an arrow if I know the shot power and target?).

My code is (target is the prefab I want the AI to hit):

arrow.GetComponent<Rigidbody>().AddForce (Aim()*speed, ForceMode.VelocityChange);

private Vector3 Aim()
{
    float xAim = target.transform.position.x - transform.position.x;

    float yAim = Mathf.Rad2Deg * Mathf.Atan((speed*speed + Mathf.Sqrt(speed*speed*speed*speed) - (-Physics.gravity.y) * (-Physics.gravity.y * HorizontalDistance()*HorizontalDistance()) + 2 * VerticalDistance() * speed*speed / -Physics.gravity.y * HorizontalDistance()));
    float zAim = target.transform.position.z - transform.position.z;
    Vector3 aim = new Vector3(xAim, yAim, zAim).normalized;
    return aim;
}
private float HorizontalDistance()
{
    float xDistance = target.transform.position.x - transform.position.x;

   // float zDistance = target.transform.position.z - transform.position.z;
    float distance = Mathf.Sqrt(xDistance*xDistance);// + (zDistance*zDistance));

    return distance;
}
private float VerticalDistance()
{
    return Mathf.Abs(target.transform.position.y - transform.position.y);
}

sentences:
Are constantly growing (in dimensional size) GameObjects a problem? It's possible the following is fundamental to Unity, and not a problem?

I am using an example of a WheelJoint2D/Car from the Ray Wenderlich tutorials. Note from the pic below, the top level game object called "Car". It has children of "Body" which contains the wheel joints and the wheels (attached to the wheel joints). The top level "Car" GameObject is placed in the scene (here at X=6.4).

Now we run the game for a short time, and the car rolls forward as expected. From the inspector, we would see that X position of the Body and the wheels has changed, but note that the Car game object's X position has not changed:

So, in reality the game object "Car" has grown in the X-dimension. Granted this growth seemingly has nothing to do with physics simulation (as all the rigidbodies and joints are moving along as expected). One interesting side affect is that this growth might make scaling the parent object problematic.

But it seems that if this were an infinite runner, you would have an ever increasingly wide "Car" object. On the surface this seems undesirable, but is it really? And if so, how would you mitigate this (given that this game object hierarchy seems to be the prescribed way of using the wheel joints).

sentences:
Procedurally splitting and merging paths I'm making a text-based adventure which sends the player along different paths depending on their choices.  Each scene is like a node in a directed graph. Each node has a time step which is equal to the number of nodes prior + 1.  There is a maximum of Tn nodes per time step, say 5, and so you can visualise this in this way:

I want to generate paths like these.

Where a node points to more than one other, that could be called a fork and where two point to one, that could be called a merge.

At any particular timestep there will tend to be Tn / 2 paths, only rarely going down to one or up to Tn.

Does anyone have ideas or know of any similar work?

(One small issue - paths never cross - that is, those on the left stay on the left until merging to the right.  And there's no wrapping from far left to far right.  Because of this, it seems like nodes on the far left or far right of a timestep will have a smaller probability of merging.  Is this avoidable?)

sentences:
Problem with stencil in directx 12 I'm trying to use stencil buffer in directx 12. I have problem that probably is really easy to solve.
So, it's look like dx12 ignore it, ClearDepthStencilView() affect only depth, writing to stencil doesn't work.

D3D12_DEPTH_STENCIL_DESC for PSO:

static D3D12_DEPTH_STENCIL_DESC const defaultDepthStencil =
{
    /*DepthEnable*/                         TRUE
    /*DepthWriteMask*/                      ,D3D12_DEPTH_WRITE_MASK_ALL
    /*DepthFunc*/                           ,D3D12_COMPARISON_FUNC_LESS
    /*StencilEnable*/                       ,TRUE
    /*StencilReadMask*/                     ,D3D12_DEFAULT_STENCIL_READ_MASK
    /*StencilWriteMask*/                    ,D3D12_DEFAULT_STENCIL_WRITE_MASK
    /*FrontFace.StencilFailOp*/             ,{ D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilDepthFailOp*/        ,D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilPassOp*/             ,D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilFunc*/               ,D3D12_COMPARISON_FUNC_ALWAYS }
    /*BackFace.StencilFailOp*/              ,{ D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilDepthFailOp*/         ,D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilPassOp*/              ,D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilFunc*/                ,D3D12_COMPARISON_FUNC_ALWAYS }
};

DSV heap desc:

D3D12_DESCRIPTOR_HEAP_DESC dsvHeapDesc = {};
    dsvHeapDesc.NumDescriptors = 1;
    dsvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
    dsvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;

DSV desc:

D3D12_DEPTH_STENCIL_VIEW_DESC depthStencilDesc = {};
    depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    depthStencilDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
    depthStencilDesc.Flags = D3D12_DSV_FLAG_NONE;

Resource desc:

m_gBuffer[GB_Depth].Dimension( D3D12_RESOURCE_DIMENSION_TEXTURE2D );
m_gBuffer[GB_Depth].Width( m_width );
m_gBuffer[GB_Depth].Height( m_height );
m_gBuffer[GB_Depth].DepthOrArraySize( 1 );
m_gBuffer[GB_Depth].MipLevels( 1 );
m_gBuffer[GB_Depth].Format( DXGI_FORMAT_R24G8_TYPELESS );
m_gBuffer[GB_Depth].SampleCount( 1 );
m_gBuffer[GB_Depth].Layout( D3D12_TEXTURE_LAYOUT_UNKNOWN );
m_gBuffer[GB_Depth].Flags( D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL );

Then OMSetRenderTargets() and ClearDepthStencilView() with flags D3D12_CLEAR_FLAG_DEPTH, D3D12_CLEAR_FLAG_STENCIL.

Any idea what's missing?

sentences:
Ashikhmin-Shirley model implementation: ugly result I am trying to implement the Ashikhmin-Shirley model using these formulas:

This is the GLSL 1.2 fragment shader code:

uniform vec4 materialAmbient, materialDiffuse, materialSpecular;
uniform float materialShininess;
uniform vec4 lightAmbient, lightDiffuse, lightSpecular, lightPosition;

varying vec3 P,N;

float pi= 3.1415926535;

vec4 Fd(float NdotV, float NdotL) {
    vec4 fd= (28.0 * materialDiffuse * lightDiffuse) / (23.0 * pi) * (1.0 - materialSpecular * lightSpecular);
    fd*= 1.0 - pow(1.0-NdotV/2.0,5.0);
    fd*= 1.0 - pow(1.0-NdotL/2.0, 5.0);
    return fd;
}

vec4 Fr(float u, vec4 specular) {
    return specular + (1.0-specular) * pow(1.0 - u, 5.0);
}

// f= phi
vec4 Fs(float VdotH, float NdotH, float NdotL, float NdotV, float et, float eb, float f) {
    vec4 fs= Fr(VdotH, materialSpecular * lightSpecular);
    fs*= sqrt((et+1.0) * (eb+1.0)) / (8.0 * pi);
    fs*=  pow(NdotH, et*pow(cos(f),2.0) + eb*pow(sin(f),2.0)) / (VdotH * max(NdotL, NdotV));
    return fs;
}

void main(void) {
    vec3 L= normalize(vec3(lightPosition) - P);
    vec3 V= cameraPosition;
    vec3 H= normalize(L+V);
    float NdotL= max(dot(N,L),0.0);
    float NdotV= max(dot(N,V),0.0);
    float NdotH= max(dot(N,H),0.0);
    float VdotH= max(dot(V,H),0.0);
    gl_FragColor= Fd(NdotV, NdotL) + Fs(VdotH, NdotH, NdotL, NdotV, 128.0,128.0,1.0);
}

I already checked and it seems like all the uniforms and varying are passed in the right way, I pass P and N from the vertex shader. The variables are:

Light direction: L;
Surface normal: N;
Camera direction: V;
Half vector: H;
Fragment position: P.

The uniforms I pass are:

light{Specular | Diffuse | Ambient} : 0xffffff (converted to a rgba vector of course);
materialAmbient: 0x543807 ;
materialDiffuse:  0xc6901d;
materialSpecular: 0xfdefce;
materialShininess: 27.8974.

This is the result I get:

Which seems very strange to me, I've seen other images of Ashkhmin-Shirley implementations on the web, and they aren't similar. This is an example:

I want one like this !! Maybe I am using wrong values of phi and other values? Or there's something wrong in the formula?

sentences:
using odd number of sprites in multi-row spriteSheet? Using XNA it's pretty easier to loop through a sprite sheet, I tell it how many rows and how many columns it has and I have a method that loops through the whole set.

I usually use this method in my sprite class, but I have a sprite sheet that has a odd number of sprites, and does not use the entire last line.  Any ideas on how to do this?

for example: I have 3 rows of 6 columns, but on the last row I only have 3 sprites.

Thanks!

sentences:
Time of Day Lighting / Day Cycle I'm trying to implement a simple "lighting" system that alters a value of light between 0.0-1.0, 1.0 is midday 0.0 is total blackness.

Are there any "good" information regarding this particular subject or is it something that you have to develop yourself and adjust to your game in particular. What I'm probably looking for is an algorithm that is flexible and could work by changing values like midday point and such.

My algorithm uses 12:00 / 12PM as it's center point and at that time it's 1.0 in lighting. What I'm trying to do is perhaps "change" the midday point to any value to say 10 and it should still work the same, and perhaps also be able to alter the number of  hours the midday can be. Perhaps so that the lighting rises and falls exponentially. So that between night and 4 it raises slowly, between 4 and 8 it raises much faster and at 10 it's reached it high point until 14 when it starts to fall again but in the reverse order.

My simple algorithm only calculates a value between 0.0 and 1.0 and if there is any good info or some suggestions on how to "improve" this method or any other information regarding this subject it would be greatly appreciated.

My algoritm goes as following:

If (CurrentHour < (HoursPerDay / 2))

    Lighting = CurrentHour / (HoursPerDay / 2)
    Lighting += (CurrentMinute / MinutesPerHour) * (1 / (HoursPerDay / 2))

Else

   Lighting = 1 - ((CurrentHour / (HoursPerDay / 2)) - 1)
   Lighting -= (CurrentMinute / MinutesPerHour) * (1 / (HoursPerDay/2))

MIN_VALUE = 0.3f;
Max(MIN_VALUE, Min(Lighting, 1f))

or in C# code:

public float CalculateLighting(uint hour, uint minute, uint minutesPerHour, uint hoursPerDay)
{
    float lighting = 1f;

    if (hour < (hoursPerDay / 2))
    {
        lighting = (hour / (hoursPerDay / 2)) * lightingMax;
        lighting += ((minute / minutesPerHour) * (1f / (hoursPerDay / 2))) * lightingMax;
    }
    else
    {
        lighting = lightingMax - (((hour / (hoursPerDay / 2)) * lightingMax) - lightingMax);
        lighting -= ((minute / minutesPerHour) * (1f / (hoursPerDay / 2))) * lightingMax;
    }

    lighting = MathHelper.Clamp(lighting, lightingMin, lightingMax);
}

This way when the time is 6:00 AM the value is (6/12) and the same for (12+6) and also I clamp the results so I get a value between 0.3 and 1.0 or change that to whatever in case you wanted it to be Winter season so it's darker you can raise that value. This is however a very simple implementation of this concept.

Some functions that I'd like to bring in to it is:¨

When is the "midday" and how long is it? Say it's 4 hours between 10-14. During this time it should always be 1.0 in lighting.
Change the midday point to anytime or remove it completely. During dark nights in a game perhaps the sun shouldn't rise fully.
"Somehow" perhaps make it increase slow and decrease fast by using some value for each. If the sun rises slowly but falls rather quickly afterwards. Exponentially raise and exponentially fall faster.

Just some ideas I'm looking for. It doesn't have to be realistic, just a sense that the weather can change. This value should be a value between 0.0 and 1.0 or adjustable (for extra bright days or something) due to the fact that it can be used to light the entire scene. A reference point to how bright it is in the game world.

How can I best extend my algoritm and improve it and perhaps implement new features?

Any suggestions are appreciated or some information on good implementation of a Day-Cycle system.

sentences:
Procedural Mesh: UV mapping I made a procedural mesh and now I want to apply a texture to it. The problem is, I cannot get it to stick the way I want it to.

The idea is to have the texture painted only once over the whole mesh, so that there is no repeating. How should I map the UV to make that happen?

My mesh is a simple plane consisting of 56 triangles. I'd add pictures to clear things up but I cannot since my reputation is below 10 points.

Any help is appreciated.

EDIT(Kind people gave me up votes, thank you):

Meet my mesh:

And when textured(tried to repeat the texture):

And my texture:

EDIT 2:

bummzack's instructions worked like a charm and the mesh got textured just as I wanted it to. Thank you.

sentences:
sprite animation individual framerate When animating sprites I am taking the delta difference between frames and locking the rendering frame rate of the sprite animation to the delta time.

float delay = 1000.0f / FPS;
float now = SDL_GetTicks();
if(now - sprite->last_update > delay) {
    render sprite frame
}

This is causing flickering because the background is being drawn faster than the sprite. (my guess) If I draw as fast as the frame rate the flickering goes away. If I slow down the background rendering then the background flickers. By slow down I mean set the FPS to 30.  I want to be able to slow down the animation for a single sprite.
 I need a better way to lock the frame rate for individual sprites.  I can slow the entire frame rate down by delaying in the game loop but I want to be able to slow down a single sprite.  Is this possible?

sentences:
How to render sprites without using SpriteRenderers I'm creating a component that lets you write text, like the UI Text component, but using sprites as letters.

I already have the mapping for characters->sprites, and now was going to draw the text using the sprites.

My first idea, was to just create one children for each letter, each child having a sprite renderer.

But it feels like a pretty poor approach, since a transform and a sprite renderer component have to created or destroyed, when the text changes size.

Then I thought about using a Mesh renderer and mesh filter, and define the mesh when the text changes, creating a quad for each letter. But what I don't like about this idea is having 2 extra components in my gameObject, as I would like to keep it as clean as possible.

Is there a way to achieve this keeping all the necessary components inside my own class? Defining my own quads, UVs and such is just fine, but I just don't know how to render them through script. Is it even possible without adding more components to the gameObject?

Don't know if its relevant, but I want to use World Coordinates, not screen coordinates.

sentences: Manually remove inactive CCParticleSystem from scene? When using particle systems that have a lifetime, with CCParticleSystem and its derived classes, should I manually remove the finished systems from their parent nodes once the particle animations are complete? Or this is done automatically? I don't want to leave dead particle systems in my scene, for obvious reasons.

sentences:
Why does my AI Enemy slide towards its target when it is supposed to be idle? So using Unity standard assets to get a stage rolling, Ive built a simple terrain and used FPSController as the player and AI ThirdPersonController (Ethan) as the enamy.

Ive built the navmesh and everything was working in its default state, but then I changed the AI script slightly as I wanted Ethan to follow me only if I come within a certain range, so I changed it to the following:

public float dangerRadius = 5f;

        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent = GetComponentInChildren<UnityEngine.AI.NavMeshAgent>();
            character = GetComponent<ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;
        }

        private void Update()
        {
            if (target != null)
                agent.SetDestination(target.position);

            if (agent.remainingDistance < dangerRadius)
                character.Move(agent.desiredVelocity, false, false);

            else
                character.Move(Vector3.zero, false, false);
        }

        public void SetTarget(Transform target)
        {
            this.target = target;
        }

But the problem is that when the remainingDistance is greater than dangerRadius or when I am out of range, Ethan just slides slowly towards the target in idle state and as the distance becomes lower than the threshold he starts running as expected.

Ive tried adding friction materials to the terrain and the collider on Ethan but he still slides.

Help thanks

sentences: Unity importing Blender models with different orientations All the models apart from 'Jungle Tree' are facing right which is not a problem, because they still seem to work with my game. But how can I change the 'Jungle Tree' to face right like the other models instead of left? I haven't made the Jungle Tree drastically different to the other models so I don't see why it is doing this

sentences:
CLR Profiler Allocated Bytes and XNA ContentManager I've been fighting with XNA ContentManager and memory allocations for some weeks because I'm trying to port my game from XNA (Windows) to ExEn / Monotouch (iphone).

The problem is that after playing a few levels, my game exits unexpectedly on a real iPhone device (not simulator).

Profiling memory usage on Windows with CLRProfile, I found some useful stuff but I also found something I dont understand. If I use 2 ContentManagers (1 for shared assets and 1 for level assets), when profiling, "Allocated Bytes" grows and grows after level through level but Memory consumption measured by Windows Task Manager stays constant (down when I unload the content manager and up again when I load content). Obviously, I contentManager.Unload() when level ends. After a few levels my game exits unexpectedly on an iPhone device.

If I use 1 content manager, "CRLProfiler Allocated Bytes" stays constant on Windows and on the iPhone; I can play the game normally and it doesnt exit unexpectedly. I use the same assets level through level.

It seems like in ios (iPhone) when loading and unloading the same assets, it allocates memory and consumes all device memory, so the ios kill it.

Can anybody explain me how this really works?
I've read quite a bit, but I still don't understand what's going on.

sentences:
How can I use multiple meshes per entity without breaking one component of a single type per entity? We are just switching from a hierarchy based game engine to a component based game engine. My problem is that when I load a model which has a hierarchy of meshes, and the way I understand, is that an entity in a component based system can not have multiple components of the same type, but I need a "meshComponent" for each mesh in a model. So how could I solve this problem.

On this site they implemented a Component based game engine:
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

sentences:
LIBGDX font.draw() makes letters blink on PC I load Bitmapfont then try to draw it, but on PC(desktop) build screen blinks with frequecy that I can judge that backbuffer is not drawn. On Android all is fine, I don't see blinking. I simply do this:

SpriteBatch = new SpriteBatch();
Bitmapfont font = new Bitmapfont();
font.setColor(Color.GREEN);
spriteBatch.begin();
font.draw(spriteBatch, "Hello world", 0, 100);
spriteBatch.end();

Ways to fix?

sentences: Why do games use tick rates in their networking and servers instead of an event system? Why do most games limit themselves with a tick rate in their networking? Isn't it better to make something like an even system where for example client A does something then the client sends related info to the server, and same for the server when something happens on it it sends a packet to the client, instead of using a tick rate and sending information only at some specific frequency. Is it cheaper/faster to send more data in a single packet or? And the same question goes for server tick rates, some servers limit themselves on specific tick rate frequencies, why do they do that? Why not just make a loop and run each tick after each other instead of having a gap between them or risking one tick to take longer than it should and causing bugs? What's the benefit of the tick rate approach for servers and for networking?

sentences:
How do I tag an empty space for an 'InAir' Boolean? I've been working with my game's settings to get the perfect jump height, gravity and movement that suits the player, however my problem is my player essentially floats back down to the ground, when I want them to fall much faster (it's a 3D game) but I don't want to tamper the gravity anymore solely for the player.

What I've done is created 2 extra Booleans alongside my Grounded Boolean, one for In Air and another for Extra Gravity, and this is where my problem comes in.

I have no idea how to set a tag to the empty space in the air, and I was wondering if anyone knew how to do this, or if there is a better method for detecting when my player is in the air?

This is what my script currently looks like:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerScript : MonoBehaviour
{
    public float movementSpeed = 5f;
    public float jumpForce = 7;
    public float jumpSpeed = 7;
    public Rigidbody rigidbody;
    private Vector3 input;
    public GameObject Player;
    public bool grounded;
    public bool inAir;
    public float ExtraGravity;

    // Use this for initialization
    void Start()
    {
        var rigidbody = GetComponent<Rigidbody>();
        var col = GetComponent<CapsuleCollider>();
        Player = GameObject.FindWithTag("Player");
    }
    void FixedUpdate()
    {
        if (Input.GetKeyDown("space"))
        {

            if (grounded)
            {
                Debug.Log("Spacebar pressed");
                rigidbody.AddForce(0, jumpForce, 0);
            }

            if(inAir)
            {
                Vector3 vel = rigidbody.velocity;
                vel.y -= ExtraGravity * Time.deltaTime;
                rigidbody.velocity = vel;
            }

        }
    }

    // Update is called once per frame
    void Update()
    {

        if (Input.GetKey("w"))
        {
            transform.position += transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 5.5f;
        }
        else if (Input.GetKey("s"))
        {
            transform.position -= transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 4.5f;
        }
        else if (Input.GetKey("d"))
        {
            transform.position += transform.TransformDirection(Vector3.right) * Time.deltaTime * movementSpeed * 5.5f;
        }
        else if (Input.GetKey("a"))
        {
            transform.position -= transform.TransformDirection(Vector3.right) * Time.deltaTime * movementSpeed * 5.5f;
        }

        if (Input.GetKey(KeyCode.LeftShift))
        {
            transform.position += transform.TransformDirection(Vector3.forward) * Time.deltaTime * movementSpeed * 20.5f;
        }

    }

    void OnCollisionStay(Collision collision)
    {
        if (collision.gameObject.CompareTag("Floor"))
        {
            grounded = true;
        }
    }

    void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.CompareTag("Floor"))
        {
            grounded = false;
        }
    }

}

sentences:
Simulate 3D with 2D sprites I was thinking about 2D games (like Starcraft), where the sprites are in two dimensions, but the objects that are "higher" in the screen are behind the other objects (I think this is obvious when you think that "higher" in the screen means "far" when simulating a 3D environment).

But, how do you do this programmatically? It is a good idea to track every movement for every object, assigning object to different layers in order to simulate movement in that axis?

Is there a better way?

sentences:
Selecting Dictionary item based on custom classes instead of keys I am attempting to write my own path finding code for a game I'm working on that will implement a form of the A* algorithm.  I store my nodes of the path finding system as a class called nodes and add these to a dictionary with their position in world space as the key for the dictionary.  Here's the problem.  At one point I need to test the dictionary and return from it the node with the lowest "f" value.  I came across the morelinq MinBy function with seemed promising, but so far have not had any luck getting it to work. Here is a stripped down version of the code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using MoreLinq;

public class GMove : MonoBehaviour
{

    public Dictionary<Vector3, Node> vectorNodesOpen = new Dictionary<Vector3,Node>();
    public Dictionary<Vector3, Node> vectorNodesClosed = new Dictionary<Vector3,Node>();

    private KeyValuePair<Vector3, Node> currentNode = new KeyValuePair<Vector3,Node>();

    private bool goal;
    private bool findingPath;

    void Start()
    {
        goal = false;
        findingPath = false;
    }

    public void addNodes()
    {
        //several nodes get added to the dictionary based on the A* algorithm
        //ending way point and beginning waypoint are stored as Vector3
    }

    public class Node
    {
        public int h { get; set; }
        public int g { get; set; }
        public int f { get; set; }
        public Vector3 pos { get; set; }
        public Vector3 parentNodeVector { get; set; }
    }

    void Update()
    {
        if(findingPath)
         while (!goal)
            {
                currentNode = new KeyValuePair<Vector3, Node>(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);  //This is the line in which I'm attempting to get the node in the open list with the smallest f value.
                vectorNodesClosed.Add(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);
                vectorNodesOpen.Remove(vectorNodesOpen.MinBy(x => x.Value.f).Key);  // remove current from open.

                if (currentNode.Value.pos == waypointEnd)   // if current node = end position we are done.
                {
                    goal = true;
                }

                addNodes(currentNode.Value.pos, waypointEnd);  //Add and update nodes
    }

}

The line that is giving me trouble is the first line inside the while loop.

I need a way to return the Dictionary item with the smallest "F" value, this would be pretty easy if it were an integer but the F value resides in the Node class.  I don't have to use MoreLinq,  I would be happy to do it any other way that someone can come up with.  Cheers!

*One more note:  the code above is incomplete in an effort to minimize it down to only what is necessary to understand the problem more complete code can be provided if necessary.

sentences:
curve of animation in C# I think that the animation curves in Unity lack the fact of being configurable because they are only chosen with a certain type (no sinusoidal function) and adjustable with handles.

How in C # create an animation (tanslation, rotation, scale) so as, for a selected mesh, to introduce parameters of a chosen mathematical function and any corresponding, if it is a translation for example, to x_position, y_position and z_position in function of the time variable?

thank you !

What if I now need to define time intervals?
for example:

a function f1 on [0.20]

a function f2 on [20.50]

The most difficult is to convert by the correct Time.time factor so that the real time varies well in seconds within the limits defined by each of these intervals.

thanks

sentences: Can I mod Among Us mobile so people don't get kicked because of network problems, and how? I want to make a mod for Among Us which will allow people to stay in game despite short-lived connection problems (as opposed to being kicked after 1 second of network issues).

sentences:
Fixed Function vs Programmable Pipeline performance with many batches In OpenGL 2.0 I can easily make 10,000 draw calls per frame (with state changes in between each call).  However, if i try to do this in either OpenGL ES 2.0 or DirectX9 with shaders, my peformance is 1Hz.  Is there an inherent different between fixed function and programmable pipeline rendering that requires programmable pipeline to require much fewer draw calls per frame, or is it more likely that I'm just doing something stupid in my code? I thought that most fixed function pipelines were implemented in shaders nowadays anyway, so if it is the case that I have to batch, then how does the fixed function implementation get away with not batching if its really using shaders?

Any "official" resources you could point me to would be great.

sentences:
How can I package and read multiple asset files into/from one file? I want to somehow "pack" (not compress) multiple game files into one bigger file. Something like Valve's .gcf, where reading from the application should be easy; like accessing an ordinary stored file.

I'm aiming for some kind of simple use, something like:

my_asset_file->setAssetFile(ASSET_FOLDER + '/file.ext');
Model *m = new Model();
m->loadFromTxtFile(my_asset_file->openTxtFile('models/props/lamp.obj'));

sentences:
Assimp skeletal animation matrices I startded to make an assimp only opengl skeletal animation demo. For that I used this: http://sourceforge.net/p/assimp/discussion/817654/thread/5462cbf5
And something is not correct in bone matrices.

and my standerd bob_with_lamp model(.md5) looks like this. its moving its parts but not in correct way.This is the code:

    for( size_t a = 0; a < anim->mNumChannels; ++a)
{
  const aiNodeAnim* channel = anim->mChannels[a];
  aiVector3D curPosition(0,0,0);
  aiQuaternion curRotation(1,0,0,0);
  aiNode* targetNode = scene->mRootNode->FindNode(channel->mNodeName);
  while((int)time >channel->mNumPositionKeys) time-=channel->mNumPositionKeys;
  curPosition = channel->mPositionKeys[(int)time].mValue;
  curRotation = channel->mRotationKeys[(int)time].mValue;
  aiMatrix4x4 trafo = aiMatrix4x4(curRotation.GetMatrix());
  trafo.a4 = curPosition.x; trafo.b4 = curPosition.y; trafo.c4 = curPosition.z;
  targetNode->mTransformation = trafo;
}
for (unsigned int n = 0; n < scene->mNumMeshes; ++n)
{
    const aiMesh* mesh = scene->mMeshes[n];
    std::vector<aiMatrix4x4> boneMatrices( mesh->mNumBones);
    for( size_t a = 0; a < mesh->mNumBones; a++)
    {
      const aiBone* bone = mesh->mBones[a];
      aiNode* node = scene->mRootNode->FindNode( bone->mName);
      boneMatrices[a] = bone->mOffsetMatrix;
      const aiNode* tempNode = node;
      while( tempNode)
      {
          aiMatrix4x4 m = tempNode->mTransformation;
          boneMatrices[a] *= tempNode->mTransformation;
          tempNode = tempNode->mParent;
      }
    }

and my render:

    std::vector<aiVector3D> resultPos( mesh->mNumVertices);
    std::vector<aiVector3D> resultNorm( mesh->mNumVertices);

    for( size_t a = 0; a < mesh->mNumBones; ++a)
    {
      const aiBone* bone = mesh->mBones[a];
      const aiMatrix4x4& posTrafo = boneMatrices[a];
      aiMatrix3x3 normTrafo = aiMatrix3x3( posTrafo);
      for( size_t b = 0; b < bone->mNumWeights; ++b)
      {
        const aiVertexWeight& weight = bone->mWeights[b];
        size_t vertexId = weight.mVertexId;
        const aiVector3D& srcPos = mesh->mVertices[vertexId];
        const aiVector3D& srcNorm = mesh->mNormals[vertexId];
        resultPos[vertexId] += weight.mWeight * (posTrafo *srcPos);
        resultNorm[vertexId] += weight.mWeight * (normTrafo * srcNorm);
      }
    }
    //And rendering the vertices from the pos vector

what should I change to made this to get correct positions?

sentences:
My mesh has holes in it. How do I make those invisible faces show? I have a mesh. A perfectly normal mesh, without any artefacts at all.

However, when I import it into Unity, there are holes in it.

After going through my UV mapping and normals, they are all mapped, have no faces with the normals going the wrong way (facing inwards) and have non-transparent textures over each mapped UV face.

Oddly enough, this mesh hasn't been split, despite its poly count and is one whole object, but yet - It has missing polygons. Is there any way to get Unity to recognise these faces?

Also, it is worth noting that these holes happen to be all the tris faces on this model, and are all (mostly) along the UV seames.

Question

How do I make the invisible faces show? What's going on?

sentences: Do I have to ask for permission to use real company logos for advertising props in the world in my sports game? I'm making a simple turn-based Android ball flicking soccer game and I was thinking of creating a theme in a sports game, like soccer for example, usually had advertisement banner on walls and a bit realistic but cartoony. It is usually encountered in most sports-based game in any gaming platform. I have a question regarding this topic. Is it required to ask a permission to used some recognized ad banner designed walls (e.g. Adidas, Samsung, McDonalds, etc.) to be used as props for the game field like this one for example?

sentences: Am I allowed to use a real life celebrity in a game? In previous questions many users asked whether or not an athlete can be used in a game. Yet the answer was no due to multiple copyright their images and names had. However anyone can use a politician's name and physical appearance due to the fact that they are "public figures" (example: Obama). In this case, I want to use famous game developers such as Kojima and Gabe Newell in a game. Am I allowed to use them? or should I make references to them using distinct names (I.E. Lord Gaben). How can I find out whether or not a person is a "public figure" and if their appearance/name is protected?.

sentences:
Why game loop should be running on a separate thread? I am struggling to fully understand the responsiveness argument suggesting to run the game loop on a separate thread other than main thread.

When OS sends a user event (touch, mouse move, etc.) it will be handled within the main thread. Then you would have to forward this event into a game loop thread where this event usually is placed into a queue. The OS may think that event was processed instantly, but user will still have to wait until event is actually processed.

In this case there is an inevitable latency before the event gets processed.

It is exactly the same latency when event is processed in the main thread, but in this case OS can detect the latency.

Is it this latency that separate thread game loop is trying to avoid, or is there anything else?

sentences:
Prefab random rotation in editor Is it possible to automacicaly random rotate pefab during placement in editor in unity 4.5.3?

I can make it autorotate in game(at start) but I want it to be visible in editor and at fixed rotation after placement.

sentences:
Children Canvas of 5.6 After upgrading to Unity 5.6, I've found my children canvases don't render right. I'm trying to figure out if this is a bug, or a new feature in Unity 5.6 that needs some adjusting.

Note the grey block on the upper left. What should be shown is a minimap, but per best practices, I was told to take frequently updating UI elements and put them on their own canvases. To compare this, here is an example from last week. The most notable difference is the transparent vs opaque view on the left. I did that in order to try to fix the problem, but it was on my todo list anyways.

Is there some setting that I should do to make the children canvases look right?

sentences:
AS3 Starling in Fullscreen Mode cuts off most of the screen I have a mixed mode (classic Flash Renderer + Starling) AIR AS3 project that I'm switching to fullscreen with

 stage.align=StageAlign.TOP_LEFT;
 stage.scaleMode=StageScaleMode.SHOW_ALL;
 // Swtich to Fullscreen with
 stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

When I do this, I have a callback on the Event.RESIZE event to resize my Starling instance to fullscreen:

private function resizeStarling(e:Event):void
{
            var size:Point = new Point();
            if(this.stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE)
            {
                size.x = Capabilities.screenResolutionX;
                size.y = Capabilities.screenResolutionY;

            }
            else
            {
                size.x = WIDTH;
                size.y = HEIGHT;
            }

            RectangleUtil.fit(
                new Rectangle(0, 0, stage.stageWidth, stage.stageHeight),
                new Rectangle(0, 0, size.x, size.y),
                ScaleMode.SHOW_ALL, false,
                Starling.current.viewPort);
}

The set to FULL_SCREEN_INTERACTIVE turns all my normal flash Stage object based UI and visuals to full-screen mode.  However, while the Starling graphics are correctly upscaled, they only occupy the upper left corner of the screen, and the remaining three quadrants are cut off.  I haven't validated yet, but I suspect that the segment being displayed is the same dimensions as the original windowed stage size.  Any ideas on what I'm forgetting to do to achieve fullscreen Starling displays that are actually fullscreen?  This is on OSX.

sentences:
Intersection points of plane set forming convex hull Mostly looking for a nudge in the right direction here. Given a set of planes (defined as a normal and distance from origin) that form a convex hull, I would like to find the intersection points that form the corners of that hull. More directly, I'm looking for a way to generate a point cloud appropriate to provide to Bullet.

Bonus points if someone knows of a way I could give bullet the plane list directly, since I somewhat suspect that's what it's building on the backend anyway.

sentences: How can i show all edges in monogame? I am using Monogame 3.5 and i have simple model of cube. I use BasicEffect to draw it. I want it transparent so i use effect.Alpha = 0.5f. Is it possible to show all edges something like on picture?

sentences:
Unity 2019 Error : com.unity.xr.arsubsystems@2.2.0-preview.3/Runtime/ImageTrackingSubsystem/XRImageTrackingSubsystem.cs57,30): error CS0506: I am opening an old project created in 2019.3 inside my new Unity 2019.4.  I got this error message in Unity Console:
Library/PackageCache/com.unity.xr.arsubsystems@2.2.0-preview.3/Runtime/ImageTrackingSubsystem/XRImageTrackingSubsystem.cs(57,30): error CS0506: 'XRImageTrackingSubsystem.Destroy()': cannot override inherited member 'Subsystem.Destroy()' because it is not marked virtual, abstract, or override

Please note that this current project does not use anything related to AR "Augmented Reality" or XR package.
I have already Googled this error message, but have not seen a solution yet.
However, I guess that this error likely comes from some conflicts in the AR or XR versions.
To fix this error, should I install or update the basic Unity XR or AR package ?
Thank you very much.

sentences:
Real-time UDP multiplayer games: ping measurement? In real-time multiplayer games that use UDP for the actual game (CS:S, UT, etc.), how is network latency (ping) measured? More specifically, how do you find out how long ago a UDP packet was sent?

Sorry if this is a dumb question, but I'm very new to network programming.

sentences:
Is it worthwhile to use particle pools in managed languages? I was going to implement an object pool for my particle system in Java, then I found this on Wikipedia. To rephrase, it says that object pools aren't worth using in managed languages like Java and C#, because allocations take just tens of operations as compared to hundreds in unmanaged languages like C++.

But as we all know, every instruction may hurt game performance. For example, a pool of clients in an MMO: the clients won't enter and exit the pool too fast. But particles may get renewed tens of times in a second.

The question is: is it worth it to use an object pool for particles (specifically, those that die and get recreated fast) in a managed language?

sentences: How to get a Vector2 location of an object? (Unity2D javascript) I need to make an "AI" that makes a ball try to touch the player. But Vector2.MoveTowards()needs a Vector2 variable but how do i get the location of an object?

sentences:
Sprites draw-order sorting for top-down 2D game with floors and bridges I am working on custom 2D engine for a game.
I am having trouble figuring out a working system for sprite drawing-order sorting for this specific game.

Game description:

2D
Top-down perspective
Multiple floors
Bridges

More details for clarity:

Characters (Player characters, enemies, NPCs) can be positioned and move around any Floor and move between Floors.
Objects (crates etc.) can be positioned on any Floor. (Not on Stairs.)
Floors are traversed using Staircases.
Staircase is a "ramp" connecting 2 Floors.
Staircase can connect 2 Floors that can be any number of Floors apart.
Characters and Objects cannot be positioned / move "behind" back-facing walls and behind Objects.
Characters can be positioned / move behind other Characters and pass through each other.
Characters and Objects can be positioned / move both on and under a Bridge.

Entities that need their sprites sorted are Characters, Objects, Bridges.
Visuals (tiles) that make rest of the game level, are rendered first (under everything else) in one pass, and don't need any kind of sorting.

What I tried so far:

V0. Sorting by Y
Obviously doesn't work because it can't solve verticality (Floors).

V1. Sorting Characters into lists by Character current Floor, than sort each list by Character current Y
Than drawing eg.
Floor 0 sorted Characters list
Floor 1 Bridges
Floor 1 sorted Characters list
...

Problem with this is approach, that Floor has to have a hard edge.
Each Character is at one point on one and only one Floor.
When two Characters are close enough together on Y axis to overlap, and each one is on a different Floor, this happens:

V2. Sorting Characters and Bridges using "Painter's Algorithm" (average distance to camera of 3D rectangle vertices)
Even though the graphic engine is 2D, I defined every Character and Bridge as 3D positioned rectangle, and defined virtual camera (view point) with 3D position.
Than calculated average 3D position of every entity and it's distance to camera. Than sorted by the distance.

Problem with this is approach is one of problems of Painter's Algorithm: the distance to camera is calculated from position of center point of the rectangle.
The bigger the rectangle, the more imprecise the calculation.
If the rectangle is big enough, it will start wrongly overlapping surrounding rectangles.
Characters on different heights (elevations) are often sorted wrongly.
Also if the Bridge is wide enough on Y axis, it will be wrongly sorted between Characters on and under the Bridge.

V3. I can make the game fully 3D
and use Z-Buffer, that is made to solve the problems mentioned above.
But before I make that leap, I would like to be sure I explored all other (2D) possibilities.

I searched the internet high nad low for any tutorial or article on this, and surprisingly didn't find a single one that would fit my case.

I will be very grateful for any advice.

sentences:
Turn-Based RPG Battle Instance Layout For Larger Groups What a title, eh?

I'm currently designing a videogame; a turn-based RPG like Final Fantasy (because everybody knows Final Fantasy). It's a 2D sprite game.

These are my ideas for combat:

The player has a group of 15 members (main character included)
During battle, five of the group are designated as active, and appear in the battle.
These five may be switched out at leisure, or when one of the five die.
At any time, the Waiting members can cast buffs, be healed by the active members, or perform special attacks.
Battles should contain 10+ monsters at least. I'm aiming for 20, but I'm not sure if that's possible yet.
Battles should feel larger than normal due to the interaction of Waiting members, active members and the increased amount of monsters per battle.
The player has two rows in which to put the Active members:  front and back.
Depending on the implementation, I might allow comboing of player attacks and skills.

These are just design ideas, so beware! I have not been able to test this out yet- I have no idea yet if any of these ideas bunched together will make for a compelling game. What sounds good on paper doesn't necessarily have to be good in practice!

What I'm asking now is how to create the layout for this. My starting point are the battles in Final Fantasy VI, with up to 5-6 monsters on the left and the characters on the right- monsters on both sides if it's a pincer attack.

However, this view would not work feasible with my goal of 20 monsters and 5 characters. All the monsters on the left would appear cluttered unless I scale them far far back. If I create a pincer-like map, then there would be no real pincer-attack possible. If I space the monsters out, I force the player to scroll the screen- a game mechanic I've come across and not enjoyed.

Does anybody have any layouts or guides for designing battle maps in turn-based RPGs, especially with a larger number of enemies taken into consideration? How should it look?

I am not asking for specific combat mechanics, just the layout for the moment.

sentences:
What platform should I use for a master server? We are making a small FPS, and want people to be able to play it online and fetch a list of all servers from a master server. We only have experience in C#, and we have already written a master server that tracks all the servers.

However we realize that we'd have to host it on a windows application server. These are expensive, and making our master server completely reliable and watertight may be a lot of work. Also it seems a waste to have a server out there running windows and our tiny application that only tracks a list of servers...

Should we make the effort to learn PHP and SQL and make our master server that way? Does anyone know of any master servers written in PHP to get us started?

sentences:
Making a parenting system Each Entity can have one parent and any number of children. They have a position vector and a quaternion orientation.

I know that I can make objects look like they're in a hierarchy by multiplying parent transforms all the way to the root, but how to I get the canonical coordinates out of those transformations? I need to have the real position of every Entity in the world in order to update their bounding meshes.

I would like to keep my drawing code for everything as just this:

XMMATRIX transform = XMMatrixRotationQuaternion(orientation);
transform = XMMatrixMultiply(transform, XMMatrixTranslation(position));
transform = XMMatrixMultiply(world, transform);
model->Draw(context, *states, transform, view, projection);

Eg. without relying on visual tricks to get the hierarchy looking right, so no multiplications with parent transforms while rendering.

How do I properly change a child's position and orientation with respect to the parent?

sentences: Develop on Oculus Go using Java and OpenGL I have recently done some game development using Java and OpenGL (with the JOGL library), and I was thinking about trying to learn how to develop on an Oculus GO. However, all guides seem to assume that the developer is going to use Unity. Is it possible to develop Oculus GO applications with Java and OpenGL directly? Is there any good documentation or guides for this?

sentences:
Proper Line of Sight in tile based game My rendering engine currently takes "xMin, yMin, xMax, yMax" to render a rectangular region of tiles, and will automatically scale based on the size of the panel it is rendering to.

However, I am having an issue rendering based on line of sight. Currently (I know this is inefficient but it is simply the best option as of right now) I use Bresenham's line algorithm. However, that results in

As you can see, the walls invisible. How should I go about updating the algorithm to have it make the walls visible as well?

If I render tiles that end where the raytrace ended, I get

This implies that a floating point solution would be preferred.

Of note, I will accept suggestions on how to improve the rendering engine if it would make this more possible.

sentences:
File Path conflicts on GitHub with Unity I am getting file path errors when a contributor is making commitments to GitHub. All of these errors are file path related or extra white space on the same lines.

This should be something in the .gitignore, but I can seem to locate it. Has anyone had similar issue with this?

sentences:
Send failed since rewinding of the data stream failed I'm using WWW class to sent a WWWForm to an asp.net server.
it used to work in unity 5.3.x but since I migrated to 5.6.3f1, it is not working and sending Send failed since rewinding of the data stream failed message.
I tried doing it with the UnityWebRequest but it couldn't send the data in the form and I would get null values in the server side.
here is my code:

        WWWForm WF = new WWWForm();
        WF.AddField("UserID", ServerProperties.user.UserID);
        WF.AddField("UserEmail", ServerProperties.user.Email);
        WF.AddField("UserPassword", ServerProperties.user.Password);
        //I'm sending some json as strings. I don't need to do anything to the json data on the server
        WF.AddField("PlnFile", Export);
        WWW www =new WWW(ServerProperties.ServerAddress + "/Unity/SaveDesign", WF);
        while (!www.isDone)
        {
            yield return www.progress;
        }
        if (www.error != null)
            debug.Log(www.error);
        else
            debug.Log(www.text);

And I'm getting this request with [HttpPost] on the server.

        [HttpPost]
        public ActionResult SaveDesign(DesignViewModel _Design)

I'm reaching a deadline and I really need this, any ideas is appreciated.

sentences:
Calculate XP needed for next Level using this simple algorithm? I am currently calculating the Levels in my game using the following forumla:

player.level = mathFLOOR(mathMAX(1, 0.05 * mathSQRT(player.score)) * (1 + player.kd / 10));

So the level is based on the persons total score and their kd. However I am now trying to figure out a formula for calculating the percentage of the score/kd you need to progress to the next level. If this is not possible, how could I do it with just this formula:

 player.level = mathFLOOR(mathMAX(1, 0.05 * mathSQRT(player.score)));

Thank you for your time.

sentences:
Shadows go through meshes, and also being applied to itself I am using Ogre3D and I am using stencil shadows for my character. They work pretty well, but I have 2 problems: first, the shadow is applied to the entity it is casting the shadow, and secondly, the shadow goes through all the entities on the screen, and I would like to apply the shadow to only the first entity.

Also, the shadow gets rendered on the back of the model.

Images showing the problems:

sentences:
Legal issues around using real players names and team emblems in an open source game I'm writing a sports management simulation game. Like most sport management games, it makes heavy use of statistics. I would like to use real players, teams and league names.

i) Am I running the risk of getting into legal battles if I should use the real names?
ii) Also what about team colours and emblems etc?

Update
Much thanks for all the input!

sentences:
Locking the frame rate in pygame? I am having trouble setting up the frame rate in my first game. I know that I can set it up with

clock = pygame.time.Clock()
clock.tick(60)

but this is not producing very desirable results. If I move a character 1 pixel per frame, it will move smoothly but jitter about once a second. If I print(clock.get_fps()) it tells me that my frame rate is about 59.8. Since it never hits 60, it never syncs up with my monitor's refresh rate and the annoying jittering continues.

That I know of, this is not a problem with the game's performance, since it is in a very early stage of development. If I cap the FPS at 1000 then I can get a maximum FPS of about 270.7. Is there any way I can give my game a continuous frame rate of 60?

P.S. I don't mind that my movement code is tied to FPS. I tried making it FPS-independent using this code, but this introduced some floating-point inaccuracies to my movement. It wouldn't let me set the FPS to exactly 60, either.

sentences:
Why does my 3d model become invisible as I move the camera away? I'm trying to load a 3d model from Mixamo:

//        let scene = SCNScene(named: "art.scnassets/ship.scn")!
        let scene = SCNScene(named: "art.scnassets/Ch45_nonPBR.dae")!

    // create and add a camera to the scene
    let cameraNode = SCNNode()
    cameraNode.camera = SCNCamera()
    scene.rootNode.addChildNode(cameraNode)
    scene.fogStartDistance = 10000
    // place the camera
    cameraNode.position = SCNVector3(x: 0, y: 40, z: 100)

    // create and add a light to the scene
    let lightNode = SCNNode()
    lightNode.light = SCNLight()
    lightNode.light!.type = .omni
    lightNode.position = SCNVector3(x: 0, y: 50, z: 10)
    scene.rootNode.addChildNode(lightNode)
    lightNode.light?.intensity = 10000;

    // create and add an ambient light to the scene
    let ambientLightNode = SCNNode()
    ambientLightNode.light = SCNLight()
    ambientLightNode.light!.type = .ambient
    ambientLightNode.light!.color = UIColor.white
    scene.rootNode.addChildNode(ambientLightNode)

    // retrieve the ship node

//        let ship = scene.rootNode.childNode(withName: "ship", recursively: true)!
        let ship = scene.rootNode

While the z value for the cameraNode position is 100 or less, I can see the 3d model. But if I increase the value, then the model is no longer visible. Even at 100, parts of the model are not visible.

Is this a problem with lighting or rendering distance ? I would like to move the camera far away so that I can see the whole model on screen. Right now I can only see a part of it.  What do I need to change so I can see the whole model clearly like this:

EDIT: I am using Swift 5

sentences:
Wikipedia A* pathfinding algorithm takes a lot of time I've successfully implemented A* pathfinding in C# but it is very slow, and I don't understand why. I even tried not sorting the openNodes list but it's still the same.

The map is 80x80, and there are 10-11 nodes.

I took the pseudocode from here Wikipedia

And this is my implementation:

 public static List<PGNode> Pathfind(PGMap mMap, PGNode mStart, PGNode mEnd)
    {
        mMap.ClearNodes();

        mMap.GetTile(mStart.X, mStart.Y).Value = 0;
        mMap.GetTile(mEnd.X, mEnd.Y).Value = 0;

        List<PGNode> openNodes = new List<PGNode>();
        List<PGNode> closedNodes = new List<PGNode>();
        List<PGNode> solutionNodes = new List<PGNode>();

        mStart.G = 0;
        mStart.H = GetManhattanHeuristic(mStart, mEnd);

        solutionNodes.Add(mStart);
        solutionNodes.Add(mEnd);

        openNodes.Add(mStart); // 1) Add the starting square (or node) to the open list.

        while (openNodes.Count > 0) // 2) Repeat the following:
        {
            openNodes.Sort((p1, p2) => p1.F.CompareTo(p2.F));

            PGNode current = openNodes[0]; // a) We refer to this as the current square.)

            if (current == mEnd)
            {
                while (current != null)
                {
                    solutionNodes.Add(current);
                    current = current.Parent;
                }

                return solutionNodes;
            }

            openNodes.Remove(current);
            closedNodes.Add(current); // b) Switch it to the closed list.

            List<PGNode> neighborNodes = current.GetNeighborNodes();
            double cost = 0;
            bool isCostBetter = false;

            for (int i = 0; i < neighborNodes.Count; i++)
            {
                PGNode neighbor = neighborNodes[i];
                cost = current.G + 10;
                isCostBetter = false;

                if (neighbor.Passable == false || closedNodes.Contains(neighbor))
                    continue; // If it is not walkable or if it is on the closed list, ignore it.

                if (openNodes.Contains(neighbor) == false)
                {
                    openNodes.Add(neighbor); // If it isn’t on the open list, add it to the open list.
                    isCostBetter = true;
                }
                else if (cost < neighbor.G)
                {
                    isCostBetter = true;
                }

                if (isCostBetter)
                {
                    neighbor.Parent = current; //  Make the current square the parent of this square.
                    neighbor.G = cost;
                    neighbor.H = GetManhattanHeuristic(current, neighbor);
                }
            }
        }

        return null;
    }

Here's the heuristic I'm using:

    private static double GetManhattanHeuristic(PGNode mStart, PGNode mEnd)
    {
        return Math.Abs(mStart.X - mEnd.X) + Math.Abs(mStart.Y - mEnd.Y);
    }

What am I doing wrong? It's an entire day I keep looking at the same code.

sentences:
Do complementary shadows make sense for games? According to color theory, shadows work better if they don't use pure blacks or grays, but instead use a color that's complementary to the color of the object casting that shadow.

That is, if you have a red apple, you should use a dark green shadow; for a yellow banana, a dark violet shadow.

But in many games, you cannot always predict what kind of background or environment the shadow will appear in, and you may not have the luxury of having dynamic shadow colors. In such cases, does it still make sense to use complementary shadows, or is a neutral black or gray acceptable?

sentences: What's the difference between a game engine and a physics engine? What's the difference between a game engine and a physics engine? How do they work together, and what's the meeting point between them?

sentences:
Converting an XNA game from WINDOWS to XBOX I have an XNA game for WINDOWS which I want to work on XBOX also.

I've designed the game so that when I want to connect it to an XBOX, all I have to do is supply a different input class,

And I would do that by checking with the preprocessor macros and checking if it's windows or xbox.

But then, when I tried to do Create a copy of this project for XBOX in VisualStudio, it created several new projects (the real XNA project and some of it's dependencies), and it complained about things not working for C# 3.0 and that I should use C# 4.0 instead, which I didn't find out how to do either.

What's the correct way to make both WINDOWS and XBOX versions of an XNA game?

And also, how do I really run the game on XBOX? I haven't found a good tutorial on how I do that... also I don't have an XboxLive membership so if there's a hacky way to do that, it's better

sentences:
Setting resolution of multiple display screens in my unity project I have multiple screens. How can I set resolution of each screen? I know Screen.SetResolution(1366,768,true); sets the resolution of a single screen but what about multiple screens?

I disabled unity pop up option before starting the game. Does unity choose maximum resolution by default?

sentences: Selecting all GameObjects in Unity I want to rotate all my GameObjects by 90 degrees. To do that I need to select all my GameObjects, how can I do so?

sentences:
Graphics messed up when I try to reskin the game in Android Studio I need a little help. I'm new in Android Studio, I have a game where I want to reskin the design. First of all when I install it on my phone with the original files the game run perfectly without problems. When I try to reskin the photos in my assets folder, I save it, build it in APK file, I install the game and then the graphics is messed up. Here is screenshot of the game after the reskin.
Sorry for my bad English...

sentences:
How to disable player-player/player-monster collisions and keep the OnTrigger/OnCollision hooks? I'm developing a network game. Players and enemies have attached Rigidbodies, move with physics forces, stops on kinematic colliders (walls) - everything works pretty well. Now it's the time for player-player and player-monster coliisions.

In my case, the player should be unpushable, even by other players and monsters.

The problem with that is if all 'moving/non-kinematic' objects have rigidbodies, they can move/push each other as they move - which is wrong in my case. I came up with an idea that I'll disable collisions between these objects through layers and did that.

I also wrote a script which pushes the object back (in the opposite direction) when triggered which I want to apply.

The problem is here, that I need to preserve the original collider (non-trigger) so the player can be stopped by walls AND I need to detect other players in OnTriggerEnter() so I can push them back so they don't overlap.

This is quite easy - I need two colliders attached to the player:

a non-trigger one - responsible for the ground, walls, physics driven
a trigger one - for interaction with players and enemies (to push them)

I also need to disable built-in collisions between players through the physics layers and listen for "Player" and "Monster" tags in OnTrigger().

Does this all make sense? How would you improve this? Is there a quicker way to achieve this? Two colliders seem not that bad - but it's still two instead of one.

In order to visualize what I want to achieve:

Games I know have collisions like this are Diablo 3 and League of Legends probably.

sentences:
Problem getting mouse events while keys held down in SDL2 I'm attempting to write input capturing code using SDL2 on Windows.  However, I'm running into a problem.

Whenever a key is held down, the SDL event queue has no mouse movement, nor will the mouse move on my screen. Instead, The SDL event queue continually returns the key I am holding down as an SDL_KEYDOWN event.

Here is a simple example program which reproduces the problem exactly:

#include <SDL2/SDL.h>
#include <iostream>

int main(int argc, char** argv) {
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Window* window = SDL_CreateWindow("Moust Input Test", SDL_WINDOWPOS_UNDEFINED,
                                        SDL_WINDOWPOS_UNDEFINED, 640, 480,
                                        SDL_WINDOW_SHOWN);
  SDL_Event event;
  for(; ;) {
    while (SDL_PollEvent(&event)) {
      if (event.type == SDL_QUIT) {
        SDL_DestroyWindow(window);
        return 0;
      } else if (event.type == SDL_MOUSEMOTION) {
        int x, y;
        SDL_GetMouseState( &x, &y );
        std::cout << "Mouse moved to: " << x << " " << y << std::endl;
      } else if (event.type == SDL_KEYDOWN) {
        std::cout << "Code of key pressed: " << event.key.keysym.sym << std::endl;
      }
    }
  }
  return 0;
}

What I would expect to happen is that, when I hold down a key (for example, 'a'), it prints exactly once:

Code of key pressed: 97

And then, while they key is held down, if the mouse is moved, it prints every time the mouse is moved:

Mouse moved to: [wherever]

Instead, I'll keep seeing over and over again:

Code of key pressed: 97

And I will not get any mouse movement whatsoever on the screen, nor will I get my mouse movement log printed, until I release whatever keys I am holding down.

Anybody know how I can capture mouse movement while I have a key held down?

The only thing I can think of which could possibly be relevant is I am compiling with MinGW using:

g++ -Dmain=SDL_main test.cpp -o test.exe -L./lib/SDL2 -lmingw32 -lSDL2main -lSDL2 -mwindows -mconsole

Thanks.

Edit: I've also just noticed that the problem persists even when the window is minimized- if I am holding a key down in this text window while my program is minimized in another Window, the mouse stops working, though my program is not printing out the key code.

sentences:
Generating circular bounding volume / AABB for bone animated object I have the animated bounding boxes for the individual bones of an object which comes from a pre-computation of the bone's bounding boxes multiplied with the bone matrix. In this question I'm referring to the surrounding aka overall BB for the model. I get it by looping through the precomputed bounding boxes of the bones.

I'm able to get an OBB but not an AABB or circular volume because I can't get into the correct "space" for the center of the volume. I thought that getting an AABB would be very easy, but since I have the min/max points in bone space (?) I need to do some operation to disable rotation. All I can get is OBB :(

I figure that the aabbV4 vector is in "bone space". So, I have to take the inverse of that space somehow, but since I have the combined value of each bone, I need the AABB / circular volumes to follow tutorials on collision detection and not just OBB that I have now.

So, each object has multiple bones which have a bounding box which animate each frame according to a bone matrix. Then, the mvpGet() function creates the MVP matrix which moves / rotates / scales the whole thing.

I render the OBB / surrounding volume of the bones like this:

for (auto &i : myAbj.allObj)
{
    if (i->bb->val_b && i->anim->val_b)
    {
        i->aabbV4.clear();

        for (auto &j : i->bbSkelAll)
        {
            for (auto &k : i->aiGbones)
            {
                if (k.name == j.name)
                {
                    i->obbMVP = glm::transpose(k.animatedXform) * j.obbMVP; // precomputed obbMVP

                    //AABB - STEP 1 - GATHER / STORE
                    glm::vec4 bbSkelXformMin = glm::transpose(k.animatedXform) * glm::vec4(j.min, 1.f);
                    glm::vec4 bbSkelXformMax = glm::transpose(k.animatedXform) * glm::vec4(j.max, 1.f);
                    i->aabbV4.push_back(bbSkelXformMin);
                    i->aabbV4.push_back(bbSkelXformMax);

                    break;
                }
            }

            i->mvpGet();
            i->render();
        }
    }
}

 //AABB - STEP 2 - MIN / MAX
for (auto &i : myAbj.allObj)
{
    if (i->bb->val_b && i->anim->val_b)
    {
        glm::vec4 aabbMin = (i->aabbV4.empty()) ? glm::vec4(0.f) : i->aabbV4[0];
        glm::vec4 aabbMax = (i->aabbV4.empty()) ? glm::vec4(0.f) : i->aabbV4[0];

        for (uint j = 0; j < i->aabbV4.size(); ++j)
        {
            aabbMin = glm::min(i->aabbV4[j], aabbMin);
            aabbMax = glm::max(i->aabbV4[j], aabbMax);
        }

        glm::vec3 aabbSize = aabbMax - aabbMin;
        glm::vec3 aabbCenter = .5f * (aabbMin + aabbMax);
        i->aabbMVP = glm::translate(glm::mat4(), aabbCenter) * glm::scale(glm::mat4(), aabbSize);

        i->aabbTgl = 1;
        i->mvpGet();
        i->render();
        i->aabbTgl = 0;

        cout << "aabbCenter = " << glm::to_string(aabbCenter) << endl;
    }
}

sentences:
Generating Normal map from a Image with a given Albedo map I am working on a research problem part of which involves generating normal map from a given image of a rusted object. I searched the internet for techniques to achieve the above and apparently crazybump is mentioned a lot. I tried it but it didn't produce the desirable effects. Also I am looking for a method which draws inspiration from an existing research paper not some closed source software. I turned my attention to the technique described in the this paper. Results from this technique are satisfactory for normal objects because of bias in the training data but it doesn't work very well in the case of rusted objects.
After this I focussed my attention on generating Albedo map (the above problem would become more solvable if Albedo map is obtained). Fortunately I am able to generate pretty good albedo maps for images of rusted objects. I used this paper's approach to generate Albedo maps. Now I want to know a good technique to get Normal map given an image and it's corresponding Albedo map. To give you an idea of what kind of images I am working with I am attaching a sample.

Links to research material would be really appreciated. Thanks!

sentences:
Mute/Unmute Mic volume from Unity (I've gone through tons of articles on this, but not found a working solution I can run in Unity 5.5.2+)

I'm looking for C# code I can run that will allow me to mute and unmute the default microphone.  This ONLY needs to run on Windows 10.

sentences:
TiledMaps and real objects I'm creating a simple game for the iPhone using Cocos2d.
I'm having a hard time understanding how add real objects to a tiled map.

I know that you can add an object-layer to the tiled map and set the position of it,
but I'm not sure how to define WHAT object it should be.

For example, if I'm creating a simple Super Mario Bros. I want to add different blocks to the map, one should hold a star, one should hold a coin, and so on.

How should I define what object it is?

So my question, how do I correctly create class-objects in a tiled map?

sentences:
unity3d - Fire bullet using AddForce is very slow This is a top-down view but in 3D coordinates, I would like to instantiate and fire a bullet from the player's gun. This script is on a spawner object at the end of the barrel.

void Fire () {

        float speed = 80;

        GameObject projectile = Instantiate (bullet, transform.position, transform.rotation) as GameObject;

        projectile.GetComponent<Rigidbody>().AddForce(transform.forward * speed);
        coolDown += Time.time;
    }

I also tried this but in this case the bullet always moves in a fixed direction (North) :

projectile.GetComponent<Rigidbody>().velocity = Vector3.forward * speed;

Bullet is an empty object and the actual bullet is it's child ( did that to overcome a rotation issue ), the problem is nomatter how high I turn up the speed the bullet travels very very slow.
Both the parent and the bullet have Rigidbody.

sentences:
How do I move a sprite to the mouse position? So, I'm trying to make my sprite walk to the X-coordinate of my mouse click.
This is my code:

currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();
            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                int mouseposx = mouseState.X;
                if (playerPosition.X < mouseposx)
                    {
                        playerPosition.X += 3;
                    }
                if (playerPosition.X > mouseposx)
                    {
                        playerPosition.X -= 3;
                    }
            }`

The problem is that the sprite will walk only 3 pixels and then stop. If I use while instead, like this:

  currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();
            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                int mouseposx = mouseState.X;
                while (playerPosition.X < mouseposx)
                    {
                        playerPosition.X += 3;
                    }
                while (playerPosition.X > mouseposx)
                    {
                        playerPosition.X -= 3;
                    }
            }

it will simply teleport to the X-coordinate instead. I tried adding a delay using Thread.Sleep(ms), but that just made it freeze and then teleport anyway.

So, what should I do?

EDIT:
This is the new code, by Byte56.

currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();
            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                if (playerPosition.X - mouseState.X < 3)
                {
                    playerPosition.X = mouseState.X;
                }
                else if (playerPosition.X < mouseState.X)
                {
                    playerPosition.X += 3;
                }
                else if (playerPosition.X > mouseState.X)
                {
                    playerPosition.X -= 3;
                }
            }

edit3:

 void update()
        {
            // Check if the player has reached the target, if not, move towards it.
            if (playerPosition.X - playerTarget.X < 3)
            {
                playerPosition.X = playerTarget.X;
            }
            else if (playerPosition.X > playerTarget.X)
            {
                playerPosition.X -= 3;
            }
            else if (playerPosition.X < playerTarget.X)
            {
                 playerPosition.X += 3;
            }

        }

and

 currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();

            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                // This will give the player a target to go to.
                playerTarget.X = mouseState.X;
            }
            update();

sentences:
How do I scale up pixel art without blur in GM Studio? I'm creating a game in Game Maker Studio that uses pixel art.   When I launch the game, all scaled-up textures are really blurry. (It doesn't happen to small ones.)

For example, this image

renders in the game like this:

Is there anyway to resize small pixels into big pixels instead of blurred pixels?

sentences: Essential 2D engine features I have decided to make a simple engine for a new game I'm working on, and now, I'm wondering: what are the essential features of a 2D game engine? Or, a game engine in general?

sentences:
How to find path in graph without crossing the walls? I would like to know how to find path in a graph while having the edges "double-sided". Consider this scenario:

I have list of the line segments. These represents "walls" or rather impassable edges (in a game). I then plan in a next step to build a connected graphs (where possible). I'm trying to determine the feasibility at this point. If there's even a solution to this (it should in my opinion).

I don't need to know about A* or other algorithms per se, but rather how to not walk through the walls as seen in figure B. Any ideas?

I was wondering if I could turn segments to polygons (by adding width). Then make an union of these polygons and then treat them rather as polygons. But I would like to know whether there is a way to do it without this hassle. Also I'm not sure I want to add any width to the lines necessarily.

sentences:
Crop a texture procedurally Is there a way to crop a texture having a list of triangles which represent the part to be kept?
For instance, I have a rectangular texture and I want to obtain a texture shaped by the triangle list I have.

sentences:
How do I quantize an image into an arbitrary bitdepth with dithering? In the games I make, sometimes I need to balance the quality of the images I show with the amount of memory they consume. This is especially true for smartphones and other devices with very tight memory constraints.

Most of the time, images are saved in 24 or 32 bit formats, depending on whether or not there is an alpha channel, and graphic programs make use of the full 32 bits.

In order to reduce the memory used by some images, some times I have to reduce the memory they consume by loading them for example in 16 bits: 5 for red, 6 for green and 5 for blue. However, this process creates banding and other nasty artifacts, as the downsampling process is performed by fitting each pixel separately to the reduced palette.

I'm looking for a process to quantize an image to an arbitrary bitdepth, with dithering. In fact, I am a great fan of pngquant, which palettizes an image down to 256 colors, and applies dithering very intelligently to achieve some very impressive results. The problem is that the quantized colors are still 32 bits, and while this may reduce the size of the file, it won't reduce the amount of memory consumed once the image is loaded.

The tool I'm looking for should optimize on the decompressed size of the image, based on an arbitrary texture format, by reducing the amount of bits used by each pixel, and dithering where necessary to minimize the perceived detail and color loss. It doesn't really matter if the image is actually saved with 32 bits per pixel, as long as when it is loaded as a lower depth image, no further truncations occur. Optimally, this tool would also palettize the image, and minimize both file and uncompressed size.

In other words, how do I turn this image:

into, for example, this dithered R1G1B1 image?

Of course, I want to set the bitdepth myself. Notice that this is irrespective of the file format.

sentences:
Casting in UE4 to derived class I’m stuck in understanding of usable actors from survivable c++ example.
I have return Cast<AUsableItem>(Hit.GetActor());.
I have class AUsableItem. And I have another class AUsableWeapon inherited from AUsableItem.

I have function Use() in both classes, so basically in the end it looks like Cast<AUsableItem>(Hit.GetActor())->Use(). Hit.GetActor() returns instance of AUsableWeapon. And when i do that ->Use() call, it goes into AUsableWeapon even though it was casted to AUsableItem. Problem is - I cant understand how exactly after casting to AUsableWeapon I get Use() called from AUsableWeapon.

sentences:
How to draw equal length line stripes on a parabola? Simply put I'm making a basketball game. I'm using these equations to predict the ball position and it works fine:

x = vx * t
y = vy * t + 0.5 * gravity * t * t

But I can't find a way to draw equal length line stripes on the parabola. At this moment I'm using:

t = t + dt

in which dt is the time elapsed in last frame. It works but the line segments would be longer if velocity is larger. Anybody know a way to draw equal length line stripes like the flying trails in Angry Bird? Thanks very much.

I suppose I should calculate the integral on the curve but I can't get it through...

sentences: Does Apple currently accept iPhone apps with embedded Lua? I was researching this and I can't seem to find a concrete answer.

sentences:
Unity 2D - Pixel perfect movement using physics I'm trying to make a game in the style of many NES games and I'd like object movement to do two things:

I want to move an exact number of pixels per update.
I want, for lack of a better term, absolute movement.  The object should move or not move, I don't want a ramp up or down in speed.

I'm trying to do this with physics because I would like to use Unity's hitbox collision detection.  Moving objects using the translation property does not allow for this, at least that is my understanding.

Any help is appreciated and if my thought process is off, I'd like any suggestions or pointers in the right direction, thanks.

Here is my move method that gets called on Update.  I expect to movement to be in whole pixels, however, when I test the x and y are always fractional.

private void Move()
{
    VerticalMovement = 0;
    HorizontalMovement = 0;

    if (Input.GetKey(KeyCode.W))
        VerticalMovement = 1;

    if (Input.GetKey(KeyCode.S))
        VerticalMovement = -1;

    if (Input.GetKey(KeyCode.A))
        HorizontalMovement = -1;

    if (Input.GetKey(KeyCode.D))
        HorizontalMovement = 1;

    this.GetComponent<Rigidbody2D>().velocity = new Vector2(HorizontalMovement * Speed, VerticalMovement * Speed);
}

sentences: Should I sync animations from the server to the client or let the client play its own animations? For example, if the user presses the "Fire" button which leads to the player character doing some kind of animation, should the client evaluate itself if it can play the animation or wait for a response from the server telling it that it's ok to play the animation?

sentences:
Unity 2017.3.of3 Raycast2D randomly misses objects 2d up down platformer.  Character has 2 Rays(one left one right) going down, when either Ray's hit distance hits between -1 and 1 it should call a function which will change character direction from down to up.  Works 1, 2, 3, 4, sometimes 6, sometimes into the teens times then character goes through the obstacle got placing character over an obstacle and hitting play with no changes gave a different amount of time before falling through the obstacle.  I have tried changing the Time.time in fixedUpdate, placed movement in last update, varying degrees of success, I will post the current version of code, but it has gone through several revisions any ideas accepted.  thanks

[RequireComponent (typeof (BoxCollider2D))]
public class YowiController : MonoBehaviour {

  BoxCollider2D yowiCollider;
  Vector2 rayDir, leftRay, rightRay, rayOrigin;

  public AudioSource jumpSound;

  bool jump;
  bool bounce;

  public float upTime;
  float looseTime;

  float bounceCount = 0;
  float gravity = 3f;
  float bounceHeight = 5f;
  float movementSpeed = 2f;
  float bounceTime = .03f;

  void Start () {
    yowiCollider = GetComponent<BoxCollider2D> ();
    rayDir = new Vector2 (0, -1);
    jump = false;
    bounce = false;
  }

  void Update () {
  }

  private void LateUpdate () {
    movement ();
  }

  void movement () {
    drawRays ();
    if (Input.GetKey (KeyCode.RightArrow)) {
      transform.Translate (Vector2.right * Time.deltaTime * movementSpeed);
    }
    if (Input.GetKey (KeyCode.LeftArrow)) {
      transform.Translate (Vector2.left * Time.deltaTime * movementSpeed);
    }
    if (!bounce) {
      transform.Translate (Vector2.down * Time.deltaTime * gravity);
      gravity += .02f;
    } else {
      Bounce ();
    }
  }

  void Bounce () {
    transform.Translate (Vector2.up * Time.deltaTime * bounceHeight);
    looseTime = bounceTime / 2;
    if (upTime < looseTime) {
      bounceHeight += .01f;
      looseTime--;
    } else {
      bounceHeight -= .01f;
    }
  }

  void drawRays () {
    Bounds bounds = yowiCollider.bounds;
    leftRay = new Vector2 (bounds.min.x, bounds.min.y);
    rightRay = new Vector2 (bounds.max.x, bounds.min.y);
    RaycastHit2D leftHit = Physics2D.Raycast (leftRay, rayDir * -1, .05f, 1 << 9);
    RaycastHit2D rightHit = Physics2D.Raycast (rightRay, rayDir * -1, .05f, 1 << 9);
    if (leftHit || rightHit) {
      RayHit (leftHit, rightHit);
    }
  }

  void RayHit (RaycastHit2D leftHit, RaycastHit2D rightHit) {
    if ((leftHit.distance < 1.1f) && (leftHit.distance > -1.1f)) {
      bounce = true;
      StartCoroutine (Bouncing ());
    } else if (rightHit.distance < 1.1f && rightHit.distance > -1.1f) {
      bounce = true;
      StartCoroutine (Bouncing ());
    } else {
      print ("No Joy");
    }
  }

  IEnumerator Bouncing () {
    yield return new WaitForSeconds (bounceTime);
    bounce = false;
  }
}

sentences:
(real) 3d map rendering in wpf without an engine - how to handle the map data? I'm just doing some research before embarking on rendering a 3D map inside a wpf app. I've never delved into 3D before, and hence the question..

I have map data (in several formats, and many files) which I need to render - probably in a wpf viewport3D. All the map data is in 2D, but I can add a height-map and convert to 3D. This data can be altered (updated) by the user without my knowledge, but a bit of data-crunching can be done before application start, so it doesn't need to be entirely realtime.

I've googled around but can't find a framework for how to represent my world. Do I write a terrain-tile stream server to handle requests from the viewport about which area to display?
Do I create a collossal map, and hope it fits into memory?

Are there tutorials about how to deliver large terrains for rendering? Most of them seem to be about building a world inside an editor..

My world could be about 1000km * 1000km, with roads, parks, forests, power lines, street addresses (etc) - it's going to be a fair bit of data..

The machines that this software has to run on are ruggedized laptops - so not terribly fast (Core 2 duo?) and probably without DX10, but we can insist on heaps of RAM and HDD (SSD?).

Thanks - I'm looking forward to getting into this project..

sentences: What is the fastest way of reading an atomic counter? I have an atomic counter in my fragment shader that my application reads after each drawcall. I am currently using glMapBufferRange with  GL_MAP_READ_BIT set. This absolutely destroys my applications performance. To give you an idea of how often the atomic counter gets read, each drawcall consists of a million vertices.

sentences: Android sidecroller template I want to create a sidescroller game for Android but it seems stupid to reinvent the wheel and since there are a lot of android sidescroller games already out I though that there must be some sort of template or something so I can get started quicker, so I can keep developing from there.

sentences:
A Star pathfinding on oblique map I'm making an RPG and want to make npc ai to navigate the city. I am using polylines for collision detection, and my map is 2D, but oblique styled. I am considering using the A* algorithm to help them navigate.

I've gotten the A* algorithm to work with a top-down 2D array of nodes:

But am not sure how to go about implementing this in my game.

The overall world is 100x100 64x64px tiles, but the viewport (red box) only shows a small portion of them:

My questions are as follows:

Do I make a 2D 100x100 array, each cell size 64x64 px to mimic the real map?
How do I account for the polyline barriers/collision if 1's (unwalkable) and 0's (walkable) can only be assigned to a square cell?
Performance: is it better to just created a pathing grid for the viewport, or always generate one for the entire 100x100 map?
Barriers/Collision: I create my collision barriers directly in Tiled. Is there a way to programmatically insert unwalkable into the matrix for a given location of the barrier?

I am lost as to where to go next in translating this to my game.

Thanks!

sentences:
Libgdx is Character on Screen Inside an entity class:

public boolean onScreen(Camera camera){
    if(position.x + getWidth() > camera.position.x
            && position.x < camera.position.x + camera.viewportWidth
            && position.y < camera.position.y + camera.viewportHeight
            && position.y + getHeight() > camera.position.y){
        return true;
    } else {
        return false;
    }
}

The function returns false even when the entity is on the screen. What am I doing wrong?

sentences: Get screen bounds of 3D object I'm trying to draw a 2D plane that has minimum dimensions to contain a 3D model (a sphere). How do I calculate the minimum size and position of the rectangle to completely cover a 3D model on screen?

sentences:
Does XNA's content pipeline alter my FBX files? Basically I'm trying to export a model in fbx format through the XNA content processor and I'm finding that the model itself is getting modified and being shifted slightly to the right and being scaled down a bit too. I am certain the FBX file being exported by 3D Studio Max is properly alligned at the center and of a larger scale.

If I export an FBX file with more than one mesh in it the exporter seems to work fine, so not sure what's up with that either...

*Just found that no matter what rotation/orientation I give a model XNAs content exporter seems to reset it to an identity matrix. i.e. I create a long box and give it an angle of 20degrees, XNA resets it to 0 degrees when I draw it...

THis is as it appears in 3D StudioMax: http://i.stack.imgur.com/e0oW4.png

This is how it appears in XNA: http://i.stack.imgur.com/1vOcx.png

Both are being viewed from the same angle and direction but varying distances.

Now what is really odd is if I create another mesh in max, say a box, and export that (along with the original model), it works fine: http://i.stack.imgur.com/SIDg9.png

So long as there is more than one mesh in the fbx model it draws fine, if there is less its orientation which I applied to it in 3D studio max is removed when I draw it.

Here's my code for drwaing the mesh:

model.CopyAbsoluteBoneTransformsTo(boneTransforms);
foreach (ModelMesh mesh in model.Meshes) {
    foreach (BasicEffect effect in mesh.Effects) {
        effect.World = boneTransforms[mesh.ParentBone.Index];
        Vector3 cameraPosition = Camera.Get.Position; // new Vector3(0, 0, 0);
        //cameraPosition.X = -Camera.Get.PosX;
        //cameraPosition.Y = Camera.Get.PosY;
        effect.View = Camera.Get.View;
        // Matrix.CreateLookAt(cameraPosition, cameraPosition + Camera.Get.LookDir,
Camera.Get.Up);

        effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4
            , BaseGame.Get.GraphicsDevice.Viewport.AspectRatio
            , 0.01f, 1000000);
        //Matrix.CreateOrthographic(800 / 1, 480 / 1, 0, 1000000);

        //effect.TextureEnabled = true;
        effect.LightingEnabled = true;
        effect.PreferPerPixelLighting = true;
        //effect.SpecularColor = new Vector3(1, 0, 0);
    }

    mesh.Draw();
}

sentences:
SDL 2 SDL_BLENDMODE_BLEND way faster. Why? I was just tinkering around with a simple ecs, when I noticed drawing like 20,000 rectangles killed my
framerate (~10 FPS). I thought ok, maybe it's just too many.
Later I wanted to draw them transparent and set the blend mode to SDL_BLENDMODE_BLEND. Now I can draw
around 60,000 of them with 60 FPS.
I figured maybe it's because of pixel format conversion or something alike. When I use getWindowPixelFormat I get RGB888. No I'm even more confused because of the lacking alpha channel.
Code (abbreviated):
SDL_Window *window  = SDL_CreateWindow("Test",
                                       SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
                                       1280, 720,
                                       wndFlags);

SDL_Renderer *renderer  = SDL_CreateRenderer( window, -1,
                                             SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
while(running) {
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0xFF, 0xFF);
SDL_RenderFillRect(renderer, &rect);
SDL_RenderPresent(renderer)
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
}

Could someone enlighten me please?

sentences:
How to convert a rotation around an axis into pitch and yaw rotation So i want to rotate particles towards a point and i've already figured out how to calculate the angle and the rotation axis.

Currently what i do is simply use a 3 dimensional matrix, apply the rotation and then extract the euleric angles from the matrix using joml.

Now using the result i have the problem that the particle is also using the z rotation, messing up the orientation of the particles texture. The easiest way to fix this would be to only use yaw and pitch, but how do i convert the roation to just a rotation around the x and y axis?

sentences:
Sprite brighter than texture I have imported a new texture into UE, and have created a new sprite. I have setup the material of the sprite as follows:

I have also set my texture as texture-parameter. But my sprite renders brighter than its texture:

Why? What am I doing wrong?

Thank you in advance.

sentences:
Syncing game states in a multiplayer RTS game I'm working in a group with 2 friends on our Gr. 12 final project for programming. We're making a multiplayer RTS game. I've been assigned to the networking section of the game, and none of us have any experience doing network programming.

We've established that we'll have the server process everything such as path finding, build queues etc. The client will receive packets from the server, which will contain information such as HP, x, y, etc of each unit/building (Well, the server will send a packet whenever a unit/building's state such as losing HP, movements etc is changed).

The problem is identifying which unit the packet contains information for. I've thought of generating a number as an ID for each unit/building, and storing the units in a map data structure, where the key is the ID. Is there a better way to do this? How do most RTS games do it?

sentences:
Collisions and Lists I've run into an issue that breaks my collisions. Here's my method:

Gather Input
Project Rectangle
Check for intersection and ispassable
Update

The update method is built on object_position * seconds_passed * velocity * speed. Input changes velocity and is normalized if > 1.

This method works well with just one object comparison, however I pass a list or a for loop to the collision detector and velocity gets changed back to a non zero when the list hits an object that passes the test and the object can pass through.

Any solutions would be much appreciated. Side note is there a more proper way to simulate movement?

sentences:
Using 2d sprite characters from asset store noob here

So I recently downloaded this asset https://assetstore.unity.com/packages/2d/characters/2d-archers-sprites-18748
from the asset store. All the animations work great (walk, jump etc) but I do not know how to edit these. So let's say I want my character to jump from point A to point B, how would i start doing this? And would i just add the script to the animation?

sentences:
Attributes and Behaviours in game object design Recently I have read interesting slides about game object design written by Marcin Chady Theory and Practice of the Game Object Component Architecture. I have prototyped quick sample that utilize all Attributes\Behaviour idea with some sample data.

Now I have faced a little problem when I added a RenderingSystem to my prototype application. I have created an object with RenderBehaviour which listens for messages (OnMessage function) like MovedObject in order to mark them as invalid and in OnUpdate pass I am inserting a new renderable object to rederer queue. I have noticed that rendering updates should be the last thing made in single frame and this causes RenderBehaviour to depend on any other Behaviour that changes object position (i.ex. PhysicsSystem and PhysicsBehaviour).

I am not even sure if I am doing this the way it should be. Do you have any clues that might put me on the right track?

sentences:
Libgdx change to other screen and dispose current one I am trying to switch to a GameScreen when the LinearVelocity of a Box2D - Object is x = 0.
If it is so, I am using the setScreen() - Method by calling the main class. This works perfekt, but when the screen should change, it just flickers, which is most likely caused by the render() - method in the screen class.
So my question is now, how to dipose that render method or how to dispose the whole screen class, so that I only the new screen appears!
Thanks

sentences: Is SFML a game engine? I am a little confused on the difference between a game engine and an actual game. By making a game, are you making a game engine, or is a game engine a library used to make a game?

sentences:
How does 3D games work so fluent provided that each mesh's size is so big? I'm surprised to find that each mesh takes at least 5-6 MB,

how can a 3D game be so fluent when there are hundreds of models?

I'm expecting it will simply go out of memory or something else that makes the game un-playable..

What's the trick employed here?

sentences: What is the base framework of making a minimalist mobile game? I've seen plenty of minimalist games throughout the years recently like Blue Box, Loop, Colorolo and Ultraflow. Games that use simple shapes. What's not talked about is the design process of making such games, specifically with a clean, vector-like visual presentation.

sentences: How to view 360 degree images in Unreal Engine 4 Is there any way I can view 360 degree images in UE4, Ive read about possibly mapping it onto a hollow sphere however it always seems warped. I am working on a virtual tour and would like to be able to transition between multiple 360 images such as the ones found here : http://www.wpanorama.com/panoramas.php?page=01n . I am new to Unreal Engine and any help would be greatly appreciated. Ideally I would like to have it mapped to a sky sphere with the image on the sky sphere changing based on the "point" the user clicks on however I am not sure how I could go about this.

sentences:
I want to make a pause button on the scene I want to make a pause button on the scene. If I press the button it will show the guiTexture with a variety of buttons with each different script. So what steps should I take?
1. How do make it so if I press the pause button on a scene it will show guiTexture?

sentences:
increasing speed of sound as player approaches I am trying to create a sound that increases in speed as the player gets closer to the object. The sound is just a single 'ping' and will increase in frequency as we approach, once we are on top of it, it should play a different sound. I can't seem to get it to work. Here is what I've done in blueprints:

I'm not extremely experienced with Blueprints and I have almost no experience with working with sound in it. From my understanding, the blueprint should be measuring the distance between the object and the player, dividing it by .5, and then returning the sound at that speed.

Currently, I'm getting no sound whatsoever.

sentences:
For voxel rendering, what is more efficient: pre-made VBO or a geometry shader? Given a fairly static voxel array, what is more efficient: using the CPU to pre-generate a VBO to render the voxel faces (ignoring more advanced forms of rendering like marching cubes for now) or using a geometry shader on the GPU to generate the faces on the fly?

I'm not that worried about updating changing voxels but of course that is a benefit of the GPU-version since you don't have to rebuild the VBOs. Also, the GS approach feels a bit more modern :)

On the other hand, I haven't looked at the details on how a GS actually works with the rasterization pipeline in modern GPUs. Does it output the vertices into a sort of stream-cache or is the vertices written to the normal GPU memory in between? If it's the latter, then on-the-fly generating could reduce the available bandwidth and processing power from the rest of the GPU tasks I guess and then it would be more beneficial to do it on the CPU..

sentences:
GLSL - Stretched vertices after translating I'm trying to translate 3D object in my game engine.
I copied all formulas from my old, working game engine, where translation was working.

When I set position and rotation to 0, everything looks to be fine, but when I try to change position of my 3D object, something strange happens.
I'm not sure if it is projection matrix issue, or maybe transform matrix issue.

Position: x = 0, y = 0, z = 0
Rotation: x = 0, y = 0, z = 0

Position: x = 0, y = 0, z = 0
Rotation: x = 0, y = 45.0, z = 0

Position: x = 1.5, y = 0, z = 0
Rotation: x = 0, y = 0, z = 0

Position: x = 3.5, y = 0, z = 0
Rotation: x = 0, y = 0, z = 0

I checked all formulas once again, checked transformation matrix output, projection matrix output, and everything seems to be fine.

Here is my vertex shader:

#version 400

in vec3 position;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

void main(void)
{
  gl_Position = projectionMatrix * viewMatrix * transformationMatrix * vec4(position,1.0);
}

and fragment shader:

#version 400

uniform vec2 textureVec;

layout(location = 0) out vec3 out_Diffuse;
layout(location = 1) out vec3 out_Texture;

void main(void)
{
  out_Diffuse = vec3(0.5, 0.5, 0.5);
  out_Texture = vec3(textureVec, 0.0);
}

Projection matrix formula:

  float aspectRatio = static_cast<float>(windowSize.x) / static_cast<float>(windowSize.y);
  float yScale = static_cast<float>((1.0f / tanf(MathUtil::degToRad(fov / 2.0f))));
  float xScale = yScale / aspectRatio;
  float frustumLen = farPlane - nearPlane;

  projectionMatrix.m00 = xScale;
  projectionMatrix.m11 = yScale;
  projectionMatrix.m22 = -((farPlane + nearPlane) / frustumLen);
  projectionMatrix.m23 = -1.0f;
  projectionMatrix.m32 = -((2.0f * nearPlane * farPlane) / frustumLen);
  projectionMatrix.m33 = 0.0f;

View matrix formula:

  viewMatrix.setIdentity();
  viewMatrix.rotate(Vector3(1.0f, 0.0f, 0.0f), MathUtil::degToRad(transformComponent->rotation.x));
  viewMatrix.rotate(Vector3(0.0f, 1.0f, 0.0f), MathUtil::degToRad(transformComponent->rotation.y));
  viewMatrix.scale(Vector3(1.0f, -1.0f, 1.0f));

  Vector3 negativeCam = Vector3::negate(transformComponent->position);

  viewMatrix.translate(negativeCam);

And transformation matrix formula:

  transformationMatrix.setIdentity();

  transformationMatrix.translate(position);
  transformationMatrix.rotate(Vector3(1.0f, 0.0f, 0.0f), MathUtil::degToRad(rotation.x));
  transformationMatrix.rotate(Vector3(0.0f, 1.0f, 0.0f), MathUtil::degToRad(rotation.y));
  transformationMatrix.rotate(Vector3(0.0f, 0.0f, 1.0f), MathUtil::degToRad(rotation.z));
  transformationMatrix.scale(scale);

Same happens for "y" and "z" position axis, but object "rotates" in different axis.

I also checked my VAO loader, vertices, uniform values loader, and everything else.
If you need more code, let me know.

sentences:
Give a message box where yes no question should be answered Message boxes, had some time put in creating some for my program, now it all were informative message boxes where an OK button was available and then it closed.

I worked with a canvas that would be enabled when needed and gets disabled on clicking OK.

But now I'm in need of a messagebox that gives an output.
I've tried to do the same and test some stuff with public variables, but my code kept going and didn't wait for the response of the "dialogue box" which results in the changes going through and an unused canvas that opened behind my active screen. (Another canvas is loaded when running the code while the current canvas gets disabled).

Code example:

 cnvCleanup.enabled = true;
 //Here it should wait till i have "answered" on cnvCleanup
 if (CleanUpDone == true)
 {
 usages = 0;
 }
 else
 {
 usages++;

The cnvCleanup will get disabled on the script I wrote for clicking on the OK button.
In case the Not OK button is clicked the bool CleanUpDone should remain false so there the cnv gets disabled.

EDIT: More code.
The CleanUpDoneis public bool CleanUpDone; that gets changed in the cnvCleanup.

int usages;
usages = System.Int32.Parse(AssetList[2]);
if (usages < 10)
 {
 usages++;
 AssetList[2] = usages.ToString();
 }
 else
 {
 cnvCleanup.enabled = true;
 //Here it should wait till i have "answered" on the cnvCleanup
  if (CleanUpDone == true)
  {
  usages = 0;
  AssetList[2] = usages.ToString();
  }
  else
  {
  usages++;
  }
}

sentences:
Why does the location of my vehicle spawner change when I open a matinee? I'm doing work with InterActors and vehicle spawners in Unreal Tournament 3's editor, and have it set up like so:

(The Walkway its on is the InterActor)

However if I go in Kemsit and open the matinee that handles the InterActor, this happens:

It does look to me like the editor is moving it out of the way so I can see the InterActor (which would be very clever) because only the image of the vehicle moves, not the gizmo, nor does the vehicle spawn in that location in game.

Is this the case?

sentences:
Mesh Triangulation that is insideoutside aware am working on an algorithm for procedural generation of 3D meshes for caves in a side-scroller game.

The algorithm nicely computes contours and also points inside the caves that are supposed to be anchor points for the mesh. A sample for this can be seen in the following image:

The idea is that each of those anchor points has a distance to the view-pane depending on their distance to the contour. This way the caves have a roughly spherical shape in 3D.

This is also the reason I added those anchor points because having triangles from wall-to-wall would not enable me to have actual 3D caves.

However, the problem now is how to make the triangles. I found a nice implementation of the Delaunay triangulation algorithm. However that yields me the following mesh:

Obviously this algorithm is not aware of what's inside my cave and what is not and thus forms triangles completely outside of the caves. Pruning those outliers does not yield good results because then the contours of the caves are interrupted.

I have heard of "ear cut" algorithms that can work with concave shapes like my outlines. However those are not compatible with the anchor points I require.

What I'd need is a triangulation algorithm that allows me either to add anchor points inside the figure, or that allows me to limit the maximal length of vertices thus computing anchor points on its own.

Is such an algorithm known?

Huge thanks!

sentences:
Calculate UV sphere vertices (altitude) There is an fantastic answer by DMGregory here where he explains how to calculate and generate the vertices of an UV Sphere: OpenGL calculate UV sphere vertices

Based on his code, how can we change the "altitude" of each individual vertex?

To create something like this:

sentences:
How to generate point based on a map I am making a multiplayer game in Unity, with a socket.io server in NodeJS.
I am using a globe, with a texture to represent the world in Unity.

Let's say something similar do this.

Now, there I am stuck with some algorithm.

I would like to generate equally distant point, on the lands, where user can build stuff.

Something similar to this :

I saw this post here post and I would like to generate the map in the server, create from the generate map a mongoDB collection of point. When a user connect, he get back a list of point (that are already generated and can interact with those).

I get stuck on the generation. How do I make the server generate point based on a map that I will show to client, but that the server do not have idea of ? How would I store the coordinate position, so that the server generate them, and the client no matter the scale of the map would be able to display them at the good point ?

Basically, I don't know where to start to make this algorithm. I just would like some idea on how you would achieve this, so I can inspire myself to find my solution.

sentences:
Simultaneous AI in turn based games I want to hack together a roguelike. Now I thought about entity and world representation and got to a quite big problem.

If you want all the AI to act simultaneously you would normally(in cellular automa for examble) just copy the cell buffer and let all action of indiviual cells depend on the copy. Actions which are not valid anymore after some cell before the cell you are currently operating on changed the original enviourment(blocking the path) are just ignored or reapplied with the "current"(between turns) environment. After all cells have acted you copy the current map to the buffer again.

Now for an environment with complex AI and big(datawise) entities the copying would take too long. So I thought you could put every action and entity makes into a que(make no changes to the environment) and execute the whole que after everyone took their move.
Every interaction on this que are realy interacting entities, so if a entity tries to attack another entity it sends a message to it, the consequences of the attack would be visible next turn, either by just examining the entity or asking the entity for data. This would remove problems like what happens if an entity dies middle in the cue but got actions or is messaged later on(all messages would go to null, and the messages from the entity would either just be sent or deleted(haven't decided yet)

But what would happen if a monster spawns a fireball which by itself tracks the player(in the same turn). Should I add the fireball to the enviourment beforehand, so make a change to the environment before executing the action list or just add the ball to the "need updated" list as a special case so it doesn't exist in the environment and still operates on it, spawing after evaluating the action list?

Are there any solutions or papers on this subject which I can take a look at?

EDIT: I don't need information on writing a roguelike I need information on turn based ai in respective to a complex enviourment.

sentences:
How to start a coroutine that will finish after the object is destroyed I have a simple game in which the player can collect power-ups. Each power-up gives the player a temporary advantage for several seconds. The power-up should disappear immediately after the player collects it.

My current implementation of the power-up logic is:

[SerializeField] float duration;

private void OnTriggerEnter2D(Collider2D other) {
    if (other.tag == "Player") {
            StartCoroutine(GiveTemporaryPowerup(other.gameObject));
            Destroy(gameObject);
    }
}

private IEnumerator GiveTemporaryPowerup(GameObject gameObject) {
    gameObject.ActivatePowerupFunction();
    yield return new WaitForSeconds(duration);
    gameObject.DeactivatePowerupFunction();
}

This does not work: the powerup is activated but not deactivated. Deactivation does work when I remove the line "Destroy(gameObject)". However, without this line the player can collect the same powerup several times, which I want to avoid.

I tried to put the coroutine on a component attached to the player object (rather than the power-up object), but this did not solve the problem - deactivate was not called. Here is the updated code on the power-up:

private void OnTriggerEnter2D(Collider2D other) {
    if (other.tag == "Player") {
            var playerComponent = other.gameObject.GetComponent<Player>();
            StartCoroutine(playerComponent.GiveTemporaryPowerup(duration));
            Destroy(gameObject);
    }
}

And the code on the Player component:

public IEnumerator GiveTemporaryPowerup(float duration) {
    ActivatePowerupFunction();
    yield return new WaitForSeconds(duration);
    DeactivatePowerupFunction();
}

What is the correct way to implement this?

sentences: OpenGL optimization tips What tips or tricks do you have when it comes to making the OpenGL more efficient?

sentences:
Unity3D object fill shader I've been researching this for a while, and had no luck yet. I figured I'd ask here to see if anyone had any good ideas.

Essentially what I want is a shader that can make only part of an object transparent based on a slider. Similar to fill effects on 2D sprites, the object would fill from the bottom up, when the slider was set to 0 the whole object would be transparent, when it was set to 50 just the bottom half would be visible, and when it was set to 100 the whole object would be visible.

I've tried various masking effects, but it would be best if I could build this in to existing shaders or have a separate mask. Is there perhaps a way to adjust the alpha on individual pixels used for the diffuse texture without incurring great performance loss?

sentences:
How to figure out a vector based on 2 points that add up to a certain value I am writing a game in which I am representing a velocity with a vector. I have a starting point and a point that I want the object to move towards at a certain speed. (I need the resulting vector's x and y values to add up to 800). I'm not sure what kind of formula I can use to accomplish this.

SO! I have a starting point. An "ending point". And need a vector whose x and y values add up to 800.

Here is the code I came up with:

dx = size.width / 2 - ball.position.x
dy = 800 - size.height / 2 - ball.position.y
ball.physicsBody?.velocity = CGVectorMake(dx, dy)

Although this appears to work, |dx| + |dy| != 800 and therefore the balls move at slightly different speeds. I'm sure I'm doing this wrong, but I'm not sure how to go about fixing it.

sentences:
How can I simulate a magnet that attracts a ball in a 2D enviroment? I am making a top-down game where you have to move a ball from point A to point B. You are attracting the ball using magnets that are standing still. The ball needs to get pulled by multiple magnets.

How can I make this happen?

sentences:
2.5D platformer how to darken building edges? I was wondering how I could go about creating a vignette type effect / some sort of volumetric shadow for the 'cross section' parts of a 2.5D level. The effect I'm going for can be seen in 'This war of mine' where the edges of the rooms and walls / floors that are facing the camera have been darkened and blurred. (see below).

I thought about creating the edges in photoshop and then blurring them and putting them in, however the blur scales weirdly as I'm re scaling the sprites so it looks really fake and not like a visual effect. Is there perhaps a 2d shader I could use or make?

Any help on this would be appreciated!

Cheers

My photoshop attempt to recreate

sentences:
AdMob interstitial ads not showing after publishing in playstore I have create a Unity game, 1st I add an AdMob interstitial ads script on game object then try on my main camera when I test in my mobile before publishing. It has worked like real time ads and mistakenly clicked it and earn 0.3 so I create new ad unit placed it on my game then published my game. But the ads are not showing in real time. No error was found in AdMob but 147 ad requests are shown in AdMob and ads are not visible when my game 1st scene opens.

Here is my interstitial ads script code:

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class AdmobScript : MonoBehaviour
{
   private InterstitialAd interstitial;

   private void RequestInterstitial()
   {
      #if UNITY_ANDROID
         string adUnitId = "ca-app-pub-3129337025883034/9036322***";
      #elif UNITY_IPHONE
         string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
      #else
         string adUnitId = "unexpected_platform";
      #endif

      // Create an interstitial.
      this.interstitial = new InterstitialAd(adUnitId);
      // Load an interstitial ad.
      this.interstitial.LoadAd(this.CreateAdRequest());
   }

   // Returns an ad request
   private AdRequest CreateAdRequest()
   {
      return new AdRequest.Builder().Build();
   }

   private void ShowInterstitial()
   {
      if (interstitial.IsLoaded())
      {
         interstitial.Show();
      }
   }

   public void Start()
   {
      RequestInterstitial();
   }

   void Gameover()
   {
      if(interstitial.isloaded){
        ShowInterstitial();
      }
   }
}

sentences:
How do I clear up artifacts between aligned faces when using AA in XNA 4.0? I'm working on a graphics engine that lets you walk around a world that is made up of cubes (voxel engine) and I'm having some difficulties getting the results I want.

I'm not the best at 3D graphics, but I'm willing to learn. When I have anti-aliasing turned off, the textures line up properly together on the surfaces, but when I turn it on, I see a lot of lines between each square face. I've taken a picture:

I've tried changing the mip map mag filter options on the sampler, but cannot get it to look right. I've tried increasing the quality of the textures, but that doesn't help either. When I use Linear TextureFilter but that just makes everything super blurry, and the edges are even more obvious. In fact many edges get some blurry white and dark color to them. Anisotropic doesn't help.

Nothing I do seems to get rid of those lines in between faces when I have AA turned on. Anyone have any advice on where I would start looking? I'm assuming it's because all of the faces are individual, and not mixed together when they are next to each-other. Not just the edges are being anti-aliased. Not sure if I'm even on the right track with that thought.

I'm using XNA 4.0 to do this.

sentences: Using Quaternion in libGDX Can someone give me an explanation about how to use the Quaternion class in libGDX to move my camera around a sphere or just set it up, manipulate it, and apply it general? I am trying to acheive orbiting my camera around a sphere without gimbal lock, and I'm not having any luck getting the camera to do anything by using quaternions...

sentences:
General 2D Collision Detection Question Everytime I have coded "working" collision, I always went about it very haphazardly and unstructured. If I use Axis Aligned, or Verlet, Or Euler, any or all of these theories, my problems always lie in the edge cases. Let me invent a scenario to better explain my question.

Imagine a 2D game, let's use Mario as the best example. So there is gravity, there is acceleration and friction. If the world is being loaded as all individual, let's say 32 x 32, tiles, while the player is moving along the ground, there will always be that edge case of when he happens to be in the dead center of both tiles, and collision ends up being checked on both tiles below him and of course he gets moved based on both tiles' positions.

So in that case, I assume I would only want to be checking top block collision (bottom of player) only, and not side collisions, but then when I'm jumping onto a tile, or block, I know I want to check bottom player collision, so I can land, but that doesn't stand for anytime the player is in the air right? Cause what if I'm falling/jumping, and I hit the side of a block or wall, I want to check side collision. And then what if I hit the side of one block, but in that frame of collision when the player overlapped the tiles, he also got into the top of one of the tiles and now gets his y position moved because of it.

So the tl;dr version of my rambling is...

What's the most sensible way to structure collision? Totally case specific, i.e. only check specific collisions dependant on surrounding tiles, or the movement of the player?

Or is there a broad way to keep all collisions being checked (top, sides and bottom of player) and deal with the edge cases as well?

Also this isn't language specific, I'm speaking totally in generics. Any code examples are welcome. (Any language)

Thanks. (Hope my rambling isn't too convoluted and it makes sense. ><

sentences:
City-region generation I am currently making a procedural generated map and wanted to add regions to the cities indicating their reach, the way I am achieving it currently is by expanding outwards from the city center until either the reach of the city is exceeded or water/mountain terrain is met, a bit like raytracing I assume:

This gives the issues seen above, making big ugly/unnatural holes and not filling areas out of "sight" but arguably within the city's reach. City regions are supposed to be blocked by mountains ranges and larger bodies of water, but should curve around small lakes/rocks in a natural way. I can provide my current code put I believe it's fundamentally flawed for what I want to do, and is not usable.

Basically the desired region I want to great should look something like this:

I am at a bit of a loss what to search for to find literature about this topic, whether it be something like an algorithm or hints of some sort, so basically I am asking what this is called. (Any tips/tricks would also be greatly appreciated)

sentences:
Building a Flash Platformer I am basically making a game where the whole game is run in the onEnterFrame method. This is causing a delay in my code that makes debugging and testing difficult. Should programming an entire platformer in this method be efficient enough for me to run hundreds of lines of code?

Also, do variables in flash get updated immediately? Are there just lots of threads listening at the same time?

Here is the code...

stage.addEventListener(Event.ENTER_FRAME, onEnter);

function onEnter(e:Event):void
{
//Jumping

if (Yoshi.y > groundBaseLevel)
{
    dy = 0;
    canJump = true;
    onGround = true; //This line is not updated in time
}

if (Key.isDown(Key.UP) && canJump)
{
    dy = -10;
    canJump = false;
    onGround = false; //This line is not updated in time
}
if(!onGround)
{
    dy +=  gravity;
    Yoshi.y +=  dy;
}

//limit screen boundaries

//character movement
if (! Yoshi.hitTestObject(Platform)) //no collision detected
{
    if (Key.isDown(Key.RIGHT))
    {
        speed +=  4;
        speed *=  friction;
        Yoshi.x = Yoshi.x + movementIncrement + speed;
        Yoshi.scaleX = 1;
        Yoshi.gotoAndStop('Walking');

    }
    else if (Key.isDown(Key.LEFT))
    {
        speed -=  4;
        speed *=  friction;
        Yoshi.x = Yoshi.x - movementIncrement + speed;
        Yoshi.scaleX = -1;
        Yoshi.gotoAndStop('Walking');

    }
    else
    {
        speed *=  friction;
        Yoshi.x = Yoshi.x + speed;
        Yoshi.gotoAndStop('Still');
    }

}
else //bounce back collision detected
{
    if(Yoshi.hitTestPoint(Platform.x - Platform.width/2, Platform.y - Platform.height/2, false))
    {
        trace('collision left');
        Yoshi.x -=20;

    }
    if(Yoshi.hitTestPoint(Platform.x, Platform.y - Platform.height/2, false))
    {
        trace('collision top');
        onGround=true;  //This update is not happening in time
        speed = 0;

    }

}
}

sentences:
How to determine what difficulty is right for the game? I am targeting mass casual audience as I am developing the hyper-casual game. The problem is that I have played Helix Jump and Color Bump 3d and those games have a pretty big difference in difficulty level (well at least for me). They are both considered hyper-casual, both target mass casual audience and both have market success.

If two so similar games have such decent difference in difficulty how to determine that the difficulty of my game is just right? It's easy to say that it's subjective but when you invest so much time in your project you need to have at least some benchmark to work with. How to define this benchmark?

sentences:
how to pick up multiple coins with Phaser? I have a function that drops coins but I can only pick them up one by one when I click on them. Is it possible to make it so that I can pick up anything that overlaps?

dropCoins: function() {
var coinsNumber = 3;
for (var i = 0; i < coinsNumber; i++) {
  var coin = this.coins.getFirstDead();
  coin.body.collideWorldBounds = true;
  coin.anchor.setTo(0.5, 1);
  coin.reset(this.enemy.x, this.enemy.y - this.enemy.height / 2);
  game.physics.arcade.enable(coin);
  coin.body.bounce.set(0.3);
  coin.body.drag.set(80);
  coin.body.gravity.y = 1500;
  coin.body.velocity.y = -500;
  coin.body.velocity.x = Math.random() * 150 * util.plusOrMinus();
  coin.gold = Math.ceil( game.global.enemyHPTotal * (0.02 + (0.00045 * Math.min(game.global.level, 150))) );
  game.time.events.add(3000, this.removeCoin, this, coin);
}
this.coins.setAll('inputEnabled', true);
this.coins.callAll('events.onInputDown.add', 'events.onInputDown', this.removeCoin);

},

any help is appreciated. thanks

sentences:
How to perform some custom math between the model matrix and the projection matrix? I'm trying to write a shader in Unity that will perform some custom math after the model*view matrix is applied but before the projection matrix is applied.
First off, I'm not sure whether I should be using a surface shader or an unlit shader. My impression is that a surface shader can do everything I need it to and the outcome will look better with less effort, is that right?
I'm thinking that what I can do is manually apply the model and view matrices in the vertex shader, and then I have to tell it somehow to only apply the projection matrix in the rasterization step. Any idea how to go about this, or a different way to achieve the same result?

sentences:
After using Unity's Destroy() function, I see the Prefab Clones are now called "New Game Object" is this a problem? I use a prefab to generate several gameobjects which I then get rid of with the Destroy() function.

I noticed the clones, when destroyed are replaced with "New Game Object".  Because of the nature of the game there would be thousands of these created throughout the course of the game.

Is this expected behavior, or is there something I'm perhaps doing wrong where the Destroy isn't really getting rid of it completely?

sentences: How do I make something I flash/blink more frequently as it gets closer to disappearing? In my game when you kill an enemy they may drop something like a health pack or gold.  I want this to have a time limit so that it eventually disappears if you don't pick it up.  I want the item to flash more frequently the closer the drop gets to "death".  How do you do the "more frequently flashing" algorithm?

sentences:
Making an 'anim in circular motion' get attracted by gravity of the center I am working on a project, where the main player anim is in circular motion with respect to a center point. This video shows what I have done to the anim till now.

In that video, there are multiple apples are in circular motion. However, in my case, there is only one anim which is in circular motion. I have tried the following code for the circular motion.

public Transform center;
public float degreesPerSecond = -65.0f;

private Vector3 v;

void Start() {
    v = transform.position - center.position;
}

void Update () {
    v = Quaternion.AngleAxis (degreesPerSecond * Time.deltaTime, Vector3.forward) * v;
    transform.position = center.position + v;
}

The above code works perfect for the circular motion.

At the center (0, 0), I placed a circle sprite with 'point effector 2d' component. (see below image).

The reason why I 'added point effector 2d ' is to apply gravity effect to the player. But that didn't work. The player anim which is in circular motion around the circle sprite should get affected by gravity of that circle sprite and it should be pulled towards the center.

Changing the 'Point effector 2d' parameters is good enough to create gravity? or do I require any change in code?

sentences: Is it legal to use the Source Engine out of Steam? I would like to create a game that uses the Source Engine on Desura, the problem is that I am afraid that it is illegal to use the Source Engine in other platforms are not managed by Valve

sentences:
server/client architecture, how to combine physics data, scene graph and database over the network? I'm writting a C++ server and a C++ client for a rpg game.

The client is using OpenSceneGraph for rendering the 3D. RakNet is used for communication between the client and server.

At this time, the client and the server can communicate together. I have installed bullet for physics, but I didn't added bullet to the server nor the client.

The first reason is because I would like to know what you think about my idea to put the whole physics on the server and just sending to each clients, the updated quaternions for all actors view by each clients.

My second problem is, I never really used bullet, moreover never with a 3D engine. And I don't know if I need to build a scene graph on the server, or if I have to use another strategy. More precisely, most of such games seem to use a database. I using sqlite in some other C++ projects, so I don't have some question about that, but only about the fact that I never wrote a scene graph, so the question is, should I wrote one database scene graph ? or use a scene graph in memory and using a database to save the whole scene graph ? if so, should I do that every frame ?

sentences:
Determining the probability of a successful attack based on the equipped weapon? Take this example, a player has a sword composed of the handle and a blade. Together, they generate a strength of X and that combination adds qualitative attributes (induce more damage to fire creatures). If the player encounter 2 enemies, both at same defence level, but one is made of fire. Then, I need to calculate the probability of hitting the enemies, knowing that it may be higher for the fire creature.

Given the example, I need to calculate the:

Weapon's strength, by combining different parts?
Probability of the outcome of an encounter?
Inclusion of qualitative attributes in the calculation?

So far, I though of the following and I am not sure if it is good enough.

For the weapon, I would associate a value to each component. Then, I would determine that the handle represents 25% of the total strength; allowing me to calculate the total strength
The enemy will get a defence value.
For the encounter, I would generate a random number between 1 and the (player strength)+(enemy defence). If that number is higher than the enemy's defence, than it's a hit. This means that if they are equal, then it's 50% chance of success.
For the physical attributes, if the enemies has a weakness towards an elements, then I would deduct a certain value of he's defence before calculating the probability.

Is this a viable approach? If not, what would be a suitable implementation? or where can I find more ressources on these kinds of problems.

sentences:
How to detect if object is moving in clockwise- or counterclockwise direction? I've read this one, but I need more info: rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise?

I have a ball. The user is able to drag the ball in any direction clockwise/anticlockwise around a circle. I need to know whether or not the ball was dragged clockwise or anticlockwise.

I'd like to get both vector/non-vector methods.

sentences: What does vsynched mean? I'm always looking for ways to improve the smoothness of my games.  When I read around the net I come across the term "vsynched" quite often.  What does vsynched mean?

sentences:
How to use touch screen for movement instead of keyboard narrow keys I wrote this code and run the game on my desktop, now I need to build this game for android and I need to change to touch to move the player, what it should be changed in the following code and what is the necessary steps to build my desktop 2D game to be run on android device, the following is the player code:

#pragma strict

var speed : int = 5;

function Start () {
}

function Update () {

  if(Input.GetAxis("Horizontal") >0){

    if(collided_with != null) {
      if(collided_with.tag== "Right") {
        //collided_with=null;
        return;
      }
    }
    transform.Translate(Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,0));
  }

  if(Input.GetAxis("Horizontal") <0) {
    if(collided_with != null) {
      if(collided_with.tag == "Left"){
        // collided_with=null;
        return;
      }
    }
    transform.Translate(Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,0));
  }
}

sentences:
Selecting/Hiding is broken for Perspective but works for Orphographics views. Why? I'm learning Unreal4. Got a problem with selecting, focusing and hiding objects.

Focusing Issue: Focusing have to be done separatly for perspective view and ortho view. Why it is so?

Example: If I select an object in perspective view and focus on it (key F) everything works only for perspective view, but at the same time in ortho view no focusing occurs. So inorder to focus on the object in the ortho plales too I have repeat the whole process again: find object in orpho plane, select it, click F and only then focusing happens in all ortho view planes.

In perspective view "Show only selected" does not work, but works in ortho views
The same issue with "Show all actors".

Please, I need help. Thnaks.
P.S. Damn, it looks like I'm in some kind of a mode (for the lack of a better word). I mean in my clicking around, i've clicked ON some mode and now this selection\hiding thing works buggy...

sentences: Velocity and drag in unity So I have an object that is bouncing around the screen randomly, physics still works on it so it will speed up or slow down depending on what it hit and when. To try to normalize the speed I want to apply force or drag when ever it goes above or below the thresh hold. My question is, do I need to make note of the direction the object is moving to add force? Or can I just add force to the way it is currently traveling?

sentences:
Changing AnimationOverrideController "sometimes" fails - Unity 5.2.1 I have the following code, in a menu where you can chose the armor and weapon of a character:

private List<string> armors = new List<string> { "armor1", "armor2", "armor2" };
private List<string> weapons = new List<string> { "weapon1", "weapon2", "weapon3", "weapon4", "weapon5", "weapon6", "weapon7", "weapon8", "weapon9" };

private int  armor_index = 0;
private int weapon_index = 0;

public GameObject avatar_body;
public GameObject avatar_weapon;

void Update() {
         if (Input.GetKeyDown(KeyCode.RightArrow)) nextArmor();
    else if (Input.GetKeyDown(KeyCode.LeftArrow))  previousArmor();
    else if (Input.GetKeyDown(KeyCode.DownArrow))  nextWeapon();
    else if (Input.GetKeyDown(KeyCode.UpArrow))    previousWeapon();
    else if (Input.GetKeyDown(KeyCode.Return))     loadLevel();
}

void nextArmor() {
    if (armor_index < armors.Count - 1)
        armor_index += 1;
    else
        armor_index = 0;

    setArmor();
    setWeapon();
}

void previousArmor() {
    if (armor_index > 0)
        armor_index -= 1;
    else
        armor_index = armors.Count - 1;

    setArmor();
    setWeapon();
}

void nextWeapon() {
    if (weapon_index < weapons.Count - 1)
        weapon_index += 1;
    else
        weapon_index = 0;

    setWeapon();
}

void previousWeapon() {
    if (weapon_index > 0)
        weapon_index -= 1;
    else
        weapon_index = weapons.Count - 1;

    setWeapon();
}

void setArmor() {
    avatar_body.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/body" ) as AnimatorOverrideController;
}

void setWeapon() {
    avatar_weapon.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/"+weapons[weapon_index] ) as AnimatorOverrideController;
}

The problem is when I start switching between the weapons, sometimes the sprite showing does not update. Inspecting the GameObject, it is weird, because the Animator Component has successfully updated, but the Sprite Renderer still shows a fixed sprite from the last Animator.

Here are 2 examples:

Here we see that the animator is set for the weapon Gladius, and that the Sprite renderer is looping through all the frames of that animation

Here we can see that even though we have moved to the Flanged mace animator, the Sprite Renderer is still stuck on a sprite of Gladius

The problem is hard to recreate, because it happens just SOMETIMES. If I were to switch back to gladius and then once again back to flanged_mace...

Now it works... but I didn't change anything.

What is going wrong??

sentences:
Appropriate Cache Friendly Associative Container For An Entity Component System The intro to this problem is a bit of a long one so my apologies in advance. In short I am asking for suggestion as to what type of collection I should use to store data for a particular part of my system.

I have an entity component system in place where a static EntityManager creates and stores components within vectors of their own type, and creates Entities storing them in either a vector for dynamic entities or a vector for static entities. Something like this:

#define COMPONENTS X(MeshComponent) X(CameraComponent) X(PointLightComponent) X(DirectionLightComponent)
#define X(ARG) std::vector<ARG>,
using ComponentTuple = std::tuple<COMPONENTS Empty>;
#undef X

class EntityManager {
    static ComponentTuple components;

    vector<Entity>& getDynamicEntities() {
        static vector<Entity> entities;
        return entities;
    }

    vector<Entity>& getStaticEntities() {
        static vector<Entity> entities;
        return entities;
    }
}

Without getting into too much detail each Entity has an id (stored as a short which determines its dynamic or static status and its index within the respective vector).

Each Component has its own id (an unsigned short referring to its index in its respective vector) and an Entity id, referring to the entity it is "attached" to.

At this point all the Entity object is, is an ID and useful functions. To make it more useful I decided to let the Entity object store a collection of id's (unsigned shorts) of its own components (to make searching for the entities specific components faster). My initial plan was to use an unordered_map data structure it like so:

class Entity {
    friend class EntityManager;
private:
    short id = SHRT_MAX;
    std::unordered_map<std::type_index, vector<unsigned short>> components;
}

Thinking on it though, this introduces at least two (from what I can see) levels of indirection. One to the hash table produced by the unordered map and another to the vector storing the actual id's. With this in mind I was wondering if anyone else would be able to suggest a more cache friendly data structure. If not a simple reassurance that my choice was a correct one will also suffice (as right now I can't help but feel that there is a better way).

Some of the things that I would like the collection to do:

1) I would like to be able to search the collection by ComponentType (because components may share the same ID but be stored in different vectors)

2) I would like the collection to be expansive (not all entities will have the same components and it just seems wasteful to have an array for all potential Component Types when the entity may only have one)

3) I would like the potential to have multiple Components of the same Component Type in the collection (in the example given above maybe some Components have two PointLightComponents)

Any suggestions or comments would be greatly appreciated as I've been wracking my brain on this one for some time now. Thanks in advance.

sentences:
What causes regions of improperly-lit terrain when my pixel light count is below 4? My Unity3d game has a strange bug where if you have the pixel light count set below 4, these strange boxes appear on the terrain.  Because this game is going to be for mobile, if I set the pixel light count too high, won't run fast enough.

The screenshot will show you what I mean:

You can see this box on the left of the image where light is entering, I want light to enter all around the coin. How can I fix or prevent this?

sentences:
How should I go about creating a generic Scene object for managing VBO data? To simplify managing multiple types of data with different shaders and textures, I thought about creating a generic Scene object (is there a name for this?) which would allow me to pre-configure how I want to render something, and how the data changes. Let me give an example:

Everything  below is in the context of a 2D top-down game

Some parts are completely static, e.g. the background, and their geometry never changes.
Then there'd be a "NPC" layer, which can change on almost every single frame, uses different shaders.
Last but not least, there's a UI layer, which sits on top of everything else.

Some of these parts would probably be split into multiple subparts, such as parts rendered as GL_TRIANGLE_FAN, and other parts rendered as GL_LINE_STRIP, etc. To avoid duplicating lots of setup/generate geometry/render phases, it would seem logical to wrap this in something that can be configured, such as:

Scene s;
Batch b1 = s.create_batch(somehow_specify_shaders_etc);
generate_background_geometry(b1);

Batch b2 = s.create_batch(somehow_specify_other_shaders_and_VAO);

// game loop
while (true) {
  // this would generate/update the NPC geometry on the fly
  b2.process_input(gather_user_input());

  for (Batch b: s) b.render();
}

Now what if I wanted to specify different texture bindings for each batch? Or different shaders?

Is there a general pattern for managing geometry data like this?

sentences:
Maya 3D model to iOS OpenGL ES I need to display, rotate, and zoom a 3D model in OpenGL ES (iPhone/iPad).  The 3D graphic artists are using Maya (on OS/X).  What export format should I be looking at to use their 3D models in the app?

Also, a number of Maya plug-ins don't work on the Mac (apparently it doesn't handle plug-ins the same way as Windows and Linux), so I may need an external tool to handle the conversion.

I'm still learning my way around the 3D dev-world, so any advice is appreciated.

Thanks!

sentences:
Framerate control and physics engines? I am reading this article on how to control the framerate and physics calculations.

But in the game I am writing, I use a third party physics library and the only thing I do to update my physics is call
a single function (runSimulation()).

Since I cannot do things like "interpolation" in the above tutorial, how can I make my game runnable in different hardware/at different framerates?

sentences:
Sending Vector3 from Unity to custom C# server I'm working on a multiplayer game in which the server is a custom C# server.
What I want to do is to store the position of each player in my database.

In my case I'm sending Vector3 as an object through NetworkStream, the problem is how to access to that object in the server side. As you know there is no Vector3 class out there.

I don't want to get the object sent by the client as a string, manipulate it to get the coordinate. I want directly to access the coordinate of the Vector3 in the server side.

sentences:
How can I call Schedule() on interface that inherits from IJob So I have a voxel terrain engine, and I have an interface that all meshing jobs should inherit from. That looks like this (simplified from the actual):
public interface IMesherJob : IJob
{
    VoxelDataVolume<byte> VoxelData { get; set; }

    NativeArray<MeshingVertexData> OutputVertices { get; set; }
    NativeArray<ushort> OutputTriangles { get; set; }
}

One example of a meshing job is marching cubes, which looks like this: public struct MarchingCubesJob : IMesherJob
So here's my question: If I have a reference to an IMesherJob, can I somehow call Schedule on it? If I have a reference to MarchingCubesJob, I can call Schedule on it:
This works:
MarchingCubesJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64)

But this does not work:
IMesherJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64);

I noticed that Schedule() is an extension method for T where T : struct, IJob so that might be interfering with it, but it should still work because IMesherJob inherits from IJob

sentences:
Turning x and y difference between two points into a projectile moving between them at a fixed speed In a libgdx project of mine, I have two units on a 2d field who want to fire at each other. They both know the x and y distance to each other by subtracting their enemies position from their own:

Vector2 path = pos.cpy().sub(target.getPos());

What's the simplest way of turning this Vector2 into a vector that'll allow the units to fire at each other, with the projectile being sent off with Projectile.maxSpeed?

I was thinking of normalizing path and multiplying both x and y with the desired bullet speed, but I fear I may be overthinking this and that applying trigonometry would be simpler.

sentences:
How to efficiently change VBO size? I have created a menu class and now I'm working on getting it to render using OpenGL's VBO's. The menu is fairly simple, it has a number of buttons, the user can press up and down to highlight the desired button and then press ENTER to go to the selected buttons sub-menu which is just another instance of my menu. It should be noted that it doesn't need to have the same amount of buttons as the previous one. Pretty basic.

What I've come up so far is this:

//setting up the buffers and variables
int amountOfVerticesButtons = this.menu.getCurMenu().getNoButtons() * ShapeRenderUtils2D.VERTICES_RECT;
FloatBuffer vertexBufferButtons = BufferUtils.createFloatBuffer(amountOfVerticesButtons * VERTEX_SIZE);
FloatBuffer colorBufferButtons = RenderUtils.createColorBuffer(0.5f, 0f, 0.5f, amountOfVerticesButtons);

int amountOfVerticesBorders = this.menu.getCurMenu().getNoButtons() * ShapeRenderUtils2D.VERTICES_FRAME;
FloatBuffer vertexBufferBorders = BufferUtils.createFloatBuffer(amountOfVerticesBorders * VERTEX_SIZE);
FloatBuffer colorBufferBorders = RenderUtils.createColorBuffer(0.3f, 0f, 0.45f, amountOfVerticesBorders);

//filling up the buffers
for (int i = 0; i < MAX_BUTTONS_PER_PAGE && i < menu.getCurMenu().getNoButtons(); i++) {
    //buttons
    vertexBufferButtons.put(ShapeRenderUtils2D.getRectVertices(new Point(point.x, point.y + (i * (BUTTON_HEIGHT + BUTTON_SPACING))), MENU_WIDTH, BUTTON_HEIGHT));

    //button borders
    vertexBufferBorders.put(ShapeRenderUtils2D.getFrameRectangle(new Point(point.x, point.y + (i * (BUTTON_HEIGHT + BUTTON_SPACING))), MENU_WIDTH, BUTTON_HEIGHT));
}

vertexBufferButtons.flip();
buttons_handles = RenderUtils.createHandles(vertexBufferButtons, null, colorBufferButtons, amountOfVerticesButtons);

vertexBufferBorders.flip();
borders_handles = RenderUtils.createHandles(vertexBufferBorders, null, colorBufferBorders, amountOfVerticesBorders);

This code is run once in the constructor and it sets up the VBO for my buttons, and creates a color array with one color for each button.

My question is:

When the user presses ENTER, a new menu becomes active. The new menu doesn't have to have as many buttons as the previous one, so the old VBO is worthless, because it is of different size. I detect that the menu changes and what I basically do is to run the above code again, for the new menu, but at the end before I flip and create Handles I first do:

RenderUtils.deleteHandles(buttons_handles);
RenderUtils.deleteHandles(borders_handles);

Which removes the handles to the old VBO's. And then I create new ones just like I did the first time, but this time with correct size.

This seems very ineffective. Is there a better way to do it? Is there a better way to change an existing VBO's size?

EDIT: Please note that I've got everything else done with the menu. I only have problems with the VBO rendering. Also, there may be a very large amount of buttons, with many sub-menus that also contain large amounts of buttons, so creating a separate VBO for each case is not possible.

sentences:
Algorithm to find all tiles within a given radius on staggered isometric map Given staggered isometric map and a start tile what would be the best way to get all surrounding tiles within given radius(middle to middle)?

I can get all neighbours of a given tile and distance between each of them without any problems but I'm not sure what path to take after that. This feature will be used quite often (along with A*) so I'd like to avoid unecessary calculations.

If it makes any difference I'm using XNA and each tile is 64x32 pixels.

sentences:
How do I hide the console window for my released MonoGame game? I am just finishing up my first game for the One Game A Month challenge which I wrote with the current MonoGame framework in Xamarin for Windows. I built the program in release mode, but running the executable produces a console window besides the game window. The console stays empty unless I deliberately cause an error to be logged, say by removing a required resource.

How can I get rid of this extraneous console window?

I looked through the project settings, but saw nothing alluding to removing the console window...

sentences:
Why does iOS packaging fail when I activate Apple ARKit plugins in Unreal Engine? Steps,

Using Unreal Engine 4.21.2

1 - I created new Third Person game from the Unreal Engine template and named it FaceARSample

2 - I imported a skeletal mesh with blend shapes
3 - I added this to my DefaultEngine.ini:

[/Script/AppleARKit.AppleARKitSettings]
bEnableLiveLinkForFaceTracking=true

4 - I packaged the project for iOS and it was successful. I was able to deploy it to my iphone.
5 - I activated Apple ARKit and Apple ARKit Face Support plugins

6 - I packaged the project for iOS and it failed (error log below)

sentences:
Is there a quick-reference card for HLSL (DX9 or DX11)? Does anyone know of a DX9 or DX11 counterpart to the GLSL quick-reference card from Khronos?  The GLSL card is pages 8-11 here, and lists preprocessor directives, operators, types, and builtin variables and functions in a concise way.

I have looked here, on MSDN, and on Google results, including at the answers of this earlier question.  The closest I have found are:

Cg tutorial Appendix E, but that only covers the functions.
Adam Sawicki's cheatsheet, p.14, which lists predefined variables, but nothing else.
Ogre's wiki page on HLSL, which gives examples but not a reference.
The Ventuz shader node docs, which are close but are Ventuz-specific.

Context (and blatant plug ;) ) - there will be a Shader Showdown fragment-shader live-coding competition at Demosplash 2018 in Pittsburgh in a few weeks.  I am helping organize and would like the competitors to have reference cards so that more people can feel comfortable participating.  The software in question is Bonzomatic, which supports GLSL, DX9, and DX11 fragment shaders.  I can't give the GLSL competitors an unfair advantage, so if I can't find an HLSL quick-reference I will have to also not provide the GLSL reference.

I know this question may be on the edge of on-topic and appreciate your help.
 It is difficult to search for "quick-reference card" because "reference" materials are often very detailed (e.g., MSDN), and "cards" are more often hardware than paper in this context :) .  I have tried other search terms as well, but with limited success.

sentences: Optimizing spawning 500 objects every 3 seconds Using Object Pooling, assuming I'll like to spawn 500 cubes once every three seconds. How do I make it performance friendly? I need ideas, not the code itself.

sentences:
Collision detection in Arkanoid-like game at intersections I'm creating an Arkanoid-like game from scratch. I have no (formal or informal) education of any kind in game-development, so I kinda made up things as I went regarding collision detection based on personal ideas of "how it probably works".

I approximate the ball as a point and ignore its thickness, which is small anyway. I compensate for this visually by very slightly making all objects smaller than they are.

I don't "detect" collision, but anticipate it and change the outcome of the next frame. For example:

The ball is currently in position A, and it "wants" to go to E (red line). But I calculate all intersections with all segments which make up the bricks: B, C, D. The closest one to starting point (A) is B, so I choose B as the "real" intersection. I destroy the brick this segment belongs to.

Now I check how would the ball proceed if it would start at B, with its vector flipped horizontally (because I determine that the segment it hit was horizontal). This is the blue line. Again, from F and G, I pick F. I destroy the brick this segment belongs to.

Lastly, the orange line doesn't intersect, so I determine that the bottom of the orange line is where I should place the ball in the next frame.

This worked fine and I was satisfied with it, until I started nailing the edge case of the ball hitting the T intersection, where it all goes bananas.

What should happen here is that the ball bounces to the left and destroys either of the bricks. But what can happen is that my algorithms decides to choose the middle vertical segment (connecting boxes 1 and 2) as the collision point, either belonging to the 1st or 2nd box.

I thought of ignoring the edges of the segments, but then the ball would pass right through the T-intersection in this scenario, because it would also ignore what it's supposed to hit.

You can see it in action here (around after 00:07 mark): https://www.mp4upload.com/p6966u6kuzad

What are common techniques for handling this case? Even if I introduce the width to the ball, it could still hit the exact T-intersection at the tangent, so the problem would remain.

Requested to post code. Here's the main bit. Please note that I'm not expecting you to (or looking for) debugging the application. I'm more asking about how are these things even handled in general.

export function bounceBall(
  ball: Point,
  vx: number,
  vy: number,
  obstacles: Obstacle[],
) {
  const projectedNextPoint = ball.clone().translate(vx, vy)
  const movement = new Segment(ball, projectedNextPoint)

  const touchedObstacles: Obstacle[] = []

  let loop = 10

  let hasCollision = false
  do {
    hasCollision = false

    if (loop-- < 0) {
      throw new Error('oops')
    }

    // If in the previous loop the ball just grazed the surface
    if (movement.isZeroLength()) break

    const collisions: Collision[] = []
    for (const obstacle of obstacles) {
      const collision = getIntersectionOfSegmentAndObstacle_ClosestToStartExcludingStart(movement, obstacle)
      if (collision != null) collisions.push(collision)
    }

    const collision = getClosestCollisionExcludingSelf(movement.start, collisions)

    // We don't count a collision if it's the starting point.
    // If we did, grazing a surface would turn into an infinite loop.
    if (collision == null || Point.AreEqual(collision.point, movement.start)) {
      hasCollision = false
    } else {
      hasCollision = true
      touchedObstacles.push(collision.obstacle)
    }

    if (hasCollision) {
      movement.setStart(collision!.point)
      if (collision!.segment.isVertical()) {
        movement.mirrorVerticallyWrtStart()
        vx = -vx
      }
      if (collision!.segment.isHorizontal()) {
        movement.mirrorHorizontallyWrtStart()
        vy = -vy
      }
    }

  } while (hasCollision)

  return {
    touchedObstacles,
    vx,
    vy,
    newBall: movement.end,
  }
}

sentences:
Do leaderboard sets (in Game Center) allow 500 unique leaderboards? The Game Kit Programming Guide for iOS claims:

  The number of different leaderboards allowed increases to 500
  leaderboards per game when leaderboard sets have been
  enabled...Leaderboard sets offer developers the ability to combine
  several leaderboards into a single group.

But their example (see image below) implies that a single leaderboard is placed into multiple leaderboard sets. Is that the only way to be able to use the full 500 leaderboards? by combining the same leaderboard into multiple sets? I want to be able to have 500 unique leaderboards that are not duplicated between sets. Is this possible?

sentences:
How can I generate random lakes and rivers in my game? I have a 2D block building game and am trying to make randomly generated lakes and rivers. I have looked into the Perlin noise algorithm, but, I couldn't get it to generate random and nice results.

I have been trying to use the python noise library, but, it didn't create maps very randomly.

Is there some seed function I am missing on that library to make it more random? What variable do I change if I want it to go more random? If possible, give me a less technical answer, with less math and more python terms.

The map is a 2D tiled map. Here is some examples of the non-randomness of the other algorithm. The following code was outputted 3 times in a row. I was randomizing the octaves and frequency with something like this: freq = 16.0 * random.randint(1, 500000) * 0.000001 + 0.5

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1
1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

This is the code that produced the output above:

"""Writes a 256x256 grayscale simplex noise texture file in pgm format
(see http://netpbm.sourceforge.net/doc/pgm.html)
"""
# $Id: 2dtexture.py 21 2008-05-21 07:52:29Z casey.duncan $

import sys
from noise import pnoise2
import random
octaves = random.randint(1, 500000) * 0.000001 + 0.5
freq = 16.0 * octaves
for y in range(30):
    for x in range(40):
        n = int(pnoise2(x/freq, y / freq, 1)*10+3)
        if n>=1:
            n=1
        else:
            n=0
        print n,
    print

sentences:
How can I reduce a bezier curve using a slider till all points converge to it's original midpoint I am using the code from the question here to create bezier curves (I didn't think it was necessary to repost the code here since I haven't made any significant changes to it yet).

I have a symmetric bezier curve (please see image) that I want to reduce till all points converge at the midpoint of the original curve. I would like to preserve it's symmetry while it moves.
I would like achieve this using a  float slider (with values from 0 to 1) in editor mode.

sentences: Slide to reveal in AndEngine I was designing the game in that i want to cover the scene with black layer and i want user to see it when he slide the image. Is there any functionality in AndEngine for something like slide to unlock.

sentences:
Transparency behaviour on PowerVR I'm doing some graphics optimizing tests, especially on PowerVR transparency. Now I made a scene where there are two groups of simple objects. One group has the shape in geometry using diffuse shader and the other with quads using transparency shader. The camera looks through a plane towards a group.

The test was about the "lateness" of PowerVR's Z-tests. And whether or not use better geometry instead of transparencies for e.g leaves or flowers.

The results were not wholly what I expected. The transparency group benefitted from changing the plane from transparent to diffuse by increasing the FPS by 20(expected).

But why is the group without the plane infront so much faster than when the plane is in front?(Not expected) FPS was 38, screenshotting lowered it.

Tests on the geometry group were opposite of what I had learnt in the past few days. There was only 2FPS difference between transparent and diffuse planes. (Not expected). Shouldn't the transparent plane infront cause the whole scene to render as the Z-test is at the bottom of the pipeline?

sentences:
How can I hook into OpenGL initialization on Windows? I want hook all OpenGL games/applications. I want load my library only if application actually use OpenGL. Something like Direct3DCreate9 for Direct3D 9 or CreateDXGIFactory for Direct3D 10/11.

I thought this function wglDescribePixelFormat, but some app's/games not use it.

sentences:
LibGDX drawing map using tiles without space I am making a board game. To draw the map on the board I use different tiles.
On some screen the map looks good but on some other screens there is a space between the tiles.
How can I do so there won't be any space between the tiles?

I am designing my game with the size 480x800. To fit other screens I stretch it.

My tiles looks like this:

I draw the map using a for loop to draw the tile in different (x,y) position on screen.

Here is what I mean with space between tiles:
Screen with 240x400

Screen with 360x600, here there is no spacing between tiles.

I use camera and the screen to draw I don't use stage. I have also tried to use Viewport but I get the same results.

  cam = new OrthographicCamera();cam.setToOrtho(true, gameWidth, gameHeight);
  batcher = new SpriteBatch();
  batcher.setProjectionMatrix(cam.combined);
  shapeRenderer = new ShapeRenderer();
  shapeRenderer.setProjectionMatrix(cam.combined);

How can I do to solve the problem?

sentences:
GUI.Button inside GUI.Window not responding I am trying to do some GUI work with unity but am having some issues.

I call a window with this code:

fortuneRect = GUI.Window(0, fortuneRect, fortuneWindow, "Your future");

and inside the window I have a button

if(GUI.Button(new Rect(10, 10, 150, 20), "save fortune")){
       Debug.Log("save fortune button press");
       writeToFile("Button pressed!", "fortune.txt");
       Debug.Log("After save fortune button press");
    }

but the button doesn't fire any of its events on click. I tried commenting out the writeToFile but even with only Debugs in the body it doesn't fire.

sentences:
What is the design rationale behind melee retaliations in turn-based games? I've seen quite a lot of turn-based games in which melee attacks on another unit cause the attacked units to also damage the attacking unit, while ranged attacks do not suffer from this "retaliation" mechanic.

Examples include the Heroes of Might and Magic series, the Civilization series, the new King's Bounty series, and more.

Is there a specific design reason for this? What's the rationale behind giving the attacked unit an extra attack, which doesn't cost it its turn? And why are ranged attacks excluded from retaliation?

sentences:
As an artist, how do I go about gaining "experience", and how do employers define it? I'm a freelance 3D artist, and recently I've been looking into getting a full-time job as a character/environment artist (character prefered) and up until now I've only been doing unpaid commissions with two small paid jobs along with my current paid commission, a cinematic for a modding company.

My issue is this: nearly every game artist job, no matter how large or small the studio is, requires at least two years experience in the field before most will even consider looking at your portfolio. Only recently have I gotten out of college, and I'd like to think that I'm extremely competent and self-motivated, but it's impossible to find any serious companies who won't consider me a risk for having such a limited amount of real-world experience. I've been doing free commissions to expand my portfolio for nearly 3 years to the date, but I'm fairly certain this doesn't qualify as "experience" in the eyes of employers.

So the question stands. How do employers define experience, and how do I go about gaining that 2 years of required paid experience, or do employers care once they see your portfolio?

Any help would be greatly appreciated.

sentences:
Admob banner not getting remove from superview I am developing one 2d game using cocos2d framework, in this game i am using admob for advertising, in some classes not in all classes but admob banner is visible in every class and after some time game getting crash also.

I am not getting how admob banner is comes in every class in fact i have not declare in Rootviewcontroller class. can any one suggest me how to integrate Admob in cocos2d game, i want Admob banner in particular classes not in every class,
I am using latest google admob sdk, my code is below:

Thanks in advance

`

-(void)AdMob{
NSLog(@"ADMOB");

CGSize winSize = [[CCDirector sharedDirector]winSize];
// Create a view of the standard size at the bottom of the screen.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-364,
                                           size.height -
                                           GAD_SIZE_728x90.height,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];

}
else { // It's an iPhone

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-160,
                                           size.height -
                                           GAD_SIZE_320x50.height,
                                           GAD_SIZE_320x50.width,
                                           GAD_SIZE_320x50.height)];
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    bannerView_.adUnitID =@"a15062384653c9e";
}
else {
    bannerView_.adUnitID =@"a15062392a0aa0a";
}

bannerView_.rootViewController = self;
[[[CCDirector sharedDirector]openGLView]addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];

GADRequest *request = [[GADRequest alloc] init];
request.testing =  [NSArray arrayWithObjects:
                  GAD_SIMULATOR_ID, nil];                              // Simulator

[bannerView_ loadRequest:request];
 }

   //best practice for removing the barnnerView_

-(void)removeSubviews{
 NSArray* subviews = [[CCDirector sharedDirector]openGLView].subviews;
 for (id SUB in subviews){
    [(UIView*)SUB removeFromSuperview];
    [SUB release];
 }
 NSLog(@"remove from view");
  }

    //this makes the refreshTimer count
-(void)targetMethod:(NSTimer *)theTimer{

//INCREASE OF THE TIMER AND SECONDS
elapsedTime++;
seconds++;

//INCREASE OF THE MINUTOS EACH 60 SECONDS
if (seconds>=60) {
    seconds=0; minutes++;
    [self removeSubviews];
    [self AdMob];
  }
NSLog(@"TIME: %02d:%02d", minutes, seconds);
 }

`

sentences:
How do I teach the players that their strong but slow attack can not be cancelled? Designing the combat mechanics of my current project I've  come to a problem: How do I make players feel responsable of their mistakes instead of they blaming my game?
This is the scenario:

Among other things your character has two basic abilities a quick and a strong melee attacks, and as you may guessed the quick attack does less damage and has a smaller control(time enemies are pushed/stunned after hit), as the strong attack has a slower and obviously longer animation that (here is the catch) cannot be cancelled. And here is my concern; many players may feel that the game is unresponsive instead of realizing that they shouldn't had used a strong attack in that moment.

Extra info:

Neither of the attacks consume resources as stamina.
Receive a hit is a big penalization for the player as heal is hard and
the difficulty lies in progressing through levels loosing less health than
you can find.
Both attacks has a 3 hit chain with cool down after the last, this
means that the managing of this ability to cancel or not the attack
is a core mechanic that the player should learn in order to succeed.
Enemies always give a big hint before attacking the player.

Solutions I thought:

Explain to the player via tutorial.
Pop a message sometimes when the player got hit during a strong attack animation.

Pd: I'm looking to the solution to the problem described above, but any general tips in this mater are also appreciated

sentences:
All scripts in Unity game can not be loaded I can not provide a "why" here, because as far as I can tell it happened spontaneously - after saving an edit to one of my scripts, it just started happening. But here's the problem:

Every single one of my scripts, while still in the same Scripts file, can no longer be found and loaded. All the Script Components (take the Game Manager component for example) now look like this:

or like this:

Attempting to locate the scripts by going Add Component > Scripts > [Desired Script] doesn't work, because there isn't even a Scripts item in the Add Component menu. I have already looked this up, and none of the answers I found were applicable:

Yes, every script's file name is the same as the Class name within them
I have tried reimporting all  assets (Assets > Reimport All), no success.
Taking all scripts out of the project, restarting unity and then reimporting the scripts. Nothing
Removing all script components, then reapplying them. It didn't work because, as I said, there was no Script item in the Components menu.

This is a pretty game-breaking, literally, because this is a hobby game (I'm not doing this as a job, it's just in spare time). If I can't restore the game as it was, I won't be able to bring myself to restart it. So any help is greatly appreciated.

sentences:
What quality should my sounds be? Sound and it's quality is something like religion. Never ending story.

People will say, that MP3 320kbps is lossless, while experts will say that any MP3 is crap, but in the end, no one will hear a difference in the result... unless they're in the music industry for 20 years+.

What would be the best format for video game, and what properties should be enough (Hertz, bitrate etc.), assuming that 320kbps MP3 is "heavy"?

Maybe an example or two, how some AAA titles work with their sounds.

sentences:
How does this hash function work in this perlin noise implementation? In Perlin's implementation of his noise function, he uses an array to hash the input coordinates and later find the gradient vectors. But in Stefan Gustavson's implementation, a strange "permute" function is used:

vec4 permute(vec4 x)
{
  return mod289(((x*34.0)+1.0)*x);
}

vec4 mod289(vec4 x)
{
  return x - floor(x * (1.0 / 289.0)) * 289.0;
}

Then, it is used like this:

vec4 i = permute(permute(ix) + iy);

vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0 ;
vec4 gy = abs(gx) - 0.5 ;
vec4 tx = floor(gx + 0.5);
gx = gx - tx;

I understand that the "*2.0 - 1.0" is for getting gx to the range -1 to +1, but I do not understand the rest of the hashing.
How does this "permute" function work and why does it divided by 41.0?

Thanks.

sentences:
Third person and LineTracing C++ Problem

I have a crosshair in the middle of the screen.

I need to create a lineTrace that passes straight through this crosshair.

As this is a third person game, I need the line trace to cast through the crosshair

Question

How do I do this

Code sample

    #include "GameFramework/PlayerController.h"
    #include "Engine/World.h"
    #include "DrawDebugHelpers.h"
    #include "Camera/PlayerCameraManager.h"
    #include "GrabObjects.h"
    #include "CollisionQueryParams.h"

    #define OUT

    //...

    // Called every frame
    void UGrabObjects::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
    {
        //...

        FVector PlayerViewPointLocation;
        FRotator PlayerViewPointRotation;

        // Get player viewport
        GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
            OUT PlayerViewPointLocation,
            OUT PlayerViewPointRotation
            );

        // Draw a line from player showing reach
        // PlayerViewPointRotation.Vector() is the unit vector
        FVector LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector() * Reach;

        DrawDebugLine(
            GetWorld(),
            PlayerViewPointLocation,
            LineTraceEnd,
            FColor(0, 255, 0),
            0.f,
            0,
            5.f
        );

        //...
    }

```

sentences:
Is it possible to load local html pages into Gamemaker games? I was just wondering if it would be possible somehow to load locally saved web pages into a game. My primary use for them would be as menus, helping to navigate between rooms.

I know about the built in "Open URL" function but I want to know if the loaded page can interact with the actual game.

sentences:
Unity 2D detect if swipe goes through an object I am developing a game in unity with flying arrows that the user tries to deflect by swiping through them (changing their direction). I can get the arrows to move with the swipes, but they move no matter where the swipes occur. I want them to only move (be affected) iff the swipe goes through the arrow. Here's what I have so far:

public class swipe : MonoBehaviour
{

private Vector2 leftFingerPos = Vector2.zero;
private Vector2 leftFingerLastPos = Vector2.zero;
private Vector2 leftFingerMovedBy = Vector2.zero;

public float slideMagnitudeX = 0.0f;
public float slideMagnitudeY = 0.0f;

bool touched = false;

void Update()
{
    if (Input.touchCount == 1)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            leftFingerPos = Vector2.zero;
            leftFingerLastPos = Vector2.zero;
            leftFingerMovedBy = Vector2.zero;

            slideMagnitudeX = 0;
            slideMagnitudeY = 0;

            // record start position
            leftFingerPos = touch.position;

        }

        else if (touch.phase == TouchPhase.Moved)
        {
            leftFingerMovedBy = touch.position - leftFingerPos; // or Touch.deltaPosition : Vector2
            // The position delta since last change.
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            // slide horz
            slideMagnitudeX = leftFingerMovedBy.x / Screen.width;

            // slide vert
            slideMagnitudeY = leftFingerMovedBy.y / Screen.height;

            if(touched)
            {
                //rigidbody2D.velocity = new Vector2(slideMagnitudeX, slideMagnitudeY)*20;
                rigidbody2D.AddForce(new Vector2(slideMagnitudeX, slideMagnitudeY)*5000);
                touched = false;
            }
        }

        else if (touch.phase == TouchPhase.Stationary)
        {
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }

        else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
        {
            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }
    }

}

void OnMouseEnter()
{
    touched = true;
}
}

The only way I have been able to find so far is using "onMouseEnter" which only works for very slow swipes.

How do I detect whether a swipe goes through an object?

sentences:
How can City-sim simulate hundreds of characters? My games usually start lagging quite easily when there are a couple hundred of boxes representing possible characters. While games like SimCity or even Anno have hundreds of characters.

I realized that those games don't update everything at every tic, the needs are handled in intervals and it's not a render problem, but all of those tiny creatures have individual path-finding etc.
I simply can't understand how they can pull that off for thousands of characters even on old machines. How do they do this?

This question was updated to refer to huge Numbers where individuals don't really count and are simply simulated for immersion and aesthetics.

(Related if referring to individual characters: How does Dwarf Fortress keep track of so many entities without losing performance?)

(Different question but maybe related?: Rendering hundreds of animated characters in Unity3D)

sentences: How to convert a silhouette to a blob? Using ShapeShop you draw a silhouette and it converts the silhouette to a "blob", which gives a nice game character. Using 3DSMAX 2012 you draw a line and close the spine. How do you convert it to a "blob" there? Extrude gives sharp edges, BlobMesh only converts the lines to a blob, I want it to be the organic "blob" structure it is in ShapeShop.

sentences:
Rotating a model AND translating it forward in XNA I have this enemy class, and I want it to

1) Spawn at a certain place Vector3 pos

2) Rotate to face my player position

3) Move forward

As this code is now, it will appear at it's specified place: pos, and attempt to rotate to face it's target: targetShip. It fails to correctly face it's target, because of this offset.

If I remove the code that assigns a value to translation, or if I normalize pos then the model will appear at   the origin and rotate to face it's target correctly.

If I try to move it at all using any of the comment out code regarding translation, It appears to start someplace else and I never can find it.

However, if I remove the code relating to rotation, and uncomment the code relating to translation, then I can get it to move forward.

The trick is doing it all together.

    class Enemy : BasicModel
    {

        Matrix rotation = Matrix.Identity;
        Matrix translation = Matrix.Identity;
        public Vector3 pos, up, right, targetShip,dir;

        public Enemy(Model m, Vector3 pos)
            : base(m)
        {
            up = Vector3.Up;
            //sets the position to the Vector3 as it's spawn point.
            translation = Matrix.CreateTranslation(pos);

        }

        public override void Update()
        {
            //Glo is a global class, where I store the player world.
            targetShip = Glo.world.Translation;
            targetShip.Normalize();

          pos = transform.Translation;

          rotation = RotateToFace(targetShip, pos, Vector3.Up);
          //Attempt at moving the model forward. Causes it to go out of view
          //translation *= Matrix.CreateTranslation(this.GetWorld().Backward);
          //translation *= Matrix.CreateTranslation(pos);
        }

        public override Matrix GetWorld()
        {
            return rotation * world * translation ;

        }

        /*Params: O = Our target
         * P = Our position
         * U = up.
         *
         * Code from some site I googled up.
          */
        Matrix RotateToFace(Vector3 O, Vector3 P, Vector3 U)
        {

            //The direction we're facing.
            Vector3 D = (O - P);
            //Our relative Right.
            Vector3 Right = Vector3.Cross(U, D);
            Vector3.Normalize(ref Right, out Right);
            //Our back
            Vector3 Backwards = Vector3.Cross(Right, U);
            Vector3.Normalize(ref Backwards, out Backwards);
            //Our relative up
            Vector3 Up = Vector3.Cross(Backwards, Right);
            //Make a matrix out of all of these.
            Matrix rot = new Matrix(Right.X, Right.Y, Right.Z, 0, Up.X, Up.Y, Up.Z, 0, Backwards.X, Backwards.Y, Backwards.Z, 0, 0, 0, 0, 1);
            return rot;
        }

    }
}

----

This is fixed now, and all this code is mostly obsolete.

sentences:
LibGDX ShapeRenderer rotated I'm having a weird problem with the LibGDX ShapeRenderer where it draws everything rotated.
Here are some images to show you what i mean:
This is what it looks like in Tiled(Map Editor):

This is how it looks like in game:

As you can see, its rotated.
Heres the Code i use to render the mapobjects:
    shapeRenderer.setProjectionMatrix(cam.combined);
    shapeRenderer.setColor(1, 1, 0, 1);
    shapeRenderer.begin(ShapeType.Line);
    for (RectangleMapObject o : MovementSystem.objects.getByType(RectangleMapObject.class)) {
        Rectangle rect = o.getRectangle();
        shapeRenderer.rect(rect.x, rect.y, rect.height, rect.width);
    }

    shapeRenderer.end();

The rectangle is positioned at the right place and it is definitely NOT rotated!
I checked this with a small collision detection test where i moved another rectangle over this one.
So it just gets drawn like this and i have no idea why^^
Would be nice if anybody could help me :)
Thanks for your help in advance!

sentences:
Client side latency when using prediction I've implemented Client-Side prediction into my game, where when input is received by the client, it first sends it to the server and then acts upon it just as the server will, to reduce the appearance of lag.  The problem is, the server is authoritative, so when the server sends back the position of the Entity to the client, it undo's the effect of the interpolation and creates a rubber-banding effect.

For example:
Client sends input to server -> Client reacts on input -> Server receives and reacts on input - > Server sends back response -> Client reaction is undone due to latency between server and client

To solve this, I've decided to store the game state and input every tick in the client, and then when I receive a packet from the server, get the game state from when the packet was sent and simulate the game up to the current point.

My questions:

Won't this cause lag? If I'm receiving 20/30 EntityPositionPackets a second, that means I have to run 20-30 simulations of the game state.

How do I sync the client and server tick? Currently, I'm sending the milli-second the packet was sent by the server, but I think it's adding too much complexity instead of just sending the tick.  The problem with converting it to sending the tick is that I have no guarantee that the client and server are ticking at the same rate, for example if the client is an old-end PC.

sentences:
How to stop sliding properly I wanna stop immediately (not instantly) when I release a key so it would not slide. I don't wanna use rb.isKinematic = false; because it's just stopping so instant. So like I thought about:
x = GetAxisRaw("Horizontal");
z = GetAxisRaw("Vertical");

move = transform.right * x + transform.forward * z;

if (no inputs pressed)
{
   rb.AddForce(force * -maxSpeed); // maybe force will be the current velocity
}

I tried this but seems like nothing is hapenning. And so I think I need some improvements

sentences:
How to convert a Maya object to a VBO? I'm currently trying to teach myself OpenGL... and quickly discovering that the Immediate Mode taught in old OpenGL tutorials is basically obsolete... which leads me to VBO's... which I kind of get but would like to start learning them in context.

What is the workflow involved in taking a 3D object from Maya or 3DS Max and converting it to something that can be turned into a VBO?

On that token, do these export workflows also deal with materials and textures, or is that handled in an entirely different manner?

sentences:
Creating Rope Physics for Unity I want to create a bungee jumping-like game in Unity and therefore I need a rope physics. I especially need elastic ropes with capability to pull objects with velocity after a little extension. Do you know any place to start? Because I have no idea how to start such scripting.

I looked at Asset Store. There are some rope physic simulators, but I have to do it on my own, plus they are really expensive.

EDIT: I already tried using Spring and/or Configurable Joints in Unity, but they did not give what I want.

sentences:
When I use a font in my game, do I have to include its license in the credits? For example, if I use this font from Google Fonts:
https://fonts.google.com/specimen/Open+Sans

This font is licensed under Apache License 2.0
But regardless of the license, if it allows commercial use, do I have to include a notice or the license in the credits? (assuming that I didn't modify the font)

sentences: Publishing a game on Google Play with a fake name I'm almost publishing my game to Google Play, but I wonder if I can use an fake name, I mean, not using a fake name with a real names, just some words like Lazer Dude or anything else, because I don't want to show who am I, I wanna keep my anonymously. There's no problem to use an fake name?

sentences:
Set / Get UserPointer - What Do They Do? I see a lot of talk about glfwGetWindowUserPointer() and glfwSetWindowUserPointer() but I can't for the life of me understand what these functions actually do.

From http://discourse.glfw.org/t/what-is-a-possible-use-of-glfwgetwindowuserpointer/1294:

  "If you are trying to use glfw in a program that follows object-oriented design, for example, you can use this pointer to store the address of the instance that is handling a particular window, and forward the callbacks (which have to be static functions, because of the way the API works) to the appropriate member functions."

The author of that comment then posts the following example:

/* Constructor for the MyWindowHandler class */

MyWindowHandler (GLFWwindow * window)
{
....
    glfwSetWindowUserPointer(window, reinterpret_cast<void *>(this));
}

/* Key event callback wrapper function */

static void key_callback (GLFWwindow * window, int key, int scancode, int
                                                        action, int mods)
{
    MyWindowHandler * handler =
    reinterpret_cast<MyWindowHandler *>(glfwGetWindowUserPointer(window));

    if (handler)
        handler->keyEvent(key, scancode, action, mods);
}

What confuses me is that (at least as far as I can tell) I was able to achieve the exact same outcome in my program without using glfwSetWindowUserPointer() or glfwGetWindowUserPointer() at all.

/* Class constructor (just provided for reference) */

GLFW::GLFW(int right, int top)
    : m_Window(0)
{
    if (!glfwInit())
    {
        std::cout << "GLFW initialisation failed!\n";
        __debugbreak();
    }

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    m_Window = glfwCreateWindow(right, top, "OpenGL Window", NULL, NULL);

    if (!m_Window)
    {
        glfwTerminate();
        std::cout << "Could not create window!\n";
        __debugbreak();
    }

    glfwMakeContextCurrent(m_Window);
    glfwSwapInterval(2);

    if (glewInit() != GLEW_OK)
    {
        std::cout << "GLEW initialisation failed!\n";
        __debugbreak();
    }

    std::cout << glGetString(GL_VERSION) << std::endl;
}

/* My callback member function */

void GLFW::MouseMovement(int x, int y)
{
    std::cout << "Mouse moved\n";
    // do other stuff...
}

/* Main.cpp */

static void MouseMovementCallback(GLFWwindow* window, double x, double y)
{
    GLFW* glfw = nullptr;
    glfw->MouseMovement(x , y);
}

int main()
{
    GLFW glfw(1200, 600);
    glfwSetCursorPosCallback(glfw.GetWindowID(), MouseMovementCallback);

    // ......
    // ......
}

In the above code my 'MouseMovement' callback function was called... so I'm rather stumped as to what the purpose of the glfwGetWindowUserPointer() and glfwSetWindowUserPointer() functions actually is.

I'm sure there is something rather obvious that I am missing here, hopefully someone can enlighten me.

Thanks in advance.

sentences:
Binary Serialization of C# for GameObject in Unity? I'm trying to serialize a GameObject (with children and textures) using the binary serialization for C#.

It works with many data types but not with GameObject. In the docs it says should be serializable (http://docs.unity3d.com/ScriptReference/SerializeField.html):

  Serializable types are:
   - All classes inheriting from UnityEngine.Object, for example GameObject ....

I've read suggestions of using the asset of UnitySerialization, but that is overkill for me, I just need to store a GameObject on my scene (that will be generated by many users) and load them all in another scene.

This is the code (I'm following this tutorial: http://www.youtube.com/watch?v=J6FfcJpbPXE&feature=player_embedded)

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class GameControl : MonoBehaviour {

    public static GameControl control;

    public GameObject drawing;
    public string drawName;

    void Awake () {
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control = this;
        }
        else if (control != this)
        {
            Destroy(gameObject);
        }
    }

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    public void Save ()
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/drawing.drawli");

        UserDraw data = new UserDraw();
        data.drawing = drawing;

        bf.Serialize(file, data);
        file.Close();
    }

    public void Load()
    {
        if (File.Exists(Application.persistentDataPath + "/drawing.draw"))
        {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(Application.persistentDataPath + "/drawing.draw", FileMode.Open);
            UserDraw data = (UserDraw)bf.Deserialize(file);
            file.Close();

            drawing = data.drawing;
        }
    }

}

[System.Serializable]
class UserDraw
{
    public GameObject drawing;
}

Check the Save/Load functions. I'm just trying to store the "drawing" (GamObject), save it and load it. That's all! Is very simple. With other data types it works. But not with GameObject.

This is the (execution) error:

SerializationException: Type UnityEngine.GameObject is not marked as Serializable.

sentences:
How to make Box2D bodies automatically return to a initial rotation I have two long Box2D bodies, that can collide while moving one of them around with MouseJoint. I want them to try to hold their position and rotation.

Blue body is moved using MouseJoint (yellow) towards the Red body. Red body has another MouseJoint - Blue can push Red, but Red will try to return to the start point thanks to the MouseJoint - this works just fine.
Both bodies correctly rotate along the middle. This is still as I want. I change the MouseJoint to move the Blue away.
What I need is both bodies return to their initial rotation (green arrows)
Desired positions and rotations

Is there anything in Box2D that could do this automatically? The MouseJoint does that nicely for position. I need it in AndEngine (Java, Android) port, but any Box2D solution is fine.

EDIT: By automatically I mean having something I can add to the object "Paddle" without the need to change game loop. I want to encapsulate this functionality to the object itself. I already have an object Paddle that has its own UpdateHandler which is being called from the game loop. What would be much nicer is to attach some kind of "spring" joint to both left and right sides of the paddle that would automatically level the paddle. I will be exploring this option soon.

sentences:
How to create simple physics for a group of balloons colliding in the screen (2D) The game is 2D, how can I make simple physics for a group of balloons colliding in the screen.

What I need is the balloons not to overlap and to bounce when they reach the limits of the screen or other balloons.

Should I use something like box2d or is there a simple algorithm to do something like this?

sentences:
Best peer-to-peer game architecture Consider a setup where game clients:

have quite small computing resources (mobile devices, smartphones)
are all connected to a common router (LAN, hotspot etc)

The users want to play a multiplayer game, without an external server.

One solution is to host an authoritative server on one phone, which in this case would be also a client. Considering point 1 this solution is not acceptable, since the phone's computing resources are not sufficient.

So, I want to design a peer-to-peer architecture that will distribute the game's simulation load among the clients. Because of point 2 the system needn't be complex with regards to optimization; the latency will be very low. Each client can be an authoritative source of data about himself and his immediate environment (for example bullets.)

What would be the best approach to designing such an architecture? Are there any known examples of such a LAN-level peer-to-peer protocol?

Notes:

Some of the problems are addressed here, but the concepts listed there are too high-level for me.

Security

I know that not having one authoritative server is a security issue, but it is not relevant in this case as I'm willing to trust the clients.

Edit:

I forgot to mention: it will be a rather fast-paced game (a shooter).

Also, I have already read about networking architectures at Gaffer on Games.

sentences:
most efficient AABB vs Ray collision algorithms Is there a known 'most efficient' algorithm for AABB vs Ray collision detection?

I recently stumbled accross Arvo's AABB vs Sphere collision algorithm, and I am wondering if there is a similarly noteworthy algorithm for this.

One must have condition for this algorithm is that I need to have the option of querying the result for the distance from the ray's origin to the point of collision. having said this, if there is another, faster algorithm which does not return distance, then in addition to posting one that does, also posting that algorithm would be very helpful indeed.

Please also state what the function's return argument is, and how you use it to return distance or a 'no-collision' case. For example, does it have an out parameter for the distance as well as a bool return value? or does it simply return a float with the distance, vs a value of -1 for no collision?

(For those that don't know: AABB = Axis Aligned Bounding Box)

sentences:
How to set X and Z axis to 0 after transform.rotation in c# Recently I start using C# instead of JAVA and I don't know how to set a value in a eulerangle only for one axis.

Maybe I don't need to do that, so better I explain what I'm doing:

I have a 3D object (player) that look at mouse pointer, but when the mouse pointer it's too close to the object, it's change his x and z axis, and I need to set it to 0 to keep standing the object.

In java I just write this after transform.rotation:

transform.eulerAngles.x = 0;
transform.eulerAngles.z = 0;

In C# I can't do that. Is there a simple way to do it? My code is:

Ray ray = Camera.main.GetComponent<Camera>().ScreenPointToRay (Input.mousePosition);
RaycastHit hit_A;
if (Physics.Raycast (ray, out hit_A, Mathf.Infinity, GroundMask)){
    Vector3 rotPoint = new Vector3 (hit_A.point.x - transform.position.x, transform.position.y, hit_A.point.z - transform.position.z);
    transform.rotation = Quaternion.LookRotation(rotPoint);
}

Maybe, as I said, there are an other way to fix this. I'm open to any solution. I searh it on google, but because at my english level I don't understand the results

Thanks you all.

sentences:
Unity augmented reality app doesn't work on android I am pretty new to unity and augmented reality applications. I use unity 2019.4.4f1 and my project is very simple as you can see in the screenshot below:

I am using Wikitude plugin for image tracking and the image i am using as the marker is the Jack of Clubs card as you can see in the assets. The project works fine when i press play and use my laptop's webcam , but when i build the project for android (unity 2019 automatically uses Gradle to build the project) and install the .apk file in my android phone, all i see on my phone screen when i open the application is:

As you can see the phone camera doesn't work and it gets stuck in this screen. How should i fix it? Does it have to do something with Gradle? I haven't tried using unity version 2018 to build it using the "Internal" build option. Anyways that's just my own thought and i might be wrong, but the final question remains which is how this problem can be fixed?
By the way i don't build the .apk file directly from the unity engine. I use the export option in unity to get a gradle project folder then i use that in Android Studio to build the final .apk file. The reason that i don't use unity to build .apk is that it gives errors and doesn't work for me so this is the solution i found for it.
Update: I debugged the application and it seems that the application needs camera permission to work, this is my debugging log:
07-22 17:47:16.908: E/Unity(32483): On Camera Error
07-22 17:47:16.908: E/Unity(32483):         Error Code: 1000
07-22 17:47:16.908: E/Unity(32483):         Error Domain: com.wikitude.camera.android
07-22 17:47:16.908: E/Unity(32483):         Error Message: Permission denied. Make sure to have camera permissions before trying to access the camera.
07-22 17:47:16.908: E/Unity(32483):
07-22 17:47:16.908: E/Unity(32483): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

I'm pretty sure that it didn't ask for camera permission, how should i allow the permission if it's not asking?

sentences:
How can I calculate the future position of my moving object? I'm relatively new to games development and I have a 2D game where the playing area is an enclosed rectangle with width w and infinite height. In the playing area there is a ball. A gravity force of strength G acts on the ball. The ball starts at position p and has an initial velocity of v.

How would I calculate the position the ball will be at when it reaches the specified height h. I have a function setup using the following parameters:

bool CalculateXPositionAtHeight(float height, Vector2 position, Vector2 velocity, float Gravity, float width, float& xPosition);

The playing area doesn’t have any boundary at the top, so no
collision ever happens with it.
The ball can be considered as a point.
There are no precision issues and everything can easily fit in a float.
There is no air resistance.
All collisions are perfect without any energy loss.
If the ball hits the bottom it won’t bounce.

sentences:
Animating sprites at different speed than what the game runs at I am building a Javascript/canvas platformer game, and it's coming along nicely. The only problem I've really run into where I can think of any solution at all is the animation of my player sprite.

The game loop is running every 16ms, which equates to 60fps. On every game loop, I'm using a method of my player class (called draw) to draw the player sprite. The sprite looks like this: http://i.imgur.com/uM3Un.png

On every call of the draw method, I am advancing the "frame" of the player sprite, to give the illusion that the player is moving. As far as I know, this is common practice. However, due to my draw method being run every 16ms with the game loop, my player sprite is animating extremely quickly, and it doesn't look realistic at all.

Is there a way to slow this down to a pre-defined speed, or will I have to resort to adding loads of duplicate frames to my player sprite? Obviously that's not a great solution, as to make it look realistic at a game speed of 60fps I'd need to have a LOT of frames.

Here's my relevant code:

// Sets off the main game loop
setInterval("gameLoop()", gameSpeed);

function gameLoop() {
    // Updates
    player.update();

    // Draw
    c.clearRect(0, 0, canvas.width, canvas.height);
    player.draw();
}

// Then in my player class...

this.draw = function() {
        if(this.state == "idle") {
            c.drawImage(this.idleSprite, this.idleSprite.frameWidth * this.idleSprite.frameCount, 0, this.idleSprite.frameWidth, this.idleSprite.frameHeight, this.xpos, this.ypos, this.idleSprite.frameWidth, this.idleSprite.frameHeight);
            if(this.idleSprite.frameCount < this.idleSprite.frames - 1) { this.idleSprite.frameCount++; } else { this.idleSprite.frameCount = 0; }
        } else if(this.state == "running") {
            var height = 0;
            if(this.facing == "left") { height = 37; }
            c.drawImage(this.runningSprite, this.runningSprite.frameWidth * this.runningSprite.frameCount, height, this.runningSprite.frameWidth, this.runningSprite.frameHeight, this.xpos, this.ypos, this.runningSprite.frameWidth, this.runningSprite.frameHeight);
            if(this.runningSprite.frameCount < this.runningSprite.frames - 1) { this.runningSprite.frameCount++; } else { this.runningSprite.frameCount = 0; }
        }
    }

sentences:
How to apply a visual filter to what I am drawing? I'm looking to apply a sepia filter to what I'm rendering. Perhaps we could just apply the filter to the view or pass it to the draw method to draw everything with the filter (I'm using one draw method, everything that is visible gets drawn by one draw system).

Would I use a shader for this? I honestly don't know how to implement shaders or how to learn.

I'm using sfml.

How would you apply other filters, not just sepia? For example greyscale, moonlight (I would love this one), or the other filter styles you commonly see on the photo editing section of your (i)phone?

I've done some research into it and didn't really find anything useful. However, I assume you use shaders - but I don't really know how to program a shader, so I'll have to learn that if that's the case.

Thanks :)

sentences:
Unity 2D: Why does my character stutter if I add deltaTime to moveSpeed? So I'm following a tutorial on youtube, first time Unity user, but been making games in other frameweorks before. In the tutorial he does not use deltaTime for movement, which has always been the standard for me, so I added it my self, but it makes my character "stutter/lag" really weirdly (does not stutter without deltaTime). Surely I must use deltaTime for movement in the Update()method?

Script for Player movement:

void Update () {

     playerMoving = false;

     if (!playerAttacking) {
         Vector2 direction = new Vector2();

         if (Mathf.Abs (Input.GetAxisRaw ("Horizontal")) > 0.5f) {
             Debug.Log ("Moving on X");
             playerMoving = true;
             direction.x = Input.GetAxisRaw ("Horizontal");
             lastMove.x = direction.x;
             lastMove.y = 0;
         }

         if (Mathf.Abs (Input.GetAxisRaw ("Vertical")) > 0.5f) {
             Debug.Log ("Moving on Y");
             playerMoving = true;
             direction.y = Input.GetAxisRaw ("Vertical");
             lastMove.y = direction.y;
             lastMove.x = 0;
         }

             if (playerMoving) {
                 myRigidBody.velocity = direction.normalized * moveSpeed * Time.deltaTime;
             } else {
                 myRigidBody.velocity = Vector2.zero;
             }
     }

My Camera (Stutters unless I use fixedUpdate):

void FixedUpdate () {
    targetPos = new Vector3 (followTarget.transform.position.x, followTarget.transform.position.y, transform.position.z);
    transform.position = Vector3.Lerp (transform.position, targetPos, moveSpeed);
}

sentences:
Detecting image curve to move a truck on this surface I have an image background in surface view

I want to move something according to black surface.But i can not do this using height of this image as it return same height.and one more thing bitmap.getPixel is also not working.and my background is moving.So what is the way to achieve this feat

sentences:
Unity: Failed to build APK. See console for details i am getting this error whenever i am trying to build a project. i looked at so many solutions but this one just doesn't go away.

This is the error:

CommandInvokationFailure: Failed to build apk.
C:\Program Files\Java\jdk-9\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Mohit/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at SDKMain.main(SDKMain.java:130)
Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
    at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)
    at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
    at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
    at UnityApkBuilder.<init>(UnityApkBuilder.java:214)
    at UnityApkBuilder.main(UnityApkBuilder.java:34)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 11 more
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

what i have tried so far:

1) downgrading android sdk
2) moving zipalign file from build-tools to tools folder
3) setting up keystore

sentences:
How can i achieve an outline effect? I have a small shader that does the following things:

(First cgprogram block)

Copy the current mesh and scales it along the normals
Assign a color to the inflated mesh
Draw the inflated mesh

(Second cgprogram block)

Assign a color to the original mesh
Draw the original mesh

In-game you can only see the inflated mesh because the smaller one gets inglobated.

Is there a way to re-order the rendering order, by drawing first the inflated mesh and then the original mesh, resulting in a sort of outline effect?

What I tried

Setting Cull Front on the inflated mesh and Cull Back on the original mesh

I copied this approach from an outline shader. Unfortunately it leads to other problems such as bad intersecting between inflated mesh in-game.
Changing the Queue in the shader between the two CGPROGRAM blocks

I set the first CGPROGRAM block on "Queue" = "Geometry-10" and the second on "Queue" = "Geometry+0" but.. no effect.

Is there a way to obtain the desired effect? Thanks in advance.

Here are some images to make the question a bit clearer:

Current wireframe situation

Original mesh inside, inflated mesh outside

Current shaded situation

Desired outcome

Inflated mesh set on Cull Front

This is the aforementioned problems between intersecting meshes. The inflated meshes have z-fighting going on.

sentences:
How does a 4x4 matrix represent an object in space and matrix lore? I have been following some tutorials on how Matrix maths works, with adding, dividing, scaling, etc, but I am struggling to understand how the 4x4 matrix represents an object's position in space.

There are 16 elements in the array but to my knowledge you only need to use 7 of them? (I am most likely, horribly wrong but please correct me) and they are:

x, y, z
scale
pitch, roll and yaw.

Furthermore, what is the significance of a column major matrix over a row major one or vice versa? Is it just down to the framework you are using that determines which one you use? (i.e OpenGL or DirectX) What is the difference between them? Is it just the order the elements appear in?

sentences: Move body to mouse click and stop I'm trying to have a body move to the player touch and stop once he reaches the destination. I have the player boxed in to prevent him to move out of bounds, I can somewhat do that with translate but with collision, it doesn't work properly, is there a better solution for this?

sentences:
Move relative to screen I use top down 60 degree tilted camera and want move always visually straight directions relative to screen (up, down, left, right). When object is near screen edges it starts moving diagonally (visually) probably because of camera tilt.

I tried with WorldToViewportPoint / ViewportPointToRay but it doesnt work exactly because even when there is no input, conversion to viewport and back to world same value sometimes gives slighltly offset from start position.

float delta = Time.deltaTime;

float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");

Vector3 view = MainCamera.WorldToViewportPoint(transform.position);

view.x = (h > 0) ? 1 : (h < 0) ? 0 : view.x;
view.y = (v > 0) ? 1 : (v < 0) ? 0 : view.y;

Ray ray = MainCamera.ViewportPointToRay(view);

RaycastHit hit;

Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 15); // 15 - ground plane layer

Vector3 world = new Vector3(hit.point.x, transform.position.y, hit.point.z);

Vector3 dir = (world - transform.position).normalized;

transform.position += dir * Speed * delta;

sentences: How to intentionally make an RPG maker game crash? I'm currently working on a game project that involves tricking the user into thinking the game experienced a bug/glitch and crashed. The reason that I want to code this is that I want to hide the file size of the main game, thus separating it into two files. So I want the first file which has x amount of game to crash at a certain point. Then manually give the second half of the game to the user and they can continue on. It may seem a little pointless, but I think stylistically this is a neat concept to try.

sentences:
Maximum range of projectile fired at given force and elevation I've gone over this again and again, and my result is obviously wrong when viewed in-action. Here's the initial formula I converted (first one):

http://en.wikipedia.org/wiki/Range_of_a_projectile

and here's my C# code:

float CalculateMaximumRange() {
    float g = Physics.gravity.y;
    float y = origin.position.y;
    float v = projectileSpeed;
    float a = 45;

    float vSin = v * Mathf.Sin(a);
    float vCos = v * Mathf.Cos(a);

    float sqrt = Mathf.Sqrt(vSin * vSin + 2 * g * y);

    return Mathf.Abs((vCos / g) * (vSin + sqrt));
}

Does anyone see what I did wrong?

sentences:
How unity works on Web How Unity can work on Web if the code is written in C#? I understand that you can compile the C# code to a shared library and use it in Java (for Android) in ObjectiveC (for iOS) to enable Unity on multiple platforms, but you cant use shared library on JS. Does Unity do language to language translation from C# to JS to enable Unity on Web?

As I understand now starting from Unity 5.0 it even doesn't use Unity Web Player.

sentences:
How does an energy-conservative Blinn-Phong-Fresnel model work? What is a plausible, basic equation/pseudo-code for energy-conservative Blinn-Phong shading, including Fresnel with a coloured light-source?

The net gives so many alternatives that it's hard to figure out which I should use.

sentences:
Overriden Event does not execute on Unreal I've been learning Unreal Engine through this tutorial and I am having an issue with overriding an event I created on C++ using blueprints.
So here is what I've done:

I created a class called ABasePlayer that inherits from APawn. And I am trying to make this jump.

On the unreal project settings > Engine > Input, I created an Action Mapping called "Jump" and set it to the space bar.

On the ABasePlayer, I created a function called Jump, like this:
UFUNCTION(BlueprintImplementableEvent)
void Jump();

I also created a jump impulse property, looks like this:
UPROPERTY(EditAnywhere, BlueprintReadWRITE)
float JumpImpulse;

In the SetupPlayerInputComponent function, I added the next line :
InputComponent->BindAction("Jump", IE_Pressed, this, &ABasePlayer::Jump);

Then I went to the blueprint editor of my main player, and override the function:

I then created the next blueprint to add Jump to my player:

I then added the jump impulse :

-After building and compiling, I ran the scene but nothing happened. When I press space nothing happens.
So what I did next was to try to implement jump by code instead, just to see if I can see what is going wrong with my blueprint. I went to C++, and implemented the Jump function in this way:
void ABasePlayer::Jump() {

    FVector ForceToAdd = FVector(0, 0, 1) * JumpImpulse ;
    Mesh->AddForce(ForceToAdd);

    GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Jump!"));

}

Curiously enough, whenever I press space I see the "Jump" message, but there is no jumping.
My question would be, did I did something wrong? Did I oversee something in these steps that does not allow my character to jump?
Thanks in advance!

sentences:
Problem with a TinyOBJLoader Renderer I was working on implementing a renderer for SYOYO's tiny obj loader and when it came to testing time, it failed to render. Here is an image of the result:

I believe that i have made the error with my renderer, in which i have no idea of what is wrong.

Here is the code for the renderer:

void flushTerrain() {
            while (!pr_Models.empty()) {
                const Model3D* model = pr_Models.front();

                model->getVAO()->bind();

                glm::mat4 a;
                glm::translate(a, glm::vec3(model->getPosition()));

                model->getShader().setUniformMat4("ml_matrix", a);
                glDrawArrays(GL_TRIANGLES, 0, model->getShapeVerticies().size());

                model->getVAO()->unbind();

                pr_Models.pop_front();
            }
        }

and the code for the Model3D Constructor:

Model3D(std::vector<tinyobj::shape_t> shapes, std::vector<tinyobj::material_t> materials ,glm::vec3 position, Shader& shader) :
            pr_shapes(shapes), pr_materials(materials), pr_position(position), pr_shader(shader)
        {
            pr_VAO = new VertexArray();
            for (tinyobj::shape_t shape : pr_shapes) {
                pr_VAO->addBuffer(new Buffer(shape.mesh.positions, shape.mesh.positions.size(), 3), 1);

                pr_VAO->addBuffer(new Buffer(shape.mesh.texcoords, shape.mesh.texcoords.size(), 2), 2);
                pr_VAO->addBuffer(new Buffer(shape.mesh.normals, shape.mesh.normals.size(), 3), 3);
            }
        }

and finally, for the Buffer and VertexArray class:

Buffer::Buffer(tinyobj::shape_t data, GLsizei count, GLuint componentCount) {
        glGenBuffers(1, &pr_BufferID);
        glBindBuffer(GL_ARRAY_BUFFER, pr_BufferID);
        glBufferData(GL_ARRAY_BUFFER, count * sizeof(tinyobj::shape_t), &data, GL_STATIC_DRAW);
        glBindBuffer(GL_ARRAY_BUFFER, 0);
    }

void VertexArray::addBuffer(Buffer* buffer, GLuint index) {
        bind();
        buffer->bind();

        glEnableVertexAttribArray(index);
        glVertexAttribPointer(index, buffer->getCount(), GL_FLOAT, GL_FALSE, 0, 0);

        buffer->unbind();
        unbind();
    }

sentences:
Getting neighbors of hex tiles in 3D space I have a hex tiled model like attached below. Each of the hex tiles are separate objects meaning I can access each of the hex tiles individually inside Unity

Now in my program I want to be able to get the 6 neighboring tiles of the selected tile. At first I thought I would get the 6 edges of the current tile and then check to see if any of the remaining tiles have those edges in common but that would be very expensive if I want to compute neighbors of all the tiles.

Any ideas??

sentences:
How can I get my game to show up in the Games Explorer on Windows? I want to create an installer for a game which allows for an icon to be put in the Games Explorer for Vista and Windows 7.

I have created the GDF, then built the script for project and obtained the .h, .gdf and .rc files. But I can't compile (using Visual Studio 2010) the .rc file into an executable to be used after that in order to create the installer. I get the following error after I set the executable path:

  "Could not load file or assembly'Microsoft.VisualStudio.HpcDebugger.Impl, Version 10.0.0.0, Culture=neutral, PublickKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

Any ideas what I'm doing wrong?

sentences:
Can I use remade sprites in my game? Possible Duplicate:
  How closely can a game resemble another game without legal problems

Can I use remade sprites in my game?

I am making a game and I used some sprites, but I didn't copy them. I remade them completely the character looks nothing like the original. I only did this to get the movement of the character right (moving, running, jumping, punching). I've been working on the game for a long time, so I really need to know is it safe and legal to do this. I do intend making a small profit.

sentences:
What are the typical day-to-day tasks of a games writer? I am interested in plot writing for games, and wondered first of all:

Is this available as an entry-level position, or is it accessed through other avenues (even external to games development)

And secondly, what are the daily tasks of a games writer, both at the entry level and at a higher level?

Thank you.

sentences:
Conversion of a number from Single precision floating point representation to a Half precision floating point Hope it is relevant here.

I have a code where I have to work on Half precision floating point representation
numbers. To achieve that I have created my own C++ class fp16 with all operators(arithmetic logical, relational) related to this type overloaded with my custom functions, while using a Single precision floating point number with a Half precision floating point number.

Half precision floating point = 1 Sign bit , 5 exponent bits , 10 significand bits = 16 bit

Single precision floating point = 1 Sign bit, 8 exponent bits, 23 significand bits = 32 bits

So what I do to convert from a Single precision floating point number to a Half precision floating point number:-

For significand bits - I use truncation i.e. loose 13 bits from the 32 bits to get 10 bits significand for half precision float.

What should I do to handle the exponent bits. How do I go from 8 exponent bits to 5 exponent bits?

Any good reading material would help.

sentences:
Algorithm for spacing points out among a line I'm writing an angled tile system, and my implementation is to have a starting height and an ending height inside the tile.

Like so:

The starting and ending height allow me to get the length of the angle and the angle in degrees using atan2.

For collision against the angled tiles I give the tiles a collection of points along the line, and as a bounding box intersects any of a tile's slope points it will move the box's y position to that point.

This implementation works fine for 45 degree tiles, however with other degrees I don't know how to create the points on the line.

What algorithm could I use to space the points out along the line when they are not in a perfect 1 to 1 ratio angle? (e.g. 17 degrees instead of a nice 45 degrees)

EDIT: Here's a way to interpret my question perhaps more academically:

Given a length of a line and its angle, and an arbitrary number of points, find an algorithm that will space the points out among the line that will as closely resemble the angle.

sentences:
Rendering lighting only on specific objects I have done something similar to this in monogame:

My question is, what would I have to do to draw that lighting effect only on the pillar and not the background ? Is there something like ignoring certain sprites when using BlendState.Additive ? How would that work ? Here is how i'm drawing it now.

//draw background
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
spriteBatch.Draw(Background, Vector2.Zero, Color.White);
spriteBatch.End();

//draw pillar
spriteBatch.Begin(SpriteSortMode.Deferred);
spriteBatch.Draw(Texture, new Rectangle(PillarX, PillarY, Width, Height), Color.White);
spriteBatch.End();

//draw lighting sprite in additive mode
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
spriteBatch.Draw(LightTexture, pos, null, Color.OrangeRed, 0f, Vector2.Zero,
    scale, SpriteEffects.None, 0f);
spriteBatch.End();

Edit: Also, apart from the pillar I have as an example, I need to do that for 3D models as well, so would the Stencil Buffer work here ?

sentences:
How to call a method from another c# script using invoke? I want to call a method from another script in my script using Invoke(),but unable to run it.How can i achieve this ?

Following is my code -

void Start () {

    int randNum;
    randNum = Random.Range(0,2);

    Debug.Log("random number == " + randNum);

    if(randNum == 0)
        Invoke("PositionScript.instance.MAttack",5f);

    if(randNum == 1)
        Invoke("PositionScript.instance.SAttack",5f);

}

sentences: Getting angle from current position and next position I am using pathfinding to move a train along rails, but I need the train to rotate. I have the next intended position and the current position at my disposal, how would I go about this? Pseudocode will do as an answer since I am using a specialized programming language for the engine that I use.

sentences:
I want to delay 3 sec to load next level after the collision in C# I need to delay the load new level by a few second. Please help.This is the script I need to use:

void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Enemy")
    {
         score = score + 50;
         Destroy (gameObject);
         /*Here I need to wait for 3 sec then it should load the next level*/
         SceneManager.LoadScene(nextLevel);
    }
}

I have tried this code but this doesn't update my score and don't wait and don't even load the next level:

void OnCollisionEnter2D(Collision2D col)
{
    Debug.Log ("Collision");
    if (col.gameObject.tag == "Enemy")
    {
        score = score + 50;
        Destroy (gameObject);
        StartCoroutine (WaitForIt (3.0F));
    }
}

IEnumerator WaitForIt(float waitTime)
{
    yield return new WaitForSeconds(waitTime);
    SceneManager.LoadScene(nextLevel);
}

sentences:
How can i convert a non-convex mesh collider object to a convex mesh collider object I created a character object in Maya and stored it as char.obj, then I imported the object into Unity.

The character object is not colliding with any other Unity objects like cube, plane, sphere, etc.

Then I found non-convex mesh colliders do not collide with any other Unity default objects. How can I convert the non-convex mesh collider to a convex mesh collider?

Here is the error message I see:

  Non-convex MeshCollider with non-kinematic Rigidbody is no longer
  supported in Unity 5. If you want to use a non-convex mesh either make
  the Rigidbody kinematic or remove the Rigidbody component. Scene
  hierarchy path "mesh_octopus/Default", Mesh asset path
  "Assets/PlaceAsset/mesh_octopus/mesh_octopus.obj" Mesh name "Default"

sentences:
How to maximize enclosed area and minimize perimeter on a grid with obstacles? Developing an RTS game, I have a tile-based terrain (grid) filled with obstacles. It looks like this (red shapes are obstacles):

Now I need to plan an enclosed area on the terrain with some restrictions:

tile marked with a "star" must be included (it is a seed)
area needs to be at least 20 tiles (for this example)
farthest area tile from the seed needs to be no more than 7 steps away (for this example)
area needs to traversable by moving in 4 directions
area should be bound by existing obstacles and by new fences
new fences building takes time and resources, it is beneficial to use existing obstacles as much as possible and have the smallest number of fences placed.
there are cases where terrain could be free of any obstacles, or contrary to that - be a maze-like labyrinth)
it is okay to fail (e.g. there's not enough walkable tiles around the seed), or the area/fences ratio is too low.
processing is done on CPU (if that matters)

So, here are some "manual" attempts at outlining an area of required size using the least fences:

As you can see, there are 3 enclosed areas (green, blue, orange) with very similar perimeters, yet different areas. Best one in this case would be "green" one - it has the least fences added (just 10) and has the sufficient area (21).
What is the algorithm to allow to plan area of given size (~20) while minimizing the amount of additional fences required?

So far I have tried to take the larger area and try to clip it - using BFS to get the area within possible reach (7 steps), clipped the last step (since it is touching the unexplored and has no neighbor info) and clipped the obvious protruding buds - leaves plenty of tiles to work with. I'm out of good ideas on how to improve from that:

yellow tile is the seed
red tiles are walkable (saturation shows distance from the seed)
dark grey tiles are obstacles
light grey tiles are obstacles that also need fences
purple tiles got clipped by existing incomplete algo
black tiles are unexplored
yellow dashes are required fences

As you can see, it looks quite sub-optimal, but I'm at loss as to how to proceed.

sentences:
How to make a character jump in SFML? How could I made a character jump with SFML in C++, a simple example could be very helpful.

Thanks in advance.

This is the code I currently have; how can I make the sprite jump?

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace sf;

int main(){
    sf::RenderWindow ventana(sf::VideoMode(800,600),"mi ventana");
    ventana.setFramerateLimit(60);
    sf::Texture Image;
    Image.loadFromFile("tortuga.png");
    sf::Sprite sprite(Image);
    sprite.setPosition(-230,100);
    bool isPlay=true;
    bool presionarW(false);
    bool presionarA(false);
    bool presionarS(false);
    bool presionarD(false);
    //Controlar cualquier evento
    int x=30;
    int y=3;
    sf::Event miEvento;
    sf::CircleShape figura(10);
    while (isPlay)

    {
        //Eventos

        while(ventana.pollEvent(miEvento)){
            if (miEvento.type==sf::Event::Closed){
                isPlay=false;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::W){
                presionarW=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::A){
                presionarA=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::S){
                presionarS=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::D){
                presionarD=true;
            }

        }

        //Logica del juego
        if(presionarW){
            sprite.move(10,-20);
            presionarW=false;
        }
        if(presionarA){
            sprite.move(-20,5);
            presionarA=false;
        }
        if(presionarS){
            sprite.move(0,25);
            presionarS=false;
        }
        if(presionarD){
            sprite.move(25,0);
            presionarD=false;
        }

        //Renderizado
        ventana.clear();
        ventana.draw(sprite);
        ventana.display();
    }
    ventana.close();
}

sentences:
I need my timer to go up every 30 seconds I wrote code for a jackpot to increase from one date to the next, and it works beautifully. The client wants the numbers to stay put for a while, and then increase.

This is the code:

if (timerRunning1)
{
    timerValue1 += Time.deltaTime * 14.4 * (timerValue1F - timerValue1)
                / (finish1 - start).TotalSeconds;

    Jack1.text = timerValue1.ToString ("F2");

    //PlayerPrefs.SetFloat ("Jackpot1", float.Parse(Jackpot1.text));
    //PlayerPrefs.SetFloat ("Jackpot1f", float.Parse(Jackpot1F.text));

    if (timerValue1 > (timerValue1F - 0.1))
    {
        timerRunning1 = false;
        print ("ALTO");

        PagPrincipal.SetActive (false);
        Victoria.SetActive (true);

        Debug.Log ("FUNCIONA!!!");

        Invoke ("apagavictoria", 10f);

    }
}

I tried WaitForSeconds(30f), and it didn't work. How can I make my timer go up every 30 seconds?

sentences:
How can I stop the player from drifting due to local input prediction when they stop? I'm working on a 2D server-client multiplayer game engine (which you can try here). It uses WebRTC DataChannels. (The connections are peer-to-peer, but the host peer still acts as a server.)

The biggest problem (apart from connectivity) is the local input prediction. We do the usual: On key press, players move instantly, tell the host what keys are pressed, receive data back from the host and compare it to the historical position. The position is corrected over time if there is a difference. This works well with low packet loss or PDV, even if the ping is high.

If there is loss or PDV, the deviation can be larger. I think this is because if the first packet indicating a change of input is delayed or dropped, the host finds out later, and starts changing that player later than their local input prediciton shows.

If the player is moving, we crank up the amount of applied correction, since it's less noticable. This seems to cover up gaps when starting to move and while moving. However, any correction is more noticable if they come to an abrupt stop. Then if the PDV or loss means the host thinks they stopped later, the host overshoots, sends back data saying they're a bit further ahead, and the correction makes the player drift a little. On flaky connections, players often noticably drift after coming to a stop.

I've not noticed this in other games. How can this be mitigated?

sentences:
How to create custom gravity in unreal engine and only affect specific actors? I am fairly new to unreal engine and I would like to know how to set custom gravity in a specific point or area instead of down. For example I do not want the gravity pull to be down but more to the center of my level (center plane not center point) and that gravity to only affect specific actors. Other actors will be affected by normal gravity or affected by no gravity at all.

How can I do this? (blueprints or c++)

sentences:
Generating a set of islands in real time With thismethod I can create multiple separated islands just by randomly choosing a point as the center for a gradient. Now what I want to do is to have a system of real time generation like the one in Minecraft.

When I generate a new chuck, some random points inside of it are chosen to be the center of a gradient. However, if one of these points gets positioned near the border of the chuck, the gradient will cross the border and affect the other chunk. But if that other chunk was already generated and visited by the player, I couldn't update that chunk to include the new gradient, so I would end up with something that looks like this:

What could be a method to avoid this?

sentences:
Finite-state machine with more than one concurrent state I am using a FSM for the player entity and it is working fine. Currently the entity has one state and only one (e.g. paralyzed). The entity's state process() method is called every turn.

It is necessary however, that each entity can have more than one state simultaneously (e.g. paralyzed and blinded). Each state affects the entity attributes e.g. paralyzed reduces the walking range to 10% and blindness reduces it to 50%. Vision range is not affected by paralyzed state, but by blindness (set to 0).

Now it is important in which order the states are processed. I either end up with a wrong walking range or a wrong vision range. I could do checks in every state's process() whether the entity has any other states and alter the code accordingly, but this gets very messy the more states I add.

Currently I think it's a better choice to attach only one state to the entity, but to create more states, some of them a combination of two states (e.g. a blindedAndParalyzed). This way I'll and up with a lot more states than I currently calculated with, because ever state has to be combined with other states. I'm wondering if that is the best solution?

A state is a Singleton with an enter, process and exit method. Process is called each turn.
Currently process() for paralyzed looks like this:

public void process(){
   walkRange = 10% * walkRangeBase;
   visionRange = visionRangeBase;
}

and process() for blinded looks like this

public void process(){
   walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

At the moment the result is always fine becvause only the process() method of only one state is executed. If I switch to multiple states both get executed and the result is either walkRange = 50% and visionRange = 0 or walkRange = 10%. THe desired result would be a walkRange of 10% and a visionRange of 0, because the walkRange should be limited to the smallest one.
I could do something like that:

public void process(){
   if(state != paralyzed)
      walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

But i have around 20 different states, so I have to create a lot of if cases. Choosing the smallest value for e.g. walkRange doesn't work either because there are some states with positive effect on walkRange.
So I am wondering if it is better to avoid a state machine with more than one concurrent state and live with a bigger amount of states (about 50), or if there si another solution to this problem.

sentences:
How do I pick tiles from an isometric map with slopes? I'm looking for a way to convert mouse/screen coordinates to isometric map coordinates, with the addition that the world has slopes and cliffs, and I have to be able to tell which quadrant of the tile is being pointed at by the mouse. The textures are handled by OpenGL, so I can't (easily) pick directly based on the tile sprite.

I've found several similar solutions, (e.g. Isometric Tiles Math, XNA Resources & Mouse Maps for Isometric Height Maps with the latter looking most promising) but none of them seem to quite fit my requirements.

My tiles look like this:

What algorithm or technique could I use here?

sentences:
How to prevent top down sprite snapping during diagonal movement upon keyboard release I have a sprite that faces 4 directions depending on input. This is all working well except for my keyboard input..

If I am pressing down-right at the same time on the keyboard and release both keys there is a moment where I am pressing only the right key. This creates a snapping of my sprite upon key release where now im suddenly facing right instead of down.

basically i would like to release both the x and y buttons at the same time but i dont have a good way of detecting this. its TOO sensitive.

    pressed_vector.x = int(directions.right) - int(directions.left)
    pressed_vector.y = int(directions.down) - int(directions.up)

    dpad_vector = pressed_vector.normalized()
    owner.direction_changed(dpad_vector)

its the standard input code you see everywhere.

I have the player mapped to a virtual joystick, dpad etc and i dont have this issue because on release you're going to be releasing your x and y keys at the same time. not sure how to handle this with the keyboard.

sentences:
Why are my brushes see-through in Hammer/CS:GO? I'm making a map for Counter Strike: Global Offensive, but I am having this issue with a part of the map. One of my brushes is weird and see-through in game.
I have no clue what is causing it or how I can fix it. Does anyone know what's going on, and how I could fix it?

sentences:
How can I maintain a rectangular formation when units are added or removed? I've got bots in a rectangular formation with rows and columns. A problem arises when a bot is added or removed from the formation. When this happens, the bots have to rearrange themselves so that the rectangular formation is still roughly the same aspect ratio, and is as rectangular as possible. How to do this?

Some ideas:

When a bot is added or removed, use the new total number of bots and a
desired constant aspect ratio to calculate the new width and height
of the formation that most closely fits that aspect ratio. Then
somehow reshuffle the bots to fit the new dimensions.
When a bot is removed, move the bot that was behind it into it's
place, and continue until you reach the end of the formation. Then
even out the back rank as much as possible by somehow shuffling the bots in
the back rank.
Another idea that's completely different is to mimic the way molecule structures stay together. Make every bot want to be surrounded by four other bots by attracting the four closest bots, and repelling the rest. Repel all bots (including the four) that are too close to ensure separation using inverse square law. You'd also need an additional force to shape of the entire structure. But, this sounds very computationally expensive.

UPDATE: So looking into sarahm's answer, I came up with a good general function that gives good dimensions.

First I solved the below simultaneous equation for width and height, and then rounded the answers.

width/height=aspect ratio of your choice
width*height=number of bots

This gives you the closest integer rectangle to that aspect ratio for your number of bots. The closest rectangle will half the time be a too large, and half the time be a too small (of course sometimes it will be just right but who cares about those). In the cases where the rectangle is a little too large, nothing needs to be done. The back rank will just end up being almost full, which is ideal. In the cases where the rectangle is a little too small, you got problems because that teeny tiny overflow will have to go to its own rank created a rank with only a few bots on it, which doesn't look pretty.  There are also cases where the difference is large (larger than half the width), in which case add or subtract one rank to make the difference small. Then, when the rectangle is too small, add one column to make it just a little bit larger. After doing that it looks like the back rank will always have at least half as many bots as the other ranks.

UPDATE

Once you got the dimensions, compare them to the current dimensions. If the frontage of the new dimension is bigger, for every rank, pop bots from the rank below, and push them onto the current rank until that the number of bots on that rank is equal to the frontage. Continue that algorithm until you get to the back rank. Using this algorithm, bots will move to fit into the new dimension efficiently. After that, I simply push the new old onto the back rank. The algorithm is slightly different for the cases where the new frontage is smaller, but you can figure it out!

There's two more problems next. Deletion, and a more flexible addition method where new bots are not necessarily assigned to the back rank but whichever position is closest to them at the moment they are added.

sentences:
very simple math destination and speed calculation My player goes to (destinationX, destinationY)

His position is: (x,y)

and the player has an update event

function update() {
 this.x = this.x + dx;
 this.y = this.y + dy;
}

what is the formula for dx and dy ?

dx = (destinationX-this.player.x)/this.speed;
dz = (destinationZ-this.player.z)/this.speed;

is "almost" good: it goes to the good direction, but problem is his speed.
It takes the same time to go from (0,0) to (10,10) than from (0,0) to (1000,1000)

sentences:
A* pathfinding algorithm to identify entrances into current "room"? Was looking for some online articles that might have a good idea or two in how to approach this but not finding much. Most of it deals with the various ways to generate and follow a path to a known destination type.

Basically the idea is that you have an existing node graph and want to utilize that data in order to locate entrances into the current area an AI unit would want to defend. So think of an AI unit assigned a task of defending a point with a radius and wanting to choose the best direction to face while waiting for enemies to show up that would be pathing to the defend point.

The critical point that I was looking for input on would be how one might identify the entrance points. Or the nodes that are the doorways into the area being defended.

The best idea thought of would be to do a breadth first outward search from the defend point and identify nodes that can see the defend point, have links, but none of the linked nodes can also see the defend point.

sentences:
Baked lightmap: Parts of scene appear too dark I'm having trouble setting up global illumination in my Unity 2021.1.1 URP project
Parts of my scene are appearing completely dark, I'm only using directional light and area light on the windows, here's the baked lightmap view:
In the corner as you can see it's completely dark

Here's the Shaded view:
The corner again

Generally the whole scene is pretty dark, it'd like to brighten it up a bit, but the corner is just horrendous.
Those are my lighting settings

Also the Environment settings as per request:

sentences:
Andengine onAreaTouched TouchEvent not working - ACTION_OUTSIDE & ACTION_CANCEL I have a simple problem. I have a button on the screen. I want isActionDown to push the button down, and isActionUp to push the button back up again and make my character jump. But the problem is if I push the button down and drag away from it, the button stays pushed down. I would like the button to push back up again if the user drags away from it.

How can I create the desired affect? isActionCancel doesn't seem to do the trick.

    private void addButton(){
goB = new AnimatedSprite(240, 364, ResourceManager.getInstance().go_region, vbom){
    @Override
    public boolean onAreaTouched(final TouchEvent event, final float x, final float y){

        if (event.isActionDown()){
            goB.animate(new long[]{ 250 }, new int[] { 1 }, true);
            /*if(event.isActionCancel()){
                goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
            }*/
        }
        if (event.isActionUp()){
            goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
            fresh = true;
            playerBody.applyLinearImpulse(new Vector2(0, 45), playerBody.getPosition());
        }

        if (event.isActionCancel() || event.isActionOutside()){
            goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
        }
        return true;
    }
};
goB.setScale(3);

registerTouchArea(goB);
attachChild(goB);

goB.animate(250);
}

I'm having the hardest time with this, and I've tried all sorts of variations of the code above. Please let me know if you have the solution.

Thanks for your help!

sentences:
How to handle user save games? I started on my first game; and now im confused how to handle the player SaveGames. I use google-play-services to persist the user's save games across devices, and I am keeping a local save too.

So the problem is how do I manage conflicts (server vs local).
I have attached Save DateTime on he file and there is general data included.

So this is what im doing right now :

I check the number of coins and gems, the level the player has and if all those are greater than or equal to the other save, i take the first save;
In all other cases i ask the player what copy to keep; displaying the infos in each save file;

I would like to minimize asking the player which file to keep;
(These problem arises only if the player uses multiple devices; Or sometimes he plays locally for a while; and signs in to his acc which already has a save file)

I think you get the idea. I would like to automate everything and dont want the user to go sad just because he misclicked on the local-copy when he had awesome stuff in the server-copy.

I need the idea please :)

sentences:
Storing non-binary, but non-mergable files in Git LFS Is it acceptable to store files that aren’t binary and diffs between versions are not important in Git LFS? Examples of these files include:

.obj
.stl
.mtl
large .csv data dumps
etc

I know that I can, but would there be any advantages to storing them in LFS instead of the regular repo? I've done a bit of googling but couldn't find any information on the subject.

sentences:
Is there a better term for a thing that hosts a game story script than "game engine?" When I recently entered the field of game development, I actually assumed that “game engine” meant something with which you can make your game story script run in an environment where non-player characters have a state, and so you can test running your story as the bare bones of a game. A typical example of a tool for this is Chat Mapper.  This in my perspective is the core of your game, around which you build animations, sounds, etc. using say a 3D engine. A 3D engine can also be used for ends which have little to do with games. Let’s temporarily call what I mean a game-story engine.

But this does not seem the intended meaning – I guess it depends on the focus and stage of your game. Possible meanings of “game engine” seem to be:

An environment which supports creating and running a complete game; this too is quite ambiguous definition, consider Unity, http://unity3d.com/unity/engine/, Vassal http://www.vassalengine.org .
The term “game engine” is actually a shortcut for “game 2D engine” or “game 3D engine”

Now what I am asking is not to become uselessly precise with words, but just whether there is a better term used for “game-story engine” which experienced game developers use. Thanks.

P.S. And no, I’m not heading towards (nor advising to) creating “game engines” before creating games. In my startup we actually created a very simple JavaScript “game-story engine” for our browser games (it was strictly necessary) which we would like to share and am now wondering how to present it.

sentences:
How does one multiply by a constant in a VS1.1 assembly vertex shader? I'd like to multiply a vector by -1

e.g.

mul    r0,    r0,    -1

When I try this, I get this error message:

SimpleShaderA.vsh(20,17): error X2000: syntax error : unexpected integer '1l'

How can I specify -1 in my (first) shader program?

sentences:
OpenGL ES 1 Pixel Error? I am developing a game on android using OpenGL ES 1.0 for Android OS. It is a 2d game using a simple Orthographic projection and textures for the sprites. One of these textures has a small line (it looks like 1 pixel) all the way across the top that has the same colors as the bottom 1-pixel line of the texture. It is almost as if the bottom line of the image raster was copied and pasted as the top line as well.

Is anyone familiar with this type of error? What could the problem be?

sentences:
Is it still possible to install Unity? When trying to install Unity I am getting the following error:

  The download of version ... was cancelled.

I checked that there are no spaces in the path.

Also I can not Sign in.
When I provide the correct email and password the Sign in window just closes with no result.

Also I tried to report a bug using the Report Bug feature, but it seems not to work.

Also I tried to post a question on Unity Forum. But the Sign In over there does not work as well.

What else may I try? Thank you.

sentences:
IndexOutOfRangeException on World.Step after enabling/disabling a Farseer physics body? Earlier, I posted a question asking how to swap fixtures on the fly in a 2D side-scroller using Farseer Physics Engine. The ultimate goal being that the player's physical body changes when the player is in different states (I.e. standing, walking, jumping, etc). After reading this answer, I changed my approach to the following:

Create a physical body for each state when the player is loaded
Save those bodies and their corresponding states in parallel lists
Swap those physical bodies out when the player state changes (which causes an exception, see below)

The following is my function to change states and swap physical bodies:

new protected void SetState(object nState)
{
    //If mBody == null, the player is being loaded for the first time
    if (mBody == null)
    {
        mBody = mBodies[mStates.IndexOf(nState)];
        mBody.Enabled = true;
    }
    else
    {
        //Get the body for the given state
        Body nBody = mBodies[mStates.IndexOf(nState)];

        //Enable the new body
        nBody.Enabled = true;

        //Disable the current body
        mBody.Enabled = false;

        //Copy the current body's attributes to the new one
        nBody.SetTransform(mBody.Position, mBody.Rotation);
        nBody.LinearVelocity = mBody.LinearVelocity;
        nBody.AngularVelocity = mBody.AngularVelocity;

        mBody = nBody;
    }

    base.SetState(nState);
}

Using the above method causes an IndexOutOfRangeException when calling World.Step:

mWorld.Step(Math.Min((float)nGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f)));

I found that the problem is related to changing the .Enabled setting on a body. I tried the above function without setting .Enabled, and there was no error thrown. Turning on the debug views, I saw that the bodies were updating positions/rotations/etc properly when the state was changes, but since they were all enabled, they were just colliding wildly with each other.

Does Enabling/Disabling a body remove it from the world's body list, which then causes the error because the list is shorter than expected?

Update:

For such a straightforward issue, I feel this question has not received enough attention.  Has anyone else experienced this? Would anyone try a quick test case? I know this issue can be sidestepped - I.e. by not disabling a body during the simulation - but it seems strange that this issue would exist in the first place, especially when I see no mention of it in the documentation for farseer or box2d. I can't find any cases of the issue online where things are more or less kosher, like in my case. Any leads on this would be helpful.

sentences:
Is it possible to use Google Play Service on a game not published on Google Play? I'm developing a game for a local Android market but for the leaderboard I'm using Google Play Services. I wanted to know whether it's possible for people to use my leaderboard without publishing on Google Play and just on that local Android market.

Problem is I got Leaderboard up and running with the GPGS but only testers can use it and I think for others be able to use it has to be out of beta and published, please correct me if I'm wrong.

Best, idn

sentences:
Vehicle: Boat accelerating and turning in Unity I'm trying to make a player-controllable boat in Unity and I'm running into problems with my code.

1) I want to make the boat to accelerate and decelerate steadily instead of simply moving the speed I'm telling it to right away.

2) I want to make the player unable to steer the boat unless it is moving.

3) If possible, I want to simulate the vertical floating of a boat during its movement (it going up and down)

My current code (C#) is this:

using UnityEngine;
using System.Collections;

public class VehicleScript : MonoBehaviour {
public float speed=10;
public float rotationspeed=50;

// Use this for initialization
// Update is called once per frame
void Update () {

    // Forward movement
    if(Input.GetKey(KeyCode.I))
    speed =
    transform.Translate (Vector3.left*speed*Time.deltaTime);

    // Backward movement
    if(Input.GetKey(KeyCode.K))
        transform.Translate (Vector3.right*speed*Time.deltaTime);

    // Left movement
    if(Input.GetKey(KeyCode.J))
        transform.Rotate (Vector3.down*rotationspeed*Time.deltaTime);

    // Right movement
    if(Input.GetKey(KeyCode.L))
        transform.Rotate (Vector3.up*rotationspeed*Time.deltaTime);

}
}

In the current state of my code, when I press the specified keys, the boat simply moves 10 units/sec instantly, and also stops instantly. I'm not really sure how to make the things stated above, so any help would be appreciated. Just to clarify, I don't necessarily need the full code to implement those features, I just want to know what functions to use in order to achieve the desired effects.

Thank you very much.

sentences:
Dynamic Terrain Texture I've been looking at a 2D physics game called 'Hill Climb Racing' (Android and iOS) and was wondering how they went about texturing the terrain?

I've had a think about it and I've come up with nothing and finding a resource on the web has proved impossible. Please help.

The game mentioned uses Cocos2d. Would it be just as doable in a different environment?

EDIT:

I was looking at another question: Drawing large 2D sidescroller level terrain

The end result is what I'm looking for, but in my mind I was thinking that there would be some way to add this effect (using small textures) to some terrain specified by vertices rather than making a very large image to match whatever is seen in the level.

sentences:
animationClip.SampleAnimation() does not result in visible changes Here is the relevant code snippet:

public class AnimatedGameObject : MonoBehaviour
{
    private float extentPlayed;

    public AnimationClip Clip;
    public GameObject AnimationTarget;

    private void Update()
    {
        if (this.extentPlayed >= 1f)
        {
            return;
        }

        Debug.Log(this.extentPlayed);

        this.Clip.SampleAnimation(this.AnimationTarget, extentPlayed * this.Clip.length);
        this.extentPlayed += 0.005f;
    }
}

In the Unity Editor, the game object assigned to AnimationTarget contains the animator component controlled by the controller that uses Clip.

However, when I start the game, even though I can see that this.extentPlayed is being incremented every frame, no animation is taking place that I can see.

I am aware that what I am currently trying to do in the Update() method can be achieved by calling SetBool(string name, bool value) on the animator, but the purpose of writing the Update() method this way is to gain familiarity with how the SampleAnimation() method works, so that I can perform more complicated manipulations when necessary.

What changes should I make for the animation to take place?

sentences:
One-way platforms in UDK I'm looking to make a multi-player platforming game using UDK.
I'm currently doing feasibility research, to make sure I will reasonably be able to do all of the technical things I want to do. The first major hurdle I've come across without being able to find as answer, are one-way platforms.

That is to say, platforms through which a player can jump up, but not fall through (unless they choose to).
These are commonly seen in games like Mario, Kirby and Smash Bros.

Does anyone know how such a system would work within UDK? I can think of solutions that might work for single-player, but not multi.

sentences:
Simple game engines / development tools made with artists in mind? I've been working in the 2d art side of games for a while now, and my full time job keeps me very busy on the art side of things, but I'm becoming more and more interested in learning to prototype my own games.

I know very very little programming, though I did take some in college (in TorqueScript, of all things), and while I could probably take the time to learn it, the learning curve is a bit too steep for me as it's completely separated from my current job.

I'm wondering if there are any game engines out there with an interface designed with artists in mind, where the learning curve might be easier for me, and where my current skill set will be more easily applied. I bought an indy license for Torque Game Builder but it still requires a lot of scripting and finding good, basic, entry-level tutorials is proving difficult.

Basically I'm looking for a tool where I can focus on the art and game design, and where the programming is minimal, or is easy to learn and has really excellent documentation. No idea if anything like that exists, but it's worth a shot. :]

Any ideas?

sentences:
How to get object position from a ray hit? I've been coding a program to teleport an object to a player hands(which is just and empty game object). I did this using ray collision on mouse down, but I cant think of a way to find the position of the object I'm trying to teleport. I'm using GameObject.Find to find position of the hands, but I wanted to know if there was a way to find the position of an object via a ray collision. If there isn't a way to find the position of an object from a ray collision what other way could I find its position.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BasicCollisonSound : MonoBehaviour {
    public Transform hands;
    public Transform obj;

    void Start()
    {
        hand = GameObject.Find("Hand");
    }

    void Update () {
        if (Input.getkeydown("mouse1"))
        {

            Ray ray;
            RaycastHit hit;

            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if(Physics.Raycast(ray, out hit, 100.0f))
            {
                if (hit.collider.tag == "Grabbable")
                {

                    obj.position = hands.position;
                }
            }

        }
    }
}

sentences:
How to correctly draw a 2D polygon in Unity I'm trying to draw a 2D polygon using GL.Line; however I'm not getting a polygon but separated lines instead. In the example below, I would expect a rectangle formed by the spheres:

My code is the following:

void OnPostRender( )
 {
     GL.PushMatrix ( );
     mat.SetPass ( 0 );
     GL.LoadOrtho( );

     GL.Begin( GL.LINES );
     GL.Color( Color.white );

     for ( int i = 0; i < spheres.Length; i++ )
     {
         currentVector = Camera.main.WorldToViewportPoint ( spheres[i].transform.position );
         GL.Vertex3 ( currentVector.x, currentVector.y , 0  );
     }

     GL.End();
     GL.PopMatrix();
 }

Also, I found this tutorial/example but is not exactly what i'm looking for, since in the example, all have the same origin point.

I'm asumming that the correct way of achieving what I want, would be to call the Gl.Vertex3 method once for each of the 2 points that form each line:

From A to B (GL.Vertex3 call 2 times)
From B to C (GL.Vertex3 call 2 times)
From C to D (GL.Vertex3 call 2 times)
From D to A (GL.Vertex3 call 2 times)

Is this the right way of doing this?

Thanks in advance.

sentences:
How to make texture size correctly in THREE.js? I'm new to THREE.js and I have a frustrating problem. I can't get my grass texture to size "normally" on the terrain.

I get it, the terrain is steep, but that doesn't mean the grass should be stretched as well!

I don't want the textures to scale, resize, stretch, or distort. I want the textures to render the same size as the original image. The image is 128x128, so why can't the texture be the exact same?

THREE.js doesn't allow me to make the texture repeat as much as it needs to fill the plane. It only lets me set a fixed number of "repeats." That's what most likely causes the distortion.

texture.repeat.set(10, 10);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;

How can make the size of the texture not be affected by the size of the polygon it's on? If the image is 128x128, it should still be 128x128 on the terrain.

  EDIT: Is it possible to use pixel coordinates instead of UV?

sentences:
How to find the resulting angle of a ball hitting a wall in 2D So there's a ball moving on a 2D plane with any vector. When it comes into contact with a collider, it should reflect in a linear fashion. What formula should be used in order to find the angle that this new direction should have? The pieces of information that are known are:

The X and Y velocity of the ball when it was hit
The angle it was travelling at when it was hit
The point of contact

I've found many solutions for if the ball can only hit vertical or horizontal walls, but have yet to find a one for a general case.

sentences:
C++ timer function acts as if time limit is instantly reached if it is less than 1 second I'm trying to make a Snake clone with C++ and OpenGL/GLUT, but I've been having trouble with programming the timed input. I made a timer class, as you'll see below, to be used for the short time intervals allowed for input and movement. It's function checkTime() is called to start the timer. Then on following calls, it checks if the time limit (represented by the int variable limit) has been reached.

To test it, I set up a simple, looping console program, that displays keyboard input. When working properly, it displays what key is being held precisely at the point when the timer finds the time limit has been reached (it returns "true"). Given a limit of 1 second, it will only display current input every second. If it is given a value below 1 however, like 0.333, it will act as if the time limit has instantly been reached, and will display input instantly whenever a key is pressed. How can I get it to only display the input every 0.333 seconds?

Also - I realize my method of doing things here may not be the best, given the tools I'm using. However, I'm curious why this won't work properly.

#include <iostream>
#include "timer.h"
// Include all files necessary for OpenGL/GLUT here...

using namespace std;

Timer timer;

void update(int value)
{
    if (timer.checkTime())
    {
        if (GetAsyncKeyState(VK_LEFT))
            cout << "You pressed LEFT!" << endl;
        else if (GetAsyncKeyState(VK_RIGHT))
            cout << "You pressed RIGHT!" << endl;
        else if (GetAsyncKeyState(VK_UP))
            cout << "You pressed UP!" << endl;
        else if (GetAsyncKeyState(VK_DOWN))
            cout << "You pressed DOWN!" << endl;
    }

    glutTimerFunc(1000/60, update, 0);
    glutPostRedisplay();
}

timer.h

#pragma once

class Timer
{
public:
    Timer();
    bool            checkTime(int limit = 0.333);
private:
    unsigned long   getElapsed();
    bool            running;
    unsigned long   elapsed;
    unsigned long   start;
};

timer.cpp

#include "timer.h"
#include <ctime>

Timer::Timer()
{
    running = false;
    elapsed = 0.0;
    start = 0.0;
}

bool Timer::checkTime(int limit)
{
    (unsigned long) limit;

    elapsed = getElapsed();

    if (elapsed < limit)
    {
        return false;
    }
    else if (elapsed >= limit)
    {
        running = false;
        return true;
    }
}

unsigned long Timer::getElapsed()
{
    if (! running)
    {
        start = (unsigned long) clock();
        running = true;
        return 0.0;
    }
    else
    {
        return ((unsigned long) clock() - start) / CLOCKS_PER_SEC;
    }
}

sentences:
Unity Profiling - Mesh.Bake PhysX CollisionData Doubling CPU cycles I have a mob that, when it dies, spawns smaller versions of itself.  When this happens there's a huge resource spike.  The profiler narrowed it down to baking the meshes of the new objects.  I have a couple of smaller questions related to this, but the crux of the issue is that it looks like the baking is occurring twice (doubling CPU usage) as shown below in both Instantiate and Transform.SetParent.  I'd normally say it's redundant, but in every way it looks like it's happening twice and take over one full second total.  Why would this happen twice on the same set of object (there are a variable number of spawned mobs, so the actual numbers can vary)?

As an aside, can this be backed in the prefab somehow to avoid this?

sentences:
How can I display a loading state until a song loaded with www.GetAudioClip() is ready to play? I use www.GetAudioClip() to get a song and play it when my Android mobile game starts.

My issue is that it takes a 3-second delay to play the song.

My idea is to add some loading screen before starting the game, and the game starts after www.GetAudioClip() finishes getting the song and I begin to play it. But I don't know how to control the loading screen so it disappears after the right delay.

sentences:
What does "{ get; set;}" in Unity mean? I am coming back again into hobby game development after about 6 months away. I'm just trying to learn some kind of basic things again. I'm at the very start of making a very simple boxing management simulator. Later, I will be trying to re-learn using databases and might ask for more help.

But for now, I'm making a Boxer class which will hold all the data on each boxer (eg. Name, height, number of wins, punch power etc etc). I've used private variables for those and then have made my own methods for each variable called Getxyz().

I have seen people doing things like 'public int xyz { Get(); }' but i dont understand how that would work.

Is the way I'm doing ok (it does seem long-winded to me) or should I investigate these Getter Setters some more? Here's what I am doing right now:

public class Boxer : MonoBehaviour {
// generic boxer details:
int id;
string nameA, nameB;
int weight;
int height;
float age;
float reach;
// career info:
int wins, loses, draws, winsByKO;
// boxing attributes/stats:
float power, speed, agility, koPunch, stamina, toughness;

public int GetId()
{
    return id;
}
public string GetNameA()
{
    return nameA;
}
public string GetNameB()
{
    return nameB;
}

}

sentences:
How to "merge" multiple intersecting circles so that only the outer edges of each show? In my RTS (In Unity) each unit or building has strategic circles in a similar fashion to SupCom. If you have multiple units or buildings selected it looks like the picture to the left. I want to make it look like the picture to the right, where anything inside the outer edges of their circles is no longer shown.

I draw these using vectrosity, mentioning this just in case vectrosity provides a way of doing this, or can be modified to do this.

The circles are essentially just an array of points with lines drawn in between them. How would I go about "merging" the circles inside of their overlapping area?

This is similar to: How to make unit selection circles merge?, however I am not interested in a shader solution.

Edit: To re-explain the above.:

I'm not seeing how the answers are applicable. I've read through the other thread before posting, which is why I posted it here to avoid this exact thing (being marked as a duplicate). I have an array of points with straight lines in-between them to create a circle-like effect. This is not a true circle, but a really granular polygon. I am interested in solutions that are achievable in C# within Unity, not with shaders or with rendering mechanics.

Edit2: Another picture based on one of Roberts suggestions

This seems viable, though computationally expensive. If I have a circle made up of 250 points, and 50 circles all intertwined that's 615,500 checks in a worst-case scenario.

sentences:
Interactive map designer I've made a simple game in pygame/pymunk. Currently my maps consists of lists with functions, e.g

ground_segments = [ground(position, size, shape...), ...]

I have equally built up lists for planks, stones, trees etc. And althoug it works, it is a bit tideous to work with.

I tried first tried making a tile-based map editor and .txt files to read/write to, but having a grid of letter felt limiting to wha I could add. Since I had a working concept of importing lists with the information I tried to build on that, but stopped once I realised I couldn't edit the contents of map.py fromlevel_editor.py. Is there a workaround for that or do I need anothter concept? If so, any suggestions?

sentences: How make a laser path prediction line like a “slingshot cowboy” game? How so I make a laser path prediction line like a “slingshot cowboy” game in cocos2d or box2d and select the target like "slingshot cowboy" game.

sentences:
Scale DIV with tiles I am trying to create a repeating background. I have a main DIV with a grid of small 16x16 DIVs. I am trying to scale the main DIV in CSS; when the small DIVs simply have a red background color everything works great, but when there is a background image in the small DIVs then borders become visible between the tiles.

This image explains the problem:
http://cl.ly/FpNW/o

Check the HTML in these examples:

With BG-COLOR: http://jsfiddle.net/pTLXw/

With BG-IMG: http://jsfiddle.net/vkpuY/

Does anyone know what is causing this problem and how to fix it? If it is not possible to fix while using DIV, is there another way to do this?

Thanks you so much!

sentences:
How does Blizzard manage to support Mac OS and Windows in their games? I've always thought that using Direct X for Windows was the most powerful, easy and modern method to create games with modern graphics, nowadays. Knowing that it's only Windows, I thinks it's pretty difficult to make something similar on other platforms; Mac OS, to be exact. However, Blizzard somehow managed to deliver Starcraft 2 for Mac OS, and Diablo 3 will be available for Mac, too.

So what I'm interested in is information about:

what technologies are they using for their game engines?
are they using one engine for both games (Starcraft 2 and Diablo 3), or do they develop custom engines for each game?
what are they paying, in terms of time and money, for Mac OS support?

sentences:
Using single Triggers on multiple controllers in Unity After trying out a lot of stuff I finally need to surrender. Im having a project where I want to use the triggers of the Xbox Controllers seperately. To do so I added them as axis 9 and 10 in the input manager (see image). Now, when i have multiple controllers connected on project startup the triggers wont get recognized. I have to press the trigger on two controllers to get a value from it...prettty strange. If i reconnect the controllers after project launch everything works fine...

Test script looks like this.

Thanks!

sentences:
How to have real time (blood) traces? https://www.youtube.com/watch?v=Tzf3zjPJYw4

In this game, Ink, color blobs fall then they create pretty color spots.

The color traces are unlike any other game.

For an example, in Super Meat Boy https://www.youtube.com/watch?v=snaionoxjos

The red traces of SM Boy was more of sprites aligned across the surfaces of the object.

The trace in game Ink is different from those traditional traces of other games because...

They stack infinitely.
Come in many different shapes.

The approaches I can think of are...

Prepare many different shapes sprites, then put then where traces should be.
Assign each block with their own texture, then draw the traces on that texture.

The issues I see however are...

First solution will lead to having many-MANY-MANY sprites being generated to look as if the traces are being drawn upon the object.
Heavy calls between GPU and CPU. Keep drawing traces while uploading drawn new texture onto the GPU to be rendered. Significantly slowing down the game.

I don't have a good computer. My computer cannot handle either approach 1 or 2. But it can the run the game Ink.

So I am assuming Ink must use some sort of clever approach to handle this crucial visual aspect of the game. But I am out of ideas.

sentences:
Creating a bitmapfont from images? A bitmapfont consists of a image and a textfile that hold the position and size of each character on that image. Is there any way to create the text file with just a image? Or do I have to manually create the "atlas" for each character, which is kinda tedious.

Here is a line for a character in such a textfile .fnt

char id=36   x=0     y=0     width=46     height=83     xoffset=1     yoffset=0    xadvance=51     page=0  chnl=0

I think xadvance would mean how many pixels to advance on the line to put the next character. I have 36 characters A-Z0-9 but I want upper and lower case to output the same image.

I need this specifically for libgdx but this would probably be the same for any tool that uses a BitmapFont.

In addition I have a xml file that came with the sheet that includes the characters allong with the other images.

<TextureAtlas imagePath="sheet.png">
  ...
  <SubTexture name="letterA.png" x="412" y="835" width="61" height="64"/>
  <SubTexture name="letterB.png" x="460" y="977" width="52" height="66"/>
  <SubTexture name="letterC.png" x="432" y="1613" width="54" height="66"/>
  ...
</TextureAtlas>

I also have a each character separately in PNG and Vector.

To make clear to what I need this is a complete .fnt it needs to be accompanied by a single image that holds all the images of each character.

info face="FontName" size=78 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0
common lineHeight=93 base=73 scaleW=512 scaleH=512 pages=1 packed=0
page id=0 file="fontsheet.png"
chars count=83
char id=32   x=0     y=0     width=0     height=0     xoffset=0     yoffset=73    xadvance=25     page=0  chnl=0
char id=36   x=0     y=0     width=46     height=83     xoffset=1     yoffset=0    xadvance=51     page=0  chnl=0
char id=106   x=46     y=0     width=19     height=82     xoffset=2     yoffset=9    xadvance=26     page=0  chnl=0
char id=41   x=65     y=0     width=20     height=75     xoffset=1     yoffset=3    xadvance=26     page=0  chnl=0
char id=40   x=85     y=0     width=21     height=75     xoffset=2     yoffset=3    xadvance=27     page=0  chnl=0
char id=96   x=106     y=0     width=31     height=75     xoffset=5     yoffset=0    xadvance=39     page=0  chnl=0
char id=64   x=137     y=0     width=72     height=68     xoffset=1     yoffset=7    xadvance=77     page=0  chnl=0
char id=48   x=209     y=0     width=51     height=68     xoffset=1     yoffset=7    xadvance=57     page=0  chnl=0
char id=85   x=260     y=0     width=54     height=68     xoffset=1     yoffset=7    xadvance=60     page=0  chnl=0
char id=79   x=314     y=0     width=60     height=68     xoffset=1     yoffset=7    xadvance=65     page=0  chnl=0
char id=38   x=374     y=0     width=60     height=67     xoffset=2     yoffset=8    xadvance=65     page=0  chnl=0
char id=54   x=434     y=0     width=47     height=67     xoffset=1     yoffset=8    xadvance=53     page=0  chnl=0
char id=121   x=0     y=83     width=43     height=67     xoffset=1     yoffset=26    xadvance=48     page=0  chnl=0
char id=113   x=43     y=83     width=48     height=67     xoffset=1     yoffset=24    xadvance=53     page=0  chnl=0
char id=112   x=91     y=83     width=48     height=67     xoffset=0
// etc...

sentences:
How to use generic level editors with my arbitary code? I have a game, breakout clone. It has a Block class that contains CCSprite as a property.
Usually I made levels by manually setting those blocks to positions.
Here comes the question, how do I use generic level editors with my custom code? All editors work with CCSprites and not my class. How can I overcome that?

sentences:
Skeletal Animation - Caching global bone transforms Very often I see skeletal animation implemented like this:

On Init - store bone's local transforms and inverse bind pose
On Update - traverse the skeleton tree, multiplying local transforms on the way (and inverse bind pose)

However, it is more efficient to pre-calculate global poses from local transforms and just reassign them at specified time point to constant buffer.

What is the benefit of keeping all those local matrices? Does it have any meaningful application in other systems like physics, collision detection?
People still choose the first scenario and that actually keeps me puzzled.

sentences:
Multiplayer first person camera gone after restart I have a main camera in a multiplayer scene and when a player joins he owns that camera so there is always a single camera.

Now when i click "disconnect" and connect again, there is no camera left in the scene because it gets "destroyed" with the players prefab.

How can i catch the "client disconnect" on client side to clear the cameras parent so that it still remains in the scene?

sentences:
Collision Detection Efficiency I've just written my first successful collision detection code, and it works great for a small scene of actors (player + 4-5 obstacles).

However, I realize that since it checks every possible collision for each actor in the scene, it checks each possible collision in the scene twice (Does A collide with B? Does B collide with A?).

With a small number of objects that may be colliding, this is not a problem, but it seems to me that it could slow things down in a very busy scene if every collision is checked twice.

Should I go ahead and rewrite it to check each collision once, or would that be a premature optimization?

sentences:
Is computing depth in a pixel shader bad? Can I reduce fillrate by moving depth calc to vertex shader? I have a DX10 game that is fillrate bound. One of the things I've been realizing may be contributing to this is that I compute depth in the pixel shader (the game uses a logarithmic depth buffer to get extreme precision from 1cm to millions of meters away).

It occurred to me that writing the depth in the pixel shader is ruining the ability to to Early Z testing.

Can this be fixed by outputting this computed depth value in the vertex shader instead?

sentences:
Player & Level class structure in 2D python console game? I'm trying to create a 2D console game, where I have a player who can freely move around in a level (~map, but map is a reserved keyword) and interfere with other objects.
Levels construct out of multiple Blocks, such as player(s), rocks, etc.

Here's the Block class:

class Block(object):
    def __init__(self, x=0, y=0, char=' ', solid=False):
        self.x = x
        self.y = y
        self.char = char
        self.solid = solid

As you see, each block has a position (x, y) and a character to represent the block when it's printed. Each block also has a solid attribute, defining whether it can overlap with other solids or not. (Two solid blocks cannot overlap)

I've now created few subclasses from Block (Rock might be useless for now)

class Rock(Block):
    def __init__(self, x=0, y=0):
        super(Rock, self).__init__(x, y, 'x', True)

class Player(Block):
    def __init__(self, x=0, y=0):
        super(Player, self).__init__(x, y, 'i', True)

    def move_left(self, x=1):
        ... # How do I make sure Player wont overlap with rocks?
        self.x -= x

And here's the Level class:

class Level(object):
    def __init__(self, name='', blocks=None):
        self.name = name
        self.blocks = blocks or []

Only way I can think of is to store a Player instance into Level's attributes (self.player=Player(), or so) and then give Level a method:

def player_move_left(self):
    for block in self.blocks:
        if block.x == self.player.x - 1 and block.solid:
            return False

But this doesn't really make any sense, why have a Player class if it can't even be moved without Level? Imo. player should be moved by a method inside Player.

Am I wrong at something here, if not, how could I implement such behavior?

sentences:
Controlling the movement of player by sprite using Mouse I want to move the player by pressing down on the mouse and moving around by dragging. The player won't move to the position of the mouse. Instead it should be relative to the players current position.

https://youtu.be/oGSpX6GEYa0?t=5m55s

The way this works, your finger can be anywhere on the screen, and when you move down, the player moves down. This is what I have so far, but it's not as elegant as I want it to be. For example, if your mouse is not moving, it still applies acceleration.

public static inline var EASING:Float = 0.1;

private var mouseX:Float;
private var mouseY:Float;
private var vx:Float;
private var vy:Float;
private var distance:Float;

/**
 * Function that is called once every frame.
 */
override public function update(elapsed:Float):Void
{
    if (canMove == false) {
        return;
    }

    if (FlxG.mouse.justPressed) {
        this.mouseX = FlxG.mouse.screenX;
        this.mouseY = FlxG.mouse.screenY;
    }

    // if we are pressing down, we should move ronnie
    if (FlxG.mouse.pressed)
    {
        vx = getVelocityX();
        vy = getVelocityY();
        distance = getDistance(vx, vy);

        if (distance > 0) {
            this.x += vx * EASING;
            this.y += vy * EASING;
        }

    }

    if (FlxG.mouse.justReleased) {
        //
    }

    super.update(elapsed);
}

/**
 *
 * @return
 */
function getVelocityX():Float
{
    return FlxG.mouse.screenX - this.mouseX;
}

/**
 *
 * @return
 */
function getVelocityY():Float
{
    return FlxG.mouse.screenY - this.mouseY;
}

/**
 * Return distance
 *
 * @return
 */
function getDistance(vx:Float, vy:Float):Float
{
    return Math.sqrt(vx * vx + vy * vy);
}

sentences: Rendering a black and white image in OpenGL 1.1 Is there is any way that I can simple disable the color in OpenGL 1.1? Or can I "grey out" textures in LWJGL?

sentences:
Orientation changed event in Unity3D? I'd like to listen to orientation change events, so for example my UI layout or the components themselves can be changed.
All I've found is that I should check the value of Screen.orientation every frame, and check if it has changed since previous frame.
But this isn't really efficient, and I wonder why doesn't Unity provide an event for this.
This asset seems to have what I need. Anyone knows how is it implemented?
As a last resort I could make a singleton behaviour which starts a coroutine which checks every X seconds whether it has changed, and if it has, I fire an event. But this still seems like a suboptimal solution.

sentences:
How do I show an interviewer that I have past experience? While researching some of the development companies I'd like to work for in the future, one thing kept catching my eye; they all wanted previous AAA experience I will have an enormous struggle obtaining. I currently live in an area with no AAA developers nearby, so an internship is next to impossible. Is this requirement a killer, or can this be looked past if I have an 8-year degree? (I am planning on getting a Masters in Computer Science or a similar field anyway for permanent job security.)

If this requirement is that important, I have also heard that you can compensate by having a homemade demo of a game you created on your own. If this is true, how complex must it be? As involved as an indie game? Deeper? Must it be in 3D?

I know this is a few questions too many for one post, but I'd appreciate any advice (preferably for people who have hired other developers in the past or have bypassed a similar issue.)

sentences:
Algo for rotating tower towards enemy - Unity I have made a grid and placed towers and moving a enemy on it. Now i want to rotate towers face towards enemy when enemy comes in the range of tower.

I have a solution that whenever enemy comes to its range ( 2 grids far ) it starts do something, lets say when tower finds enemy is on left side it starts firing like that when enemy moves up/down ( when it finds there is a tower on very next tile) tower starts rotating with enemy position uniti enemy's range that is 2 grids far. So its mean tower has to rotate whenever enemy comes to its range and moves up/down.

What would you people suggest me a optimized way or any helpful scripting function ?..thnx

sentences:
Collisions between two objects in 2D space I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to make it a little more interesting when the player plays with other objects in motion, they collide and separate. This is a very physical 2D issue itself.
If an object A is at positive velocity at x collides with an object B is at negative velocity at x, collide head-on, what would be the best calculation to do so that they separate naturally after the collision?

What if they go in the same direction in x? and if one has going on x and another on y? How do I deal with all this?

Should I add mass and acceleration to make this separation calculation after the collision?

sentences:
anisotropic fog of war Here I am not talking about how to render fog of war, but how to model exploring of terrain in a more sophisticated way.

In a straight-forward approach, terrain explored by a game unit is simply represented by a circle whose radius is how far this unit can see. And visible area is just union of isometric circles. But I can tell that it is not the case in popular games.

Please take a look at the following screenshot from League of Legends, for example.

The sight of view is anisotropic. The shape of surrounding terrain is also taken in to account.

Any idea how this can be done?

sentences:
Determine speed of sprite I'm trying to calculate the speed of my sprites in Cocos2d but I'm having some difficulties. I'm not sure which units of time/speed cocos2d uses.

My background sprite moves 2 positions to left each .004 seconds.
I have a sprite that is generate each 3 seconds at position X0. The sprite moves until X1.
I would like that his speed would be the same as the background.

This is how I'm scheduling the background movement and the other sprite generation:

this.schedule(this.gameLogic, 3);
this.schedule(this.moveBg,.004);

this is how I'm changing the position of the background

var X = bg.getPositionX();
      var X1 = bg1.getPositionX();
      //alert(X);
      //alert(bg.getBoundingBox().width);
      bg.setPosition(X-2, 0);
      bg1.setPosition(X1-2, 0);

      if ( X < -bg.getBoundingBox().width) {
        bg.setPosition(bg1.getPositionX() + bg1.getBoundingBox().width, bg.getPositionY() );
      }

      if ( X1 < -bg1.getBoundingBox().width) {
        bg1.setPosition(bg.getPositionX() + bg.getBoundingBox().width, bg1.getPositionY() );
      }

And this is how I'm determining the X0, X1 and speed of sprite.

star.setPosition(winSize.width + star.getContentSize().width/2, Y);
        this.addChild(star);
        var from = winSize.width + star.getContentSize().width/2;
        var to = -(winSize.width+ star.getContentSize().width/2);

        // Create the actions
        //var actionMove = cc.MoveTo.create(2, cc.p(-star.getContentSize().width/2, Y)); // 3
        var actionMove = cc.MoveTo.create(14, cc.p(to, Y));

How can I determine the speed of star to be the same as bg?

sentences:
What is the proper way to create a camera matrix? I am having issues when trying to create a camera transform. It seems to have odd distortions and it does not seem to rotate properly, though it will translate alright. While I have seen issues like this where the rotation does not work, I have not found any like my issue.
This is what I currently do to create the matrix:
Mat4 TransformLookAt(Vec3 from, Vec3 to, Vec3 world_up) {
    Mat4 view_matrix = Mat4New(1.0f);
    Mat4 rot_matrix = Mat4New(1.0f);

    Vec3 axis_n = Vec3Normalise(Vec3Subtract(to, from));
    Vec3 axis_v = Vec3Normalise(Vec3Cross(from, Vec3Cross(world_up, from)));
    Vec3 axis_u = Vec3Normalise(Vec3Cross(axis_n, axis_v));

    // Rotate on the X-axis
    rot_matrix.ax = axis_u.x;
    rot_matrix.ay = axis_u.y;
    rot_matrix.az = axis_u.z;

    // Rotate on the Y-axis
    rot_matrix.bx = axis_v.x;
    rot_matrix.by = axis_v.y;
    rot_matrix.bz = axis_v.z;

    // Rotate on the Z-axis
    rot_matrix.cx = axis_n.x;
    rot_matrix.cy = axis_n.y;
    rot_matrix.cz = axis_n.z;

    // Translate the camera
    view_matrix.aw = -from.x;
    view_matrix.bw = -from.y;
    view_matrix.cw = -from.z;

    view_matrix = Mat4ByMat4Multiply(view_matrix, rot_matrix);

    return view_matrix;
}

The camera is at (1.0, 0.0, 3.0) at is set to look at (0.0, 0.0, 0.0), which is where the centre of the cube is located. Here is what it looks like:

I would expect to see the left side and possibly top of the cube (since that is what this is supposed to do), but instead the cube has been distorted so that its left side cannot be seen.
That leads me to this question: If none of the methods like the one I've tried to implement works, then what is the proper way to create a camera matrix? What am I missing so that this does not work?
I understand how it should work, but I just can't get it to work. I feel like it might be something obvious, but I can't seem to figure it out.

sentences:
OpenGL approach to depth-testing-like combination of a large buffer of fragments I have a depth buffer and color buffer created by another effect. The buffer is more than double my screen size. It is not rendered from geometry, but as a whole it resembles a rendered scene with an ortho projection. I can't generate this data w/ any other projection. I'm trying to redraw the scene in two-point perspective. This means each fragment from the orthographic data will be skewed and translated based on the depth value.

If I render a fullscreen quad, each fragment will not know how or where to sample from the original buffer. It seems like I the sources have to assign themselves to destinations, rather than a destination gathering sources.

Impractical or incomplete solutions:
- Generate a tri or point for every pixel in the source buffer, and actually rasterize them with depth testing. This is really slow, but it could be possible to generate the vertices in a compute shader or something? We're still dealing millions of tris for an average screen. I'm skeptical that this is the real solution.
- Something with SSBO and atomicMax. It seems like you can only compare your actual data, so I would have to pack my colors with depth values somehow.

This seems like a fairly fundemental operation, so I'm hoping there is some canonical technique or opengl extention that does this sort of thing for me well. Even a name for this operation might help me find existing literature.

The final solution must be realtime for typical screen sizes. C++/OpenGL.

sentences:
Sidescrolling terrain 1D perlin noise I'm working on a tile based game and already got a generator working. But it doesn't seem to be smooth enough to look realistic.

Here's the code I'm using:

for (int i = 0; i < width; i++)
        {
            float y = ClassNoise.PerlinNoise1D(i, 2f, 4);
for(int j = 2048+y;j<height;j++)
{
  tiles[i][j] = new Tile(i,j);
}
}

public class ClassNoise
{
    public static float Noise(int x)
    {
        x = (x<<13) ^ x;
        return (float) ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
    }
    public static float PerlinNoise1D(float x, float persistence, int octaves)
    {
        float total = 0;
        float p = persistence;
        int n = octaves - 1;

        for (int i = 0; i <= n; i++)
        {

            float frequency = (float) Math.pow(2, i);
            double amplitude = Math.pow(p, i);
            total += InterpolatedNoise(x * frequency) * amplitude;
        }

        return (int) total;

    }

    private static float InterpolatedNoise(float x)
    {
        int integer_X = (int) x;
        float fractional_X = x - integer_X;

        float v1 = SmoothNoise1D(integer_X);
        float v2 = SmoothNoise1D(integer_X + 1);

        return CosineInterpolate(v1, v2, fractional_X);

    }

    public static float CosineInterpolate(float a, float b, float x)
    {
        float ft = (float) (x * Math.PI);
        float f = (float) ((1 - Math.cos(ft)) * 0.5);

        return a * (1 - f) + b * f;
    }
    public static float SmoothNoise1D(int x)
    {
        return Noise(x)/2  +  Noise(x-1)/4  +  Noise(x+1)/4;
    }

}

How can I make this terrain generator smoother?

EDIT:

It currently looks like this (The terrain on the screenshot isn't the full terrain it's just the terrain on the screen):

sentences: Started work on a time based business game- one similar already exists... What should i do? Yeah so like i said, i started to work on a time based game that involves business investments, and as it turns out, there is a game called adventure capitalist that has pretty much the same idea about it. I planned to greenlight my game on steam and i found that adventure capitalist is on steam. Im not sure what i should do. Should i continue but make changes to the game (and if so, what sort of changes) or should i give up and work on something else. I should have mentioned this earlier but in the game, you make investments in the electronic industry, and each type of investment will have a different payout per second and a different base investment price to other types. For example, investing in computers will cost you £500 and have a payout of £5/second but investing in smartphones will cost only £100 and have a payout of £1/second. When you can afford it, you can level up your investment. I havent really added any more to the game than that so any advice would be appreciated, thanks.

sentences: C++ OpenGL - 2D Lighting Around Object in a Pitch-Black Environment I am making a 2D game in C++ with OpenGL where a maze is generated and you have to move the character through the maze and get it to the end. I have achieved all this, but now I want to make it more challenging by having everything pitch-black but a small light around the character. How can I achieve this? I don't want the light to be complicated and I don't want it to only go through the tunnels. I just want a simple light around the character to illuminate that area of the maze.

sentences:
Controls: Rolling on a ceiling Currently I'm writing an iOS game where the basic movement is rolling. Technically you make the player turn clockwise or counterclockwise. When you tilt the device to the right, you will rotate clockwise. This makes sense, because you are standing on a floor, so this will make you roll right. Same idea goes for left, of course.

But sometimes, the player can roll in some sort of looping. The problem with that is, is that the player is in contact with something above (in other words, with a ceiling). This makes the logic turn: tilting the device to the right, makes your rotate clockwise, which will cause you rolling to the left instead.

Physically this is okay for me. But I've seen lots of people trying my game getting confused about it. As they go into the loop, they turn the device the other was as well, in order to follow the direction of the loop. But that makes them roll the other way and slow down, and eventually drop.

I don't want to do a stupid check like: if touching at the top side, then reverse the control, because to me that feels not natural. So, I guess there are lots of other people with the same feeling to this as I'm experiencing.

So, my question is: Are there any good techniques of handeling this issue? Make it feel natural most of the time for everyone?

sentences:
SlimDX: Error while loading Effect Im trying to load a effect in SlimDX, but I get a error when I try to get the ShaderSignature.
The error-code:

E_FAIL: An undetermined error occurred (-2147467259)

This is my code:

   EffectTechnique tech = this.effects.GetTechniqueByIndex(0);
   EffectPass pass = tech.GetPassByIndex(0);
   ShaderSignature shaderSignature = pass.Description.Signature;

Any idea?

sentences:
Andengine Box2D Physics "disappearing"? I have problems with my PhysicsWorld in Andengine GLES20. Sometimes when i first load my app and level there is no velocity added to my bodies. they also rotate slower as it seems. This also happens in Game when I press the home button and then go back into the app.
Any ideas? Is this fixed in the AnchorCenter Branch?

sentences:
Implementing Multiplayer: entire world ticks or just changes? i'm working an a very simple multiplayer experience (for now node.js, later will probably remake all in c++, but my question is more about theory).

All guides and tutorial i saw about making something multiplayer Always speak about sending all the "world" information, once per tick, deciding optimal tickrate, making smooth movements on client side with interpolation or stuff like that.

Honestly i thought of another way, and i really cant see why its never mentioned.
My idea would be the following:

Client sends to server when input happens; eg if you move with arrows, you send to the server a message only when your moving status changed. If you was moving right and then start moving upright, then you send a message about you changing your movement.
Server recives the messages, sets variable on player object for its movement, and sends to all other clients information about the change. Also sends current time and current position in the server at the moment of movement change.
Clients recive a movement status update, place the player object in recived coordinates moved by the new movement * ping delay. That way position in all clients should Always be up to date with the server.

Why should i send hundreds of positions to each client per each player every x milliseconds when i can just send the changes?

I feel like its about polling vs interrupt... (yeah i know its not polling anyway, but the concept is sending the change vs keep sending everything)

sentences:
2D Real-Time shadows on level on a level made from a Dynamic Bitmap The Bitmap has transparency, and only non-transparent pixels are solid and used for hit detection for the physics engine and gameplay.

I have seen some versions done with convex hulls, but for multiple reasons I am not using convex hulls to build the levels in my game.

How can I implement 2d shadows on a level made out of a Dynamic Bitmap?

The answer jpaver posted is good, but I am sure there are some other ways to do this. Does anyone else have any more information on this question?

sentences:
Unity - RageTools Performance Has anyone used RageTools for Unity? What do you know about the performance? Is it more performant than using raster, for example with "puppet 2d" or the other way?
I'm developing mobile games, so performance is very important for me.
Thank you!

sentences:
Tween Animation Cannot Start Do you have any reasons why my tween code didn't run or work? I already add the tween engine onto the library folder under LibGDX project folder and "Order and Export" it under Java Build Path at the Properties menu. My first two classes ran correctly and workly but my third class didn't work. Here's the sequence:

First class is the first screen. Fade animation works on the company's logo.
Second class is the second screen. Fade animation for the loading screen works.
Third class is the third screen. After the second screen, now calls for the third screen. Animation stopped or won't run since I want the black screen to fade out at the start when the menu is here.

Can you check if I did right? Look carefully by comment lines for explanation.

    //-----[ Animation Setup ]-----
    Tween.registerAccessor(Sprite.class, new Tween_Animation()); // --> Tween_Animation.java
    Tween_Manager = new TweenManager(); // --> I initialized it the TweenManager and seems okay.
    cb_start = new TweenCallback() // --> I'll use this when I choose START and the menu will fade in black.
    {

        @Override
        public void onEvent(int arg0, BaseTween<?> arg1)
        {
            goTo();
        }

    };

    Tween // --> This is where I focused the problem.
    .to(black_Sprite, Tween_Animation.ALPHA, 3f)
    .target(1)
    .ease(TweenEquations.easeInQuad)
    .repeatYoyo(200, 2.5f) // --> I set the repeat for 200 times when I noticed that the animation won't work!
    .start(Tween_Manager);

sentences:
Where is better to do shaders, vfx, uv-mapping and coloring? Well i understand that 3DS-Max is mainly for modeling and Unity is mainly for programming and logic, but where is it better to do shaders, vfx, uv-mapping/painting and coloring?

for example i worked a little bit in Blender and it has modifiers, but also Unity has materials and similar stuff.

What let's say "imade a model in 3ds max, now where should i do the art and texturing, should i continue with 3ds or should i do it in blender? OR it doesn't matter where?"

sentences:
how to bring movement and rotation vectors of object in the current scene in unity editor sometimes in unity i need to zoom to fix the exact position and rotation of an object. but movement and rotation sign of the object always stays on object and i think its pivot of the object.

How can i really bring those movement and rotation signs to simply perform those translations of my object?

thank you for helping.

sentences:
Recognizing runes drawn by user I want to implement a system where the player can draw runes on the screen with multiple gestures. Meaning its not just one motion it can be up to 3. So far I have implemented the $P Recognizer . In the example it works great and is exactly what I want. But its made with .Net 4.0 and the dll does not work with unity. I eventually managed to get it working by compiling down to 3.5. The problem is that  the integration in unity does not work well at all. It recognizes the shape but when I draw wrong symbols it recognizes them as well. I'm completely lost as how to proceed fixing this. Here is my code that handles the integration.

if (Input.GetMouseButtonDown(0))
        {
            clone = Instantiate(trailHolderPrefab, transform.position, Quaternion.identity) as GameObject;
            clone.transform.SetParent(transform);
            i++;
        }
        if (Input.GetMouseButton(0))
        {

            points.Add(new Point(Input.mousePosition.x, Input.mousePosition.y, i));

            Ray r = Camera.main.ScreenPointToRay(Input.mousePosition);
            Vector3 pos = r.GetPoint(_distance);
            transform.position = pos;
        }
        if(Input.GetMouseButtonUp(0))
        {

            if(i>=3)
            {
                i = 0;
                Point[] _points = points.ToArray();
                Gesture candidate = new Gesture(_points);
                string gestureCLass = PointCloudRecognizer.Classify(candidate, trainingSet);
                spellname.text = gestureCLass;
            }
            clone.transform.parent = null;
            clone.GetComponent<TrailRenderer>().autodestruct = true;

          // GestureXML.GestureIO.WriteGesture(_points, "Triangle",Application.persistentDataPath+"test"+i.ToString()+".xml");
        }

sentences:
Working with retina graphics on Unity 2D I begun trying Unity for iOS 2D development.

I am curious about how to work with retina devices. The first thing I did was create a 1136x640 solid rectangle sprite and throw it into my scene, then run the game on my iPhone 5.

My expectation was that this image would perfectly fill the screen - that is, the retina would "kick in". Alas, this was not the case: my sprite was much smaller than the iPhone's screen.

Then I saw the main camera game object, and played around with the size property. By default is was like 5, but I determined that the number I needed for my sprite was somewhere around 3.2.

This works and looks fine in my phone. But I am unsure if this is how I am suppose to do things: what is the correct way of supporting retina images? I feel like guessing the size property of the main camera is a bit hackish. Actually, how do I know if Unity is indeed using retina?

sentences:
Can I speed up "potential fields" pathfinding when it's working on a large grid? I'm looking to implement a pathfinding algorithm that will allow me to throw hundreds of spiders at the players in my grid-based game. I can implement this with A*, but I'm worried that that algorithm has too high of a "per spider" performance cost.

The "potential fields" approach looks really good to me, but my map is quite large and rebuilding the entire potential field sounds expensive (even on a background thread).

Unfortunately, there's no logical divisions on my map where I could separate the grid into smaller grids. And the map is quite dynamic (walls/bridges can be destroyed, which could have huge impacts on pathing).

Are there any options other than reducing the size of the map?

sentences:
How to animate alpha channel of sprite color using Animator in code in Unity3D? I tried Animator + AnimationClipPlayable, but failed. Sprite disappears completely after 1 second, without animation happening. If I set "1" instead of "0" for final point, then nothing happens.

Code:

    AnimationClip clip = new AnimationClip();
    AnimationClipPlayable playable = AnimationClipPlayable.Create(clip);

    gameObject.AddComponent<Animator>();

    AnimationCurve alpha = AnimationCurve.Linear(0, 255, 1, 0);
    clip.SetCurve("", typeof(SpriteRenderer), "m_Color.a", alpha);

    gameObject.GetComponent<Animator>().Play(playable);

sentences: Nav Mesh Agent and obstacles I have a scene with buildings and a Nav Mesh Agent. Should all the buildings contain the Nav Mesh Agent obstacle component, or them having colliders and being higher than agents step height is enough for the agent to avoid them at all times?

sentences:
Help with moving object to mouse position I'm trying to make an object follow my cursor using raycasting. I'm creating the raycast each frame and checking the player's distance from the hit and whether or not the hit landed on an object tagged 'surface'. The code works fine with only one of those conditions, e.g. if I just check for the surface tag or just check the range, but when checking for both the object will only move to a few certain (apparently random) positions on the surface.
        if (Physics.Raycast(ray, out hit))
        {
                if (hit.transform.tag == "Surface" && Vector3.Distance(player.transform.position, hit.point) < range)
                {
                    obj.transform.Find("holo").gameObject.SetActive(true);
                    obj.transform.position = new Vector3(hit.point.x, hit.point.y + 0.5f, hit.point.z);
                }
            }

At first, I thought maybe the double condition was causing lag, but I have a powerful pc and I struggle to believe that two conditions in a frame are enough to create a noticeable loss in performance.
Video of the bug: https://youtu.be/mLug2ThX2hg ,
Full script just in case: https://pastebin.com/ruUXivsc
Any pointers would be greatly appreciated :)

sentences:
Unity saving and loading of images in game So I'm planning out this game for unity but I don't know how feasible it will be with all of the image loading and saving.  I've worked with some other coding, and while I am in the process of learning C# and Unity I don't have a very informed base for my opinion.

Basically the game will be inspired by the base mechanics of the Chaotic tv show where you have to adventure to take scans of creatures and these scans will be used in another aspect of the game as cards.  The creatures will be randomly generated.  The problem is I want the scans to be like actually taking a picture (A picture that includes all the stats of the creature).  This means I want to be able to save a picture of the scene with the creature in it as well as the stats associated with said creature which means I would have to have some sort of data base capable of storing hundreds (Possibly thousands if you include player made and prebuilt cards) of cards and the data associated with them.  The scans take a picture and record the stats of the creature at that point in time so they're only highly usable for the game when the creature is in near perfect condition (Not yet defeated or attacked).  I would have to be able to store scans of creatures, scans of the environment, and possibly scans of items found while adventuring.  I think it would work best if only a small picture of the actual scene is saved with the stats instead of the full card and the stats, with it rebuilding the card each time it's loaded into memory.  The small picture would also cut down on storage space (Possibly so small as to be high res pixel art)

Would it be unrealistic to save all of this data?  Aswell, does Unity/C# even have the capabilities to take screenshots from specifically defined areas of the screen/players view and then reuse them in another area of the game instead of saving them in some predefined screenshot area?

(This game will be entirely offline so no data will need to be transferred to a different system)  (Said game will also be 3d with the card playing area in 2d)

sentences:
What is the purpose of the macro UNITY_EDITOR? I found on a tips guide in Unity that I can do:

#if UNITY_EDITOR
do_something()
#endif

And do_something() will only be executed on Unity editor. Even more, when I build the game, that section of the code won't be compiled.

I found that as something very interesting, I thought it could be useful for example to use it on DrawGizmos methods since they can only be used on Unity Editor, and you don't need them on a finished product.

What has it been designed for? Is there anything bad that could come from using it?

sentences:
Concept design-pattern for industry simulation required I am making a mobile game simulating industry. A brief high level description is below.
A hub could be thought of as a base/city, within which there are rooms/buildings which determine what is produced and consumed.
Rooms/buildings need people to work them.
People have their own produced and consumed resources that need to come from rooms/buildings.
The buildings like machines in a production line have paths of commodity flow defined.
How to implement people with their own needs like thirst, sleep and illness while coordinating the buildings is causing me trouble.
I know many games have this same premise but can’t turn up enough info on their workings to help me. The real challenge is that I do not want to run the game where time passes relatively slowly and each person can move around and make decisions constantly.  I want to be able to change the speed of the game, likely from running a day every 30 seconds to a month every two minutes. So was focusing more on when changes to the system were occurring.
The number of hubs is likely to reach 80 each with 20 rooms and say 30 people to give an idea of scale.
Do you have any example games or coding approaches that could help light my way? Each concept I think through falls over.
Your help is very much appreciated and thanks for reading! If I have not included enough details please let me know, it is my first post so unsure how far to go into it.

sentences:
How can I plot points and generate a list of coordinates? Is there a program that lets me draw, a la pixel art, a map, and give me a list of coordinates and their corresponding colors? For example, I'd like to use a point and click interface to draw this

and then "export" this somehow.

sentences:
What is the most efficient way to render water? Would I create the water surface mesh in C++, and control the movement/animation in the CPU, and afterward apply any shaders (reflect/refraction/caustics/etc..).
Or should I only create the mesh in C++ and afterward control movement in the vertex shader?

It seems with the second approach, it would be more difficult to simulate more complex water models.

What is the most common approach in modern video games?

sentences:
Determine the direction of force when ball is moved through pipes I have set of pipes(edge colliders) in my scene, through which I pass the ball.

     ____|  |  <---Edge colliders
   o _______|

How do I move the ball in upward direction. For above this pipe I have to move along the positive x direction first, then positive y direction. How can I detect that.?

mRigidBody.AddForce (new Vector2 (moveSpeed,moveSpeed));

I tried this, but this can be used to move one direction at a time

sentences:
400 bad request UnityWebRequest hey everyone any ideas why im getting a 400 error? im trying to post a json to a subscription list. doing that through postman works just fine!
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class testing : MonoBehaviour
{
    //public InputField field;
    [SerializeField]
    private Email _email = new Email();
    private string URL = "https://a.klaviyo.com/api/v2/list/YeXzKp/members?api_key=pk_ec448e1bdab7504c143466ca5eeabc5e95&profiles=[]";
    IEnumerator SaveIntoJson()
    {
        string data = JsonUtility.ToJson(_email);
        System.IO.File.WriteAllText(Application.persistentDataPath + "Data.json", data);

        //UnityWebRequest www = UnityWebRequest.Post("URL", data);
        //www.SetRequestHeader("Content-type", "application/json");
        UnityWebRequest request = UnityWebRequest.Put(URL, data);
        request.SetRequestHeader("Content-Type", "application/json");
        yield return request.SendWebRequest();
        //yield return www.SendWebRequest();

        if (request.isNetworkError || request.isHttpError)
        {
            Debug.Log(request.error);
        }
        else
        {
            Debug.Log("Form upload complete!");
        }
        Debug.Log(data);
    }

    public void SaveData()
    {
        StartCoroutine(SaveIntoJson());
    }
}
[System.Serializable]
public class Email
{
    public List<Profiles> profiles = new List<Profiles>();
}

[System.Serializable]
public class Profiles
{
    public string email;
}

sentences:
Handling multiple agents in astar pathing When working with grid based path finding in how do you normally handle different agent types? In the game I am working on I have a regular agent, and one that occupies 2 cells on the grid, and one that can fly. The idea I have now is to use a separate AStar map to store the grid for each type. The height is max 4 units so I can use AStar for flying as well.

This keeps it possible to add new actor types as well but is it waste of memory? Also how to deal with avoiding nodes occupied by other agents? The game is turn based so I don’t want to do any object avoiding type thing. Is there a simple way to mark a node in the AStar as temporarily unwalkable?

I am using the Godot Engine and would like to use the in built astar implementation but I can create my own if really needed.

sentences:
Unity: Model Construction on the fly So, forgive me if some of the terminology is wrong, I am just getting started with Unity again and I can't remember the proper names. I'm also on my phone, so I didn't have unity in front of me when I posted this question.

I am beginning work on a voxel based game. Everything in the game will be models constructed of 64 by 64 cubes. I would like to, with the code given, say, a 4096 bit array, be able to construct a model in the game with those cubes. I know that you can programmatically add models that you have imported into unity, but I want to make contiguous meshes programmatically, with highest performance being the goal. I do not want a certain amount of little 1x1 cube meshes positioned right next to each other, but specifically one model.

Is this possible?

sentences:
Efficient physics and collision detection for RTS I'm thinking about writing my own RTS game and while I'm more or less clear about how the game engine should work, I need some directions as to how to implement physics and collision detection.

Now, I am an experienced programmer but I have never ever done game dev before, so please excuse me my poor/incorrect terminology.

There will be a large 3D (i.e. planes, hills, valley, etc) world with lots of units, moving and/or fighting simultaneously and lots of projectiles flying around. So the most important thing is, physics and collision computation must be very fast.

Could you please point me in the right direction?
Idea I'm elaborating on is some kind of 3D tiles, with every unit's position being x,y index of tile + elevation (e.g unit staning on the hill or on the fortress wall). the smallest unit will occupy for examle one tile horizonally and 5 vertically. With every tile having 3x3x1 aspect ratio (e.g. 15x15 horizontally and 5 pixels height).

How realistic is this? How would you approach this? Are there any 3d physics/collision engines which are fast enough for such application?

Hope for your help
Alex

sentences:
How can I achieve a 'warm' scene in Unity using post processing effects? I've recently fallen inlove with this Cozy Tavern scene by Beholder, and am looking to replicate it's feel the best I can in unity as a learning exercise.

A lot of the scene's depth is added through lighting, and post processing effects. The lighting is simple enough to where I think I can reasonably replicate it with some trial/error using different lights, however the post-processing is where I get a bit lost.

It's clear that there are a few different effects going on, one of which being the increase in saturation, and a limited depth of field.

My guess is that I would need to write a few different shaders (or rather one?) to add these effects? Any input as to how I could achieve similar results would be greatly appreciated.

No Post Processing:

With Post Processing:

sentences:
texconv produces texture with same size using BC1 or BC4 According to msdn, the BC1 block compression format is for images with 3 color channels and 1 bit alpha channel and the BC4 is for images with 1 color channel and no alpha.

Using the same RGBA input image I would expect the output of this command

texconv.exe -f BC1_UNORM diffuse.tga

to be larger than the output of this other command

texconv.exe -f BC4_UNORM diffuse.tga

Since the resulting DDS should only have information on one channel, but both DDS have the exact same size. The only difference being that the BC4 compressed one appears red (as expected).

Is this the expected output?

sentences:
Unreasonable CPU consumption for server build with nographics I have built my game in server mode on Mac OS and attached profiler to it. In profiler I can see unreasonable high cpu load.

Other scripts take a lot of cpu time. How can this be optimized?

Vsync takes a lot of time otherwise. How can it be since I have disabled VSync, built as server, run with -nographics and even removed cameras and UI?

sentences:
OpenGL Poor FPS when models outside view I have been testing my game to see how well it renders a few hundred complex models onscreen at once point but even when all the models are outside my viewpoint, i still get poor fps.

I have face culling enabled to get rid of back facing triangles, but I'm not sure how to stop processing triangles behind or outside my viewpoint.

sentences:
Using copyrighted sprites Possible Duplicate:
  How closely can a game resemble another game without legal problems

I was thinking about making a pacman clone, I know there is a similar question here Using Copyrighted Images , but I know i can't use the original art from the game because it belongs to Namco, so if I design a character that has the shape of the slice circle it will look exactly like pacman, maybe if I use green instead of yellow?
Also if the game plays like the original pacman, it is wrong?
I just want to make the game as a personal project and and publish it in my site without getting in trouble

sentences:
Should the interaction between the player and world objects be handled from the player class or as an event from the object classes? Suppose you're making a 3D platformer like Super Mario, if you jump on a Goomba, does Mario (the class) know that it just landed on a Goomba and then tell that Goomba to die, or does the Goomba realize that he is being smashed and dies ?
I want to go with the first approach but it will end up with a huge If/then (or Switch/Case) script, also the reason why this is "problematic" is that many objects will make the player have a "reaction", for example if you land on a Goomba, you don't just kill it, but it forces you to jump, that jump event, what's the best way to handle it ?
Thanks

sentences:
Is it possible to write a game with a HTML5+REST service architecture? As a side project I'd like to program a board game similar to Twilight Struggle. For this pet project I'd like to satisfy several non functional requirements:

The core logic must be written in Haskell
If I succeed, I'd like to sell it in platforms like Steam, Google Play and Apple Store.

The Haskell requirement limits me a bit about the range of frameworks to use and the Haskell+SDL2 route doesn't seem very mature when talking about porting to mobile platforms (maybe I'm wrong but I haven't found any easy tutorials on the topic).

So I've thought about an HTML5 Canvas talking to the Haskell core either through REST calls or websockets. The HTML5 canvas will be contained in a Cordova application or similar when in the mobile. What do you think about this approach in terms of:

feasibility
robustness
portability
software engineering
whatever other concern you might have

sentences:
Directx 12 ultimate. What has changed? We have Windows 10 2004 with new sdk, we have new nvidia drivers with support wddm 2.7 and Dx12U but I still can't understand - how it should help to developers write one code for all platforms?
I don't see any new D3D_FEATURE_LEVEL_12_2, I don't see any new feature to help developers write one code to xbox and pc. Developers still need to check if user has support for all new features as they did before. So what is changed? For me it looks like it was made only for non-tech users who will ask seller give him only GPU with Directx 12 Ultimate sticker and that's all.
Microsoft docs doesn't have any information about directx 12 ultimate, only some blog posts.

sentences:
Animating a background 'pulse' with easing equation I'm trying to find a suitable easing equation (or other method) to animate an object so that it 'pulses' (imagine a 'spike' on a music visualiser, or see the image I drew badly below)

'v' is the value I'm using to scale. 't1' and 't2' mark the end of a single pulse.

The game I'm working on is a puzzler, but I'd like to have objects in the background pulse in time with user-selected music.

I'm sure it's just a case of knowing what to search for, but any advice would be appreciated on how best to achieve this.

sentences:
Cannot click UI button in Unity I am working on Unity 5.4. I have an Event System, my UI has a parent canvas, Canvas has the graphic raycaster. I am not able to understand why this is not working. I have attached an image of the button script, Canvas, event system and my script.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Level01Controller : MonoBehaviour
{
    private int highScore ;

    void Update ()
    {
        if (Input.GetKey (KeyCode.Escape))
        {
            Application.Quit ();
            Debug.Log ("Clicked);
        }
    }

    public void StartGame()
    {
        Application.LoadLevel ("Level01_Game");
    }
}

sentences:
Smooth Scene transitions with SceneManager and additive scene in Unity I'm trying to work with the new SceneManager class with Unity, I'd like to have smooth transitions between scenes.
Currently I suppose that the only way to do those transitions is to manually implement them on the scene objects leveraging on the fact that scenes can be loaded additively.

In pseudo code I image something like:

for gameObject in previousSceneGameObjects
    gameObject.animateSceneExit()
endFor

for gameObject in nextSceneGameObjects
    gameObject.animateSceneEnter()
endFor

I feel that there is something I'm missing :P which is the best approach that you'd suggest? Is it my approach valid?

sentences:
How can I highlight and move to adjacent tiles in an isometric grid? I trying to create a turn-based strategy game where you move a game object from one tile of a grid to another tile near it. I have created the grid using sprites and game objects but can't sort out the movement part.

How can I highlight adjacent tiles given the 'current' tile, and then allow a game object to move to any of those highlighted tiles?

sentences:
Dijkstra's Algorithm - Infinite loop While running Dijkstra's Algorithm to assign a direction to every tile and when an object land on the tile, follow the direction to a goal. I encountered an infinite loop (or I think it is). The following is my code:

while (openList.Count > 0)
    {
        Debug.Log("Running alg");
        failsafe++;
        if (failsafe > 1000) { break; }

        Tile currentTile = openList[0];
        openList.Remove(currentTile);
        closedList.Add(currentTile);

        List<Tile> neighbours = GetNeighbours(currentTile.localX, currentTile.localY, grid);

        foreach (var neighbour in neighbours)
        {
            if (!closedList.Contains(neighbour))
            {
                neighbour.parentX = currentTile.localX;
                neighbour.parentY = currentTile.localY;
                openList.Add(neighbour);
            }
        }
    }

Under these conditions, the failsafe triggered and broke the loop. The grid is a 11x11 grid and as such by my understanding should have never reached 1000 cycles.

When the failsafe triggers, it explored 9 tiles away from the goal and the rest are unexplored.

What am I doing wrong here?

sentences:
AndeEngine Parallax / Sprite Depth? What I'm attempting to do is create a game in which a space ship explores a large area of space.  I'm randomly generating placement of planets, space stations etc.  I want to use the ParallaxBackground (I actually had to find a custom implementation which supports both x and y parallax values).

When a planet is generated I create a sprite, and add a new parallax entity to the background.

My issue is that when I place the sprite, it is not being placed properly (due to the parallax calculation I'm assuming).  As the player navigates further away from the origin (0,0 in world space), the offset from the position the object is supposed to appear in the background and the position in which it actually appears gets larger and larger.

Here is the code for the custom drawing of the ParallaxEntity2D:

public void onDraw(final GLState pGLState, final Camera pCamera, final float pParallaxValueX, final float pParallaxValueY) {
            pGLState.pushModelViewGLMatrix();
            {
                final float cameraWidth = pCamera.getWidth();
                final float cameraHeight = pCamera.getHeight();
                final float shapeWidthScaled = this.mAreaShape.getWidthScaled();
                final float shapeHeightScaled = this.mAreaShape.getHeightScaled();

                //reposition
                float baseOffsetX = (pParallaxValueX * this.mParallaxFactor);
                if (this.mRepeatX) {
                    baseOffsetX = baseOffsetX % shapeWidthScaled;
                    while(baseOffsetX > 0) {
                        baseOffsetX -= shapeWidthScaled;
                    }
                }

                float baseOffsetY = (pParallaxValueY * this.mParallaxFactor);

                if (this.mRepeatY) {
                    baseOffsetY = baseOffsetY % shapeHeightScaled;
                    while(baseOffsetY > 0) {
                        baseOffsetY -= shapeHeightScaled;
                    }
                }

                //draw
                pGLState.translateModelViewGLMatrixf(baseOffsetX, baseOffsetY, 0);

                float currentMaxX = baseOffsetX;
                float currentMaxY = baseOffsetY;

                do {
                    this.mAreaShape.onDraw(pGLState, pCamera);

                    if (this.mRepeatY) {
                        currentMaxY = baseOffsetY;
                        do {
                            pGLState.translateModelViewGLMatrixf(0, shapeHeightScaled, 0);
                            currentMaxY += shapeHeightScaled;
                            this.mAreaShape.onDraw(pGLState, pCamera);
                        } while(currentMaxY < cameraHeight);
                        pGLState.translateModelViewGLMatrixf(0, -currentMaxY + baseOffsetY, 0);
                    }
                    pGLState.translateModelViewGLMatrixf(shapeWidthScaled, 0, 0);
                    currentMaxX += shapeWidthScaled;
                } while (this.mRepeatX && currentMaxX < cameraWidth);
            }
            pGLState.popModelViewGLMatrix();
        }

This is far beyond my ability to understand in terms of the calculation required to figure out where in screen space the sprite needs to be placed for it to show up in the background properly.  I've gotten close by hacking together some simple math, but I want this to be perfect.

I guess first I need to understand what the above onDraw code is doing exactly.  Maybe there is another approach that would work better for this instance?  I explored being able to use the z component on a sprite, but I couldn't get this to work with GLES2 (the example for GLES1 is here).

sentences:
Using full resolution of depth buffer for 2D rendering I'm working on a front-to-back renderer for a 2D engine using an orthographic projection. I want to use the depth buffer to avoid overdraw. I have a 16-bit depth buffer, a camera at Z=100 looking at Z=0, zNear is 1, and zFar is 1000. Each sprite rendered sets its Z co-ordinates to increasingly distant values, allowing depth test to skip rendering anything which is underneath.

However I'm aware the way Z positions end up with Z buffer values is non-linear. I want to make use of the full resolution of the 16-bit depth buffer, i.e. allowing 65536 unique values. So for every sprite rendered, I want to increment the Z position to the next position to correlate to the next unique depth buffer value.

In other words I want to turn an incrementing index (0, 1, 2, 3...) of the sprite being drawn in to the appropriate Z position for each sprite to have a unique depth buffer value. I'm not sure of the maths behind this. What is the calculation to do this?

Note I'm working in WebGL (basically OpenGL ES 2), and I need to support a wide range of hardware, so while extensions like gl_FragDepth might make this easier, I can't use it for compatibility reasons.

sentences:
Transformations and basis vectors I've been reading this very nice tutorial on OpenGL, and I encountered a statement which I can't wrap my head around. In Chapter 6, it states:

  Transformation from one space to another ultimately means this: taking the basis vectors and origin point from the original coordinate system and re-expressing them relative to the destination coordinate system. The transformation matrix from one space to another contains the basis vectors and origin of the original coordinate system, but the values of those basis vectors and origin are relative to the destination coordinate system.

This is reaffirmed in Chapter 7:

  ... And this makes sense; a transformation matrix contains the basis vector and origin of the source space, as expressed in the destination coordinate system.

... But isn't it the other way around?

Take a look at this example from the tutorial:

The transformation Matrix to transform from the space on the left to the space on the right is

[1   0   0   1  ]
[0   1   0  -1.5]
[0   0   1   0  ]
[0   0   0   1  ]

The last column of the transformation matrix is the origin of the destination space, expressed relative to the source space.

What am I missing?

Note The above transformation matrix is not from the notes, so feel free to correct it.

sentences:
How is a Challenge implemented for a game networking protocol? Working on an authoritative online game using LiteNetLib. I've been reading about building a game network protocol and I'm feeling stuck with the "challenge" implementation.

The client requests a connection with the server.
The server then returns some sort of challenge (that only the client should be able to solve?).
The client returns the solution and the server allows the connection.

The first thing that I don't get is how to have a "pending" connection without accepting it to begin with. With LiteNetLib, this is how the server handles incoming connections:
listener.ConnectionRequestEvent += request =>
{
    if(server.ConnectedPeersCount < 10 /* max connections */)
        request.AcceptIfKey("SomeConnectionKey");
    else
        request.Reject();
};

From the looks of it, the server must decide whether to allow the client or not at this very instant. If I want to send or receive a challenge, I need to accept the connection first don't I? But that would defeat the point of the challenge implementation.
Is there a resource with an example of how this is done? The article doesn't really go into detail, and when I google things like "online game protocol challenge request packet" the results aren't quite related (almost as if the concept was coined by that article).

sentences:
How to implement a tractor beam? I'm working on a game where the player can pick up objects using something like a tractor beam, and carry them around.

Attracting the object towards the center of the beam is not difficult. But once the object is close enough to the center, I need to keep it there while the player moves, which is what I'm having problems with. I can think of two ways to do it, and both have issues:

Update the object's position whenever the player position changes, keeping it centered on the beam.
Update the object's velocity to point directly towards the center of the beam, the further away, the more velocity.

Moving and rotating works just fine with both approaches, but the physics are wrong when the carried object collides with other objects:

With the first approach, physics are completely ignored. The carried object just pushes anything out of the way. That is because position changes are only supposed to be done as part of the world physics, based on velocity.

With the second approach, physics basically behave how they should, but overreact. The problem is: In order to keep the carried object at the center of the beam even when rotating and moving, I need to use high velocity values. So once the carried object touches another one, it gets way too much velocity from the collision.

How can I implement this properly? My best guess right now is to go with the second approach and add special handling for carried objects to the world physics, reducing the velocity to sane values for collisions or when the player stops carrying them. But that seems like a pretty inelegant workaround.

Edit: Adding some pseudo code to illustrate how it works right now (that'd be the second approach above)

void attract_object(object, ticks) {
    Vector distance = beam_center - object.center;
    // If the object is not close to the beam center, attract it slowly
    if (magnitude(distance) > 10) {
        object.velocity += distance.normalized() * ticks * 0.1;
        return;
    }

    // Here comes the part we're talking about. That magic 0.5 is just high enough
    // that the object isn't lost while moving around. But it's still so high that
    // other objects are repelled with way too much force.
    object.velocity = distance * ticks * 0.5;
}

From what I see, this happens when the carried object pushes another object away:

The carried object collides with another object
The objects' velocities are distributes properly, so the carried object is pushed away from the center of the beam in the process
The code above causes the carried object to return to the center of the beam, with so much velocity that it'll get back there quickly
When the carried object moves back towards the center of the beam, half of its high velocity is transferred to the other object, repelling it violently. Since the initial velocity of the carried object appears to be sane, I can imagine that steps 2 to 4 are repeated multiple times, building up such a high velocity.

That appears to be the cause. I can't think of a nice way to fix it though :(

sentences:
Unity 2019.3 - Tilemap colliders 2D + Componsite colliders + Platform effectors I am using tilemaps to create my own platform game. This is what I had in the first place.

This was working fine in first place, but is an issue. Sometimes, the enemies get stuck while running along the platforms. This was probably due to a similar issue that I had, when the player was getting stuck on the walls. It was solved by adding a composite collider. So I did the same to solve this problem. With the composite, it was looking like this:

This solved the issue too. But now comes the catch. Those elements are also platforms, meaning that I have to add a platform effector. And while this works, there is a small edge case...

If I am in a height where I do not reach the top of the platform, but can reach the bottom part, somehow it can stand on it. This was not happening before using the composite collider 2D.

Why is this happening? How can avoid this issue?

I am using Unity 2019.3.9f1

sentences:
Unity3D Android - Move your character to a specific x position I want to move my character (which is a cube for now) to a specific x location (on top of a flying floor/ground thingy) but I've been having some troubles with it. I've been using this script:

var jumpSpeed: float = 3.5;
var distToGround: float;

function Start(){
    // get the distance to ground
    distToGround = collider.bounds.extents.y;
}

function IsGrounded(): boolean {
    return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
}

function Update () {
    // Move the object to the right relative to the camera 1 unit/second.
    transform.Translate(Vector3.forward * Time.deltaTime);

    if (Input.anyKeyDown && IsGrounded()){
        rigidbody.velocity.x = jumpSpeed;
    }
}

And this is the result (which is not what I want):

https://www.youtube.com/watch?v=Fj8B6eI4dbE

Does anyone have any idea how to do this? I'm using UnityScript (Javascript).

sentences:
How to get asset/model name from (custom) Content Processor in XNA 4.0 I'm trying to make multiple animations for multiple models in XNA 4.0 and I need to get the name of the model/asset from the content processor which is a custom one (XNA default I think), I'm trying doing this by the split method which requires reading from a file the animations but I need to get the model's name to match it with the files because I'll have several files for several models.

public override ModelContent Process(NodeContent input,
                                         ContentProcessorContext context)
    {
        ValidateMesh(input, context, null);

        // Find the skeleton.
        BoneContent skeleton = MeshHelper.FindSkeleton(input);

        if (skeleton == null)
            throw new InvalidContentException("Input skeleton not found.");

        // We don't want to have to worry about different parts of the model being
        // in different local coordinate systems, so let's just bake everything.
        FlattenTransforms(input, skeleton);

        // Read the bind pose and skeleton hierarchy data.
        IList<BoneContent> bones = MeshHelper.FlattenSkeleton(skeleton);

        if (bones.Count > SkinnedEffect.MaxBones)
        {
            throw new InvalidContentException(string.Format(
                "Skeleton has {0} bones, but the maximum supported is {1}.",
                bones.Count, SkinnedEffect.MaxBones));
        }

        List<Matrix> bindPose = new List<Matrix>();
        List<Matrix> inverseBindPose = new List<Matrix>();
        List<int> skeletonHierarchy = new List<int>();

        foreach (BoneContent bone in bones)
        {
            bindPose.Add(bone.Transform);
            inverseBindPose.Add(Matrix.Invert(bone.AbsoluteTransform));
            skeletonHierarchy.Add(bones.IndexOf(bone.Parent as BoneContent));
        }

        // Convert animation data to our runtime format.
        Dictionary<string, AnimationClip> animationClips;
        animationClips = ProcessAnimations(skeleton.Animations, bones);

        //split animations
        animationClips = SplitAnimations(animationClips["Take 001"], @"F:\Education\GP\GP\Animations\defs.txt");

        // Chain to the base ModelProcessor class so it can convert the model data.
        ModelContent model = base.Process(input, context);

        // Store our custom animation data in the Tag property of the model.
        model.Tag = new SkinningData(animationClips, bindPose,
                                     inverseBindPose, skeletonHierarchy);

        return model;
    }

I want to replace the "defs" with the model/asset name to make it load the correct animations.
Sorry if my question is vague or redundant.
Thanks in advance.
Is there something wrong with the question ? ._.!

sentences:
When handling key input, I'm getting a negative timeout value in my thread. What's going on? So I'm programming a game using Swing and AWT and I'm getting a weird error. As I check for input in my MenuState, which is just my Menu screen, it is telling me that the timeout value in my game loop.

MenuState.java:

package GameState;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;

import Handlers.MyInput;
import TileMap.Background;

public class MenuState extends GameState {

    private Background bg;

    private int currentOption = 0;
    private String [] options = {
            "Start",
            "Help",
            "Quit"
    };

    private Color titleColor;
    private Font titleFont;

    private Font font;

    MenuState(GameStateManager gsm) {
        super(gsm);

        try {
            bg = new Background("/Backgrounds/Menu.gif", 1);
            bg.setVector(-0.1, 0);

            titleColor = new Color(128, 0, 0);
            titleFont = new Font("Jokerman", Font.PLAIN, 22);
            font = new Font("Times New Roman", Font.PLAIN, 12);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public void update() {
        bg.update();
        handleInput();
    }

    public void draw(Graphics2D g) {

        bg.draw(g);

        //draw title
        g.setColor(titleColor);
        g.setFont(titleFont);
        g.drawString("Suddenly, Cold Pizza", 55, 70);

        g.setFont(font);
        for(int i = 0; i < options.length; i++) {
            if(i == currentOption) {
                g.setColor(Color.BLACK);
            } else {
                g.setColor(Color.RED);
            }
            g.drawString(options[i], 145, 140 + i * 15);
        }
    }

    public void init() {

    }

    private void select() {
        switch (currentOption) {
        case 0:
            //start
            break;
        case 1:
            //help
            break;
        case 2:
            //close
            System.exit(0);
        }
    }

    public void handleInput() {
        if(MyInput.isPressed(MyInput.BUTTON6)) {
            select();
        } else if(MyInput.isPressed(MyInput.BUTTON2)) {
            if(currentOption > 0) {
                currentOption--;
            }
        } else if(MyInput.isPressed(MyInput.BUTTON4)) {
            if(currentOption < options.length - 1) {
                currentOption++;
            }
        }
    }

}

And then the function that contains my game loop:

GamePanel.java:

public void run() {
    init();

    long start;
    long elapsed;
    long wait;
    boolean first = true;

    //game loop
    while(isRunning) {

        //start time
        start = System.nanoTime();

        update();
        draw();
        drawToScreen();

        //time elapsed
        elapsed = System.nanoTime() - start;

        //frame wait
        wait = targetTime - elapsed / 1000000;

        if(wait < 0) {
            wait = wait + 20;
        }

        try {
            Thread.sleep(wait);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

I'm getting the error in the Thread.sleep(wait). It says I have a negative value for wait, but in debugging, the value never appears to be negative.

If you need any more information, let me know and I'll post it.

sentences:
Texture-Mapping in Blender/XNA I have a simple Blender-Model (just a few faces). I want to add 2 Textures. (a special face should get Texture 1, the other faces Texture 2). This model I want to use in XNA.

The first Texture should be replaceable at Runtime by Code (the new image is generated based on user input).

So how do I best solve this: Using UV-Maps or Normal-based Maps in Blender? How can I access the Blender UV-Mapping in XNA? Or do I completely perform the Texturing in XNA (using Code or shaders)? And how (I´m new to this)?

sentences:
What is the simplest way to calculate distance in a 3D environment? What is the simplest way to programmatically calculate difference between two points in a 3D game environment?

I am trying to sort a list of light sources by how close they are to an entity, so that only the four closest light sources affect an entity at any given time.

sentences:
Articles about a plot in an open world There are plenty of articles about open world game design and writing plots. But have you guys come across articles or blog entries about designing an engaging plot in an open world game? What i mean by this? In TES:Morrowind you're introduced to mechanics and are given the "main quest" within the first 5 minutes and then you're free to go, learn, kill, do whatever you want. I've spent hundreds of hours playing the game, but i have never got to doing the "main quest" and i'm sure alot of people are in the same situation, be it Morrowind, Oblivion or Skyrim. Maybe it's the power of TES games and a true testiment to how great RPGs they are, however for me, thinking as a designer, it seems like a massive design failure. Maybe it's the fact that there's no actual threat that needs to be dealt with, maybe it's that, amongs all the well designed and interesting quest within the game, the "main quest" just doesn't seem so interesting.

I've got a game idea in the back of my head, i want to create an action platformer, but the "level selection" would be open world style "dunegons" like you find in MMOs. This is a vague and undeveloped idea, so don't focus on it, i didn't give this design much thought, however an issue arose, i can't figure out, in general, how to make the player care about the open world aspect (f.e. dealing with roaming, pillaging parties, doing a gauntlet run to get some special armor, clearing a water source from enemies, etc.) while "forcing him" to finish the game, carrot-on-a-stick kind of way. There are "crazy" people who will go search everywhere between cutscenes in FF games, but i'm aiming at the general audience. I want to create  a subtle system for guiding people throughout the game to a goal, while giving them an option of gaining power any way they want. This may aswell be impossible, but it doesn't hurt to ask.

I'm looking for articles or musings on this matter. Not solutions (since there's no design document, no direct solutions matter at this point), just thoughts from other people, probably with other games as a reference.

sentences:
How to change/modify or animate an existing OpenGL object on Android? I maybe know understand it all a little bit better so i thoug i make a new shorter question to eventually get an answer.

Get back or delete an existing OpenGL object, then change it and draw at new. How?

So if and Admin reads this post, he can feel free to delete it.

I'm working on OpenGL since a Week, so i'm new to the most stuff.
(also my englisch isn't the best. Hop you can understand the most anyway)

So i'm working on an Tamagotchi App for a school project and want to make it with OpenGL.
I allready came this far:

But now i want to animate things.
My mind told me that it shoud be possible to change or modify an existing OpenGL object.
In my situation there are 3 opjekts:

Body
Eyes
Mouth

For example her is my code from the mouth:

public class GLMouth {

private int points = 1000;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;
private FloatBuffer vertBuff2;

public GLMouth(){

    vertices = new float[points * 2];
    for(int i=0; i<= (points+3); i+=3)
    {
      double rad = (Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff=bBuff.asFloatBuffer();
    vertBuff.put(vertices);
    vertBuff.position(0);

    vertices = new float[points * 2];
    for(int i=0; i< (points+3); i+=3)
    {
      double rad = -(Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff2=bBuff.asFloatBuffer();
    vertBuff2.put(vertices);
    vertBuff2.position(0);

}

public void draw(GL10 gl){

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 0.15f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 1.0f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff2);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

}

}

In my renderer i just creat a mouth object and then draw it with mouth.draw.

So i thought i have allready drawn the mouth and now i can cange for example the gl.glScalef(1.8f, 0.15f, 1.0f); from that existing mouth to zero with some time in between to let it look like the mouth is closing.

But how can i do that?
I don't find anything with google, mostly because i don't know what i have to look up.
If i understand OpenGL right, than it will just draw new mouths over the original.

edit
Or it is a question about where is the opjekt? Can i save it an take it back (delete it etc) and draw it new with other properties.

sentences:
Task vs Thread with execution queue My game server will have to respond to requests very often, so I consider threading a good option.

But should I use Task class from .NET or have several threads that would execute requests which I would store in a queue (linked list). Which way would be faster?

sentences:
What is the range of RAM consumption for the typical 3D character in a video game? What is the average number of KB in memory for a 3D character?
Granted, this will obviously be biased based on what game we're talking about.
However, I am less interested in actual size in KB, and more interested in the range.
Simply, a general idea.

I want to know this information, to compare it to my 2D game. Currently, my 2D game has an almost exact scale for how much RAM a character takes up in memory.

The current formula is this: 95KB * Number of Animations * Number of Frames * Number of Directions. So for example, if a character had an Idle Animation with 15 frames, and a Walk animation of 15 frames, and there were 4 directions the character could move, the character would take 11.4MB in memory.

3D Characters have to load their mesh, textures, and animations. 2D characters simply load a image. However, with hundreds of animations- I can only imagine the 2D character would eventually exceed the memory requirements of a 3D character.

I need to get a general idea of how many characters I should limit on screen, how I should load my characters and their animations in memory, etc. I get some performance hits when swapping out textures in memory, probably because they are large spritesheets. I do not know if not using spritesheets would fix this or not. I was always told "Sprite Sheets are good for performance."

What about 3D games? Any example would work, and it doesn't have to be a real range. I just want to know what I may be looking at. An example of a lower quality 3D game and an example of a higher quality 3D game would be perfect.

sentences:
How to manage grid-based inventory with items larger than 1x1 cell? Me and my team have been trying to implement some sort of inventory system. We've set our eyes on an inventory system where some items may take up more than one box on the grid system, sort of like the one used in SOTS the pit, like this:

(source: webguyunlimited.com)

Notice how some items, such as the gun, take up more than one slot. How can we implement this? This includes checking to make sure that a slot we would like to insert an item in hasn't already been taken up (we may have irregular shaped items too).

sentences:
Identify controller/buttons using javascript Gamepad API Using the Gamepad API, or possibly some third party device mapping, is there a way I can associate buttons (gamepad api gives buttons by a numeric key value) to their controller counterparts?

For example, when using an xbox one controller with the PC, the "x" key is given by chrome as 2. I'd like to use the controller id/key value to show a picture of that happen to help new users.

It seems like this isn't something native to the gamepad API, but I'm not seeing any third party libs for it.

sentences:
Mythbuster: Mirror Operation with Quaternion Mirror operation : all vertex positions must be reflected by a specific plane (here YZ).Synonyms: FlipHorizontal, SymmetryX, MirrorX,

What implementations I already know that work:
1) Multiplying by -1 scale.
Unfortunately that is not allowed in unity because it messes with physics and lighting.
2) Vertex Manipulation. Yes, it works!!!

And now here comes the "Myth" from mr. evil person...
Mirror operation can be implemented if you get a "lucky" quaternion rotation. He says that:
a) if "euler rotation" suffers from Gimbal Lock, and Quaternion doesnt.
b) Then If quaternion (Matrix 4x4) cannot represent mirror operation, then increasing the #dimensions to Pentaternion (Matrix 5x5), Or Hexaternion (Matrix 6x6) is sure to solve the problem.

Note: I am not looking for "Reverse" operation (15 degree rotation converted to (360-15) degree rotation at that axis). I am looking for a way to "free" my model from those rotation limiting axes... I tried everything but couldn't achieve "Red" projection with a quaternion, maybe I miss something...

Is he right ? Or a quaternion cannot implement reflection and that myth is Busted?

Unity allows me to use all transform operations (Translation, Rotation, Instancing) but not scaling (messes up physics and lighting).

sentences:
glCreateShader causes segmentation fault I can't create a shader when trying to use shaders with sfml. The function glCreateShader(GL_VERTEX_SHADER); causes a segmentation fault. At first I googled it and found that it does that when the program does not have an opengl context. I tried SDL first but the poor documentation and "look at the header to know what to do" made me go for sfml

the code that causes the seg fault is bellow

    sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");

// Set color and depth clear value
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);

// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);

// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLuint vertShader = glCreateShader(GL_VERTEX_SHADER);

    //...

I'm including glew, gl.h, sfml-window, sfml-system, using opengl 2.1 on gcc linux.

What is missing?

sentences:
How do I change the window position in Unrealscript? So when I start my game it starts out in the middle of my screen at 1024x768 resolution, but then when I change the resolution via consolecommand("SETRES ..."); it resets the window position to the top left of my desktop.

Is there a way for me to set the windows position after I make this change?

sentences: How can a game engine's renderer be visually compatible with Maya's? Say you create some model in say Maya, you apply all kinds of effect to the model and then export the file. Then the game engine has to load the file and render it, so surely the game engine needs the same renderer as Maya's to reproduce the effects created in Maya?

sentences:
Testing Live Ads Before Publishing Admob I am testing ads with the test device method and test ads are showing perfectly but when I try to load live ads they won't load.

I have implemented the OnAdFailedToLoad which tells me that ads are not loading, this only happens when I try to load live ad but in the test ad everything works fine.

Does this happens all the time? we can't see live ads without publishing the game first? or there are no ads available at the moment if so when do the get available or they even get available for new users. How can I make sure that I will get live ads after publishing the on Google Play Store.

I don't know I am just confuse about this thing, I am using Unity 3D and building for Android.

I have searched on internet but everybody says that ads might not available at the moment I am just curious why are ads not available its been two days and I haven't seen any ad when are the ads going to be available. Thanks for reading this.

sentences:
Implementing Frame of reference for physics calculations How would I alter physical calculations to account for frame of reference of a physical body?

Currently I have a world that is a collection of rigid body objects that act on each other. There is no frame of reference for collision detection or resolution with respect to each body (i.e. body A has a velocity of zero when resolving a collision with body B and vice versa). The world is the reference frame, therefore everything is moving that has a non-zero velocity.

sentences:
when to unbind vao in drawing loops I am very new to open gl and am struggling to understand relation between vaos vbos and ibos
like how is currently bound vao related to currently bound ibo?

now i am trying to render 4 triangles with vertex data and index data for ibo as

float vertices[] = {
        -0.5f, -0.5f,  2.0f,     1.0f, 0.0f, 0.0f ,1.0,
         0.5f, -0.5f,  2.0f,     0.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.5f,  2.0f,     0.0f, 0.0f, 1.0f ,1.0,

         0.0f,  0.0f,  1.0f,     1.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.0f,  3.0f,     0.0f, 1.0f, 1.0f ,1.0,
         0.0f, -1.0f,  2.0f,     1.0f, 0.0f, 1.0f ,1.0,
    };

    float vertices1[] = {
        -0.5f, -0.5f,  0.0f,     1.0f, 0.0f, 0.0f ,1.0,
         0.5f, -0.5f,  0.0f,     0.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.5f,  0.0f,     0.0f, 0.0f, 1.0f ,1.0,

         0.0f,  0.0f, -1.0f,     1.0f, 1.0f, 0.0f ,1.0,
         0.0f,  0.0f,  1.0f,     0.0f, 1.0f, 1.0f ,1.0,
         0.0f, -1.0f,  0.0f,     1.0f, 0.0f, 1.0f ,1.0
    };

    unsigned indices[] = {
        0,1,2,3,4,5
    };

    unsigned indices1[] = {
         0,1,
         1,2,
         2,0,
         3,4,
         4,5,
         5,3
    };

and i am creating vaos  and ibos as:

unsigned int VBO[2], VAO[2], IBO[2];
    glGenVertexArrays(2, VAO);
    glGenBuffers(2, VBO);
    glGenBuffers(2, IBO);
    glBindVertexArray(VAO[0]);

    glBindBuffer(GL_ARRAY_BUFFER, VBO[0]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);

    glBindVertexArray(0);
    //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

    glBindVertexArray(VAO[1]);

    glBindBuffer(GL_ARRAY_BUFFER, VBO[1]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices1), vertices1, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices1), indices1, GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 7 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);

    glBindVertexArray(0);
    //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

And I am drawing it as:

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[0]);
        glBindVertexArray(VAO[0]);

        glDrawElements(GL_TRIANGLES, sizeof(indices1) / sizeof(unsigned), GL_UNSIGNED_INT, 0);

        glBindVertexArray(0));
        //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBO[1]);
        glBindVertexArray(VAO[1]);

        glDrawElements(GL_LINES, sizeof(indices1)/sizeof(unsigned), GL_UNSIGNED_INT, 0);

        glBindVertexArray(0));
        //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

If i dont unbind vao in the draw call then it will not be drawn as expected i.e. partially drawn lines or missing triangles.
Are'nt vaos supposed to override any previous bindings and bind a new one specified?
Even if i dont unbind vao after setting glVertexAttribPointer I get a blank screen! Then I got Totally confused on when to bind before doing what.
What does vao hold other than vertex attribute?like can i unbind ibo before vao?

sentences:
How do I calculate an offset from an Object based on the Objects Rotation rather than the World Space I have a Matrix of a player & I want to create a second location a set distance away from the first location but I want the second matrix to be set a set distance based on the rotation of the first matrix e.g. A player looking in a certain direction fires a gun, I want the bullet to start it's existence out side of the players mesh but in the direction the player is facing.

I've uploaded a video of what's happening:
http://www.youtube.com/watch?v=9aThUZ94Edo

Ideally I would like to just apply the players rotation Matrix to the Offset amount to get the proper offset Matrix, based in the world space co-ordinates to then be able to apply back to the object.

It's obvious at the end of the video that it's wrong when I am able to shoot the player model from his bullet :-)

sentences:
Determine if Plane is seen by Camera If I have an arbitrary plane (center and normal) or a quad (center, normal and width and height) and a camera (frustum, projection & view matrix, etc). Then how would I go about calculating if the plane/quad is visible to the camera?

Additionally how would I calculate to check if it's the front or the back of the plane/quad that is visible to the camera?

My first idea was to do some ray vs plane intersection, but then I realized that it of course wan't going to work!

bool plane_visible = false;
const float denom = plane_normal.dot(camera.getLook());

if (abs(denom) > 0.0001f)
{
    const float t = (plane_position - camera.getPosition()).dot(plane_normal) / denom;

    plane_visible = (t >= 0.0f);
}

Using the dot product of the plane/quads normal and the camera's look direction. Will give wrong results!

For instance, use the following image as an example! A dot product will tell me that I'm looking at the face that's facing outwards of the frustum. Though the face that I'm actually looking on is face facing inwards the frustum/towards the camera!

sentences:
Why is OpenGL provided with latest GeForce drivers so extremely slow? I'm writting a code in OpenGL and using two computers - an old and a new one.

On the old computer (which I use for debugging/creating implementation for the old GL) I have GeForce 5500 FX. Before windows reinstall on it, I had NVIDIA drivers with OpenGL 1.5. And everything worked perfectly. Games made quite good FPS, even with dozens or hundreds sprites.

However, after XP reinstall, I installed the drivers provided with my video card but it seems there's no OpenGL at all (mysterious 'GDI Generic' renderer). So I tried to download the newest NVidia drivers. After their installation I saw there's OpenGL 2.3 but when I runned my app it worked with extremely low FPS (about 0.25, I mean I had to wait four seconds for any app reaction) with only one sprite. And as I loaded smaller images, the FPS relatively increased, but on the new computer it's always (no matter how big and how many sprites) speed, so it must be the perfomance problem. Without any sprites, it seemed it worked normal, but game without graphics doesn't make any sense.

That's why I downloaded the oldest drivers for NVIDIA GeForce 5500 FX I found on the Nvidia site. But they're still providing OpenGL > 2.0 (2.1 exactly). The problem's the same.

I also tried to change all the properties of OpenGL to increase performance but it didn't help too.

So what can I do? I'd like to find drivers with OpenGL 1.5 but it seems they're not on the NVIDIA site and most people say it's the best to download they from there.

sentences:
How to stop 3D model from reflecting light like plastic I was browsing SketchFab and found a 3D model I decided to try in Unity.

This is how the model looks in SketchFab's viewer:

When I put it in Unity, I used a Directional Light object:

As you can see, it looks like plastic. I have been playing with the light's intensity, but the model seems to always reflect light as if it were some sort of plastic (unlike SketchFab's viewer).

How can I make it look like the above image?

The model is https://sketchfab.com/models/1ee9b44352c840bda4202895948c30bb

sentences:
Google on different versions of games I'm focusing on a game for the Android platform, and thinking of building multiple versions with different themes. Every one of them would have a distinct name, graphics, and content, but the same game engine.

I would be maintaining the same code base for these 20 apps. If I capitalize on this format with different themes, is that forbidden in Google play?

sentences:
Should I tell the player they have no chance of completing the level? Suppose a player has reached a point where they have absolutely no chance of completing the current level, and must restart it and try again.

Should I notify them that they will gain nothing by continuing the level and needs to restart? If so, how should I tell them that? Would a message box of some sort saying something like "No chance, start again" be good? Or should I let them continue to play and find out themselves?

Note that the levels are not huge, and mostly take about a minute each to complete. So for example, if the user missed the opportunity to level up after 30 seconds or so, should I stop the game and make them restart?

sentences:
Synchronization problem with Visual Studio 2017 and Unity 2017.1.1f Sometimes I need to change a lot of files and Clean and Rebuild the Solution to get the changes on Unity, am I missing some configuration on Visual Studio or Unity? I uninstalled everything and make a clean install and few days later I'm getting the same problems.

Sometimes if I create a stardard MonoBehaviour script from Unity and I try to attack it to a gameObject I get the error: "Can't add script component XXXXXX because the script class can't be found"(see image: screenshot). The class name and file name are the same, with no syntax errors.

Some times opening a file with an external editor changing the encoding, cleaning and rebuilding the project solves the problem, but just sometimes and I'm tired of do that for test any change, now I have a lot of Debug.Log just to check if Unity is getting my code changes.

Any suggestion will be very greatful

sentences:
Soft Body Collision with Box2d (libGDX) I've made a few classes to create soft body objects in libGDX using Box2D (specifically a circle and rectangle similar to these links).

The objects are constructed of a number of circle shaped Box2D bodies (hereafter deform points) connected together by distance joints which allow the object to "deform" when the deform points move around. Collision works more or less fine when the objects are colliding with other standard Box2D rigid bodies such as a box polygon (what they're sitting on):

The problem starts when two soft bodies collide. As you can probably guess from the way they're constructed, the two often pass through each other since the deform points for which Box2D handles collision are small and spaced apart, so they easily don't collide when the two soft bodies should. If the two bodies are placed like seen on the left in the following image, the circle passes through the square, rather than bouncing off the top of it as it should:

I've tried solving the problem (methods shown below) by tessellating the bodies more so that the deform points are closer together (left), which seems far too resource intensive and didn't affect much anyway. Then I tried enlarging the size of the deform points to fill the gaps (middle), which worked perfectly for the collision but as you can see caused problems mapping the texture to the object since the textures don't appear to collide. After that I tried to bound the outside of the object using polygon bodies connected between deform points using revolute joints, this works with the texture better and does prevent objects from falling through each other, but it stops the object from deforming properly.

I can't think of any more ways to tackle this problem, but I'm very new to Box2D and libGDX and maybe I'm overlooking a much more simple solution. I'll give any ideas a shot.

sentences:
How do I find out where a script is attached to in Unity? I'm using Unity 2017.03.0f3 and I have a scripts folder with scripts (C#).

Suppose I forget, or am working on someone else's project:

How do I know exactly which scripts are attached to what GameObjects or PreFabs, without clicking and going through all the Hierarchy objects please, and by first clicking on a script in the Project view?

I hope that's specific enough.

sentences:
Connecting an AI Agent to a Flash Game Overview
The game is a multiplayer simple real time strategy housed in a Flash application.  Players run the Flash client, and are connected to a server written in another language (the language is irrelevant).  Players compete against one another in games of 2~8 players.
My aim is create some way for people to create an AI agent to play in the same realm against human players, or other AI agents.  Akin to the Broodwar AI competitions, but in a much simpler game.

The current model
has players logging in to the lobby. Games seeking players are listed in the lobby.  Once the game acquires the amount of players required to start (defined by the host at game room creation time), the players are then pushed into a game, and leave the lobby.  Games then run through to completion; players who disconnect are left stagnant until destroyed or they login again and are reconnected to the game.

In a perfect world
the flash client (Using an MVC type model) would be able to interface in some way with the users AI agent, handing data to the agent, and receiving commands from the agent.  In this way the user could observe the game in the flash client while in play, as well as choose games for the agent to participate in.  This model would be ideal for debugging purposes, as to not interrupt play on crash, and since commands can only be sent (with malformed commands being ignored, with an error callback) users could pick out major bugs quickly.

However
flash is a prissy little nitwit when it comes to communicating client side to client side.  The only realistic options I can see would be to create a second client interface in another language (say .Net) that would be used to interface the AI agent, the player would then login to the flash client and enter games/observe in the above mentioned manner.  OR the flash client would create a second socket pointed at the local host.  A suitable API would be created to manage the communication protocol (as a DLL or similair) that would handle all data values of the game, and sending commands.  This API would be extended by the users AI agent, and the player would login to the flash client and join/observe games.

The Big Question:
From experience or observations, what would be the most suitable model for this type of a system?  I have no qualms with either, but due to the long timeframe of implementing each system (I work alone) I'd rather start off on the right path, and end up with an easy to use model.  Any suggestions at all are very welcome!

sentences:
How to adapt a webgl shader using mouse position to have symmetrical behaviour I'm trying to create a particular kind of effect for the background of my SpriteKit game, and I've found some shaders on shadertoy that are close to what I want, but I'm struggling to adapt them to do exactly what I want..

There are a few shaders that simulate the sun with atmospheric scattering based on its xy position.
here are some examples:
https://www.shadertoy.com/view/MsVSWt
https://www.shadertoy.com/view/MdtXD2

I want something similar to this effect but I want the glow to be symmetrical, so that when the 'sun' reaches close to bottom or top edge the glow effect is at a maximum, and when it is in the centre it is at a minimum. I've been playing with these shaders trying to get this effect but my understanding of webgl is clearly lacking as I'm struggling to achieve this.

What I've tried playing with is replacing variables such as sunPosition.y with abs(sunPosition.y) - my logic being that the y axis ranges from -1 to 1 so I should be able to get symmetry by making everything positive.. but this in fact has no effect.

If someone can nudge me in the right direction would be greatly appreciated as I'm now thoroughly confused by webgl!

sentences:
How to connect Unity with Arduino using Bluetooth module? I will be getting data in real-time from an Arduino. I want to display that data (such as rpm of a bike) in my Unity game and use it to control the subjects in the game.

I have Bluetooth module HC-05 which I want to use to send the data from the Arduino to Unity.  I found a plugin for this on Unity store but it costs $20.

Could you guide me on how to include Bluetooth access in Unity as well as Arduino?

sentences:
Access Entities components via the Entity that holds them, or via a separate System? Now, I'm implementing a component based game engine and I came to a thought: Which way should I access my components?

Have a list of Entities, which have a list of Components, and access them by going trough each entity, and updating/drawing/whatever on each component.

or

Have separate systems for each component type and acces them by going trough that systems components.

Or does it really matter? I think that the second way would seem faster...

sentences:
DX9 sprite / font draw depth order I need the ability to order the drawing of sprites and fonts. Some sprites need to be drawn behind and some in front of text. My problem is that my sprites and fonts use separate Begin() End() calls so I can't simply order the draw calls.

How is sorting generally done in DX9?

sentences:
click event not registered for an actor inside stacked cell within a table in libgdx In the following code segment, the click event for image element is not registered. However, if i comment out stack.add(shapeLabel) statement, then the image button is able to register the click event. Why is it so ?

        private Array<Shape> tableShapes;
        private Array<Stack> tableofStackedShapes;
        ....
        ....
        Stack stack = new Stack();
        Label shapeLabel;
        colorIndex = MathUtils.random(colorsList.size - 1);
        cellShape = shapesList.get(MathUtils.random(shapesList.size - 1));
        String filename = cellShape + "/" + cellShape + "_" + colorsList.get(colorIndex) + ".png";
        img = new Shape(cellShape, colorsList.get(colorIndex), new Texture(filename));

        if (this.currentLevel > 2) {
            int randomNumber = MathUtils.random(0, 9);
            img = new Shape(cellShape, colorsList.get(colorIndex), null, randomNumber, new Texture(filename));
            img.setSize(cellSize * ((float)stage.getWidth() / stage.getHeight()), cellSize);
            stack.add(img);
            shapeLabel = new Label("" + randomNumber, new LabelStyle(new BitmapFont(), com.badlogic.gdx.graphics.Color.BLACK));
            shapeLabel.setAlignment(Align.center);
            shapeLabel.setBounds(img.getImageX(), img.getImageY(), img.getWidth(), img.getHeight());
            stack.add(shapeLabel);
        }   else {
            img = new Shape(cellShape, colorsList.get(colorIndex), new Texture(filename));
            img.setSize(cellSize * ((float)stage.getWidth() / stage.getHeight()), cellSize);
            stack.add(img);
        }
        stack.debugAll();
        tableofStackedShapes.add(stack);
        tableShapes.add(img);
    }

My suspicion is on chaining of events, and that the label is restricting the click events to be detected by the img element. But I don't know what exactly is triggering this and how to fix it. Thanks for any inputs .

sentences: How can I rasterize 3D triangles in software? I am creating a 3D software renderer, and I have a wire frame cube rendering. Now I am working on solid color rendering and I am wondering what an efficient algorithm for shading the contents of the triangles would be?

sentences:
Making AI follow player in pacman game with grid I have an AI that I want to navigate a maze in order to follow the player. I thought of creating a large grid with the help of FloatRects, so I do it like this:

private List<FloatRect> grid;
//...
for(int y = 0; y < screenHeight; y += 16)
{
    for(int x = 0; x < screenWidth; x += 16)
    {
        grid.Add(new FloatRect(x, y, 16, 16));
    }
}

making each rectangle 16x16. Now I want to make the AI find the path that crosses the least amount of rectangles in order to cross the player, while avoiding walls. How do I approach this?

sentences:
Exception in thread "LWJGL Application" I'm using libGDX for my android game in which I'm trying to use bitmap fonts. I have created .fnt and .png bitmap files using Bitmap font generator of angel code.Both .fnt and .png have been placed under same folder /asset/data in my project.

Now when I try to run my project I get exception errors. Here is my sample code -

FileHandle handle = Gdx.files.internal("data/calib.fnt");
FileHandle handle2 = Gdx.files.internal("calib_0.png");
font = new BitmapFont(handle,handle2,true);
font.draw(batchmaker, "abcdef", x,y);

The error on console looks like this (showing only relevant lines):

  Exception in thread "LWJGL Application"
  com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file:
  data/calib.fnt . . . at
  com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.(BitmapFont.java:809)
  Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid font
  file: data/calib.fnt

I do not believe this error has something to do with issue with paths, because it gives me different errors when I play around by changing the paths.

I have been trying to fix this since almost last 2 days but couldn't come up with a solution. Can someone please let me know what could be the problem or am I missing something?

Edit: Or could there be some checks in which the parameters of calib.fnt is not passing (due to upper/lower case name mismatch with libGDX lib files) ? Please help!

sentences:
How to calculate a normalized direction of two rotations? In Vector math and translations we can do:

dir = (v1 - v2).norm

and then v1.translate(dir * 50) so v1 moves to the v2's direction.

What about rotation and eulerAngles?

Here's my attempt, but it doesn't work, probably from some obvious reasons.

Vector3 initial = ob1.transform.rotation.eulerAngles; // get it's initial rotation
ob1.Rotate(new Vector3(0,0,90)); // rotate
Vector3 after = ob1.transform.rotation.eulerAngles; // store new rotation
ob1.Rotate(new Vector3(0,0,-90)); // rotate back to initial

// here I need to calculate the direction so I can do rotate(dir * 50); or something similar

I need to get the rotation direction, so I can rotate the object continously with direction, not with a fixed desired angle value.

To be super clear, I need to get this blue line direction:

The object is initially rotated by (0,0,57).
I need to rotate it around it's center (green axis).

I know I can do logo1.transform.RotateAround(logo1.transform.position, logo1.transform.up, 80); and it works, but I need the direction from this, so I can use it in Tweening.

sentences:
is mvc design pattern good for developing video games? how mvc design structure works in game development and specially in unity game development.

I know what mvc is and how it works but in coding structure for game development specially in unity I don't know how it really works.

as you may know is it a good structure for developing video games? if its a yes, why and how it should be used?

thank you for helping

sentences:
How to get a game done? My problem is, whenever I start programming a clone of a game (for practice) or my own game or some other problem I stop somewhere in the middle of the development, because I lost interest in it.

How do you keep up the interest in developing a game, or developing in general?

sentences:
Spine: export both skeleton and spritesheet I am follow this tutorial for animation using spine. In this tutorial, they are import components separately (i.e: head, body, hands, legs ...). After I finish animation part, I want to export to json. After export to json, I check content, I see this:

{
"skeleton": {
    "hash": "3EPAHc7vcP4zQ93w+eSLhR5M6YQ",
    "spine": "3.6.53",
    "width": 205.5,
    "height": 506.79,
    "images": "../../Downloads/SpineElf_START/"
},

I see that images path is absolutely. Moreover, they are using images separately based on file name.

"lArm": {
            "lArm": { "x": 59.26, "y": 8.91, "rotation": 76.18, "width": 69, "height": 142 }
        },

I want to use spritesheet. I don't have much experience in this field. So my question is: We will import spritesheet from very first time start project or there is an option in spine that allow export json file + spritesheet.

Thanks

sentences:
C# Adventure Game - Simple Dialog System For school we have to make a small adventure game in C# (Visual Studio 2015) with a custom game engine made by our teacher. Now I want to implement a small dialog system between Liz (The main characer) and her teddybear.

The way I would like it to work is by using buttons. The bear starts out with "I can't let you pass Liz". Then the player can choose between three options (which are buttons) 1. [Question] 2. [Demand] 3. [Observe].

I am just not sure how to implement this and what would be the most efficient way of doing this codewise. To make it a bit more clear I've added an image of the entire dialog that needs to be implemented.

Any help/tips would be welcome!

Thanks in advance

sentences:
How do I get the size of a Plane in pixels and set it multiplied by some factor to be the size of a Sphere? I am doing an attempt to make a 3D snake game, as an experiment but I am still a beginner. I have a Sphere that I wish to dynamically resize to be, let's say, the 20th part of the width of this Plane. How can I do this? I thought to find the size of the Plane first. I also thought to use Screen.width and Screen.height because in my actual project the Plane is almost the size of the screen, but from what I found the Transform class does not have a way to resize it to a specific dimension in pixels.

Using the code below I do not get this work, but I also see that the Sphere becomes a black circle because of the only instruction in the Start method.

Existing code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

// Attached to the Plane
public class SphereResizer : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        // what should I put here?
        GameObject.Find("Sphere").transform.localScale = new Vector3(1f, 1f);
    }

    // Update is called once per frame
    void Update()
    {
    }
}

Screenshots

Download the example

Here is the GitHub repository.

Thank you.

sentences:
How can I create my own GameTime for timing things in my game? I have a Game class and a GameComponent class. I want to perform operations inside the GameComponent class which depend on calling gameTime.ElapsedGameTime.TotalSeconds, but I've noticed that that value is always 0.

At the moment I am initializing gameTime inside the GameComponent class by doing new GameTime();

I had the thought that somehow I should take the gameTime variable of my Game class, but I was not able to find a way to do so. I had always used Update(Gametime gameTime) and Draw(Gametime gameTime) methods in the past, which automatically gave me a game time object.

Now, that I need to deal directly with gameTime to run my own timing information, I see that it is a little tricky because I don't understand how it works properly. How can I create a timer for my own use?

sentences:
Player can only dash towards to the top right, but can't in any other direction? I have a dash mechanic, but it only seems to be working when the player is going up, down, left, right, or to diagonally to the upper right. It won't work diagonally in any other directions, and I can't figure out why?
The super weird thing is this problem only happens when my game is running on my computer, not on my laptop?? Any ideas on how I can fix this? Thank you!
void FixedUpdate()
    {
        if (dashing)
        {
            myRigidbody.AddForce(direction * dashspeed/3,
            ForceMode2D.Impulse);
        }
        else
            myRigidbody.AddForce(direction* thrust/4.75f,
            ForceMode2D.Impulse);
            myRigidbody.AddForce(direction * -thrust * 7f,
            ForceMode2D.Force);
        }

void Update()
{
    direction.x = Input.GetAxisRaw("Horizontal");
    direction.y = Input.GetAxisRaw("Vertical");

    if (Input.GetKeyDown(KeyCode.Space) & powerSlider.value > 0)
      {
        if (direction.x != 0 || direction.y != 0)
      {
        if (CanDash) elapsedTime = 0f;
      }

if (elapsedTime < duration)
            {
                if (!dashing)
                {
                    CanDash = false;
                    dashing = true;
                }
                elapsedTime += Time.deltaTime;
                }

        if (elapsedTime > duration)
        {
            if (dashing)
            {
                dashing = false;
                elapsedTime = Mathf.Infinity;
                StartCoroutine("DashCoolDown");
            }
        }

        if (elapsedTime >= duration)
        {
            elapsedTime = Mathf.Infinity;
        }

    IEnumerator DashCoolDown()
    {
        Debug.Log("dash cooldown");
        yield return new WaitForSeconds(.45f);
        CanDash = true;
    }

}

sentences: How can I check on a large number of points to see if they're inside the camera's frustum? I have a locally stored database on my Android project, it is a database of approx 100,000 Point3D(double,double,double). I need to check if each of these points are inside of the camera's frustum in unity. Will I most likely be running into performance issues querying the database and feeding all live Point3D's to unity per frame? What would be the best way to go about this if I am approaching this from the wrong direction?

sentences:
How to identify entrances of a cluster in HPA*? Recently I've become interested in understanding and implementing HPA* in a RTS game. I've found the following presentation which is really good for explaining how HPA* works: https://harablog.files.wordpress.com/2009/06/beyondastar.pdf

At slide 28 it says "identify entrance points between clusters". Slicing my map into several clusters is easy, but I can't get the idea how to identify the points between clusters. "Should I take the middle? Border points? All of them?"

I've struggled to look at some implementation in java, C# or C++ but games like 0 A.D. use a different strategy for implementing hierarchical graphs mixed with Jump-point search. Others like libgdx-ai use multi-level HPA* and can't find an implementation simple enough to understand and reproduce, specially on the matter regarding entrances and how to connect them.

Can anyone enlighten me?

Thanks

sentences:
How do I use music analysis in a game? I'm thinking of writing a game in the vein of BeatHazard (where the music you're listening to affects the game), and after researching the subject of music analysis in programming, I know enough to know that it's a very complex subject.  So here are some questions:

What concepts do I as an engineer need to know about to do this?  What concepts do I probably not need to know about?
What kinds of analysis are simple, robust, and efficient enough to be used in a game (and preferably in that order - I would greatly prefer simplicity over efficiency and can trade some correctness if it keeps things simple)?
What cross-platform open source libraries exist that are easy to build and include?  I'm using MonoGame, but I'm willing to use p/invoke for a good library.  I've read about aubio, clam, and marsyas, and I'm not quite sure which I'm looking for.

sentences: Creating lots of sprites dynamically in libgdx I´m creating Groups that contains Sprites and adding bodies with box2D, but when I create many of this my animation gets very slow. How can I handle it?

sentences:
Collision with 2 of the same objects I'm looking to make a button that is activated by two of the same objects, but the code I'm using doesn't recognize the second object as a different instance. Not the best explanation but here's the code:

if place_meeting(x,y,obj_cube) && place_meeting(x,y,obj_cube)

So the game sees this as just one obj_cube and the button is pressed even if there is only one cube on the button. I've tried using variables but I might be doing it wrong.

sentences:
Bulk level when user gets bulk exp I've been working with this for the entire week now, this is about a leveling system of my application. When a user gets the enough exp needed, it gets leveled up, everything works fine. But, when a user gets a bulk exp, it won't get a bulk level as well. The default for exp needed for every user is 1000. For example:

The user gets 1000 exp, for level 1, it gets leveled up to level 2. It works fine that way, but if it gets more than the exp needed the flow won't work the same way. Because the exp needed for level 2, is 1400. So the algorithm for this if the user gets enough or more than the exp needed, the current exp_needed for the next level is multiplied by 1.4.

if($user->level <= 19){
   while($user->curr_exp >= $user->exp_needed){
   $user->level += 1;
   $user->curr_exp -= $user->exp_needed;
   $user->prev_exp = $user->exp_needed;
   $user->exp_needed = $user->prev_exp * 1.4;
   $user->save();
  }
}
elseif($user->level >= 20){
 while($user->curr_exp >= $user->exp_needed){
 $user->level += 1;
 $user->curr_exp -= $user->exp_needed;
 $user->prev_exp = $user->exp_needed;
 $user->exp_needed = $user->prev_exp * 1.1;
 $user->save();
 }
}

Edit : The levels 1-20 and their exp_needed is working fine now, but when I'm at Level 21, I'm having troubles with the exp, because the exp_needed at level 21 should only be multiplied by 1.1,

For example,

Scenario 1:
The User will earn a curr_exp(current exp) of 2,100,000 the user will jump on to level 21 with an experience of 836,6825.55 which is wrong because the exp_needed at level 21 should be the sum of the prev_exp(level 20 = 597,630.40) multiplied by 1.1 which will be

(prev_exp of level 20) 597,630.40 * 1.1 =  657,393.44

Scenario 2:

The user gets an exp of 2,000,000 it will be on the level 20 with an exp of 508,424.01 with an exp_needed of 597,630.40 and when it gets another exp of 100,000 the user will be leveled up to 21 with an exp_needed of 657,393.44 which is correct.

So to summarize each scenarios results:

Scenario 1:

Level 21
Exp:10,793.61
Previous Exp: 597,630.44
Exp Needed for the next level: 836,682.55

Scenario 2:

Level 21
Exp: 10,793.61
Previous Exp: 597,630.40
Exp needed for the next level: 657,393.44

Scenario 2 should be the results I am seeking for but it doesn't work that way on my while loop. Any ideas how to deal with this? Thank you.

sentences:
Using this.GameObject I once read (I actually don't remember where, I'm looking for it) that using this.GameObject to call the script owner is a very bad practice.

I believe it has to do with some sort of information hiding, but I couldn't figure out why. What are the disadvantages with this? Is there a best-practice to achieve the result?

sentences:
How to produce assets effectively on large Flash game projects? I have been working on Flash games professionally for two years now and somehow, having our artists producing assets the right way is one of our biggest challenge.

More precisely, it is very hard to have them following any kind of structure and/or standards, nor taking into consideration performance. I would say also the most of our issues concerns UI and related animations.

Our current workflow is (on a Facebook hidden object game) :

Artists produce PSD and animate prototypes in Flash
Artists re-organize their FLA files to be a bit more "programmer friendly"
Programmers retouches assets until they have the right structure and export classes inside a SWC, from Flash
Programmers try to improve performances, sometimes degrading the quality of game graphics

Our main idea is to hire somebody dedicated to prepare assets for programmers but I am really looking forward to improving the pipeline.

I was wondering if you guys have tips of any kind to improve this workflow, whether it be team organization, training, tools or tips with Flash. Any explanation on your asset pipeline is well appreciated too.

EDIT :

Thanks for your replies. I do agree with you that tools and processes will never replace collaborative people. However, I feel like we got stuck into this "I am doing my own thing" mentality as the integration process caused a lot of friction. As part of our Scrum process, the team clearly acknowledge its own quirks and was looking at immediate solutions for the next project : better rules, better attitude, better understanding of each other.

My team have specialized artists (UI, character drawing, character animation), but no leading art director (we use existing licenses/brands), and programmers (both front and back end). That's why having a very versatile person in between (designer, integrator, technical artist or however you want to call it) is invaluable in my opinion - so, I am looking for innovative solutions.

Usually, the main specs/requirements for assets are :

Naming (of classes, textfields or various visual objects that will be used by the code, taking in account that visual needs can cause deep nesting of objects)
States (that we implemented with frame labels)
Alignement (always build from 0,0 - use round values)

So, while adopting "good practices" can sure help, there always is this little part of feature-specific requirements that has to be decided. Basically I was looking for a an efficient way to communicate these specs (even to non-technical people) and avoid the back and forth to verify assets are as expected (this is where my idea of intermediate validation format comes from).

I understand there is no clear answer and I created this post to get people feedback and good ideas (it's working so far :)

sentences:
blurry image rendered I'm using Direct2D to render a PNG image using a ID2D1BitmapRenderTarget and then caling it's GetBitmap() function and rendering the image using ID2D1HwndRenderTarget::DrawBitmap().

Some of the images rendered this way are clear but others appear blurry. I did some research and followed a tutorial to make my application "DPI Aware" but it didn't help.

(sample with a blurry image on the left)

What could cause the rendered image to appear blurry? Has anyone experienced this issue before? What can I do about this?

sentences:
How to save boolean to player prefs in Unity? I'm making a player settings thing where the user can turn off or turn on the game music by clicking buttons. I had this script below and everything was working fine.
 private GameObject music;

 public void Start()
 {
     music = GameObject.FindGameObjectWithTag("Music");
 }
 public void YesButton()
 {
     music.SetActive(true);
 }

 public void NoButton()
 {
     music.SetActive(false);
 }

I want to save it as player preferences so when they go out and back into the game, their settings would be saved. How would I do this? This is what I tried:
 private GameObject music;
 private bool musicOn = true;

 public void Start()
 {
     music = GameObject.FindGameObjectWithTag("Music");
 }

 public void YesButton()
 {
     musicOn = true;
     PlayerPrefs.GetInt("MusicOn", (musicOn ? 1 : 0));
 }

 public void NoButton()
 {
     musicOn = false;
     PlayerPrefs.GetInt("MusicOn", (musicOn ? 1 : 0));
 }

 void Update()
 {
     PlayerPrefs.SetInt("MusicOn", (musicOn ? 1 : 0));

     int value;

     value = musicOn ? 1 : 0;

     if (musicOn)
     {
         value = 1;
         music.SetActive(true);
     } else if (!musicOn)
     {
         value = 0;
         music.SetActive(false);
     }
 }

But it doesn't work. When I click the "no" button, the music turns off but it turns back on when I go back into the game. How would I fix this problem? Thanks for your help!
New code that mostly works:
public GameObject music;
public bool musicOn = true;

public void Start()
{
    music = GameObject.Find("Music");
    bool musicOn = PlayerPrefs.GetInt("MusicOn", 0) > 0;
    if (musicOn)
        YesButton();
    else
        NoButton();
}

public void YesButton()
{
    music.SetActive(true);
    PlayerPrefs.SetInt("MusicOn", 1);
}

public void NoButton()
{
    music.SetActive(false);
    PlayerPrefs.SetInt("MusicOn", 0);
}

sentences:
Tennis game algorithm and maths Tennis courts are real dimensions and game is 3D

Ball has position (x,y,z), speed(vx,vy,vz) and acceleration (ax,ay,az)

Game has 30 fps and on each update (1/30sec) it has these properties

vx +=ax;
vy +=ay;
vz +=az;

ball.x += vx;
ball.y += vy;
ball.z += vz;

function hitBall(destinationx, destinationy=0, destinationz) {
    // calculate vx, vy, vz, so ball imapcts  the point (destinationX, 0, destinationZ)
    // destinationY = 0 = bounce on floor
    vx = ....
    vy = ....
    vz = ....
// I guess this problem has infinite solution, so we must intersect with 1 point
// intersection line is (x,1,12)
// 12 is middle of the tennis court and 1 is 1 metter above the ground.
// ball passes there 1 meter above the ground.

}

Any clue on how to resolve that math problem ?

regards

Google doc :
https://docs.google.com/presentation/d/1EiUYpalDXlJUgjg8aIxLiWENgZJW7fnH4bGHsj1jb9I/edit?usp=sharing

sentences:
LibGDX Bounding system with tiledMap, 3D model player and ortho cam Begins explaining my achieve: as I said in my last question, I am tryna makin' a 2D game with 3D player as Factorium. For hours I am tryna to make a kinda of bounding system:
1)Camera will follow player untill the left border of the screen will reach the left edge of the map
2)If left edge has been reached, only player keep walking towards left
3)Once player come back, camera will follow player again only when it will have reached the right distance
These steps for each side

First image: left edge of the map still not reached, so camera keep following player constraints it at its center.
Second image: camera reached it, but layer kept waling, then begins come back
Thirds image: distance between player and left edge is at lest as half camera viewport, so camera begins follow player again.
Of course, I tried something...
/**
 * Using tile map proeprties
 * @param translateCords how much player has to be moved
 * @return if the player can me moved
 e.g. if the camera will not be over the map's edge
 * after have been moved
 */
private boolean canPlayerMove(Vector3 translateCords) {
    Vector3 playerPos = this.entityPlayer.getPosition();
    Vector3 futurePos = playerPos.add(translateCords.x, translateCords.y, 0);

    TiledMapTileLayer.Cell cell = ((TiledMapTileLayer)this.tiledMap.getLayers().get(0)).getCell((int)futurePos.x, (int)futurePos.y);
    return cell.getTile().getProperties().containsKey("blocked");
 }

This for move camera
     /**
 * @param translateCords how much camera has to be moved
 * @param camPos current camera position
 * @return if the camera can me moved
 e.g. if the camera will not be over the map's edge
 * after have been moved
 */
private boolean canCameraMove(Vector2 translateCords, Vector3 camPos){
    if( (translateCords.x < 0 && camPos.x - this.viewportWCam >= 0) ||
        (translateCords.x > 0 && camPos.x + this.viewportWCam <= this.widthWorld) ||
        (translateCords.y < 0 && camPos.y - this.viewportHCam >= 0) ||
        (translateCords.y > 0 && camPos.y + this.viewportHCam <= this.heightWorld)) {
        return true;
    }
    return false;
}

I tried a lots of other stuff...

sentences:
Protecting/Handling game data I have been working on a web based game, in which involves a lot of javascript/PHP. My question is what is the most secure way to handle any data being passed between the two languages?

At this moment I am currently using javascript to preform any required functions such as making objects appear for you to click and then awarding points for clicking that object.

I know javascript isn't the best way to handle the data due to how accessible it is on the client-side. I currently use ajax to pass the points gained from a click, to PHP where it can then assess whether the points were gained fairly or by an exploit.

This works, however when it comes to making sure that the user doesn't abuse a function in the console such as "Spawning an object" I run into some issues, as I can't seem to think/find of a way to achieve this. At the moment I have it so when the game starts an interval begins which displays an object based on a random value and then when the user clicks that object it gets destroyed and their score is sent to a PHP file to check the action was legit.

Is there some sort of way I can make a checker in the PHP file to make sure that an object can only be spawned if the browser calls it and not the client. I know you can't stop a user from using the console, its more of thinking of a system to judge/evaluate whether an action is allowed by a user.

sentences: Can't get debug spew for Direct3D9 The Direct3D9 debug runtime's debug output does not appear to be working correctly. I linked against d3dx9d.lib instead of d3dx9.lib and defined D3D_DEBUG_INFO and I also set the debug runtime on in the Direct3D control panel. However, there is still no D3D debug spew in the Visual Studio Output window. Any suggestions as to what I'm missing?

sentences:
Unity - Instantiated prefabs do not adapt to UI Layout I have a small container, where I want listed a series of buttons. I try to fill them at Runtime like this:

using UnityEngine;

public class FillWithGearData : MonoBehaviour {
    public Transform SelectGearButton;
    public Transform GearPanel;

    void Awake() {
        Transform button = Instantiate(SelectGearButton, new Vector3(0, 0, 0), Quaternion.identity) as Transform;
        button.SetParent(GearPanel);

    }
}

But the buttons added at Runtime are not adapting to the Layout, even though the ones added before runtime seem to adapt without a problem.

Demo:

What is going on?

sentences:
A two player game with a split screen In the antique game spy vs. spy, two players play on a single computer. The screen is split, with each half showing the viewpoint of one player.

Is it possible to create such an effect in Unity? The main problem is that Camera.main is a global variable, so it is not clear how to have two cameras.

sentences:
Most efficient method to render 1,000s of unique space scenes? I'm an artist with a concept, not the developer, and I'm trying to wrap my head around the approach I should be taking for the following scenario, namely whether to model in Photoshop or 3DS Max.

Say I have a simple animation loop of a rotating planet with a moon orbiting it that I want to play in the background of a game menu screen. Thanks to your help I have some ideas as to how to represent this illusion in 2D. But what if instead I had thousands of different scenes of this nature I wanted to represent in-game, using different planets, moon configurations, orbiting ships, passing asteroids, various backgrounds, etc. I assume that attempting to render these as video files and apply individually as movie texture is out of the question due to hardware and/or storage limitations on mobile devices, and that the scenes would be too complex for spriting.

Would I be best off using a 3D game engine to individually render constituent objects (a rotating planet, an orbiting moon, a drifting debris field) and then place them in front of a static backdrop (a JPEG of a nebula and star field, for example)? I assume for the same reasons as above that you wouldn't actually pre-render these objects, but instead send instructions to the game engine to draw a sphere, map a couple of textures to it, give it rotational parameters, etc.? Is this basically how it works? What about for the non-simple shapes like asteroids, ships, etc., can you also send a model parameter?

Keeping in mind that these scenes will be backgrounds only and non-interactive, am I on the right track?

sentences:
Weird block selector selection (to floor or not to floor)? Well, I am creating a Minecraft like engine in XNA, and since I first implemented the block selector (the cube that allows you to select blocks in 3D space) it has always been very inaccurate. Here is what I mean:

And here is the code that does the selecting (note that I have tryed to ceil then floor the vectors but none correct the abnormal positioning of it):

private Block GetSelectedBlock()
{
    Block block = new Block();
    block.BlockType = BlockType.none;

    for (float x = Variables.SELECTION_MIN; x < Variables.SELECTION_MAX; x += 0.1f)
    {
        Vector3 targetPoint = camera.Position + (camera.LookVector * x);
        //targetPoint = Util.FloorVector3(targetPoint);
        //targetPoint = Util.CeilVector3(targetPoint);

        blockSelector.UpdatePosition(new Vector3((int)targetPoint.X, (int)targetPoint.Y, (int)targetPoint.Z));
        block = world.GetBlock((int)targetPoint.X, (int)targetPoint.Y, (int)targetPoint.Z);

        if (block.BlockType != BlockType.none)
        {
            blockSelector.Visible = true;
            break;
        }

        blockSelector.Visible = false;
    }

    return block;
}

Also the two following screen shots show where the block selection cube is placed when I do call the blockSelector.UpdatePosition() function but do not cast the values to integers:

Any ideas what I am doing incorrectly?

Also regarding Blecki's answer here is what I implemented based on his idea:

       private Block GetSelectedBlock()
    {
        Block block = new Block();
        block.BlockType = BlockType.none;

        for (float x = Variables.SELECTION_MIN; x < Variables.SELECTION_MAX; x += 0.1f)
        {
            Vector3 targetPoint = camera.Position + (camera.LookVector * x) + new Vector3(0.5f, 0.5f, 0.5f);
            targetPoint = Util.FloorVector3(targetPoint);

            blockSelector.UpdatePosition(new Vector3((int)targetPoint.X, (int)targetPoint.Y, (int)targetPoint.Z));
            block = world.GetBlock((int)targetPoint.X, (int)targetPoint.Y, (int)targetPoint.Z);

            if (block.BlockType != BlockType.none)
            {
                blockSelector.Visible = true;
                break;
            }

            blockSelector.Visible = false;
        }

        return block;
    }

It seems to allow you to place blocks alot more accurately but it is still off centre:

sentences:
OpenGL drawing multiple polygons with different colors with VBOs I'm trying to change my program to use VBOs instead of immediate rendering for performance reason. The rendering consists of thousands of hexagons, all of the same size/shape. Each hexagon has a different color, so I'm trying to figure out how to change the color of the VBO for each rendered hex. Here's the code I'm using right now:

private static final int NUM_VERTICES = 6;
private static final int VERTEX_SIZE = 2;
private static final int COLOR_SIZE = 3;

private int vboVertexHandle;
private int vboColorHandle;

// This is called once on initialization
private void initVbo() {
    DoubleBuffer vertexBuffer = BufferUtils.createDoubleBuffer(VERTEX_SIZE * NUM_VERTICES);
    FloatBuffer colorBuffer = BufferUtils.createFloatBuffer(COLOR_SIZE * NUM_VERTICES);
    for (Point vertex : WorldHandler.TILE_VERTICES) {
        vertexBuffer.put(new double[]{vertex.x(), vertex.y()});
        colorBuffer.put(new float[]{1f, 0f, 0f});
    }
    vertexBuffer.flip();
    colorBuffer.flip();

    vboVertexHandle = GL15.glGenBuffers();
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboVertexHandle);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertexBuffer, GL15.GL_STATIC_DRAW);
    GL30.glBindVertexArray(0);

    vboColorHandle = GL15.glGenBuffers();
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboColorHandle);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, colorBuffer, GL15.GL_STATIC_DRAW);
    GL30.glBindVertexArray(0);
}

// This is called thousands of times per frame
private void drawHex(Color color) {
    // Set up the vertex buffer
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboVertexHandle);
    GL11.glVertexPointer(VERTEX_SIZE, GL11.GL_DOUBLE, 0, 0L);

    // Set up the color buffer
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboColorHandle);
    GL11.glColorPointer(COLOR_SIZE, GL11.GL_FLOAT, 0, 0L);

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);

    GL11.glDrawArrays(GL11.GL_POLYGON, 0, NUM_VERTICES);

    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
}

Note that I'm using OpenGL in Java through LWJGL. One solution I found online is to create a color VBO at initialization for each tile, then access each one when rendering that tile. That would probably solve my problem, but it may be more expensive than I'd like considering the lookup time when there are potentially millions of hexes that are off-screen.

Is there anything else I'm doing that is glaringly wrong? Even with those solution I'm only getting ~20 fps which is obviously far lower than I'd like.

sentences:
How to get the position in an actor inside a table with LIBGDX? Well the title says it all, I want to get the position of an actor inside a table

Button button = new Button(bs);
table.add(button).width(50).height(50);
table.top().center();

By using

button.localToStageCoordinates(new Vector2(button.getX(), button.getY()));

I get a near position but not exact, here is an screenshot, red squares are the positions I'm getting, while the transparent squares are the buttons.

sentences:
Using Perlin/Simplex noise in a 2d tile game for terrain generation I've been doing a bunch of research regarding procedural 2d terrain generation and have come to the conclusion that the use of perlin/simplex noise seems to be the way to go for most things.

I've copied the code from opensimplex noise and generated some noise, but I'm not really sure what to do with that? How can I take this noise and use it to create terrain similar to games like Diablo2 or Path of Exile? Things placing trees and rivers, etc.

Also, would it be possible to use this to create simple tiles for my game? Say I wanted to create a bunch of different grass tiles(Isometric), would I be able to do this?

EDIT:
So I've tried the following code to try and generate some natural looking rock placements and I'm not quite sure I understand how it's working. I've used the condition value < .1 for placing a rock, but the world seems to be full of rocks. Am I doing something wrong, or am I just not understanding how it's supposed to work?

    private void populateObjects(TileLoader tileLoader)
    {
        OpenSimplexNoise noise = new OpenSimplexNoise();

        for (int i = 0; i < layers[1].layerData.GetLength(0); i++)
        {
            for (int j = 0; j < layers[1].layerData.GetLength(1); j++)
            {
                double value = noise.Evaluate(j, i);
                if(value < .1)
                    layers[1].layerData[i, j] = tileLoader.getTileByName("grassrock");
            }
        }
    }

Here's a screenshot of something this produced:

sentences:
Remove bullets from sprite Group I'm having an issue with removing objects from a sprite Group.  What is happening is I have a bullet class and every time the user presses  the player shoots a bullet.  I have 'alive = bool' code and all works great so long as only one instance of bullet is in the list.  If multiple are in the list however only the last one gets removed.  Does anyone know how I can fix this?

elif event.key == pygame.K_SPACE:
                # Fire a bullet if the user clicks the mouse button
                bullet = Bullet()
                bullet.bullet = bullet
                # Set the bullet so it is where the player is
                bullet.rect.x = player.rect.x + 9
                bullet.rect.y = player.rect.y
                # Add the bullet to the lists
                bullet_list.add(bullet)
                all_sprites_list.add(bullet)
                print(len(bullet_list))

    if bullet.alive == False:
        bullet_list.remove(bullet)
        all_sprites_list.remove(bullet)

#In the class
# If the bullet goes off the screen remove it
    if self.rect.y < 200:
        self.alive = False

I have it set to 200 at the moment for testing purposes.

Any help or a better way of doing this would be very much appreciated.  Thank you in advance.

sentences:
How does SDL2 renderer work? Does it make sense to render to only part of a window? In order to run a game without using the CPU/GPU too much, I want to only update the section of the window that has changed.

Does this goal even make sense? How does the texture objects/renderer work when updating the screen? My idea is that the renderer builds a matrix of ints (pixel colours) and when SDL_RenderPresent is called, this edits a matrix stored on the memory that controls the colours for each pixel on the screen.

If what I've said so far makes sense, then is my implementation below correct (not updating more of the screen than needed)? I've tried to keep my code very, very simple so that it's easy to read.

The programme jumps the character (picture of a prince) from the top-left of the window to the bottom-left, and visa-versa, whenever the user inputs anything. This is just to keep the code simple for the example.

#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>

using namespace std;

int main ()
{
    // Screen dimension constants
    const int WINDOW_WIDTH = 639;
    const int WINDOW_HEIGHT = 1015;

    const int PRINCE_WIDTH = 74;
    const int PRINCE_HEIGHT = 114;

    SDL_Init ( SDL_INIT_EVERYTHING );

    SDL_Window * window =
    SDL_CreateWindow ( "example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN );

    SDL_Renderer * renderer = SDL_CreateRenderer ( window, -1, SDL_RENDERER_ACCELERATED );

    SDL_Texture * background = IMG_LoadTexture ( renderer, "./images/background.bmp" );
    SDL_Rect rect_background = { 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT };
    SDL_RenderCopy ( renderer, background, & rect_background, & rect_background );

    const SDL_Rect rect_place_one = { 400, 600, PRINCE_WIDTH, PRINCE_HEIGHT };
    const SDL_Rect rect_place_two = { 40, 60, PRINCE_WIDTH, PRINCE_HEIGHT };

    SDL_Texture * prince = IMG_LoadTexture ( renderer, "./images/prince.bmp" );
    SDL_RenderCopy ( renderer, prince, NULL, & rect_place_one );
    SDL_RenderPresent ( renderer );

    SDL_Event input;

    for ( uint8_t count = 0; SDL_WaitEvent( & input ); ++count )
    {
        // User requests quit
        if ( input.type == SDL_QUIT )
            break;

        if ( input.type != SDL_KEYDOWN )
            continue;

        if ( ( count % 2 ) )
        {
            SDL_RenderCopy ( renderer, prince, NULL, & rect_place_one );
            SDL_RenderCopy ( renderer, background, & rect_place_two, & rect_place_two );
        }
        else
        {
            SDL_RenderCopy ( renderer, prince, NULL, & rect_place_two );
            SDL_RenderCopy ( renderer, background, & rect_place_one, & rect_place_one );
        }

        SDL_RenderPresent ( renderer );
    }

    SDL_DestroyTexture ( prince );
    SDL_DestroyTexture ( background );
    SDL_RenderClear (renderer);
    SDL_DestroyWindow ( window );
    SDL_Quit ();

    return 0;
 }

sentences:
About tiles in games I'm trying to learn how to develop games in Unity and my base is tiled games, I would like to know if a simple tile is an image (sprite in 2D) or a game object in 3D.

Since I'm trying to do some kind of 3D tiles with interaction with the user like press to do something + an animation, I would like to know how it works.

sentences:
Java - Load new classes from a folder automatically at startup I want to make my game-coding very flexible; so I wanted to make the game automatically load new Mobs from a folder named "mobs".

This must be only at startup; not while it's already running.

I just want to put a file with a name like "mouse.jar" (or others -> dynamic) into this folder, and the game should load it at startup.

I already saw this in "Robocode" (Robots) and "MCForge" (whole Mods), so it must be possible.

Can anyone tell me, how is it possible to load classes as resources in game at startup, regardless of the quantity?

sentences:
Unity WorldToViewportPoint not giving correct results I have a script that places an UI element on the place where a 3d object is in 3d space. I do this in the following way:

public class test : MonoBehaviour {

public Camera MainC;
public GameObject testc;

// Use this for initialization
void Start () {
    var ui = Object.Instantiate((GameObject)Resources.Load("uit"), Vector2.zero, Quaternion.identity);
    ui.transform.SetParent(GameObject.FindObjectOfType<Canvas>().gameObject.transform, false);

    var vertexs = testc.GetComponent<MeshFilter>().mesh.vertices;
    var trs = testc.GetComponent<Transform>();
    var cdc = new Vector2(GameObject.FindObjectOfType<Canvas>().GetComponent<RectTransform>().sizeDelta.x , GameObject.FindObjectOfType<Canvas>().GetComponent<RectTransform>().sizeDelta.y);

    Object.Instantiate((GameObject)Resources.Load("pinksphere"), trs.transform.TransformPoint(vertexs[6]), Quaternion.identity); //bottomright
    Object.Instantiate((GameObject)Resources.Load("pinksphere"), trs.transform.TransformPoint(vertexs[5]), Quaternion.identity); //topleft

    var tl = MainC.WorldToViewportPoint(trs.transform.TransformPoint(vertexs[5]));

    var topleft = new Vector2(tl.x * cdc.x, tl.y * -(cdc.y) );
    ui.GetComponent<RectTransform>().anchoredPosition = topleft;
}

}

But this does not place the UI Element on the desired position. See the following images for more explaination.

in this case i want the TOPLEFT corner of the UI element to be ontop of the pink dot at the TOPLEFT of the whitecube. But as you can see the Y-axis doesnt quite match..

Some extra information about the conditions like canvas used and the prefab settings. See images below:

these are the canvas settings.

this are the Main Camera settings.

and this are the UI prefab settings.

If you need any more information or something isnt clear let me know so i can clarify!
the code is really inefficient and ugly but it is only for testing purposes :)

sentences: Is it possible to make an obj with single triangle I am not good in using blender so i wanted to ask if it is possible to make an object with just one triangle and how would it look like, will the no of triangle increase if you scale it up.

sentences:
At same positioned game objects collision detection In my game, I am creating two game objects at same position using Instantiate statement. Each generated object has box collider attached.

So I want to detect collision between them so I write following code.

void OnCollisionStay(Collision collisionInfo){
   print("on collision stay");
}

But this statement not called. I generate two object using following code.

BallUtility.AddNormalCommonBall (normalBallPref, Vector3.zero);
BallUtility.AddNormalCommonBall (normalBallPref, Vector3.zero);

I need help in collision detection. I already post question in unity forum but I didn't get any reply from there.

sentences:
Retain Position and Scale Values of Render Texture Canvas Elements to another Canvas Now the title might not be able to express the entirety of the question but here's my problem. In my main scene I have a camera and a canvas in overlay mode, let's call this "View A". In this view is a crosshair which position and size I want to manipulate depending on elements inside the canvas of "View B". "View B" is located in the main scene as a render texture it contains a camera and a canvas in camera space with another crosshair. Now what I want to do is the following: I'm trying to set the position and size of the crosshair in "View A" to practically overlap with the values of the crosshair in "View B", i.e. if the crosshair in "View B" is in the lower left corner of its screen I'd like the crosshair in "View A" to be in the same position with the same size but in the canvas of "View A".

What I'm currently capable of is setting the crosshair in "View A" to the same location as the crosshair in "View B" but only if the crosshair in "View B" is in its origin, as all I have to do in that case is to get the origin of the render texture quad in the screen space of "View A" canvas. I do this in the following way:
RectTransformUtility.ScreenPointToLocalPointInRectangle(CanvasTransform, CameraComponent.WorldToScreenPoint(RenderTextureQuadTransform.position), null, out Vector2 localPoint);
CursorTransform.localPosition = localPoint;

But now I'm stuck in figuring out how to get a scale factor that makes the crosshair in "View A" and "View B" look the same size and how to adjust the position of the crosshair in "View A" depending on the position of the crosshair in "View B".

sentences:
Is character movement with an animated sprite controlled by the animation itself or moved manually? How is a walking animation of a given character designed? I can see two possible ways:

The first way is to draw each frame of the animation such that, if the frames are displayed at position (0,0), the character walk but does not really move (I mean: at frame 10, the character is still at the left, upper corner of the screen). This means that one needs a way to move (translate) the frames manually.

The other way is to draw each frame such that their width grows progressively. Drawing the frame i at position (0,0) will give the impression that the character is really moving (not only walking on the same point). This way is the graphic artist that do all the job, but the animation is completely controlled by him, so he can give a specific style to the walking animation.

The first one seems to be the right way to do things, but one would need a way to say: ok, frame 0 last 50 ms at (0,0), frame 1 last 30 ms at (5, 0), frame 2 last 15 ms at (13, 0) etc...

This makes things much more complicated.

What is the best practices? What way do you usually adopt/suggest?

sentences:
Buttons implementation with regards to a basic Game Loop As the title states I am creating a game with SFML being the only library used.

I am entirely unsure how to go about this.

I want the buttons to be activated by simple mouse clicks (when the mouse is within the defined area of the button).

My question however is how do I do this with regards to a standard Game Loop, with the following methods HandleInput(), Update() and Draw().

Should I implement it so that HandleInput() calls a function (on left
mouse click) which stores the mouse coordinates and in Update() every
button checks if it has been clicked on?
Or should I (attempt to) implement Observer pattern?
Or is there a method I haven't even covered?

I hope this question is relevant to GameDev I believe it is.

sentences:
Build a Unity asset bundle on linux? I'm trying to generate an asset bundle on a remote linux machine and stream the bundle to a running Unity instance.

Is it possible to download the same libraries Unity uses and compile on Linux?

sentences: How to apply constraints to limb movements of a 3D human model? I'm animating a 3D human model using playcanvas game engine according to the quaternion data provided by IMU sensors. How can I limit the movements of the limbs of the human model to avoid unrealistic postures? Is there a mathematical method to limit joint angels?

sentences:
Why not show progress towards achievements/badges? Achievements are everywhere now — Xbox Live, iOS Game Center, many individual games, and even in social communities with gaming elements like Stack Overflow.

A common user request of Stack Overflow is to show progress toward badges.

This has been denied by SO, as seen in this uservoice request, where Jeff Atwood made the following statement:

  this is modelled on the xbox live achievements model, and that does not show progress, either.. by design

Jeff defers to the design of Xbox Live when denying the request to show progress.  Certainly, SO is technically nothing like Xbox Live, so it can be inferred that this is a design decision, not a technical one.

I am working on a game where we have achievements and right now the intention is to show progress.  So, I have two questions:

If it's known that Xbox Live achievements "by design" do not show progress, is there a source for this?
Why is this "by design"?  In other words, in terms of game design, what reason is there to intentionally not show achievement progress?

sentences:
How to connect two Iphone/ipod/ipads for gameplay over local wifi network? I would like to add the option to play against another person over my wifi network in my pong game. How do I make this happen?

Also, I would like to know how to be able to have 4 players at the same time like I would if I make a monopoly type game or something similar.

I'm a newbee so please point me in the right direction or show me some code I can use for this and study.
Thanks guys
David

sentences:
To what extent it is legal to declare support of third party commercial products' assets? Is it legal to say that MyGame supports other (specific) games' textures, sounds and models?

I'd like to get involved into an open source game project and implement support for Quake's weapon models (for example), but the owners of the project don't know about the legal aspect of it, so I'm asking here.

sentences:
How to get Flare elements? Is it possible to get the elements or the textures of a Flare and to change them at runtime? If so, then how do I get them?

Pseudocode:

Flare flare = GetComponent<Flare>();
foreach (Element e in flare) {
    e.Size = 10;
    e.Color = Color.green;
}

Thanks in advance :)

sentences: Debugging multiplayer games without killing network thread? How do I approach multiplayer games for debugging? When debugging locally - how can you prevent yourself from disconnecting? The debugger halts network activity.

sentences:
How to generate mesh at runtime using raycast points? I'm trying to make a clone of the trail/line renderer with the difference that everything is perfectly flat, i.e. the faces are not designed to face the camera. I'm using two raycasts to get the position of the edges of where I want those faces but now I'm struggling to generate the mesh...I've gone through the mesh docs but I don't really understand it. Could someone help me do this?

Here is my code so far:

    public Transform[] probes;
    public float probeDistance;

    public Vector3[] newVertices;
    public Vector2[] newUV;
    public int[] newTriangles;

    void Update () {
        //Generating the mesh
        Mesh mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        mesh.vertices = newVertices;
        mesh.uv = newUV;
        mesh.triangles = newTriangles;

        //Defining the rays
        Ray l_ray = new Ray(probes[0].position, -probes[0].forward * probeDistance);
        Ray r_ray = new Ray(probes[1].position, -probes[1].forward * probeDistance);

        RaycastHit l_hit;
        RaycastHit r_hit;

        Debug.DrawRay(probes[0].position, -probes[0].forward * probeDistance, Color.blue);
        Debug.DrawRay(probes[1].position, -probes[1].forward * probeDistance, Color.red);

        //Getting the position of the left ray point
        if(Physics.Raycast(l_ray, out l_hit)){
            print (l_hit.point);
        }

        //Getting the position of the right ray point
        if(Physics.Raycast(r_ray, out r_hit)){
            print (r_hit.point);
        }
    }

sentences:
Shader - Convert vector into scalar I am trying to convert a half3 as a simple half but I am facing an issue. As for an example half3(1, 0, 0) give me white but half3(0, 1, 0) gives me black.

How can I convert properly a half3 to a simple black and white half value

Thank you.

sentences:
Tetris - Rotations using Linear Algebra (Rotation Matrices) I'm making Tetris in Java and am at the point of rotations... Originally I was hardcoding each rotation:

if (direction.equals("right")) {
            if (shape.equals("Bar")) {
                if (rotationsCounter == 0) {
                    currXs[0] += 1;
                    currYs[0] += -1;

                    currXs[1] += 0;
                    currYs[1] += 0;

                    currXs[2] += -1;
                    currYs[2] += 1;

                    currXs[3] += -2;
                    currYs[3] += 2;

                    rightRotate1 = new int[] {currXs[0], currYs[0], currXs[1], currYs[1], currXs[2], currYs[2], currXs[3], currYs[3]};
                }
                if (rotationsCounter == 1) {
                     etc...

Then, I have this to set the correct coordinates based on what the rotated counter is

   if (direction == "right") {
            if (shape == "Bar") {
                if (rotationsCounter == 0) {
                    pieceRotations = rightRotate1;
                }
                if (rotationsCounter == 1) {
                    pieceRotations = rightRotate2;
                }
                if (rotationsCounter == 2) {
                    pieceRotations = rightRotate3;
                }
                if (rotationsCounter == 3) {
                    pieceRotations = rightRotate0;
                }
            }
        }
        if (direction == "left") {
            if (shape == "Bar") {
                if (rotationsCounter == 0) {
                    pieceRotations = leftRotate3;
                }
                if (rotationsCounter == 3) {
                    pieceRotations = leftRotate2;
                }
                if (rotationsCounter == 2) {
                    pieceRotations = leftRotate1;
                }
                if (rotationsCounter == 1) {
                    pieceRotations = leftRotate0;
                }
            }
        }
        return pieceRotations;

But found that was a very tedious way to go...

People suggested I use rotation matrices in Linear Algebra.

So I tried rotating 1 coordinate in a Tetris piece just to see if I was doing it correctly... the point (1, 1) seems to rotate just fine...

So then I thought that the way to rotate the whole block was to get all the coordinates of each tile in a Piece (4 tiles, 16 coordinates), and rotate each one... but I was wrong.

So my questions is...

In the first picture, I choose (1, 1) as my rotation axis... How do I move the rest of the coordinates in relation to that point?

Thanks!

sentences:
Problem with IsKeyPressed 2 times i tried to make thing to show menu up by doing VK_MULTIPLY and close it by doing VK_MULTIPLY, but this does not work..
Anyone can help :) ?

        if (IsKeyPressed(VK_MULTIPLY))
        {
            Menu::MenuLevelHandler::MoveMenu(SubMenus::NOMENU);
        }
        else if (IsKeyPressed(VK_MULTIPLY)) //????
        {
            Menu::MenuLevelHandler::BackMenu();
        }

sentences:
How should my game characters store their abilities/spells? I'm new to game development and a bit confused about how to effectively store an object's access to certain spells/abilities.

The player and mob objects are all generated from the same class. However, each object may have access to different abilities and spells. How do I keep track of a specific object's access to these?

Example: My player object might have access to Fireball and Haste, while a goblin might have access to Confusion.

I followed the RogueBasin Python Libtcod tutorial, and I understand how to attach a spell function to scroll use. I'm just not sure how to emulate a character memorizing a spell and using it as an ability.

sentences:
Should a 4x game use one class per planet type? I'm try to make a small 4x game for my own educational purposes.

Currently I have interfaces like IStarSystem which contains a list of IPlanets. My next step was to make classes implementing those interfaces. Is it better to make classes like BarrenPlanet, GasPlanet, et cetera or is it better to make a single Planet class and define the different types in a XML file?

sentences:
openGL managing images, VBOs and shaders I'm working on a game where I use shaders with vertex attributes (so not immediate mode). I'm drawing lots of images and changing the width/height of the quads I use to draw them a lot. To optimize this it's probably a good idea to have one buffer but then one needs to update the complete buffer when one image changes (or only a part of the buffer using glBufferSubData...)

I was just wondering what kind of strategies you guys are using?

sentences:
Verify which bubble is connected to top using DFS I am working on a bubble shooter game in this game i have implemented searching using DFS as suggested in this link, and this is working fine.

Update

Here is my code for DFS

-(void)callDfs:(int)startR:(int)startC:(int)color{

notVisitedBubblesArr = [[NSMutableArray alloc]init];

//reset visited matrix to false.
for(int i = 0; i < R; i++)
    for(int j = 0; j < C; j++)
        visited[i][j] = FALSE;

//reset count
count = 0;
isFound = NO;
bubbleBlastCount = 0;
[self dfs:startR :startC :color :false];

[self bubbleFalling];

}
-(void)dfs:(int)ro:(int)co:(int)colori:(BOOL)set{
    coundown++;
    for(int dr = -1; dr <= 1; dr++)
        for(int dc = -1; dc <= 1; dc++)
            if([self ok:ro+dr :co+dc]) // 4 neighbors
            {
                int nr = ro+dr;
                int nc = co+dc;

                if ((([[[bubbles_Arr objectAtIndex:nr] objectAtIndex:nc]   integerValue]==colori) && !visited[nr][nc])) {
visited[nr][nc] = true;
count++;
[self dfs:nr :nc :colori :set];
if(count>2)
{
// pass row and colom will start dfs
//  if (nr >= touchClum && nc >= touchROW) {
isFound = YES;
bubbleBlastCount++;
[[bubbles_Arr objectAtIndex:nr] replaceObjectAtIndex:nc withObject:NOCOLOR];
[bubbles[nc+1][nr+1] setTexture:[[CCTextureCache sharedTextureCache] addImage:@"blank.png"]];
}
}
}
}

Now i am trying to implement bubble falling using DFS, i studied this link. i got all unvisited nodes after DFS but i am not able to verify with node is connected to top.

Here is my code for bubble falling

-(void)bubbleFalling{

for(int i = 0; i < R; i++){
    for(int j = 0; j < C; j++){
if (!visited[i][j]) {
    //NSLog(@"Array :  %d %d", i,j);

    NSLog(@"Value : %d",[[[bubbles_Arr objectAtIndex:i] objectAtIndex:j] integerValue]);

    BOOL canReach = [self canreachTop:i :j];
    if(canReach){
        NSLog(@"Yes");

    }
    else{
        NSLog(@"NO");
        [[bubbles_Arr objectAtIndex:i] replaceObjectAtIndex:j withObject:NOCOLOR];
        [bubbles[j+1][i+1] setTexture:[[CCTextureCache sharedTextureCache] addImage:@"blank.png"]];
    }

}

    }
}
}

-(BOOL)canreachTop:(int)ro:(int)co{
   int topNode = [[[bubbles_Arr objectAtIndex:R-1]objectAtIndex:C-1] integerValue];

BOOL success = FALSE;
for(int dr = -1; dr <= 1; dr++)
    for(int dc = -1; dc <= 1; dc++)

        if([self ok:ro+dr :co+dc]) // 4 neighbors
        {
            int nr = ro+dr;
            int nc = co+dc;

            if ((([[[bubbles_Arr objectAtIndex:nr] objectAtIndex:nc] integerValue]== topNode) && !visited[nr][nc])) {
            success = TRUE;
            }
        }

return success;
}

-(BOOL)ok:(int)r:(int)c{
    return r >= 0 && r < R && c >= 0 && c < C;
}

Below is the screenshot of my iPhone simulator in that green bubble should fall because it is not connected with any bubble, i think we have to check whether it is connected with the top bubble or not or i have to follow some other approach?

This is my first game and i am not getting what is wrong with my bubble falling code.

Thanks in advance.

sentences:
How to make a simple dialog system with yes/no options and pages? I recently made dialogues. Now I want to add the option to choose yes/no when the dialogue is finished (if it has a choice).

Adding buttons to the dialogue is no problem, the problem I'm having is that I want a "generic" dialogue system. By that I mean, I might have 200 NPCs, and depending on which NPC I am talking to, the yes/no buttons will react differently. This is where I'm stuck. How will the buttons know which methods to call?

Say I have one NPC that offers to sell me an item for 100 gold, and another NPC that offers to show me around the village. How will my system know which functions to call when I press "Yes"?

All I can find on this subject is really complicated using trees and things I don't fully understand yet, and don't really need, since my system is very simple.

sentences:
OOP in cocos2d for ios I have been pulling my hair out trying to make an object in cocos 2d that is a CCSprite (with an image) and a CCLabelBMFont.

I tried making a CCNode object and I tried making a custom CCSprite object but none of it worked!

Can someone show me how to do this?

Thanks.

sentences:
Steering Behavior Seeking I am trying put a seek feature in my code.

Just frame code, not actual code.

 Seek(TargetPos)
{
  Vector2D DesiredVelocity = Normalize(TargetPos - currentPos)*MaxSpeed();

  return (DesiredVelocity - currentVelocity}

Simply when I press 2, it will change the target, 3 will change the target and so on...

Do I need to make the currentVelocity the old Desired velocity?

sentences:
Moving a continue condition into the for loop produced something NOT logically equivalent? I'm setting up a hex grid. The column/row system I use puts 0, 0 as the top left corner, and increasing columns (x) moves to the right but also vertically upwards. So columns run straight up and down, but rows run to the right but slanted upwards a bit.

This code...

for (j = 0; j < bd*2-1; j += 1) // bd is "board dimension", in my case 9
{
  for (i = 0; i < bd*2-1 and i < j+bd; i += 1)
  {
    if (i <= j-bd)
      continue;

    scr_ini_hex(i, j, bxo + i*hs, byo + j*hh - i*vs); // bxo and byo are arbitrary board x/y origins where the first cell is drawn, hs, hh, and vs are the gaps between cells in horizontal and vertical directions.
  }
}

produced this:

which is exactly what I want, a large hexagon with 9 smaller hexagons on each side.

So I thought I would be sophisticated and move that continue condition into the for loop. I wrote this...

for (j = 0; j < bd*2-1; j += 1)
{
  for (i = 0; i < bd*2-1 and i < j+bd and i > j-bd; i += 1) // added "i > j-bd", basically migrated the condition into this inner loop
  {
    //if (i <= j-bd)
      //continue;

    scr_ini_hex(i, j, bxo + i*hs, byo + j*hh - i*vs);
  }
}

and it produced this:

What went wrong here? I thought they were logically equivalent (except negating the condition, because the continue code was like a do until, but the for condition is like a do while).

sentences:
Repeat/Scroll texture on CubeMap I need a method to scroll an image across all sides of a cube map in a way similar to scrolling a UV texture across a water's texture to give the appearance of movement by shifting the normals. I want to cause certain areas of the skybox to grow in intensity or lower to mimic a twinkle effect for the stars. I'm using a simple perlin noise map to do it, and I just need to find a way to scroll the texture on each side of the cubemap.
I've tried to shift the texture coordinates on the samplerCube in GLSl, but it seemed to move the entire cube instead of just changing the coordinates that the cube gets the texture from.
I also tried using a regular sampler2D, but that resulted in a screen of pure grey somehow.
What can I do to get this effect?

sentences:
What happened to procedurally generated textures? I recall some time ago that procedurally generated textures were becoming a big deal that a lot of people/companies were really interested in with some serious benefits (smaller deployments, potentially faster loading, higher quality, scalable textures, potentially cheaper to produce, etc.).

From what I can tell, the buzz is dead and no games on my radar are using them. What happened?

I was hoping I'd see procedural textures go the way that NaturalMotion's stuff has (slow but steady adoption).

sentences:
Tools for generating texture atlases/sprites from source images? Is there an industry standard file format for texture atlases?

What are the apps that take a directory of images and turns it into a texture atlas png and a text file describing what's on it?

This is primarily for use in OpenGL iPhone/Objective-C, but it seems like there ought to be a standard across many platforms.  I can create these by hand or by writing a script to simply tile them, but it seems like there would be some tools already made for this.

sentences: What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix? So, I have an object in my custom engine (C++), with a column-major transform in world space. I'm using a package that takes a look-at direction as an input. What's the most efficient way to get a look-at direction from this transform? Do I extract the rotation matrix? Do I try to extract a quaternion?

sentences:
HLSL identity matrix multiplication not producing identical output I'm debugging my very simple shader and it's led me to a point where, as a quick test, I'm performing a multiplication of my position vector with an identity matrix. If I don't perform this multiplication, my position is preserved and I get a nice-looking quad in the middle of the screen, as expected. If I multiply with an identity matrix, my quad goes away, leaving only the background. I'm sure I'm missing something, or doing something stupid (or both), but I have no idea what that is. My code is below:

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

struct VIn
{
    float4 position: POSITION0;
    float4 color: COLOR0;
    float2 texcoord: TEXCOORD0;
    float2 pad: PADDING0;
    matrix translate: CUSTOM0;
};

matrix Identity =
{
    { 1, 0, 0, 0 },
    { 0, 1, 0, 0 },
    { 0, 0, 1, 0 },
    { 0, 0, 0, 1 }
};

VOut VSMain(VIn input)
{
    VOut output;
    float4 pos = float4(input.position.x / 4, input.position.y / 4, 0.0, 1.0);
    matrix trans = Identity;
    pos = mul(pos, trans); // <-- THIS LINE HERE DOESN'T DO WHAT I EXPECT
    output.position = pos;
    output.color = input.color;
    return output;
}

The line marked above should produce identical output to the pos input, but it does not.

sentences:
Who should handle animations when game logic is separated from rendering? Suppose I have a tile-based game and I want the step to be 1 tile but also want the movement to be smooth while the player is getting there. If I understand correctly, the only way to achieve this would be making a series of small movements where the increment is a percentage of a tile.

My question is: should the game logic thread send the animations to the rendering thread? What is the best way to go about it?

sentences:
Repeat image on a fixed background, Cocos2D? I'm quite new to Cocos2d, does anyone know how to create a background that would be one fixed screen (no scrolling), with a small image just repeated to the whole size of the screen - depending on device?

The best way I can explain the look I'm after is something similar to repeating a small image for a website background.

Thank you in advance for any help :)

sentences:
Depth write and depth test in Unity Scenario: several objects (o1, o2,.., on) have to be rendered with the z test disable, but the z values must be written to the depth buffer. In another pass, some other objects (t1, t2,..., tm) need to be rendered considering with the z test enabled, and considering the prior values from the previous pass.

Is it possible to achieve this with Unity's material script? The goal is to support a custom order for the rendering of transparent objects (the o1,..,on in the scenario description) alongside with matte objects (t1,..., tm). I tried using the features mentioned here, but the results were incorrect, i.e. as if the z values were completely discarded inbetween passes. Can anyone, perhaps, share a code stub for this scenario?

sentences:
How can i get object from TMXTiledMap and store it in Dictionary variable ? I've been following a tutorial to make tiled map in cocos2d x 3.0 ,
but i couldnt complete the rest of the tutorial because its for coco2d x 2.0 version,

How can i get a value of property that is stored in an object from TMXObjectGroup variable ?
and my code is:

tileMap = cocos2d::TMXTiledMap::create("ground.tmx");
ground = tileMap->layerNamed("ground");
this->addChild(tileMap);

TMXObjectGroup *objects = tileMap->getObjectGroup("objects");
??? sign = objects->getObject("sign");// it return ValueMap not Dictionary ?!

how can i get a Dictionary of that object so i can get its values ??

sentences:
How do I draw two lines of text in GMS and keep one static? I am making an intro sequence for my game, but I'm having some difficulty drawing two lines of text. The first line is "DEVELOPED BY:" referenced from a separate language file as "IntroSequence", "DevelopedBy". The next line (made by using + chr(13) + chr(10) +) is my name which I want to be kept static. I would essentially like the user to be able to make different language files being able to change the string reference "DEVELOPED BY:", but not the developer name. Now, I can get the text to draw if I use "DEVELOPED BY:#Mr.Mendelli" in the language file, or keeping both strings static in the script by declaring mytext = get_text("DEVELOPED BY:" + chr(13) + chr(10) +"Mr. Mendelli");. But If I use the second method, the DevelopedBy string cannot be translated in the language resource any more.

When I use the below script, GMS says two arguments are declared, but three are provided:

mytext = get_text("IntroSequence", "DevelopedBy" + chr(13) + chr(10) +"Mr. Mendelli");
image_alpha = 0;
statetime = 0;

How do I use my alias as an unchangeable separate line?

sentences:
How to work properly with different coordinate-systems Let's say we got a little set {S} wich has 4 possible coordinate systems (LH=left handed, RH=right handed):

LH-y_up
LH-z_up
RH-y_up
RH-z_up

Now, let's say my Opengl engine is using a RH-y_up coordinate system and I want to import models from some 3d package which uses a RH-z up coordinate system (like 3ds max). One way to do it would be at the exporting/preprocessing stage flipping the y&z model's components. That solution doesn't seem like a really good idea though... what about if i decided to change eventually on my engine from coordinate system 3) to 1) or 2)?

So, my question would be. Let be A & B 2 coordinate systems from set S. What's the proper way to use models from A onto B?

sentences: Can I sell a game made with OpenGL? I love creating games, and I've always made games using OpenGL and not with game engines such as Unity or Unreal. Can I legally sell the games I made with OpenGL?

sentences:
Shadow mapping bone animated model I am trying to get shadowmapping right for my animated models. It works perfectly for static meshes but the animated models are just wiggeling a bit

here's the vertex shader for rendering to the depth texture:

#version 400 core

in vec4 inputPosition;
in vec3 inputNormal;
in vec2 inputTexCoord;
in vec4 weights;
in vec4 joint_index;

uniform mat4 bone_matrix[65];
uniform int animate;
uniform mat4 depthMVP;

void main(){
    vec4 pos = inputPosition;

    if(animate != 0) {

        pos = vec4(0);
        vec4 post = inputPosition;

        for(int i=0;i<4;i++) {
            if(weights[i]>0) {

                pos += (bone_matrix[int(joint_index[i])] * post) * weights[i];

            }
        }

    }

    gl_Position = depthMVP*vec4(pos.xyz, 1);

}

The animation works fine in the second pass but during the first using the vertex shader above the model vertices don't get transformed instead the whole model rotates a little so i get a depth texture with my model in binding pose rotating around the y-axis a little. Weird because i use the exact same bone transformation code as in the second pass shader. So i'm wondering am i missing something crucial in the vertex shader above

sentences:
Invalid coordinates returned by glutMouseFunc() I am using GLUT's glutMouseFunc() function to retrieve the coordinates of mouse clicks.  I want to move the object on that coordinate to another coordinate.  But when I click on the object the coordinates returned by glutMouseFunc() are different than the original.

windowWidth=1250;
windowHeight=1000;

void onMouse(int button, int state, int x, int y);

int main(int argc, char** argv) {

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE);
    glutInitWindowSize(1250, 1000);
    glutCreateWindow("OpenGL - First window demo");
    // ...
    glutMouseFunc(onMouse);
    // ...
    glutMainLoop();
    return 0;
}

void onMouse(int button, int state, int x, int y) {
    flag++;
    if (state != GLUT_DOWN && button!=GLUT_LEFT_BUTTON)
        return;

    GLbyte color[4];
    GLfloat depth;
    GLuint index;

    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_INT, &index);

    printf("Clicked on pixel %d, %d, color %02hhx%02hhx%02hhx%02hhx, depth %f, stencil index %u\n", x, y, color[0], color[1], color[2], color[3], depth, index);
    move();
}

Inside my render function i have set the window coordinates to 0,0 using glortho

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, windowWidth, windowHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

If my object is at (550, 900), onMouse() reports it as (556, 650) while if I click on an object which is at position (375, 475) the onMouse() returns (376, 342).

Basically there is a huge difference between the value of y axis returned by the function.

How can i get the correct screen coordinates?

sentences: How can I implement a global high score ladder? Are there any existing frameworks I can build on?  Should I build my own?  How can I prevent fake scores from being posted to it?

sentences:
Does anisotropic filtering need a previously generated mipmap? I have a GPU which supports anisotropic filtering and a 1024x1024 soil texture. I would like to know, if I even need to create a mipmap when I am using anisotropic filtering or if I can just leave it out and only use anisotropic filtering.

I looked it up in some tuts and posts and each one had mipmapping enabled too, but they did not mention why.

I am not sure, but I think that I need a mipmap because I don't think that anisotropic filtering scales a texture from 1024x1024 to something like 512x512 or 256x256. Am I right?

sentences:
Algorithm to simplify building/structural meshes I am looking for an algorithm to simplify the meshes of buildings or similar structures.

EDIT: I had made a comment that Hoppe's algorithm tends to make meshes more and more spherical with simplification. But, I am not sure about it, so am deleting the comment. Buildings in contrast should tend to become more and more rectangular with increasing simplification. The D3DX extensions for D3D in version 9.0 (d3dx9.lib) used to have classes to do progressive mesh simplification. See:
http://doc.51windows.net/Directx9_SDK/?url=/directx9_sdk/graphics/reference/d3dx/functions/mesh/d3dxgeneratepmesh.htm
http://msdn.microsoft.com/en-us/library/windows/desktop/bb281243(v=vs.85).aspx

sentences:
Smooth Rotate Object While Orbiting I am working on a 3D game where you can control an object that orbits a sphere with an on-screen virtual joystick. So far I have that part working, but the object follows the joystick angle perfectly and "snaps" into the angle, rather than smoothly interpolating to the new angle of the joystick.

I would like to redo this and have it interpolate the values. I have it very close using the following code:

angle = Mathf.Atan2(joystickY, joystickX) * Mathf.Rad2Deg;
Quaternion targetRotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, currentAngle);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, TURNING_SPEED * Time.deltaTime);

This works great on one side of the sphere, but as soon as I move the object halfway around the sphere, the rotation is now mirrored and the object rotates 180 degrees until it reaches the other side again. What am I missing here?

I am basically trying to calculate the joystick angle, then apply that to the object as it orbits, but do this smoothly using slerp.

Let me know if you need any further information. Thanks!

sentences:
Procedural generation of evenly distributed random points (2d) I am coming here because I've have a performance problem with my current implementation of an algorithm. I am the idea of Voronoi diagrams to distribute patches on an infinte 2d layer.

For a Voronoi pattern you need to have a set of points which is in my case procedural generated to allow an infinite generation of the Voronoi pattern.

And there is the problem. I have an algorithm which requires uses a grid of interval for the distance between each point on the grid. But I don't want a perfect square pattern so I add a randomization to each point on the grid with amplitude as possible randomization on X and Y axis.

Here you can see how the points are shifted by adding the randomiation. (The randomization depends on the coordinates of the point on the grid to allow procedural generation. They are generatied by a noise map, but let's assume they are just a seed for a RNG)

And now we come to the performance problem. I have a point (x,y) which I need to find the nearest point. So what I do is I take all points within the maximum randomization amplitude and apply the randomization to get the points in my layer.

Now I take the random point with the shortest distance to my point (x,y) and return it.

The performance of the code is exploding very quickly though.

n = amplitude / interval
runtime = (2n + 1)^2

A basic shape of the code is here, in the actual code I already use caching to avoid costly randomization of one point multiple times.

Vector2d currentlyBest = null;
double bestDistance = Double.POSITIVE_INFINITY;

double gridX = round(x / interval) * interval;
double gridY = round(y / interval) * interval;
for (double ix = 0; ix <= interval + amplitude; ix += interval) {
    for (int loopX = -1; loopX < 2; loopX += 2) {
        double dx = gridX + ix * loopX;
        for (double iy = 0; iy <= interval + amplitude; iy += interval) {
            for (int loopY = -1; loopY < 2; loopY += 2) {
                double dy = gridY + iy * loopY;
                Vector2d point = new Vector2d(dx, dy);
                randomizePoint(point);

                double px = point.x - x;
                double py = point.y - y;
                double disSq = px * px + py * py;
                // save point if disSq is smaller than before
            }
        }
    }
}

Thanks for reading so far! My question now is, if anyone knows a way to improve that or if you know a better way to produce evenly distributed randomized points on a 2d layer.

Thank you very much!

PS: I am not allowed to post more images so I can't give you more images, sadly :(

sentences:
When should a game be announced to the public? I'm not sure if this is where I should ask this as it might be opinion based so I apologize.

I am creating a game and I would like to know at what point in development I should reveal it to the public. An example would be posting on a forum about the language I am using, and having that post announce the game.

I am wondering how close to completion I should have the game before I begin to reveal it.

edit: Lets say that the game is a puzzle game similar to portal in style however without using a portal gun.

sentences:
Reusing entities across screens: game data vs. object modelling I'm working on a 2D RPG. I currently have a MainWorldScreen which has a Player entity, and some MapObjects that he can collide against. The player has a few components (sprite, keyboard input) etc. that implement specific logic for it to work in the main world screen.

The problem now arises when I start working on a "battle" screen. The crux of it is, should I reuse/extend my Player entity or create one entity per screen?

Up to now, components are all behaviour based -- sprites to display something on-screen, input components to capture and expose events to handle input, etc. My entities are a composition of components that implement game logic (eg. move on keyboard click).

If I did this as "pure" object-oriented, I would probably have a larger Player class which had all the combined attributes needed for all screens -- list of equipment, health, etc. and each screen would only take what it needs.

However, since I have components, if I reuse my player entity, it doesn't make much sense to reuse it; I will have to remove and re-add new components, since screens use completely different data, and I don't really know where the player state should go (eg. equipment).

What's the right way to handle this? Should I go with one Player entity per screen (at least with these two screens)? Should I keep player state in the entity, and just add/remove components depending on the screen when I pass it from screen to screen?

sentences:
How to avoid Walls in A* Well I had a problem with the implementation of my A* algorithm in C# for unity, and I don't realize how to prevent the diagonal movement and the cross walls, I had the next code, the print line's are for debug purposes:

public void FindPath(Vector3 startPos, Vector3 targetPos)
{
   List<Transform> openSet = new List<Transform>();
   HashSet<Transform> closedSet = new HashSet<Transform>();
   openSet.Add(begin.GetComponent<Transform>());

   while (openSet.Count > 0)
   {
      Transform currentNode = openSet[0];

      for (int i = 0; i < openSet.Count; i++)
      {
          if (openSet[i].GetComponent<Cell>().fCost < currentNode.GetComponent<Cell>().fCost || openSet[i].GetComponent<Cell>().fCost == currentNode.GetComponent<Cell>().fCost && openSet[i].GetComponent<Cell>().hCost < currentNode.GetComponent<Cell>().hCost)
              currentNode = openSet[i];
          print("Todo bien despues de agregar el actual al set");
      }

      openSet.Remove(currentNode);
      closedSet.Add(currentNode);

      if (currentNode == end) {
          print("LLEGUE AL NODO FINAL");
          RetracePath(begin,end);
          return;
      }

      foreach (Transform neighbour in grid.GetNeighbours(currentNode.GetComponent<Cell>()))
      {
          if (closedSet.Contains(neighbour.GetComponent<Transform>()) || !neighbour.GetComponent<Cell>().IsOpened)
              continue;

          int newMovementCostToNeighbour = currentNode.GetComponent<Cell>().gCost + GetDistance(currentNode, neighbour.GetComponent<Transform>());
          if (newMovementCostToNeighbour < neighbour.GetComponent<Cell>().gCost || !openSet.Contains(neighbour.GetComponent<Transform>()))
          {
              neighbour.GetComponent<Cell>().gCost = newMovementCostToNeighbour;
              neighbour.GetComponent<Cell>().hCost = GetDistance(neighbour.GetComponent<Transform>(), end.GetComponent<Transform>());
              neighbour.parent = currentNode;
              print("Pase hasta definir los costos");

              if (!openSet.Contains(neighbour.GetComponent<Transform>()))
              {
                  openSet.Add(neighbour.GetComponent<Transform>());
                  neighbour.GetComponent<Renderer>().material.color = Color.blue;
              }
          }
      }
   }
}

The Getneighbours list is in here:

public List<Transform> GetNeighbours(Cell node)
{
    List<Transform> neighbours = new List<Transform>();
    for (int x = -1; x <= 1; x++) {
        for (int y = -1; y <= 1; y++) {
            if (x == -1 && y == -1)
                continue;

            if (x == 0 && y == 0)
                continue;

            if (x == 1 && y == 1)
                continue;

            int checkX =(int)node.Position.x + x;
            int checkY =(int)node.Position.z + y;

            if (checkX >= 0 && checkX < GridSize.x && checkY >= 0 && checkY < GridSize.z)
                neighbours.Add(GridArr[checkX, checkY]);
        }
    }
    return neighbours;
}

I use a Prefab and I really don't know to put the restiction of walls to prevent the algorithm pass over them, to destroy the other prefab walls I use a RayCastHit function.

this return the next image:

The problem with this is it cross my walls and I don't know how to avoid that

Any help?

Thanks

sentences:
Is component-based design an architectural pattern or design pattern? When using the component-based paradigm in game development with engines like Unity, is component-based design an architectural pattern, or a design pattern?

Can I even say that component-based design is my "main" architectural pattern for my game?

I see architectural patterns as being more high-level than design pattern. The component-based design in game development's context (like with Unity engine) seems to fit as an architectural pattern to me. However, on some sites, I read that component-based design is a behavioural pattern, much like other behavioural design patterns, and not so much like an architectural pattern like MVC.

sentences:
Box2D: How can I speed up a physics simulation with many, many overlapping box bodies? I'm new to physics libraries and am trying to use Box2D to help implement the procedure described in this article: http://www.gamasutra.com/blogs/AAdonaac/20150903/252889/Procedural_Dungeon_Generation_Algorithm.php

(Edit for clarification:) The algorithm involves rectangular bodies of random dimensions being created in a random point in a circle. They are meant to intersect initially and have those intersections resolved by the simulation, so as to evenly distribute the bodies.

I've managed to get the algorithm working but it runs extremely slowly. Even with only sixty bodies to distribute, it takes over thirty seconds for all intersections to be solved and the bodies to return to sleep. For 120 bodies, it takes well over three minutes, which is horrendously slow.

The simulation progresses quickly when many bodies are overlapping, but slows down dramatically as the area becomes increasingly crowded with bodies. I suppose each body must have more work to do, in an abstract sense, to push an increasingly large number of bodies and interlocking rows of bodies out of the way.

I've tried making each body 0.00001f units in density (therefore lowering mass?), I've tried increasing the restitution value of each body and lowering the friction and linear damping values, but the simulation runs at about the same speed. Even multiplying the number of time steps, position iterations, and velocity iterations by ten doesn't seem to do anything.

So my question is, how can I tweak the simulation or each body's parameters as to greatly increase the speed at which every intersection will be solved? Accuracy of the simulation is no issue; I am subverting it anyway by rounding the coordinates to the nearest 32 px in the end.

Description of my physics bodies and fixtures:

b2BodyDef roomGenBody;
b2PolygonShape roomGenPolygonShape;
b2FixtureDef roomGenFixture;

roomGenBody.type = b2_dynamicBody;
roomGenBody.fixedRotation = true;
roomGenBody.linearDamping = 0.001f; // Seems to have no effect.
roomGenBody.allowSleep = true;

roomGenFixture.density = 0.00001;
roomGenFixture.restitution = 60.0f; // As far as I understand, more bouncy objects repel each other with greater force?
roomGenFixture.friction = 0.0f;

Concerning the world and running the simulation:

b2Vec2 physicsGravity(0.0f, 0.0f); // No gravity and at no angle.

float32 timeStep = 1.0f / 60.0f;  // Increasing timestep doesn't seem to have a very noticible effect.
int32 velocityIterations = 10;
int32 positionIterations = 8;

physics->Step(timeStep, velocityIterations, positionIterations);

Attached is an image describing my problem- Orange lines are the boundaries of my boxes, labelled 1-160:

Please let me know if any necessary information is missing. Thanks!

sentences:
Indirect indexing (uv coords read from texture) In the vertex shader, I need to make a texture fetch, where the texture coordinate itself is read from some other texture.

vec2 uv = texture(someTexture,coords).xy;
vec4 val = texture(otherTexture,uv).xyzw;

As far as I know, the second sample has undefined results, because the value of uv is outside of uniform flow control.

Is there any way to efficiently (i.e., not copy back the contents of the texture and upload it as a uniform to the shader or something) do what I want to do?

sentences:
Why is my XInput gamepad press stamp not working? I'm trying to add basic gamepad input to my c++ DirectX game but i'm having some trouble creating a press stamp (registers the press only the first time it's pressed if button held down).

The entire input class is here:
https://gist.github.com/anonymous/28be899570c72fe7ae98

My ButtonPressed function:

bool Input::wasGamePadButtonPressed(int padNum, WORD button)
{
    if((gamepad[padNum].wButtons & button) &
        ((gamepad[padNum].wButtons & button) != (prevGamepadState[padNum].wButtons & button)))
    {
        return true;
    }
    return false;
}

The It's just as basic press stamp, if the button is down, and the button was not down before, return true, else return false.

In my input::strobe() i strobe all the inputs and collect their states. at the beginning of the strobe i copy the current states and save them to a previous states structure

void Input::strobe(void)
{
    //hold on to the previous states for input stamping
    memcpy(prevKeys, keys, sizeof(keys));
    memcpy(prevGamepadState, gamepad, sizeof(gamepad));

    //gather keyboard
    HRESULT err;
    err = keyboard->GetDeviceState(sizeof(keys), (LPVOID) &keys);
    if((err == DIERR_INPUTLOST )|| (err == DIERR_NOTACQUIRED))
    {
        keyboard->Acquire();
    }

    //gather mouse
    err = mouse->GetDeviceState(sizeof(mouse_state), (LPVOID) &mouse_state);
    if((err == DIERR_INPUTLOST )|| (err == DIERR_NOTACQUIRED))
    {
        mouse->Acquire();
    }

    //strobe controllers
    if(hasGamepads)
    {
        for(int ii = 0; ii < 4; ii++)
        {
            ZeroMemory(&gamepad[ii], sizeof(XINPUT_STATE));
            XINPUT_STATE state;
            DWORD result = XInputGetState(ii, &state);

            if(result == 0)
            {
                gamepad[ii] = state.Gamepad;
            }
        }
    }
}

This works fine for my keyboard press stamp, which is very similar to the gamepad press function, but the game pad one refuses to work for some reason, firing true every frame for as long as i hold down the button.

It seems really straight forward so i cannot think of why it't not working. the only thing i can think is an issue in the strober, which i did not write originally (most of the basic directinput stuff was given in a class i took), or its me misunderstanding bitwise masks and I've got that gamepadpressed function totally wrong.

sentences:
Oblique launch within a game I'm creating a simple game in python that will follow the same logic of DDTank and Worms. The graph is formed by characters. The buildings that will be destroyed are formed by '*', players are '@' and the projectile I still did not think the character. For now I did the part that draws the buildings with a random height.

But I was thinking the logic of launching projectiles. I learned in physics classes some formulas for oblique launch. So wanted to know if these formulas would fit in a computer program or I would have to invent another logic?

Formulas:

vx = v0 . cos ?
x = vx * t
v0y = v0 * sen ?
y = v0y * t + g * t² / 2

sentences:
One AI object for each npc Let's think for a moment a game where you'll have around 1k npcs, each one has to take its own decisions. Should each one has an object that decides what to do, or maybe exist one to process every unit?

Also, let's think about a complex ai, not just check if npc can see the player nor decides if npc will attack or not. Something like Dwarf Fortress does.

sentences: How to rotate an object to a specific transform? I am working on a car racing game and there are some times when the car rotates and ends up on its roof. On those situations I want the car to respawn on the same location. What can I do to rotate it so the car ends up on its wheels?

sentences:
Why does OnControllerColliderHit not work while Physics.CheckSphere() does? Using the following code below, when my character hits a crate and goes over it, it ends up floating in the air, while jumping is no issue. That successfully lands on the ground.
using UnityEngine;

public class Testing: MonoBehaviour
{
    public CharacterController Controller;
    //speed of the character
    public float Speed = 12f;
    // earth gravitational value
    public float Gravity = -9.81f;
    Vector3 velocity;
    //hit point of character
    float hp = 90;

    bool Grounded = true;

    public void OnControllerColliderHit(ControllerColliderHit hit)
    {
        Grounded = true;
        hp -= velocity.magnitude;
        velocity.y = 0;
        Debug.Log(hp);
    }

    public void OnControllerColliderExit(ControllerColliderHit hit)
    {
        Grounded = false;
    }

    public void Checkstatus()
    {
        if (Grounded == false)
        {
            velocity.y += 0.5f * Gravity * Time.deltaTime;
        }
    }

    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space) && velocity.y == 0)
        {
            velocity.y = 12;
            Grounded = false;
        }

        //check if it grounded
        Checkstatus();
        Controller.Move(velocity * Time.deltaTime);
    }
}

Here's an image showing the floating player:

And why does the code below (using Physics.CheckSphere()) have no issue? Feels like the above code is better (if working correctly), as it doesn't need to waste resource on checking the condition of Grounded (like in checkstate1()) every frame.
using UnityEngine;

public class NewPlayerMovement : MonoBehaviour
{
    public CharacterController Controller;
    public float Speed = 12f;
    public float Gravity = -9.81f;
    Vector3 velocity;
    public LayerMask groundmask;
    float hp = 90;

    bool Grounded = true;
    // Update is called once per frame

    void checkstate1()
    {
        Grounded = Physics.CheckSphere(this.transform.position, 0.85f,groundmask);
        if (Grounded==true)
        {
            hp -= velocity.magnitude;
            Debug.Log(hp);
            velocity.y = 0; }
     }

    public void Checkstatus()
    {
        if(Grounded==false)
        {
            velocity.y += Gravity * Time.deltaTime;
        }
    }
    void Update()
    {
        checkstate1();
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space)&&Grounded==true)
        {
            velocity.y = 12;
            Grounded = false;

        }

        Checkstatus();
        Controller.Move( velocity * Time.deltaTime);

    }
}

sentences:
How to improve image clarity in Unity 3d How to improve image clarity in Unity 3d. If we use same images for game developing in Adobe Flash and in Unity , flash game have more clarity , but in unity image will blur . Text Mesh also blur

How to get good clarity in unity games

I made a 2d game using quad,cube , sprite and Text Mesh . Platforms Android ,iPhone , Mac ,PC . Every platform have poor clarity

Image size is 44X44 pixels to 1024x1024 pixels

sentences:
NullReferenceException in Swipe Controller Script I am Getting a Exception in My Swipe Controller Script name Dot.Here is the Code

using UnityEngine;

 public class Dot : MonoBehaviour
 {
private Vector2 firstTouchPosition;
private Vector2 finalTouchPosition;

public float swipeAngle =0;
// Start is called before the first frame update
void Start()
{
    firstTouchPosition = new Vector2(0,0);
    finalTouchPosition = new Vector2(0,0);
}

// Update is called once per frame
void Update()
{

}

 void OnMouseDown()
{
    firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

    Debug.Log(firstTouchPosition);
}

void OnMouseUp()
{
    finalTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    Debug.Log(finalTouchPosition);
    CalculateAngle();
}

void CalculateAngle()
{
    swipeAngle = Mathf.Atan2(finalTouchPosition.y - firstTouchPosition.y, finalTouchPosition.x - firstTouchPosition.x)*180/Mathf.PI;
    Debug.Log(swipeAngle);
}  }

Please Tell ME What Im Doing Wrong.

sentences: Does Minecraft Really Rely on CPU More Than GPU For FPS? I understand that Minecraft runs on Java which is very demanding on the CPU (garbage collection and JVM processes), but I still don't understand how FPS is the CPU's responsibility. Shouldn't the CPU handle game logic while the GPU handles rendering the results of that logic asynchronously? Minecraft was developed using OpenGL libraries afterall. But I still see a ton of people saying that upgrading your CPU is more worth it than upgrading your GPU if you want good FPS on Minecraft. What's actually happening under the hood?

sentences:
Do I need to make network game fully deterministic to achieve a non-exploitable MOBA/RTS? First of all - I know some networking concepts and I coded couple games with GDX/Kryonet/Unity/UNET. I've read all the Gaffer's, Gambetta's and Valve's, but still, can't decide which approach should I follow.

Network engineers say that for the game to be truly 'safe', we need a fully authoritative server. To shorten the definition:

  A fully authoritative client-server system is when the client sends
  the input only, and the server runs the physics.

There are exceptions to this. Client-side simulation these days is required to maintain a real-time experience. It's impossible to achieve a real-time smooth movement without the interpolation, extrapolation and other prediction mechanisms.

I've integrated a small UNET network, where I can move my players around with a click-to-move. The synchronization is made through the built in commands and transmissions (syncvars). I perform the logic myself in callbacks. To fix the jitter, I combined all the knowledge from the websites above and coded a buffer which is blocking enemies coordinates for 100ms so I have some data to interpolate them on the clients. It basically views the enemies 100ms in the past.

I know that modern RTS games networking mechanisms are far more advanced than just buffering & interpolation, but it should be enough to create a concept similar to DOTA/LoL/Diablo 3 smooth feel.

As far as I get it there are two approaches:

Authoritative Input - sending inputs, receives positions & own corrections so the client can fix wrong predicted values
Non-authoritative Input - sending Transform values (position, rotation).

The second approach is believed to be non-deterministic, not authoritative and way easier to implement. Comes with a risk of cheating.

Of course it does come with a risk, but the server is the one with a head here. He owns all the objects, he checks their movement speed, teleportation, everything and transmits the correct data to the rest of the crew, not the cheated one.

From the other point of view, the first approach with input safety applies only to deterministic-lockstep simulations. I don't really know if modern games use this approach (I read that Blizzard's HoTS does, Valve's CS does, but I'm not sure of MOBA's).

My question is:

Is this unwise/unprofessional to transmit positions/rotations/transforms from the client to the server even, when the server decides what to do with them and passes through anti-cheat mechanisms? Writing a simple anti-speed/teleport hack seems a way easier than fighting with floating point determinism and making the server & client's simulations fully equal.

Is there something I'm missing?

sentences:
Why does a physics engine produce different results each run through? There are no random numbers in the engine and everything is calculated the same way. How can it happen differently each time?

This is on my own small physics engine that I made earlier that is written in lua and runs in the Moai SDK

sentences:
LibGDX: Issue with unitScale for Tiled and Box2D I've got the following: I use a TiledMap (loaded from a .tmx), each tile 32x32 pixels in size and generate the Box2D bodies for collision from the TiledMap's ObjectLayer. That all works fine, no errors or issues. The only thing is a very strange behavior of the OrthogonalTiledMapRenderer: It gets a unitScale with the value 1 / 32 (because one unit is 32 pixels) as advised on the LibGDX GitHub wiki page. The same unit scale is used for Box2D. Thought in theory this should work just fine it renders the map very small (same is the case for the Box2D bodies, they're shown very small by the Box2DDebugRenderer):

Here is my code (more or less simplified):

public class MainScreen {
    private OrthographicCamera camera;
    private ScreenViewport viewport;
    private SpriteBatch batch;
    private World world;
    private TiledMap tiledMap;
    private OrthogonalTiledMapRenderer tiledMapRenderer;

    public MainScreen() {
        this.batch = new SpriteBatch();
        this.world = new World(new Vector2(), true);
        float unitScale = 1.0f / Constants.TILE_SIZE;

        this.camera = new OrthographicCamera();
        this.camera.setToOrtho(false, Gdx.graphics.getWidth() * unitScale,
            Gdx.graphics.getHeight() * unitScale);
        this.viewport = new ScreenViewport(this.camera);
        this.tiledMap = (new TiledMapLoader()).load("level/test-level.tmx");
        this.tiledMapRenderer = new OrthogonalTiledMapRenderer(this.tiledMap,
            unitScale, this.batch);

        // Create bodies in world based on map
        Collisions.create(this.world, this.map, unitScale);
    }

    public void render(float delta) {
        // Clear the screen
        Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        this.world.step(delta, 6, 2);
        this.camera.update();
        this.tiledMapRenderer.setView(this.camera);
        this.tiledMapRenderer.render();
    }

    public void resize(int w, int h) {
        this.viewport.update(w, h);
    }
}

I've got no idea why this is happening... Thanks in advance :)

sentences:
How to render metaballs? How  to render metaballs?
I am a Python programmer familiar with the Panda3d and Blender3d APIs. My math kinda sucks, but I know enough to write game logic code and procedural model generation code, as well as importers/exporters for the 3d modeller Blender. So you kind of get my level of experience. So can anyone explain or link to a tutorial which explains what needs to be done, without advanced math or with mentioning what math concepts are needed?

This is what I want to achieve:

http://www.youtube.com/watch?v=dEipENLes10
http://www.dailymotion.com/video/xn3xfn_mercury-meltdown-psp-un-trailer-pour-mercury-meltdown_videogames?search_algo=2

Though with probably more metaballs on screen at the same time.

sentences:
How do engine sounds for vehicles work? How does the engine sound for a car (or whatever has an engine) work?

When you increase the throttle the engine sound changes but it's never quite the same. When programming such a system what is the high level view of how it works. I know that there is some looping involved in the sound files but how do you transition when for example you change gear or you increase/decrease the throttle? How would one go about getting and preparing the sound files?

sentences:
Most efficient way of brighten and darken sprites with OpenGL > 2.0 So I have been shading (brighten/darken +adding color) my sprites by using glTexEnvf with GL_MODULATE and GL_ADD and a vertex color.
I only had to rebind the batch every time I needed to change from modulate to add and vice versa.
it was not perfect but worked well enough.

However libGDX 1.0 dropped support for OpenGL1.1 and the only way I see is to use shaders. I want to stay up to date and therefore want to update.
I am new to shaders but I found some code that works to brighten a sprite. However as far as I understood I need to rebind the batch every time I want another value for my brightness => batch binding on every sprite I render. That is not very performant.

Is there a way to change values between the bindings? (I don't think it's possible because shaders get compiled afaik).
Or do you have another idea how to archive this effect with openGL2.0 (like I did before)?
Or is rebinding every sprite the most efficient way with OpenGL2.0?

sentences:
pause Menu only working in one scene and not in others Hi I'm working on a game for a school project but I'm still pretty new at game dev, I decided to add a pause menu to my game but for some reason, it only works in one of the scenes in unity, and I can't tell why it won't work on any of the other ones
Here is a video showing the problem: https://youtu.be/28fD9UEtfpg
and here is my script just in case
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;

public GameObject PauseMenuUI;

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        if (GameIsPaused)
        {
            Resume();
        }
        else
        {
            Pause();
        }
    }
}

public void Resume()
{
    PauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameIsPaused = false;
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

void Pause()
{
    PauseMenuUI.SetActive(true);
    Time.timeScale = 0f;
    GameIsPaused = true;
    Cursor.lockState = CursorLockMode.None;
    Cursor.visible = true;
}
}

sentences:
Can I directly pass a Boost ptr_vector list to glBufferData? I have a data structure like this:

typedef struct vertex_ {
float x;
float y;
float z;
float s;
float t;
}vertex;

Then I add to a list called: boost::ptr_vector<vector> vertices;

Is there a way to use vertices to provide the parameters for glBufferData?

sentences:
Which Unreal Engine 4 project files can I ignore in source control? I want to put an Unreal Engine 4 project under source control with git. (I know the editor has Perforce and Subversion support, but I don't care for those.)

What folder and files do I include in the repository and which can I ignore?

The way I see it, the following is needed: Config, Content, Source, *.sln, *.uproject

Things that I can ignore: Binaries, DerivedDataCache, Intermediate, Saved, *.suo, *.sdf, *.opensdf

Is this correct?

sentences:
Möller-Trumbore false positive I've implemented the Möller-Trumbore algorithm but I hit some false positive:

Ray: vec3(2.100000, -1.000000, 3.314214), vec3(0.685786, -1.000000, 1.900000)
Collide with: vec3(1.000000, 1.000000, -0.999999), vec3(0.999999, 1.000000, 1.000001), vec3(1.000000, -1.000000, 1.000000))
uvt=vec3(0.435307, 0.198000, -1.603999)

If I draw the collision, I see clearly that the ray does not intersect with the triangle.

From this site: http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection
I wrote this code:

bool Node::rayIntersectTriangleDebug(const glm::vec3 orig, glm::vec3 dir
                       , const glm::vec3 vert0, const glm::vec3 vert1, const glm::vec3 vert2
                       , glm::vec3 &result)
  {
    //dir = glm::normalize(dir);

    const glm::vec3 edge1 = vert1 - vert0;
    const glm::vec3 edge2 = vert2 - vert0;
    const glm::vec3 pvec = glm::cross(dir, edge2);
    const float det = glm::dot(edge1, pvec);

    const float Epsilon = std::numeric_limits<float>::epsilon();

    if (det > -Epsilon && det < Epsilon)
      return false;

    const float invDet = 1.0f / det;

    const glm::vec3 tvec = orig - vert0;

    result.x = glm::dot(tvec, pvec) * invDet;
    if (result.x < 0.0f || result.x > 1.0f)
      return false;

    const glm::vec3 qvec = glm::cross(tvec, edge1);

    result.y = glm::dot(dir, qvec) * invDet;
    if (result.y < 0.0f || result.x + result.y > 1.0f)
      return false;

    result.z = glm::dot(edge2, qvec) * invDet;

    const float abs = std::abs(result.z);
    const float dist = std::abs(glm::distance(orig, dir));

    const glm::vec3 intersection = vert0 + result.x * edge2 + result.y * edge1;

    if (abs < dist)
      {
         return true;
      }
     return false;
  }

Also I'm not sure if I have to normalize my direction vector.

EDIT

I've red here that

  I'm not sure if it should be normalized or not, but tests I've
  conducted over a normalized version yelded valid results

I've tried to normalize my direction with the following code without success:

const glm::vec3 dir = glm::normalize(officialDirection - orig);

sentences:
Show view over existing view in same activity I am newbie Android developer, and I am starting out with a simple Sudoku game. The problem I am facing right now is that I have my game showing on a dedicated Activity, which is displaying a custom View class. I have the code within the onDraw function. Now I want to show a custom keypad view, which is a separate class extending View, whenever a user clicks on a block in the Sudoku grid.

I am extremely confused as to how I should go about doing this. I am reluctant to create a dedicated activity for just this keypad, and want to show this keypad over the Sudoku grid view that the activity is currently displaying.

The activity is using setContentView(myCustomGridViewClass) to show the grid. Now I want something to the equivalent of

onTouch -> setContentView(myCustomKeypadView), though this should appear over the previous view.

I have tried reading about the LayoutInflater, but did not understand how to use it to show the keypad within this same activity. This is probably a very noob question, but any help, including any other questions, or sources I could refer to for an answer would be highly appreciated.

Regards,

sentences:
Unity: Messages in Compound Colliders Lets say I have a 2D character with two colliders: a circle collider that represents the feet, and a box collider that represents the body. Lets say that the character is currently standing on the ground, i.e. only the feet collider is in contact with the ground collider. According to the Unity manual, I will receive an OnCollisionEnter2D message. That message contains a Collision2D object that contains an otherCollider field of type Collider2D. I don't see anything in that object that would tell me which of the two colliders - the body or the feet - initiated the message.

So my question is this: how do you figure out which collider in a compound collider initiated a collision/trigger message?

sentences:
How to properly implement alpha blending in a complex 3D scene? I know this question might sound a bit easy to answer but It's driving me crazy. There are too many possible situations that a good alpha blending mechanism should handle, and for each Algorithm I can think of there is something missing.

These are the methods I've though about so far:

First of I though about object sorting by depth, this one simply fails because Objects are not simple shapes, they might have curves and might loop inside each other. So I can't always tell which one is closer to camera.
Then I thought about sorting triangles but this one also might fail, thought I'm not sure how to implement it there is a rare case that might again cause a problem, in which two triangle pass through each other. Again no one can tell which one is nearer.
The next thing was using depth buffer, at least the main reason we have depth buffer is because of the problems with sorting that I mentioned but now we get another problem. Since objects might be transparent, in a single pixel there might be more than one object visible. So for which object should I store pixel depth?
I then thought maybe I can only store the most front object depth, and using that determine how should I blend next draw calls at that pixel. But again there was a problem, think about two semi transparent planes with a solid plane in middle of them. I was going to render the solid plane at the end, one can see the most distant plane. Note that I was going to merge every two planes until there is only one color left for that pixel. Obviously I can use sorting methods too because of the same reasons I've explained above.
Finally the only thing I imagine being able to work is to render all objects into different render targets and then sort those layers and display the final output. But this time I don't know how can I implement this algorithm.

sentences:
Creating a UI health bar image for each enemy object I would like to create a small health bar on top of each enemy in my game. I know how to do this for one enemy, but I'm not completely sure how best to expand it to work for each enemy in the game. I'm guessing I should instantiate the UI health bar prefab somewhere, each time an enemy is spawned maybe? Currently, I don't even have an enemy spawner, I'm just testing by dragging enemy prefabs into the scene. I'll post the relevant scripts.

public class EnemyHealthBarController : MonoBehaviour
{
    private Image remainingHealthImage;

    private EnemyHealth enemyHealth;

    void Start()
    {
        remainingHealthImage = transform.Find("Remaining Health Image").gameObject.GetComponent<Image>();

        enemyHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent<EnemyHealth>();
    }

    void Update()
    {
        remainingHealthImage.fillAmount = enemyHealth.currentHealth / enemyHealth.maxHealth;

        if (enemyHealth.isDead)
        {
            gameObject.SetActive(false);
        }
    }
}

and

public class ClampEnemyHealthBar : MonoBehaviour
{
    private GameObject enemyHealthBar;

    private Vector3 offset;

    void Start()
    {
        enemyHealthBar = GameObject.Find("Enemy Health Bar");

        offset = new Vector3(0f, 30f, 0f);
    }

    void LateUpdate()
    {
        Vector3 desiredPosition = Camera.main.WorldToScreenPoint(transform.position) + offset;
        enemyHealthBar.transform.position = desiredPosition;
    }
}

Right now, I'm using GameObject.Find to set a reference to the preexisting enemy health bar in the scene. Also, I'm only finding the EnemyHealth component of one of the enemies. How might I better structure this in order to do the kind of thing I'm trying to do?

sentences:
Position UI.Button to mouse position This has been discussed a couple of times, but I didn't find any solution:

I want to set the position of an UI.Button to my mouse position.
I can get the mouse position like this:

Vector3 cameraVector = Camera.main.ScreenToWorldPoint(Input.mousePosition);

Problem: The UI elements are using another "coordination system". How can I handle that problem?

sentences:
Xcode on Hackintosh (under VM) Should I be pessimistic about the iOS game development under VM? A virtualized environment will run on AMD (4-core 2.8 ghz Phenom II)/ATI/Linux/VMware host.

Not talking about any 3D engines, may Xcode's emulator bring at least 15-20 FPS for a simple 2D game like, errr, Airport Mania?

sentences:
what can be done to improve the ultimate insane real time strategy game AI? I had this chat with a friend of mine about whether an AI can be created or not that could beat any human without resource cheating in a real time strategy game. An AI that would play almost perfectly. The AI of today's games have many areas that can be improved, most of them rely on resource cheating, a better early base developement because of that, and attacking in waves.

Still, the question is what would need to be done to improve on this to obtain the ultimate AI. Also, if you have any example of a game where a certain feature was used it would be great.

Edit: There is little clarification i can provide for those who haven't read the title or the few paragraphs describing the problem. This is about real time strategy games and the ultimate AI. That means Strarcraft, Warcraft, Generals, Red Alert, Age of Empires, AI War etc. Games that have more than one difficulty level, but the focus here is on the ultimate challenge.

tenpn has a fantastic post filled with great resources. Thank you, tenpn! I wish more people would contribute in that direction.

sentences:
How to turn a 3d camera (in HTML5 2D Canvas) A few years back I started experimenting with 3d in canvas. Everything went pretty well untill I had to to turn the camera, I couldn't get it done.

A few days back I just happened to stumble upon that project again and noticed I got pretty far with it, sure, the code was a mess... so I cleaned it up a little and started fixing the camera rotation... And... I still have no clue how to do it. I tried google but so far nothing worked, I just have no idea what I'm doing....

Can somebody help me with this?

The code is located here: http://johandam.com/etc/3d

The relevant pieces are (probably) located here:

http://johandam.com/etc/3d/js/obj.js < General 'entity' class, here the 3d world coordinates are translated to 2d screen coordinates, it used to adjust it's position based on the camera's rotation but then distance-checking got all messed up so I moved it to the camera class, which I think makes more sense anyway.

http://johandam.com/etc/3d/js/camera.js < the camera object. A lot of movement code and at the end I try to adjust the camera based on it's rotation.

The idea is to have a target point around which the camera rotates but I'm pretty sure that somewhere a long the line I mixed a couple of different methods in it and I have no idea what I'm doing...

Who can help me out here?

sentences:
What's a good data structure solution for a scene manager in XNA? I'm playing with XNA for a game project of myself, I had previous exposure to OpenGL and worked a bit with Ogre, so I'm trying to get the same concepts working on XNA.

Specifically I'm trying to add to XNA a scene manager to handle hierarchical transforms, frustum (maybe even occlusion) culling and transparency object sorting.

My plan was to build a tree scene manager to handle hierarchical transforms and lighting, and then use an Octree for frustum culling and object sorting. The problem is how to do geometry sorting to support transparencies correctly. I know that sorting is very expensive if done on a per-polygon basis, so expensive that it is not even managed by Ogre.
But still images from Ogre look right.

Any ideas on how to do it and which data structures to use and their capabilities? I know people around is using:

Octrees
Kd-trees (someone on GameDev forum said that these are far better than Octrees)
BSP (which should handle per-polygon ordering but are very expensive)
BVH (but just for frustum and occlusion culling)

Thank you

Tunnuz

sentences:
Behavior Trees and Animations I have started working on the AI for a game, but am confused how I should handle animations.  I will be using a Behavior Tree for AI behavior and Cocos2D for my game engine.

Should my "PlayAnimationWalk" just be another node in the tree?

Something similar to this:
[Approach Player]
- Play Walk animation
- Move Towards player
- Stop Walk animation

Or should the node just update an AnimationState in the blackboard and have some type of animation handler/component reference this for which animation should be playing?

This has been driving me nuts :)

sentences: What should I use to handle input? What should I use to handle input? I am wanting to use OpenGL so that my games are cross platform. DirectX provides input libraries, and OpenGL does not. Because my games need to be cross platform, I cannot use DirectX's libraries. What should I do, or what is the common solution to this type of problem?

sentences:
Scripting for a C#, multiplayer game I have a multiplayer game written in C# and we've recently been creating a lot of content but have been looking for a way to give our entities customization logic that the designers can hook into. I took a look at this post. With something like this in mind (using C# as a scripting language); I have a few questions.

Would one embed the script itself in the entity object before persisting to it to the disk? Is this okay?

Would I compile once per scripting then - this seems like a lot of overhead to store all these compiled Assemblies to execute.

Any general advice on how to do thigns is welcome, too. These entities are generated on the fly inside the editor and could be composed of a lot of different things.

sentences:
How can I load and store data for a large map in Unity I'm working on a tower defense game. I have this structure:
int array (public int[,,,] gridArray = new int[2000, 2000, 9, 9];)
that I'm using as a map-bible; by map-bible I mean that the array holds all the cell data that the game uses to build its map form.
What I am specifically asking for is a way to store that data in any file format without needing to massively rework my game.
The first two dimensions of the array store x and y, while the last two dimensions hold cell-specific data. In most cases, this cell-specific data stores building health or ammo. But the vast majority of the 81 cells are empty to accommodate more things down the line. It should be noted that all this data is simply integers that are passed on to game objects, for example: newbuilding.health = gridArray [x,y,0,1];
It should be noted I am a novice level programmer and in way over my head, so detail would be appreciated.

sentences:
Using a sphere collider in combination with FoV I have a character and some npc's in my game. I want the npc's to look out for my character using a sphere collider. Well it kind of works but of course not as i want. When the npc is looking at me and a colission occurs it should trigger some chasing behaviour, but if the npc look in another direction, it should not trigger that behaviour.

So i need something like a field of view inside the collider. I watched some tutorials like https://www.youtube.com/watch?v=rQG9aUWarwE and  https://www.youtube.com/watch?v=mBGUY7EUxXQ but it should be 3 dimensional so not only on the ground like in the tutorial. I added a picture to visualize it

How can i accomplish this?

sentences:
What is wrong with my Chest script? I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script.

#pragma strict
var Text : GameObject;
var OpenedChest : GameObject;
var CurrentChest : GameObject;

function OnTriggerEnter()
{
    Text.SetActive(true);
    if (Input.GetKeyDown("e"))
    {
        CurrentChest.SetActive(false);
        OpenedChest.SetActive(true);
    }
}

function OnTriggerExit()
{
    Text.SetActive(false);
}

I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?

sentences:
Is web browsers, how much latency is there with event listeners? I have an event listener in JavaScript looking for keydown events.
document.addEventListener('keydown', e => {
    // Callback code
});

What is the latency between someone pressing a key and my function executing. Is the function immediately added to the event queue or does it wait until the next frame is ready to be drawn? Is the behavior consistent between web browsers?
Just to be extra clear, I'm only interested latency in the context of web browsers, not anything before it.

sentences:
How to sample png heightmap in HLSL I am working on simple parallax shader and I have problem with sampling height texture for value.
My aproach amples texture and give me RGB values of picture:

tex2D(TextureHeightSampler, input.BaseOutput.TexCoordAndViewDistance.xy)

But I am not sure how to convert RGB data to height value. How to solve that?

sentences:
Is it possible to animate the texture of a model? Below is how far I've got. I just made a simple block with user primitives to test it. But I haven't found a way to crop the spritesheet.

textureLava = frames[activeFrame];

This line is how I want it but off course this doesn't work. Is there a way to crop this spritesheet or is there another way to animate the texture of a model?

public void CreateFrames()
{
    for (int i = 0; i < 64; i++)
    {
        frames.Add(new Rectangle(WIDTH + i, i, WIDTH, HEIGHT));
    }
}

public override void Update(GameTime gameTime)
{
    if (System.Environment.TickCount - lastFrameTime > TIME_BETWEEN_FRAMES)
    {
        activeFrame++;
        lastFrameTime = System.Environment.TickCount;

        if (activeFrame > 15)
        {
            activeFrame = 0;
        }
    }

    textureLava = frames[activeFrame]; --> DOESN'T WORK

    base.Update(gameTime);
}

public override void Draw(GameTime gameTime)
{
    effect.TextureEnabled = true;
    effect.World = Matrix.Identity;
    effect.View = Camera.ActiveCamera.View;
    effect.Projection = Camera.ActiveCamera.Projection;

    effect.Texture = textureLava;

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        GraphicsDevice.SetVertexBuffer(vertexBuffer);

        GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 10);
    }
}

sentences:
What formula does this projectile velocity code derive from? //Calculate the velocity needed to throw the object to the target at specified angle.
float projectile_Velocity =
            target_Distance / (Mathf.Sin(2 * firingAngle * Mathf.Deg2Rad) / gravity);

Which formula is used to derive this projectile code?

sentences:
Unexpected result when generating world with 2 perlin noises I try to generate a world with a temperature and an humidity noise to generate biome based on the y values of the two. I take the y values and round them on a 33 base for the humidity and 25 for the temperature then add the two to get 12 possibilities of biome. to test it I first tried generating a chunk by assining the sum of humidity and temperature to their y location. I was expecting to get multiple platform at different height (12 possibilities of height) but I instead got this
even if it doesn't look like it, there are random patterns within the bigger layers. i don't understand why I got that result (which looks pretty sick not gonna lie).
here is my script
const int seed = 50;
const int FREQUENCE = 100;
const int AMPLITUDE = 100;
const int size = 100;

int[] BIOME_DATA = { 0, 33, 66, 25, 58, 91, 50, 83, 116, 75, 108, 141 };

int[] temp_VERT = new int[100 * 100];
int[] hum_VERT = new int[100 * 100];
public int[] biome_VALUE = new int[100 * 100];

void Start()
{
    //generate the y values for the humidity vertices
    for (int x = (int)transform.position.x, i = 0 ; x < size+ (int)transform.position.x; x++)
    {
        for (int z = (int)transform.position.z; z < size+(int)transform.position.z; z++)
        {
            float y = Mathf.PerlinNoise((float)x+seed / FREQUENCE, (float)z / FREQUENCE) * AMPLITUDE;
            y = Mathf.Floor(y / 33) * 33;
            hum_VERT[i] = (int)y;
            i++;
        }
    }

    //generate the y values for the temperature vertices
    for (int x = (int)transform.position.x, i = 0; x < size+ (int)transform.position.x; x++)
    {
        for (int z = (int)transform.position.z; z < size+ (int)transform.position.z; z++)
        {
            float y = Mathf.PerlinNoise((float)x-seed / FREQUENCE, (float)z / FREQUENCE) * AMPLITUDE;
            y = Mathf.Floor(y / 25) * 25;
            temp_VERT[i] = (int)y;
            i++;
        }
    }

    //assigne une valeur représentant un biome pour chaque vertex
    for(int i = 0; i < biome_VALUE.Length; i++)
    {
        biome_VALUE[i] = System.Array.IndexOf(BIOME_DATA, (hum_VERT[i] + temp_VERT[i]));
        //biome_VALUE[i] = new Vector2(temp_VERT[i],hum_VERT[i]);
    }

    GenerateChunk(biome_VALUE);
}

void GenerateChunk(int[] Y_VERTICES)
{
    Mesh meshy;
    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();
    meshRenderer.sharedMaterial = new Material(Shader.Find("Standard"));
    MeshFilter meshFilter = gameObject.GetComponent<MeshFilter>();

    Vector3[] VERTICES = new Vector3[Y_VERTICES.Length];
    List<Vector2> UV = new List<Vector2>();
    List<int> TRIANGLES = new List<int>();
    List<Vector3> NORMALS = new List<Vector3>();

    meshy = new Mesh();

    //création des Vecteur
    for (int i = 0, x = 0; x < size; x++)
    {
        for (int z = 0; z < size; z++)
        {
            VERTICES[i] = new Vector3(x+transform.position.x, BIOME_DATA[Y_VERTICES[i]], z+transform.position.z);
            i++;

        }
    }

    //création des normales
    for (int i = 0; i < VERTICES.Length; i++)
    {
        NORMALS.Add(-Vector3.forward);
    }

    //création des triangles
    for (int x = 0; x < size - 1; x++)
    {
        for (int z = 0; z < size - 1; z++)
        {
            int i = size * x + z;
            TRIANGLES.Add(i);
            TRIANGLES.Add(i + 1);
            TRIANGLES.Add(i + size);
            TRIANGLES.Add(i + size + 1);
            TRIANGLES.Add(i + size);
            TRIANGLES.Add(i + 1);
        }
    }

    //création des uv
    for (int i = 0; i < VERTICES.Length; i++)
    {
        UV.Add(new Vector2(VERTICES[i].x, VERTICES[i].z));
    }

    //assignation des valeurs
    meshy.vertices = VERTICES;
    meshy.triangles = TRIANGLES.ToArray();
    meshy.uv = UV.ToArray();
    meshy.normals = NORMALS.ToArray();
    meshFilter.mesh = meshy;
}

}

sentences:
How to make legacy animations run in Unity in unscaled time? (Pause game related) I'm relatively new to Unity, and I've been having a very difficult time getting the legacy animations to run in unscaled time.  I need to pause my game, and as soon as it pauses, I need to have my boxes for the pause screen come in from the side.  This sort of works if I use an IEnumerator, but I have to hard-code exactly how long it will take for the animation to come in (.333f seconds) and the game will not pause until the animation fully shifts in.

The major problem with this is that I need to use more moving animations while the game is paused that will be called using the onClick() methods in the pause game's buttons.  Think of my pause menu as somewhat like an old-school RPG's menu like Final Fantasy but with moving GUI animations.
Now, I know that unscaled time is the key to solving this issue, but every explanation I've found online seems to involve the Animator which refuses to work with the legacy? animations.  Either that, or the code they're using makes little sense to me because it may be above my level of comprehension.  Here is what I have as it stands (*note that I have some deltaTime and _lastframetime code but I have no idea how to make use of it):

// Update is called once per frame
void Update () {
    deltaTime = Time.realtimeSinceStartup - _lastframetime;
    _lastframetime = Time.realtimeSinceStartup;

    //Press T or Tab to pause the game
    if (Input.GetKeyDown(KeyCode.T) || Input.GetKeyDown(KeyCode.Tab)) {
        //If not currently paused, then stop time and show the GUI
        if (!pauseGame) {
            Debug.Log("Tab/T properly pressed to pause game.");
            pauseGame = true;
            showGUI = true;
            StartCoroutine(Wait(.333f)); //IEnumerator Wait, then stops
        }else if (pauseGame){
            Debug.Log("Tab/T properly pressed to UNpause game.");
            Time.timeScale = 1;
            pauseGame = false;
            showGUI = false;
        }

        //If we are to show the GUI, play the start animation; otherwise, the exit one
        if (showGUI == true) {
            //startMenuCanvas.animation.
            startMenuCanvas.animation.Play ("pause_menu_anim1");
        } else {
            startMenuCanvas.animation.Play ("pause_menu_anim1_exit");
        }
    }
}

IEnumerator Wait(float seconds){
    Debug.Log ("Waited for " + seconds + " seconds.");
    yield return new WaitForSeconds(seconds);
    Time.timeScale = 0;
}

Ideally, I want to remove the IEnumerator and be able to call the Play animations using unscaled time.  Is there any simple way to do this that I am missing?

sentences:
1D Perlin Noise Game in Unity I'm working on a 2D side-scrolling game in the Unity engine. I am using the 1-Dimensional Perlin Noise function and using pseudo-code. I can't use two links so I'll provide a link to imgur with the images and the links in numerical order. First link in imgur links to the pseudo-code/implementation of perlin noise I am using.
My implementation so far is showing good results.
Here is a picture:

This image uses the values:

Persistance = 0.7

Octaves = 4
From the first article I linked, it states:

Now, you'll want several different random number generators, so I
suggest making several copies of the above code, but use slightly
different numbers. Those big scarey looking numbers are all prime
numbers, so you could just use some other prime numbers of a similar
size.

This block of text is referring to this part of code which is an Integer-noise function:
  float Noise (int x)
    {
        x = (x << 13) ^ x;
        return (float)(1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
    }

Another site I found the author adjusts the Integer-noise function from discrete to continuous (allowing the range not to be limited). I've made this change although I am not sure if my implementation of both links I've provided is entirely correct. The results are promising but when you change these variables values to:

Persistence = 1

Octaves = 8

the terrain starts to have little gaps at the bottom like so:

I am not quite sure how to fix this, I know lowering the persistence provides smoother results resolving this issue but that makes the terrain's amplitude rather low for a side-scrolling platformer.
Here is the complete code:
    void Start ()
    {
        objectArray = new GameObject[width, height];

        for (int i = 0; i < width; i++) {

            float x = PerlinNoise_1D (i, persistances, octaves);

            for (int j = 0; j < height; j++){
                objectArray[i,j] = (GameObject)Instantiate (gameobject, new Vector3 (i, j + x, 0), Quaternion.identity);
            }
        }

    }

float Noise(int x){
    x = (x << 13) ^ x;
    return (float)(1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
}

float CoherentNoise  (int x)
{
    int intX = (int)(Mathf.Floor(x));
    float n0 = Noise (intX);
    float n1 = Noise (intX + 1);
    float weight = x - Mathf.Floor (x);
    float noise = Mathf.Lerp (n0, n1, weight);
    return noise;
}

float SmoothedNoise (int x)
{
    return CoherentNoise (x) / 2 + CoherentNoise (x - 1) / 4 + CoherentNoise (x + 1) / 4;
}

float InterpolatedNoise (float x)
{

    int integer_X = (int)x;
    float fractional_X = x - integer_X;

    float v1 = SmoothedNoise (integer_X);
    float v2 = SmoothedNoise (integer_X + 1);

    return Cosine_Interpolate (v1, v2, fractional_X);
}

float Cosine_Interpolate (float a, float b, float x)
{
    float ft = x * (float)Mathf.PI;
    float f = (float) ((1 - Mathf.Cos ((ft))) * .5);

    return  a * (1 - f) + b * f;
}

float PerlinNoise_1D (float x, float persistance, int octaves)
{

    float total = 0;
    float p = persistance;
    int n = octaves - 1;

    for (int i = 0; i <= n; i++) {

        float frequency = (float)Mathf.Pow (2, i);
        float amplitude = Mathf.Pow (p, i);

        total +=  InterpolatedNoise (x * frequency) * amplitude;
    }

    return total;

}

Thank you for your help and time.

sentences:
What is an efficient way to deal with large, scrolling background images? In my mobile game you basically you just fly up (infinite height) and collect stars.

I have many quite large background images, scaled down so that their width is the same as the device width. Then they are appended after each other during rendering.

Since I implemented these backgrounds, my game runs poorly. I've got about 20 background images with a size of 800x480 each; without backgrounds the game is quite smooth.

Does anyone have an idea how to implement this many backgrounds without making the game slow down?

The images are used as a 2DTexture.
If I leave the clouds out of the image and "just" display the blue part, the app still slows down. Showing some code is a bit difficult, because I got many many classes which will do the loading, rendering and display stuff. Basically its done as Google does it in there "spriteMethodTest" example here:
http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest

2 of these image set.

First: http://picbox.im/view/b7c8c86abb-01.png

Second: http ://picbox.im/view/3a8162314a-02.png

sentences:
Animations only play when moving along the Y axis My problem is, I have walk animations which only play when my character is moving upward or downward, and I don't know why. This is my code:

public float speed = 5f;
private Animator anim;

void Start () {
    anim = gameObject.GetComponent <Animator>();
}

void Update () {
    anim.SetFloat ("Speed", Mathf.Abs (Input.GetAxis ("Horizontal")));
    anim.SetFloat ("Speed", Mathf.Abs (Input.GetAxis ("Vertical")));

    if (Input.GetAxis ("Horizontal") < -0.1f) {
        transform.localScale = new Vector3 (-1,1,1);
    }
    if (Input.GetAxis ("Horizontal") > 0.1f) {
        transform.localScale = new Vector3 (1,1,1);
    }
}

void FixedUpdate {
    Vector3 move = new Vector3 (Input.GetAxis("Horizontal"), Input.GetAxis ("Vertical"),0);
    transform.position += move*speed*Time.deltaTime;
}

sentences:
Collision between a player and a solid block C++ SDL2 I am trying to implement a collision between a player and a solid e.g. a solid box.

bool Collision::Checkcollision(const SDL_Rect &A, const SDL_Rect &B)
{
    return A.y + A.h >= B.y &&
    A.y <= B.y + B.h &&
    A.x <= B.x + B.w &&
    A.x + A.w >= B.x;
}

if (CKeyboard::Get()->GetKey(SDL_SCANCODE_DOWN))
        {
             Vel.y += 1.0f;
        }
        if (CKeyboard::Get()->GetKey(SDL_SCANCODE_RIGHT))
        {
            Vel.x += 1.0f;
        }
        if (CKeyboard::Get()->GetKey(SDL_SCANCODE_UP))
        {
            Vel.y -= 1.0f;
        }
        if (CKeyboard::Get()->GetKey(SDL_SCANCODE_LEFT))
        {
            Vel.x -= 1.0f;
        }
        Position = Position + Vel.GetNormalized();
        SDL_Rect r1 = Sprite->Get_Rect();
        SDL_Rect r2 = Sprite1->Get_Rect();
        if (Collision::Get()->Checkcollision(r1,r2))
        {

            if (Vel.x < 1.f)
            {
                Position.x = Position.x - 1;
                Vel.x = 0;
            }
            if (Vel.x > 0.f)
            {
                Position.x = Position.x + 1;
                Vel.x = 0;
            }
            if (Vel.y < 1.f)
            {
                Position.y = Position.y - 1;
                Vel.y = 0;
            }
            if (Vel.y > 0.f)
            {
                Position.y= Position.y + 1;
                Vel.y = 0;
            }
        }

The problem is I still can move through the box if i keep pressing a key.
So the question is what is the best way to implement collision in SDL?
Thank you in advance

sentences:
libgdx game not disposing My game does not exit entirely even after calling dispose() method. It loads a black screen when I launch it for the second time and works well if I kill the game manually and restart it.

I get an error that says buffer not allocated with newUnsafeByteBuffer or already disposed when I try to dispose off the SpriteBatch object. This is were I suspect the problem to be. But not able to fix it entirely. Please help!

Here is how I have built it (I have put the sample code here just to show you guys that there are no visible loop backs in dispose function, please correct me if I'm wrong)-
In game screen,

public void dispose() {
  AssetLoader.dispose();
  render.dispose();
  Gdx.app.exit(); }

Under class AssetLoader-

public void dispose(){
  Texture.dispose();
  sound.dispose();
}

Under game render class -

public void dispose(){
  spritebatch.dispose(); //throws an error when I GameScreen.dispose is called
  font.dispose();
  shaperender.dispose();
}

I believe that my spritebatch isn't disposing which is causing the black screen but I cannot find a way to dispose it off successfully. Any help would be greatly appreciated.

sentences:
How to set multiple times, in a single spritebatch, the same pixel shader parameter I make a test with Effect class in XNA and I want to set multiple times the same parameters (MyParameter in below code).

My code is :

[...]
//In Engine class
Effect ShaderEffect = GameEngine.Instance.Content.Load<Effect>(@"shaders\test");

spriteBatch.Begin(
    SpriteSortMode.Deferred,
    BlendState.AlphaBlend,
    SamplerState.PointWrap,
    DepthStencilState.Default,
    RasterizerState.CullNone,
    ShaderEffect);

[...]

//in drawable class
foreach(//big loop) {
     ShaderEffect.Parameters["MyParameter"].SetValue(//random vector4);
     spriteBatch.Draw(
            SpriteSheet,
            ScreenRect,
            sprite_to_draw.Rectangle,
            color,
            rotation,
            Scene.getInstance().Camera.Position,
            sprite_to_draw.SpriteEffect,
            layer
     );
}

[...]

//In Engine class
spriteBatch.End();
[...]

But on my screen it look like the Parameter "MyParameter" is not overwrite.

So can I overwrite it and If yes do you know how ?

Thanks

sentences:
Where can I pay artists to make models for my game? Lets say I get some money for my hobby project, and I would like to start filling it up with good models, instead of some cheap placeholder ones. What are some sites where I can pay people to make models for the game? How much would it cost per asset?

Edit: I don't want to hire anybody. I just want to pay them for individual assets.

sentences:
Calculate 2D tile map tiles within a "field of view" cone I need to calculate which tiles make up a "cone", originating at my player and extending outward for a specific tile distance.

My player can only face North, South, East, West and I'm not sure yet on the angles I'll use for the cone.

I've found several posts/articles already covering this but they're trying to determine visibility and are a lot more complex than I need. I'm not lighting a room or calculating shadows/occlusions.

sentences:
How to reset a gameobject to it's prefab condition? I have a GameObject with a ragdoll in it. Gameobject comes from a prefab which is pooled. So whenever the enemy is killed it's disabled then enabled when spawn.

Problem is that the ragdoll settings and it's condition cannot be reset by enabling.  i.e. enemy stays dead even though respawned.
Is there a way to easily reset a GameObject to prefab state?

Solution online is to keep all the transforms and re-apply them by code. Is this the only way?

sentences:
Java game Inventory problem I have a game where you walk around picking up items. They are supposed to go into the next empty slot in your inventory, but when I pick up an item all the empty inventory spots get filled with it.

How can I only have the first empty one be filled by the item that is being picked up:

Here is my code:

for (int i = 0; i < c.toArray().length; i++) {
  c.get(i).tick();

  for (int i1 = 0; i1 < play.items.p.toArray().length;i1++) {
    if (c.get(i).holdingid == 0) {
      // check if the player walks onto the item which means it should
      // be picked up:
      if(play.items.p.get(i1).r.intersects(play.p.r)) {
        // remove the item from the ground:
        play.items.p.get(i1).remove = true;
        // change the empty inventory spots to be filled with the item
        // that has been picked up
        c.get(i).holdingid = play.items.p.get(i1).holdingid;
      }
    }
  }
}

The problem is it fills all the inventory spots how can I make it only fill the first inventory spot.

sentences:
Algorithm for determining random events I'm struggling with coming up with an elegant solution to generating random events in the game that I'm working on.

Say there are 4 classes of events that can happen, with varying events in those classes that may occur.

So something along the lines of

main_events = {"common event", "not so common event", "somewhat rare event", "rare event"}
sub_events[0] = {"common event 1", "common event 2",..}
...

I have a somewhat kludgey solution in place that first just has a random number generated between 0 and 100, and if the number falls within a given range then a main event will be triggered.  Then I'll do another random roll to see which sub event occurs.

Is there a better solution than something along these lines?  Like I mention, it doesn't feel very elegant, and I'd like to make it easily expandable for the addition of future events.

sentences:
Unity3D - How to tessellate 2D sprites? I use dynamic vertex lighting on 2D sprites. On larger sprites the lighting is uglier than on smaller ones. This is because every sprite is just a quad of two triangles. Not enough vertices there for lighting on larger areas.

Is there a way to use more triangles on a sprite? Maybe even depending on how much screen space they cover?

sentences:
Optimal way to find point D that lays at the perpendicular line between point A and line BC I am trying to write a script in C# to find the position of point D in 2D space in a specific scenario.

I know the (X,Y) position of point A, which never happens to be on the line that contains the line-segment BC. I also know that point D lies on the perpendicular line that passes through A and crosses BC at a point that we can call P. Also, I know the distance that D is from P. Se the image below:

Can anyone shed some line on which is the most optimal way of achieving that?

sentences: How do games programmatically manipulate 3d models? The title says it all. An artist makes a 3d model of a character. How does a programmer use the model to make the character run around?

sentences:
How to make 3D characters that grow? I am creating a game in LWJGL with Java that will feature growing animals that will be imported as OBJ files from Blender.

If I wanted these animals to grow, would I create a full sized 3D model and then shrink it via code and have it grow up, or would I have a small sized 3D model and have it expand in the game to full size?

sentences:
Keeping over-shoulder camera view consistent at different screen resolutions I have a player GameObject.
There is a character attached to it and a camera (both are children of the player GameObject).

The over-shoulder camera is positioned nicely.
The player should appear on the left edge of the screen.

Now when I change the viewport / screen size and make it larger, the camera doesn't keep it's view. I can see in the Inspector that the camera's view changes.

I don't understand in which way it does that.

What would I need to do to keep the player always on the left edge, no matter what the screen resolution is?

Thank you.

The upper image shows how I have planned / developed the camera view. This is what the camera view should look like.
The lower image shows how the camera changes at larger viewport.

sentences:
Using collision.contacts to determine if on a floor I'm trying to make my own first-person character (because I get lost in the sea that is Unity's FP character script), and am trying to make it so it detects when it is standing on a floor. I tried using a playerController, but I've found rigidbody is just more malleable.

Anyways, so I think how you'd do it is finding the direction of the contact, and if it isn't straight down, then to keep onGround as false. I'm just not entirely sure the scripting behind this, and several searches have turned up nothing.

Several offered using mutliple colliders, but I would prefer to keep the number of objects, colliders or otherwise, at a minimum, considering there will be a large number of them in the scene as is. I also want something that's easily manipulable so that I can add extra features like climbing up a wall or the like, and I think that measuring the angle to the center is about as simple and easily manipulated as it gets.

sentences:
Update Camera manually after Camera's target updates, bypassing the game loop. Is this a good or bad practice? This question may be suited better for codereview.stackexchange.com?

I've been experimenting with a camera implementation / matrix SpriteBatch transformations and have run in to a bit of a snag.

The camera's .Update() method updates the transformation matrix and the camera's positioning.

My Player class depends upon the camera in order to work out where the mouse is in relation to the game world for a rotation calculation. This leads to the camera's information being one frame out of date when I need to be. This isn't noticeable when the player isn't moving as the camera's information is correct; even at low speeds I didn't personally notice the problem. However the speed was in excess of ~1000 pixels/sec (a few pixels per frame), it started to introduce a jittery-ness to the player's transformed position. Above and beyond these speeds resulted in very ugly drawing.

My thought process was "So I should update my camera immediately after the player's position has changed instead. Won't that introduce an unnecessary dependency? What happens if my camera isn't following the player or a player doesn't exist?"

My solution:

// in Camera2D.cs

public void ManualUpdate(GameTime gt)
{
    Update(gt);
    _hasAlreadyUpdated = true;
}

public void Update(GameTime gt)
{
    if (!_hasAlreadyUpdated)
    {
        DoUpdate(gt);
    }
    else
    {
        _hasAlreadyUpdated = false;
    }
}

private void DoUpdate(GameTime gt)
{
    ...
}

I can now manually call the camera's .Update() method early if I want to and it won't lead to multiple calls per frame. The jitter has been completely eliminated.

Would you consider this an adequate solution? Can you think of something more elegant?

sentences:
How to compile with OpenGL ES on Windows? I downloaded OpenGL ES 3.1 sdk here.

But when I tried to run (or compile and run) the executable in "samples" directory, I got the following message:

  The program can't start because libGLESv2.dll is missing from your computer. Try reinstalling the program to fix the problem.

This sounds strange, because the sample program is directly linked with libGLESv2.lib, so it shouldn't even look for dll files.

But when I wanted to install dll files (libGLESv2.dll and libEGL.dll), I got the following error:

regsvr32 libGLESv2.dll

  The module "libGLESv2.dll" was loaded but the entry-point DllRegisterServer was not found.
  Make sure that "libGLESv2.dll" is a valid DLL or OCX file and try again.

So it looks like these dll files are kind of invalid.

Is the problem from my dll files? Or did I miss something in installation process?

sentences:
Jumping Logic Issues Possible Duplicate:
  How to make a character jump?

I have been working on a 2D platformer and am trying to implement jumping. At the moment I have it simply teleporting upward and then falling back down:

if(Keyboard.GetState().IsKeyDown(Keys.Space) && !jumping) _position2D.Y -= 64f;

Is there any way to smooth it out and make it more parabolic?

sentences:
Projected trajectory of a vehicle? In the game I am developing, I have to calculate if my vehicle (1) which in the example is travelling north with a speed V, can reach its target (2). The example depict the problem from atop:

There are actually two possible scenarios: V is constant (resulting in trajectory 4, an arc of a circle) or the vehicle has the capacity to accelerate/decelerate (trajectory 3, an arc of a spiral).

  I would like to know if there is a straightforward way to verify if
  the vehicle is able to reach its target (as opposed to overshooting
  it). I'm particularly interested in trajectory #3, as I the only
  thing I could think of is integrating the position of the vehicle over
  time.

EDIT: of course the vehicle has always the capacity to steer, but the steer radius vary with its speed (think to a maximum lateral g-force).

EDIT2: also notice that (as most of the vehicles in real life) there is a minimum steering radius for the in-game ones too).

sentences:
Detecting on which side did the objects collided unity 2d I have a ball and a rectangle in my game.

The rectangle has a box collider 2d attached to it. How can I calculate or check when the ball hits the top of my collider, when it hits the bottom, left and right, so basically any side of the collider and also a corner of the collider, I have searched over the internet and not one answer that I found helped me into solving my problem. If anyone can help I would appreciate it.

sentences:
Recursively find neighbors I'm making a Bubble Shooter game in Unity. I came to the point where I can hit another bubble and it destroys all of its neighbors.

Now I'm trying to use recursion to destroy all of its neighbors neighbors and it causes a stack overflow.

private List<Bubble> FindAllRecursiveNeighbors(Vector2Int originPosition)
{
    List<Bubble> allNeighbors = FindNeighbors(originPosition);
    List<Bubble> result = new List<Bubble>();

    foreach (Bubble bubble in allNeighbors)
    {
        if (result.Contains(bubble)) { continue; }
        result.Add(bubble);
    }

    // Recursion starts here.
    foreach (Bubble bubble in result)
    {
        List<Bubble> neighbors = FindAllRecursiveNeighbors(FindPositionOfBubble(bubble));
        foreach (Bubble neighbor in neighbors)
        {
            if (result.Contains(neighbor)) { continue; }
            result.Add(neighbor);
        }
    }
    return result;
}

sentences:
Reconstructing mesh from topological skeleton? I have a topological skeleton of a 3d maze-like level (think Descent[I]/II). It looks like a tree where each node is a vertex in 3d-space.

If it were on a 2d plain, I would "simply" use this to offset it and reconstruct the polygon. However, it's not a 2d skeleton and I am interested in 3d mesh outward offsetting it in 3d space.

What I tried so far is offsetting outward as if it were in 2d space and then extruding the flat shape into a 3d-object. This however does not work where two edges in the skeleton are close to one another as they intersect after this process.

Is there an algorithm or tool that accomplishes this?

I am trying to do the opposite of this I believe:

skeletonization

Please notice that this is a graph with simple cycles, in my specific case it's a tree.

Starting from a skeleton and getting a rough mesh without buggy intersections.

This is an example of what it would look like after being offset outwards (inflated). Minus the intersections of course.

sentences: How can I compute the shortest path in Euclidean environments with non-convex polygons? Can someone suggest papers or algorithms about calculating shortest paths in Euclidean spaces with non-convex polygon as obstacles?

sentences:
Representation of trains on a simplified rail grid I'm working on a hobby game, basically about train dispatcher's job.

(stack: Typescript, phaser.js)

My map is based on a grid, each tile can hold 1 rail tile (well, except junctions, but we can simplify it for now, since junctions are just multiple tiles, from which only one is active).

Example (black is grid, white is rail):

As you can see, we have basically three different tiles: straight rail, 45 degree turn and diagonal rail (which can be also considered straight rail). I don't plan to add more tiles, as you can already build pretty complex setups from these tiles.

On these rails, trains would drive. Each carriage has two "wheels" - positions, where it snaps to a track. This may be seen on the following example from my prototype:

However the existing system (see below) has some issues:

when a train travels diagonally, sometimes it's x and y coordinates fit in a field than it should (example: traveling from 1|1 to 2|2, but at one point the train's coordinates correspond to the field 1|2 or 2|1).
axles sometimes get closer or futher away from each other. This has almost no effect on resulting simulation (as the carriage is centered between those two axles), but may cause carriages to be closer or futher away from each other (this effect is visible on the prototype as weell)
moving the train in a certain direction is handled by a big chunk of code that essentially lists all possibilities of directions and handles it. I'm interested if there's a better way to do it, so I could simplify the code.

I decided that I would improve the core. I'm wondering, what would be the best way to do this?

What I am looking for:

how to save the rail pieces on the map?
how to move train (I know it's x, y, speed and acceleration)?
how to have the train continue to the next piece on the grid?

Current solution (broken in some edge cases, also not ideal):

each rail piece has it's class (CurvedRail, StraightRail)
each rail piece class has method movePoint, that accepts x, y, direction and distance and returns new point (that is distance away from the original point, but also considering track turns). It may also return delta, if the movement reached edge of the tile and it needs to be moved futher (on another piece). This is handled by a separate class, that finds the following rail piece and calls movePoint with the delta instead
it has issues, because sometimes trains passing diagonal connection don't exactly follow the diagonal, so they instead of ending up on the next diagonal piece, they end up on neighboring horizontal or vertical piece and derail.

One of the issues I may be facing is that tiles are 32x32 pixels, so it's hard to travel exactly in the "middle" of the piece, because it's "between two pixels", and although I'm using decimals, it may be a problem. Is it better to have a grid from odd-sized tiles?

sentences:
Alternatives to remove Unity splash screen after developing a game with the free version? I developed a simple game using the free version of Unity. I want to understand how much it would cost me to remove the Unity Splash Screen to know if it's worth it.

Right now Unity professional edition costs $75 per month, does this mean I have to pay every month while the game is on the app store or can I pay just for the month I have to release the game so I remove the Unity Splash Screen and that's all (provided I don't need to update the game later)?

sentences:
How to store shader output to VRAM? This is really ungrateful question to Google.

Basically, I would like to know, regarding openGL, what are various methods to do some kind of computation in one of the shaders and have the results stored in VRAM to be used and accessed at a later time?

sentences:
Networking server/client library to setup p2p connection I'm making a multiplayer game, and I want to setup a p2p network.
I'm coding a server in python to make the matches and send each player it's adversary ip and port, but I'm having trouble to make udp hole punching to work.
On the client side I'm using ENET library that works over UDP.
Is there any library specific for game networking that will include all necesary from making the match to setup the p2p?

sentences:
Most suited technology for browser games? I was thinking about making a 2D MMO which I would in the long run support on various plattforms like desktop, mac, browser, android and ios.

The server will be c++/linux based and the first client would go in the browser.
So I have done some research and found that webgl and flash 11 support hardware accelerated rendering, I saw some other things like normal HTML5 painting.

So my question is, which technology should I use for such a project? My main goal would be that the users have a hassle free experience using what there hardware can give them with hardware acceleration. And the client should work on the most basic out-of-the-box pc's that any casual pc or mac user has. And another criteria would be that it should be developer friendly. I've messed with webgl abit for example and that would require writing a engine from scratch - which is acceptable but not preferred. Also, in case of non-actionscript, which kind language is most prefered in terms of speed and flexability. I'm not to fond of javascript due to the garbage collector but have learned to work around it.

Thank you for you time.

sentences:
Blender rigid body physics animation into Unity? I'm stuck trying to get these cube objects to explode into chunks when destroyed in Unity. I've set up a physics sim in Blender of the effect I want, originally planning to replace the unbroken GameObjects with this fragmented one coupled with the explosion animation upon destruction. I guess it's not that simple.

I've tried "Bake to Keyframes" in blender and exporting as an FBX, but Unity imports each individual fragment with its own Animator/Avatar and a crazy amount of animations, which is almost useless. Any better ways to go about this?

sentences:
Data structure fo a ship like in Faster Than Light I am wonder me, whats the best data structure for a ship like in FTL.
At first I thought its easy and I need only to make a array with the rooms(Tiles).
But than I noted, that I must put somewhere the doors, walls, weapons, crew and systems.
And with this Aspect I don't know a clean data structure.
Have someone a idea ?

If there is something unclear write it and I try to explain.

sentences:
Cocos2d - Physics bodies randomly loosing Velocity along an axis after impact This just started occurring and seems to randomly happen during, and between, game sessions. A dynamic moving body collides with a static body and instead of bouncing off looses (almost completely) it's Velocity along the collision's normal. This means the dynamic body starts moving along the static body's surface it just collided with, and is most noticeable on the rare occasions it does a 90 degree turn upon hitting a a second wall right ahead.

This behaviour is very erratic, and almost seems to come and go between builds with the same code on my content (although it could just be chance), so I'm wondering if it could be an issue with the cocos2d libraries?

For reference, the way I'm setting up these bodies:

For both types it starts witj:

PhysicsBody *pawnBody = PhysicsBody::create();
PawnBody->setDynamic(true);
pawnBody->setContactTestBitmask(0xFFFFFFFF);
setPhysicsBody(pawnBody);

Then the static body code does:

myBody->removeAllShapes();
PhysicsShapePolygon *colPolygon = PhysicsShapePolygon::create(&spriteVertices[0], 4,
                                                     PhysicsMaterial(0.f, 1.f, 0.f));
colPolygon->setContactTestBitmask(0xFFFFFFFF);
myBody->addShape(colPolygon, false);
...
getPhysicsBody()->setDynamic(false);

And the dynamic body code does:

getPhysicsBody()->removeAllShapes();
PhysicsShapeCircle *circle = PhysicsShapeCircle::create((getScale() *
                                                   mySprite->getContentSize().width) / 2,
                                                   PhysicsMaterial(0.f, 1.f, 0.f));
circle->setContactTestBitmask(0xFFFFFFFF);
getPhysicsBody()->addShape(circle);
...
myBody->setVelocityLimit(moveSpeed);
myBody->setDynamic(true);

I believe they are both set up correctly to achieve fully elastic collisions, and I'm sure this was working at some point through a slightly different flow (they didn't share the initial build code). Has anyone experienced any similar behaviour?

sentences:
How do some mobile games scale graphics so beautifully? I'm working on my first Android game and have been struggling a bit with scaling.

I've got 3 test devices 800x480, 1920x1080 and a 2560x1600 tablet. Some games look near perfect on all of them - many other games don't, including mine.

I'm really struggling with images looking blocky when scaling. I'm using the libdgx library, and have turned on linear filtering for everything. Almost always scaling down. Fonts are something I'm really struggling with.

I've been dissecting the apk's of various games for tips but can't see anything in particular that they're doing. In one game I examined (Candy Crush Saga) there's only 1 set of images, they only use 1 font. They also have a ttf in there, but I can't work out where that's used. The main font in a pre-created bitmap font.

Does anyone else have any tips or tricks. Ho do others manage it, especially the font scaling?

sentences:
Black bars on 720p emulator? I'm making a game for Windows Phone 8 using XNA 4.0 in Visual Studio express 2012. I'm trying to add a background image to the game with a size of 1366x768 (as I believe WP8 only supports up to 720p). Everything stretches  well on the other emulators (WVGA and WXGA) until I use the 720p emulator and I get black bars on the sides:

How can I fix this, or is this normal?

This is all the code I have used so far:

GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D Background;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

        graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;

        this.graphics.IsFullScreen = true;

        // Frame rate is 30 fps by default for Windows Phone.
        TargetElapsedTime = TimeSpan.FromTicks(333333);

        // Extend battery life under lock.
        InactiveSleepTime = TimeSpan.FromSeconds(1);
    }

    /// <summary>
    /// Allows the game to perform any initialization it needs to before starting to run.
    /// This is where it can query for any required services and load any non-graphic
    /// related content.  Calling base.Initialize will enumerate through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here

        base.Initialize();
    }

    /// <summary>
    /// LoadContent will be called once per game and is the place to load
    /// all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        Background = Content.Load<Texture2D>("SkyBackground");

    }

    /// <summary>
    /// UnloadContent will be called once per game and is the place to unload
    /// all content.
    /// </summary>
    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    /// <summary>
    /// Allows the game to run logic such as updating the world,
    /// checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        base.Update(gameTime);
    }

    /// <summary>
    /// This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        // TODO: Add your drawing code here
        spriteBatch.Begin();
        drawBackground();
        spriteBatch.End();

        base.Draw(gameTime);
    }

    private void drawBackground()
    {
        spriteBatch.Draw(Background, GraphicsDevice.Viewport.Bounds, Color.White);
    }

sentences:
Legality of using names in a game? If I am creating a board-game type game, does anyone know if it is legal to use others' names in the game?

ie. A playing card with "George Bush" or "Michael Jackson" on it.

Also, is it the same for brand names?

sentences:
Is there any way to convert .unr file? I'd like to examine a Harry Potter game for study purposes.
All of resources are fine except map file.
The maps are in a .unr file format. I know it is unreal map file.

Is there any way to convert .unr file to .fbx, .obj, or pskx formats?
I want to open map file to 3ds max or blender.

sentences:
Avoiding bouncing between states in an FSM Suppose you have a simple state machine for a game character with two states:

StandingIdle
Walking

In the update logic for the StandingIdle state you have (pseudo code):

if input received
    setState(Walking)

In the Walking state you have:

intendedLocation = calculate new location based on current heading and speed

if intendedLocation is blocked
    setState(StandingIdle)
else
    move to intendedLocation

Now this creates the problem that the state machine can bounce back and forth between the states, which can result in an awful visual effect. This is because the StandingIdle state may switch to Walking, whereupon the Walking state may determine that something is blocking the way and subsequently switch back to StandingIdle. As long as there is input being received (ie. the player is trying to move), then the state machine will bounce back and forth between these two states.

In order to deal with this, the StandingIdle state could first check whether there is sufficient room in which to start walking. But that requires either duplicating logic that already exists in the Walking state, or exposing that logic in some fashion and calling it from the StandingIdle state. I am leaning towards the latter route at this stage.

Another option I considered was exposing some kind of canTransition() method from my state objects and having the state machine call it prior to allowing a state change. That way, the Walking state could return false if there is insufficient room to walk. This, however, creates other problems.

Is there a best practice way to deal with this problem?

sentences:
Spaceship acceleration for following waypoints I'm creating a turn based space ship strategy game with simultaneous turn resolution similar to Steam Birds. After all the orders are given, the ships run through a real time simulation where they rotate, accelerate and shoot each other.

The physics work similar to the old asteroids game. At the beginning of each turn the ships can be given a constant acceleration, they will then rotate into position so that their engines will be pushing them in the acceleration direction, and they will maintain the acceleration for the rest of the turn. Each ship has a maximum acceleration value based on their engine strength and mass.

I'm having trouble calculating the proper accelerations for the AI ships to get them to go where they need to go.

I had a diagram here, but this video makes it much more clear what I'm trying to do. This is a player controlled ship moving through some asteroids in the same way I need an AI ship to move.

I've got a ship moving through some obstacles, there are waypoints defined that will guide the ship through the obstacles. There are a couple of things I'm trying to calculate:

I need to calculate how much the ship has to slow down to make a fairly tight turn so that it doesn't run into obstacles
I need to calculate the acceleration to get the ship to change directions at the waypoint, again making sure that the turn is fairly tight
Between the waypoints I would like the ship to accelerate to as high a speed as it can and still have time to slow down to make the turn

Any help here would be greatly appreciated. Thanks.

sentences: How does a developer ask for the rights to use a character? What channels must a developer go through to ask for the rights to a character? I want to make a point and click adventure based on Freddy Krueger, and I know my chances are slim, but how do you even go about asking?

sentences:
How to change the value of variable from actor Y by the blueprint of actor X? I have a project, and it has: 1 NPC (actor X), 2 target points and 1 tower (actor Y).

Image of components in level:

These rose arrows demonstrate part of the NPCs path.

I added a Event Begin Overlap in the blueprint of the NPC so that when it collides with the tower it loses 10 of life every second:

Image of print of variable life:

When the NPC gets 0 life, it goes to the next target point.

But I would like to know how to also modify the life of the tower by the same blueprint (NPC).

The code is already in my mind, it is kind of obvious to speak the truth.

"Code" of NPC blueprint:

I do not want to have to create a new Event Begin Overlap on the blueprint of the tower.

And I think using the blueprint level would not be a good idea.

One of the links below indicated something like Blueprint Interface, but I'd like to know if I can do what I want for the NPCs own blueprint.

Links:

https://forums.unrealengine.com/international/brazil/89438-pegar-vari%C3%A1vel-de-outro-blueprint

https://answers.unrealengine.com/questions/21386/communication-between-2-blueprints.html?sort=oldest

https://answers.unrealengine.com/questions/24773/how-to-call-a-blueprint-variable-from-another-blue.html

https://docs.unrealengine.com/en-us/Engine/Blueprints/UserGuide/Types/Interface

sentences:
Are there established conventions for naming "directions" (width,height) in 3D? I want to create a 3D game world where the players can modify the environment. I would like to bring it to the point where a power-user could even create "game objects" inside the application using some kind of very simple 3D modeling UI. So I decided to write this UI first, as I can then use it to create the game content. I spent some time in the last two months trying to learn Blender, and decided that this was a total overkill for what I want to create.

Anyway, I have the classes representing the 3D "concepts" mostly worked out, but I have problems with the "unwrapping" code, that is, mapping the graphic primitives, triangles and rectangles, to a texture file.

The 3 points representing a triangle are in 3D, but I need to work in 2D for the texture mapping. How should I best choose which of the 3 points to use as the "origin" of that triangle in the texture file, and how do I define some "reliable" concept of width and height that make sense, when I am in 3D?

I can think of several methods, but if one is most commonly used, I would like to know, so that my code also make sense to other people.

[EDIT] It seems I did a very bad job of explaining what I want. I understand how unwrapping works. I sweated blood going through a Blender unwrapping tutorial. But now I'm trying to write code that can automatically create a basic unwrapping of simple objects (boxes, wedges, pyramids, ... and composition thereof). My idea was to group primitives that are 1) in the same plane, and 2) touch each other in (flat) "boxes" and map those boxes to the first free spot on the texture file that is big enough (under the assumption that all primitives have the same scale). Far from optimal, but good enough to get going. Later, the user could have refined the unwrapping as necessary, for example, by mapping several "boxes" to the same coordinates, if they look the same. The box would have a width and a height, and the unwrapping would map the "origin" of the box (say top left corner) to the coordinate in the texture file where it should be mapped.

But, for me, width is the length is along the X axis, and height is the length along the Y axis. So how do I decide what is the width and the length when the box is in the X-Z plane, instead of the X-Y plane, for example? And which vertices is the "top left" when all vertices have the same "Y" or "X" coordinate (but vary in Z)? Unlike the real world, there is no "obvious" "up and down", "left and right" ... in computer 3D. Anything can be in any direction. Things don't "fall down" because there is no down.

Hopefully I now made clear my problem. How can I consistently define "top", "left", "width", and "height" when I am in 3D, instead of in 2D, and when a primitive might, for example look like an horizontal line from user point of view because it stretches in Z (which traditionally "comes out of the monitor") instead of Y?

My code can only make sense if I can define all concepts clearly, and unequivocally. I first need a way of defining those concepts that always apply, for any 3 points in 3D space. Only then can I look at any piece of my code, and decide whether it is correct or not. What I cannot define clearly, I cannot program correctly.

What I really want to know is what I asked in the title. I only talked about unwrapping to explain why I need to know this.

sentences: Efficiently representing a dynamic transform hierarchy I'm looking for a way to represent a dynamic transform hierarchy (i.e. one where nodes can be inserted and removed arbitrarily) that's a bit more efficient than using a standard tree of pointers . I saw the answers to this question ( Efficient structure for representing a transform hierarchy ), but as far as I can determine the tree-as-array approach only works for static hierarchies or dynamic ones where nodes have a fixed number of children (both deal-breakers for me). I'm probably wrong about that but could anyone point out how? If I'm not wrong are there other alternatives that work for dynamic hierarchies?

sentences:
Moving pac-man in maze game using objective c I am trying to develop maze game using objective-c, I want to allow moving the pac-man using swipe method, the user can swipe his fingers on the iPhone to indicate where he want PAC-MAN to go but I'm stuck on moving pac_man.
I used UIPanGesture but it can't indicate the collision of ghosts?

Please see the bellow code:

- (IBAction)pacmanmovement:(UIPanGestureRecognizer *)sender {
    CGPoint netTranslation;
    CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.pacman];

    sender.view.transform = CGAffineTransformMakeTranslation(
        netTranslation.x +  translatedPoint.x,
        netTranslation.y += translatedPoint.y);

    if ([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) {
        netTranslation.x += translatedPoint.x;
        netTranslation.y += translatedPoint.y;
    }

    [self collisionWithGhosts];
}

- (void)collisionWithGhosts {

    CALayer *ghostLayer1 = [self.ghost1.layer presentationLayer];
    CALayer *ghostLayer2 = [self.ghost2.layer presentationLayer];
    CALayer *ghostLayer3 = [self.ghost3.layer presentationLayer];
    CALayer *ghostLayer4 = [self.ghost4.layer presentationLayer];

    if (CGRectIntersectsRect(self.pacman.frame, ghostLayer1.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer2.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer3.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer4.frame) ) {

        self.currentPoint  = CGPointMake(0, 144);
    }

Any help?

sentences:
Why does resizing my game window move and distort my rendering? I'm starting to make a game, and the first screen I've made is a very simple loading screen with some centered text.

On starting it up, the text is nicely centered:

Then I resize the window, and I get:

Why is it stretched? And why has it moved? Looking at my code it looks like everything should be perfectly centered:

public void render(float delta) {
        Gdx.gl.glClearColor(0, 0, 0.2f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if (Assets.manager.update()) {
            // Eventually change to a main menu or something
        }

        String text = "Loading " + Math.round(Assets.manager.getProgress()) + "%";

        BitmapFont.TextBounds bounds = fnt.getBounds(text);

        batch.begin();
        fnt.draw(batch, text, (Gdx.graphics.getWidth()/2)-(bounds.width/2), (Gdx.graphics.getHeight()/2)-(bounds.height/2));
        batch.end();
    }

sentences:
Screen coordinates to a multilevel isometric world I have an isometric world that has stuff on multiple levels, i.e. it has an XYZ coordinate system, and tiles can be stacked on each other, accumulating screen Y offset as they go. I currently have an algorithm in place that converts the screen coordinates to world XY coordinates, but it doesnt take into account that there might be e.g. a hill under the mouse and selects the tile behind it instead.

Is there a generalized form algorithm for this? I need a generalized form because all the variables are unknown (I'm writing a game engine):

Tile width (as in the width of a single tile rectangle)
Tile height (as in the height of a single tile rectangle)
Tile depth (as in how much Y offset each level contributes)

I suppose one option is run down the map with something like this (pseudo code):

p = screenToMap(screenPos)
bestMatch = null

for (x=p.x, y=p.y, z=0; x<mapWidth && y<mapHeight; x++, y++, z++) {
  b = highestPlacedBlockInPos(x, y)

  if (b.z === z) bestMatch = [x, y, z]
}

But I'm wondering if there's a better way? This seems pretty ineffective especially if you have a big map.

sentences:
Generate equal regions in a hex map Taking for example a large (X by Y) hex map, how can I divide it into N regions of connected hexes to simulate countries?

The goal is to generate a hex map that looks like a real life map with countries with different shapes but equal sizes.

sentences:
Camera movement issue with pitch and yaw angles I'm trying to implement a simple first person camera using pitch and yaw angles (no quaternions, I want a simple camera for debugging purposes). An Input class processes mouse input and translate the x and y position in the window into angles. Here's the code:

#define SENSITIVITY 0.01f

void Input::ProcessMouseInput(int x, int y, Camera &camera)
{
    /* pitch and yaw angles */
    static float pitch = 0;
    static float yaw = 0;

    /* initialize initial mouse position */
    static int prev_x = x;
    static int prev_y = y;

    int offset_x = x - prev_x;
    int offset_y = y - prev_y;

    pitch += offset_y * SENSITIVITY;
    yaw += offset_x * SENSITIVITY;

    /* compute transformation matrix */
    XMMATRIX pitchTransform = XMMatrixRotationX(pitch);
    XMMATRIX yawTransform = XMMatrixRotationY(yaw);
    XMMATRIX transform = XMMatrixMultiply(pitchTransform, yawTransform);    // fps-like
    //XMMATRIX transform = XMMatrixMultiply(yawTransform, pitchTransform);  // airplane-like

    /* transform camera direction - rotate camera */
    XMVECTOR oldDirection = XMVectorSet(0.0, 0.0, 1.0, 1.0);
    XMVECTOR newCameraDirection_ = XMVector3Transform(oldDirection, transform);
    XMMATRIX oldView = XMLoadFloat4x4(&camera.GetInitialViewMatrix());
    XMVECTOR det = XMMatrixDeterminant(oldView);
    XMMATRIX inverse = XMMatrixInverse(&det, oldView);
    XMVECTOR v = XMVector3TransformNormal(newCameraDirection_, inverse);
    XMFLOAT3 newCameraDirection;
    XMStoreFloat3(&newCameraDirection, v);
    camera.SetDirection(newCameraDirection);

    /* store current mouse position */
    prev_x = x;
    prev_y = y;
}

What I do is I calculate the direction vector in the view space and transform it with pitch/yaw rotations. Then I tranform the resulting vector in world space coordinates and update the camera direction. All works fine if the camera space x-z plane initial position  is parallel to the world space x-z plane. If the camera is initially tilted downwards or upwards the movement is off (moving along the yaw direction causes a wobbling and the movement is incorrect).
I can't find the problem as I think the calculations are correct (but they obviously aren't).

EDIT

what I mean with odd behaviour is that when I create a camera that has starting position with a pitch wich is not zero I get mixed movements (pitch when yawing and yawing when pitching)

sentences: Compiling a Monogame Game into a single .exe Is it possible to compile a monogame game into a single .exe? I know if you go in the debug or release bin, there is in fact a .exe your game, except you move this .exe's file location or try to run in on another computer it crashes. I am also aware of the one-click application except this seems like a really messy way of redistributing a monogame game. How come when you build your game, the exe for it wont work anywhere but that file location and that computer. I am also aware that the computer probably needs the XNA framework downloaded to play the monogame game, so in short is it possible to redistribute a monogame game by creating a single .exe and assume that person who is using it doesnt have XNA or monogame installed?

sentences:
How to write properly shader with gradient based on vertex-color? I took 4 squares with the outer corners painted in black, and the other ones in white. For some reason, they have a different gradient.

fixed4 frag (v2f i) : SV_Target
{
    fixed4 mainTex = tex2D(_MainTex, i.uv);
    fixed4 overTex = tex2D(_OverTex, i.uv3);
    fixed4 final = fixed4(lerp(mainTex.rgb, overTex.rgb, overTex.a) * i.color, 1.0);
    final = lerp(float4(0, 0, 0, 1.0), final, i.color.a); // shadows

    return final;
}

How can i make the same gradients as bottom-left and top-right?

In-game this is faces of blocks (like minecraft) and gradients - is smooth shadow/light. So I cannot change tris

sentences:
How can I reduce the size of bundled Unity DLLs on Android? I have created a simple project (I am a Unity beginner) for Android but the apk size is around 18 MB!

I checked the documentation. One way to decrease the apk size is to check the editor log. Then I discovered that imported DLLs have a size of 3.9MB.

I only used UnityEngine and Collision packages. So how can I avoid to import the other big DLLs?

sentences:
Transitioning through menus in Unity: what is the best option performance-wise? I'm making a menu manager and I'm not sure what should I do to make a transition from one menu to the other. What is better to be used performance wise? Here is the step in my mind.

Simple enable or disable menu.
Change alpha 0 or 1.
Move the menu outside of canvas.

So what is better?

sentences:
Stopping an object after applying an impulse or force? I'm having a small issue where after applying an impulse or force it is impossible to actually get an object to stop, i.e. a velocity of zero.

This code is run every 1 / 60 of a second:

void RigidBody::Update(double deltaTime) {

    double mass = GetMass();
    //If static body, do nothing.
    if(Math::IsEqual(mass, 0.0)) return;

    Vector2D F;
    Vector2D total_forces = std::accumulate(_curState._forces.begin(), _curState._forces.end(), Vector2D());
    Vector2D total_impulses = std::accumulate(_curState._impulses.begin(), _curState._impulses.end(), Vector2D());
    F = _curState._gravity + total_forces + total_impulses;
    _curState.ClearImpulses();
    SetAcceleration(F / mass);
    SetVelocity(GetVelocity() + GetAcceleration() * deltaTime);
    SetPosition(GetPosition() + GetVelocity() * deltaTime);

}

RigidBody::SetAcceleration(const Vector2D& acceleration) {
    _prevState.SetAcceleration(_curState._acceleration);
    _curState.SetAcceleration(acceleration);
}
//Similar for RigidBody::SetVelocity and RigidBody::SetPosition...

If I apply an impulse, say (-1.0, 0.0), the object's acceleration changes by -0.012 or -0.011 instantaneously and only once then reverts to (0.0, 0.0), which then changes the velocity to (-0.012/-0.011, 0.0). Equal and opposite changes in acceleration causes rounding errors to accumulate to the point where the velocity will never be zero and the object will never stop.

Similarly, if I apply a force, (-1.0, 0.0), the object's acceleration changes to (-1.0, 0.0), equal and opposite forces applied so the acceleration changes to (0.0, 0.0) works but the velocity changes so minutely that again, the object will never stop. (The closest I've ever gotten it was (0.009, 0.0) )

sentences:
"Pixel-perfect" camera positioning in 2d game I am writing a 2d game using LibGDX. The view to the game world is top-down. The game shows a grid of lines, which looks nice when the camera is at its initial position (0,0).

The problem is now that when I move (shift) the camera left/right/up/down this grid sometimes becomes a bit blurry, so the lines do not look perfectly sharp any more.

I assume this is because in these cases the grid lines are not exactly on screen pixels, but somewhere in between. Is this correct?

In any case: Are there any "best practices" how to address this problem (not necessarily LibGDX-specific)?

sentences:
Unity Script and game not syncing after player respawn I have a health system for my player that looks like this:

public int fallBoundary = -10;
public int Health;
public int numOfHearts;

public Image[] hearts;
public Sprite fullHeart;
public Sprite emptyHeart;

void Update() {
    if(Health > numOfHearts) //Health script works, why does heart display not?
    {
        Health = numOfHearts;
    }

    for (int i = 0; i < hearts.Length; i++) {
        if (i < Health) {
            hearts[i].sprite = fullHeart;
        } else {
            hearts[i].sprite = emptyHeart;
        }

        if (i < numOfHearts) {
            hearts[i].enabled = true;
        } else {
            hearts[i].enabled = false;
        }
    }
}

Unfortunately, after respawn, the hearts do not sync anymore. My debugging showed, that the elements of hearts still did their job, resetted and got replaced correctly. However, in my game, nothing changes after the respawn (should reset to full health and change if player gets damaged). For the respawn, I am loading my prefab, which I also checked (everything is there). To avoid confusion: my hearts never reset to 0, but stay at 1.

Player Prefab that loads during respawn

Hearts after respawn

sentences:
Error in unity : The type or namespace name RigidBody could not be found i m new to unity and got stuck in a problem , i have searched unity forum but could not get an answer to solve my problem.
getting this error.

The type or namespace name RigidBody could not be found. Are you missing a using directive or an assembly reference?

using UnityEngine;
using System.Collections;
public class playercomponent : MonoBehaviour {

public RigidBody rb;

void start()
{
    this.rb =  GetComponent<Rigidbody>();
}
void FixedUpdate()
{

    float moveHorizontal = Input.GetAxis("Horizontal");
    Float moveVertical = Input.GetAxis("Vertical");
    Vector3 movement = new Vector3 (moveHorizontal,0.0f,moveVertical);

    rb.AddForce(movement);

}

}

sentences:
How do I efficiently use 16 bit texture coordinates? While loading a model I get a big array of 32 bit floating point texture coordinates. I just upload that to a single vertex buffer (along with other data, such as vertices, normals, etc.) and use it while rendering via

glVertexAttribPointer(texcoordindex,2,GL_FLOAT,GL_FALSE,texcoordstride,texcoordoffset);

I use this format for all types of meshes.

However, 16 bit and the ~65000 possible values are more than enough to represent textures that are mostly smaller than 4096 in size per dimension.

Now I'm wondering how to most effectively switch to some 16 bit based texture coordinate format, with respect to maximizing performance, i.e. minimizing the bandwidth and storage used, as well as minimizing ALU operations. Mainly I'm wondering:

Should I use half floats or short integers?
How do I convert the 32 bit floats I get when loading the model safely to the respective 16 bit format and upload it to the vertex buffer? In C++ or other languages, by rolling some custom type conversion via bit twiddling, or use standard procedures provided by the language or libraries such as GLM?
How do I have to change the glVertexAttribPointer call to use that format, and does the input in the vertex shader stay a "vec2"?
Is there maybe another option to save space here? For example, most textures are in the range of 256x256 to 1024x1024 range. 16 bits are way too much for that, but 8 bit are not enough for most textures. Are there some other strategies to save space here?

sentences:
Import 3D model into Unreal Engine 4 (Sorry if I misunderstood the context of what I want, I'm currently noob in game development).

I want to retrieve a 3D model from let's say Saints Row 3, and import it to Unreal Engine 4, is it possible ? If not is there a way to create it from scratch ?

What is the right way to achieve what I want ?

sentences:
Android frame by frame PNG animation I am new at Android game development. I have done some apps before, but none of them are games :)

So, I wanted to do a frame-by-frame animation of PNGs. I tried with AnimationDrawable, but OutOfMemory error comes quickly (I have a lot of PNGs). So I came upon SurfaceView. But I am stuck, because I really don't find any useful tutoirals/examples.

What is the best way to make an animation like this?

Here there already is a great answer to almost the same question, but all the links there don't work anymore.

I would really like to here suggestions how to make an animation frame-by-frame with PNGs in Android and if you have any tutorials or examples, I will be really happy :)

EDIT

I thought wrong about sprites, I think... Sorry, but I am a noob at game developing :) I have 60 PNG pictures (40kb, 427*420px each - on disk) which I would like to put in a animation. Is this even possible to do it with frame by frame animation?

The most similar and famous game that is close to mine is Talking Tom (but I don't know if they have frame-by-frame or any other method for animation).

sentences: How to fix flare in unity? I have a simple sun flare that I would like to appear on my directional light (sun). However I cannot see the flare, I have tried setting the ignore layers to everything and checked and double checked that there is a flare layer on my camera. The light is also rotating constantly as I have a day/night cycle too if that means anything for the flare... Anyway, could someone show me how to fix this?

sentences:
Player is not looking at correct direction My Enemy/Bot is facing the wrong direction as shown in the attached screenshot 1.
Basically what I want is that Enemy/Bot gun should directly face the player, not enemy/Bot himself.

Note: White line in the image is representing Aim direction which is
correct.

Here is my Code:
Vector3 targetPosition = kbcrd.playerToEngage.thirdPersonPlayerModel.shootTarget.position;
targetPosition .y = 0;

Vector3 botPosition = pb.thirdPersonPlayerModel.gunDirection.position;
botPosition.y = 0;

Quaternion targetRotation = Quaternion.LookRotation(targetPosition - botPosition);

//pb is Bot which is holding transform and other scripts.
pb.transform.rotation = Quaternion.RotateTowards(pb.transform.rotation, targetRotation, kbcrd.lookingInputSmooth);

What I Get from the above code is this: (Screenshot # 1)

What I want is this: (Screenshot # 2)

Guns And player Orientation:

Full function if needed:
public override void WriteToPlayerInput(Kit_PlayerBehaviour pb)
{
    CampaignModeControlRuntimeData kbcrd = pb.botControlsRuntimeData as CampaignModeControlRuntimeData;
    CampaignModeEnemyAI botCampaignModeAI = pb.gameObject.GetComponent<CampaignModeEnemyAI>();

    if (botCampaignModeAI.enemyInRange)
    {
        if (kbcrd.enemyPlayersAwareOff.Contains(botCampaignModeAI.detectedEnemies) == false)
        {
            kbcrd.enemyPlayersAwareOff.Add(botCampaignModeAI.detectedEnemies);
        }

        kbcrd.playerToEngage = botCampaignModeAI.detectedEnemies;
        //CheckForEnemies(pb, kbcrd);
    }
    else
    {
        kbcrd.playerToEngage = null;
    }

    UpdateAimPosition(pb, kbcrd);
    FiringDecision(pb, kbcrd, botCampaignModeAI.enemyInSight);
 }

Any help is appreciated. I know its simple problem but I struggling now. :(

sentences:
How should I make a jump-timing game's character static on screen? I decided to learn Pygame and try to make a simple game inspired by Google's T-rex jump game. However, I stumbled upon a problem that I can not seem to figure out: How can I implement a scroller/camera that can keep up with my character and platform?

Now it just disappears off the screen. I have made it so the platform moves to the right with the same speed as the character. Here is a GIF of what it looks like at the moment:

Is this the best way to do it for a game like this where speed of the character is always constant or is there a better way that will make adding obstacles in the future more easy?

sentences:
how to automate the game testing? I am new into this field of testing. I just developed a basic game using unity engine but i want to test it.

I have checked with selenium but i don't know how to get the value that is being returned which has the information of the action that is being performed in the game. If i am able to get the value then i will be able to take necessary action accordingly.

sentences:
How do I remove the background from pixel art sprites in Gimp? I drew a pixel art tree using GIMP. My problem is, how can I cut out the white background, because if I want to build a tile map with it, in my case with tiled, it always has the white background with it.

I know you can cut it manually, but I want to know whether there is an easier way.

sentences:
How do I change the direction of a circle when it hits a corner? I have a 2D Ball that might go against a wall.
If the Ball goes against the wall perpendicularly, it will just invert its direction (assuming no air resistance and no bounces that should make its speed change).
My problem is: how the velocity of the Ball changes when it goes against a corner?
This is the case I didn't figure out how to handle:

sentences:
How to calculate whether a cuboids face edge is infront of or behind another for sorting I'm building an isometric game, I want to position and sort objects in a particular way.
All my entities have 3d bounds which determines their cuboid, looking my example, a different edge is used to decide if a cuboid is in front of another, depending on whether the point b2 is left or right of a2.

I have already calculated all the points a1,a2,b1,b2 which are x,y,z
I think I basically need to virtually draw "aedge" and "bedge", and compare some intersection.

If b2 is right of a2 the green cuboid (b) is consider in front of the red cuboid when bline is south east of aline.

If b2 is left of a2 the green cuboid (b) is considered in front of the red cuboid when bline is south west of aline.

Please forgive my ignorance here, I'm sure there's some terminology I should have used here. I'm struggling to put down in words what it is I need.

sentences: Unity, grass chunk or dynamic batching In theory would it be faster to render a lot of grass patches that would dynamicly batch or big meshes of combined patches, too big for batching? Rendering chunks should be faster because unity doesn't have to combine them and it avoids some overhead but smaller patches will make it easier for culling.

sentences:
How can I move the object back to his original position after the object reached the target? InteractableItem target;
    private void Update()
    {
        if (target != null && target.name == "kid_from_space_helmet")
            objToThrow.transform.position += (target.transform.position - objToThrow.transform.position).normalized * 2f * Time.deltaTime;

        if(Vector3.Distance(objToThrow.transform.position, target.transform.position) < 1f)
        {
            objToThrow.transform.position += (objToThrow.transform.position - target.transform.position).normalized * 2f * Time.deltaTime;
        }
    }

The object is moving to the target but never moving back.
This IF is not working good :
if(Vector3.Distance(objToThrow.transform.position, target.transform.position) < 1f)

My guess is that the problem is that when the object distance is less then 1 he try to move back but then he is not less then 1 anymore. but anyway it's not working.
I want to move the object to the target then wait 1 second at the target and then to move the object back.

sentences:
Bullets doesn't do any damage I have a melee enemy tagged as enemy. enemy has two coliders: a capsule(physics) and a sphere(for attacking player in radius and istrigger) and a particlesystem, enemy has enemyhealth script attached.

Similarly, bullet has capsule collider and set istrigger, I've attached enemyhealth script to bullet as enemy sphere and bullet capsule are triggers (bullet doesn't have any particle system need fix for this too without raycast), bullets are destroyed on colliding with enemy but doesn't damage the enemy.

script used for enemy health

using UnityEngine;
using System.Collections;

public class enemyhealth : MonoBehaviour {
  public int health = 40;
  public int current;
  //public int score = 10;
  public AudioSource deathclip;
  public ParticleSystem death;
  CapsuleCollider Collider;
  bool dead;
  // Use this for initialization
  void Start ()
  {
    deathclip = GetComponent<AudioSource> ();
    Collider = GetComponent<CapsuleCollider> ();
    death = GetComponentInChildren <ParticleSystem> ();
    current = health;
    dead = false;
  }

  void Update()
  {}

  public void Takedamage (int amount )
  {
    if (dead)
      return;
    current -= amount;

    if (current <=0)
      die ();
  }

  void die ()
  {
    //GetComponent<NavMeshAgent> ().enabled = false;
    dead = true;
    Collider.isTrigger = true;
    deathclip.Play ();
    death.transform.parent = null;
    death.Play ();
    Destroy(death.gameObject);
    Destroy(gameObject);
  }
}

script used for bullet

using UnityEngine;
using System.Collections;

public class mover : MonoBehaviour {
  public float speed;
  public int damage = 10;
  enemyhealth Enemyhealth;
  GameObject ENEMY;
  bool enemyinrange;

  // Use this for initialization
  void Awake () {
    GetComponent<Rigidbody>().velocity = transform.forward*speed;
    Enemyhealth = GetComponent<enemyhealth> ();
    ENEMY = GameObject.FindGameObjectWithTag ("enemy");
  }
  void OnTriggerEnter(Collider other)
  {
    if(other.gameObject == ENEMY && Enemyhealth.currenthealth >=0)
      enemyinrange=true;

    //Destroy(gameObject);
  }
  void OnTriggerExit(Collider other)
  {
    if (other.gameObject == ENEMY)
      enemyinrange = false;
  }
  void Damage()
  {
    Enemyhealth.Takedamage (damage);
  }

  // Update is called once per frame
  void Update ()
  {
    if (enemyinrange)
        Damage ();
  }
}

sentences:
Trying to trigger dialogue when the space bar is clicked, and two objects are colliding I'm getting a NullReferenceException on OnTriggerStay. I've been going crazy trying to figure out why. I have tried to cut this down to only the relevent information. I got this code through a tutorial: https://www.youtube.com/watch?time_continue=48&v=_nRzoTzeyxU (just for credits).

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
public class MainCharacter : MonoBehaviour {
    public int limbs;

    public float speed;
    public Vector3 jump;
    public float jumpForce;
    Rigidbody2D rb;
    public float fire_start_time = Time.time;
    Animator animator;
    public DialogueManager dialogueManager;

    // Checking if we are grounded
    public bool isGrounded;
    public LayerMask groundLayers;

    private SpriteRenderer myRenderer;

    public Sprite[] LimbSprites;

    void Start()
    {
        dialogueManager = gameObject.GetComponent<DialogueManager>();
    }

    public void OnTriggerStay2D(Collider2D collision)
    {
        if (Input.GetKey(KeyCode.Space))
        {
            Dialogue dialogue = collision.GetComponent<Dialogue>();
            dialogueManager.StartDialogue(dialogue);

        }
    }

}

Here is my dialogue manager:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DialogueManager : MonoBehaviour {

    public Text nameText;
    public Text dialogueText;

    public Animator animator;

    private Queue<string> sentences;

    // Use this for initialization
    void Start () {
        sentences = new Queue<string>();
    }

    public void StartDialogue (Dialogue dialogue) {

        animator.SetBool("IsOpen", true);

        nameText.text = dialogue.name;
        sentences.Clear();

        foreach (string sentence in dialogue.sentences) {
            sentences.Enqueue(sentence);
        }

        DisplayNextSentence();
    }

    public void DisplayNextSentence() {
        if (sentences.Count == 0) {
            EndDialogue();
            return;
        }

        string sentence = sentences.Dequeue();
        dialogueText.text = sentence;
    }

    void EndDialogue() {
        animator.SetBool("IsOpen", false);
    }
}

Here is DialogueTrigger

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DialogueTrigger : MonoBehaviour {

    public Dialogue dialogue;

    public void TriggerDialogue () {
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);

    }
}

Here is Dialogue

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class Dialogue : MonoBehaviour {

    public string name;

    [TextArea(3, 10)]
    public string[] sentences;

}

sentences:
How to transform a matrix's local space position into another's local space When looking at an example to learn how to do per pixel collision, I came across this:

// Calculate a matrix which transforms from A's local space into
// world space and then into B's local space
Matrix transformAToB = transformA * Matrix.Invert(transformB);

I have a (very) basic understanding of matrices, so I'm not too sure how this works, how can you convert the local space of one matrix to another by multiplying by the others inverted?

sentences:
Creating Multiple Instances of a camera at run time I'm trying to create a bunch of different game objects from a settings file I'm passing in at run time. I've checked and my game is reading in settings fine. But when I run the program, I get the following error:

  ArgumentException: The prefab you want to instantiate is null.

But, I still get two cameras appearing in my scene. So I'm confused as to why this is happening.

Here is the code that is acting on the information received from the settings file:

public void CreateCamera()
{

for (int i = 0; i < testCamera.Count; i++)
{

    camera = Instantiate(gameObject.AddComponent<Camera>(), new Vector3(0, 0, 0), Quaternion.identity) as Camera;
    camera.name = testCamera[i].Name;
    camera.near = Convert.ToSingle(testCamera[i].Near);
    camera.far = Convert.ToSingle(testCamera[i].Far);
    camera.aspect = Convert.ToSingle(testCamera[i].AspectRatio);
    camera.fov = Convert.ToSingle(testCamera[i].FOV);
}

}

Following this, I also get the following message as well:

  Can't add component 'Camera' to GameObject because such a component is
  already added to the game object!

Can anyone help me in fixing these issues?

sentences:
Hiding UIs behind a custom image shader Is there a way to hide UIs such as text, images etc. behind another transparent image? The problem is that I am using the latest Unity version and these custom shaders have no effect on hiding the UI shaders. The two custom shaders I have applied for testing are:
Shader "Custom/DepthReserve"
{
    Properties
    {
    }
    SubShader
    {
        Tags { "RenderType" = "Opaque" "Queue"="Geometry-1" }
        LOD 100

        Blend Zero One

        Pass
        {

        }
    }
}

Shader "Custom/InvisibleMask" {
  SubShader {
    // draw after all opaque objects (queue = 2001):
    Tags { "Queue"="Geometry+1" }
    Pass {
      Blend Zero One // keep the image behind it
    }
  }
}

So is there a way to use a transparent image to hide text, images and even gameobjects?

sentences:
I want to make a racing game.Can I have licensed cars without paying for licenses? My idea was something similar to rFactor, but very easy to mod. There will be a step by step tutorial.

If I or somebody from the developers make the mods and publish them, do I still need licensing? Now it's just an idea, but I plan to make at least 1000-1500 cars from at least 150 manufacturers, and that would cost a fortune. A lot of the cars would be converted from other games like Forza or GT6 and others modeled by my team.

sentences:
How to get the physical camera sensor size on iOS / Android in Unity I'm trying to get the physical camera sensor size on iOS and Android mobile devices for intrinsics calculations.
On Android the sensor size should be found in the SENSOR_INFO_PIXEL_ARRAY_SIZE (Android CameraCharacteristics API). However I don't find a way to access that array via ArFoundation. I can imagine to write a plug-in for that, but I would also require a plug-in for iOS so I don't know if that's the right way to go.
Is there maybe another (easier) way to get the physical sensor size?

sentences:
How to do simple bump mapping I'm trying to do bump mapping, and I'm getting fairly close at achieving my goal.  I miss one crucial piece of my puzzle to have bump mapped effect in my scene; I need to transform the normals from my bump map to match the direction my faces are pointing.

This is my scene rendered with my vertex normals:

This is my scene rendered with the bump map:

The last image is wrong, because all samples from the bump map are rendered relative to as if they are pointing upforwards from the ground.  What I need to do, is transform the samples from the bump map to be relative to the face normals.

Now, I have tried researching how to achieve this for a while - I've been told that if I create a TNB matrix, and multiply the sample with it - things should behave like I want.  This is however not the behaviour I am getting.

This is my vertex shader:

uniform mat4 u_projectionMatrix;
uniform mat4 u_viewMatrix;
uniform mat4 u_modelMatrix;
attribute vec3 a_position;
attribute vec2 aTextureCoord;
attribute vec3 aNormalCoord;
attribute vec3 aTangentCoord;
attribute vec3 aBitangentCoord;
varying vec2 vTextureCoord;
varying vec3 vNormalCoord;
varying vec3 vVertexCoord;
varying mat3 vTNBMatrix;

void main()
{
    vec4 pos = vec4(a_position, 1.0);
    vTNBMatrix = mat3(
        aTangentCoord,
        aNormalCoord,
        aBitangentCoord
      );

    gl_Position = u_projectionMatrix * u_viewMatrix * pos;
    vTextureCoord = aTextureCoord;
    vNormalCoord = aNormalCoord;
    vVertexCoord = a_position;
}

And this is my fragment shader:

varying vec2 vTextureCoord;
varying vec3 vNormalCoord;
varying vec3 vVertexCoord;
varying mat3 vTNBMatrix;

uniform sampler2D mytex;
uniform sampler2D mynormal;

void main()
{
    vec3 nt = normalize(texture2D(mynormal, vTextureCoord.st).rgb * 2.0 - 1.0);

    vec3 lightpos = vec3(15.0, 26.5, 0.5);
    vec3 L = normalize(lightpos - vVertexCoord);

    vec3 finalNormal = nt * vTNBMatrix;

    vec3 ld = vec3(1.0, 1.0, 1.0) * max(dot(finalNormal, L), 0.0);

    ld = clamp(ld, 0.0, 1.0);

    gl_FragColor = vec4(texture2D(mytex, vTextureCoord.st).rgb * ld, 1.0);
}

Which are giving me the following, undesireable result:

Would anyone be so kind and give me some pointers at what I'm doing wrong?

Update:

These are the textures I'm using for this

Normal map:

Texture:

sentences:
Get an exponential number between two numbers Bit of a math question here...

lets say I want to supply a number (any number) and I want the result to be clamped between 0 and 1.

For instance, see the following graph.

Is there a way that when a number larger than 1 is supplied, that it returns a number that is still within those bounds (0 - 1), but still resulting in a number larger than any smaller supplied numbers that came before it (for instance, a supplied 2 would be a slightly larger number than a supplied 1.5)?

Thanks for your help!

sentences:
Is there an algorithm for a pool game? I am looking for algorithm to calculate direction and speed of balls in a pool game. I am sure there has to be some type of open source code for this since pool games are some of the oldest computer games I can remember.

I mean, when one ball hits another, I need a algorithm to calculate direction of both of them. It will depend of exact angle of where they hit each other and on speed.

I want to practice Java coding, so I am looking for java code or package that has this type of code.

sentences:
Coroutine only partially executing I have a Coroutine that I use to pull and spawn an enemy in my game. This coroutine works perfectly fine, with the exception of the very first call. I am fairly certain this is because I am probably loading something before it is ready, but I don't know enough to know where.

This is my code (Note the Debug.Log entries). I have removed whatever I think is irrelevant code.

EnemyHandler.cs

public class EnemyHandler : MonoBehaviour
{
public int mob_id;
IEnumerator LoadMob()
{
    Debug.Log("Checkpoint 1");

    WWWForm form = new WWWForm();
    form.AddField("mob_id",mob_id);
    WWW www = new WWW("my-url-here",form);
    yield return www;
    Debug.Log("@@@@@@ Checkpoint 2 @@@@@@");
    string[] webResults = www.text.Split('\t');

    int returncode = int.Parse(webResults[0]);

    switch (returncode)
    {
        case 0:
        //Mob Loaded Successfully
        //Mob variables are set here
        Debug.Log("@@@@@@ Checkpoint 3 @@@@@@");
        break;

        default:
        Debug.Log("Error!");
        break;
    }

}

 public void CallMobLoad(int requested_mob_id)
 {
     mob_id = requested_mob_id;
     StartCoroutine(LoadMob());
     Debug.Log("Coroutine called! Checkpoint 0");
 }
}

2.GameManager.cs (This is my primary class)

public class GameManager : MonoBehaviour
{
    public GameObject spawnManager;
    public static EnemyHandler thisenemy;

    void Start()
    {
     thisenemy = spawnManager.AddComponent<EnemyHandler>();
     thisenemy.CallMobLoad(1);
    }
}

CallMobLoad is called once at Start, and every time a monster dies. It never works when called in Start(), but always works after that.

Furthermore, the first call only calls the first 2 Debug.Logs "Checkpoint 0" and "Checkpoint 1", none of the other checkpoints are hit. Every subsequent call works correctly and hits all checkpoints.

I really want to learn how/why this happens, Any help is greatly appreciated!

EDIT: I have fixed this by turning Start into an IEnumerator, and adding a yield return to thisenemy.CallMobLoad(mobloadtemp);

Still not sure if this is the best way to do this, so please do advise.

sentences:
HLSL texture sampler always returns white I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code is below, and then I'll say more.

texture2D fillTexture;

sampler fillSampler = sampler_state
{
    Texture = <fillTexture>;
};

sampler s0;

struct VertexShaderOutput
{
    float4 Color : COLOR0;
    float4 Position : SV_POSITION0;
    float2 TexCoords : TEXCOORD0;
};

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(fillSampler, input.TexCoords);
}

technique Technique0
{
    pass Pass0
    {
        PixelShader = compile ps_4_0 PixelShaderFunction();
    }
}

First, in my C# code, I'm using the SpriteBatch to draw a large rectangle. That part works fine. Second, I have a smaller texture that I'm passing as a parameter into my pixel shader (fillTexture). No matter what I try, the resulting large rectangle is pure white.

I've already verified that my shader is being applied, as the following code results in a red block.

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return float4(1, 0, 0, 1);
}

I've also verified that my texture coordinates within the pixel shader function are correct. The following code produces the image below.

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float2 texCoords = input.TexCoords;

    return float4(texCoords.x, texCoords.y, 0, 1);
}

I've also verified that the fill texture itself has valid colors (i.e. it isn't pure white itself).

Apart from that, I've tried every combination I've seen. I've tried using sampler2D rather than sampler, fillTexture.Sample rather than tex2D, even compiling with ps_4_0_level_9_1 and level_9_3. I've tried using SamplerState rather than sampler_state, binding registers, everything I can think of.

Any help would be greatly appreciated. Thank you :)

sentences: How can I create a pixellated, limited-palette appearance in modern OpenGL? I wanna get some old art style (256 color, dithering, etc) in modern OpenGL in an effective way. Maybe using a low resolution (320x240) rendered at a bigger space so that the pixels looks "bigger?" I'd just like to fake this old style on modern GPUs.

sentences:
After creating DirectX11 Device, enumerating the DXGI Adapters seems to produce invalid results EDIT: This is part of an upgrade from DirectX10 to DX11.

When I create a DirectX 11 device with D3D11CreateDevice(), it chooses a video adapter for me. I access this object like so:

// removed HRESULT checks for brevity- normally I print errors on failed hr

IDXGIDevice1*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

IDXGIAdapter* pAdapter = NULL;
pDXGIDevice->GetAdapter( &pAdapter );

// save pAdapter

However, later, when I enumerate the adapters, this adapter is not on the list:

IDXGIDevice*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

IDXGIAdapter* pAdapter;
hr = pDXGIDevice->GetParent(__uuidof(IDXGIAdapter), (void **)&pAdapter);

// so far so good: pAdapter matches my current adapter I saved from above

IDXGIFactory* pFactory;
pAdapter->GetParent(__uuidof(IDXGIFactory), (void **)&pFactory);

UINT i = 0;
while( SUCCEEDED( hr ) && hr != DXGI_ERROR_NOT_FOUND )
{
    IDXGIAdapter* padapter;
    hr = pFactory->EnumAdapters1( i, &padapter );

    // none of these padapters matches the current adapter!!
    i++;
}

After this section, I have a list of the enumerated adapters. My current adapter is not in the list! Instead there is a DIFFERENT adapter with the same name as my current one.

Most importantly (this is the part I actually need) if I call D3D11CreateDevice() with this enumerated (different) adapter specified, I get E_INVALIDARG.

What am I doing wrong to generate these alternative, invalid adapters?

sentences:
track 2D offset after rotation red is my origin point, blue is my offset, both are 2D vectors, how can calculate blue after rotation?
this is the code I've been trying(just throwing things against a wall to see what sticks)
public static Vector2F CalcPointWithRotation(Vector2F origin, Vector2F point, float rotation)
{
    return new Vector2F((float)Math.Cos(rotation) * origin.x, (float)Math.Sin(rotation) * origin.y);
}

sentences:
HLSL mipmapping not working I want to implement a mipmap filter in my 3D game, so that textures which are located far away are using a lower resolution than the original.
For the shader I'm using hlsl version 4_0_level_9_1 or 4_0 depends on which one I will get this running.
I have tried this:

texture Texture;
sampler diffuseSampler = sampler_state
{
    Texture = (Texture);
    MAGFILTER = ANISOTROPIC;
    MINFILTER = ANISOTROPIC;
    MIPFILTER = ANISOTROPIC;
    AddressU = Wrap;
    AddressV = Wrap;
};
[...]
Color PixelShaderFunctionTex(VertexShaderOutputTex input)
{
    return tex2Dlod(diffuseSampler, float4(input.TexCoord, 0.0, 0.0));
}

in vs_4_0 it still uses the full-res texture.
And in vs_4_0_level_9_1 it won't even compile: "texlod not supported on this target"

I could manually generate the downscaled textures, but there must be a way to only input one texture and let hlsl do the rest.

In short:
How to apply the mipmap filter in hlsl?

sentences:
Polygon edges visible when using per-fragment lighting (OpenGL) I have created a mesh in Blender (just a sphere with a texture over it; it's supposed to look like mars) and I've exported it as OBJ. I've tried it both with exporting with normals in Blender's export settings and also with the aiProcess_GenNormals flag. But for some reason I'm still getting this lighting issue.

There's a lot of C++ code but I'm not sure if any of it is relevant to this issue, so I'll just include the shaders.

The vertex shader:

#version 330 core

layout(location = 0) in vec3 vertexpos_modelspace;
layout(location = 1) in vec2 texcoord_vertex;
layout(location = 2) in vec3 normal_vertex;

uniform mat4 world;
uniform mat4 view;
uniform mat4 projection;

out vec2 texcoord_fragment;
out vec3 normal_fragment;

void main()
{
    texcoord_fragment = texcoord_vertex;

    vec4 transformed_normal;
    transformed_normal = vec4(normal_vertex, 1);
    transformed_normal = world * transformed_normal;
    normal_fragment = transformed_normal.xyz;

    gl_Position.xyzw = projection * view * world * vec4(vertexpos_modelspace, 1);
}

The fragment shader:

#version 330 core

uniform sampler2D texsampler;

uniform vec3 light_direction;

in vec2 texcoord_fragment;
in vec3 normal_fragment;

out vec4 color;

void main()
{
    float lighting = 0;
    lighting = dot(normalize(normal_fragment), normalize(light_direction));
    lighting = clamp(lighting, 0, 1);

    vec4 sample = texture(texsampler, texcoord_fragment).rgba;

    color = sample * lighting;
}

And the result looks like this:

I can't figure out why this is happening. It doesn't appear this way in Blender, just in my application.

sentences:
Rendering multiline text with SDL_TTF Can you use any function to render more than a line of text in a surface?

If you can't do this, what whould be the way to go?
I am doing the following: Create a surface (not sure if should be a software or a hardware one) and then create as many surfaces as lines my text have, then blitting all the surfaces, and freeing all the surfaces. But this turns to be very slow. This is the code:

void Text::updateSurface() {
    if (surface != NULL) {
        SDL_FreeSurface(surface);
    }

    TTF_Font * font = TTF_OpenFont(fontPath.c_str(),size);
    if (font == NULL) {
        ERROR("Null font"<<TTF_GetError());
    }

    int maxWidth = 0;
    int totalHeight = 0;

    std::vector<SDL_Surface *> surfaces;
    for (size_t i=0; i<lines.size(); i++) {
        SDL_Surface * partialSurface = TTF_RenderText_Solid(font, lines[i].c_str(), color);
        if (partialSurface == NULL) {
            ERROR("surface == NULL: "<<TTF_GetError());
        }
        surfaces.push_back(partialSurface);
        totalHeight += partialSurface->h;
        maxWidth = std::max(maxWidth, partialSurface->w);
    }

    TTF_CloseFont(font);

    surface = SDL::allocateSurface(maxWidth,totalHeight);
    if (backgroundColor != NULL) {
        SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format,backgroundColor->r, backgroundColor->g, backgroundColor->b));
    }
    totalHeight = 0;
    for (size_t i = 0; i < surfaces.size(); i++) {
        SDL_Rect dst = {0, totalHeight, 0, 0};
        switch(aligment) {
        case ALIGMENT_RIGHT:
            dst.x = maxWidth - surfaces[i]->w;
            break;
        case ALIGMENT_CENTER:
            dst.x = (maxWidth - surfaces[i]->w) / 2;
            break;
        case ALIGMENT_LEFT:
        default:
            break;
        }
        totalHeight += surfaces[i]->h;
        SDL_BlitSurface(surfaces[i],NULL,surface,&dst);
        SDL_FreeSurface(surfaces[i]);
    }
}

This is the code for SDL::allocateSurface(...)

static SDL_Surface * allocateSurface(int width, int height, int bpp = -1, Uint32 flags = 0)

SDL_Surface * SDL::allocateSurface(int width, int height, int bpp, Uint32 flags) {
    if (bpp == -1) {
        bpp = SDL::bpp; //SDL_GetVideoInfo()->vfmt->BitsPerPixel;
    }

    if (flags == 0) {
        flags = SDL_HWSURFACE;
    }

    Uint32 rmask, gmask, bmask, amask;

    #if SDL_BYTEORDER == SDL_BIG_ENDIAN
        rmask = 0xff000000;
        gmask = 0x00ff0000;
        bmask = 0x0000ff00;
        amask = 0x000000ff;
    #else
        rmask = 0x000000ff;
        gmask = 0x0000ff00;
        bmask = 0x00ff0000;
        amask = 0xff000000;
    #endif

    return SDL_CreateRGBSurface(flags, width, height, bpp, rmask, gmask, bmask, amask);
}

sentences:
Water effect using DuDv Map weird look I'm trying to apply a DuDv Map effect (distortions) on my water.

My texture is 512x512 in size.

I'm using the following code:

(Vertex Shader)

out vec2 texCoord0;

void main()...
{

texCoord0 = vec2(position.x / 2.0 + 0.5, position.y / 2.0 + 0.5) * 6.0;
}

(Fragment Shader)

in vec2 texCoord0;

void main()
{
    ...

        vec3 ndc = (clipSpace.xyz / clipSpace.w)/ 2.0 + 0.5;

    vec2 reflectTexCoords = vec2(ndc.x, -ndc.y);
    vec2 refractTexCoords = vec2(ndc.x, ndc.y);

    vec2 distorsion1 = (texture(dudvMap, vec2(texCoord0.x, texCoord0.y)).rg * 2.0 - 1.0) * waveStrength; // waveStrength = 0.02;

    refractTexCoords += distorsion1;

    reflectTexCoords += distorsion1;

    vec4 reflectColor = texture(reflectionTexture, reflectTexCoords);
    vec4 refractionColor = texture(refractionTexture, refractTexCoords);

      outColor = mix(reflectColor, refractionColor, 0.5);
}

As you can see when I add my distortion to my reflection and refraction texture coordinates, it seems that something is wrong and can't figure what, because I get this effect:

Do any of you have any idea how can I fix this? Thanks for your time!

sentences:
Put objects on a 2D maps using a matrix of distances Is that possible to put objects in a 2D map using only a matrix of their relative distance ?

An example would be putting cities on a map using the distances between them. There would be a minimum of 4 cities.

Thanks a lot.

sentences:
What is causing this problem with my object rotation? I'm having an issue here with rotation in OpenGL. Before I changed my rendering function the rotation I had for my object worked fine, but now it seems to be messed up.

I changed my rendering function because I wanted to be able to clip the image (render frames of the image), whereas before I was just rendering things on a 1 object, 1 image basis.

The rendering is fine, just the rotation to clarify that. Here's my current rendering code:

void DrawRotateAdv(int x, int y, int width, int height, float sourceX, float sourceY, float imageWidth, float imageHeight,
    GLuint texture, float angle, bool blendFlag)
{
    glTranslatef((GLfloat) x + (width / 2),  (GLfloat) y + (height / 2), 0.0);
    glRotatef(angle, 0.0, 0.0, 1.0);

    if (blendFlag)
    {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }

    glBindTexture(GL_TEXTURE_2D, texture);
    float texscaleX = 1.0f / (float)(imageWidth / width);
    float texscaleY = 1.0f / (float)(imageHeight / height);
    sourceX = sourceX / (float)imageWidth;
    sourceY = sourceY / (float)imageHeight;

    glBegin(GL_QUADS);

    // Top-left vertex (corner)
    glTexCoord2f(sourceX, sourceY);
    glVertex2i( (-width / 2), (-height / 2));

    //Bottom-left vertex (corner)
    glTexCoord2f(sourceX, sourceY + texscaleY);
    glVertex2i( (width / 2), (-height / 2));

    //Bottom-right vertex (corner)
    glTexCoord2f(sourceX + texscaleX, sourceY + texscaleY);
    glVertex2i( (width / 2), (height / 2));

    //Top-right vertex (corner)
    glTexCoord2f( sourceX + texscaleX, sourceY);
    glVertex2i( (-width / 2) , (height / 2));

    glEnd();
    glLoadIdentity();
}

I think that perhaps my translation is wrong? Unsure though, guess that's a stab in the dark on my part. As for the getting the angle:

     angle = atan2((cEnemy->position.y - (float)position.y), cEnemy->position.x -        (float)position.x) / 3.14159265f * 180;

But I don't think that's the issue, like I said it worked before-hand perfectly. Screenshot of the output:

sentences:
How to create fun and interactive menus with cocos2d? Possible Duplicate:
  How to make animated buttons in a menu with Cocos2d?

How do I make fun and interactive menus with cocos2d, all the tutorials are just for simple clickable menus. Can any one help me learn this?

It would be see the menu flip or slide away, I know you can do this with scenes but how do I make this with just the menu?

Let's say the menu is a bunch of cards and I want them to flip over like the sub-menu is on the backside of the card, how would I do this?

Or, make the Main menu slide in from the left, right, top or bottom side and then when a button is selected it slides away the same way and switch to a sub-menu (settings, Score etc)?

Anyone?

David

sentences:
OpenGL dynamic font glyph cache library I have begun work on an OpenGL application (all on my own and with little knowledge) and started with FTGL, rendering true type fonts, which, with alot of text has a great impact on frames per second.

I believe that to overcome this limitation one needs to generate a font atlas and save glyphs to opengl textures which are then drawn by shaders.

I have done a search of github for such a library and found several, a few of which are incomplete (and by their own admission have memory leaks)

I am looking for, and hoping that one of you can recommend, the most stable opengl font library that you preffer and does the aforementioned. I also need unicode support.

Or a guide to help a noob like me achieve this

Thankyou for reading

sentences:
animation of an Actor in libgdx crashes on iphone I am using a class found here on stackover for the animation of the actors , but I crash on the physical device

class AnimatedImage.java:

public class AnimatedImage extends Image
{
    protected Animation animation = null;
    private float stateTime = 0;

    public AnimatedImage(Animation animation) {
        super(animation.getKeyFrame(0));
        this.animation = animation;
    }

    @Override
    public void act(float delta)
    {
        ((TextureRegionDrawable)getDrawable()).setRegion(animation.getKeyFrame(stateTime+=delta, true));
        super.act(delta);
    }
}

create() method, get frames and add to the stage:

Array<TextureRegion> waveArrayTextureRegions = new Array<TextureRegion>();
for(int i = 1; i < 24; i++){
    waveArrayTextureRegions.add(new TextureRegion(new Texture("wave/4096/wave ("+i+").png")));
}
waveAnimation = new Animation(0.15f,waveArrayTextureRegions, Animation.PlayMode.LOOP);
waveActor = new AnimatedImage(waveAnimation );
waveActor.setWidth(Gdx.graphics.getWidth() / 1.05f);
waveActor.setHeight(Gdx.graphics.getHeight() / 1.05f);
waveActor.setPosition(0,0);
stage.addActor(waveActor);

I would add this class is animated actor , and , on Android no problem , but when I install it on my iPhone via RoboVM crashes . It ' possible that the class or something wrong with liking to the iPhone ? Additirruta on the iPhone simulator works only when I put it on the physical device I crashes in this class . can someone give me a help?

sentences:
Curved 3D health bar Hello I would like to make a curved healthbar (like if it is drawn on a cylinder). See the spatial UI element left to the shoulder of the character on this photo for what I mean.
There is a main outline in white and inside the green healthbar When health decrease only the green bar get shorter.

I can use blender 3d but this is not so immediate...
Any idea?

sentences:
Why is the pixel so popular as the metric unit of a game? I keep seeing everywhere people using pixels for resolving collisions, angles, distances. I wonder if using the pixel as the metric unit for a game is a good solution, first because you're tying your game logic with implementation, in this case squares in your monitor, second handling more elaborated effects like zoom, rotation becomes more difficult, etc. Isn't adopting integer numbers as your smallest metric unit more flexible and letting the renderer do the pixel operations?

Why the pixel unit is so much popular than integer units?
Which are the benefits and drawbacks for each strategy?

sentences:
Can I use music I made in GarageBand or FL Studio in a commercial game? I'm a beginning developer and I'd like to make music for my game. I've searched this question on the site, and when it comes to music in games, I see many people suggesting programs like FL Studio, Reaper, GarageBand, etc.

What are the legal implications of using music made with them in a commercial game? Is it okay to use music I've created on my computer with one of these programs (I was thinking of FL Studio) in a game I plan to profit from?

sentences:
How do I clear streaming textures in SDL? I need to clear a streaming texture before I draw into it on the next frame, because only a part is updated, and it's random enough that I can't predict which part will be clear.

I don't want to reinitialize it every time, or rewrite the whole texture each time.

Here is the code I tried, but this fails every time, since the texture is in streaming mode.

SDL_Texture* StreamingTexture = SDL_CreateTexture(render, SDL_PIXELFORMAT_RGBA8888,
        SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);

SDL_SetRenderTarget(render, StreamingTexture);
SDL_SetRenderDrawColor(render, 0, 0, 0, 0);
SDL_RenderClear(render);

sentences:
Place actors that attach to other actors and simulate physics as a single object I'm super new to UE4. I'm making a block-based building game (I know, I know) in which I want to place actors (blocks) that can "attach" to another actor(block), and then simulate physics as a single object - become one object, rather than say, garys mod welding, which I definitely don't want.
Im looking for pointers rather than specific code - to be honest I have no idea where to start with this. My plan is to create some kind of a blueprint that can be hold multiple blocks,  called a structure, but even this I'm not sure how to go about. About all I have working currently is spawning actors in during run time

sentences:
what are the essential things to be looked upon in game design I've made a couple of games now.

Starting from basic hobbyist projects like snake , I advanced into platform based games, board games, turn based games. While doing the latter of these projects I had to spent a lot of time redesigning certain concepts, sometimes even throwing away certain logic. So always I've felt the time wasted could have been avoided or at least reduced, if I had properly planned each and every stage of my game.

Though i can try to do it on paperwork or by a word file with bulleted points. I think there ought to be some other way of game design.

Do help me with suggestions and other game design patterns being followed, either as an indie-game developer or as a game company. I can learn from both. I am not looking for game design e-books, since there is already a thread for that. I would like to get suggestions and game design patters.
Thank you.

sentences:
How to implement jump in NavMesh? I want my NavMeshAgent to jump when Space key is hit.

The Script (in Unityscript) I tried is :

var isJump:boolean=false;

function Update () {

  if(Input.GetKeyDown(KeyCode.Space)){

     GetComponent.<UnityEngine.AI.NavMeshAgent>().enabled=false;
     GetComponent.<Rigidbody>().isKinematic=false;
     GetComponent.<Rigidbody>().AddForce(0,400,0);
     isJump=true;

 }
}

 function OnCollisionEnter(col:Collision){

   if(col.gameObject.layer==4 && isJump){

     GetComponent.<UnityEngine.AI.NavMeshAgent>().enabled=true;
     GetComponent.<Rigidbody>().isKinematic=true;
     isJump=false;
  }

}

The ground where the NavMeshAgent stands is in layer 4. But the Agent is not jumping in the first place. But when I don't used the OnCollisionEnter function it jumps. But I need some function to return it to the initial state.

I tried a print("something") inside if statement of OnCollisionEnter function and it prints it as soon as I hit Space. That if statement should have executed when the object jumped and collides with the ground.

How to make it work?

sentences:
Default mipmap level & elements to use for CopyTexture in Unity Scripting? I want to make a tiled map. I want to use the function CopyTexture to copy from a Texture2D (where is stored my tileset) to a RenderTexture.

I want to use the third overloading (with all the arguments) which allow me to choose from where in the source texture and where in the render texture I will copy. But I need to specify mipmap levels and elements.

I don't know what to use as mipmap levels and elements in this function. Thanks to everyone who can help me :)

sentences:
How do you handle entity life-time and entities without all components in an ECS? I'm just starting to implement my own ECS and am drawing everything down on paper to make sure I understand it all before tackling the implementation in code. However I'm getting stuck on entity-lifetime and nothing I've read really answers my question.

Just to be sure I'm not missing something, my understanding so far is:

Components of the same type all sit next to each other in memory
Entities are just an ID, which Components refer to (i.e. Components have an "owner")
Components all have a unique Id

Great! So for example, say I have a PositionComponent, VelocityComponent, and VisibleComponent.

struct PositionComponent {
    vector2f position;
};

struct VelocityComponent {
    vector2f velocity;
};

struct VisibleComponent {
    Image imageToRender;
};

Great. Now let's say I have two types of Entity:

EntityA has a position, velocity, and visible components
EntityB has a position and velocity component, but is not visible

(let's hypothetically say that the Image in the visible component is the actual image data because every entity is super unique or something)

Say I have an PhysicsSystem which wants to iterate over all the Position and Velocity components and update the Position. This works, because every entity I've created has both of these components.

And so we're using EntityID as an index into the component arrays, we can easily know we're accessing the correct ones.

But then if there was a RenderSystem that wants to iterate over all the Position and Visible Components, the problem is that the EntityId can no longer be an index into the arrays, because not every Entity has every component.

So; the way I've thought to address this is by having an "Entity to Index Map" for each component. Basically, this EntityID has a PositionComponent in index 232 of the array.

But because of this, now any system that needs two or more Components to act, will lose out on all the benefits of an ECS, right?

I dismissed giving all components arrays empty space to keep them all "in sync", but that means I could have a lot of wasted data, which only gets worse the more different components I create.

There's then the problem of lifetime. If EntityID 232 is killed, I ideally would shift all the components in these arrays down to fill the gap, which again means I can't use EntityId as an index into the arrays.

A solution I thought of here was to re-use EntityIDs when they're no longer needed, maybe by using a 16bits of a 32-bit ID as the actual array index, and the other 16-bits as some sort of random guid to keep it clear that it's a new entity (and not the old one who's EntityID is being reused). This means I don't need to shift the data around, and wouldn't need to keep a map from ID to Index; but it doesn't solve the problem where not all entities have all components, so none of the arrays can ever be assumed to be "in sync".

So in summary my questions are:
1. How does a System in an ECS handle iterating over two separate components, when it's not guaranteed both component arrays will have the same entities components in the same indices?
2. Is it more beneficial to keep the data compact, or keep the arrays in sync?

sentences:
If a game is made for Windows or MacOS, and sold for profit, is Microsoft or Apple entitled to royalties, even if it's sold on a different website? I.e. sold on some website some game developer made, and NOT sold on Apple Store or Microsoft Store.

2) Also, for any game made and sold for their platform, does Apple or Microsoft look at the game/app content, and decide whether they want that game/app to exist for their platform or not? Again, this for the case of where the game/app is NOT sold on the Apple Store or Microsoft Store.

3) same questions, but for game consoles? e.g. Nintendo, Sony, etc.

EDITED: I ask because... well... sometimes I wonder if a certain game has content which is too inappropriate. So I'm wondering ... what companies looked at these games and said they were okay when maybe they should've said no.

sentences: Zenject injection from an existing in scene prefab I am trying to use Zenject to automatically inject a reference to a component on a game object that I have in the scene, but can only seem to make the create new component on new object work. Should I be using a prefab installer and if so why can't I just drag the prefab into the prefab installer?

sentences:
Ways to "invert Z-axis" in shader-based core-profile OpenGL? In my hobbyist shader-based (non-FFP) GL (3.2+ core) "engine", everything in world-space and model-space is by design "left-handed" (and to stay that way), so X-axis goes from -1 ("left") to 1 ("right"), Y from -1 ("bottom") to 1 ("top") and Z from -1 ("near") to 1 ("far").

Now, by default in OpenGL the NDC-space works the same but the clip space doesn't, from what I gather, here z extends from 1 ("near") to -1 ("far").

At the same time I want to ideally keep using the "kinda-sorta inofficial quasi-standard" matrix functions for lookat and perspective, currently defined as:

func (me *Mat4) Lookat(eyePos, lookTarget, upVec *Vec3) {
    l := lookTarget.Sub(eyePos)
    l.Normalize()
    s := l.Cross(upVec)
    s.Normalize()
    u := s.Cross(l)
    me[0], me[4], me[8], me[12] = s.X, u.X, -l.X, -eyePos.X
    me[1], me[5], me[9], me[13] = s.Y, u.Y, -l.Y, -eyePos.Y
    me[2], me[6], me[10], me[14] = s.Z, u.Z, -l.Z, -eyePos.Z
    me[3], me[7], me[11], me[15] = 0, 0, 0, 1
}

//  a: aspect ratio. n: near-plane. f: far-plane.
func (me *Mat4) Perspective(fovY, a, n, f float64) {
    s := 1 / math.Tan(DegToRad(fovY)/2) // scaling
    me[0], me[4], me[8], me[12] = s/a, 0, 0, 0
    me[1], me[5], me[9], me[13] = 0, s, 0, 0
    me[2], me[6], me[10], me[14] = 0, 0, (f+n)/(n-f), (2*f*n)/(n-f)
    me[3], me[7], me[11], me[15] = 0, 0, -1, 0
}

So, for the lookat-part to have my world-space camera (positive-Z) work with lookat (negative-Z) as per this pseudocode:

// world-space position:
camPos := cam.Pos
// normalized direction-vector, up/right/forward are 1 not -1:
camTarget := cam.Dir
// lookat-target:
camTarget.Add(&camPos)
// invert both Z:
camPos.Z, camTarget.Z = -camPos.Z, -camTarget.Z
// compute lookat-matrix:
cam.mat.Lookat(&camPos, &camTarget, &Vec3{0, 1, 0})

That works well. Moving the camera in all 6 degrees of freedom produces correct on-screen movement and correct new camera world-space coords.

But geometry is still inverted on the Z-axis. When I position two boxes, A at (-2, 1, -2), to appear near-left and B (2, 1, 2) to appear far-right,  then A appears far-left and B appears near-right. Z is still inverted here.

Now, these nodes have their own world-space coords and update from those their own model-to-world matrices. I shouldn't invert posZ there as they form a hierarchy of sub-nodes multiplying with their parents transforms and all that. They're still in model or world space, which as per my decree is to remain left-handed.

Their world-to-camera calculation happens on the CPU at my end, not in a vertex shader which just gets a single final (mvp/clip-space) matrix.

When that happens -- multiplication of world-space-object-matrix with clip-space lookat-and-projection matrix -- at that point I need to somehow invert Z.

What's the best way to do this? Or, more generally speaking, what's a common way that works? Do I have to modify the projection to accept left-handed but output-to-GL right-handed? If so, how? And then wouldn't I also have to modify lookat? Is there a smart way to do all this without having to modify the somewhat-standard lookat/projection matrices while also keeping model-transform-matrices in left-handed coords?

sentences:
About the A* algorith(pathfinding) We have a formula of f=g+h wherein g is the path cost and h is the distance left to the goal.

Given that I only want to move my unit in 4 direction (N,S,E,W), my question is:

Can we consider h as an input?  Because we will choose what heuristic to use?  Or not because it's value is given automatically?

sentences:
Level loading with threads runs sometimes and doesn't run sometimes I am trying to load a scene in the background while displaying a loading screen till the scene loads and then changing the scene to the loaded scene and I am using threads and ResourceLoader to do so. On my computer it runs sometimes and doesn't run other times. And, on android it never gets completed the loading screen comes up and then the game just hangs.
On pressing the play button:
func _on_play_pressed():
        $loading_screen.show()
        go_to_scene(level_to_load, true)

The gotoscene():
func go_to_scene(new_scene, loading):
    if (loading):
        loading_thread = Thread.new()
        loading_thread.start(self, 'prep_scene', ResourceLoader.load_interactive(new_scene), 2)

The prep_scene():
func prep_scene(interactive_ldr):
    while (true):
        var err = interactive_ldr.poll();
        if(err == ERR_FILE_EOF):
            call_deferred("_on_load_level_done");
            return interactive_ldr.get_resource();

The onloadleveldone():
func _on_load_level_done():
    var interactive_ldr = loading_thread.wait_to_finish()
    print('thread', loading_thread.is_active())
    if get_tree().change_scene_to(interactive_ldr) != OK:
        print('error')

sentences:
Where should I place input/output console for server? I'm developing a simple 2d online game and now I'm designing my server. The server will be run on linux vps and I need a way to communicate with it (for example to close it, and as it will be run on vps, simply closing terminal won't work). So I think there are 2 options:

1) Write 2 apllications - server which doesn't say anything and doesn't accept console input and the second application is console which sends commands to server (like exit, get online players etc).

2) Have 2 threads on the server appplication - one is the real server, the second thread will be used for cin and cout. However I'm not sure if this will work on vps...

Or maybe there is better aproach? What is the usual way of doing this?

sentences:
Enabling / disabling Static objects in Unity The Unity docs clearly explain that game objects marked static should not be moved for performance reasons but I can't find any info regarding enabling / disabling.

Almost everything in my games levels is destructible so I only use real-time GI. When the player damages a game object enough it's either removed or replaced with a damaged version of the model, usually via an object pool.

What effect does enabling or disabling a static game object have on performance?

sentences: Using Blueprint to spawn objects at runtime in Unreal Engine 4 Using UE4's "Blueprint" visual scripting system, how can I dynamically spawn objects at runtime?

sentences:
"Solve" a game algorithmically -- creating bots (and making them smart) EDIT :  at first I gave a lot of context for this question, explaining why I wanted to create a bot. I'm sorry it distracted people from my "actual" question.

My question is pretty simple : how does one create a bot for a game ? (Especially... on a mac, if it's possible -- though I can use a Linux virtual machine if needed).

Is it interfaced with the application, or just "watching" the screen and extracting information from it (as if it was taking pictures and analyzing them to get informations such as your HP, your position, etc.) ?
Could I use python to code it, or are there specific languages ?

The forementioned context :

Since I started programming, I've wanted to try to create algorithms that would be able to "play" (or even "beat") video games. Many games require only logical choices, more and more complex as the difficulty grows, which seems perfect for algorithms.

I currently enjoy the game "Pixel Dungeon" a lot (see here), but it's not always nice to you (and you die. A lot.). A few researches on the internet show that a lot can be achieved just by following simple guidelines.

So I figured maybe this would be a good game to try and create bots to play it. In the long term, I would like to let bots play, extract data out of it, and modify my algorithms according to these data.
I am really enthusiast about this, but also really novice.

(maybe this belongs more to https://stackoverflow.com/ ?)

sentences: 'Real' AI that learns in games In my work I analyze and design Evolutionary Algorithms (EAs), but for fun I'm learning game design, and, of course application of EAs in games. So I'm wondering if there have been any games where AI actually works as AI, i.e. learns from past solutions to develop new ones. I suspect it should be something like tic-tac-toe or chess.

sentences:
Unity "Update" method with lots of objects with logic In my game I'm working on in Unity, I want to have energy and machines (i.e ore processing machines, smelting (think Minecraft modded)), but I was thinking about performance.  The player could have quite a few of these machines in their base, all of them could be doing something and could be off screen, so this could effect performance as each machine will have logic to handle whatever it needs to do, and lots of them could be running at the same time.

Machine example;  Let's say we have a machine that crushes stone.  Player puts it into the machine slot, machine then starts crushing it if it has enough energy, and after X seconds, it outputs the crushed stone.  Player could keep the machine UI open and watch the progress (i.e progress bar), or be far away from it.

Should these machines be running constantly in Update, if not, what would be a better way to do this?

sentences:
Flow/design of steering behaviors implementation I am implementing some simple steering behaviors like: follow the leader, separation, cohesion and flee(from the leader when he walks in our direction - aka spread the group for him).

I am having issues with design of this system. I know how each of this behavior works separately but I simply can't do it with "if ladder" (as I did up to know). Can someone lead me on how to concatenate/normalize/multiply the forces and how to join them in one resultant force ?

EDIT

What I am exactly talking about is: for now I have something like so :

if(leaderGoingAtMe)
    makeSpaceForhisMovement()
else if(followTheLeader)
    goto(positionBehindLeader)

if(separation)
    addSeparationForce()
if(cohesion)
    addCohesionForce()

if(velocity > maxSpeed)
    clamp(velocity, maxSpeed)

Which is EXTREMELY bad in my opinion but I have no idea how to improve it.

sentences: Should the bullet trajectory calculated by server or by client? In a FPS game like Battlefield or Arma, when playing online, should the bullet trajectory be calculated by the server or by the client?

sentences:
How can I override OnTriggerEnter? I am trying to extend Unity's BoxCollider class.  So I am extending it in the editor like such:

using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(BoxCollider))]
public class MyBoxCollider : Editor
{
    public override void OnInspectorGUI()
    {
        EditorGUILayout.LabelField("My Box Collider");
        base.OnInspectorGUI();
    }
}

However, I cannot figure out how to override OnTriggerEnter, OnCollisionEnter, etc.

How can I override these?  They appear to be declared as private in the base class.

My end goal is that when I add a BoxCollider to a GameObject, it has a label in addition to its normal stuff. Then when BoxCollider's OnTriggerEnter method is called, it prints out what the label says before continuing on about its business. (This is a simplification, but I think it helps clarify my objective.)

sentences:
HTML canvas, Node WebSocket and multiplayer game like slither.io. How to send visual data over websockets? Where to start creating a multiplayer game like slither.io, agar.io, etc.

I need only learn how to draw live positions and other data of all players into one fullscreen HTML5 canvas with update frequency +/-100ms.

I already have websocket server but that is only chat. I dont know sending images of players and positions. My first idea is sending every 100ms array of all players positions, current position on the map and all other data of players.

var worldSize = [10000,10000]; //width and height in px
var currentPosition = [5000,5000]; //center on the map
var players = new Array();
//on player join
players.push({
    id: 1,
    name: "test",
    position: [1234,850], //random position on the map
    points: 100 //example points
});

//on player eat point find that player, update players[index].points+1 etc.

This is only my (bad) idea and I not tested it because I dont know how start, how to send visual game data via websockets. How?

Update

I checked slither.io game WebSocket console and all frames is Binary Frame (Opcode 2) and Binary Frame (Opcode 2, mask). This is short version of array of all players and their positions and all other data? Or?

For example if game play 1000 peoples, that array will be too long. This will lag browser?

sentences:
VS2017 (and 2019) Community Intellisense only showing part of the Unity class/method information, missing descriptions If I hover keywords like Input.GetKeyDown, for example, I know it should tell me something about using it for autofire.

I get autocompletion and the syntax examples / override counts, all great things, but no descriptive text blurbs.

I would really like to get those descriptions turned on.

I yanked a screenshot of an old Unity forum post that has visual evidence of the problem I'm having. I know that the text blurbs exist because I've watched enough Unity videos now with VS being used and more info.

This second image is a screenshot from a video.  In my editor, I do not see the line "Base class for all entities in Unity scenes." I only see the first line "class UnityEngine.GameObject"... helpful but not as helpful as it could be.  Same thing is missing in every class/method.

How can I get these Intellisense description texts to show in my version?

sentences:
How do I optimize searching for the nearest point? For a little project of mine I'm trying to implement a space colonization algorithm in order to grow trees.

The current implementation of this algorithm works fine. But I have to optimize the whole thing in order to make it generate faster. I work with 1 to 300K of random attraction points to generate one tree, and it takes a lot of time to compute and compare distances between attraction points and tree node in order to keep only the closest treenode for an attraction point.

So I was wondering if some solutions exist (I know they must exist) in order to avoid the time loss looping on each tree node for each attraction point to find the closest... and so on until the tree is finished.

sentences:
Calculate tile ID on a Reus style world with canvas context.arc() I need a bit of math help for my game.

I'm using Javascript and the Canvas tag to create a circular world, think God Finger, and Reus.  The current version of my game is here: http://lazyeels-sandbox.appspot.com/

The problem:
The Canvas draws an arc (or circle) starting at 90 degrees going clockwise. See an example image.

My game splits the world in to segments (tiles).  The world is 10 tiles in length I would like to calculate which tile the mouse is hovering over so the player can add buildings or adjust the height of the tile.

So I need to calculate the offset and deduct it from the mouse angle (either radians or degrees is fine). However, I can't seem to get it right.  I know that in theory I should do the following:

Calculate the angle of the mouse.
Calculate the tile by dividing by the segment size (as per regular tile maps i.e. y-axis/tilewidth).
Remove the offset of the angle to point 0 degrees at the top of the circle rather than 90 degrees clockwise).
Deduct the offset to get the new tile position.

Here is the main function I'm using;

var getMouseAngle = function(mouse){
    var world_length = 10;
    var segment = (Math.PI * 2)/world_length;

    // Get the distance
    var dx = mouse.x - ((canvas.width * 0.5) - Game.camera.xScroll);
    var dy = mouse.y - ((canvas.height - Game.camera.yScroll) * Game.camera.zoom);

    // calculate the angle
    var arctan = Math.atan2(dy, dx);

    // Reset the angle if it is a negative value
    var angle =  dy < 0 ? (Math.PI * 2) + arctan: arctan; // perhaps this is where I need to apply the offset.

    // Calculate the tile
    var orig_tile = angle/segment;

    // Calculate the offset
    var offset_tile = ((Math.PI * 3/2)/segment); // calculate offset clockwise = 270 degrees to the top of the circle (where the player sits).

    var tile = (orig_tile - offset_tile) // This is soooooo wrong

    return {
        dx: dx,
        dy: dy,
        degrees: (angle * 180/Math.PI).toFixed(2),
        radian: angle.toFixed(2)
        tile: Math.floor(tile),
    };

By comparison the player tile function was way easier:

Player.getTile = function(rotation){
    var tile = Math.floor(rotation/Game.level.segment);

    if(rotation > 0){
        tile = Math.abs((Game.level.world.length - tile)-1);
    } else {
        tile = Math.abs(tile)-1;
    }
    if(rotation == 0){
        tile = 0;
    }
    return tile;
};

Does anyone know where I'm going wrong in the calculation, i.e. how and when should I apply the offset - on the angle before calculating the tile, or afterwards?

I haven't shown the other permutations I tried, such as deducting the offset from the original angle, all of these resulted in the wrong tile ID being returned.

I know it should be a similar process to the player function, i.e. using the word_length in the calculation.

sentences:
Score system for "little bit more complex" snake game I have created snake game.
I can't think of good score system so that is is fair.

There is only one highscore list for all modes.

Player can choose any size of board
- Let's call that param "Board area", it is defined in cells. One snake segment takes one cell.

Player can choose any speed of snake
- Speed, in cells per second

I don't know how to calculate it so that score is fair for all players.

Firstly I thought of this:
score = length * speed
But is is not fair for players that reach end of board (nearly no free spaces to go, careful planing is needed to survive).

Then I thought that I need somehow award players that can survive for long in small amount of free place. The new formula looks like that:
score = (length/board size) * (length * speed)
But I still don't like it.

My score should reward players for:
Longest snake, tight turning and planning (bigger multiplier when board is full), and speed at which they are playing.

sentences:
What are some good learning resources for OpenGL? I have been using the OpenGL ES on the iPhone for a while now and basically I feel pretty lost outside to the small set of commands I've seen in examples and adopted as my own. I would love to use OpenGL on other platforms and have a good understanding of it.

Every time I search for a book I find this HUGE bibles that seem uninteresting and very hard for a beginner. If I had a couple of weekends to spend on learning OpenGL what would be the best way to spend my time (and money)?

sentences:
How to set shader global variable in sharpdx without using Effect class I am working with SharpDX, i thinking to try using (uniform) global variables for HLSL constants instead of constant buffers.

But, in my code SharpDX's Effect class is not used: i use PixelShader and VertexShader classes instead - constructed directly from bytecode blobs (i just don't use techniques/passes, i compile shaders separately).

With Effect class, i can assign new value to any constant in HLSL program by its name, as DirectX allows that, in any time. Example (i haven't tested this; yes, its ugly here):

SharpDX.Direct3D11.Effect fx = //
fx.GetVariableByName("someOption").AsVector().Set<Vector3>(newVectorValue);//nice

But i don't use Effect class.
How can i set global HLSL variable using Vertex/PixelShader class instance?
If it is not possible, shame on SharpDX dev then, in native DirectX it is much easier.

sentences:
Java 2D RPG Game smart pathfinding Hello I have a top down survival game where you shoot bad guys(green squares). The player can collide with certain tiles and so can the mobs but I want the mobs to go around the tile if there is a path and not juts look in the direction of the player. How could I do this. Here is my mob class, collision class and block class

public class collision {

public static boolean iscolliding(Point p,block b){
    return b.contains(p);

}

}

public class block extends Rectangle {
private static final long serialVersionUID = 1L;

public static int blocksize = 40;
private int id;

private Image i;

public static Rectangle r = new Rectangle(Comp.mx, Comp.my, 1, 1);

public static boolean c = false;

public block(int x, int y, int id) {
    setBounds(x, y, blocksize, blocksize);
    this.id = id;
}

public void render(Graphics g) {
    g.setColor(Color.green);

    if (id == 0) {
        ImageIcon i62 = new ImageIcon("res/tiles/air.png");
        i = i62.getImage();
        g.drawImage(i, x - play.camx, y - play.camy, null);

    }
    if (id == 1) {
        ImageIcon i62 = new ImageIcon("res/tiles/dirt.png");
        i = i62.getImage();
        g.drawImage(i, x - play.camx, y - play.camy, null);

    }
    if (id == 2) {
        ImageIcon i62 = new ImageIcon("res/tiles/roots.png");
        i = i62.getImage();
        g.drawImage(i, x - play.camx, y - play.camy, null);

    }
    if (id == 3) {
        ImageIcon i62 = new ImageIcon("res/tiles/hellgrasses/hellsoil.png");
        i = i62.getImage();
        g.drawImage(i, x - play.camx, y - play.camy, null);

    }

}

public void setID(int id) {
    this.id = id;
}

public int getID() {
    return id;
}

}

public class blob {

public double x,y;

public boolean dead;

public Rectangle r = new Rectangle((int)x, (int)y,20,20);

public boolean canmove;

public blob (int x, int y){
    this.x = x;
    this.y = y;
}

public void tick(){
    r = new Rectangle((int)x- play.camx, (int)y-play.camy,20,20);

    if(!play.isPaused){
        if(x > play.p.x+ play.camx){
        x-=.2;
        }
        if(x < play.p.x+ play.camx){
        x+=.2;
        }
        if(y > play.p.y+ play.camy){
        y-=.2;
        }
        if(y <  play.p.y+ play.camy){
            y+=.2;
        }

        if(r.intersects(play.p.r)){
            play.p.health-=1;
        }
    }

    if(dead){
        if(new Random().nextInt(100) >= 95){
            play.hp.add(new healthPack((int)x,(int)y));
        }
    }
}

public void render(Graphics g){
    g.setColor(Color.green);
    g.fillRect((int)x - play.camx, (int)y -play.camy, 20, 20);
    g.setColor(Color.red);
    g.drawRect((int)r.x , (int)r.y, 20, 20);
}

}

if you need any other info just leave a comment

sentences:
How do I make a blueprint run keyboard key commands? I created a project based on the Top Down Example.

In the project comes a character that I can move by clicking on the terrain that already comes by default.

Image of gameplay:

In the character's blueprint, I added a function on the N KEY. Simply to print a sentence (key N).

Character's blueprint:

I created an NPC based on creating a Blueprint Class > Character:

In the NPC blueprint I added a function, only now in the M KEY, but with the same principle. Print a sentence (key M).

NPC's Blueprint:

It turns out that only the command made in the blueprint of the character works:

I alternately clicked the N and M keys to take the screenshot.

I scanned the character's blueprint to see if something was missing, something I needed to add in order for the NPC blueprint to recognize the keyboard command. But I only found things like that related to the mouse.

Scan:

I'd like to know what I need to do to make the NPC blueprint recognize the M KEY.

sentences:
Programmatically creating a continuous scrolling background in Game Maker: Studio I have 15 background images for a 2D horizontal scrolling shooter game and I have been wondering how to insert programmatically those background images in the first level room, as I want them to be displayed one after the other looking as they were one large background image, repeating the last four ones until the boss is defeated.

I have seen that in Game Maker: Studio only 8 background slots are available in each room, so how could I achieve doing what I need here?

sentences:
Detecting if line crosses rectangle in python. Need speed boost I am currently writing a top down man vs robot shooter. The game works now, but if I have a decent sized level it runs slowly when you are being chased by robots. While just roaming around it can go at full 60 fps, but with the robots on your tail it slows down immensely.

I have traced the source of the problem to the part of the code where the robots decide whether or not their sight of the player is obstructed by a wall. This code works by seeing if the line segment formed by the center of the robot and the center of the player intersects a wall.

I have written this algorithm to see if a line segment goes through a rect:

for wall in wall_rects:

    #is wall between the robot and player:
    if man.rect.centerx < wall.rect.centerx < self.rect.centerx or\
    man.rect.centerx > wall.rect.centerx > self.rect.centerx or\
    man.rect.centery < wall.rect.centery < self.rect.centery or\
    man.rect.centery > wall.rect.centery > self.rect.centery:
        r = [] #are the corners above or below the line between the man and robot
        r.append((self.rect.centerx-man.rect.centerx)*(wall.rect.top-man.rect.centery)\
          - (self.rect.centery-man.rect.centery)*(wall.rect.left-man.rect.centerx))
        r.append((self.rect.centerx-man.rect.centerx)*(wall.rect.top-man.rect.centery)\
          - (self.rect.centery-man.rect.centery)*(wall.rect.right-man.rect.centerx))
        r.append((self.rect.centerx-man.rect.centerx)*(wall.rect.bottom-man.rect.centery)\
          - (self.rect.centery-man.rect.centery)*(wall.rect.left-man.rect.centerx))
        r.append((self.rect.centerx-man.rect.centerx)*(wall.rect.bottom-man.rect.centery)\
          - (self.rect.centery-man.rect.centery)*(wall.rect.right-man.rect.centerx))
        if not(max(r) < 0 or min(r) > 0):
            #if all of the corners are not on the same
            #side then the line does go through the wall
            break
    else: #IT SEES YOU! >:D

however it is not near fast enough to check all 450 some walls there are in my test level. My difficulty is either making it faster or having it find out which walls are worth checking for sight-line blockage. I tried checking the distance between the wall and robot to see if it is closer to the robot than the man, which slowed it down more.

Any suggestions?

EDIT:
I forgot to mention that in this game, while the walls are placed on a grid with 25X25 pixel squares, you are free to move any distance in any direction, and so are the robots, but it looks like the suggestions below will still likely help.

sentences:
Algorithm for "healing" multiple rectangles into a smaller number of rectangles? Say I have a grid of rectangles of different shapes and colors and I want to reduce (reasonably close to optimal is fine, optimal is not necessary) the number of rectangles to represent the same layout of colors.

The image above is a very simplified case and the whitespace between the rectangles is for visualization only -- they would actually be tightly packed.

What is an approach or algorithm name (happy to google) that can help me do this?

sentences:
Wall avoidance steering I making a small steering simulator using the Reynolds boid algorithm.
Now I want to add a wall avoidance feature. My walls are in 3D and defined using two points like that:

   ---------. P2
   |        |
P1 .---------

My agents have a velocity, a position, etc...

Could you tell me how to make avoidance with my agents?

Vector2D ReynoldsSteeringModel::repulsionFromWalls()
{
    Vector2D force;
    vector<Wall *> wallsList = walls();
    Point2D pos = self()->position();
    Vector2D velocity = self()->velocity();

    for (unsigned i=0; i<wallsList.size(); i++)
    {
        //TODO
    }

    return force;
}

Then I use all the forces returned by my boid functions and I apply it to my agent.

I just need to know how to do that with my walls.

Thanks for your help.

sentences:
How would I swap a character when a player touches a collider? I wrote a simple script to attempt to do this and I created an empty game object and applied the script to it and dragged both of my sprites into my script and I receive no errors but nothing happens when my player enters the collider and the "Calm" version of the sprite is still active.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;

public class JetAnglerSwap : MonoBehaviour {
public GameObject CalmAngler;
public GameObject AngryAngler;
// Use this for initialization
void Start () {

}

void OnTriggerEnter2d(Collider2D other)
{
    if (other.CompareTag("Player"))
    {
        SwapAnglers();
    }
}
    void SwapAnglers()
{
    CalmAngler.gameObject.SetActive(false);
    AngryAngler.gameObject.SetActive(true);
}
}

sentences:
Entity component system: how and where store pointers to system resources or third-party lib's objects? I'm migrating my game pet-project to ECS. I use C# (custom-made engine, not Unity). It goes pretty well, but one big thing is making me worry.
This is how and where to store pointers to system resources or third party libraries' objects?
For example, I have object with Transform and RenderModel component.
Transform contains data like matrices, quaternions etc (like described in any ECS paper :)
RenderModel contains path to FBX scene and some data how to render this model (materials, overrides, flags, scaling, etc).
For model rendering I use existing rendering library. To render the model I need to create object, add it to this library, update its transform if necessary and destroy it when I don't need to draw this model any more.
The question is where to store pointer to such rendering objects?
I see three approaches:

Any component that holds such resources implements methods OnAdd and OnRemove which are called when component added or removed respectively. On addition the component create lib's object and destroys it on removal. I've focused on this approach because it's pretty straightforward and simple to implement. Main drawback of such approach that I need to implement some kind of workaround to feed transformation to this models.

Systems are stateful and keep tracking of component addition and removal. When given combination of components is added (i.e. RenderModel and Transform) system that handle object drawing creates internal representation of the model and destroys when components are removed. Main drawback that I have no idea how efficiently track multiple component addition and removal.

Some kind of "imperative" approach. For each entity with RenderModel and Transform components system calls method like DrawModel(...). At the end of the frame the internal representation is destroyed and created again on next frame. Such approach looks like most convenient approach from game logic view, but suffer from obvious performance issues, because rendering library might build internal structures, cache visibility data, use interleaved shadow maps etc. Furthermore, updating this systems in parallel threads obviously will become nightmare.

Same issues I've also encountered with physics library and FMOD sound, because such libs also offer some long-living objects (non-POD) and build internal data structures.
Could you suggest better approach to solve such issue?
P.S. I use custom (made from scratch) engine (not Unity)

sentences:
How to prevent rendered wound from sliding on moving character? I am trying to display a rendered wound on the character, but I still can't figure out how to display it properly without sliding on character's body.

I'm following this link on rendering the wounds on characters but I still can't figure out why it isn't working.

This is what I have so far on rendering the wound based on hit location

What have I done wrong? Any ideas is appreciated. Thanks!

p.s This is how I draw the wound based on hit location.

UPDATE:
So I replace WorldPosition into Preskinned Position based on the comment suggested and the sphere mask won't render at all. I thought my HitLocation must be the problem, so I get back to the linked post to understands better on how to approach this, and included some C++ as well, but all those still resulting in the same results. The sphere mask keep on sliding on the body.

This is the code I have been using for both callable functions above

//Recursive function to have results relative to world origin
FTransform UGestureMathLibrary::GetWorldSpaceTransform(FReferenceSkeleton RefSkel, int32 BoneIdx)
{
 FTransform BoneTransform;

 if (BoneIdx > 0)
 {
  BoneTransform = RefSkel.GetRefBonePose()[BoneIdx];

  FMeshBoneInfo BoneInfo = RefSkel.GetRefBoneInfo()[BoneIdx];
  if (BoneInfo.ParentIndex != 0)
  {
   BoneTransform *= GetWorldSpaceTransform(RefSkel, BoneInfo.ParentIndex);
   UE_LOG(LogTemp, Warning, TEXT("if parent index is not equal to zero"));
  }
 }

 return BoneTransform;
}

//Reference pose bone transform
FTransform UGestureMathLibrary::GetRefPoseBoneTransform(USkeletalMeshComponent* SkelMesh, FName BoneName)
{
 FTransform BoneTransform;

 if (SkelMesh && !BoneName.IsNone())
 {
  SkelMesh->ClearRefPoseOverride();
  FReferenceSkeleton RefSkel;
  RefSkel = SkelMesh->SkeletalMesh->RefSkeleton;
  BoneTransform = GetWorldSpaceTransform(RefSkel, RefSkel.FindBoneIndex(BoneName));
  //BoneTransform = RefSkel.GetRefBonePose()[RefSkel.FindBoneIndex(BoneName)];
 }

 return BoneTransform;
}

//Bone transform
FTransform UGestureMathLibrary::GetBoneTransform(USkeletalMeshComponent* SkelMesh, FName BoneName)
{
 FTransform BoneTransform;

 if (SkelMesh && !BoneName.IsNone())
 {
  FReferenceSkeleton RefSkel;
  RefSkel = SkelMesh->SkeletalMesh->RefSkeleton;
  BoneTransform = SkelMesh->GetBoneTransform(RefSkel.FindBoneIndex(BoneName));
 }

 return BoneTransform;
}

Am I missing something?? Thanks again!

sentences:
In Unity, how do I set the window's size? Say I want a "world map" (maybe think the overworld in ff games) with dimensions 800px by 600px. How would I do that? Is this tied in with the resolution? Because I know you can set the game aspect.

Tutorials don't seem to cover this. For example, in this video, he just sort of drops the sky into the scene. You can see that some parts of the sky is cut off. He fixes this later by setting the pixels to units to 200 instead of 100. However, this all seems arbitrary to me. We don't know how large the sky is now, ie we don't know the dimensions of the sky. How do people fix this problem? Do you just look at the original image and do math to figure out how "large" it is in unity? What happens if you do something like this video where no size is defined?

sentences:
Blending Two different animations I'm sure there are articles around on this but I'm not really sure what they are called.

animation blending tends to give me the blend between two different complete animation such as walk and run.

what I'm after is having a player with that has a walk/jump animation and a firing gun animation. Is this still animation blending?

Can anybody enlighten me to how this process could be achieved?

sentences:
Really simple count down timer I'm making a little 2D tank game that fires bullets depending on where you click (This has been done and works a treat).

I'm currently working on a timer class with a simple function that displays a little countdown depending on the inputted time. (This will be used for bullet fire delays).

bool timer makeTimer(int waitTime)

This is the start of the timer, it is a simple boolean function which returns "true" when the timer has reached 0.

I can make it decrement down until it reaches 0 easily, but the part I'm having issues with is making it countdown based on an actual time event, so once per second. I've tried lots of different things but I just can't get this darn part to work.

The variables I have to work with are;

waitTime // inputted timeDelay
sf::Clock // To show the elapsed time per frame
sf::seconds(1) // Not too sure if I need this

So, to wrap up.
 - I'm trying to get it to countdown from the inputted time once per second.

sentences:
Technique for multiple shadow casting lights in 2D I'm trying to create shadows in a 2D game in such a way that I can have an arbitrary number of lights in a scene, all of which can cast shadows. To do this I think I have to generate a mesh for each light that models where the light can come (e.g. where there is no shadow).

In this tutorial: http://youtu.be/4BtjcH-iLR0?t=4m40s (at 4 minutes 40 seconds) Chris Molini does exactly what I want describing it as 'a polygon clipping pass' for each edge that intersects with the light. However I don't understand what kind of polygon clipping he is refering to here. I have tried to mimick his technique on my own but without success. (I get lost in corner cases and radial+distance ordering around the light).

Here's a screenshot from the video. The square is the light's mesh (basically an AABB containing the light's sphere of influence). Which is gradually adjusted for each edge that intersects with the light's mesh.

sentences:
XNA4 - Trouble updating part of a Texture2D I have a big Color[] ColorMap in memory (1280x720), and I have a Texture2D that I've uploaded this ColorMap to.
I update parts of the in-memory ColorMap, and want to upload those changed parts to the texture. I'd rather not re-upload the entire texture every time, so I'd like to use

public void SetData<T> (
     int level,
     Nullable<Rectangle> rect,
     T[] data,
     int startIndex,
     int elementCount
)

As far as I can see, I can not use this directly to upload just a part of my in-memory map to the texture since I can't specify a stride in the SetData method.

So say I'd like to update the area specified by DirtyRect, I'd first need to create a temporary in-memory buffer

Color[] tempBuffer = new Color[DirtyRect.Width*DirtyRect.Height];

then copy the wanted data from my ColorMap to the tempBuffer, and then upload the tempBuffer to my Texture2D like

Text.SetData<Color>(0, DirtyRect, tempBuffer, 0, DirtyRect.Width*DirtyRect.Height);

This seems to work - sometimes... But sometimes it appears in the wrong place ?!

If I get rid of the rectangle code and reupload the entire texture every time using

Tex.SetData(ColorMap);

it works fine, so apparently I must be doing something wrong.

Anyone got any idea? Or is there any code-example of updating only parts of a texture that I can have a look at (XNA 4)?

sentences:
Should I throw out game heavily using OpenGL 2.0 and rewrite it from scratch? I've picked up one old open source game (done with C++/Lua) with a lot of features and chosen to continue its development. It use SDL2 (ported by me from 1.2) and OpenGL 2.0. Now when I look at futher development it seems that mobile platforms don't support legacy OpenGL stuff, which is used really heavily: entire arhitecure is based on calling gl functions from lua side, where rendering functions are specified.

I'm not quite a pro in 3D development, so I'm not sure is it easier to change current architecture to modern OpenGL or re-write all the stuff. There are some other architecture problems (not GL related ones).

So, is it better to try changing exsisting architecture or start all from scatch, using modern stuff like OpenGL 3.1+ or Vulcan?

sentences:
Which language is best for 2D and 3D games to be played on the desktop and on the web? I am B.Tech. student and have done some CS courses and have some knowledge about programming languages. I know C++ (I've made some small desktop GUI programs with Qt and in Visual Studio), Java (also have done some GUI in Swing) and Python.

Now I want to learn to make 2D and 3D games which can be played on the desktop and also on the web. So which language will be best for this? I have played some web games and they all need Flash player to run, so are they all made in AS or some other Flash language?

sentences:
way to implement a menu -pratical i do my first game and already read alot about design strategie, programming style, design .. and so on
theoretically it works perfect but in practice i dont know if i do thinks "right"

i have three classes my main which starts the view
in this i do all my stuff -currently-

it holds an state variable, it has an onDraw method .. and so on

the third class is the game-thread while my game is running, in here are decisions -depending on my current state- what should be done

@Override
public void run() {
    Canvas canvas = null;
    mStartTime = System.currentTimeMillis();
    while (mRun) {
        canvas = mHolder.lockCanvas();
        if (canvas != null) {

            // State Updating State means to manage state transitions, such as a game over, character select or next level.

            switch( mPanel.getModeState() ){
                case Surface.MODE_LOGO_SPLASH :
                break;

                case Surface.MODE_MENU :
                    // the menu

                break;
                case Surface.MODE_LOADING :
                    // loading animation

                break;
                case Surface.MODE_GAME_PLAYING :
                    // game stuff
                                            // GAME START _ RUNNING _ END

                    // Input
                    // AI
                    // Physics

                    // animation
                    //mPanel.animate(mElapsed);
                break;
            }

            // draw everyThing
            mPanel.doDraw(mElapsed, canvas);
            // sound
            // Sound and Video.
            mElapsed = System.currentTimeMillis() - mStartTime;
            mHolder.unlockCanvasAndPost(canvas);
        }
        mStartTime = System.currentTimeMillis();
    }
}

my problem is .. the function onDraw draws everything .. including the menu ?
this sounds for me like bad code because everytime doDraw is executet, i have to check in this function which state i am currently in .. this cost time, dosent it ?

public void doDraw(long elapsed, Canvas canvas) {
    canvas.drawColor(Color.BLACK);

        // currently just gameLayout
        canvas.drawBitmap(background, 0, 0, mPaint);
    gameLayout.draw(canvas);

}

would it not be better do implement an other thread which draws the menu ?
but if so, how can i overlay the menu afer pause the game ?

:\
thanks for help
erwin

sentences:
What is the alternative to Time.time for scrolling texture? In my game, I'm using the standard SetTextureOffset method to smoothly scroll texture on background quad.

However, on game over, instead of reloading the scene, I'm just reseting all values initial position to give illusion that scene was reloaded. With this approash, i'm unable to use Time.time or Time.timeSinceLevelLoad because, the level was not reloaded and this value stays high. So scrolling is too fast right in the beginning.

Are there any time independent methods to smoothly scroll texture? Thanks.

sentences:
How do I create a closed beta on Steam? As per suggestion I'm splitting How do I create a closed beta on the App Store? up.

Can I upload the game I'm developing to Steam as a closed beta, so I could generate a couple of keys/tokens for my testers? I'm hoping to only publish the game for the public after I'm happy with the game as it's offered on Steam, as a complete user experience which includes the installation process.

If this is not the usual workflow, how should I do it?

sentences:
Align SpriteText position i have this function which aligns text.

static function AlignTxt(obj : GameObject, txtAnchor : SpriteText.Anchor_Pos,
txtAlign : SpriteText.Alignment_Type)
{
obj.GetComponent(SpriteText).SetAnchor(txtAnchor);
obj.GetComponent(SpriteText).SetAlignment(txtAlign);
}

The above function is called from this function..

txtlib.AlignTxt(powerTxt, SpriteText.Anchor_Pos.Middle_Left, SpriteText.Alignment_Type.Center);

But i get this error on AlignTxt Function :

The name 'SpriteText.Anchor_Pos' does not denote a valid type ('not found').
The name 'SpriteText.Alignment_Type' does not denote a valid type ('not found').

Can you please help me to solve the error..Thanks..

sentences:
Synchronizing players and game objects in a server/client multiplyer game OK guys,
I have some experience with 2D game development (single player only), so that's fine no questions here.

The problem is with multiplayer games. I already read lots of other questions and articles to get my head around about peer-to-peer and server/client, and non-authoritative and authoritative game clients.

What am I trying to achieve?
Build a simple 2D multiplayer game with some physics involved and over 40 player per game, a good example is flapmmo. However my game concept will be completely different and the players and other game objects will actually interact/collide with each other.

What technologies have I chosen?
Client: Unity3d (easy to develop and cross-platform)
Server: Node.js + socket.io + express.js (easy to deploy and cheap to host)

What I have done so far:
I already have a test client and server running and the players connection/join game + spawning works just fine. Now I am stuck at how to synchronize all the objects + players.

Base on that:

1 - How do I simulate physics on the server, do I need to rewrite parts of client side on the server side using a JavaScript physics engine?

2 - Is it better to send action messages like "playerJumped" and broadcast it to the clients or send it's current position on every update (more bandwidth consumption I guess)?

3- I read the server needs to run on a lower frequency( E.g. 30hz) to better perform with latency issues. Is it FIXED_TIME_STEP that we are talking about?

Please feel free to add any other important point I should consider...
Tks

sentences: How to send components in an ECS System? I'm trying to send a CreateEntity packet from a server to client, but I can't figure out how to send the information about components over the network. I gave each component an ID, but then I realized I'd have to send the associated data (E.X size of entity for the transform, etc).  Is the easiest way to just create an Enum of entities and have the client create the components based on what it knows about the entities? I'd prefer to not do that as it makes modding much harder.

sentences:
Playing animation on button press with a condition I want to do menu animation. In the animator, its contain 2 animations. One is opening animation, the other is closing animation. I set the opening animation as default state and added condition between of them. The condition contains one parameter, it is a bool type parameter. I drag the script which controls they behaviours on gameobject and animator component, but when the opening animation plays and player clicks the play button the parameter turns into true but it doesn't play.

 Animator canvasAnim;

 public Button lvlSelector;
 Button lvlSelector_A;

 // Use this for initialization
 void Start () {
     canvasAnim = GetComponent<Animator>();

     lvlSelector_A = lvlSelector.GetComponent<Button>();
     lvlSelector_A.onClick.AddListener(LevelSelector);

 }
 IEnumerator SlideLevelSelectMenu()
 {

     yield return new WaitForSeconds(1f);
     SceneManager.LoadScene("LevelSelectMenu");
 }

 void LevelSelector()
 {
     canvasAnim.SetBool("clickedclose", true);
     StartCoroutine(SlideLevelSelectMenu());
 }

sentences:
Can I have a scene graph translation node with multiple parent nodes? I am trying to write a C++ scene graph structure. While designing the node classes I am facing the below issue.

I have a scene graph to represent a house.

I would like to have another house next to the one I have but I would like to reuse the nodes from the existing graph. In order to do that, I create another house (House 2) as a child of the original house (House 1). Although this leads to a situation where the base node in the following graph has 2 parent nodes.

I would like to know, is it a good idea to have a scene graph node (intermediate translation node) to have multiple parents?
I would like to reuse my sub-graph as much as possible.

sentences:
libgdx draw/animate curve (tentacle) according to Box2D spring wavering The horizontally placed Box2D spring is made of distantJoint connected bars, and can bend up and down just like airplane wing does when you flight (bigger amplitude thou).

Ok, the physics part works, but how do I pull on a sprite/texture to have a smooth curve when it bends and waves in box2D?

Even if I compose the picture out of small bars, and spring bends 90 degrees down, there are whitespaces on the top of the spring where it is unclamped and messed up down part where it is compressed.
I wasn't able to beat this even for solid color tentacle, but what if there should be a nice picture of an octopus tentacle?

Can you please give a hint how the outer skin e.g. in this game
 implemented https://youtu.be/nakjRosCeH8?t=10 ? It is waving smooth curve, just like I need.
Thanks.

sentences:
How can I update a Stage-based HUD from another Stage's Actor in libGDX? I feel like this is a simple problem, but I'm having issues finding the correct search terms.

I have a Screen that includes two Stages.

The first, stage, contains a number of objects deriving from Actor and added via the standard stage.addActor(Actor). This is for the actual game objects.
The second, hudStage, consists of a single Table actor. This table includes a button as well as two Labels. This is for the static user interface/HUD.

I'm handling touch events on my custom actors in the game stage like the following:

public class GameObject extends Actor {
    private final static String TAG = GameObject.class.getName();
    // ...

    public GameObject() {
        // ...

        addListener(new InputListener() {
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                Gdx.app.log(TAG, "touchDown on GameObject actor: <" + x + "," + y + ">");
                return super.touchDown(event, x, y, pointer, button);
            }
        });
    }

This works perfectly and logs what I need. However, I would now like to update the HUD with information about the object the user touched.

My screen has defined the Label I want to update (added via hudStage), but I'm not sure how to go from an actor in stage to the screen, or to the hudStage label.

public class GameScreen implements Screen {
    Stage stage;
    Stage hudStage;
    // This is the label I want to update.
    Label infoLabel;
    // ...
}

I know I can call setText(String) on the label, but I'm not sure the best way to bubble the click up. Plenty of examples have simplified versions where objects are defined in the main class (in my case, GameScreen) and are able to refer to them that way, but I've already broken these apart.

I started to look at creating a custom event that my actor could trigger, and that the stage would handle, but documentation is sparse and I'm not sure this is required.

I've also thought about scrapping the idea of having a label in the hudStage and instead having my actor draw text where the HUD would have. However, from what I continue to see, I think Scene2D is the right direction to go for the UI.

Thanks!

EDIT: What I'm looking for:

An actor in GameScreen.stage is target of a touchDown event.
Logic in actor fires and updates object.
touchDown event in actor finishes by updating infoLabel in GameScreen.hudStage or updates String value in GameScreen (if easier, I'll go this route).

sentences:
Cast ray to select block in voxel game I am developing a game with a Minecraft-like terrain made out of blocks. Since basic rendering and chunk loading is done now, I want to implement block selecting.

Therefore I need to find out what block the first person camera is facing. I already heard of unprojecting the whole scene but I decided against that because it sounds hacky and isn't accurate. Maybe I could somehow cast a ray in view direction but I do not know how to check the collision with a block in my voxel data. Of course this calculations must be done on the CPU since I need the results to perform game logic operations.

So how could I find out which block is in front of the camera? If it is preferable, how could I cast a ray and check collisions?

sentences:
Dynamic Hills like Contre Jour in Cocos2d I'm interested in maps/environments which are flexible and change at runtime, such as those in Contre Jour.

I have looked for a long time to find out how to make this effect, but I couldn't find an answer. The closest I found was maybe something like this using springs to deform meshes.

Are there better methods for implementing this feature?

sentences:
How can one add a level to an already published ios/android unity3D game on a daily basis? How can one add a level to an already published iOS/Android Unity3D game on a daily/weekly basis?

I know this probably isn't feasible but it won't harm if I just made sure of it. Our game requires to allow access to just one level a day/week. You may access levels that were released on previous days and play to your heart's content but all players will get access to a new level every day/week. I know this may sound crazy but the concept requires it so just roll with me.

Is there anyway to achieve this for iOS/Android games built with Unity? Of course, we could package a whole game with 10 levels and allow access to each level after a set time, but the game will need to talk to a back-end CMS all the time to allow login and verification of users, make sure they aren't cheating, etc, etc, over proper security and https (proper anti-cheat solutions are a must and that's why maybe HTML5 route is better).

We are now moving towards doing all this in HTML5 and completely bypass Unity, but was hoping to find a solution with Unity because 3D is better than 2D depending on the situation, and some levels could be 3D while others 2D. Patching/updating everyday to upload new levels won't go down well with anyone, the app stores or the users.

sentences:
How to put trees on procedural generated world created using Perlin noise I have been new to game programming but I knew little bit about Perlin noise.
So I have created a infinite world using Perlin noise but I don't be able to understand how I put trees in my world like it is put in game Factorio.
My game is a 2d top down.

sentences:
Storing and Finding Art Assets I've started down a line of art asset development that will allow me to (hopefully) reuse and improve assets for several games.

But how do I go about storing and finding them?

Let's say for example I decide to focus on RPGs for ~2 years. I would create items, monsters, etc. and store them somewhere. How would I categorize them and make them easier to search later on?

Is the best solution "use directories with broad categories like landscape/items/monsters/etc.?"

sentences:
Different way to pass uniforms to seperate draws in glMultiDrawElementsIndirect Given OpenGL version 4.3 and GLSL 430, what would be the best way to pass a matrix to each model in a draw call to glMultiDrawElementsIndirect?

I am thinking of going the way of a TBO and indexing it based on my own attribute passed in to each model that tells the shader which draw call it is currently on. That technique is not my favourite as I have to create another buffer for something that should be basic functionality for the type of draw call (think gl_DrawID), so I have come here to ask what I could do instead.

(gl_DrawID is not supported on my current system. Although it really should be: AMD catalyst 14.4 with OpenGL 4.4 support)

sentences:
OpenGL behaviour depending on the graphics card? This is something that never happened to me before. I have an OpenGL code that uses GLSL shaders to texture a 3D model. The code involves a lot of GPU texture processing, blending, etc...

I wanted to check how the performance of my code improves using a faster graphics card (both new and old are NVIDIA, using always the NVIDIA development drivers). But now I have found that once I run the code using the new graphics card, it behaves completely different (the final render looks wrong), probably because some blending effect is not performed correctly.

I haven't really look into what has changed, but I am guessing that some OpenGL states are, by default, set different. Is this possible? Have you ever found different OpenGL/GLSL behaviour using different graphics cards? Any "fast" solution? (So far I've thought of plugging back the old one, push all OpenGL default states, and compare with the ones I initially get using the new card..)

Edit #1: The graphics cards are NVIDIA Quadro GX7300 (in which my code works OK) and NVIDIA GeForce GTX 560 Ti (in which the results changes / fails)

Edit #2 I have commented out a lot of my code, and apparently the strange behaviour has nothing to do with texture handling. A simple chessboard-like floor looks differents. The diagonal white lines did not appear using the old NVIDIA Quadro GX7300. Any guess what OpenGL related thing could be causing this?

Figure 1

Edit #3 I have now fixed the issue commented on the previous edit, regarding the weird unwanted diagonal thin whit lines. As I commented below, I had to remove the glEnable(GL_POLYGON_SMOOTH);, which was affecting the NVIDIA GeForce GTX 560 for whatever reason (probably due to reasons explained by mh01 in his answer.

However, I am still facing a "texture blending" problem when using the NVIDIA GeForce GTX 560. I have a 3D model that is being textured using a shader that blends 8 different images to compute the right texture, depending on where the camera is at that particular moment. The resulting texture is then a combination of different images, and ideally they were blended nicely, using a set of blending weights computed each time the camera moves. The blending weights are still well computed, but the resulting texture is wrong. I am guessing that the GL_BLEND function is somehow behaving different, but I have checked it in both graphics cards and it is actually the same one. I have no idea what else can be involved in getting this wrong result:

As you can imagine, the black line is where two original textures are being blended in order to get a seamless texture. If I use the exact some code and a NVIDIA Quadro GX730, the shader works as expected. However, when I use the NVIDIA GeForce GTX 560, the texture blending goes wrong. Any guess?

This is the GLSL shader I am using.

sentences:
Problems with Obstacle Avoidance steering behavior I learned how to implement the Obstacle Avoidance steering behavior from this tutorial. The approach depicted in this tutorial (simplified) is this (note that I'm using rectangular OBBs for obstacles, not circles):

The entity that avoids obstacles will have a 'ahead' vector, representing the entity's 'sight'. It will be equal to the velocity vector, but scaled to some length (the "sight distance").

For each entity in the "sight distance" radius from the entity, we check if it contains the the 'edge' of the ahead vector, marked with a red dot (actually the vector itself treated as a point):

For an entity that contains the red dot, we calculate the vector from the center of the entity to the red dot:

This vector (scaled by a scalar MAX_AVOIDANCE_FORCE) is the avoidance force. We apply it on our entity, and it should avoid the obstacle.

However, what happens in practice after applying the force is this:

As you can see, the entity is about to get stuck on the obstacle. That's because it doesn't sense it's about to collide, because the obstacle doesn't contain the edge of the 'ahead' vector.

So: what would be a good solution to this problem? How should I implement the algorithm?

sentences:
How to design AI to understand its selling decisions? I am programming a game where there are 4 competitors (players) who have finished goods that they can then sell to given markets for which they have (at most a single) contracts for.  Any finished goods is for a given market.

Turn order is important in the game as this will decide who sells first.

Scenario.

Turn order: Player #A, #C, #D, #B

The problem I'm having is I have no idea how to make the AI players aware of the following factors; they seem to need to know a lot of things which may impact on where to sell first.

For example, AI needs to know.

Am I the only person who can sell to a given market?
If so, that's fine -- sell all goods to market.

If not, do the following

Who are my competitors for a given market and will I be able to sell first?
If I sell in Market A, will I still get a chance to sell to Market B when turn order returns to me?  (demand for items goes down for every sale and can bottom out)

Indeed, this is one strategy I'm wanting to employ --  sell to a given market because i he does not he might not get a chance to sell again when turn order returns to them.

If I sell, should the AI go for most revenue per selling round.

Currently I am looking to order all markets for a given player based upon selling ability (who can sell first)

Basically an array of people who can sell for a given market based on player order.

These people then sell, and we reduce the array by one and repeat the process.

Whilst this solves some problems, it does not solve the bigger problem, which is the AI will just end up selling stuff in the order that of the Markets array; and not specifically to the ones where it is either advatangeous to do so, or will generate them the most money.

I am wondering, how do you design an AI to make coheriant, logical decisions about what when and why they would sell to a given market?

Sorry for the wall of text.

Many thanks

sentences:
How to slow down a Sphere smoothly in a world controlled by force and stop it (Unity 5)? I am a beginner and I started to use Unity 5. I play with tutorials on the site and documentation. I was basically testing springs, physics materials etc.

I have a problem understanding probably a very basic thing:

I have a Sphere (Collider + Rigidbody) and a Ground (Mesh Collider).
I add force to Sphere on FixedUpdate with GetAxis method.
I added Physics material to both sphere and the ground to create a friction.
Ball slows down when I do not touch the keys (no new forces) but it never stops while moving on the ground.
I know that as only 1 point is touching the gorund friction may not be good enough, but it almost does not affect the ball after a certain period. (I print the speed of the ball (Sphere) on a GUIText so I can numerically check it there too.)
I am aware of default Sleep treshold value but it will effect everything as it is a global variable, so I can't use that.
So, ball never sleeps.
I am aware of drag and angular drag (like the friction of Air) of Rigidbody component and they for sure work, BUT it feels like the ground is sticky and ball stops very quickly. It doesn't look smooth and natural.

Is there something that I am missing? The only way to do this is checking the speed of the ball and making it sleep manually when it's speed is low? Isn't there any other method? I don't want to do this as the world itself must live itself: I don't want to check movement of every single object..

This is probably one of the most basic things, but I cannot understand why it doesn't work..

sentences:
Text Based Tutorials for Unity3d I hope this is the right place to ask this. I'm very new to Unity but not to programming. I also have some basic game programming experience.

I'm searching for text based versions of the videos from unity3d.com/learn/tutorials. These tutorials are very good, but I end up forwarding videos a lot to get key screenshots and code snippets.

Is there any text / pdf / html / .doc / .rtf (i'm very open) version or similar resource to learn unity? Again, those tutorials are amazing and I'd hope to find something of similar quality, but I know that if I have to skim through tens of hours of video I'll end up frustrated. I get that the long hard way is probably the most robust one for deeper understanding, but I was hoping to hack a quick project.

EDIT :

If this can make it a relevant question, then I am currently looking at the "Roll a Ball Tutorial". Really, any other text tutorial would be very welcome

sentences:
Different screen sizes? (landscape) I want to make a separate landscape layout for each size of my original layout

I have activity_main.xml. I have adapted it to be able to fit multiple screen sizes:

Now, I want to create a landscape layout for each different screen size. The android docs and many (Many!) stack overflow pages suggest to do something like this to create a new landscape layout:

But after doing this, I create a landscape layout for all of the activity_main.xml's I need a separate landscape for the large activity_main, the small activity_main, the xlarge activity_main, and the normal activity_main. By doing the method described everywhere, I end up with this:

And because this covers all of the activity_main.xml's, I don't get the option to 'Create Landscape Variationon my other versions of myactivity_main`.

So, how do I get separate landscape layouts for each already made variation of activity_main?

Thanks so much,

Ruchir

sentences:
LibGdx - How can I correctly handle tile transitions / connected textures? So I am making a tiled game and I need to connect textures correctly based on whats next to it.

With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ie:

x 1 x
8 x 2
x 4 x

But for tiles with more detail I need to have corners too. I have seen people use the 8 bit meathod ie:

1   2  4
128 x  8
64  32 16

But really I can only see 48 different tile combos.

Is there a way I can separate corners and u d l r. Something like this:

x 1 x  8 x 1
8 x 2  x x x
x 4 x  4 x 2

Or is there a better way all together to do this.

This is what I have tried so far but this only uses 32/48 tiles and doesn't work for special corner cases.

public class RockTile extends Tile {

int y;

public RockTile(int id) {
    super(id);
    y = 7;
}

public TextureRegion getTexture(Level level, int xLoc, int yLoc){

    int u = (level.getTile(xLoc, yLoc + 1) != this) ? 1 : 0;
    int r = (level.getTile(xLoc + 1, yLoc) != this) ? 2 : 0;
    int d = (level.getTile(xLoc, yLoc - 1) != this) ? 4 : 0;
    int l = (level.getTile(xLoc - 1, yLoc) != this) ? 8 : 0;

    int bit = u + r + d + l;

    int ur = (level.getTile(xLoc + 1, yLoc + 1) != this) ? 1 : 0;
    int dr = (level.getTile(xLoc + 1, yLoc - 1) != this) ? 2 : 0;
    int dl = (level.getTile(xLoc - 1, yLoc - 1) != this) ? 4 : 0;
    int ul = (level.getTile(xLoc - 1, yLoc + 1) != this) ? 8 : 0;
    int corner = ul + ur + dl + dr;

    if (bit == 0) {
        if (corner != 0)
            return Game.splitTiles[y + 1][corner];
        else
            return Game.splitTiles[y][bit];

    } else {
        if (corner != 0)
            if (dl > 0 && l == 0 && d == 0)
                return Game.splitTiles[y + 2][bit];
            else
                return Game.splitTiles[y][bit];

        else
            return Game.splitTiles[y + 2][bit];
    }

}

}

If you need anything else let me know.

EDIT: Side question because I've seemed to have stumped you guys. If I decided to use the 8 bit method what would be the best and fastest way to make a lookup table for that.

sentences:
Should I use Game Engines to learn to make 3D games? HI i am a software engineering student in his second-last year.

I am proficient with C,C++,C# and java programming languages, and being a student of engineering I have studied calculus, vectors etc in both 2D and 3D & various other mathematical, probability and statistical topics.

I have made several 2D games, my most recent being a Super Mario-like game with side-scrolling and multiple levels.

Due to my these small game projects,i have become really interested in making games.

So now i want to move ahead to learn to make games in 3D.

Now I know that there are several game engines available which can take care of rendering details and other "low-level" stuff for me...

My Question is:

1) Is it a good idea to learn to program everything yourself, from making 3D shapes, terrains (using polygons meshes) etc, to programming mechanism for collision detection, lighting etc, considering my motive is to learn how to make games in 3D (but am not too eager to get into the game industry quickly, want to build a solid foundation first)

Or could I do without these details & work on the abstraction-level which the game engines (like UDK) provide ??

3) If I should try to develop from scratch, then  can anybody suggest which API to use: Direct3D or OpenGL?? (which i would be more comfortable with, in light of my above mentioned skills) & can anybody also give me references to some good books, reading materials, tutorials, etc to get me started?? (I wouldn't mind theory as long as it helps me make a sound foundation)

Many Thanx in advance (for even reading my question, i know it's lengthy... but i need a DETAILED answer... :D :D )

sentences:
How to approach players beeing overlapped by high isometric tiles? I'm making a browser game wich is based on PHP, MySQL and Javascript. It has an isometric world where the player can move and see other players/NPCs. But if a tile in the foreground is so high that it overlaps the tile behind it (e.g. a building or a group of trees, etc.), how to approach players beeing overlapped as well? I don't wan't players to be able to "hide" behind high tiles so that the characters of other players or the own character is not visible.

I thought about involving transparency by "making a sandwich" with a tile layer at the bottom, then the player and then the same tile layer on top, but slightly transparent. But when I tried it, the player looked like some king of ghost floating around and it was not clear where the player stands exactly.

Other games (like Age of Empires) managed this by displaying overlapped characters as an outline but this is really complicated/CPU-intensive using PHP, as far as I know.

I have no idea on how to approach this problem. Any ideas?

sentences:
Calculating orbital elements from Cartesian Vectors I'm having serious troubles with getting my calculations to work. I'm calculating the orbital elements from a position vector, and a velocity vector. (I also know the distance and mass of the bodies around)

The equation for angular momentum is as follows: h=r*v

The equation for eccentricity is: e=((v^2−μ/|r|)r-(r⋅|v|)v/µ

I plug in the position and velocity to get h, and I plug them into the other equation to get the eccentricity. These SHOULD be constants, and not change unless another force is put on them... yet they are not constant. In fact they change as the orbit goes around.

In the diagram I have just left a trail to show the orbital path. I should be able to calculate the required information... however they rely on the constants, which are not at all constant. I reference the rigidbody's position and velocity in them, and I've entered the equations in correctly. My code for applying force between planets is as follows:

void CalculateForce(Transform body) {
    float m1 = rbody.mass;
    float m2 = body.GetComponent<Rigidbody> ().mass;
    float distance = Vector3.Distance (transform.position, body.position);
    float f = (m1 * m2) / Mathf.Pow (distance, 2);
    Vector3 direction = rbody.position - body.GetComponent<Rigidbody> ().position;
    rbody.AddForce (-direction.normalized * f);
    body.GetComponent<Rigidbody> ().AddForce (direction.normalized * f);
}

The calculations are coming back incorrect. The eccentricity varies between 0.9 and 1.1. Anything over a 1 is not actually in orbit, and anything less is in orbit. However this remains in orbit as it travels around.

Can anybody help? (I've already posted to the space stack exchange and had no luck)

Thanks in advance.

Update:

Code used to calculate eccentricity (1001f is the combined weight of both objects):

    Vector3 pos = GetComponent <Rigidbody2D> ().position;
    Vector3 vel = GetComponent <Rigidbody2D> ().velocity;
    Vector3 eccentricity = (Mathf.Pow (vel.magnitude, 2.0f) - (1001f / pos.magnitude)) * pos;
    eccentricity -= Vector3.Dot (pos, vel) * vel;
    eccentricity /= 1001f;

sentences:
Many-to-one and feedback loop connections allowed in UE4 blueprints Under what circumstances is it allowed to connect:

Multiple execution output ports (those with the blank triangle) in
different branches to one single execution input, effectively
merging the branches into one.
Either an output port to an input in the same node, or to an input
in a different node connected to the same branch but that is executed before.
Both, for execution and data ports. Therefore effectively creating a feedback
loop.

I know those rules are enforced by the editor, but I don't have one available at the moment.

sentences:
On a 2D generated terrain what is the easiest way to pick tiles for the shoreline? If I have a two-dimensional array with ones and zeros for water and land respectively how do I choose what shoreline tile to use according to the water and land tiles surrounding it? The shoreline can form straight lines, outside corners and inside corners and there are four possible orientations for all of them. I have all the necessary tiles in the sprite sheet numbered. I want it to look similar to the shoreline in Age of Empires 2.

I could come up with a way to do this by comparing the eight surrounding tiles but this quickly became a mess as there are a lot of different possible combinations to take into account and manually assessing all of them with if statements seemed very unpractical and I'm quite sure there is a more elegant way of doing this. (I'm making this game with Slick2D)

sentences:
Affine transformation: rotate a plane parallel to another plane I am writing a function that extrudes a 2D shape along a 3D spline, as found in 3D modeling software.

I need a way of translating a set of points P so that they all lie in a new plane L (preserving distances between points).

P is all points where Z = 0;
L is defined by (0,0,0), with the normal vector N.

I am using Processing, it has common matrix and vector functionality (but no quaternions)
A conceptual or pseudo-code answer is OK.

sentences: OpenGL vs DirectX difference from Graphics card perspective? I want to know the difference in purely hardware level if there is any. For example the most simple question: Is there a chip for DirectX and another chip for OpenGL? What do hardware producers do to make their cards DirectX or OpenGL compliant?

sentences:
Setting density for Android game I am developing an Android game, in which a ball (bitmap) translates( is in motion). So I have provided motion equations for the ball. I have checked my app on Samsung galaxy S2 whose actual density is roundly 252 dpi, and It works fine on that. So my question is that Does these motions of bitmaps in surfaceView, depends on actual density of phone( i.e 252 dpi for S2) or generalized density(i.e 240 dpi).

I am confused whether if I run this app on 235 dpi smartphone, So will it have the same performance of motion as it is on Galaxy S2( with 252 dpi) or it would be little slow ?

Any help will be appreciated.

Let me elaborate it with coding. For example a linear motion of a ball is defined as with this equation x=x+4;
Now If I run this app, on Samsung galaxy S2(252dpi, and hdpi), So It will give me a particular speed motion, let say P is the speed of the ball.
Now If I run this application on Samsung Galaxy S3(300+ dpi, xhdpi), So the ball speed gonna be slow on this density, meaning less than the speed P.

So I will need the same speed on xhdpi density phone.
So will use these conversion formulas ;
dx= (x*160)/240;
px= (dx*320)/160;
 Hence the speed will be either exact or little different from P.(This is my confusion). That Whether the speed will be as same as it was on S2.

So my Question at this point is that my app worked on Samsung Galaxy S2 with the speed p, that I desired. As S2 is of 252 dpi, So Should I Include 240(Generalized density or 252 (Actual density) in my this line of coding ?
    dx= (x*160)/240;

Thanks !

sentences: Why do engines need to be optimized for new processors of the same architecture? When a new processor generation is released, most websites report that game engines and programs need to be optimized for the new hardware. I do not quite understand why. A processor usually has an architecture that defines what kind of instruction set it uses. The one we all use nowadays is amd_x86_64 . Why would any program or compiler need to be updated if all processors use this same architecture? Surely there are features WITHIN the pipeline of the new processor that optimizes the execution of machine code, but why would the machine code itself need to be changed if the architecture did not?

sentences:
Place an UI Image between two 2D sprites in Unity I am developing a 2D game with Unity.

I have two sprite objects rendered using SpriteRenderer.

With the new UI system, I want to use it to display an image between my two sprites. That is, my first sprite has a sorting order of 100, then my UI Image has a sorting order of 200 and then my second sprite has a sorting order of 300.

Is that possible?

I tried using sorting layers, but no matter what, the UI image seems to always overlay my two sprites.

sentences:
Implementing Branching Conversation Dialogue in C# with XNA How could I add logical branching conversation dialogue in C# with XNA? What I mean by this is a dialogue tree similar to this:

If the user is wearing red:
     DisplayText "You're wearing a red shirt!"
Else:
     DisplayText "You're not wearing a red shirt!"

The key is that I can't hard-code these logic questions into C# itself; it has to be readable from some sort of external file and still executable.

My question is very similar to this question: How can I implement dialog trees into my game?

But my focus is more on how I can actually begin to implement this feature into my game.

sentences:
How to let game characters enter existing 3D buildings model in my own game? I want to use ShiVa 3D game engine to build a 3D RPG game. And I want to load other people's 3D models into my game so that I wouldn't need to draw these things myself.

Here's a building model I loaded in 3ds Max, I don't know if I loaded this model in game engine, can my character enter this building and see the decoration inside? How can I verify this?

http://i.imgur.com/GHWQjXA.png

And if I cannot let my character enter this building, is there any resources that I can use on the Internet?

Thanks in advance.

sentences:
Implementing a score system similar to Moon Patrol I am working on an Android game scenario inspired by Moon Patrol.

My beta version is available for beta test from https://play.google.com/store/apps/details?id=dev.android.buggy

In my case, I got the elapsed time in seconds for reaching a checkpoint, and I could reward either a fixed bonus or a bonus based on the time, perhaps the difference between the time and the average time, or another bonus if it is a high score. My specific implementation for completing a checkpoint looks as follows at the moment:

if (checkpointComplete) {
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            //
        }
    });
    canvas.drawColor(Color.BLACK);
    ((ParallaxActivity) getContext()).stopWatch.stop();
    paint.setTextSize(60);
    String s2 = "TIME TO REACH POINT \"" + Background.checkpoint + "\"\n";
    if (runOnce) {
        for (int q = 0; q < s2.length(); q++) {
            final String s2f = s2;
            final int r = q;
            ((Activity) this.getContext()).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    checkpointtextview.setTextColor(Color.RED);
                    checkpointtextview.append(Character.toString(s2f.charAt(r)));
                }
            });
            try {
                Thread.sleep(50);
            } catch (InterruptedException ie) {
            }
        }
    }
    String str = String.format("%03d", ((ParallaxActivity) this.getContext()).countUp);
    String s3 = "YOUR TIME                :   " + str;
    if (runOnce) {
        for (int q = 0; q < s3.length(); q++) {
            final String s3f = s3;
            final int r = q;
            ((Activity) this.getContext()).runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    checkpointtextview2.setTextColor(Color.parseColor("#ADD8E6"));
                    checkpointtextview2.append(Character.toString(s3f.charAt(r)));

                }
            });
            try {
                Thread.sleep(50);
            } catch (InterruptedException ie) {
            }
        }
    }
    runOnce = false;
    // canvas.drawText("CHECKPOINT COMPLETE", (float) (screenWidth * 0.35), (float) (screenHeight * 0.45), paint);
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ((ParallaxActivity) getContext()).startTime = SystemClock.elapsedRealtime();
                    ((ParallaxActivity) getContext()).stopWatch.setBase(((ParallaxActivity) getContext()).startTime);
                    ((ParallaxActivity) getContext()).stopWatch.start();
                    checkpointtextview.setText("");
                    checkpointtextview2.setText("");
                    checkpointtextview3.setText("");
                    checkpointtextview4.setText("");
                    checkpointtextview5.setText("");
                    checkpointtextview6.setText("");
                    String str = "Player 1  " + String.format("%06d", score);
                    tvId.setText(str);
                    scoring = false;
                    buggyXDistance = 0;
                    distanceDelta = 0;
                    retardation = 0;
                    checkpointComplete = false;
                    runOnce = true;

                }
            }, 3000);
        }
    });
}

I want to calculate bonus for completing a checkpoint but how is it calculated? If we look at the original it looks like below.

Is it possible to deduce the formula for calculating the bonus? My bonus screen looks the same. So if your time is x and the average time is y and the record is z, what is the formula?

sentences:
A* pathfinding for grid with direction-dependent nodes? I'm trying to understand if the A* algorithm is a possible pathfinding solution for my game.

I have a simple grid of nodes that an enemy can move around on, but the nodes represent traversable terrain at different heights in my game world. So although an enemy might be able to "jump down" from Node A to Node B (where Node A is much higher than Node B), it could not do the reverse and "climb up" from Node B to Node A. In other words, whether the A* algorithm can travel from one node to another depends on the direction of travel. It may be possible in one direction but not the other.

Can A* handle a situation like this, or do I need a different pathfinding algorithm?

sentences:
in unity, lightmap comes out blurry on android device as you see, shadow is blurred. (see the tree's shadow)

What settings should I add?

sentences:
Generate Angle for Projectile to Follow So It's Ends Facing Downward I am building a game within a game engine. The game is a 2D platform, where the player can move left, right, and jump/fall down. Part of the game is the presence of physical projectiles falling from the 'sky'. When these objects are created (in the sky), impulse is applied to them toward the present location of the player [Pic 1]. Please note the impulse is applied one time using the location of the player at object location, it is not constantly being applied to the location of the moving player. The projectile should move toward that location of the player, not necessarily to the location - and it does - but as it reaches its destination the object starts to curl upward [Pic 2].

I have tried several formulas for setting the angle on each tick (every frame), namely

Set Angle Toward: PlayerWasAtX, LayoutHeight
Set Angle Toward: Self.X, LayoutHeight
Set Angle Toward: If (Self.X > Self.PlayerWasAtX)
                  Then (Self.X - PlayerWasAtX) / 2
                  Else (PlayerWasAtX - Self.X) / 2
                  , LayoutHeight

Where PlayerWasAtX is the stored location of the player upon projectile creation, LayoutHeight is the total height of the canvas, and Self.X is the X-coordinate of the projetile.

In those examples, example 1 would curl, example 2 would keep the object straight down at all times even when falling at a curve, and iirc example 2 just acted wacky.. or it acted the same as example 1.

Any help would be appreciated. Here are my reference pictures:

sentences:
Borderless windowed (fake fullscreen) mode doesn't cover the entire screen I'm using Direct3D 11 running on Windows 10 20H2, but have seen this problem going back to Windows 7.
I'm adding borderless windowed (fake fullscreen) mode support, and all of the online resources I can find suggest that it's simple: just setup a windowed mode the same size as your display resolution, use WS_POPUP, and that's all you need to do.
The problem is that it doesn't actually work.
Instead, I get (on a 1920x1080 display) a 1920x1060 window, with the bottom 20-pixel high portion of the taskbar still visible.  The odd thing is, the swapchain backbuffer is sized correctly, at 1920x1080, and adding some debug output shows that my WM_SIZE message is coming through at 1920x1080; it's as if something else internal was preventing the window from covering the full screen.
Fullscreen exclusive modes work correctly.
The workflow I'm using to set this mode goes like:

Determine if the window will be the same size as the display.

If so, set WS_POPUP (not sure what to use as the ExStyle so I'm leaving it at 0 for now, but I've also tested WS_EX_TOPMOST with no success).
If not, set the usual array of styes.

Call SetWindowPos with SWP_FRAMECHANGED.
Pump my message loop to make sure that everything is brought up to date.
Call IDXGISwapChain::ResizeTarget to do the actual window resizing.
Respond to WM_SIZE to call IDXGISwapChain::ResizeBuffers, create my views, etc.

Of note is that I don't change the window size using SetWindowPos; I let IDXGISwapChain::ResizeTarget do that for me, and that works for every other combination of windowed-to-windowed, windowed-to-fullscreen, fullscreen-to-windowed and fullscreen-to-fullscreen transition (where "fullscreen" here is fullscreen exclusive).
The only thing that does not work is borderless windowed.
What sorcery am I missing?

sentences:
What is the best practice to handle event with order? When you play card games, you always face some abilities and effects will be triggered at the same time. To resolve this, players relies on the rules. For example, if a minion dies, it triggers effects on my side and opponent side. If the effects is handled on my side first if it is my turn.

But how would you resolve it in computer games. Even you are using mediator for event handling, the event is usually handled by the order of subscription. Unless there are some indicators for the subscribers, you will not able to distinguish between the subscribers. But wouldn't it defeats the purpose of observer pattern? What is the best way implement it?

sentences:
How to set up Cocos2d-x for visual studio? I want to make a cocos2d-x game. I read you can use any IDE, so I was planning to use Microsoft Visual Studio 2015, since I want to make my game primarily for Windows. I have been searching for tutorials, but i couldn't find any. It'd be great if someone wrote a step-by-step guide on how to set it up.

Thanks in advance.

sentences:
Proper way to update pixel array data For a game that updates a board every frame I am calculating the next arrangement of board, updating pixel array data and render board as 2D texture to quad the size of the screen using OpenGL.
I use:

glTexImage2d(GL_TEXTURE_2D,0,GL_RGBA,tex_width,tex_height,0,GL_BGRA,GL_UNSIGNED_INT_8_8_8_8_REV, &pixel_data.front())

to initialize the texture object and

glTexSubImage2d(GL_TEXTURE_2D,0,0,0,tex_width,tex_height, BGRA,GL_UNSIGNED_INT_8_8_8_8_REV, &pixel_data.front())

to update the texture.

The slowest part of the code is update_pixels() (below) Taking  256x128 elements input array and creating four component pixel array based on that. This function is very slow(45ms) and it seems it should be done differently. What would be the proper way to implement this function?

Update pixel data per frame:

void  update_pixels() {
//update pixels
//std::vector <unsigned char> pixel_data
float state = 0;
size_t it = 0;

for (size_t y = 0; y < board.getWorldHeight(); ++y) {
    for (size_t x = 0; x < board.getWorldWidth(); ++x) {
        state = board.get_state(y * golf_board.getWorldWidth() + x);

        pixel_data[y * board.getWorldWidth() + x + it ] = static_cast<unsigned char>(state * 255);
        ++it;
        pixel_data[y * board.getWorldWidth() + x + it] = static_cast<unsigned char>(state * 255);
        ++it;
        pixel_data[y * board.getWorldWidth() + x + it] = static_cast<unsigned char>(state * 255);
        ++it;
        pixel_data[y * board.getWorldWidth() + x + it] = static_cast<unsigned char>(1 * 255);

    }

}
return;
}

Time measurement:

void render(){
render_frame() //glDrawElements() for quad and scale uniform update takes 0.2ms
generate_states() //new states for board takes 1.3ms
auto t1 = std::chrono::high_resolution_clock::now();
update_pixels(); // create new pixel array, takes 32 ms
auto t2 - std::chrono::high_resolution_clock::now();
float update_time = std::chrono::duration_cast<std::chrono::microseconds>(t2-t1).count() /1000.0f;
//cout <<updae_time
glfwSwapBuffers() //from update pixels to swap takes 13ms
}

sentences:
Visualizing NavMesh to Camera When Unity builds a NavMesh, you can see it in the scene view if you have the Navigation window open and select "Show NavMesh" in the Navmesh Display box. I'd like to use the exact same overlay in a camera view. Is this accessible in any way? Can it be rebuilt during runtime? Since the navMesh isn't an actual mesh, I can't seem to find a way to make this happen.

EDIT: This is what I'm trying to work with right now:

public class NavMeshToCamera : MonoBehaviour {

    NavMeshTriangulation triangles;
    Mesh mesh;

    void Awake () {
        triangles = NavMesh.CalculateTriangulation();
        mesh = new Mesh();

        mesh.vertices = triangles.vertices;
        mesh.triangles = triangles.indices;
    }
}

I have this script attached to a secondary camera that will be enabled while holding down a button to see an overlay of a minimap of the current dungeon.  I'm not quite sure what to do with the mesh data to provide a mesh visible to the camera.  Since no mesh exists initially, I suppose I'd have to take the new mesh, apply a layer to it, and have only that layer visible to the camera.  But I'm having some difficulties with this.

sentences: First Mobile Indie Game - Monetization Model. Ad based or in app purchases? We are a team of 3 (1 graphics designer, 2 developers). We're almost done with our first Android based indie game. Which monetization model will be suitable for us? We don't want to disturb users with a lot of ads (at this point we're thinking to put only banner ads) also, if we go with in app purchases, can we also keep ads as well? or is it a better practice to follow one model at a time? How much will it affect the user experience?

sentences:
How to add Collider to a Line Renderer in unity? I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this.
Current Code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreateCircle : MonoBehaviour
{
    // Start is called before the first frame update

    public float radius;
    void Start()

    {
        int segments =60;
        int pointCount = segments+1;

        Vector3[] points = new Vector3[pointCount];

        LineRenderer line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = pointCount; //line.SetVertexCount(pointCount);

        for(int i=0;i<pointCount;i++)
        {
            float Deg = (i*60 / segments);
            float Rad = Mathf.Deg2Rad *Deg;

            points[i] = new Vector3 ( Mathf.Sin(Rad) * radius,Mathf.Cos(Rad)*radius,0);
            // Debug.Log(" Point: "+i+" Deg: "+Deg+" Rad: "+Rad+" Vector 3:"+points[i]);
        }
        line.SetPositions(points);

        Mesh lineMesh = new Mesh();
        line.BakeMesh(lineMesh,Camera.main,true);

        MeshCollider lineCollider = line.gameObject.AddComponent<MeshCollider>();

    }

    void OnColliderEnter(Collider col){
        Destroy(col.gameObject);
    }

}
```

sentences:
Conditional priority in behavior trees I want to trigger behavior based on certain conditions. I currently just have a sequence that runs different behavior, it triggers on condition but always in sequence. When the first condition is met it runs that.
Let's say I have 2 behaviors. Flee from threat and find food if hungry. Usually the flee from stronger threat prevails and thus is placed early in the sequence. But what if the entity running the behavior is starving, it can take more risk. Since the flee from threat comes first in sequence and triggers on a threat it will never pick to gather food if there is a threat present. I guess I need something like a scoring system and let the tree pick the best option. Is this common in behavior trees? How is it called or best implemented?
I'm using gdx.ai in particular and perhaps there is something out of the box I can use. I can make a task in the behavior tree that weighs all the possible actions but this ties everything together and bt's are widely used for the opposite.

sentences:
How do the Box2d and Bullet physics simulations work internally? I've seen box2d and bullet ported into JavaScript, but neither of them attracted me, except for the source code. It all seemed quite simple, once I looked inside.

What are they doing within each of those libraries to get nice physics simulation? I can not find any explanation.

sentences:
Transform vertices in a line differently? With a GL_LINE, is there a way to have the vertex (or geometry) shader treat the first and second point differently?

i.e. In a line from p0 -> p1 I'd like to apply a different transform to p0 than to p1.

I know how to do this with a computer shader, but I was wondering if there is a way to do it with a vertex/geometry shader.

sentences:
How do I approximate the result of battle between two armies with known strengths? I need a simple algorithm to calculate the outcome of two differently sized armies battling.

Each army has 1-100 troops and every troop is the same value on the battlefield. The troops do not have individual stats. The only parameter on each army is the number of troops. For example: A with 57 troops battles B with 89 troops. Who wins?

Randomness can be a factor: For example, there could be a 50% chance that team A's total is subtracted by half of team B's total. Here's what I have so far (in a variation of BASIC):

lbl 1
If A>B goto2
If A<(or equal to)B goto3
lbl 2
50% chance B-((A-B)/2)→B
50% chance A-(B/2)→A
goto4
lbl 3
50% chance A-((B-A-/2)→A
50% chance B-(A/2)→B
goto4
lbl 4
If A=0:stop
If B=0:stop
goto1

So this system repeats until one of the armies reaches 0 troops.

The problem is, the battles go too fast. The battle is done almost instantly sometimes. Is there a better algorithm?

sentences:
Loading a stream/asset on Android MonoGame without ContentManager In the game I am developing, I have created a serializable class that generates a .map file for saving and loading levels. In XNA, this works great using the following code:

FileStream fileStream = new FileStream(filePath,
                FileMode.OpenOrCreate);
BinaryFormatter formatter = new BinaryFormatter();
MapInfo data = (MapInfo)formatter.Deserialize(fileStream);

Unfortunately, in android it appears that the filePath ends up at the device's root (argument being passed in as "Content/maps").
After some research, I came across this page from xamarin that explains how to properly load assets from the asset folder. However, this action takes place in a separate namespace from my main activity, and so far have not found a way to access the Assets.Open() function.

any other ways to load that asset?

UPDATE:
After playing around some more, I ended up trying to pass the Assets property of the main activity down through function calls, loading the file this way:

Stream fileStream = androidGame.Assets.Open(filePath);
BinaryFormatter formatter = new BinaryFormatter();
MapInfo data = (MapInfo)formatter.Deserialize(fileStream);

SADLY, the file still does not load. Looking at the variables in debug shows the correct address for the activity contained in the variable androidGame, but says Open is an "Unknown member"

UPDATE WITH WORKING SOLUTION:

In case anyone comes across file loading issues in Monogame Android, this is what I ended up doing:

First, make sure you copy/reference your files in the correct dir of your android build. This should appear somewhere under Assets/Content/yourfile.file or subfolder.

Then, check the properties of the file and select "AndroidAsset" for build options and "Copy if newer" for output.

Finally, open the stream using the Assets property of your main activity. This can be accessed using your Microsoft.Xna.Framework.Game class in this way:

Stream fileStream = Game.Activity.Assets.Open(path);

Turns out my issue was not the stream itself, but the deserialization which could not open a .dll in android (overlooked that one...). I ended up switching to XML serialization, since the binary serialization is build dependent

sentences:
Good technological solutions to build an ascii map and moving characters in a browser (like dwarf fortress)? I'd like to build a webapp for my game website that involves using text characters to represent animals and people, and have them move around on map squares with independent (server driven) AI.

So essentially, a dwarf-fortress map in the browser:

With moving creatures, mobs, npcs and pcs.  Though not that I'm not looking to acheive this scale, I'd probably start of showing a quarter of this content or so at any time.

Probably some of the background/immobile tiles could be loaded statically.  But for creatures/animals and things that can move, I'm not sure what technology solutions would be most effective.

I'm aware of <canvas> though I don't know whether its capabilities fit this use case.  Certainly some amount of javascript is going to be necessary.

Are there javascript libraries or canvas libraries out there that fit this use case?  Another technology that I am not aware of?  Anyone know of any examples of websites that have done anything similar to this, so that I can crib ideas from them?

sentences:
How to render gameplay over UI? I'm working in 2D.

I have set up 2 cameras. One for UI and another one for gameplay.

I need the UI to be rendered after before game objects (over gameplay). I wanted to achieve this without using world space canvas, because It requires being scaled for every other device along with a camera.

UI can be drawn over gameplay using greater depth than gameplay camera. And because it's depth only there is no solid color, so it all works well.

But you cannot set gameplay camera to depth only because it doesn't render things right, it doesn't clear the render texture I guess.

So this is what happens if gameplay camera is set to depth only.

This is what happens when gameplay camera is set to Solid Color and UI Camera has bigger depth. You can see that the ring is covered by UI arrow.

If the UI Camera depth would be lower than gameplay camera (Solid Color). It would all be covered by gameplay camera without even displaying UI.

These are mine settings.

Is there a way to achieve this in Unity without using World Space Canvas Mode?

sentences:
Inverting matrix in HLSL I've got an object in HLSL and I'm using hardware instancing to render multiple copies. But I've come a bit of a cropper when it comes to the vertex normals. Currently I am not using normal mapping (although planning to implement it soon), I'm just putting the normals inside the vertex structure. I can put the world matrix and get it out in HLSL just fine, but I need the inverse transpose if I want the world position of the vertex normal from object space. How can I invert a matrix in HLSL? Or am I going to have to send the matrix and it's inverse in the instance buffer?

Or is this somehing that normal mapping doesn't require?

sentences:
Prevent parent alarms to activate a child alarm event I'm working on a small game using Gamemaker Studio 2 and I've noticed that my Parent o_enemy.Alarm[0] Is activating the Child enemy_1.Alarm[0] event.

Both alarms were supposed to be activated under different conditions, (The parent alarm is used for all enemies, but the child alarm is used for the specific enemy) but they seem that they'll activate each other because they share the same name Alarm[0].

I could fix it by setting one of the alarms to Alarm[1], but seeing that I've only a limited amount of 9 Alarms, I think there should be an easier solution to solve this problem.

So far I've tried Event.inherited() on the child alarm, but that didn't solved the problem.

Is there a way that a child's Alarm will ignore the conditions of the parent alarm?

sentences:
Why does Physics2D.Raycast automatically fail if applying a layer mask? I have been troubleshooting a problem I have encountered with some of my raycasts, and have arrived at a perplexing brick wall. I fire a Physics2D.Raycast in order to determine if my character is grounded; however, it would not always return a reference to the ground object in situations where it should.

Breaking down the method call, I have fired a raycast without a layer mask. This returns the correct reference; I then send the layer mask associated with the reference transform to the debug log.

public void FireTestRay()
{
    RaycastHit2D hit = Physics2D.Raycast(startPosition, Vector2.down, 0.1f);
    Debug.Log(hit.transform.gameObject.layer);
}

  8

I want to be checking against my platform objects, which I have proven to contain the layer index of 8. However, when I use layer masks, the raycast fails.

public void FireTestRay()
{
    RaycastHit2D hit = Physics2D.Raycast(startPosition, Vector2.down, 0.1f, 8);
    Debug.Log(hit.transform.name);
}

  NullReferenceException: Object reference not set to an instance of an object

I am not moving my game object; in fact, the only thing that changes at all is the above mentioned lines of code.

I seem to be able to successfully hit the intended object if I do not use a layer mask, and in turn, can successfully retrieve the value of the intended objects layer mask. As soon as I filter my raycast to only hit that layer mask, it fails.

Why does Physics2D.Raycast automatically fail if applying a layer mask?

sentences:
What do game designers do for the game? One day I asked me: "How do game designers work?". I knew what the "main mission" of their work, but I didn't know: "How to do it?" and "What do they need to write?"

I want to know full "list" of terms with examples that they need to write.

For example:

Genre - Action

Setting - Retrofuturism etc...

Please answer me :)

sentences:
Drawing order in XNA When manually setting the drawing order of game components by setting

int DrawableGameComponent.DrawOrder

can one use any integer numbers as long an order is defined like

component1 => drawing order: 2
component2 => drawing order: 5
component3 => drawing order: 10
component4 => drawing order: 323

or do these integers have to be consecutive and starting with zero like

component1 => drawing order: 0
component2 => drawing order: 1
component3 => drawing order: 2
component4 => drawing order: 3

?

sentences: How to calculate a 3x3 rotation matrix from 2 direction vectors? I've got 2 direction vectors, for the X axis and the Y axis of the object. How do I calculate the rotation matrix of the object using these?

sentences: How can i add mobile camera feed to unity? I want to take my mobile camera's feed to unity , where if the target image is found , some action should happen ( may be like a cuboid appears on the target image). I thought of using ip webcam app which generates ip address , through browser i was able to see the camera feed. I want the feed from camera but the action must be in my laptop.

sentences:
Wave interference like render effect (Someone on gaming told me to better post this here.)

So in a lot of games lately I've seen this weird "light interference effect" where objects on the edges of my screen become red and blue blurry. My questions are:

What's this effect's name?
Why is it there?
Why do so many games use
it?

Here's a picture of what I mean:

sentences:
How do I create a laser pointer dot in Unity URP? I want to replicate the laser pointer dot as in RE4:

Here is a video that shows the laser in action.
I have tried to replicate it using a spotlight. The problem with the spotlight is that its size can only be controlled by its distance to the object. I'm struggeling really hard with keeping it at just the right distance.
Since this is such a big problem, I would first of all like to ask if a spotlight is the preferred way to create such a laser dot.
Thank you.

sentences:
Manually update rotation of only Y-axis on Agent I have some code to manage to rotation of my Navmesh agents:

if (Agent.isActiveAndEnabled && Agent.hasPath)
        {
            if (Agent.velocity.sqrMagnitude > Mathf.Epsilon)
            {
                transform.rotation = Quaternion.LookRotation(Agent.velocity.normalized);
            }
        }

It's causing my some issues with some odd rotations on the x/z axis for 1-2 frames every now and then, is there some way I can get this exact behaviour but only modify the y-axis?

sentences:
How can I export a model using the CAT bone system into XNA? Has anyone successfully used the CAT bone system in 3ds Max and exported the file into XNA? If so, what was your method of doing so?

There are a number of methods of doing this, apparently, but the ones I've tried have not worked.

I used the Panda Exporter which creates an .X file. This seems to be the latest way of going about this, but when it's loaded in XNA, there is an error saying something about the bone weights. This happens when I export with and without CAT bones.

sentences:
Torus World Collision Dection I am looking for a collision detection solution for use when 2d screen wrapping.  Specifically, when the image is split between the right and left side I can only detect a collision for a limited area.

For example, the program detects the collision when the rectangle intersects the circle in the first image.  However, it doesn't in the second image.  I am using the Rectangle.Instersects method to check for the collision in both cases.

I used the screen-wrapping solution at the following link:
How to create a 2D region where sprites are automatically wrapped?

However, since I am not using the physics engine, I am not using the related solution at:
How to create a very specific kind of joint in Farseer?

I am aware of the following question:
https://stackoverflow.com/questions/8679304/wrapping-drawn-image-in-xna-4-0, and incorporated part of the code to reset the draw rectangle's position when wrapping for both sprites:

 // reset draw rectangle for wrapping
        if (drawRectangle.X < -sprite.Width)
        {
            drawRectangle.X += parentWindowWidth;
        }
        if (drawRectangle.X > parentWindowWidth)
        {
            drawRectangle.X -= parentWindowWidth;
        }
        if (drawRectangle.Y < -sprite.Height)
        {
            drawRectangle.Y += parentWindowHeight;
        }
        if (drawRectangle.Y > parentWindowHeight)
        {
            drawRectangle.Y -= parentWindowHeight;
        }

This post also says that I have to check for the collision in the two separate positions, but I am having trouble doing so.

Any suggestions?

sentences:
Problem with Unity APK Build : Default Activity (Android) There was a project developed in Unity 4.5. I successfully updated it to Unity 2018.2.3f1 version without any error. Runs perfectly in Editor.
When I create an APK (internal). I just get this screen when I open it on a mobile.

But when I make a Windows/Mac Build, it runs perfectly.
I've also tried on another Editor (version 2017.3.x) and APK built from this is also good.
I've re-installed Unity, nothing... Also updated the SDK but still a problem.

Some other projects' APK is built successfully with the scenes and everything but they also have some strange problems.
Note: I cannot shift back to 2017.3.x.
Is it a problem the latest Editor? OR Is it a problem with my machine?
What possibly could that be?

sentences:
How To Find Out Which Package That Asset Belongs To? I have just messed up my project with some conflicting plugins, so i need to clean all plugins and reimport them, but i can't make sure which files to delete.

So how can i find out which package an asset belongs to?

Thanks in advance.

sentences:
How to animate objects in Unity 3D Yesterday I played around with Unity 4.6 and I came up with a question about animation.

I have an fps-survival project (most for educational purpose).

I use the default build-in fps camera controller that comes with unity asset and adding a script for head-mob.

Now I animate a "falling" animation. The animation is in the  First Person Controller object. Although I have two "arms" as children in my FPS controller, I want in each frame of my animation to move the arms but when I click in the each arm , the animation window don't show me the correct state of the animation, and I need to get back to where I attach my animation to show again. I don't know what to do. I can't animate the hands in seperate file cause I don't see the falling frame from the FPS controller.(which is more a visual than a technical problem)I want to point out that I need to use both my hand objects and I am preety novice so if you could tell me in steps what to do.

I attach some images bellow to see how my enviroment is setted up.

When I select the FPS controller

After I select each hand

sentences:
Transition from UIView to CCScene in Cocos2D I've surfed the internet for quite some time but haven't come to find an answer.
Any help would be greatly appreciated.
I am trying to perform a transition from a UIView to a CCScene
So i have a class which is connected to a .xib file.
I am able to present that scene using

  [[CCDirector sharedDirector]replaceScene:[LevelSelect scene]
  withTransition:[CCTransition transitionCrossFadeWithDuration:1]];

But when i try to change to a CCScene which does not have a .xib file, it doesn't perform the transition, but plays the audio that is present in the next scene.

  [[CCDirector sharedDirector]replaceScene:[Play
  sceneWithDifficulty:1]];

Thanks.

sentences:
Is it possible to make a pseudo isometric game with phaser? If I use the isometric plugin for Phaser, I end up with something like the third case of the following picture:

I would like to create a world in pseudo isometric, with only one axis tilted. This would be the second case in the picture.

Is it possible to achieve that with Phaser? With or without the Isometric plugin? If Phaser can't handle it, is there an open-source/free alternative for this kind of setup?

sentences:
MonoGame creates a copy of song files in XNBs location I'm having a problem. I've been adding .wma files to the Content Pipeline app to be used as my game's background music. But today when I opened the solution/project/content/bin/music folder I spotted the following:

So am I forced to ship the .wma files with the actual XNBs when I distribute my game? No other asset gets copied like this so how do I prevent songs from being copied as well?

If I delete the .wma files manually then the next time I build the project they get automatically added again :/

sentences:
AABB Collision Detection: Why does the simple broadphase algorithm work better? Hi I am working on barrier detection.

I used this swept aabb algorithm http://www.gamedev.net/page/resources/_/technical/game-programming/swept-aabb-collision-detection-and-response-r3084.

It suggests two ways to detect collision.
1. broadphase: this is a shorter-algorithm which can only detect non-collision 100%.
2. In order to make sure that there is a collision, the more detailed swept aabb algorithm has to be executed right after the broadphase one.

Strangely the broadphase algorithm alone detects a barrier collision each and every time and the more precise one actually doesn't at all times.

What I do in my code is basically the following:
My object moves towards the barrier with a constand speed vx = direction * speed * delta (that's the amount it moves each frame). So positionx = positionx + (direction * speed * delta) each frame. The broadphase-collision is calculated each frame by using vx and vy.

Are there some rare cases where the broadphase can actually detect a collision like in this one I described? Thanks so much for your help

Thanks so much

sentences:
Cannot import an .svg into a Unity project I cannot import an .svg into a Unity project.

When I just move the .svg file into the Unity project Unity does not work with it and the only option Unity provides is to open the file (in my case it proposes me to open the .svg with Inkscape).

After performing a little bit of research I come to a conclusion that I need to have an SVG Package being installed into the Unity in order to import the .svg files.

But when I try to install the package I do not find it in the list of packages.

I am using a free Personal Edition of Unity. So, may it be that the option to import .svg is for paid version of Unity only?

Thank you.

Yes, it really seems that importing an .svg into Unity is only a paid feature. So, does anyone know about a way to import an .svg into Unity for free? For instance, are there other packages which help to accomplish this?

I do not see the needed package in the list of packages for preview:

sentences: Unity how to set Off mesh link speed How can I set agent's speed on off mesh link? I want it to look like a jump, but now it looks like it was in slow motion.

sentences:
Unity Inspector - Turn off script for a group? I have a large group of objects in Unity that can be grouped and for one instance I want to turn off a script on each one, for over 100 this can be tedious, can this be done group wise within the inspector? Instead of me going into each one and manually turning a script off?

I have tried doing this within a script but it will not work for this situation.

sentences:
Quaternions, Axis Angles and Rotation Matrices. Which of these should I use for FP Camera? After 2 weeks of reading many math formulas and such I know what is a Quaternion, an Axis Angles and Matrices. I have made my own math libary (Java) to use on my game (LWJGL). But I'm really confused about all this.

I want to have a 3D first person camera. The move (translation) is working fine but the rotation isnt working like I need. I need a camera to rotate arround world Axis and not about its own axis. But even using Quaternions, this doesnt work and no matter how much I read about Euler Angles, everybody says to me dont touch on it!

This is a little piece of code that i'm using to make the rotation:

    Quaternion qPitch = Quaternion.createFromAxis(cameraRotate.x, 1.0f, 0.0f, 0.0f);
    Quaternion qYaw = Quaternion.createFromAxis(cameraRotate.y, 0.0f, 1.0f, 0.0f);

    this.multiplicate(qPitch.toMatrix4f().toArray());
    this.multiplicate(qYaw.toMatrix4f().toArray());

Where this is a Matrix4f view matrix and cameraRotate is a Vector3f that just handle the angles to rotate obtained from mouse move. So I think I'm doing everything right:

Translate the view Matrix
Rotate the Move Matrix

So, after reading all this, I just want to know: To obtain a correct first person camera rotate, I must need to use Quaternios to make the rotations, but how to rotate around world axis?

EDIT:

OK, i'm following @Sean Middleditch solution and this should be good, but I think i've missed something...here is the code:

public Matrix4f getView() {
    if (!viewChanged) return viewMatrix;
    if (position == null) position = Vector3f.createEmpty();
    if (rotation == null) rotation = Vector3f.createEmpty();

    viewMatrix = Matrix4f.createIdentity();
    viewMatrix.rotate(rotation);

    Vector4f forward = Vector4f.multiplicate(viewMatrix, new Vector4f(0, 0, -1, 0));
    Vector4f up = Vector4f.multiplicate(viewMatrix, new Vector4f(0, 1, 0, 0));
    Vector4f right = Vector3f.cross(forward.toVector3f(), up.toVector3f()).toVector4f();

    viewMatrix = new Matrix4f(new float[]{
            right.x,                                        up.x,                                       -forward.x,                                     0,
            right.y,                                        up.y,                                       -forward.y,                                     0,
            right.z,                                        up.z,                                       -forward.z,                                     0,
            -Vector4f.dot(right, position.toVector4f()),    -Vector4f.dot(up, position.toVector4f()),   -Vector4f.dot(forward, position.toVector4f()),  1
    });

    setViewChanged(false);
    return viewMatrix;
}

Everything seems to be right, but the "Camera" is rotating now over the origin axis...and I think the problem is because I didnt understand the following:

  construct a regular rotation matrix, and then multiply the standard
  camera vectors by that matrix

Thanks for reading it.

Best regards,

Afonso Lage

sentences:
Any way to merge plugins in RPG maker XP? So I'm trying to merge together 2 mods into one game. One is Tankentai's SBS and the other is Cocoa's UMS.

I'm trying to merge the 2 into one game that includes the battle system from SBS, but the text boxes and whatnot from UMS. Is there any easy way to do this other than combing through all the script lines and copying them one at a time? I've tried to use this but it doesn't seem to do quite what I need it to do.

sentences: What's the minimum viable product to present a game to a publisher? I am currently working on a puzzle game. I am aiming in the future to ask a publisher to publish it. What do you think could be the minimum viable product to reach before sending it. I am talking about the completeness of the work (number of levels, graphic details etc)

sentences:
Creating A Selectable Object in SDL/C++ I'm trying to create a clickable object. I wrote a pseudo code to try it. When I add a new member to object it works fine, that is when I hold the mouse cursor on the rectangle determined it returns true even it's moved around. But once the rectangle moves out of the visible area and returns back to the visible area, the if statement  return false when I hold the cursor on the rectangle determined(I'm using an int variable for camera effect.). I'm using SDL 2.0.3.

This is the loop:

multiset<IDrawable*, Drawable_compare> objects;

for(auto i = objects.begin(); i != objects.end(); ++i)
{
  if((*i)->Collision(*MouseX, *MouseY) == true)
  {
    (*i)->Update();
    cout<<"true"<<endl;
  }
  else
  {
    cout<<"false"<<endl;
  }
}

These are the base and derived classes:

class IDrawable
{
public:
  IDrawable();
  virtual ~IDrawable(void) = 0;

  virtual bool Collision(int Mouse_X, int Mouse_Y) = 0;
};

.

class Object1: public IDrawable
{
public:

  Sprite *Object1 = new Sprite(
    sdl_set->GetRenderer(),
    "data/Trees/Tree1.png",
    X_pos, Y_pos,
    100, 200,
    CamX, CamY,
    SelectionRect(0, 0, 100, 200) );

  bool Collision(int Mouse_X, int Mouse_Y)
  {
    return (Object1->MouseOver(&Mouse_X, &Mouse_Y));
  }
};

This is the sprite class:

class Sprite
{
public:

  void CSprite::Update()
  {
    SelectionRectangle.SetX(rect1.x + *CamX);
    SelectionRectangle.SetY(rect1.y + *CamY);
  }

  bool CSprite::MouseOver(int *MouseX, int *MouseY)
  {
    return !(
       ( (SelectionRectangle.GetRectangle().x + SelectionRectangle.GetRectangle().w )
          < *MouseX )
    || ( *MouseX < SelectionRectangle.GetRectangle().x )
    || ( ( SelectionRectangle.GetRectangle().y + SelectionRectangle.GetRectangle().h )
          < *MouseY )
    || ( *MouseY < SelectionRectangle.GetRectangle().y) );
  }
};

This is the class to determine a selectable area:

class SelectionRect
{
public:

  SelectionRect(int x, int y, int w, int h);
  ~SelectionRect(void);

  SDL_Rect GetRectangle() { return SelectRect; }

  void SetX(int x) { SelectRect.x = x + OffsetX; }
  void SetY(int y) { SelectRect.y = y + OffsetY; }

  void SelectionRect::SetRectangle(int x, int y, int w, int h);

};

What might be causing this? How can I correct my code?

Thanks.

Edit : I did some trial and error work and found out that when I use the alternative MouseOver() function no problem occurs. What do you think the reason is?

My Draw() function for objects:

void CSprite::Draw()
{
    Camera1.x = rect1.x + *CamX;
    Camera1.y = rect1.y + *CamY;

    SDL_RenderCopy(renderer,image, NULL, &Camera1);

}

Alternative MouseOver function:

bool CSprite::MouseOver(int *MouseX, int *MouseY)
{
        cout<<"Called"<<endl;

        return !(Camera1.x + Camera1.w < *MouseX || *MouseX < Camera1.x || Camera1.y + Camera1.h < *MouseY || *MouseY < Camera1.y);
    }

sentences:
Should I use Panels or Frames? Hi I am creating my first game in NetBeans using Java, the game is going to be an RPG that will look a bit look Undertale on the surface in that there will be a menu, then a load game section and then will go onto a world where you can walk around.

I've used a JFrame and then a JPanel on top of that to contain the initial menu screen. Should I use another JPanel over the menu screen when I press load game or new game to go to those screens, or should I make a new JFrame altogether?

If you think like how Minecraft has a load game button which sends you to a screen that shows you all the games you can load up, would that be a new JPanel or a new JFrame?

sentences:
How to have qt5 work on desktop like on mobile devices (es2, correct glsl version)? I am looking for help/information concerning this issue :

My work: I have an opengl es2 render engine that works on an iOS app. I almost managed to make it work by calling the same openGL rendering engine from a Qt(4.8 first, then 5.0 since today) app with a QGLWidget. To support es2 function set my widget also inherits QGLFunctions (QtOpenGLFunctions with qt 5.0.0).

However I still have issues with shaders : I could not compile them on qt with glCompileShader because of almost every keywords (lowp, vec4, vec2 …) were returning compilations errors. So I compiled it with QOpenGLShader program, but I had to specify “#version 120”, the closest to es2. But still, my sprites don’t show up the right size and the only potentially influencing different pieces of code with iOS are in shader compilation / version. I think the issue in the shader is that gl_PointSize is not taken into account.

Is there any better way for me to have shaders compiled on qt like they are on iOS ? ( I know glsl es2 version is coming from version 120 but I don’t know to what extent they differ ).
The hello-gl-es2 example did not help me because glsl version also returns 1.20.

I’ll happily receive any hints, thank you !

My shaders, working well on iOS but not on Qt:

const GLchar vShaderStr[] =
#ifdef  __BUILD_DESKTOP__
"#version 120\n" // necessary for Qt to compile shaders
#endif //__BUILD_DESKTOP__
"attribute lowp vec4 Position;\n"
"attribute mediump vec2 TextureCoord;\n"
"attribute lowp float Weight;\n"
"uniform mat4 MVP;\n"
"varying mediump vec2 TextureCoordOut;\n"
"void main(void)\n"
"{\n"
"  gl_Position = MVP * Position;\n"
"  TextureCoordOut = TextureCoord;\n"
"  gl_PointSize = Weight;\n"
"}\n";

const GLchar fShaderStr[] =
#ifdef  __BUILD_DESKTOP__
"#version 120\n" // necessary for Qt to compile shaders
#endif //__BUILD_DESKTOP__
"varying mediump vec2 TextureCoordOut;\n"
"uniform sampler2D Sampler;\n"
"uniform bool IsSprite;\n"
"uniform lowp vec3 TextureColor;\n"
"uniform lowp float Opacity;\n"
"void main(void)\n"
"{\n"
"   lowp vec4 textureColorResult;\n"
"   textureColorResult = texture2D(Sampler,  IsSprite ? gl_PointCoord : TextureCoordOut);\n"
"   gl_FragColor = IsSprite ? vec4(mix(textureColorResult.rgb,TextureColor, 1.0),\n"
"                    textureColorResult.a * Opacity) : textureColorResult;\n"
"}\n";

Edit : replaced preprocessor QT_OPENGL_LIB with custom BUILD_DESKTOP as the first is no more declared in qt5.

sentences:
Doom 3 codebase release details Does anyone know when the source code for Doom 3 is to be released?
I've heard a lot of things but nothing conclusive.

Thanks
Adam

Edit any info is appreciated

sentences:
Repeated nested game objects (UnityEngine.GameObject.gameObject) I created a UnityEngine.GameObject and inspect its properties while in debug mode.

GameObject obj = new GameObject();

When I inspect the object, it has a property hierarchy similar to:

active:true
activeInHierarchy:true
..
gameObject:New Game Object (UnityEngine.GameObject)
    active:true
    activeInHierarchy:true
    ..
    gameObject:New Game Object (UnityEngine.GameObject)
      active:true
      activeInHierarchy:true
      ..
      gameObject:New Game Object (UnityEngine.GameObject)

If I execute, something like, in a debugger console:

new UnityEngine.GameObject().gameObject.gameObject.gameObject;

it would still return the same New Game Object.

Is the problem in my debugger or Unity? I'm using Unity 2018.4.11f1.

sentences: Can both High poly model go with a low poly scene? I'm in the process of developing a game, and I've found a model that would go perfectly for the character. However, the scentre I already have is low poly and I can't find a good enough high poly to go with it. So tell me whether or not I should I should carry on with the art I have or find a low poly model.

sentences:
Where do I store strings? What's an efficient way of loading them? I'm making a top-down RPG for iPhone. I'm using tilemaps (CCTMXTileMap) and the cocos2d-iphone engine.

I've made a class that can handle loading maps and NPCs onto the screen, a class that handles input, and, a class that is supposed to display dialog. The dialog class takes a single string, or an array, and displays it onscreen inside a neat dialog box, hiding the controls until the user taps on the screen, when it cycles to the next message, or if it's the last/only message, hides the dialog.

My NPCs are currently stored in Core Data. Their strings will need to be updated based on quest progress. Also, there are other bits of dialog, like signposts and other messages.

So, where do I put my game's textual content? I don't think Core Data is the right place, because of three reasons:

If my strings are stored in Core Data, I will probably have a harder time translating them.
If my strings are in Core Data, that only leaves me with strings for NPCs (which would be attached to the NPCs in Core Data). Where does that leave everything else?
If I leave my strings in Core Data, it's a bit heavy on the loading operations, no?

Given all of this background information, where do I put my strings and dialog in my game?

tl;dr

What's an efficient way to store strings for an iOS game so that they can be easily accessed, translated and referenced at various parts of the game?

sentences:
Why does duplicating my object cause its vertex animation shader to distort it? I used a vertex shader (based on this example) to animate a flag waving. When I have a single flag in my scene, it works correctly.

When I duplicate the flag, all of the copies become wildly distorted after I hit play.

Here is the shader code I'm using:

Shader "Custom/Flag" {
    Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Speed ("Speed", Range(0, 5.0)) = 1
        _Frequency ("Frequency", Range(0, 1.3)) = 1
        _Amplitude ("Amplitude", Range(0, 5.0)) = 1
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Cull off

        Pass {

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            sampler2D _MainTex;
            float4 _MainTex_ST;

            struct v2f {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0;
            };

            float _Speed;
            float _Frequency;
            float _Amplitude;

            v2f vert(appdata_base v)
            {
                v2f o;
                v.vertex.y +=  cos((v.vertex.x + _Time.y * _Speed) * _Frequency) * _Amplitude * (v.vertex.x - 5);
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                return tex2D(_MainTex, i.uv);
            }

            ENDCG

        }
    }
    FallBack "Diffuse"
}

How can I make this work with multiple flags using the same material?

Should I use a new material instance for each object like this? It doesn't seem optimal:

    material = new Material (Shader); // Create new material
    material.SetFloat ("_Speed", _Speed);
    material.SetFloat ("_Frequency", _Frequency);
    material.SetFloat ("_Amplitude", _Amplitude);
    material.SetTexture ("_MainTex", _MainTex);
    flagObj.GetComponent<MeshRenderer>().sharedMaterial = material; // Set values

sentences:
Animate/Interpolate and wait for completion. I'm implementing a blackjack game in flash and so far the logic is fine but there is no animation for the cards so they just appear and disappear which doesn't look very pleasing to the eye. I want to add some animations for when cards are dealt where they slide across to their position one by one.

Is there a simple way to just tell a displayobject to interpolate from one position to another while waiting for it to complete?

My current thought would be to just do something like this:

on enter frame:
   if a card is animating:
      move it further towards its destination;
      continue;
   else (if it is done animating):
      process as usual;
   end;
end;

I believe this would produce the results I'd expect because the game should only continue after the card being dealt is where it should be. However, this feels like a weird approach and I'm probably over thinking it which is why I'd like to know if any of you have a better solution.

sentences: Converting a hipoly model to a lowpoly model I have a model with more than 500.000 polygons and I want to speed up the drawing process in my game. So I decided to use a lowpoly model and normal mapping, but found no software to get a lowpoly model from my hipoly model. Does anyone have an idea how to do this?

sentences:
Box2d collision on isometric maps built in Tiled I am trying to add Box2d collision to a map I created in Tiled http://www.mapeditor.org/

It all worked when I was creating standard othergraphic maps but now I have changed to isometric the objects layer (Where I am creating the bodies for box2d) no longer match the rendering from the IsometricTiledMapRenderer.

I created the collision using the MapBodyBuilder class (written by someone else much smarter) Code below:

public class MapBodyBuilder {

// The pixels per tile. If your tiles are 16x16, this is set to 16f
private static float ppt = 0;
public static Array<Body> bodies;

public static Array<Body> buildShapes(Map map, float pixels, World world) {
    ppt = pixels;

    MapObjects objects = map.getLayers().get("Obstacles").getObjects();

    bodies = new Array<Body>();

    for(MapObject object : objects) {

        if (object instanceof TextureMapObject) {
            continue;
        }

        Shape shape;

        if (object instanceof RectangleMapObject) {
            shape = getRectangle((RectangleMapObject)object);
        }
        else if (object instanceof PolygonMapObject) {
            shape = getPolygon((PolygonMapObject)object);
        }
        else if (object instanceof PolylineMapObject) {
            shape = getPolyline((PolylineMapObject)object);
        }
        else if (object instanceof CircleMapObject) {
            shape = getCircle((CircleMapObject)object);
        }
        else {
            continue;
        }

        BodyDef bd = new BodyDef();
        bd.type = BodyDef.BodyType.StaticBody;
        Body body = world.createBody(bd);
        body.createFixture(shape, 1);

        bodies.add(body);

        shape.dispose();
    }
    return bodies;
}

private static PolygonShape getRectangle(RectangleMapObject rectangleObject) {
    Rectangle rectangle = rectangleObject.getRectangle();
    PolygonShape polygon = new PolygonShape();
    Vector2 size = new Vector2((rectangle.x + rectangle.width * 0.5f) / ppt,
            (rectangle.y + rectangle.height * 0.5f ) / ppt);
    polygon.setAsBox(rectangle.width * 0.5f / ppt,
            rectangle.height * 0.5f / ppt,
            size,
            0.0f);
    return polygon;
}

private static CircleShape getCircle(CircleMapObject circleObject) {
    Circle circle = circleObject.getCircle();
    CircleShape circleShape = new CircleShape();
    circleShape.setRadius(circle.radius / ppt);
    circleShape.setPosition(new Vector2(circle.x / ppt, circle.y / ppt));
    return circleShape;
}

private static PolygonShape getPolygon(PolygonMapObject polygonObject) {
    PolygonShape polygon = new PolygonShape();
    float[] vertices = polygonObject.getPolygon().getTransformedVertices();

    float[] worldVertices = new float[vertices.length];

    for (int i = 0; i < vertices.length; ++i) {
        System.out.println(vertices[i]);
        worldVertices[i] = vertices[i] / ppt;
    }

    polygon.set(worldVertices);
    return polygon;
}

private static ChainShape getPolyline(PolylineMapObject polylineObject) {
    float[] vertices = polylineObject.getPolyline().getTransformedVertices();
    Vector2[] worldVertices = new Vector2[vertices.length / 2];

    for (int i = 0; i < vertices.length / 2; ++i) {
        worldVertices[i] = new Vector2();
        worldVertices[i].x = vertices[i * 2] / ppt;
        worldVertices[i].y = vertices[i * 2 + 1] / ppt;
    }

    ChainShape chain = new ChainShape();
    chain.createChain(worldVertices);
    return chain;
}

}

Any help would be greatly appreciated.

Thanks

pps I know this has been asked before generate box2d bodies from isometric tiled map

But I cannot find an answer.

sentences:
How to create an API for event-based, modular Java game? I don't really know how to explain what I am trying to do that well, but yeah I'll try my best.

I'm currently creating a game with LWJGL 3, and I hope to make it event based and rather abstract as to allow the game to be hopefully easily moddable by community members through their own .jar files. To give them the ability to modify the current functions of the game, I want to make the game event based so they can listen to events and modify them or cancel them completely before my function executes, and provide a way for them to create their own structures, entities, events, artifacts(items), et cetera. I just cannot wrap my head around how to do this exactly, at least with creating the API.

I spent a lot of time researching and I just came up with allowing modules through Unity or with Lua, but that's not what I am looking for. So, what is the best way to set up an API like this? Do I create interfaces for all of my own events, entities, items, and things or do I just create base interfaces which I implement in my own classes? Then however I do this, what do I actually provide for them to create their mod/module? My whole game or just these interfaces. I just cannot figure out a good way to set up the API especially since I've never created one myself, let alone for a game.

sentences:
Need some advice on designing components So after reading about components for a bit I want to make a very simple spaceshooter game that uses components and systems. However, I'm a bit confused on how much scope each component should have. For example, let's say the game had asteroids that fly around and if you hit them, you take damage. They also have health. The asteroid entity may then contain these components:

SpriteComponent (Texture2D texture)
HealthComponent (int amount)
CollidableComponent (bool rigid)
MovementComponent (int x, int y)
RotationComponent (int degrees)

Now let's say we had a RenderSystem. Its Update() method would require SpriteComponent, MovementComponent, and RotationComponent to draw an entity.

That's all fine and good but when would have MovementComponent and not RotationComponent? Couldn't we just have a TransformComponent that contains the x, y, and rotation? It feels a little weird designing these components to only be a container of one data-type. But then where do you draw the line? All sprites also have a position and rotation amount, so should the SpriteComponent contain the TransformComponent, or should the members of TransformComponent be moved to SpriteComponent?

But then the problem is if you wanted an entity with a position and rotation but no sprite. Then you either have to give it an empty texture (not necessarily a bad solution) or maintain TransformComponent and just make SpriteComponent contain it as well (or just pass both).

There's a lot of decisions to be made and I really feel similar to when I began object-oriented programming. "What should be objects? What should its methods be? Should this be public or private?" Obviously I've figured all that out now but this new component-based paradigm is giving me these same problems now. Does anyone have any advice or standards for component-based design for typically used components and how one normally would set something like this up?

sentences:
Raycasting from 3D object to UI canvas! I have a world space canvas in front of the player and I want to shoot a ray towards an enemy (in the direction of the enemy) and create and object where Raycast hits the UI canvas.
I know that the physics engine doesn't interact with UI elements and event system is not the answer for me since it depends on pointer events and their position.
So how can I do this?
If possible, I would like to draw the ray or the line as gizmo to see if it's working.
My Current Code is this:

void OnDrawGizmos()
{
    foreach (AeroplaneAiControl item in GameObject.FindObjectsOfType<AeroplaneAiControl>())
    {
        Gizmos.color = Color.magenta;
        Gizmos.DrawLine(transform.position, item.transform.position);
        Vector3 Direction = transform.position - item.transform.position;
        RaycastHit rch;
        Ray r = new Ray(transform.position, Direction);
        Physics.Raycast(r, out rch);
        if (rch.collider != null)
        {
            Gizmos.color = Color.cyan;
            Gizmos.DrawLine(transform.position, rch.point);
            Gizmos.DrawSphere(rch.point, 0.1f);
        }
    }
}

it draws the magenta line but not the cyan line and no spheres.

sentences:
Recommend a way to draw thousands of particles (liquid) per frame in Unity3d I'm writing a plugin for this library for Unity3d.
I have it working and now I am looking for an efficient way to draw the particles.
My 1st test just uses sprites and runs fine on my laptop but I doubt it will be so good on a mobile device.

Is there a cheap way of simply drawing lots of particles to the screen each frame?
The library generates an array of all the particle positions which updates in FixedUpdate() so I can just draw everything in that array each frame.

I'm thinking maybe somehting in the Graphics namespace would handy here, like maybe Graphics.DrawTexture

Also I might consider doing some kind of metaballs like pass over the particles to make them look more liquid like.

sentences:
C++:Segmentation fault (core dumped) while creating gameobject i made a small code to debug and i get this error

player inherit from gameobject

code

///main
#include "game.h"

 gameobject* pla;

int main()
{

    std::vector<gameobject*> objects;

    gameobject* pla = new player(32,32);  -----> error is here

    objects.push_back(pla);
    cout<<objects[0]->numberID<<endl;
    return 0;
}

/// gameobject
pragma once

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "game.h"

class gameobject
{

    public:

        virtual ~gameobject(){};
        virtual void init()=0;
        virtual void tick()=0;
        virtual void render(SDL_Renderer* ren)=0;
        virtual void destroy()=0;
        virtual void setVelx(int velx)=0;
        virtual void setVely(int vely)=0;

        int numberID=0;

    protected:

        int width = pos.w;
        int height = pos.h;
        int posx = pos.x;
        int posy = pos.y;

        float velox;
        float veloy;

        SDL_Rect crop;
        SDL_Rect pos;

        SDL_Texture* tex;

////player.h

#pragma once

#include "gameobject.h"

class gameobject;

class player : public gameobject
{

public:

    void init() override;
    void tick() override;
    void render(SDL_Renderer* ren) override;
   // SDL_Renderer* renderer;
    player(int pwidth,int pheight);

    void destroy() override{
        this->~player();
    }

    void setVelx(int velx) override;
    void setVely(int vely) override;

    int i = 0;

private:

    ~player() override;

};

/// player.cpp

#include "player.h"

player::player(int pwidth, int pheight)
{

    this->pos.w = pwidth; //width
    this->pos.h = pheight; // height
    this->pos.x = 100; //posx
    this->pos.y = 100; //posy

    // cout<<"yes iam ren : "<<ren<<endl;

    this->numberID = gameobject::numberID;

    gameobject::numberID++;
    //this->tex = IMG_LoadTexture(ren,"/home/younlok/Desktop/dash/res/pss.png");
    this->tex = game::textures[0];
    crop.x = 0;
    crop.y = 0;
    crop.w = 32;
    crop.h = 32;

    //game::hand->addObject(this);

}

void player::init()
{
}

void player::tick()
{

    this->pos.x += this->velox;
    this->pos.y += this->veloy;

}

void player::render(SDL_Renderer* ren)
{

 SDL_RenderCopy(ren,tex,&crop,&pos);

}

void player::setVelx(int velx)
{
    this->velox = velx;
}

void player::setVely(int vely)
{
    this->veloy = vely;
}

player::~player(){}

sentences:
How would you design a transformation matrix to project absolute coordinates to any orthographic projection desired? I am attempting to make an RTS based on AoE II HD Edition. I want to have ease of control by designing a transformation matrix given any style of projection I want.
This is a good example of what I mean. So, given each of those three angles, and any absolute x, y, and z, how can I design a transformation matrix to multiply the absolute position by to get the projected position on the screen? I just want full control, and I need to get better at matrices. I am about to graduate High School but I hardly learned anything related to matrices. Only a little in Physics and a little in Algebra II with Trig.

I just need to know how to create the matrix.

Also, after that, how would I convert a projected matrix back to the original position? Dividing it (Although, I know matrices can't divide - I mean multiply by the inverse)? Thanks so much for any help!

sentences:
Transferring my OpenGL PC game to PS4 and/or XBox One I want to transfer my OpenGL PC game to consoles, PS4 and/or XBox One.

It's a complex application, where many calculations (incl. fast fourier transformations) via FBOs and Transformfeedback are performed within OpenGL. What is the best way to bring it to the PS4?

Or is it easier to implement the game in an engine like Unity or Unreal. As far as I know they have console support? An advantage would be that we could offer our methods as plugin/asset. We are planning to do this too.

There are a lot of glsl-shaders and OpenGL-Api-Calls. Is it possible at all to "translate" that into an engine like unreal? Or would we have to use the engines "predefined" rendnering mechanisms? We basically need shaders operating on floating point textures, changing render targets frequently and transform feedback if possible. We also need low level acces to shading attributes like changing pointsize in the vertex shader etc.

And I really would like to know which is less work. I could image that it is possible to absctract all the Api-Calls in classes/functions and then where first all the OpenGL-calls are implemted and then we would do an implemetation for the console api. Is this realistic on the PS4 Api?

I know that Direct X will have a different design and therefore abstraction itself won't be enough. I believe porting to an engine might be even more work as you have to respect its structures.

sentences:
Find nearby users by real world location in Unity I am looking to add a feature to my mobile game (IOS and Android) to let users connect to trade with users nearby in a certain radius based on the real world geolocation. Whats the best approach to find nearby users who are also running the game right now?

I have looked into using bluetooth using assets such as this: https://forum.unity.com/threads/android-bluetooth-multiplayer.188667/ but it seems like there is nothing for bluetooth multiplayer between android and IOS.

There is plenty of AR tools like this one: https://cloud.google.com/maps-platform/gaming however non seem to have the feature I am looking for.

Or perhaps if there is no existing solution for this. I have to share and compare player locations via a game server. However I have no idea what my first steps would be for that.

sentences:
Passing an OpenGL texture ID loaded in NDK back to java Is it possible to load a texture using the NDK, but pass the result back to use in java.

I have used the code in the link above and it appears to load the png correctly and generates a texture ID without an error (the id is 0 before the loading function is called and non-zero afterwards).

Is it not allowed to mix opengl operations between C++ and java?

Thanks for your help
All the best,
Ash

sentences:
When storing voxels in chunks, how do I access them at the world level? I'm not looking for how to store the voxels, data wise; I'm looking for the theory. Currently, my voxel engine has no global list of tiles. Each chunk has its own list, and its "hard to do things" like collision detection or anything that may use tiles that are outside of its own chunk. I want to start using height maps, but I have a problem. If each chunk has its own list, then it will be pretty difficult to implement the height maps.

Should I store a global list of voxels, independent of the chunks? Then, I can just easily perform collision detection and terrain generation. However, it would probably be harder to do things such as frustum culling.

So how should I store voxels?

sentences:
Transforming a primitive tetrahedron into a primitive icosahedron? I've created a tetrahedron by creating a BoundingBox and building the faces of the tetrahedron within the bounding box as follows (see image as well):

VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[12];
BoundingBox box = new BoundingBox(new Vector3(-1f, 1f, 1f), new Vector3(1f, -1f, -1f));

vertices[0].Position = box.GetCorners()[0];
vertices[1].Position = box.GetCorners()[2];
vertices[2].Position = box.GetCorners()[7];

vertices[3].Position = box.GetCorners()[0];
vertices[4].Position = box.GetCorners()[5];
vertices[5].Position = box.GetCorners()[2];

vertices[6].Position = box.GetCorners()[5];
vertices[7].Position = box.GetCorners()[7];
vertices[8].Position = box.GetCorners()[2];

vertices[9].Position = box.GetCorners()[5];
vertices[10].Position = box.GetCorners()[0];
vertices[11].Position = box.GetCorners()[7];

What would I then have to do to transform this tetrahedron into an icosahedron? Similar to this image:

I understand the concept but applying it is another thing entirely for me.

And to clarify, I'm not wanting an animation, I simply want to create an icosahedron from the vertices of a tetrahedron.

EDIT: So I now have an alternative way to create an icosahedron using golden rectangles. That's fine for the purposes of my particular project. However, I'd like to leave the question open for solutions to the original problem, i.e. mathematically converting a tetrahedron in Cartesian co-ords into an icosahedron (not vice-versa).

sentences:
Is a separate thread for game loop compulsory for simple games? I am new to game development. In order to learn I am recreating this game on android platform. You can observe the game-play video at the above link. It is a simple game.

I have read a lot of articles on getting started with game development.Almost all of them recommended using a game loop on separate thread, which makes sense for other games. However, for this particular game do I need to start a separate thread ?

sentences:
Deleting faces or triangles from an object by material on load scene I have objects that have multiple materials imported from blender as a .FBX.

I'd like to find the objects where materials are used, and destroy faces when a certain material name is used ("!null", in my case).

I know this is not the correct way to work. Normally I should delete the faces in Blender, but as I am building quite complex geometry using faces that I need in Blender but don't want the Unity engine to render, it seems the only way to go.

I tried "cutout", but although they are invisible, it does not make any difference in rendering times.

Is this at all possible? If it is, how do I do it?

sentences:
Unity built app crashes when using particle system I have scenes with some basic flame effect. Its max particle count is 20 and there are not more than 4-5 instances active on the screen at once. I even checked the profiler but the memory usage was around 150 MB maximum.

Given these, all runs fine in the editor but once the particles become visible, the game crashes every time. I tested this on a virtual Nexus tablet.
I'm using Unity 2017.1.0p4. If anyone has encountered an issue like this, I'd appreciate any help to get around this.

EDIT: the built game crashes on PC as well (made a final build for PC, using the same PC).

EDIT2:

So I was able to trace the issue back to the few following lines:

var mf = transform.parent.gameObject.GetComponentFromParentRecursive<MeshFilter>();

if (mf != null && mf.mesh != null)
{
    var sh2 = system.shape;
    sh2.mesh = mf.mesh;
    return;
}

public static class GetComponentRecursive
{
    /// <summary>
    /// Returns the first Component (T) found on the parent or its children
    /// = the gameobjects on the same level as this is called on.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="g"></param>
    /// <returns></returns>
    public static T GetComponentFromParentRecursive<T>(this GameObject g)
        where T : Component
    {
        if(g.transform.parent.GetComponent<T>() != null)
        {
            return g.transform.parent.GetComponent<T>();
        }
        else
        {
            foreach (Transform c in g.transform.parent.transform)
            {
                if(c.GetComponent<T>() != null)
                {
                    return c.GetComponent<T>();
                }
            }
        }
        return null;
    }
}

Please bear in mind that GetComponentFromParentRecursive works, can use it for sprites, no harm done. When I comment out the first few lines, it doesn't crash(just lost functionality).

Any ideas why this might cause a crash? And only in built game?

sentences:
Combination of DLL/Plugins with Object/Components I worked on a personal game project (learning) for about the last year or so off and on in Ogre3D. Now that I am starting a new project, I want to avoid the Class Heirarchy for objects and having all of my libraries stuffed into one project file.

After a massive amount of reading, I am going to start implementing a Object/Components system tomorrow, mostly based off of what I have read on http://gameprogrammingpatterns.com/component.html but I want to have a better understanding before I proceed.

Ogre3D offers a Plugin system, which I understand to basically be the equivalent of a normal .dll library except it has install()/initialise()/uninstall()/etc methods, intended for registering factories.

So my confusion comes down to what would be best kept in a Plugin or DLL?

Most of what I read, people recommend putting wrappers for third party libraries into Plugins/DLLs so I am assuming I would want to have one for my Physics (Bullet) System, Audio (OpenAL) System, Input (OIS) System, and so on.

In that case, should I basically just strip the Managers out of my project, and move them to a Plugin/DLL? I am still quite confused on how I will actually go about implementing them into Components once they are moved, but I guess that will come with time.

sentences:
LibGdx TextButtonStyle Offset not working correctly I'm intending to give an animation to the TextButton by giving the pressedOffsetX and pressedOffsetY values:

TextButtonStyle buttonStyle = new TextButtonStyle();
buttonStyle.font = font25;
buttonStyle.fontColor = Color.WHITE;
buttonStyle.up = new TextureRegionDrawable(settingsAtlas.findRegion("achievements"));
buttonStyle.down = new TextureRegionDrawable(settingsAtlas.findRegion("achievements"));
buttonStyle.pressedOffsetX = 5;
buttonStyle.pressedOffsetY = -5;

And I created a button like this:

TextButton achievementsButton = new TextButton("ACHIEVEMENTS", buttonStyle);
achievementsButton.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
        // show achievements
    }
});

But when I click the button, only the text in it is animated. The button background stays in the same position. What might I be doing wrong here?

sentences:
Why are my click events being fired many times for every click? I am working on a game in unity where a user will click a button to gain coins and clicks over a lifetime of clicking the button but the code is making the clicks go up by a lot instead of just 1 each time it is clicked like here are the values returned the first 3 clicks
247 731 2111
anybody have an idea why it produces this behavior and how i can fix it?

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class GameManager : MonoBehaviour {
    public Button clicker;

    public Text coinsSec;
    public Text ltClicks;

    private float baseClick = 2;
    private float coins = 0;
    private float lifeTimeClicks = 0;
    private float coinsPerSec;

    private void Start(){
        UpdateTxt ();
    }

    private void Update(){
        UpdateTxt ();
        Clicker ();
    }

    private void Clicker(){
        clicker.onClick.AddListener (delegate {
            coins += baseClick;
            lifeTimeClicks++;
        });
    }

    private void UpdateTxt(){
        coinsSec.text = "Coins/s: ";
        ltClicks.text = "Lifetime Clicks: " + lifeTimeClicks.ToString ();
    }
}

sentences:
Stencil test doesn't work at all in Unity when I am using a custom shader I am using Unity 2019.3 and I have a custom shader A which contains the code

Stencil{
     Ref 5
     Comp Equal
     Pass Keep
}

And the other custom shader B contains the code

Stencil{
     Ref 5
     Comp Always
     Pass Replace
}

The stencil test can do the right thing only if I add Fallback "Diffuse" in B, otherwise, it's never working. And A has no code related to Fallback.

Since shader A is using for post processing and I did something like

    buffer.SetGlobalTexture(ShaderID._MainTex,source);
    buffer.SetRenderTarget(destination);
    buffer.DrawMesh(mesh,Matrix4x4.identity,material,0,pass);

The material uses shader A.

Does this cause the issue because before today, I never use the Fallback during stencil test.

PS. You can use this and scene named SSS as example. In that scene the shader named Unlit/PBR has this issue. If you delete Fallback "Diffuse in that shader, the post processing effect never works.

sentences:
Getting any type in Unity Inspector I am developing a SaveManager system for my games. Basicly what it should do is;

1) Gets the "ANY" user created Serializable class by Drag&Drop to inspector. (save data).

2) Writes that class to a file using either BinaryFormatter or XMLSerializer.

I want to be able to use it in my future games. So it should be save data class(type) independant (like serializers). I will use it like an asset, import the SaveManager, give serialized class as parameter, and let it do the rest. But as i said, it should be able to use any user created serialized class.

So the problem is, since that "serialized class" will be written by the user in the "game project" (not in the SaveManager project), and i don't have that "serialized" class type in my SaveManager project, i don't know how to make the SaveManager, reference the class from inspector.

So lets say i create this class in the game project (not in the SaveManager project)

[System.Serializable]
public class SaveData
{
    public string Name = "Name";
    public int Number = 5;
}

Now when i import the SaveManager project (asset) into my "game" project, i should be able to drag and drop the script to the SaveManager inspector and let it do the rest. Since BinaryFormatter works for every Serializable type, the name of the type is actually doesn't matter. I mean BinaryFormatter is type free as long as the type is serializable. I want to use that feature, and make the SaveManager type free too.

So in future if i want to use, say "MyNewSaveData" serialized class, "in an another game", i want to be able to drag and drop this to SaveManager inspector and let it do the rest.

Now the thing is, if i use

public object _SaveData;

in SaveManager script, unity inspector doesn't show it.

if i use

public Object _SaveData

it casts the user created type to an Object, and i lose the type i need.

I tried to use System.Type, but unity doesn't show it too.

Basicly what i want to do is, get "any" serialized class as reference. Like

public SerializedClass _SaveData;

or something like

public Script _SaveData;

That reference should accept "any" serialized class. Gets it's type, then casts it to that type.

When i use

public Object _SaveData

if i use _SaveData.GetType(), i get the type the "user created".
I have the type, in my hands, but i can't cast Object to that type. I don't know how to use that type for casting.

What ever i do, it either doesn't show up in inspector, or it casted to another type and i lose the data.

What should i do?

sentences:
Unity - Display array of Objects in inspector I have an array of ScritableObject's, which should only be displayed in the inspector if a boolean is true. How would I do this? With my current code, I get an error saying:

  Cannot implicitly convert type Tile to `Tile[]

This is my current code:

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

[CreateAssetMenu (fileName="Data", menuName="Tiles/Map", order=1)]
public class Tile : ScriptableObject {

    public ETile eTile;
    public Sprite sprite;

    [Space(5), Header("Variety")]
    public bool variety;

    [Range(0f, 1f)]
    public float varietyChance;
    public Tile[] varietyTiles; <---- This should be hidden if variety is true
}

public enum ETile {
    Water,
    Grass
}

[CustomEditor(typeof(Tile))]
public class MyScriptEditor : Editor {

    override public void OnInspectorGUI() {
        var tile = target as Tile;

        tile.variety = EditorGUILayout.Toggle("Hide Fields", tile.variety);

        if (tile.variety) {
            tile.varietyTiles = (Tile)EditorGUILayout.ObjectField("Tile", tile, typeof(Tile), allowSceneObjects: true);         }
        }
    }
}

sentences:
Getting the Ray position from View and Projection Matrix I'm having some trouble calculating the direction and position of the ray from my matrices. I have tried some things such as:

private Vec3 getPick(Mat4 projection, Mat4 view) {
     Mat4 inverseProject = projection.copy().inverse();
     Mat4 pick = inverseProject.mul(view.copy());
     Vec3 pos = new Vec3(pick.m10, pick.m11, pick.m12);
     return pos;
}

I am using custom math classes and I'm pretty sure they work. Also, would it be better to perform this math in my shader? For better performance etc..?

I contacted Notch (creator of Minecraft) on this issue and he told me  to inverse the view Matrix and multiply by the projection, then multiply by the mouse coordinates. I tried that, it didn't do much.

EDIT: Tried normalising the screen space. It seems to do the job except in negative directions. Plus its a little off.

Vec3 getPick(double w, double h, double ar) {
    double sx = ((Mouse.getX() / w / 2.0) - 1.0) * ar;
    double sw = 1.0 - (2 * ((h - Mouse.getY()) / h));

    Mat4 viewProjInv = view.copy().mul(projection).inverse();
    Vec3 mouseNormal = new Vec3(sx, sw, 1.0);
    Vec3 dir = viewProjInv.mul(mouseNormal);
    return dir.mul(1);
}

sentences:
LibGDX: Do I have to dispose a texture if I load it from AssetManager? AssetManager manager = new AssetManager();

manager.load("texture1", Texture.class);
manager.load("texture2", Texture.class);
manager.load("texture3", Texture.class);
//And so on...

And then I load it from another screen, do I still have to dispose it? Or manager does it when I call manager.clear?

sentences:
How can a system similar to Dwarf Fortress' legends mode be implemented? In Dwarf Fortress, nearly everything that happens during world generation is logged and viewable in legends mode. An XML file containing that information can be exported and loaded into a utility such as Legends Viewer which can show specific events, relationships between two recorded people, what kingdoms people belonged to, etc.

My naive approach would be to add each event associated with a person to a database with a unique ID then filtering using the ID in order to view the correct events. However, this approach seems to be inflexible and adds more dependencies and complexity to my project.

My second approach would be to store these events in a JSON file in order to be able to treat each individual as an object, although this approach will probably be either be too memory intensive and not scale well since I would have to load a large file into memory or be too slow since I would have to open and modify many files at a time.

Assume the game has a simple system where each individual is tracked by a name and a UUID, belongs to a kingdom, and has some type of relationship to other individuals. Events are tracked by recording the location, date, and individuals involved. What type of file, data structure, library, etc. is generally used for something like this that is efficient enough to store up to a million or so of these simple entries?

sentences:
How do I get my polygons to be lighted by either side? Okay, I am using Ogre3D and Gorilla(2D library for ogre3D) and I am making Gorilla::Screenrenderables in the open scene.

The problem that I am having is that when I make a light and have my SR(screenrenderable) near it, it does not light up unless the face of the SR is facing the light...

I am wondering if there is a way to maybe set the material or code(which would be harder) so the SR is lit up whether the vertices of the polygon are facing the light or not. I feel it is possible but the main obstacle is how I would go about doing this.

sentences:
Editing a new list of vector3's without changing the original list? (Unity) I just got Vectrosity for Unity and need to make a line of all the destinations for an object. Issue is that I need to use a single list of vector3's to create the line (as far as I'm aware).

I have a list of vector3's that is the objects queued destinations. I then need to insert the objects current location at index [0] in the list so that the first line point is at the objects location. Issue is that no matter how I try and accomplish this I'm still referencing the original destinations list, and inserting something at [0] on the list for the lines changes the original destinations list as well.

How do I go about creating a single List from a list of vector3's and an extra point without changing the original list that is being referenced? Do I need to clone it?

sentences:
Passing multiple colors to a pixel shader in DirectX I have a pixel shader that sets the output color based on the interaction of an input texture, sort of like:

if (case1)
{
    output.Color = float4(0, 0, 0, 0);
}
else if (case2)
{
    output.Color = float4(0.5f, 0, 0, 1);
}
...

There can be up to four cases, meaning that the output color will be one of four different input colors, but 90% of the time only one or two colors will be used.

An additional detail that may be important is that the shader has a constant buffer with a few values that can change up to per-frame. These values, and the colors, are selected out of a dictionary that is roughly like:

StyleID: 1
Color1: 0, 0, 0, 0
Color2: 0.5, 0, 0, 1
...two other colors...
Width: 0.8
...other properties...

There are around a thousand different styles to select from. My question is: what's the best way of passing these values to the shader, and why? There are two designs that occur to me offhand.

On the CPU side, the current style is looked up in the dictionary. It assigns the various properties to members of the cbuffer, including however many colors associated with that style (1 to 4). The shader uses these values.
During initialization, the the entire style dictionary is built in to a separate, large constant buffer, something like:

.

cbuffer Styles
{
    float4 Color1[n];
    float4 Color2[n];
    float1 Width[n];
}

Where n is the number of different styles. Then the CPU just pushes the style ID to a different buffer variable (or perhaps to the unused color semantic), and the shader resolves the colors and properties to used based on this.

I'm using shader model 4.0 level 9_3.

sentences:
In PHP, how do I implement multiplayer "rooms" for a turn-based game? I'm working on a multiplayer checkers game. I want to let players choose another connected player and invite him to play. I have a working game engine and rendering, but I'm stuck on the multiplayer part.

This is specifically a web-based game.

How can I know whether a player is connected?
How can I detect when a player closes the browser, and set them to disconnected?
When a player sends an invitation to another, how do I let the first player know whether the other accepted?
How do I connect 2 players on a same game and send their moves to each other?

sentences:
What defines a AAA game? I tried to find a precise definition. I found clues on Wikipedia and on Gaming SE, but I cannot find more than an approximation like:

  Equivalent of blockbuster movie in cinema, an AAA game is a game with highest development budgets and levels of promotion.

The definition seems imprecise. How can I be sure a game is AAA?

Let's imagine a small indie studio making games and growing up. They hire more and more people through the years and invest more and more money in their game. At which milestone would their game be considered as AAA?

sentences:
Hardware instancing for voxel engine i just did the tutorial on Hardware Instancing from this source: http://www.float4x4.net/index.php/2011/07/hardware-instancing-for-pc-in-xna-4-with-textures/. Somewhere between 900.000 and 1.000.000 draw calls for the cube i get this error "XNA Framework HiDef profile supports a maximum VertexBuffer size of 67108863." while still running smoothly on 900k. That is slightly less then 100x100x100 which are a exactly a million.

Now i have seen voxel engines with very "tiny" voxels, you easily get to 1.000.000 cubes in view with rough terrain and a decent far plane. Obviously i can optimize a lot in the geometry buffer method, like rendering only visible faces of a cube or using larger faces covering multiple cubes if the area is flat. But is a vertex buffer of roughly 67mb the max i can work with or can i create multiple?

sentences:
Which is better for mobile games, PNG or SVG? I want to make several 2D games for mobile platforms, mainly using Qt for iOS, Android, Symbian, MeeGo and whatever supported by Qt.

I've made one game already using PNGs. Now I'm thinking of making a game similar to Battle Heart. What do you think is the best option, PNG files or SVG files or other formats?

sentences:
Texture visualization problem on camera movement (xna) I'm trying to move a camera over a model that is used as the floor of the game. When I move the camera, the texture of the model is not showing correctly (video of the problem: http://www.youtube.com/watch?v=bpycA7epMns&feature=youtu.be). I know that the model is fine because i use xnamodelviewer (http://modelviewer.codeplex.com/) to preview all the models, and  i can see it all right, even if i move the camera. So, the problem is in my model class maybe? what is wrong with this? any help is appreciated.

this is the model class im using:

public class CModel
{
    public Vector3 Position { get; set; }
    public Vector3 Rotation { get; set; }
    public Vector3 Scale { get; set; }

    public Model Model { get; private set; }

    private Matrix[] modelTransforms;
    private GraphicsDevice graphicsDevice;
    private BoundingSphere boundingSphere;

    public BoundingSphere BoundingSphere
    {
        get
        {
            // No need for rotation, as this is a sphere
            Matrix worldTransform = Matrix.CreateScale(Scale)
                * Matrix.CreateTranslation(Position);

            BoundingSphere transformed = boundingSphere;
            transformed = transformed.Transform(worldTransform);

            return transformed;
        }
    }

    public CModel(Model Model, Vector3 Position, Vector3 Rotation,
        Vector3 Scale, GraphicsDevice graphicsDevice)
    {
        this.Model = Model;

        modelTransforms = new Matrix[Model.Bones.Count];
        Model.CopyAbsoluteBoneTransformsTo(modelTransforms);

        buildBoundingSphere();

        this.Position = Position;
        this.Rotation = Rotation;
        this.Scale = Scale;

        this.graphicsDevice = graphicsDevice;
    }

    private void buildBoundingSphere()
    {
        BoundingSphere sphere = new BoundingSphere(Vector3.Zero, 0);

        // Merge all the model's built in bounding spheres
        foreach (ModelMesh mesh in Model.Meshes)
        {
            BoundingSphere transformed = mesh.BoundingSphere.Transform(
                modelTransforms[mesh.ParentBone.Index]);

            sphere = BoundingSphere.CreateMerged(sphere, transformed);
        }

        this.boundingSphere = sphere;
    }

    public virtual void Draw(Matrix View, Matrix Projection,bool luces)
    {
        // Calculate the base transformation by combining
        // translation, rotation, and scaling
        Matrix baseWorld = Matrix.CreateScale(Scale) * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) * Matrix.CreateTranslation(Position);

        foreach (ModelMesh mesh in Model.Meshes)
        {
            Matrix localWorld = modelTransforms[mesh.ParentBone.Index]
                * baseWorld;

            foreach (ModelMeshPart meshPart in mesh.MeshParts)
            {
                BasicEffect effect = (BasicEffect)meshPart.Effect;

                effect.World = localWorld;
                effect.View = View;
                effect.Projection = Projection;
                if (luces == true)
                {
                    effect.LightingEnabled = true;
                }
                else
                {
                    effect.EnableDefaultLighting();
                }
            }
            graphicsDevice.DepthStencilState = DepthStencilState.Default;
            mesh.Draw();
        }
    }
}

If I disable the line:
    graphicsDevice.DepthStencilState = DepthStencilState.Default;
The problem with the texture is solved, but i now have problems with the model showing things that must be hidden behind others, like in this picture:

sentences:
What degree do you need to become a game designer,programmer,developer.etc I was wintering what degree do you need in order to become a game designer,programmer or developer.
P.S i mean people who work for companies such as riot or ubisoft,etc

sentences:
Using Volumes to reveal secret doors in UE4 C++ project I'm working on a maze project and I would like to have secret doors. My basic idea is to have the walls be destroyed when the player is both within the bounds of a trigger volume, and presses a button. I know the basic way to implement the code, but my main concern is how to handle the volumes. Should I create a class, maybe called "SecretController" that holds the code that says:

"if player is in box[i] and presses fire, destroy door[i]"

This seems like it would work, but I'd rather know before I go create a ton of stuff I'll just have to delete later. Thanks for the help folks!

sentences:
Unity and lots of objects. Can this way of designing levels bring problems? Ok, question.

I've been fiddling for Unity for a while and now trying to make a cohesive game.

Up until now I've found the quickest way to design levels for me is to create a block of wall/floor to work as a "unit", and copy it lots of times.

The result is something like this

The blocks are basically just a transform + a sprite renderer + a box collider.

Now my question is: Can this approach bring problems given that it basically creates lots and lots of objects? If so what alternatives there are? Creating bigger blocks?

sentences:
Sending RPC calls from server to client inside Unity In my game inside Unity, I have two scenes setup. One for the main server ( acts like authoritative server ) and the other scene for my client. The game starts once my client connects to the server.

Now I am able to send RPC function calls from my scripts in my client scene to the server but I am not able to do it the other way around.

** Further edit to my code after comments **
*********** This is my client side script attached to GameObject CursorDetection inside Scene2 *****

 using UnityEngine;
    using System.Collections;

    // ON THE CLIENT SIDE
    public class CursorDetectionScript : MonoBehaviour {

        private bool hasGameStarted = false;
        void Update()
        {
           if (Input.GetMouseButtonDown(0))
           {
              networkView.RPC("mouseDown", RPCMode.Server,true);
           }
        }

        [RPC]
        public void mouseDown(bool isMouseDown)
        {

        }

    }

**** On the server side script inside scene1 *******

private void OnPlayerConnected(NetworkPlayer player)
{
    Debug.Log(" PLAYER CONNECTED " +player);
    networkView.RPC("AddNetworkPlayer", RPCMode.AllBuffered, player);
}

[RPC]
public void AddNetworkPlayer(NetworkPlayer player)
{
    playersList.Add(player);
    Debug.Log(" FIRST PLAYER IS " + playersList[0]);
}

 if(startGame)
 {
    networkView.RPC("SendMessageToClient1", RPCMode.AllBuffered, playersList[0]);
 }

[RPC]
public void mouseDown(bool isMouseDown, NetworkMessageInfo sender)
{
    isMouseDown = true;
    Debug.Log("CAN PLACE PANELS NOW" + " VIEW IS " + sender.sender.guid);
}

**** back on the client side script inside scene2 I called the SendMessageToClient1 function call *******

[RPC]
public void SendMessageToClient1()
{
    Debug.Log(" INSIDE CLIENT 1 ");
}

sentences:
What interchange format should I use for e.g. subtitles and UI texts? Are there any standard formats that can be used as the source material for game texts (i.e. subtitles, UI texts, etc.)? I can think of the following constraints:

at least some style effects (e.g. bold, italics)
at least some format string support (e.g. you found %d gold, you found {count} gold)
be translator-friendly: either easy to grasp, or standard enough that translation companies may already have experience with it

I know about the following but none of them appear to support format strings. Are there any industry standards for that or does every game or engine roll their own format?

UE4 uses a custom rich text format (example: Hello <RichText.Emphasis>everyone</>!)
Unity uses its own HTML-like format (example: Hello everyone!)
the srt format uses HTML-like syntax, too (example: Hello everyone!)
BBCode is another popular format (example: Hello [b]everyone[/b]!)

sentences:
Advertising before seeking a publisher I'm nearing competition of my first title and I'd like to seek out publishers but I'm also eager to show it off on social media.

Should I hold off until I've spoken to publishers or is it mostly harmless?

sentences:
jMonkey Quest Database I am building a game in jMonkey (Java) and I have so far only used default quest text. But now I need to start populating a lot of quests with text. My design requires A LOT of quests texts.

What is the best way to build a database of quest texts in jMonkey? I don't have a lot of real experience with databases. Is there a database that integrates well with jMonkey?

Here are the ideal properties I want in my database, in order of priority:

Reasonably light learning curve
Easy portability (in Java) to Windows, Linux, and Mac OSX
Good interface with Java
Good interface with jMonkey
The ability to add properties to the quests: ID, level, gender, quest chain ID, etc.

Or am I wrong in thinking I need to use some giant monster like SQL? I haven't been able to find much information on this, so are people using some non-database methods for storing things like quest text in jMonkey?

sentences:
Unity - movement code overriding rigidbody mass? Unity noob here...
I have a basic movement script, but whatever I set the objects mass at it still falls the same speed, floating down off ramps instead of sticking to the floor.
I saw some posts referencing that the movement translate can override the rigidbodys downward velocity. Well I tried several code adjusts but I couldn't get it to work correctly.
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");

// this code is to keep movement direction when switching to alternate camera
if (Input.GetButtonDown("Horizontal") || Input.GetButtonDown("Vertical")) {
    viewForward = Vector3.Scale(Camera.main.transform.forward, new Vector3(1, 0, 1)).normalized;
    viewRight = Vector3.Scale(Camera.main.transform.right, new Vector3(1, 0, 1)).normalized;
    viewRight = new Vector3(viewForward.z, 0f, viewForward.x * -1f);
    }

moveDirection = v * viewForward + h * viewRight;
if (moveDirection != Vector3.zero) {
    // moveDirection.y = rb.velocity <-- not working
    transform.position += moveDirection * Time.deltaTime * moveSpeed;
    transform.rotation = Quaternion.LookRotation(moveDirection);
    }

Could someone point out what I'm doing wrong?

sentences:
World to Pixel Transformation My objects have a location in world coordinates (basically 1.0f is a meter).
If I simply draw my objects using their world coordinates, each meter will correspond to a pixel. Obviously that's not what I want.

Now, I don't want to have to apply a transformation to each and every object's position when I draw them. As I happen to be using XNA, and spritebatch allows a Matrix to be passed in as an argument in it's begin method, I was wondering if there is a way to pass the World to Pixel transformation in there. Any suggestions?

So far Matrix.CreateScale(new Vector3(zoom, zoom, 1)) puts the objects in their proper spot, but it also scales up the sprites. Is there a way to transform the position without enlarging the sprite?

Thanks

sentences:
Is a multiplayer game in JavaScript a bad idea? What are the possible downsides to using (client side) JavaScript when creating a multiplayer game?

Game description: It's an MMORPG/RTS. That means players actively contribute to structures in the world and create much of the content themselves.

sentences:
How can I run a Phaser engine game without a window? I'm currently creating a multiplayer game using the HTML5 framework Phaser.

It's a game where zombies spawn on the map and players have to shoot them to kill them. The zombies target players that are closest to them.

Currently, I'm having my an issue with my design strategy. I'm not sure if this type of game is possible with Phaser due to the movement tracking.

At present, the client is handling all of the player movement, so whenever a player moves, it broadcasts it to the server which sends it to all of the other clients.

However, I would like for the zombies and the bullets to be controlled by the server exclusively. The server then updates each client with the velocity of each zombie and their current position. My reasoning is that anything that isn't player input should be calculated by the server. This will prevent issues such as two clients saying that a zombie died at different times and then trying to communicate with one another, having bullets at different locations at the same time, or zombies spawning at separate times between clients.

Here's an example of a zombie class:

function Zombie(game, data){

this.game = game;

this.id = data.id;
Phaser.Sprite.call(this, this.game, data.x, data.y, 'zombie');
this.anchor.setTo(0.5,0.5);

this.animations.add('right', [0,1,2,3], 7, true);
this.animations.add('left', [4,5,6,7], 7, true);
this.game.physics.arcade.enable(this);
this.body.collideWorldBounds = true;

this.health = data.health;
this.maxHealth = data.maxHealth;
this.speed = data.speed;
this.target = this.game.player;
this.waiting = 100;

this.name = "zombie";
this.healthBary = 20;
this.healthBar = this.game.add.sprite(this.x, this.y + this.healthBary, 'player_health');
this.healthBar.anchor.setTo(0.5, 0.5);
CollisionManager.addObjectToGroup(this, 'baddies');
this.game.add.existing(this);

}
Zombie.prototype = Object.create( Phaser.Sprite.prototype );
Zombie.prototype.constructor = Zombie;
Zombie.prototype.update = function(){

this.updateHealthBar();

                this.moveTowards(this.target);

Zombie.prototype.uTarget = function(target) {
    this.target = target;
};
Zombie.prototype.moveTowards = function(target){
var x = target.x - this.x;
var y = target.y - this.y;

var mag = Math.sqrt((x * x) + (y * y));

var nx = x / mag;
var ny = y / mag;

this.body.velocity.x = nx * this.speed;
this.body.velocity.y = ny * this.speed;

if(this.body.velocity.x >= 0){
    this.animations.play('right');
}
else if(this.body.velocity.x < 0){
    this.animations.play('left')
}

}
Zombie.prototype.updateHealthBar = function(){
this.healthBar.x = this.x;
this.healthBar.y = this.y + this.healthBary;

var p = (this.health / this.maxHealth);
p = parseFloat(p.toFixed(1));
this.healthBar.frame = 10 - (p * 10);
}
Zombie.prototype._damage = function(amount){
this.health -= amount;
if(this.health <= 0){
    this.kill;
    this.die(true);
}
}

Zombie.prototype.die = function(points){

if(this.game){
    //this.game.baddie_die_sfx.play();
}

WaveManager.onMap--;
CollisionManager.removeObjectFromGroup(this, "baddies");
if(this.healthBar){
    this.healthBar.destroy();
}
socket.emit("kill zombie", {id: this.id});
this.kill();
this.destroy();
}

The problem is that I can't create a Phaser game object on the server (as it's running on a Linux server) because there's no window that can be used. The bullets and zombies need to be Phaser objects for the sake of collision detection, but I can't do that on the server.

I know that I could create a vector of zombies and bullets server-side that would have the information for each bullet/zombie's position at any given time and then update the client, but then I wouldn't be able to use the CollisionManager in Phaser.

Right now, it seems like my only solution is to create my own collision detection system. Are there any alternative ideas?

sentences:
Resolving collisions with float precision errors I'm facing a problem when I try to resolve the collision between two units using floats as positions of the units in my game.

I am detecting the collisions using the SweptAABB algorithm and if there is a collision I fix it by using the normalized collision time that the SweptAABB function returns. Something like this:

collisionTime = SweptAABB(unitA, platform)
fixedPosition = (currentPos - previousPos) * collisionTime;

This generally works fine but not always, due of the floats precision errors the fixedPosition can result in a VERY SMALL overlap.
For example: suppose that the fixedPosition for the Y axis should be 12.345234 to avoid the collision but instead of getting that value (after multiplying by the collisonTime) I get something like 12.345239 (a difference of 0.000005) and when eventually the overlap method is executed it will still detecting the overlap:

public boolean overlap(AABB b) {
    Vector2 distance = new Vector2(b.position).substract(position);

    return Math.abs(distance.x) < (extents.x + b.extents.x)
        && Math.abs(distance.y) < (extents.y + b.extents.y);
}

So I decided to start changing the code so that I can get the face of the box that collides and use simple arithmetic addition of the positions instead of multiplication but this also fails for the same reason. For instance, suppose this:

// unitA collides with unitB at this point in the X axis:
float unitB_Face_X = 0.7466669f;
// since position is defined at the center of the unit I move unitA to the right:
float unitA_Fix_X = unitB_Face_X + 2;

But unitA_Fix_X will result in a slightly different value (2.746667) that will eventually be detected as an overlap.

Just a clarification: My game is like Super Mario Bros, a 2D platform. I dont need fine precision, two decimals places (or one) is more than enough for my game world (each unit character has 1f for width and 2f for height).

I think that there must be a correct way to deal with this kind of problem (every 2d platform game out there has solved this problem). I have only think in one solution: Use integers instead of floats for the position of every unit in my game. I cannot avoid floats completly  because of deltaTime (also libgdx uses them for the sprites positions and rendering), but I think I can make the integer conversion at the begining of each frame by doing something like this:

float fPos = unitA.velocity * deltaTime;
int intPosition = (int)(fPos * 1000);

And use the intPosition for detecting and resolving the collisions. After that I will have to convert it back to float for rendering the sprites.

Is this a bad approach? I dont want to shoot my self in the foot.
Thanks in advance.

sentences: What program was used in Kojima's Death Stranding to create the 3D scans of people? I've been unable to find out what program Hideo Kojima used to create his 3D scans of people in his game Death Stranding and presumably Metal Gear V as well. Here is a video of the scanning in progrees (Starts at 4:45 https://www.youtube.com/watch?v=KlMpN26ts7s).

sentences:
Why does my HTML5 game loop (with masking) run slowly? I have a game loop like so:

setInterval(function()
{
    context.save();
    context.rect(26, 144, 745, 400);
    context.clip();
    context.drawImage(myImage, 100, 100, 900, 900);
    context.restore();
}, 40);

As it runs the canvas gradually slows down to a stop. If I put the drawImage outside of the clipping then it runs indefinitely at the correct speed. Is there something I'm doing wrong?

sentences:
Can I legally use movie sounds for game production? Can I legally use short sounds from movies, like a door closing, in my game?
Is there a way for others know from where the sounds came from originally? Does it matter if I apply audio editing to the sample?

sentences: How to apply shaders on primitives There are tutorials about applying shaders to 3D models, but I would like to know how to use shaders on primitives. I have a world with a lot of vertices and I would like to apply a shader to it without adding any texture to it or loading any model. I'm working with XNA and HSLS.

sentences:
2D mouse coordinates from 3d object projection Not entirely certain of the nomenclature here -- basically, after placing a model in world coordinates and setting up a 3D camera to look at it the model has been projected onto the screen in a 2D fashion.

What I'd like to do is determine if the mouse is inside the projected view of the model.

Is there a way to "unproject" in the XNA framework?  Or what is this process called as, so that I can better search for it?

sentences:
How do I make an arrow line up with a bow when rotating them? I am trying to create a bow and arrow animation in which the player can drag downwards to increase the bow strength (see the image) and release it to hit a target. I can't get the arrow to align with the bow when the arrow's height is changed (third image). I am rotating both the bow and arrow around their respective origins (w/2, h/2).

What is the correct way to do it?

sentences:
Typical Applications of Linear System Solver in Game Developemnt I am going to write a custom solver for linear system.

I would like to survey the typical problems involved the linear system solving in games. So that I can custom optimization on these problems based on the shape of the matrix.

currently I am focus on these problems:

B-Spline editing (I use a linear solve to resolve the C0, C1, C2 continuity)
Constraint in Simulation (especially Position-Constraint, cloth)

Both of them are Banded Matrix.

I want to hear about some other applications of a linear system in games.

Thank you.

sentences:
In Unity, how to get reference of descendant? I'm trying to get descendant game object, not a child. Let's assume that I have a GameObject and it's hierachy looks like this:

Weapon
- Hands
- metarig
  - upper_arm.L
  - upper_arm.R
    - forearm.L.001
      - hand.L.001
        - weapon.L.001
          - AttackDetection(!)
- Sword

I want to access "AttackDetection" from Weapon(Root) in script. But when I try this:

void Start() {
    attackDetectionGObject = this.transform.Find("AttackDetection").gameObject;
}

It fails with this:

  NullReferenceException: Object reference not set to an instance of an object

Looks like transform.Find just looking up it's own child, not descendant. I try to find way to solve this problem, but there's nothing I found.

Any advice will be very very appreciate it.

sentences:
How to reference nameof private serialized field in unity custom inspector I'm running into a problem that I think will seriously affect maintainability down the road, so I'd like to figure it out now before it becomes a problem.

I've been starting to use private [SerializeField] rather than public fields to avoid other scripts manipulating internal data.Then, for scripts referencing the component's fields through properties in an interface.

So in a MonoBehaviour I have something like:

[SerializeField]
private float speed;

public float Speed => speed; //implements interface

However, In my custom inspectors, I now can't use

serializedObject.FindProperty(nameof(MonoBehaviourScript.speed));

This is because it doesn't have access to the private member speed. I now have to reference it by string name:

serializedObject.FindProperty("speed");

This worries me since now I can't easily rename the speed field. Also, Making both speed and Speed public is scary since then speed can be manipulated from outside.

Is there a good way to protect myself from external modification, while keeping refactoring easy?

sentences:
How important is engineering? I'm a student at Ohio State, I hope to be a game developer one day, and I'm on track to be enrolled in the BS Computer Information and Science program in the Arts and Sciences department, but there's another major in the engineering department called Computer Science and Engineering. As you can see, they're virtually the same, except that CSE requires several courses in engineering and higher level math, whereas CIS requires more GE classes, like foreign language. CSE is also accredited, whereas CIS is not.

So I'm wondering, if I want to be a game developer, how important is a knowledge of engineering, if at all? Should I try and get into the CSE program or will I be fine in CIS?

sentences:
Disable Ubuntu shortcuts On Ubuntu when capturing keyboard input with GLFW some keys like LEFT ALT are not passed to my window. Instead some desktop functionality is triggered like the dashboard search in case of the alt key.

How do I run a windowed game on Ubuntu, using all keys available on the keyboard, without telling the user how to turn off Ubuntu keyboard shortcuts all together at game start?

sentences:
Can I use Unity remote with a Android emulator instead of Android phone? Unity Remote is good app. It allows to connect with Unity while you are running your project in Play mode from the editor.

But what if I want to test game but I don't have an Android phone? Yes, it happens ¯\_(ツ)_/¯

I have a great Android emulator: Nox APP Player

The emulator doesn't have USB, so it just show me standsrt text Connect device with a USB cable ..... bla bla bla ...Game in the Unity Editor is running...emulator doesn't display the game.

Can I somehow connect this emulator to unity using Unity Remote? Or using something else? How?

sentences:
Why does the order of Farseer collision categories affect collisions? I've discovered a bizarre issue with the Farseer Physics Engine that I can't figure out. I have two Farseer bodies that I'd like to only collide with each other. To that end, I have the following code.

body1.CollisionCategories = Category.Cat1;
body1.CollidesWith = Category.Cat2;

body2.CollisionCategories = Category.Cat2;
body2.CollidesWith = Category.Cat1;

Which works fine. However, if I switch the categories around (shown below), the bodies no longer collide.

body1.CollisionCategories = Category.Cat2;
body1.CollidesWith = Category.Cat1;

body2.CollisionCategories = Category.Cat1;
body2.CollidesWith = Category.Cat2;

Some additional notes that might be relevant:

body1 is static, while body2 is dynamic.
body1 is created before body2 (although I switched the order and nothing changed).

Does anyone know why this happens? Based on my understanding of how Farseer uses collision categories (i.e. as masks using bitwise operations), the order shouldn't matter. Is it something silly I'm missing?

Thank you.

sentences:
Can ARToolKit be used for color detection? I'm trying to make an app that will show an object from different sides, but the target will be too small for any real marker detection.

Think of a cube with one or two centimeter sides. The camera distance is not a problem but it has to be at least ten centimeters out or what I'm trying to do won't work.

I was wondering whether it was possible to color one side of the cube differently than others and make ARToolKit recognize the color to know which side it's looking at. Is this possible or just not in the range of things ARToolKit can do? If so, is there any kind of AR that can do this.

sentences:
Curved movement between two points What is a good technique to enable an object to move between to points in a nice curved motion?

The end position could also be in motion, such as the trajectory of a homing missile.

sentences:
Slow Firefox Javascript Canvas Performance? As a followup from a previous post, I have been trying to track down some slowdown I am having when drawing a scene using Javascript and the canvas element.  I decided to narrow down my focus to a REALLY barebones animation that only clears the canvas and draws a single image, once per-frame.  This of course runs silky smooth in Chrome, but it still stutters in Firefox.  I added a simple FPS calculator, and indeed it appears that my page is typically getting an FPS in the 50's when running Firefox.

This doesn't seem right to me, I must be doing something wrong here.  Can anybody see anything I might be doing that is causing this drop in FPS?

<!DOCTYPE HTML>
<html>
<head>
</head>
<body bgcolor=silver>
<canvas id="myCanvas" width="600" height="400"></canvas>

<img id="myHexagon" src="Images/Hexagon.png" style="display: none;">

<script>
window.requestAnimFrame = (function(callback) {
    return window.requestAnimationFrame ||
            window.webkitRequestAnimationFrame ||
            window.mozRequestAnimationFrame ||
            window.oRequestAnimationFrame ||
            window.msRequestAnimationFrame ||
            function(callback) {
                window.setTimeout(callback, 1000 / 60);
            };
})();

var animX = 0;
var frameCounter = 0;
var fps = 0;
var time = new Date();

function animate() {

    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");

    context.clearRect(0, 0, canvas.width, canvas.height);

    animX += 1;
    if (animX == canvas.width)
    {
        animX = 0;
    }

    var image = document.getElementById("myHexagon");
    context.drawImage(image, animX, 128);

    context.lineWidth=1;
    context.fillStyle="#000000";
    context.lineStyle="#ffffff";
    context.font="18px sans-serif";
    context.fillText("fps: " + fps, 20, 20);

    ++frameCounter;
    var currentTime = new Date();
    var elapsedTimeMS = currentTime - time;
    if (elapsedTimeMS >= 1000)
    {
        fps = frameCounter;
        frameCounter = 0;
        time = currentTime;
    }

    // request new frame
    requestAnimFrame(function() {
        animate();
    });
}

window.onload = function() {
    animate();
};

</script>
</body>
</html>

--EDIT--

I did some additional experimentation, and now I'm not sure that this issue really has anything to do with canvas at all.

I added a "frame duration" counter in miliseconds, and neither Chrome nor Firefox ever go above 1 ms, so the code I am running inside animate is certainly not exceeding the 60 FPS frame time.  My current theory is that the Firefox browser just isn't giving me a consistent animation frame that is locked to V-sync; I had read some old posts about Firefox being capped in the 50's, and maybe this is still true?

So I tried a new method to compensate for the problem.  I started "pooling" my update time, and running an updatge step for each 16.6666 milisecond increment in the pool.  Frankly, this looks almost MORE jittery, but I am guessing that it at least maintains a more consistent timeline for a game.  Blech though :(  Is this really the best way to go?

sentences:
Gamemaker: Making a bullet Spawn at the enemy it was called from I'm making a gamemaker game with gml. In this game I have multiple enemies (same object) on screen at the same time. I want them to all spawn a bullet at their location. But instead each enemy spawns a bullet at one single enemy. They all shoot but the bullets appear in the wrong location. I want the bullet to spawn at the location of the instance is was called for. How do I do this?

Thank you for reading my question.

Code:
obj_carrier is the enemy I want to spawn from.
obj_carrier_bullet is the bullet I want to spawn at location of the carrier
There are multiple carriers around the stage.
In the step event of the carrier following an if statement:

   instance_create(obj_carrier.x, obj_carrier.y, obj_carrier_bullet)

sentences: If you create a game, do you automatically have the rights to it? I am creating a game in c++ that will me multiplier and am going to post it on https://indiegamestand.com  Here is one of the requirements "Must own the rights to distribute your game and to assign those rights to us (non-exclusively) for the purpose of selling here."  If I compile my game as an .exe do I have that right?  How can I make sure I retain it, and what can they do with the game if I give them that right?

sentences:
How do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d? I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. Pay attention to this gif. It might be hard to notice due to the low frame rate, but the collider registers collisions with objects (in red) that do not point out of the ground. They share the same y-position as the ground. I've printed the normals of the collisions, and there are a lot of normals that are perpendicular to the normal of the ground (which is causing the rigidbody to get stuck).

The problem lies with collisions in unity. If I were to print the y-position of the bottom of my collider, it would be just a tad lower than the y-position of the ground. The collider actually rests below the ground by an almost negligible amount (which is why it doesn't always collide with these objects).

Here is what I have tried: I created a function that runs at the beginning of every FixedUpdate() that uses current collisions to change the y-position of the rigidbody. It only runs on collisions that would ground the player (meaning that they are below the collider). The problem with this approach is that the same issue can occur with walls, meaning that the collider can get stuck on walls. I cannot create another function that would do the same for walls for various reasons.

Here is what would fix the issue: I need help figuring out how I can make collisions more discrete in unity. Colliders rest slightly below objects when ontop of them. They can also "sink" just a little into walls. In other words, colliders can rest into other colliders, and I need this to stop.

Any help is appreciated. Thank you.

sentences:
Slow performance on an A* implementation in a tower defense game I'm making a Tower Defense game in Flash with no predefined path.

Although my grid is 40x40 (small?), A* is struggling when recalculating every time. So I made my own modification to ease the recalculation and the touched cell count dropped to around 900 (when modifying near the root). It still freezes for a very short, but detectable, amount of time when a new tower is placed.

Is this an implementation problem, or is 40x40 just too much?

Edit:

The structure of my code:

All the data is saved in 2d array of cells.
Each cell contains its parent in path direction (1-8 clockwise) and bitwise encoded array of its children in path (every bit represents a child).
The search is performed by A* with the estimate of euclidian distance.

sentences:
Driving Force GT: Force Feedback and Wheel Rotation I'm diving into the world of game development on PC and have a language agnostic question in regards to controller output.

I have in my possession a Logitech Driving Force GT. This particular steering wheel controller has force feedback (aka vibration or rumble) and the ability to turn the wheel through the game.

What are my options for interfacing with this advanced functionality (not the basic axis rotations and button presses)? I've read the DirectInput and xInput documentation with no luck. Is it like a propriety Logitech only API, or as simple as passing information via HID?

Any pointers that will lead me in the right direction would be greatly appreciated!

sentences:
Camera relative movement is pushing into/off the ground instead of parallel I'm building upon roll a ball tutorial in unity, and I have managed to rotate the camera around the ball just fine with the code below. But there's one problem.

In this code, when I add force to the ball, with W for example, the force will be added in the exact direction the camera is looking at the ball, meaning pushing the ball onto the ground, increasing friction and lowering speed. And if I press S the force will push the ball to the air, lowering friction and making the ball move fast.

So my question is, how can I achieve rotation without this issue?

Code for Camera (CameraController):

public GameObject Player;
private Vector3 offset;
public float cameraSpeed;
private Vector3 point;
static public Vector3 finalMovement;

void Start () {
    offset = transform.position - Player.transform.position;

    point = Player.transform.position;
    transform.LookAt(point);
}

void LateUpdate()
{
    point = Player.transform.position;

    offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * cameraSpeed, Vector3.up) * offset;
    transform.position = point + offset;
    transform.LookAt(point);
}

Vector3 movement;
void FixedUpdate()
{
    movement = new Vector3();
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");
    movement = new Vector3(moveHorizontal, 0f, moveVertical);

    finalMovement = GetComponent<Camera>().transform.TransformDirection(movement);
}

Code for ball:

public float speed;
void FixedUpdate()
{
    rb.AddForce((CameraController.finalMovement) * speed);
}

sentences:
How to color individual parts of curve in unity, real time? So I have a mesh curve that I've imported from Blender. What I want to do is to place individual points on the curve (at fixed distance) and then based on a specific number, color them.

Let's say for instance number 1000 is color red and number 10 is color blue (based on color gradient). These numbers get updated real time, so I want my color to get updated real time.

I have no idea how to approach this problem. I've looked up some ideas but couldn't find anything useful.

Please help!

Thank you

sentences:
How to get a translation vector in a certain direction? SAT I'm using the seperating axis thereom for discrete collision detection. I have code to find the minnimum translation vector (or distance) to seperate two shapes but how can I adjust it to get a vector in a certain direction that seperates the shapes? For example: If a box A is overaping box B 10 pixels horizontaly and 40 pixels vertically the MTV would calculate to move the box horizontally 10 px or so but I want to seperate the boxes vertically (move 40px up). How can I adjust my code to calculate a MTV in a direction of my choosing?

    const Vector2 ShapeImpl::CalcDisplacement(const AxesVec &axes, const Shape &a, const Shape &b) const
{
    Vector2 displacement;
    Precision_t Overlap = std::numeric_limits<Precision_t>::infinity();
    Axis smallest;

    for (auto && axis : axes)
    {
        const Projection pA = b.Project(axis);
        const Projection pB = a.Project(axis);

        // No Collision
        if (!pA.IsOverlap(pB))
            return Vector2(0, 0);

        else
        {
            const Precision_t o = pA.GetOverlap(pB);

            if (std::abs(o) < std::abs(Overlap))
            {
                Overlap = o;
                smallest = axis;
            }
        }

}

    displacement = smallest * Overlap;

    return displacement;
}

sentences:
What is the standard procedure for importing animations in Unity? I need some info about importing game objects from Maya to Unity. I am making 2D Tower Defense game, I have made some basic functionality using dummy objects (cubes and spheres). Now I want to replace these dummies with objects made in Maya. The basic objects for gameplay would include walk of enemy and tower rotation towards it.

So what is the standard procedure of my query, would I need a running enemy object animated in Maya, replace it with my dummy objects, or something like multiple still images of enemy and tower movement, combined in Unity?

sentences:
How to rotate a whole Bezier Curve around a given point I am using the code from the question Adding functionality to make individual anchor points of bezier continuous or non-continuous to create bezier curves (I added a line renderer).

How can I rotate the whole bezier curve (which may contain multiple cubic Bézier segments) around a point?

Please note that the rotation point could be any point including the one of the curves anchor points or control points.

sentences:
Creating a single GUI Text with Fade-In I have this line of code

void Update () {

    float alVal = 0.0f;
    float damping = 1f;
    alVal += damping * Time.time;
    GameObject text2 = new GameObject();

    text2.AddComponent (typeof(GUIText));
    text2.guiText.color = new Color (1f,1f,1f);
    text2.guiText.name = "name";
    text2.guiText.text = "YOLOMF";
    text2.guiText.pixelOffset = new Vector2 (100, 100);

    text2.guiText.color = new Color(1f,1f,1f,alVal);

    Debug.Log (alVal);

}

I want to create a SINGLE TEXT, but I guess the Update() function keeps on making more.

I need that SINGLE TEXT to do an animation of Fade-In that's why it is in Update()

sentences:
How to attach a framebuffer to a whole cube map from a GL_TEXTURE_CUBE_MAP_ARRAY? I'm trying to make shadow cube maps in an array.  I want to draw each shadow map with a single pass using a geometry shader, which I read about here: https://stackoverflow.com/questions/462721/rendering-to-cube-map.  But in that example, the cube map is not in an array, and I can't find any code examples of how to get a cube map from an array attached to a frame buffer.

Just to make sure my array is legit, here's how I made it:

glGenTextures(1, &shadowMapArray);
glActiveTexture(GL_TEXTURE0 + TEXTURE_UNIT_SHADOW_MAPS_POINT);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, shadowMapArray);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_DEPTH_COMPONENT, POINT_LIGHT_SOURCE_SHADOW_MAP_RESOLUTION, POINT_LIGHT_SOURCE_SHADOW_MAP_RESOLUTION, (POINT_LIGHT_SOURCE_MAX_SHADOW_MAPS * 6), 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);

And this is how I tried to make the frame buffer:

    //Create the shadowMapFrameBuffer
    glGenFramebuffers(1, &shadowMapFrameBuffer);
    glBindFramebuffer(GL_FRAMEBUFFER, shadowMapFrameBuffer);
    glDrawBuffer(GL_NONE);

    //Attach the shadow map to the shadowMapFrameBuffer
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, shadowMapArray, 0, shadowMapIndex);

    GraphicsResources::checkGLFramebufferStatus();
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

But it looks like glFramebufferTextureLayer is only going for a layer-face, not a layer (a whole cube map), so only the first face (positive X) of the first shadow map is working, (and, for some unknown reason, only half of that face).

I also tried this:

    glFramebufferTexture3D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, shadowMapArray, 0, ((shadowMapIndex * 6) + 0));
    glFramebufferTexture3D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, shadowMapArray, 0, ((shadowMapIndex * 6) + 1));
    glFramebufferTexture3D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, shadowMapArray, 0, ((shadowMapIndex * 6) + 2));
    glFramebufferTexture3D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, shadowMapArray, 0, ((shadowMapIndex * 6) + 3));
    glFramebufferTexture3D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, shadowMapArray, 0, ((shadowMapIndex * 6) + 4));
    glFramebufferTexture3D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, shadowMapArray, 0, ((shadowMapIndex * 6) + 5));

But I don't know if a frame buffer is meant to be set up with multiple calls like that, and anyway, this produces 'GL_INVALID_ENUM'.

Anyone know the proper way to do this?

sentences:
A star pathfinding path too narrow for enemy The tiles for my top down 2D shooter are 32x32 and the player and enemies are too. But obstacles like walls and other things can of course be smaller than this - the smallest being 8x8. This causes a problem where a single 8x8 barrier intruding in a 32x32 tile will cause that whole tile to be impassable if my AI Grid is based on 32x32 tiles, like as follows:

This results in a grid with more impassable area than it should have. (On the left the red being the AI grid's impassable area, and on the right, the green being the box2d barriers for the same map section).

The other option is to make the grid 8x8 based and then the grid will perfectly calculate the actual impassable areas but it will create paths too narrow for the 32x32 enemy to pass through. With design I can make the first way (pathfinding grid of 32x32 tiles) work but it's not ideal since you're limited to placing everything in perfect tiles so as to not create impassable areas that are in fact passable.

sentences:
How can Highscores be more meaningful and engaging? I'm developing a casual Android game in which the player's success can very easily be represented by a number (I'm not more specific because I'm interested in the topic in general).

Although I myself am not a highscore person at all, I was thinking of implementing a highscore for that game, but I see at least 2 problems in the classical leaderboard approach:

very soon the highscore will be dominated by hardcore players, leaving no chance for beginners, who are then frustrated. This is very severe especially in casual games.
there is no direct reward for being a loyal player who plays the game over and over again

My current idea is to "reset" the highscore every 24 hours (for example) and each day nominate the "player of the day" who then gets a "star".
Then there would be some kind of meta-highscore of players with the most stars.

That way even beginners might have a chance to be "player of the day" once and continued or repeated play is rewarded much more.

The idea is still very rough and there are many problems in the details and the technical implementation but I have a feeling it is a step in the right direction.

Do you have creative and new ideas on how to implement highscores?

Which games are doing this well / what types of highscores do you find most engaging?

sentences:
How do I tell the difference between tapping and holding the touchscreen? I have a problem with the Unity game engine. I am making an Android game. I want to move an object by a small distance every time the user taps the screen, but not when the user holds the screen.

This is my current code. When the user holds the screen, the object keeps moving. I want to only move the object once the user touches the screen and not move it again until they released it:

void Update () {
        if (Input.touchCount > 0) {
            transform.position = new Vector2(transform.position.x, transform.position.y+0.1f);
        }

sentences:
Screen space decals, converting world to decal space I'm trying to do screen space deferred decals following the presentation made by Pope Kim about SSDs in WH40K: Space Marine (link). I've gotten to the point where I can render a decal if the bounding box is placed at the world space origin (0, 0, 0). The moment I move the bounding volume the decal is still trying to render at the world space origin and can be seen if you look "through" the bounding volume. The red planes in the picture are the bounding volume rendered for reference, the circular patch is the decal.

Picture showing a decal rendered correctly at world space origin

Picture showing a decal clipped when rendered offset from world space origin

Decal as seen "through" offset bounding volume.

My code is fairly similar to that off Kim, with minor differences accounting for the D3D to OpenGL transition.

Vertex shader:

#version 430

layout (shared) uniform PerFrameBlock
{
    mat4 gView;
    mat4 gProjection;
};

uniform mat4 modelMatrix;
uniform vec3 decalSize;

layout ( location = 0 ) in vec4 positionIN;
layout ( location = 1 ) in vec4 normalIN;
layout ( location = 2 ) in vec4 tangentIN;
layout ( location = 3 ) in ivec4 boneIndices;
layout ( location = 4 ) in vec4 boneWeights;
layout ( location = 5 ) in vec2 uvIN;

out vec4 posFS;
out vec4 posW;
out vec2 uvFS;

void main()
{
    posW = modelMatrix * vec4(positionIN.xyz * 1, positionIN.w);
    //Move position to clip space
    posFS = gProjection * gView * posW;
    uvFS = uvIN;
    gl_Position = posFS;
}

Fragment shader:

#version 430
#extension GL_ARB_texture_rectangle : enable

in vec4 posFS;
in vec4 posW;
in vec2 uvFS;

uniform sampler2D gNormalDepth;
uniform sampler2D gDiffuse;

uniform float gGamma;

uniform mat4 invProjView;
uniform mat4 invModelMatrix;

vec4 reconstruct_pos(float z, vec2 uv_f)
{
    vec4 sPos = vec4(uv_f * 2.0 - 1.0, z, 1.0);
    sPos = invProjView * sPos;
    return vec4((sPos.xyz / sPos.w ), sPos.w);
}

layout ( location = 1 ) out vec4 diffuseRT;
layout ( location = 2 ) out vec4 specularRT;
layout ( location = 3 ) out vec4 glowMatIDRT;

void main()
{
    vec2 screenPosition = posFS.xy / posFS.w;

    vec2 depthUV = screenPosition * 0.5f + 0.5f;
    depthUV += vec2(0.5f / 1280.0f, 0.5f / 720.0f); //half pixel offset
    float depth = texture2D(gNormalDepth, depthUV).w;

    vec4 worldPos = reconstruct_pos(depth, depthUV);
    vec4 localPos = invModelMatrix * worldPos;

    float dist = 0.5f - abs(localPos.y);
    float dist2 = 0.5f - abs(localPos.x);

    if (dist > 0.0f && dist2 > 0)
    {
        vec2 uv = vec2(localPos.x, localPos.y) + 0.5f;
        vec4 diffuseColor = texture2D(gDiffuse, uv);
        diffuseRT = diffuseColor;
    }
    else
        diffuseRT = vec4(1.0f, 0, 0, 1);
}

I think my problem stems from the conversion from world space to decal space using the inverse model matrix. The model matrix is build by the following code:

        glm::quat rot;
glm::mat4 rotationMatrix;
glm::mat4 translationMatrix;
glm::mat4 scaleMatrix;

        rotationMatrix = glm::toMat4(rotation);
        translationMatrix = glm::translate(glm::mat4(1.0f), position);
        scaleMatrix = glm::scale(scaleX, scaleY, scaleZ);

       modelMatrix = translationMatrix * rotationMatrix * scaleMatrix;

To get the inverse I just use the following:

glm::inverse(modelMatrix)

What I'm wondering is if inverting the model matrix like this actually correct or am I doing something with it which would cause this kind of behaviour? I've tried offsetting the calculated local space position in the shader with no luck (probably because the distance gets borked) and I'm starting to run out of ideas.

Any help is much appreciated!

sentences:
Why might render target in DirectX9 fail to work? I'm trying to render to a texture, but nothing is being drawn. Everything before SetRenderTarget is rendered properly, everything after second SetRenderTarget is visible on the screen. Just the part that should have been rendered to a texture is ignored.

Below is a Delphi code showing what I'm doing. What am I missing?

//Random texture size, non-power-of-two textures supported by card
//Tried with 512x512, same results
FStaticWidth := 806;
FStaticHeight := 413;

//Error checking code left out for clarity
//But every operation is checked

//Create texture
dev.CreateTexture(FStaticWidth, FStaticHeight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, FStaticText, nil);
FStaticText.GetSurfaceLevel(0, surf);

//Save everything;
dev.GetViewport(oldVp);
dev.GetRenderTarget(0, oldTarget);

//Change render target
dev.EndScene;
dev.SetRenderTarget(0, surf);
dev.BeginScene;

//Reset viewport
vp.X := 0;
vp.Y := 0;
vp.Width := FStaticWidth;
vp.Height := FStaticHeight;
vp.MinZ := -1000;
vp.MaxZ := 1000;
dev.SetViewport(vp);

//Draw
dev.Clear(0, nil, D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER, $FF112233, 1.0, 0);

//...whatever I do here, it's ignored.
//It doesn't appear neither on the surface, nor on the screen.
//Not even dev.Clear() above works.

//Restore render target
dev.EndScene;
dev.SetRenderTarget(0, OldTarget);
dev.BeginScene;

//Restore viewport
dev.SetViewport(oldVp);

//Dump the texture to a file
D3DXSaveSurfaceToFileW(PWideChar(AppFolder+'\static-surf.bmp'), D3DXIFF_BMP, surf, nil, nil);
//The file is a FStaticWidth x FStaticHeight bitmap,
//containing only black transparent ($00000000) pixels.

Here's how it looks like in PIX:

12570   <0x05AC9EA0> IDirect3DDevice9::GetViewport(0x0018FD40)
12571   <0x05AC9EA0> IDirect3DDevice9::GetRenderTarget(0x00000000, 0x0018FD80 --> 0x05ACA9B8)
12572   <0x05AC9EA0> IDirect3DDevice9::EndScene()
12573   <0x05AC9EA0> IDirect3DDevice9::SetRenderTarget(0x00000000, 0x05B53878)
12574   <0x05AC9EA0> IDirect3DDevice9::BeginScene()
12575   <0x05AC9EA0> IDirect3DDevice9::SetViewport(0x0018FD58)
12576   <0x05AC9EA0> IDirect3DDevice9::Clear(0x00000000, NULL, 0x00000003, D3DCOLOR_ARGB(0xff,0x11,0x22,0x33), 1.000f, 0x00000000)
12577   <0x05AC9EA0> IDirect3DDevice9::EndScene()
12578   <0x05AC9EA0> IDirect3DDevice9::SetRenderTarget(0x00000000, 0x05ACA9B8)
12579   <0x05AC9EA0> IDirect3DDevice9::BeginScene()
12580   <0x05AC9EA0> IDirect3DDevice9::SetViewport(0x0018FD40)

Render target 0x05B53878 remains empty (transparent black) after each event.

sentences:
How to run a method after a scene2d being rendered in libGDX I want to make a screenshot with

ScreenUtils.getFrameBufferPixmap(x, y, w, h);

I call this function in Actions.run(new Runnable{...}) in scene2d.ui, and the problem is that actions are called at very beginning of a new frame, so nothing is rendered yet.

How to call this method properly, e.g.

Scene.inTheEnd(run(ScreenUtils.getFrameBufferPixmap(x, y, w, h);));

?

sentences: Accessing motor object of a surface motor I would like to make a door closer for a door. The door should open normally, but when the person passes through close slowly. I've made an standard door on hinges, but then made one of them a motor and thought to control it when the person passes the door. However, I can't find the motor object on that part which owns the motor-surface. How can I do this properly?

sentences:
Bomberman clone, how to do bombs? I'm playing around with a bomberman clone to learn game-developement.

So far I've done tiles, movement, collision detection, and item pickup. I also have pseudo bombplacing (just graphics and collision, no real functionality).

I've made a jsFiddle of the game with the functionality I currently have. The code in the fiddle is very ugly though. Scroll past the map and you find how I place bombs.

Anyway, what I would like to do is an object, that has the general information about bombs like:

function Bomb(){
  this.radius = player.bombRadius;
  this.placeBomb = function (){
    if(player.bombs != 0){
      // place bomb
    }
  }
  this.explosion = function (){
  // Explosion
  }
}

I don't really know how to fit it into the code though. Everytime I place a bomb, do I do var bomb = new Bomb(); or do i need to constantly have that in the script to be able to access it.

How does the bomb do damage? Is it as simple as doing X,Y in all directions until radius runs out or object stops it? Can I use something like setTimeout(bomb.explosion, 3000) as timer?

Any help is appreciated, be it a simple explanation of the theory or code examples based on the fiddle. When I tried the object way it breaks the code.

Update: I now place bombs, and after a certain amount of time delete it depending on the position I placed it. But if I place a bomb before the first bomb explodes it only deletes one of them (obviously since bombX and bombY has changed since the first was placed).

Now i need to know how to fix this issue, maybe create a new array with all of the bomb positions? What's the best way of doing this?

Current code:

function placeBomb(){
    if(placebomb && player.bombs != 0){
        map[player.Y][player.X].object = 2;
        bombX = player.X; bombY = player.Y;
        placebomb = false;
        player.bombs--;
        setTimeout(explode, 3000);
    }
}
function explode(){
    alert('BOOM!');
    delete map[bombY][bombX].object;
    player.bombs++;
}

sentences:
Large Scale GIS in a AAA-Quality Game Engine? (Unreal, Cryengine, Unity, Etc.) I am working on a new simulation project that requires large scale, real-world terrain and imagery (GIS).  By large scale, I mean that I would like to support databases that cover something on the order of 10,000 square miles that include at least height data and satellite imagery.  Using data of this size also means that the engine must be capable of managing the coordinate systems/projections such that some reasonable precision can be maintained.

To my knowledge OpenSceneGraph is the only graphics engine out there that makes this easy (via paged terrain support, osgEarth, etc.)  However, it would be nice to be able to leverage many of the other great features AAA-quality game engines bring to the table.  (OSG is just a graphics engine, really.  I've been using it for over a decade, but I don't want to be fixed only to what I know.)

I've seen many tutorials online for importing small postage-stamp sized bits of terrain into Unreal.  I haven't seen anything on this scale.

Asked here: "Very large terrains in Unreal-4" there is a link to Unreal's "World Composition" feature.  This seems to shift coordinates around and also doesn't seem geared towards using real-world data.

How can I represent real-world terrain data on these scales in a mainstream game engine?

sentences:
How can I use 9+ vertices with CollisionPolygon2D? I am using CollisionPolygon2D to implement collision detection for polygons with 3-16 vertices. It works for polygons with 3-8 vertices, but additional vertices (9+) don't seem to register at all.
This is how I implement collision detection for a nonagon in C#:
var unit = 256f / 96f;

_collisionShape2D = _node.CreateComponent<CollisionPolygon2D>();
_collisionShape2D.As<CollisionPolygon2D>().VertexCount = 9;
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(0, new Vector2(-0.3515625f, -1.000000f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(1, new Vector2(+0.3515625f, -1.000000f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(2, new Vector2(+0.8593750f, -0.515625f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(3, new Vector2(+1.0000000f, +0.140625f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(4, new Vector2(+0.6250000f, +0.750000f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(5, new Vector2(0000000000f, +1.000000f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(6, new Vector2(-0.6250000f, +0.750000f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(7, new Vector2(-1.0000000f, +0.140625f) / 2 * unit);
_collisionShape2D.As<CollisionPolygon2D>().SetVertex(8, new Vector2(-0.8593750f, -0.515625f) / 2 * unit);

Note, the nonagon is a Sprite2D with a width and height of exactly 256 pixels. In my project, 1 world unit equals 96 pixels; hence, why I multiply by unit.
If this were an octagon, it would work as expected; however, that ninth vertex doesn't seem to register. What actually happens is the eight vertex connects with the first vertex and the ninth is ignored entirely. The same applies to polygons with any number of additional vertices (decagon, hendecagon, and so forth). This leads me to believe CollisionPolygon2D simply does not work for polygons with 9+ vertices.
According to the official documentation:

Polygon shapes are solid convex polygons. A polygon is convex when all line segments connecting two points in the interior do not cross any edge of the polygon. A polygon must have 3 or more vertices.
Polygons vertices winding doesn't matter.

The nonagon in question is convex as far as I am aware. This is what it looks like:

Courtesy of Wikipedia.
As you can see, none of the angles exceed 180, indicating it is indeed convex. The following demonstrates the collision produced in my example:

I tried replacing CollisionPolygon2D with CollisionChain2D using the exact same vertices to see if that would work instead, but I get really weird collision behavior (as if the size is either very small or just nonexistent; for instance, the object does not rotate as you'd expect when it falls and hits other objects).
For craps and giggles, I decided to add a tenth vertex, which equals the first, thinking maybe I needed to "close" the shape; that theory didn't play out well either...
I did get CollisionChain2D to work for some concave polygons with <=6 vertices, but it doesn't appear to work at all for convex polygons with any number of vertices.
What am I missing here?

sentences: 2D animated sprite jumping and gravity physics I'm currently writing a Megaman clone for my school project. So far all I did was making the character run and stay put when needed. Know I want to be able to make him jump using the 'X' button. I already have the animation sheet of the jump. But I really can't figure out how to do it and how the physics work after reading so much about it both here and other places. I think you get what I mean. From the state of staying put or running, going to a jumping position and landing. Also to be able to press left/right and the jump button to jump in the direction(I know It's stupid that I explain all of this because you probably know all this but just in case). Anyway this is my code for Game1: http://pastebin.com/zYM5gnRD And this is the code for my Animated Sprites class: http://pastebin.com/5H36YAdb I'm not saying it's the smartest writing, but it's only a school project so I need it to work so I'm fine with it. Thanks a lot, a lot in advance for those who read this and are going to help.

sentences:
Make character move behind object I used Tiled Editor for making maps for my own game, I do not run any engine or anything. I have separated terrain layer and object layer in TiledEditor.

However I have problem with trees I want to make my character move behind the tree. But I have no idea how because even if it is different layer I am still rendering it by 8x8 pixel blocks.

Now my character is always on top as it is the last thing that I render.

But if I change the render order my character would be behind the tree even if the character will stay in front of the tree like this:

sentences:
XNA shader compiler error in release mode I'm having a hard time figuring out if I'm doing something wrong, or if there is a bug with Visual Studio.

I want to pass a float into my pixel shader, clamp it to a value, and then return it as part of the color. Here is my shader code:

float test;

float4 PixelShaderFunction(float2 texCoords:TEXCOORD0) : COLOR0
{
    float n = clamp(test, 0, 1);
    float4 color = float4(n, n, n, 1);

    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

Here is how I'm using the shader:

    protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            simpleEffect.Parameters["test"].SetValue(-1f);
            spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, simpleEffect);
            spriteBatch.Draw(pixelTexture, new Rectangle(10, 10, 100, 100), Color.Red);
            spriteBatch.End();

            base.Draw(gameTime);
        }

The shader compiles fine when Visual Studio is set to Debug mode, but when I set it to Release, it gives me the following error (Please excuse the ShaderModel3Bug solution name... I get the same error with both shader model 2 and 3):

Error   1   Errors compiling E:\_C#\ShaderModel3Bug\ShaderModel3Bug\ShaderModel3BugContent\simple.fx:
(15,23): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed E:\_C#\ShaderModel3Bug\ShaderModel3Bug\ShaderModel3BugContent\simple.fx 15  23  ShaderModel3Bug

Line 15 of the shader is this:

PixelShader = compile ps_2_0 PixelShaderFunction();

I have tried compiling the shader directly using fxc.exe that comes with the June 2010 DirectX SDK. Using the command fxc.exe /T fx_2_0 E:\_C#\ShaderModel3Bug\ShaderModel3Bug\ShaderModel3BugContent\simple.fx /Fc:output.fxc, I get:

Microsoft (R) Direct3D Shader Compiler 9.29.952.3111
Copyright (C) Microsoft Corporation 2002-2009. All rights reserved.

compilation succeeded; see C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x64\output.fxc

So my question is, why can't Visual Studio compile the .fx file in Release mode? Am I doing something I shouldn't be doing?

Update

Apparently XNA Game Studio doesn't use the latest version of fxc. I downloaded the March 2009 DirectX SDK, and the compilation fails with the same generic error message as Visual Studio:

C:\Program Files (x86)\Microsoft DirectX SDK (March 2009)\Utilities\bin\x64\ps.fx(16,23): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed

compilation failed; no code produced

If I run the March 2009 version of fxc.exe with the /Op (disable preshaders) flag, it compiles successfully... I am still not sure what version of fxc xna uses, or what I need to do to get my shader to compile in release mode. Any help would be appreciated.

sentences:
Should I have multiple small textures or a single big one? I'm using SDL 2 to create a small 2D game. Based on the docs, this is what I would do:

 SDL_Surface *surface = SDL_LoadBMP("image.bmp");
 SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, surface);
 SDL_FreeSurface(surface);
 ...
 SDL_RenderCopy(renderer, texture, NULL, &dest);

Since I have every single sprite in a different bmp, this would cause hundreds of texture objects to be created.

Another solution would be to create a single SDL_Surface based on all the bmp files, create a single texture object from it and then blit it with something like this:

SDL_RenderCopy(renderer, texture, &src, &dest);

I use  src to select the sprite I'm interested into blitting.

I know SDL 2 takes advantage of 3D acceleration and I'm not an expert of 3D graphics programming, but I do know that selecting the current texture is an operation that is very expensive. However, I'm not sure that a SDL texture is translated into a real Texture.

So my question is: are these 2 approaches the same in terms of performance, when using SDL 2?

sentences: Is there an easy way to add TMX Object Layer to a Scene in Andengine? I have a TMX file with a MAP layer and Object layer (called decorations, with property type = "decorations"). Is there an easy way to add the whole layer to the scene with all objects? Or do I have to iterate through objects and add them one by one?

sentences:
How would you create a single object effect with ecs like a shadow moving straight and a bouncing ball? I have a bullet that has projectile motion, this bullet is also an effect. Also the bullet has a shadow, that fade on specific time relatively  to bullet. So I'm thinking of using the libgdx particle system (I am using an Entity Component-based System approach) so I created a particle component, or would you rather recommend to create another component for that specific effect? like a projectile component and linear component or a motion component in general.

Creating shadow, bullet, and other single object effect entity. Notice that I doesn't use any Box2d Physics yet.

Entity shadow = engine.createEntity();

... add texture, transform, movement or with gravity components

engine.addEntity(shadow);

To move the shadow entity

// Shadow
Vector2 linear = ...
movement.velocity.set(linear);

To move the bullet entity

// Bullet
gravity.vertical = 9.8f; // set earth gravity
Vector2 projectile = ...
movement.velocity.set(projectile);
// Also I need to calculate the time to reach its destination to add in lifespan

To create and move a ball entity

Entity ball = ...

// assume that the world has zero horizontal and 9.8 vertical Vector2 gravity
// set the physics body and set restitution to have bounce
physics.body = createCircleBody(...);

add(texture);
add(transform);
add(physics);

Every single object has lifespan so I added some lifespan component

LifespanComponent lifespan = ...
lifespan.duration = 0.5f; // let say half a second

Then the lifespan system will handle if the time reached the duration, then remove entity.

The problem is, Because Particle System has many moving objects, I don't know if I could use libgdx Particle System to create a single moving object that has a lifespan, like shadow, ball, bullet.

sentences:
Efficiently culling off-screen objects on a top-down 2D map I know efficiency is key in game programming and I've had some experiences with rendering a "map" earlier but probably not in the best of ways.

For a 2D TopDown game: (simply render the textures/tiles of the world, nothing else)

Say, you have a map of 1000x1000 (tiles or whatever). If the tile isn't in the view of the camera, it shouldn't be rendered - it's that simple. No need to render a tile that won't be seen. But since you have 1000x1000 objects in your map, or perhaps less you probably don't want to loop through all 1000*1000 tiles just to see if they're suppose to be rendered or not.

Question: What is the best way to implement this efficiency? So that it "quickly/quicker" can determine what tiles are suppose to be rendered?

Also, I'm not building my game around tiles rendered with a SpriteBatch so there's no rectangles, the shapes can be different sizes and have multiple points, say a curved object of 10 points and a texture inside that shape;

Question: How do you determine if this kind of objects is "inside" the View of the camera?

It's easy with a 48x48 rectangle, just see if it X+Width or Y+Height is in the view of the camera. Different with multiple points.

Simply put, how to manage the code and the data efficiently to not having to run through/loop through a million of objects at the same time.

sentences:
Collision handling for grid based games and simulations I'm trying to implement a grid based game where there are many creatures moving in the grid from square to square. I'm having a hard time handling collision with creatures in the grid (multiple creatures trying to move into the same square or cell). Where can I find information on how I should handle a game (or simulation) where multiple creatures in a grid want to move into the same cell but aren't allowed to? It's easy to handle 2 creatures, but handling n object collision is tough.

I'm looking for info on how to handle collision in a grid world. I don't expect a specific answer as much as resources or suggestions to find more info.

EDIT: To clarify, I'm looking for info on HOW TO HANDLE COLLISIONS BETWEEN MULTIPLE OBJECTS IN A GRID. In a grid world where multiple objects want to move into the same cell at the same time, how do I resolve this? Does one object get to move into the cell and the other objects remain stationary? Do I make each object push the other object out of its cell? These are the questions I want to answer.

An example of the problem I'm looking to answer:
Consider a grid where there's 3 creatures who move from tile to tile. What do I do when two creatures, A and B, try moving into the same tile? Let's consider if I allow creature A to move into the tile but creature B remains stationary. What happens if a different creature C wanted to move into the tile that creature B was stuck in? Then creature C also wouldn't be able to move.

This would cause an issue if I would evaluate creature C's movement first, telling it that he can move into the tile that creature B is in (because creature B plans to move out) but then creature B ends up never moving out.

How do I determine which creatures to evaluate first? Also, how do I avoid this huge chain of creatures being forced to remain stationary (in this example, only 1/3 creatures were able to move).

sentences:
Position is not what it should be when attaching fixture In XNA / Farseer I have something like this:

Body body = BodyFactory.CreateRectangle(world, 1f, 2f, 1f);
FixtureFactory.AttachCircle(0.5f, 1f, body, new Vector2(0f, 1f));

I have been told that body.Position property is the center of the AABB of the Body. In this example it seems not to be so. When I do something like this to display the coordinates of the position I see that they are at the center of the rectangle created at the beginning:

BodyFactory.CreateCircle(world, 0.1f, 1f, Body.Position);
BodyFactory.CreateCircle(world, 0.1f, 1f, Body.WorldCenter);

The center of gravity seems also to be the same.
I need this for drawing my texture over the Body. The origin for drawing is then like this:

Vector2 Origin = new Vector2(Sprite.Width / 2, Sprite.Height / 2);

Am I doing something wrong or does the engine not recognize, that a circle fixture is attached to the rectangle?
Is there any workaround?

sentences:
What is a good "easily" moddable and scriptable 3D game? I've made a fair number of 2D games (and actually completed/released a few of them). I'm hesitant to move into the 3D realm, because of the order of magnitude (everything takes ~10x more work).

To get started, I was thinking about picking something and modding it. What's a good, "easily" moddable game? By easily, I really mean:

Most or all of the content can be changed via tools (not code)
Tools are included, and mature (don't crash much, etc.)
The game is free or cheap
The game is scriptable (scripting language or SDK)

I'm not really particular about a target language, although I lean towards something more like C# than JavaScript.

If this is not a "good" question, we can make it a list and community wiki it. I really want to know options to get started in the 3D modding realm.

sentences: How do I move a body using the hardware accelerometer? I want to move the ball as I move the device but I can not able to find how to use accelerometer in libGDX. I know that Gdx.input.getAccelerometerX() returns x coordinate but I don't know how to apply it to the body I have created.

sentences:
How to make proper billboarding trees ? (Unity3D & C#) I make a 2.5D first person game like Doom, Duke Nukem 3D, and Daggerfall used to be. I'm new to Unity and game development in general, so I'm sorry if this seems obvious to some people.

What I want is to have the 2D sprites of the trees to billboard smoothly in the same way they did in the old games.
Take a look at this video to understand what I mean: https://www.youtube.com/watch?v=xPwGXf8y6XA&t=277s

I've already tried the proposed solution at http://wiki.unity3d.com/index.php?title=CameraFacingBillboard and it doesn't work the way I want, it's uncanny and off-putting the way it works.

Please help me.

sentences:
How should I learn about collision detection? If I want to use physics engine for my game then how should I go to learn collision-detection algorithms?

When I read AI book for games, the book talks about collision detection, so I want to learn it, but what kind of book would be best?

If I had to choose to go and learn it what would you advise me to read?

A physics book. (Game physics H.Ebrely)
A real-time collision detection book. (Same author)

I don't know much about algorithms, some people say it's better to start with a physics book, because real-time collision detection book depend heavily on algorithms.

sentences:
How can I "capture" the section of my sprite sheet that I want to draw in Java? I'm working on a puzzle game, I've implemented a sprite class that uses an array of images and cycle through the array to draw each frame as required.
This works fine!

Here's the original code:

    String number;
    Image sprite;
    ArrayList <ImageIcon> spriteAnimation = new ArrayList();
    int _imageCount = 0;
    int _animationStart = 0;

   public Sprite(String spriteType, int totalFrames){

        for(int x =1; x <= totalFrames; x++){
          spriteAnimation.add(new ImageIcon("Images/" + spriteType + "/" + spriteType + x + ".png"));
          System.out.println("Added " + spriteType + x + ".png to the ArrayList");

        }

    }

    public void updateSprite(){

        sprite = spriteAnimation.get(_imageCount).getImage();

        System.out.println("image count is " + _imageCount);

        if(_imageCount < spriteAnimation.size()-1){

           _imageCount += 1;

       }else{

           _imageCount = _animationStart;

       }

    }

    public Image getSprite(){

      return sprite;

      }
}

However, after researching the difference between using the method above and using a single sprite sheet (there must be a good reason to use a sprite sheet I thought, and I was right) I've decided to use a single sprite sheet to represent all sprites in my game.

While I fully understand the principle of using the sprite sheet, I cannot get my head around actually drawing the selected part of the sprite sheet.
I thought there might be a constructor in the ImageIcon or Image classes that would allow me to do something like pass in the size of the image to be drawn, the x and y co-ordinates to start at and the original sprite sheet as arguments - but apparently not.
I'm obviously looking in the wrong place.

I would be very grateful if someone could advise me on how to do this in Java.

sentences:
Minimal Projection Matrix i hope you can help me. I'm currently stuck at the creation process for projection matrices used by shadow maps.

The problem is the following:
I got the spot/directional light projectionmatrix/boundingfrustum and additionally the bounding frustum of the camera projection matrix.

What i need is the minimal bounding box of these two frustums. How do i get that? Or is there a better way to create projection matrices for shadow maps?

sentences:
How is ball_pos calculated I'm new to game development and I'm trying to build my first Pong game on the Godot engine. the tutorial I'm following is given below.

Simple Pong Game

What I don't understand is the line:

ball_pos += direction * ball_speed * delta

How is the new ball position being calculated?

As far as I know, delta is the time elapsed in seconds (float) since the last _process() call.

Also, why is the direction vector set to (1.0, 0.0)?

I'm looking for a clear explanation since the tutorial doesn't explain much. Thank you.

sentences:
Rotating GameObject does not rotate child I am rotating a gameobject that has a child game object with a particle effect on it.

It's a missile with engine exhaust.

I am rotating the parent game object but the particle effect child objects do not rotate:

The missile object has this script on it:

void FixedUpdate () {
Vector3 dir = targetObject.position - transform.position;
dir.Normalize();

float zAngle = Mathf.Atan2( dir.y, dir.x ) * Mathf.Rad2Deg - 90;
Quaternion desiredRotation = Quaternion.Euler( 0, 0, zAngle );

transform.rotation = Quaternion.RotateTowards( transform.rotation, desiredRotation, 10.0f * Time.deltaTime );
rigidBody.AddForce( transform.up * 10.0f, ForceMode2D.Force );
}

Particle Effect:

Anyone see what I am doing wrong?

sentences:
Zooming versus panning in a 3D FPS fly camera Imagine you have a strategy game, and it's rendered in openGL, in 3D. You have an overview of the map and the camera is currently looking at the direction of the ground at some angle (but is not limited to this angle). Like the standard view in the CIV games.

You now do one of the two actions:

A) You move the camera along its line of sight towards the ground (forward).
B) You scale the whole scene by a factor >1.

If I understand these actions correctly, both situations should have exactly the same visual result, zooming in. The player shouldn't really be able to tell which of the two has happened.

My questions is, firstly, am I right to assume this?

If no, what is the observable difference?
If yes, which mechanic should be used?

Note that I am thinking about this in regards of use in a level editor.

Thinking about it a little further, the difference should become visible if player moves the camera after the action - the camera in the scaled version would move at an apparently slower speed, right?

Would there be any other side effects? Which behavior would be expected by the player/user?

If you assume an FPS fly camera (one that yaws and tilts, but does not roll), is there any scenario where the scaling method would be preferred?

sentences:
How can I implement a third-person camera in an SC2 map? I want to try creating a custom Starcraft 2 map with a third-person camera following a unit. A few custom maps with this feature exist already, so I know it's possible.

How do I do this? Do I need a custom mods file, or can everything be done in the map file?

sentences:
Better way to implement iPhone Games targeting iPhone 4, 4S & 5 iPhone 5:

4″ at 1146 x 640 resolution retina display

iPhone 4, 4S:

3.5″ at 960 x 640 resolution retina display

We are developing games targeting iPhone 4, 4S & 5.

What graphics resource ratio would be better with less time and
investment?
Which ratio would be easy to integrate with targeting device with
less coding?

sentences:
Which better? Write all scripts on timeline or write it partially on `.as` file? I'm going to create a flash game. But I don't know which way for me to write my scripts.

Is it better if I write script part by part and by object so every object has they own script .. or write all of those object's script on single timeline?

sentences:
Best logic to create and drop new gems in a Match-3 game In a simple match-3 game, with a square gems matrix creating and dropping new gems is fairly simple: when needed I generate those gems above the matrix and then I make them fall into the main matrix simulating that common fall-from-the-ceiling behavior.

Let's now imagine I have a matrix with some rock-type gems, the ones that will never move from their position, and I have cleared an entire column via a "powerful" gem. I have something like this:

OOO OOO
OOO OOO
OOO OOO
OOO OOO
OOX XOO
OO   OO
O     O
OOOOOOO

Here O is a normal gem, and X is a rock gem, that is fixed in the matrix and will not move from its original position.

When the new gems flow into this matrix, they will eventually move to the left or to the right to fill that big empty space, but each one will be dropped into the same column.

I'm wondering what the best way to drop those new gems is. I clearly cannot simply make them move from the top of the screen directly to their final position (as in the previous case), since the would move diagonally across the other gems (too bad).

I'd like to know what's the easiest and most flexible way to compute and the configure the path that each gem will have to follow.

sentences:
How to correct obtain HWND from SDL2? I use Urho3D which uses SDL2 as a window system. I want create another window as GUI and make it child for main window of Urho3D.

What I did is:

// insde virtual void Start() // Urho3D app
SDL_Window * sdlw = context->GetSubsystem<Graphics>()->GetWindow();
int width = context->GetSubsystem<Graphics>()->GetWidth();
int height = context->GetSubsystem<Graphics>()->GetHeight();
HWND mw = SDLWindows::GetWindowHWND(sdlw);
wpfC = WPFI::CreateWPFControl(0, 0, width, height);
HWND www = SetParent(wpfC, mw); // SetParent is windows function
if (www == NULL)
{
    std::cout << "------------------------------\n"
        << "www = NULL\n"
        << GetLastError() << "\n"
        << "------------------------------\n";
}

HWND SDLWindows::GetWindowHWND(SDL_Window * wnd)
{
    SDL_SysWMinfo sysInfo;
    SDL_VERSION(&sysInfo.version);
    SDL_GetWindowWMInfo(wnd, &sysInfo);
    return sysInfo.info.win.window;
}

I got Invalid window handle (1400) Error on SetParent().

I am not sure if I am doing it right, but I am sure that my wpfC is ok because I have another test project where it is working but instead SDL window I use win32 Window.

I think SDL_GetWindowWMInfo() give me a wrong handle.

Question is how to obtain HWND from SDL_Window correctly and be sure that it is right HWND?

If it is not possible do it that way, is there another way how to create child window from HWND inside main SDL2 window?

sentences:
Creating a Model out of Math primitives Here is a litte sample that I drew in Blender to visualize what I am planing to create:

Cone with spheres sample

I already have the code to generate the cone and the spheres as mentioned in my former Post Combine 3D objects in XNA 4.

I thought that it would be nicer to generate a model and add these models to the sceen graph. My problem for now is that I wasn't able to generate a model out of my primitivas. I was planning to create one Mesh for the cone and one for each sphere that I want to attach to the cone and arrange all this in a Model, but there are no constructors for a Model or a Mesh.

So the question is: Is there a way to generate a model out of my primitives?

sentences:
C# Perlin noise - generating “endless” terrain chunks? I'm currently writing a little side scroller in C#, to both learn C# and have fun. Right now I have a simple random number generator generating the world but it isn't exactly all that great - so with some research, I've discovered that Perlin Noise generation may help me out quite a bit. Problem is, I want to have an "endless" landscape made up of several chunks.

Basically my questions / concerns are:

Using minecraft as an example (Ignoring the 3rd dimension), how is Notch getting each chunk to connect to each other perfectly? Tunnels, caves, ore veins, mountains, flat lands, biomes, etc. are all connected to each other even though each chunk is generated separately, and sometimes at a much later date. This is key for me, I want the player to be able to walk to the right and as they are walking, generate more landscape that connects to previous landscape, including underground tunnels and cave systems.
Going off of #1, how would this be accomplished under the assumption that each chunk is a square, and the world is 10 squares high, and infinite squares wide? I.e. Each "chunk" is 128x128 tiles and the world is 1,280 tiles tall total. (This is so that I can make an infinitely deep map if I choose to - and also to show that all 4 sides of a chunk / square need to be able to connect and continue on what the previous square/chunk was doing).

sentences:
C++ structure for component list I'm developing a game in C++, making use of the Entity-Component system.

I'm going to store a list of each component, with each component's position in the list mapping to it's entity. So, the 5th item in the list is a component for Entity 5, etc.

My inspiration came from this:

https://www.gamedev.net/resources/_/technical/game-programming/implementing-component-entity-systems-r3382

My question is what data structure is the best for this. I guess my options are an array or a vector of Components. When using either the array or the vector, is it possible to have empty elements. So, for example element 0, 1 and 4 might contain components, but positions 2 and 3 empty. I know I could achieve this with pointers to components, but is this the best way?

Advice appreciated.

Thanks,
Rich.

sentences:
Rendering lightmaps at runtime I'm creating a procedural terrain system for Unity. And I'm looking for ways to efficiently cast self-shadows on it. If it wasn't procedural, I could simply bake a lightmap using Beast. But, I can't because the terrain mesh is created at runtime. What kind of methods can be done for this, I'm sure it has been done before. If possible, I'm looking for a solution that works for non-pro.

I was thinking that maybe some kind of onetime ray-tracing method might be a solution.

sentences:
Send Geometry Data to Multiple Shaders So I am implementing a deferred rending model for my engine, and I want to be able to send all scene geometry into a single shader to calculate ambient, diffuse, normal, ect thats not the question.
Once I have all of this data buffered into the GPU I can render all of that geometry from a camera perspective defined by a uniform for the cameras position in the scene. I am wondering if I can reuse this model data already in VRam in another shader translated by a light sources projection matrix to calculate the shadows on this scene geometry without needing to send the same data to the GPU again.
Is there a way to tell my light shader, hey all that juicy geometry/scene data you want is already in V-Ram, just use this matrix transformation instead.
Alternatively when I am sending the VAO to the GPU is there a way to send it to two shades in parallel, one for the deferred rending model, one for shadow casing light sources?
Thanks so much!

sentences:
Can't read .cso files but I can read their .hlsl versions? Well I've been trying to read a .cso file to use as a shader for a DirectX program I'm currently making.

Problem is no matter how I implemented a way to read the file it never worked. And after fidgeting around I discover that it's only the .cso files I can't read.

I can read anything else (which means it works) even their .hlsl files. Which is strange because the .hlsl (high level shader language) files are supposed to turn into .cso (compiled shader object) files.

What I'm currently doing is:

vector<byte> Read(string File){
    vector<byte> Text;
    fstream file(File, ios::in | ios::ate | ios::binary);

    if(file.is_open()){
        Text.resize(file.tellg());
        file.seekg(0 , ios::beg);
        file.read(reinterpret_cast<char*>(&Text[0]), Text.size());
        file.close();
    }

    return Text;
};

If I then implement it.

Read("VertexShader.hlsl"); //Works
Read("VertexShader.cso"); //Doesn't Works?!?!

And I need the .cso version of the shader to draw my sexy triangles. Without it my life and application will never continue and I have no idea what could be wrong.

EDIT #1:
When I read the .hlsl file the vector get's filled whit what was written in the file.
For the .cso ones the function doesn't even pass the "if(file.is_open)" test and stays empty.

sentences:
Box2D Check If Point Intersects a Body Is there a way to check if a point is intersecting a body?

For example, lets say there's a body in the world at a position of (100,100).

Is there a way to check if a point at (100,100) intersects that body?

Another example is related to a game called "PHUN". In PHUN you can click and drag bodies around. How would you check if a mouse point is intersecting a body?

sentences: SMR shadow fade by script? I want to make fade for my player shadow. I don't know if it's possible or not. In my skinned mesh render there is "Cast shadows" with four options "Off, On, Two sides, and Shadows Only". How to do it by a script ?

sentences:
How would I setup the Environment Variables for BulletPhysics? I am using Bullet Physics v2.78. And Im trying to build this library to be used for ogrebullet. The main problem is that Im getting errors trying to find the Bullet Directory.

Im wondering if maybe my environment variables are setup wrong.

I am using Windows Vista 32 bit, and here are my Environment variables:

BULLET_ROOT: C:\BulletPhys

BULLET_INCLUDE_DIR: C:\BulletPhys\src

as other information I am trying to build these libraries in cMake. Bullet physics builds perfectly, but ogrebullet cant find the libraries needed to configure(Dynamics, Collision, LinearMath, etc.)

So my question is: How would I setup the environment variables so ogrebullet can find them?

If any other information is needed i will provide upon request.

Thanks

-Molma

sentences:
How can I merge the corners of fractally-generated borders so they look natural? I'm using a fractal generator to generate borders around a rectangular area. It works great, but my problem is with corners.

A naive implementation when the left border overlaps the top border:

Obviously this doesn't look great. I tried averaging the weight of pixels from top and left border... not so great either.

My best shot was with iterating over a circle rather than over a line for corners, sort of like:

for(var i = 0; i < buffer.Length; i+= step) {
  for(var j = 0; j < buffer[(int)i]; j++) {
    PutPixel(Cos(i*CoeffStep)*CoeffRadius*j,
      Sin(i*CoeffStep)*CoeffRadius*j, ColorFor(j));
  }
}

Where PutPixel merges color into average if the pixel is already set.
This however this skips some pixels at higher radii.

Example:

Setting smaller steps obviously helps, but not 100%. Anyone have any ideas what I can do?

sentences:
stats or profit give away result of game Think of a coinflip game, whose logic looks as follows:

Server sends websocket message (RESULT_MESSAGE) to frontend with result of a game (won/lost)
Server sends websocket message to frontend with updated aggregated stats (STATS_MESSAGE) (think all-time profit after the new coin flip, or updated all-time stats)
Frontend reacts to RESULT_MESSAGE by playing an animation (coin flipping). It also updates the all-time stats and profit in response to STATS_MESSAGE

The problem with this logic is, responding to STATS_MESSAGE (updating profit and stats) gives away the result of the coin flip before the animation finishes.

Solutions I cannot use:

Merging RESULT_MESSAGE and STATS_MESSAGE together, and only updating the  stats/profit after animation finishes. Because those 2 messages are produced and sent by different services.
Linking a particular RESULT_MESSAGE to a STATS_MESSAGE and only reacting to a STATS_MESSAGE when its corresponding RESULT_MESSAGE has been processed and its animation completed. Because in reality I have several kinds of STATS_MESSAGES (trophies updated, stats updated, profit/balance updated, etc), and it's just not practical for the frontend to hold onto all those messages until their respective RESULT_MESSAGE is processed

Solutions I've tried successfully before, but I'm trying to avoid:

Having the backend send STATS_MESSAGE with a delay, to make sure it doesn't reach the frontend before the coinflip animation has finished. This sort of encodes frontend behavior (animation) on the backend.

All ideas and suggestions appreciated. Thanks a lot!

EDIT: I made the coin-flipping example for simplicity, but it's not precisely con-flipping. It's a multiplayer game where dozens of games/animations per user per seconds are going on. So queuing a bunch of stuff on the frontend might be less than ideal (I'm still looking into performant versions of this solution though).

Pulling the STATS data via an API call when the animation finishes (instead of using websockets data) is another alternative that I've considered, but for the same reason described above it might not be feasible (dozens of API calls per user per second). Plus there's a chance that an API call is triggered by game-1 finishing, but while game-2 animation is still going on, giving away the result of game-2

sentences:
How to hide player when in Shadow using Unity 2D Light System? I have been looking for this for a couple of days now and cant find an answer; how can I hide a player when they are in the shadow when am using Unity 2D Light System? I know I can choose not to cast light on objects, but when I do it still shows the object in the shadow. What am looking for is hiding the player completely when they are in shadow, and when the light hits them it would reveal the player. This effect is in the game Among Us, I know that they are using some sort of shaders and they didn't have 2D light when they were developing it.
So am assuming this would be a shader as well where it would reveal the player when they are in the light and hide them when they are in the shadow. Below are pictures of what I have and what I want it to look like.
This is what I have in Unity

So you can see that the player is not hidden in the shadows, but rather its blacked out.
But this is what am looking to recreate:

You see how the top half of the body which is in the shadow is hidden while the bottom half is revealed because its in the light? This is the effect that I want to recreate.
Is there some sort of Shader or code that can do this? I really been looking for something like this for so long and couldn't find it. Any help will be really appreciated.

sentences: How can I prevent clicks from going through a GUI.Box? I have a GUI.Box that I slide in from the side of the screen. How can I prevent mouse interaction from going to any objects under it (another GUI.Button for instance, or for that matter an GameObject)?

sentences:
Randomised Path from A to B for cursor movement simulation I'm trying to simulate the movement of the mousecursor, by creating a path from point A to B that has random variation. The algorithm I'm using at the moment is very basic, and is limited in that  it's only really good for creating a path where X and Y distance from the start are the same, forming a square:

The code looks something like this:

   function calcualtePath(from, to)
   {
      var pathNodes = [];
      while (from.x != to.x || from.y != to.y)
      {
         var newTransition = {x: from.x, y: from.y};

         if (Rand(1, 3) != 1 && newTransition.x > to.x)       newTransition.x--;
         else if (Rand(1, 3) != 1 && newTransition.x < to.x)  newTransition.x++;
         if (Rand(1, 3) != 1 && newTransition.y > to.y)       newTransition.y--;
         else if (Rand(1, 3) != 1 && newTransition.y < to.y)  newTransition.y++;

         pathNodes.push(newTransition);
         from = newTransition;
      }
      return pathNodes;
   }

I'd like some assistance in creating is a relatively fast algorithm that creates a randomised path between point A and B, that has a more curve like path and isn't limited like the one above. Ideally something a bit like this, with a pronounced curve:

sentences:
Lost on OpenGL versions, which to start? I was reading about OpenGL, and found out the Red Book is a great book for me to read to learn. I then read that even though they have 3.x and 4.x versions, I should still stick to 2.x so I don't create an artificial limit on who can play my game (older computers with older but powerful graphics cards would not be able to run 3.x and 4.x GL software).

So where do I start? I'm lost. Which book? I have no problem reading the 2.x version of the Red Book, which I believe is this one: http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321335732/ref=sr_1_2?ie=UTF8&qid=1290869828&sr=8-2
but I won't know whats deprecated :(

cry for help

sentences:
How to use Actors/Groups with ShapeRenderer instead of Batch? I am intersted in using Actors and Groups on a Stage so that I can make components and subcomponents which draw relative to their parents, but I intend to do my drawing with a ShapeRenderer instead of a Batch.  From what I understand of an Actor, the batch which is passed in to the draw() method has all of its matrices set up properly so that I can just use a coordinate system WITHIN THE PARENT to lay out the subcomponents.  But it seems that this coordinate system is focused on Batches, and I want to draw using a ShapeRenderer.

What do I have to do to get the child Actors to draw themselves RELATIVE TO THEIR PARENT (rather than in global coordinates) when drawing them with ShapeRenderers?

Also, one other question:  How should I be managing begining/ending the ShapeRenderer?  I am currently passing in a reference to a global ShapeRenderer when I construct my parent object, and this parent object passes in references to each of its children.  Should I be calling begin() end() separately in the draw method of each parent/child actor?  Or should I call it in my main app's draw() method, so I'm only calling it once each frame?

sentences:
RPG - Accuracy Formula (HIT or MISS only) I am creating the combat system of a simple RPG. The only two factors in this system are damage and accuracy.

Accuracy in this game simply means either the attacker HITS or MISSES. There is no partial damage or partial hits. The target has no chance of dodging the attack if the attacker HITS. A player's accuracy is represented with a percentage, e.g. 75% of the time the player will HIT.

In combat, the damage formula determines the damage inflicted on a target, but the damage will only be inflicted if the player HITS the target.

I have already created a damage formula; however, I do not know how to create a simple and practical accuracy formula. I have thought of this, but it's quite impractical because of how it will need to be manipulated if the player's accuracy improves/increases:

An array is filled (Player's accuracy)% with 1's, remaining percent with 0's
At random, one index of the array is chosen
If it's a 1, the player HITS; if it's a 0, the player MISSES

I have looked around this network at accuracy/hit or miss formulas but they involve other factors such as dexterity and evasion. I've also looked elsewhere online, but again the formulas involve other factors.

Is there a simple and practical formula to accomplish this?

sentences:
Transforming position in y-axis (going in the middle) in Unity I am making a 2d game where an object goes up, down or in the middle with given Input.

But when the object goes to the middle with GoMiddle() it starts glitching and it can't go back up or down

Vector2 Pos;
public bool DownKeyPressed = false;
public bool UpKeyPressed = false;
public bool MiddleKeyPressed = false;

// Use this for initialization
void Start()
{

}

// Update is called once per frame
void Update()
{
    Pos = transform.position;

    UMDCOntroller();

    transform.position = Pos;
    print(Pos.y);
}

void GoDown()
{
    if (Pos.y >= 1.2f)
    {
        Pos = Vector2.Lerp(Pos, new Vector2(Pos.x, Pos.y - 1.2f), 0.1f);
    }
    else
    {
        DownKeyPressed = false;
    }

}

void GoUp()
{
    if (Pos.y <= 2.8f)
    {
        Pos = Vector2.Lerp(Pos, new Vector2(Pos.x, Pos.y + 1.2f), 0.1f);
    }
    else
    {
        UpKeyPressed = false;
    }

}

void GoMiddle()
{

if(Pos.y < 2)
    {
        Pos = Vector2.Lerp(Pos, new Vector2(Pos.x, Pos.y + 1.2f), 0.1f);

    }

else if(Pos.y >= 2) {

        Pos = Vector2.Lerp(Pos, new Vector2(Pos.x, Pos.y - 1.2f), 0.1f);

    }
    else
    {

        MiddleKeyPressed = false;
    }

}

void UMDCOntroller()
{

    if (Input.GetKeyDown(KeyCode.S))
    {
        DownKeyPressed = true;

    }

    if (DownKeyPressed)
    {
        GoDown();
        UpKeyPressed = false;

    }

    if (Input.GetKeyDown(KeyCode.D))
    {

        MiddleKeyPressed = true;
    }

    if(MiddleKeyPressed)
    {

        GoMiddle();

    }

    if (Input.GetKeyDown(KeyCode.W))
    {

        UpKeyPressed = true;

    }

    if (UpKeyPressed)
    {

        GoUp();

    }

}

I am asking this question again because I didn't receive an answer

Thanks

sentences:
Direction vector in raycasting When I read about how to get the direction vector in raycasting, for example on this site: http://www.daimi.au.dk/~trier/?page_id=98

They first render the mesh with front face culling and then with back face culling. And then subtract the backface from the front to get at a direction vector for each pixel.

But is this not to much work to get the direction vector, is it not more simpler and faster to just take the vertex position(in world coordinates) and subtract the camera position in the fragment shader to get the direction vector? This should give the exact same answer but we skip the backface and frontface rendering.

sentences:
How to make child transforms honor parent origin I'm working on a 2D transform system that has the following requirements:

Transforms can have children
Transforms have anchor points/origins that offset them
Children should honor the parent's origin for translation
Rotations occur relative to the local origin (i.e. objects rotate
around their origin rather than the parent's)

As an example of what I'm looking for:
- You add red square in the middle of the screen and center its origin
- You add a white square, center its origin, scale it down slightly and make it a child of the red square
- Every frame you rotate both squares by a fixed amount

What you should see is a red square rotating around its center in the middle of the screen and a white square rotating inside the red square.

The way that I'm doing it now is something like this:

c = child;
p = child.parent;
c.local_transform.translate(c.translation);
c.local_transform.rotate(c.rotation);
c.local_transform.scale(c.scale);
c.local_transform.translate(c.origin.inverse());
c.local_transform.translate(p.origin);

c.world_transform = c.local_transform * p.world_transform;

This doesn't fully work however. The red square appears in the center and rotates around its origin but the white square seems to rotate both around its origin AND the world origin (i.e. the top left corner of the window).

What am I missing?

sentences:
How do I implement a fixed delta time step with a SDL_Delay(15ms) precision So I am using SDL2.0 for making a Game Engine.
Where I am having a problem is using SDL_Delay().

SDL_Delay's minimum delay time is 15ms, I've tried everything, and my FPS is Stuck at 64 because of this. I have seen another post about this but it does not seem to answer the question with SDL_Delay.

I can turn on VSYNC, and I Get a fixed 60FPS, Please explain what the SDL Library is doing that I cannot implement Myself?

This is very weird, I dont think I need to post my code for this, the code is not wrong,
Its the SDL_Delay(), wether it be SDL_Delay(1) or SDL_Delay(15) , it will always delay for 15ms, does anyone know a way of fixing this so I can still use SDL_Delay.

I have seen on SDL Documentation they say this is expected, because of OS Scheduling.

Then I read OS Scheduling does this to save power consumption...
I have High Performance turned on my computer, not Power Saver.

Does anyone know a workaround for this? I am very hardheaded and do not want to use VSYNC.

Or I might just have to. LOL Thanks in advance!!

Edit: https://wiki.libsdl.org/SDL_Delay

sentences:
What does "~" in front of a function name inside a class mean? I added a class using the 'add class' item in Visual Studio Express and it generated two functions in the .cpp file with the same names. But the second has the ~ character in front of it.

What does it mean?

sentences:
Storing Tiled Level Data in J2ME game I'm developing a J2ME game which uses tiled backgrounds for the levels. My question is how do I store this tile information in my game. At the moment it is stored as an array; with each number representing a different tile from the tile-sheet. This works well enough, however I don't like the fact that it is 'hard-coded' into the game because (at least in my opinion) it is harder to edit the levels, or design new ones. I was also thinking that it would be difficult if you wanted to add a 'level pack', I'm not sure on how this would be achieved though; it's not something I was planning on doing, I'm just curious.

I was wondering if there was a way I could store level data in some external file and then load this in to the game. The problem is I don't know what the limitations are for J2ME regarding file I/O, can it read in any file like Java? I am aware of the RMS, but from my experience I don't think this would work (unless I am mistaken).

Also, would loading the data in this way be too big a performance hit? Or is there another way I can achieve what I am trying to do. As I said, the way I have it at the moment works fine, and if this is the only viable option then it will suffice.

sentences:
A name that describes this type of turn-based battle system I am thinking of a turn-based battle system that follows this workflow:

While True
  Get next character
  Determine character's action
  Execute action
  Check Battle Status
end

This is a straightforward battle system: there's a queue of battle characters, and on each iteration, it grabs the character at the front of the queue and has it perform an action. Once the action is performed, it gets pushed to the back of the queue.

Everyone gets an equal opportunity to perform an action and it simply rotates through all the participants.

When the loop breaks, end-battle processing occurs (eg: victory, defeat, escape, etc)

Is there a name for this particular type of turn-based battle system?

sentences:
Phaser/HTML5 - Trying to add five instances to a group and display on the screen! just started using Phaser today after seeing Thomas Palef's lessmilk series. I completed PhotonStorm's "Make your first Phaser game" tutorial, and grabbed the skeleton, some CSS, and started to throw together a game. It's pretty barebones right now, but this is what I have.

The issue is that the game doesn't display the additional "orc" units I've requested. I used a for loop to throw five orcs around the map within the specified borders (32 pixels from the outside boundary. I even wrote a check for the x and y of each in the Update() function, but they don't appear at all.

I don't know how to move on from where I am, and I'm not sure that any of what I've written has been written the right way, you know what I'm saying? Thanks.

http://pastebin.com/if2VTq7j

sentences:
LibGDX strange camera behaviour I'm currently doing my final assessment for my study Game Development. I'm currently facing a real weird (maybe explainable) result from my camera.

I just set up my scene with alot of tiles and a character. When I set up the camera's position and direction, I experience something strange. The camera is tilted somewhat, and I can't explain why that is happening.

This is looking pretty good. Except for when I move the camera, the tilting is becoming worse.

Is this behaviour I should expect from the camera?
I made sure the camera is never rotated, is there any possibility the models are slightly rotated?
I use LibGDX with exported FBX files from 3Ds Max, converted to LibGDX's format "G3DB", are there any known issues with that?

sentences: Zoom to mouse cursor DirectX I have a DirectX scene. I want zoom in using mouse wheel to the mouse location. I am able to zoom the view to center of screen but I need to zoom to mouse location. Please suggest how it can be done. Thanks

sentences:
Can a character interact well with surroundings in-game? I don't have any experience in game programming, but I am currently on programming-related degree, although on a different branch to game design.

I thought about how an environment can come more alive with player movement. For example, currently in many games once you hit a wall you would continue walking into that wall in one spot. I wanted to know, if there is a possibility to make interaction instead, etc. program a certain way to push towards the wall and listen, or lean against the wall, depending on joystick feedback. I wanted to push this even further to how player interacts with an object. For example, walking into a chair wouldn't just make the character be stuck on walking into the chair, but also make certain interactions like a strong fall if player runs into it and make the body of the player respond to what's happening as well. A further example would be placing something heavy on a chair for example, like a rock, and then if a player tries to push it requires more force which builds up, makes the chair make heavier sounds, and have the rock slightly rocking with the force.

Is this at all feasible in gaming and doable for a project? I have no experience in games, so it is hard to say what can be realised with today's tools like Unity or Unreal Engine.

sentences:
Splitting a texture atlas into seperate images Possible Duplicate:
  How to decompose sprite sheet

I'm doing a port of an existing game and the designer no longer has all of the original art; he only has the resulting texture atlases he used when developing for iPad.  The tool I'm using won't support these files so I need to break them back out into separate PNG files.

I'm hoping someone knows of a software tool that does this.  PC software would be preferred in this case, but Mac would suffice.

Edit

To add some clarification; these texture atlases are in a simple gridded layout with even distribution and not packed.  No need to tie back to descriptor files; I just need a simple animation splitter type of tool where I can tell it the size of a frame, point it to the image and from that get a set of separate images.

sentences:
How can I make the X button in the Cardboard XDK exit VR mode? When I build a game using Unity 2017.2.0f3 and the Cardboard SDK (using XR settings) and run it on my device, I see two controls overlaid on the screen, a cross and a gear:

Currently, pressing the cross control does nothing. I'd like to make the cross exit VR mode when pressed.

sentences: How does Trine's lighting look so spectacular? Is there some kind of "special" lighting in this scene? I notice that the sun seems to "pop".

sentences:
How can I make natural rain drops on screen? I'm trying to make rain effect drop with metaballs and trail on screen.I find a clue in shadertoy but I didn't understand how implemented:
https://www.shadertoy.com/view/ltffzl
unfortunately it have many math calculations and i can't use it in unity because it produces a lag.obviously I should use textures but how can I have trail effect?!

my idea is using a texture and trail renderer for droping but how can I have metaballs effect?

Update
I could Implement Metaballs by This Article
https://github.com/smkplus/RainFX/tree/master
but I haven't Idea about trail

sentences:
Gamemaker multiplayer using 39dll I am making a gamemaker multiplayer game using 39dll's tcp sockets. As I want to host the server (and my javascript knowledge is a lot better), I use node.js for the server. I have already got gamemaker to connect to the server and send data, but now I have a problem with receiving data. After reading a lot, it seems that I need to do that like so: sock=tcpaccept(global.tcpConnection,1);. If sock is a negative number, the creation of the 'listening' interface failed. It returns me the number -10022. I can not find much information about it, so if anyone knows why this problem occurs and how to fix it would be very nice.

I am just making a normal gamemaker 8.1 game, no HTML5 game (I'd rather script that myself, not with gamemaker as I am really disliking it).

My server code:

var net = require('net');
var server = net.createServer(function(socket){
    console.log('connection made');
    socket.on('data', function(d){
        console.log(d.toString());
        socket.write(d.toString());
    });
    socket.on('error', function(e){console.log(e)});
    socket.on('close', function(){console.log('Socket closed');});
    socket.write('hhhaaannbikbkm');
}).listen(process.env.VCAP_APP_PORT||8080);

GML code (in the game start event):

dllinit(0,true,true);
global.username = get_string("Gebruikersnaam:","");
global.serverip = get_string("Server IP:","127.0.0.1");
global.serverport = get_integer('port', 8080);

global.tcpConnection = tcpconnect(global.serverip, global.serverport, 1);
setformat(2, '<!SEP!>');
if(!tcpconnected(global.tcpConnection)){
    show_message("Connection failed");
    game_end();
} else {
    setnagle(global.tcpConnection,1);
    clearbuffer();
    writestring(global.username, false);
    sendmessage(global.tcpConnection, 1, 1);
    while(true){
        var sock, size, cnt;
        sock=tcpaccept(global.tcpConnection,1);
        show_message(sock);
        //if (sock <=0) break;
        setsync(sock,0);//block untill new package
        size = receivemessage(sock, 0);
        show_message(size);
        //setsync(sock,1);//unblock socket
        cnt = readstring(0, '<!SEP!>');
        if(cnt!=''){
            show_message(cnt);
            clearbuffer();
            writestring(cnt, false);
            sendmessage(global.tcpConnection, 1, 1);
        }
    }
}

sentences:
Impact of increasing physics simulation rate I am working one Mini Golf game development using Scenekit (iOS). To fix one of the problem with Scenekit, I have to increase the physics simulation rate by 4 times.

Questions:

What is the impact on the CPU requirements?
What are the common advantages and disadvantages of changing the physics simulation rate?
What are the expected problems/issues with such increase in the physics simulation rate?

I would appreciate any suggestion on this topic. Thank you.

sentences:
Pass information between states in slick 2d? I am making simple game in java using Slick 2d. My question is how many ways of passing information between states are available in Slick 2d. I am having a Hero class that holds all the hero stats and carry them between states using Singleton pattern- aka creating a single instance of the object and accessible from everywhere . Are there any possible solutions and workarounds ? Some XML-alike solutions ? Is there DB option ? Is it worth the effort ?

[Edit] Put it simple I want instance of my class hero to be accessible from every state. For example my hero goes to the market and buys some armor.  That should change his stas in all states. My question was if there is another way to do that like storing the hero stats not in a class but a XML or data base.

sentences:
Attach Transform to another GameObject The scenario I am trying to accomplish is attaching a turret to a mount point on a ship.  I have gotten as far as bringing in the prefab and assigning it as a child object with the following code:

GameObject leftFixedGun = (GameObject)MonoBehaviour.Instantiate(Resources.Load("Laser Fixed Gun"), leftMountPoint.position, leftMountPoint.rotation);
leftFixedGun.transform.parent = player.transform;

The problem is, it takes on the rotation of the mount point object, obviously, which isn't exactly what I'm going for.

I have a couple ideas of how to fix this problem, but would really like it to be a different solution all together.

My idea to fix this problem would be to rotate the transform at leftGunMountPoint in order to align the attached gun correctly.

The ideal solution, and the one I would like help with, would to be to align a local mountPoint transform I have under the leftFixedGun to a leftGunMountPoint under the  ship I am trying to attach the gun to.

I hope this makes sense, and if it doesn't please feel free to leave questions in the comments.  Also, please let me know if I am going about this completely wrong =)

Thanks!

EDIT:

Thanks to the answer, and if anyone else is wondering about this, easiest way to accomplish this is as follows:

Create a transform, and line it up with where you want to place the item trying to be mounted.
The following code attached the gun as I wanted.

GameObject laserFixedGun = (GameObject)MonoBehaviour.Instantiate(Resources.Load("Laser Fixed Gun"), leftMountPoint.position, leftMountPoint.rotation);
laserFixedGun.transform.parent = player.transform;

sentences:
How to extract euler angles from transformation matrix? I have a simple realisation of entity/component game engine.
Transform component have methods to set local position, local rotation, global position and global rotation.

If transform is being set new global position, then local position also changes, to update local position in such case I'm just applying current transform local matrix to parent's transform world matrix.

Until then I have no problems, I can get updated local transform matrix.
But I'm struggling on how to update local position and rotation value in transform.
Only solution I have in mind is to extract translation & rotation values from localMatrix of transform.

For translation it's quite easy - I just take 4th column values.
but what's about rotation?
How to extract euler angles from transformation matrix?

Is such solution right?:
To find rotation around Z axis, we can find difference between X axis vector of localTransform and X axis vector of parent.localTransform and store result in Delta, then:
localRotation.z = atan2(Delta.y, Delta.x);

Same for rotation around X & Y, just need to swap axis.

sentences:
Rotating kinematic object around a moving point Box2D I'm new at Box2D and I am making a simple game where you control the rotation of the maze and the gravity leads the ball to the exit.

The game looks like:

The problem: I want to rotate the maze, and I'm doing it well. It is a kinematic object, so it will only move when I want. But it always rotate on a static pivot, I think that's it's center of mass. Rotating the maze, the ball hits the walls and when too further to the center, it becomes hard to control the movement of the ball by rotating the maze as the centrifugue force is too high for the ball.

What I want: I want to change the maze's rotation pivot to the ball's position, every game loop/frame, so it will rotate around the ball always and I will be able to use only gravity, not centrifuge forces, to lead the ball to the exit.

What I tried: I already tried to find a function to change the pivot center, or the center of mass, but I only found to change the mass proprieties. It changes the center of mass only if it was a dynamic body. Even the kinematic body having the same localCenter.x and localCenter.y proprieties as the dynamic body, it remains on (0.0 ,0.0) when trying to change it. And when changing the localCenter on the dynamic body, it doesn't rotate at this point anyway, so I'm not sure what to do.

Is there any possibility to change the center of the kinematic body all the time? I'm using Box2D Vestion 2.3.2, as you can see on the picture, and Visual Studio 2013 with OpenGL.

Thanks!

sentences:
Rendering skybox in first person shooter I am trying to get a skybox rendered correctly in my first person shooter game. I have the skybox cube rendering using GL_TEXTURE_CUBE_MAP. I author the cube with extents of -1 and 1 along X,Y and Z.

However, I can't wrap my head around the camera transformations that I need to apply to get it right. My render loop looks something like this:

mp_Camera->ApplyTransform() :: Takes the current player transformation and inverts it and pushes that on the modelview stack.
Draw GameObjects
Draw Skybox

DrawSkybox does the following:

glEnable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_FALSE);

// draw the cube here with extents

glDisable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_TRUE);

Do I need to translate the skybox by the translation of the camera ? (btw, that didn't help either)

EDIT: I forgot to mention: It looks like a small cube with unit extents. Also, I can strafe in/out of the cube.
Screenshot:

sentences:
Change collision action I have a collision detection and its working fine, the problem is, that whenever my "bird" is hitting a "cloud", the cloud dissapers and i get some points. The same happens for the "sol" which it should, but not with the clouds.

How can this be changed ? ive tryed a lot, but can seem to figger it out.

Collision Code

- (void)update:(ccTime)dt {
    bird.position = ccpAdd(bird.position, skyVelocity);

    NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init];
    for (CCSprite *bird in _projectiles) {
        bird.anchorPoint = ccp(0, 0);
        CGRect absoluteBox = CGRectMake(bird.position.x, bird.position.y, [bird boundingBox].size.width, [bird boundingBox].size.height);

        NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
        for (CCSprite *cloudSprite in _targets) {
            cloudSprite.anchorPoint = ccp(0, 0);
            CGRect absoluteBox = CGRectMake(cloudSprite.position.x, cloudSprite.position.y, [cloudSprite boundingBox].size.width, [cloudSprite boundingBox].size.height);

            if (CGRectIntersectsRect([bird boundingBox], [cloudSprite boundingBox])) {
                [targetsToDelete addObject:cloudSprite];

            }
        }

        for (CCSprite *solSprite in _targets) {
            solSprite.anchorPoint = ccp(0, 0);
            CGRect absoluteBox = CGRectMake(solSprite.position.x, solSprite.position.y, [solSprite boundingBox].size.width, [solSprite boundingBox].size.height);

            if (CGRectIntersectsRect([bird boundingBox], [solSprite boundingBox])) {
                [targetsToDelete addObject:solSprite];
                score += 50/2;
                [scoreLabel setString:[NSString stringWithFormat:@"%d", score]];
            }
        }

        // NÅR SKYEN BLIVER RAMT AF FUGLEN
        for (CCSprite *cloudSprite in targetsToDelete) {
            //[_targets removeObject:cloudSprite];
            //[self removeChild:cloudSprite cleanup:YES];
        }

        // NÅR SOLEN BLIVER RAMT AF FUGLEN
        for (CCSprite *solSprite in targetsToDelete) {
            [_targets removeObject:solSprite];
            [self removeChild:solSprite cleanup:YES];

        }

        if (targetsToDelete.count > 0) {
            [projectilesToDelete addObject:bird];
        }
        [targetsToDelete release];
    }

    // NÅR FUGLEN BLIVER RAMT AF ALT ANDET
    for (CCSprite *bird in projectilesToDelete) {
        //[_projectiles removeObject:bird];
        //[self removeChild:bird cleanup:YES];
    }
    [projectilesToDelete release];

}

sentences:
Creating texture and palette modification I need to create a texture from a surface with indexed color palette and alter the colors. However, after I set new colors, the rendered texture gets blank.

int main(int argc, char** argv)
{
    init();

    gSurface = TTF_RenderText_Solid(gFont, "text", fg1);

    // text is rendered properly, without following line
    SDL_SetPaletteColors(gSurface->format->palette, &fg2, 1, 1);

    gTexture = SDL_CreateTextureFromSurface(gRenderer, gSurface);

    SDL_SetRenderDrawColor(gRenderer, 255, 255, 255, 255);
    SDL_RenderClear(gRenderer);

    SDL_RenderCopy(gRenderer, gTexture, NULL, NULL);
    SDL_RenderPresent(gRenderer);

    SDL_Delay(1000);

    quit();
}

I tested this code with software rendering using window surface instead of renderer and pallete changing worked.
Could someone explain me why does it happed and how to fix it?

sentences:
Slowdown in sliding background with Libgdx I´m new with libgx and i have a basic question. I want an background like an image that repeats indefinetely, and moves down. I did with 2 images and it worked, but the problem is that is very slow. I stored the images with 512x512px. My code is very simple but i dont know what im doing wrong.

public void render() {
   Gdx.gl.glClearColor(0, 0, 0.2f, 1);
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   offset -= 600 * Gdx.graphics.getDeltaTime();
   offset = offset % 512;
   camera.update();
   batch.setProjectionMatrix(camera.combined);
   batch.begin();
   batch.draw(backgroundImage, 0, offset);
   batch.draw(backgroundImage, 0, offset + 512);
   batch.draw(bucketImage, 0, offset + 1024);
   batch.end();
}

Any suggestions will be appreciated Thanks a lot!

sentences:
(GLSL) Lighting code outputting a black quad So, ive been transitioning to modern opengl recently and it's going rather well. But alas, something must go wrong. As the titel says, all I'm getting is a completely black quad. (Ive double checked my C++ code and I'm pretty sure it has nothing to do  with that.)

#version 330 core

//Vertex shader

layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexColor;
layout(location = 2) in vec2 vertexUV;
layout(location = 3) in vec3 vertexNormal;

out vec3 vertNorm;
out vec3 fragmentColor;
out vec3 vertPos;
out vec2 UV;

uniform mat4 MVP;

void main(){
    gl_Position =  MVP * vec4(vertexPosition_modelspace,1.0f);
    UV = vertexUV;
    fragmentColor = vertexColor;
    vertPos = vertexPosition_modelspace;
    vertNorm = vertexNormal;
}

//Fragment shader
#version 330 core

in vec3 Normal;
in vec3 fragmentColor;
in vec3 vertPos;
in vec2 UV;

out vec3 color;

uniform sampler2D textureSampler;
uniform mat4 Model;

void main(){
    vec3 lightPos = vec3(0, 0, 0);
    mat3 normalMatrix = transpose(inverse(mat3(Model)));
    vec3 normal = normalize(normalMatrix * Normal);
    vec3 fragPosition = vec3(Model * vec4(vertPos, 1));
    vec3 surfaceToLight = lightPos - fragPosition;

    float brightness = dot(normal, surfaceToLight) / (length(surfaceToLight) * length(normal));
    brightness = clamp(brightness, 0, 1);

    color = vec3(brightness * 1 * (texture(textureSampler, UV).rgb * fragmentColor));
}

But if you require my c++ code, say so and ill edit.

sentences:
Least expensive way to build a forest in Unity3D? I'm a programmer with some experience in Unity. My objective is to make a game (or maybe just a virtual space you can walk around in First Person perspective) featuring a forest and to make it look as good as I can (probably using HDRP to try and exploit all its potential) through the use of lighting and shaders. I will be using assets from the Asset Store to fill my scene.

I have a little bit of experience with the official Unity terrain tools but I have available the Gaia asset, which I have never used but have heard plenty of good things about it. What would be the advantages of using the Gaia terrain generator over Unity official tools?

I think both Unity Terrain Generator as well as Gaia have the ability to instantiate trees, maybe Gaia has more included assets to use and fill the environment? If so, would this assets be part of the terrain or would they be considered GameObjects? All of this I ask with optimization in mind (culling, LODs).

Anyway, I'd appreciate any tips for making (and optimizing) this sort of environment, as well as advice regarding what kind of Terrain tools to use to make it.

Thanks a lot.

sentences:
CPU usage, game loop and sleep() I've read about this topic on numerous discussion sites, but I can't seem to find a clear definitive (up-to-date) answer, and hopefully this will me some more insight:

I've read the excellent game loop time article on Fix your timestep!, but it dosn't take any consideration of the CPU usage, so it will run at 100%. My question then, is it BAD to run at 100% CPU in your game loop?

If no, why? for example what about gaming on battery-driven devices like laptops? what about computer temperatures/fans/etc, and other windows applications?
If yes, why dosn't the article mention it, because surely that would impact it significantly? what is the best way to fix this on desktops/PC - is there only the unreliable sleep()? How would it affect the game loop suggested by the article?

sentences: Make my Character face the same way as my Camera as I rotate the camera Before posting, I've already tried parenting the camera to the Character mesh head and setting controller yaw, that didn't work, in fact it invalidated my blueprint to set my Mouse X and Y for the pitch and yaw that allowed me to move my camera in the first place. So I need a different method to make my character follow the way my camera is facing whenever I rotate, otherwise when I turn around I just face my Character.

sentences:
Usage of render states in Direct3D 11.x? I know there are four different render states. They are

Blend State
Depth Stencil State
Rasterizer State
Sampler State

One of my Direct3D reference books say that Direct3D is a state machine.
But how, where do we use these in game development?

sentences:
LibGDX - Rotating sprites and still keep the positioning between them I've been struggling with a problem regarding rotations and relative positions between sprites (in this case, the sprites are just lines) - a bit off-topic, but should i be using the ShapeRenderer class to do this, though?

Anyway, it might be quite simple but i can't seem to figure it out properly. Heres a picture of the situation: https://gyazo.com/78988e07991fedc778eaeb70f8a04d8e

Now, after trying a bunch of different approaches, this piece of code is the one i'm testing right now:

`   public class TestState extends AbstractGameState {

private static final String LINE = "lineEffect.png";

private Sprite[] sprites;

public TestState(GameStateManager gsm) {
    super(gsm);

    sprites = new Sprite[2];
    for (int i = 0; i < 2; i++) {
        sprites[i] = new Sprite(new Texture(LINE));
        // both lines starting at the same X and Y
        sprites[i].setPosition(20, 50);
        // both lines have the same size
        sprites[i].setSize(100, 2);
        // guess i might be messing up here
        sprites[i].setOrigin(sprites[i].getX(), sprites[i].getY());
    }

    // for testing purposes
    sprites[0].setRotation(-20);
    sprites[1].setRotation(45);
}

@Override
public void render(SpriteBatch batch) {
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    for (Sprite sprite : sprites)
        sprite.draw(batch);
    batch.end();
}`

Any help on this would be appreciated, thanks in advance.

sentences:
Finding the Dimension of OBJ objects I am having a Three OBJ file , Cone , Sphere and Cube. How can i find the dimension of these objects , so that i can use it in my collision detection class.

i.e How can i find Radius , Length of Cube and Radius and Height of cone.
Or is there any better way for collision detection , I have Hundreds of random particle in my game which may or maynot collide with these objects.

sentences:
When should I decide what language and platforms I will use for a project? During your development process, when is the recommended phase to decide what platform to aim for, and what language to use?

I figured that it would be better to choose at the beginning what would be your target platform, as it would affect your design decisions, and limit the language you are supposed to use.

However, I have heard several stories of people developing their game with whatever language they were the most confident with, and then porting it to the various platforms.

So, what is the best moment to choose? Before, during, after? If there is not one best choice, what factors should affect the decision?

sentences: lwjgl request display close when undecorated I want to create a custom titlebar/border for my display/window so I set the corresponding system property to "true" but how do I send a close request to the window manually to react to the Display.isCloseRequested()?

sentences:
What are the legal considerations about making a game with a dynamic age restricted content? What I mean by this is - is it legal to make a game which asks (or proves) your age during install or on initial load, and then dynamically sets the content to the players age.
For example if the players is under-age then all swear word assets are replaced with there PG13 equivalents.
Or the same with blood and gore.

Does this make sense?
Also what are the communities opinions or feelings about this?
(note for locality I am referring to UK law but laws and opinions for any other country is encouraged!)

(ps i can't create tags)

sentences:
Ball bouncing with box2d in libgdx I just started using Box2d and libgdx. I followed this tutorial, https://github.com/libgdx/libgdx/wiki/Box2d
And a ball would bounce if I run the following code I took from the tutorial.

// ...omit the rest of code
World world = new World(new Vector2(0, -10), true);
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DynamicBody;
bodyDef.position.set(100, 300);
Body body = world.createBody(bodyDef);
CircleShape circle = new CircleShape();
circle.setRadius(6f);
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = circle;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.4f;
fixtureDef.restitution = 0.6f; // Make it bounce a little bit
Fixture fixture = body.createFixture(fixtureDef);
circle.dispose();
// ...omit the rest of code

I'm wondering how I can make the ball bounce like a basketball or volleyball? It's like the ball movement is in a space, move so slowly. I changed some properties such as density or friction, but it seems box2d doesn't care of air friction, so nothing changed at all. Could you tell me how I can make the ball movement to be a basketball or such stuff?

sentences:
Unity 5/C#/Scripting Switching Cameras How can I switch cameras from First Person to Third person or from thrid person to first person. Like at GTA V you can switch the cameras. How to do this?

Tnx for your time.

sentences:
Implementing priority structure into a behavior tree, to react to player actions My goal is to have a behavior tree that can run alone (autonomously) but also react to input from the player.
I'm making an AI for a hack and slash game where the AI will fight you, chase you, etc. and play defensive based on certain stats (health etc), but I want to add an additional layer; events from player. Say the player attacks, I want a random chance maybe 5-10% to trigger a dodge or step-back from the AI.
Currently I have its own selector running, but that is not sufficient, as it just has same priority or triggers on the same level as the other selectors / sequences in the tree. So how do I go about implementing a priority into the tree?
I want to have dodge, which should be labelled as maybe priority 1 if the event triggers, else it should just go about its usual business.

sentences:
Android Dynamic 2D Map My problem is, I want to create a 2D tiled map. Yes, I know it's been asked a lot. I've seen answers that propose the use of tiled however it only allows (or so it seems to me) to generate static maps that do not change once generated. And I need a large empty uniform space of empty tiles, upon which players may place various buildings (some spanning more than one tile and logically being the same one).

How to approach this in Android? Do I make some kind of TableLayout, use arbitrarly large amount of rows and imageviews (with my emptyTile), than somehow work event-based changing of image ids from there? I'd think that only a portion of that map should be visible at a time, but I don't see how scrolling around could be the part of that structure.

sentences:
ELO Rating System & Multiple Games Against the Same Player I've decided to use the ELO rating system for my chess-like strategy game.

I've implemented the algorithm but I don't really understand it completely (I'm not a maths person)...

I've decided to give starting rank of 1000 for new players, and I use 32 as max increase.

Now for my actual question:

Let's say that player A plays hundreds of games against player B, and player A is much better player (or player A has created a dummy account so that he cheats!).

Do I need to take this in account in any way "manually" or does ELO handle this "automatically"? I mean, ultimately the difference between the two players will be so great that the "cheater" gets only +1 to his rank? So he would possibly have to play LOTS of games to cheat/climb up the ladder this way? Am I correct?

I REALLY wouldn't want to disallow the ladder system completely for friend vs friend (invited matches). And I shouldn't need to: even www.chess.com handles this in some way.

sentences:
Best Way to Create A Map for a 2D Game? I apologize for the subjective "best" keyword.

My friend and I have started creation of a 2D adventure game. It will be top-down in the style of pokemon or zelda (just the perspective). We have been discussing methods of creating a large world-map that the player can traverse without straining the memory capabilities of our machine.

Our first impulse was to create a large map and a circle around the player in which content will be loaded. We figured this won't hold for long and decided to partition the map into sections. First we had four large sections, but realized we could simply break it down into many tiny sections.

I played some Zelda from the SNES and saw that, during the shift of a map, the content could be loaded just then. What I mean is, instead of just checking a rectangular area for data to load, we simply section the map into many tiny chunks that load and de-load data as we move from map-portion to map-portion.

Today, he told me he wanted to create a simply 2D array map[WIDTH][HEIGHT] that contains data about every grid in the game and is a constant save-to-disk operation for data that we don't need.

I'm not sure about these ideas and thought that I might as it here. Any links, resources or tutorials on the subject would be greatly appreciated as well as direct answers to our question on how to do it efficiently.

sentences:
Can you achieve a non-square look with tiles or a similar technique? Just to explain the kind of look that is refered to in the question, it is apparent in the game Toejam and Earl 2.

Not asking how this was made but would like to know how you could efficiently blit a level design that isn't made or doesn't appear to look like easily identifiable square tiles. Another example for a "non-blocky" world would be worms but that looked more like a bitmap which sounds like it would require a lot of memory and could potentially limit the game world size.

sentences:
Can't edit specific variables from the inspector panel, while variable is static In order to make the variable accessible from other classes, I have to make it static.

When I make it static, I can't edit it from the Unity's Inspector panel.

No way to be able to do both: accessible and editable from the panel?

EDIT:

This is the code so far (by following Savlon's idea)

BouncingBall.js

#pragma strict

public static BouncingBall instance;
public var velocityX : float = 1;
public var velocityZ : float = -1;

function Awake(){
    instance = this;
}

function Update () {

    transform.Translate(new Vector3(velocityX, 0, velocityZ) * Time.deltaTime);

    if (this.transform.position.x > 4.5){
        velocityX = -velocityX;
        this.transform.position.x = 4.49;
    }
    if (this.transform.position.x < -4.5){
        velocityX = -velocityX;
        this.transform.position.x = -4.49;
    }
    if (this.transform.position.z > 4.5){
        velocityZ = -velocityZ;
        this.transform.position.z = 4.49;
    }
    if (this.transform.position.z < -4.5){
        velocityZ = -velocityZ;
        this.transform.position.z= -4.49;
    }
}

function OnCollisionEnter(col : Collision){
    if(col.gameObject.name == "PlayerPad"){
        velocityZ = -velocityZ;
    }
}

brick.js (where I call the variable from)

#pragma strict

function OnCollisionEnter(col : Collision){

    if(col.gameObject.name == "Ball"){
        BouncingBall.instance.velocityZ = -BouncingBall.instance.velocityZ;
        Destroy(this.gameObject);
    }
}

sentences:
Can we use credit card/prepaid voucher payment systems in Android and iOS? We already have a credit card gateway with a local bank. We also have a prepaid card voucher in the market.

In our game, a user will create an account within our portal. The user will "recharge" his account via credit or prepaid (voucher) cards. Then the user will buy services and subscriptions.

My question is: can I put our credit and prepaid card gateway in our Android and iOS apps in order to recharge a user account that belongs to our portal?

sentences:
Can Soomla directories be safely moved one directory down in Unity? I'm integrating in-app purchases in my game. To do so, I chose to use Soomla (http:soom.la) asset. I use the free version registering for the grow bundle. I've downloaded a unitypackage named unity3d-grow-spend from my grow web console.

When I'm going to import the unitypackage I find that it wants to import things in a variety of top-level directories, like:

/GROW/*
/Plugins/Android/*
/Plugins/GROW/*
/Plugins/iOS/*
/Plugins/Soomla/*
/Plugins/WP8/*
/Soomla/*
/WebPlayerTemplates/SoomlaConfig/*

All this installs inside my /Assets directory.

The thing is that in my assets I only have

/Assets/Scenes
/Assets/Plugins

and I do not want pollution in there.

Question:

Is it safe to move /Assets/GROW into /Assets/Vendor/GROW and move Soomla and WebPlayerTemplates also into the Vendor directory?

Or doing that movement some in-app purchases mechanism will fail?

This would result in having only

/Assets/Scenes
/Assets/Plugins
/Assets/Vendor

in the top-level, which is rather nice.

sentences:
How do i manage skill collision target in Unity? I wanted to make a skill that can be used by both Player & Enemy.

How do I make it such that the skill will not be colliding with the owner/caster or colliding with both?

One stupid way I have is to create empty gameObjects as the Skill's child and set their tag as "targetPlayer","targetEnemy" or "targetAll" whenever my player/enemy cast the skills.

And when the skill collided with Player/Enemy, i will check the skill's children and see if there's matching tag and proceed if so.

Is there better way to do what i wanted??

sentences: How to achieve graphics like those in Spy Mouse I'm really interested in making a new application for iPhone, and I have some experience in objective-c. My main problem is the visual part. I want to have graphics like in Spy Mouse. Could this be achieved using simple 2D graphics? Or would I need to use 3D, and just show it from this perspective?

sentences:
How to get interior uniform lightning? I'm trying to reach uniform lighting as in this image.
This scene i've bought is rendered with 3ds and v-ray (i suppose).

This is the same scene i've imported in Unity.

I've put a "big" point light on top of my room, i've added also directional light and a Reflection Probe.

This is my (unsatisfactory) result:

This is my baking settings:

Do you have some advice to improove my Unity lightining as the first scene ?

Thanks

sentences:
OpenGL position from depth is wrong My engine is currently implemented using a deferred rendering technique, and today I decided to change it up a bit.
First I was storing 5 textures as so:
DEPTH24_STENCIL8  - Depth and stencil
RGBA32F           - Position
RGBA10_A2         - Normals
RGBA8 x 2         - Specular & Diffuse
I decided to minimize it and reconstruct positions from the depth buffer. Trying to figure out what is wrong with my method currently has not been fun :/
Currently I get this:

which changes whenever I move the camera... weird

Vertex shader
really simple
#version 150

layout(location = 0) in vec3 position;
layout(location = 1) in vec2 uv;

out vec2 uv_f;

void main(){
    uv_f = uv;
    gl_Position = vec4(position, 1.0);
}

Fragment shader
Where the fun (and not so fun) stuff happens
#version 150

uniform sampler2D depth_tex;
uniform sampler2D normal_tex;
uniform sampler2D diffuse_tex;
uniform sampler2D specular_tex;

uniform mat4 inv_proj_mat;
uniform vec2 nearz_farz;

in vec2 uv_f;

... other uniforms and such ...

layout(location = 3) out vec4 PostProcess;

vec3 reconstruct_pos(){
    float z = texture(depth_tex, uv_f).x;
    vec4 sPos = vec4(uv_f * 2.0 - 1.0, z, 1.0);
    sPos = inv_proj_mat * sPos;

    return (sPos.xyz / sPos.w);
}

void main(){
    vec3 pos = reconstruct_pos();
    vec3 normal = texture(normal_tex, uv_f).rgb;
    vec3 diffuse = texture(diffuse_tex, uv_f).rgb;
    vec4 specular = texture(specular_tex, uv_f);

    ... do lighting ...

    PostProcess = vec4(pos, 1.0); // Just for testing
}

Rendering code
probably nothing wrong here, seeing as though it always worked before
this->gbuffer->bind();
gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);

gl::Enable(gl::DEPTH_TEST);
gl::Enable(gl::CULL_FACE);

... bind geometry shader and draw models and shiz ...

gl::Disable(gl::DEPTH_TEST);
gl::Disable(gl::CULL_FACE);
gl::Enable(gl::BLEND);

... bind textures and lighting shaders shown above then draw each light ...

gl::BindFramebuffer(gl::FRAMEBUFFER, 0);
gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);

gl::Disable(gl::BLEND);

... bind screen shaders and draw quad with PostProcess texture ...

Rinse_and_repeat(); // not actually a function ;)

Why are my positions being output like they are?

sentences:
Hidden copies of the environment in an entity component system For reasons outside the scope of this question, my game has several full copies of the game environment running asynchronously. At any one time, only one of these is rendered.

This is trivial to support in a traditional, object-oriented architecture. Instantiate a few copies of the environment, run each one in its own thread (I actually use a parallel task system for cases where there are more environments than CPU cores), and only call call draw() on the one you want rendered.

The time for large refactorings has come, and I'm considering converting to an entity component system such as Entt. What would be the best way to achieve this same functionality?

The best I've come up with is each environment being a self-contained ECS, managed by an object-oriented system (which would also handle things not replicated, such as UI). The render system would be disabled in all environments except the one being rendered.

I don't like that solution though. I don't want the render system for the game environments to be separate from that of the UI, etc. I also don't like the idea of mixing ECS and object-oriented architectures.

Is there a better solution?

sentences:
How to start simple game development with Unity 5 I want to start developing games with Unity because it's easy to learn, but I don't know where to start.

My questions are:
- Which preparations should I make for a game?
- Are there any tips and tricks for efficient work?
- Do I need special equipment?

Thank you for your response!

sentences:
More Efficient Data Structure for Large Layered Tile Map It seems like the popular method is to break the map up into regions and load them as needed, my problem is that in my game there are many AI entities other than the player out performing actions in virtually all the regions of the map. Let's just say I have a 5000x5000 map, when I use a 2D array of byte's to render it my game uses around 17 MB of memory, as soon as I change that data structure to a my own defined MapCell class (which only contains a single field: byte terrain) my game's memory consumption rockets up to 400+ MB. I plan on adding layering, so an array of byte's won't cut it and I figure I'd need to add a List of some sort to the MapCell class to provide objects in the layers. I'm only rendering tiles that are on screen, but I need the rest of the map to be represented in memory since it is constantly used in Update.

So my question is, how can I reduce the memory consumption of my map while still maintaining the above requirements? Thank you for your time!

Here's a few snippets my C# code in XNA4:

public static void LoadMapData()
    {
        // Test map generations
        int xSize = 5000;
        int ySize = 5000;
        MapCell[,] map = new MapCell[xSize,ySize];
        //byte[,] map = new byte[xSize, ySize];

        Terrain[] terrains = new Terrain[4];
        terrains[0] = grass;
        terrains[1] = dirt;
        terrains[2] = rock;
        terrains[3] = water;

        Random random = new Random();

        for(int x = 0; x < xSize; x++)
        {
            for(int y = 0; y < ySize; y++)
            {
                //map[x,y] = new MapCell(terrains[random.Next(4)]);
                map[x,y] = new MapCell((byte)random.Next(4));
                //map[x, y] = (byte)random.Next(4);
            }
        }

        testMap = new TileMap(map, xSize, ySize);
        // End test map setup

        currentMap = testMap;
    }

public class MapCell
{
    //public TerrainType terrain;
    public byte terrain;

    public MapCell(byte itsTerrain)
    {
        terrain = itsTerrain;
    }

    // the type of terrain this cell is treated as
    /*public Terrain terrain { get; set; }

    public MapCell(Terrain itsTerrain)
    {
        terrain = itsTerrain;
    }*/
}

sentences:
How do I determine a good path for 2D artillery projectiles? I'm building a little "tank wars" game (like this one).

I understand the math, and I am able to define a parabola from the launcher to the objective I want to reach. The parabola depends on the projectile's initial angle and velocity. I don't really know how to find a good path that "fits" in the screen most of the time.

As an example: I started with a velocity of 100 in a level I created and the projectile was sent far far away upwards and took a long time to hit the target. On the other hand I would like to add some obstacles to each level for example a wall between both tanks with a hole in the middle where projectiles must fly through to damage the other tank.

Questions:

To get a valid path that mainly stays on screen, I think I could play with the maximum height of the projectile. How do I relate angle/initial velocity to maximum given height?
How can I make the computer tank scan obstacles on screen and find a path to the player? (For example, a wall with a hole in the center between them.)

sentences:
Super mario bros "rounded" tile collision detection I'm working on a Mario bros clone with SDL and C++ (purely for educational porpuses / and for fun)
I got collision detection working by using AABB collision detection and resolving one axis at a time:

Check collision with X-axis first
Move entity if not collision is detected
Check collision with the Y-axis.
Move entity if not collision is detected

This is working great!
However, one thing that I really like about the original Mario bros is that tiles have some kind of "rounded" feel to them. I think this helps make the map feel more organic, see how Mario moves left when jumping on a corner in the original SNES game:

I thought of using a circle collider for mario instead of an AABB.
This would make Mario "fall" off the tiles if you step too close to the edges. But perhaps someone knows a better approach. I've been thinking about collision detection for longer than I'd like to admit.
I'd love to know if someone has a clean aproach to accomplish what the GIF shows.

sentences:
Can't change the textures of a .FBX or an .X exported from 3dsmax I created a model (real simple) in 3DSMax 2010, exported it to FBX format and loaded it in an XNA 4.0 content project. I also tried with .X files using kW X-port and it has the same behavior.

I can load the model in a game, and it has it's 3DSMax texture. I can't however change the texture of a face (or all) at runtime. When I do this, it doesn't crash or anything, it just doesn't apply the textures.

I've tried with a sample model from a microsoft creative tutorial (the famous spaceship one) and on that model, with my texture, it works. This is why I think my model isn't working properly.

Anyone care to comment/help?

Note: Even though I don't think the problem is there since I've made it work with another model, here is my LoadContent method to load the model and change the texture of all mesh :

protected override void LoadContent()
{
    base.LoadContent();

    ContentManager contentManager = new ContentManager(Game.Services, "Content");

    Model = (Model)contentManager.Load<Model>(ModelName);
    Texture = (Texture2D)contentManager.Load<Texture2D>(TextureName);

    foreach (ModelMesh mesh in Model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.Texture = Texture;
        }
    }
}

sentences:
libGDX application does not support 800x480 resolution I have an application written with libGDX that does not run with a resolution of 800x480, whereas on devices with other resolutions (e.g. 480x320) it works perfectly. It also works perfectly as a desktop application with a resolution of 800x480.

In onCreate() method I only have this code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        initialize(new BreakTheBall(), false);
}

So what do I have to do to have it work in a resolution of 800x480?
I have to ask this question because my samsung galaxy sx2 display only blank screen at the time of game execution but emulator work perfectly. I also want to said that all the given demo application by libGDX could not run on the same device resolution.

Also I like to mention the base class of my project which specify about stage, camera and viewport declaration

protected BreakTheBall game;
protected Stage stage;
protected World world;
protected OrthographicCamera camera;
protected Preferences preferences;
protected ArrayList<Obstacles> boxArrayList;
protected ArrayList<BlastBall> blastBallArrayList;

private static final int VIRTUAL_WIDTH = 480;
private static final int VIRTUAL_HEIGHT = 320;
private static final float ASPECT_RATIO = (float) VIRTUAL_WIDTH
        / (float) VIRTUAL_HEIGHT;
private Rectangle viewport;

// protected Box2DDebugRenderer renderer;

public AbstractScreen(BreakTheBall game) {
    this.game = game;

    Texture.setEnforcePotImages(false);
    stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(),
            false);

    Constant.setStageRatio(stage.width(), stage.height());

    world = new World(new Vector2(0.0f, 0.0f), false);
    // camera = new OrthographicCamera(Gdx.graphics.getWidth() / 10.0f,
    // Gdx.graphics.getHeight() / 10.0f);
    camera = new OrthographicCamera((float) VIRTUAL_WIDTH / 10.0f,
            (float) VIRTUAL_HEIGHT / 10.0f);

    // camera.position.scale(0.0f, 0.0f, 0.0f);

    // renderer = new Box2DDebugRenderer(true, false, false);
    Gdx.input.setInputProcessor(stage);

    preferences = new Preferences();
}

@Override
public void render(float deltaTime) {
    GL10 gl = Gdx.graphics.getGL10();

    camera.update();
    camera.apply(gl);

    gl.glClearColor(0f, 0f, 0f, 1f);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    gl.glViewport(0, 0, (int) viewport.width, (int) viewport.height);

    world.step(1 / 60f, 3, 3);
    world.clearForces();

    stage.act(deltaTime);
    stage.setCamera(camera);
}

@Override
public void resize(int width, int height) {

    float aspectRatio = (float) width / (float) height;
    float scale = 1f;

    Vector2 crop = new Vector2(0f, 0f);

    if (aspectRatio > ASPECT_RATIO) {
        scale = (float) height / (float) VIRTUAL_HEIGHT;
        crop.x = (width - VIRTUAL_WIDTH * scale) / 2f;
    } else if (aspectRatio < ASPECT_RATIO) {
        scale = (float) width / (float) VIRTUAL_WIDTH;
        crop.y = (height - VIRTUAL_HEIGHT * scale) / 2f;
    } else {
        scale = (float) width / (float) VIRTUAL_WIDTH;
    }

    float w = (float) VIRTUAL_WIDTH * scale;
    float h = (float) VIRTUAL_HEIGHT * scale;

    viewport = new Rectangle(crop.x, crop.y, w, h);

}

I think above specified code provide more guidance to community members so please help me to come out of this problem.

sentences: Algorithm for random flight of a fly I'm new to game development. What is a good algorithm to model the random flight of a fly? I've been looking at path-finding algorithms, but they don't give any interesting random behaviour.

sentences:
Dialog Title Does Not Fit I successfully added my own font to the default .json file and it displays, however I get some weird sizing issues. Specifically when I try to create a Dialog. This is what it looks like: Ignore the fact that that says "and"As you can see, the title does not fit and the button seems a bit big... This is how I create the dialog:

Dialog d = new Dialog("Error", RBResources.gameSkin);
        d.add(new Label("You cannot continue and empty game.", RBResources.gameSkin));
        TextButton b = new TextButton("Ok", RBResources.gameSkin);
        d.button(b);
        d.show(this);

This is how the skin is initialized:

gameSkin = new Skin(Gdx.files.internal("skins/uiskin.json"));

All I did to add the font was create the font with Hiero, add it to directory with the .json, and change the BitmapFont file reference from "default.fnt" to "text.fnt" (text is what I called the font).

EDIT
I tried changing the font size to 32 (before it was 48) and this is what it gives me:

The title still exceeds the boundaries of the title box. Does that mean, in the .png file containing the different button states and other Drawables, that I have to manually adjust the window Drawable to fit the title or is this a bug?

sentences:
How do I animate a spritesheet in cocos2d Android I'm trying to animate a sprite in a spritesheet, the goal is to make the character walk from left to right. I subclassed CCSprite: CharacterSprite.

this is my code:

    CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames("WalkAnimation.plist");
    CCSpriteSheet spriteSheet = CCSpriteSheet.spriteSheet("WalkAnimation.png");
    w.addChild(spriteSheet);

    ArrayList<CCSpriteFrame> walkSprites = new ArrayList<CCSpriteFrame>();
    for(int i = 1; i<=8;++i)
    {
        walkSprites.add(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("walk"+ i +".png"));
    }
    //float randomFactor = (float)Math.random()*10;
    CCAnimation walkAnimation = CCAnimation.animation("walk", 0.1f, walkSprites);

    Log.v("addEnemy", "Show");
    this.character = CCSprite.sprite(walkSprites.get(0));

    Log.v("addEnemy", "Don't Show");

    this.walkAction = CCRepeatForever.action(CCAnimate.action(walkAnimation, false));
    character.runAction(walkAction);

    for(int k =0; k<amount; k++)
    {
        float randomFactor = (float)Math.random()*10;
        character.setPosition(CGPoint.ccp(-randomFactor * character.getContentSize().width/2, winSize.height / 6.0f));
        spriteSheet.addChild(character);
    }

This code is in my 2nd scene. And whenever I press on Start Game, nothing happens. But the code is executed till:
character = CharacterSprite.sprite("walk1.png");

Can someone provide me of a snippet of animation using a spritesheet?

sentences:
Using external music mp3 in flash game sorry for my english.
Im relative new to flash game development,
Im creating a game and I need some big size mp3 files.
If I add them into flash, .swf file will be too big.
I guess I need to host mp3 files somewhere and use URL Request?
Where can I upload mp3 files so they are always ready for use?

sentences:
TileBased Game: Blitting Hero or Sprite? So my environment is all set up and now I'm working on the movement physics of my character. I used blitting to copy over my tiles from a tilesheet. But since they are static, they are only copied over once. And with the Hero (main player character), I figured that I might blit him into his continuously changing position. But now, I'm not quite sure it's necessary?

Is there a real big perfomance-save to copy the Hero sprite into a new position constantly using Blitting, OR, is it fine to just copy it into the game once, and simply move the Hero sprite as a movieclip?

sentences:
Short distances from reference point I would like to compute short distance from reference point in 2d grid. To expose:

0, 0: not penetrable
0, 1: not penetrable
...
1, 1: penetrable
...

I search an algorithm who return:

1, 1: 1
2, 1: 1
3, 1: 1
1, 2: 1
2, 2: 0
3, 2: 1
...
1, 6: 4
3, 6: 4

for 2, 2 reference point, 4 as maximum distance in exemple grid. What algorithm can to this (with good perf) ?

sentences:
What are common methods for organizing game objects? I'm in the early stages of developing a game in C++.

As of currently, I've defined a base GameObject class that is the base class for any interactive item in my map (e.g. enemies, loot, projectiles, etc.). When these items are created, I want to give them to an ObjectManager class. The ObjectManager class is responsible for iterating over each object and calling abstract methods like "update" or "render".

Originally, I planned on storing all objects (or references to the objects) in a single container. I would then iterate over this container.

However, I'm starting to have second thoughts about whether or not this is a good idea. I've come up with two reasons why this might be a bad idea:

1.) Regarding object collision, it makes sense to only perform calculations between certain objects on whether or not they've collided. For example, I would want to determine if the main character has collided with a loot item. However, I would never to want to calculate if a loot item has collided with another loot item (at least in my case).

2.) Object pools. Referencing this article, it has come to my attention that continuously allocating/de-allocating memory is expensive. Because of this, it is a common technique to use object pools that request memory upfront and then manage that memory without actually deleting it. One of the comments made in the article is that the objects that exist within the pool must all be the same size (or each pool slot must be big enough to accommodate the largest object).

Both of these examples make me think having a single container that houses all GameObject is a bad idea.

Instead, it seems like it would make more sense to have different containers for each type GameObject type. For example, it would make sense to have a container for enemies, loot, projectiles, etc. This way I would have more control in iterating/comparing only on objects that make sense for certain object types (e.g. don't try to calculate collisions between two loot items).

The problem I'm facing however is that I don't know how to break up these containers. Should all projectiles go in a single container? However, what if I later decide to create a "fire projectile" that performs some kind of "burn" logic. Would this require a new container to then to iterate over all fire projectiles? Essentially, I don't know how granular my containers should be.

I haven't come across any reference material on this topic. Any advice would be appreciated.

sentences:
NavMesh.CalculatePath returns invalid path Unity3D I am trying to get coordinates for path from source to destination object using NavMesh. NavMesh.CalculatePath() is only working for one level surprisingly. For all others, it returns false. Also NavMeshPathStatus is invalid. This is working Level, while this is not working fine with navmesh.

Code:

private NavMeshPath path;

    void Start () {
        path = new NavMeshPath();
    }

//Following function is called on button press
public void giveHint() {

        NavMesh.CalculatePath(source.transform.position, destination.transform.position, NavMesh.AllAreas, path);

    if (path.status == NavMeshPathStatus.PathComplete)
        print ("Path complete");
    else if (path.status == NavMeshPathStatus.PathInvalid)
        print ("Path invalid");
    else if (path.status == NavMeshPathStatus.PathPartial)
        print ("Path partial");

    for (int i = 0; i < path.corners.Length-1; i++) {
            Debug.Log(path.corners[i]);
        }
   }

// Update is called once per frame
    void Update () {
    if (path.corners != null) {
            if(path.corners.Length > 0) {
                for (int i = 0; i < path.corners.Length-1; i++) {
                Debug.DrawLine (path.corners [i], path.corners [i + 1], Color.red);
                }
            }
        }

    }

Please tell me way to debug/solve this issue. How unity calculates path between source and destination? Can there be possibly blockage in path? If yes then how? How path is invalid? Is there any bottleneck with the usage of CalculatePath function? Need guide from you guys... Thanks!

sentences:
Heightmap Physics Optimization/Improvement I'm working on implementing the physics surrounding a player walking on a heightmap. A heightmap is a grid of points which are evenly spaced on the x and z axes, with varying heights. The physical representation of my player (what is exposed to my physics engine/manager) is simply a point-mass where his feet are, rather than complicating the problem by treating him as a sphere or a box.

This image should help further explain heightmaps and show how triangles are generated from the points. This picture would be looking straight down on a heightmap, and each intersection would be a vertex that has some height.

Feel free to move this over to math, physics, or stack overflow, but I'm pretty sure this is where it belongs as it is a programming question related to games.

Here's my current algorithm:

Calculate the player's velocity from input/gravity/previous velocity/etc
Move the player's position (nextPos = prevPos + velocity * timeSinceLastFrame)
Figure out which triangle (all graphics is done in triangles!) of my heightmap the player's new position is vertically aligned with
Use the three vertices of that triangle to calculate the equation for the plane which that triangle lies in
Plug in the player's x and z coordinates into the plane's equation to get the y coordinate for the player's position on that plane
Set the y coordinate of the player's position to this (if newPos.y < y)

This is all fine and dandy, but I'm wondering if there's anything that I can optimize. For example, my first thought is to store the plane's equation with the triangle's vertex information. This way all I have to do is plug in the x and z values to the equation to get the y. However, this would require adding 4 floats to every vertex of the heightmap which is a little ridiculous memory wise. Also, my heightmaps are dynamic (meaning the heights will change at runtime), which would mean changing the plane equations every time a vertex's height changes.

Is there a faster way to calculate that point than digging up the plane's equation and then plugging in x and z? Should I store the plane equations and update them on vertex height change or should I just regenerate the plane equations for every triangle every time the player moves on that triangle? Is there a better way to do heightmap physics that maintains this simplicity? (this seems very simple to me as far as physics engines go)

sentences:
How do i prevent IAP abuse using restoring purchases in an online game? Lets say i have a mobile mmorpg (ios/android) where you can purchase premium currency using IAP's... how do i actually prevent the following case :

Player purchases premium currency
Server side checks if the purchase is valid, grants the user premium
currency
Player uses the premium currency to buy some items
Player restores his purchase on google play and gets his money back

Result : Player didnt spended money and still got what he wanted

As long as i know theres no option to prevent that case in google playstore or ios app store... Users can restore purchases within 48 hours after the purchase.

So what could i basically do to prevent this, aslong as i dont use 3rd party payment services like PayPal ?

sentences:
How do I convert a Source engine NPC model to a player model? The Source engine's NPC and player models differ: An NPC model applied to the player has no animations. It cannot walk and holds its arms out to the side by about a foot. The weapon is held in the right hand and you can see the player switch weapons, but the weapons also have no animation.

How do I convert between these model types?

sentences:
Can't run Nvidia PracticalPSM sample in debug mode I want to add PSM (Prespective shadow map) to my engine but I have problems with that.
I think the problem is somewhere in my math code so I want debug Nvidia PracticalPSM sample and compare the math result in the sample and in my engine so maybe I could find the bug

When I want to compile the sample with VS2005 I get some linker error with DXUT functions maybe it is due to that the static lib DXUT.lib that included is compiled with VS2003 and dose not work probably with VS2005 then I added DXUT source codes from SDK 9.5 to the solution and the sample compiles this time.

When I hit F5 to run the sample it complains about nv_nvb.dll but only release version of nv_nvb.dll is included in the sample and I copied that to debug folder when the program starts it crashes in NVBscene9.cpp line 283.

I don't know why it crashes here.

you can download the sample code from here

sentences:
Transparent objects in the scene only get lit half way by point light I have encountered a weird graphics problem, where all of our transparent objects in the scene only get lit half way (only from the y position downward) by a point light. This happens with all of our grass and tree shaders.
Also, when looking through translucent objects, they become really desaturated and gray-is which is an undesired effect.
Does anyone know how to deal with this problem? Please refer to the screenshots below.
I'm are using Unity 2020.1.14f, built-in render pipeline with a forward renderer.
For grass and trees we are using the Fantasy Adventure Environment, but all other grass shaders from other packages have the same problem.

sentences:
PBR How to correcly use standard lighting and IBL I'm creating a physically based renderer but I am a bit confused on how to put together standard lighting with IBL, since like I'm doing now I think it's wrong.

Right now, for each light, I evaluate it's contribution to the scene lighting combined with IBL lighting (I use both the light contribution and diffuse and specular coming from the IBL) but like this I sum the IBL contribution for each light, and I don't think it's right.

To put together standard lighting with IBL, do I need to process all the lights alone and then, in another step, bake into the scene the IBL? I think this would be more correct.

sentences:
Wall jump without returning to wall In my 2D Platformer character controller that has both a wall jump and a double jump ability, how would I approach implementing a feature that stops the player from returning to the wall they initiated a wall jump from, while still making sure my controls feel responsive? (like they did in Celeste, apart from the double jump)
So far, I have got a timer that starts when the player initiates the wall jump and stops the player from moving until the timer is over. I'm already not too happy with that approach because it leads to this moment where it feels like player input is basically ignored.
Now in addition, I realised that after the timer is over, while just pressing left won't be enough to return to (a higher part of) the wall, simply doing a second jump will enable the player to easily make their way up the wall.

sentences:
How can I ensure GLFW callback events only happen once in the main loop? The problem is that the mouse and keyboard events can be triggered before the main loop(in which the program starts to render and update content) takes place. In the program if the moues button is pressed, there will be a sound effect. And the code looks like this

void main()
{
// Here I initialize everything including parsing model files,
// so when the window appears it's initially plain white(loading files and not
// drawing stuff). I set up the callback functions with glfwSetKeyCallBack()
// and glfwSetMouseButtonCallBack().
// The next line is the main loop

 while (!glfwWindowShouldClose(window))
 {
 // Here I draw all the content and this is supposed to be only the place that the events
 // can be triggered
 }

glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}

When I debug the program, the window will appear and if then I click the mouse, the sound effect will appear when the program starts drawing stuff on the window. But I want the callback
functions to process events only when window enters the main loop. It should not receive or process events during the initialization part. Is there a way to prevent the callback functions to receive or process events before the main loop?

sentences:
Unity Surface Shader Using "worldNormal" While modifying Normals Turns Shader Black So I was writing a simple triplanar mapping shader and while doing so encountered a bug where when using IN.worldNormal in code while writing to o.Normal would result in the albedo turning black as can be seen below:
https://ibb.co/n1DHC8
Here is the complete shader code (bug tested on webGl as well as Windows DX11):

Shader "Custom/NormalMappedTest" {
Properties {
    _Color ("Color", Color) = (1,1,1,1)
    _MainTex ("Albedo (RGB)", 2D) = "white" {}
    _NormalMap("Normal Map", 2D) = "bump" {}
    _Glossiness ("Smoothness", Range(0,1)) = 0.5
    _Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
    Tags { "RenderType"="Opaque" }
    LOD 200

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Standard fullforwardshadows

    // Use shader model 3.0 target, to get nicer looking lighting
    #pragma target 3.0

    sampler2D _MainTex;
    sampler2D _NormalMap;

    struct Input {
        float2 uv_MainTex;
        float2 uv_NormalMap;
        float3 worldPos;
        float3 worldNormal; INTERNAL_DATA
    };

    half _Glossiness;
    half _Metallic;
    fixed4 _Color;

    // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
    // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
    // #pragma instancing_options assumeuniformscaling
    UNITY_INSTANCING_BUFFER_START(Props)
        // put more per-instance properties here
    UNITY_INSTANCING_BUFFER_END(Props)

    void surf (Input IN, inout SurfaceOutputStandard o) {
        // Albedo comes from a texture tinted by color
        fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;

        //Even just having this here causes the bug
        float3 wnrm = abs(normalize(IN.worldNormal));

        float3 nrm = UnpackNormal(tex2D(_NormalMap, IN.worldPos.xz));

        o.Albedo = IN.worldNormal;// c.rgb;
        o.Normal = nrm;
        // Metallic and smoothness come from slider variables
        o.Metallic = _Metallic;
        o.Smoothness = _Glossiness;
        o.Alpha = c.a;
    }
    ENDCG
}
FallBack "Diffuse"
}

Any help would be appreciated, thanks in advance,
 - Thomas

sentences:
Best Practices for combining animation and logic In Games I often run into this kind of scenario:

The Game Logic decides something happens, and of course the logic does so instantly. But the Game also has animations depending on the logic. Like player died -> play death animation -> respawn.
But the logic can't wait for the animation so we have to work around that.

Or take for example Starcraft 2 siege tanks as morphing units on click and they start the siege animation, but in what state is the logic. Is there a state for each animation too? Is it just a Flag ignoring everything as long as it is animating?

It tends to become really messy as i am including more and more animations.

Hope someone can give me a hint.

sentences:
What exactly does XMMatrixPerspective{L,R}H do? There are generally three functions to create a perspective matrix in DirectXMath, XMMatrixPerspective{L,R}H, XMMatrixPerspectiveFov{L,R}H and XMMatrixPerspectiveOffCenter{L,R}H. I'm kind of confused what XMMatrixPerspective exactly does.

I'm currently generating a perspective matrix using

DirectX::XMMatrixPerspectiveFovRH(to_rad(80.0f), (float)winX / (float)winY, 0.1f, 100.0f);

which works fine, I can see the cube I'm drawing in front of me. If I replace this with a DirectX::XMMatrixPerspectiveRH(winX, winY, 0.1f, 100.0f), I don't see anything on the screen. So the question is, what exactly does the matrix represent? What is it's field of view? And why don't I see my cube? If this function uses some sort of default fov value, I'd expect to see my cube - even if possibly stretched - as my view matrix looks straight at it.

Unfortunately, the docs only say "creates a projection matrix" but nothing about how one is supposed to work with that matrix.

E: I figured out, I'm not supposed to pass the window coordinates. It expects the size of the near-clipping plane. However after playing around for a bit with values, how is this function supposed to be used? I really can't see any reason to use this over the one where you pass in a fov.

sentences:
Why are some games using some dithering pattern instead of traditional alpha for transparency? Recently, I have seen some 3D games (eg: GTA IV)  to use some kind of ordered dithering to simulate transparency / alpha.

The polygons are not transparent as usual, but instead render a dithering texture that gradually switch from left to right to simulate transparency :

The effect is not unpleasant but rather surprising to see at first (vs traditional alpha blending)

Except for the visual aesthetic effect it produce, is there any reason some games do this (better performance, saving bandwidth or any else i do not think about) ?

I have searched on the web but cannot found anything about this technique.

sentences:
Android loading screens blocking, good practice? I've noticed many (if not all) android games don't support the "back" button functionality during their loading screens. Which leads to some frustrating moments when a user accidentally starts up the game and has to wait for the long loading stage to end in order to close it.

So my questions are:

1) Why is that ? Is there a good reason to avoid something like asynchronous loading (or some other solution to this problem) in android games ?

2) If there is no good reason not to support this functionality, what would be the best way to accomplish it ?

sentences: Unity3d Colliders not working on my characters I have create 2 characters in maya and imported them in Unity3d. I am able to move and animate them in unity but the characters are not colliding with each others. I have tried all major colliders capsule, box and mesh. I am kind of stuck in it !

sentences:
Could not load dynamic library .\RenderSystem_GL_d. System Error: %1 is not a valid Win32 application I am using OGRE 1.8.1 SDK for Visual C++ 2010 (32-bit) from ogre3d.org/download/sdk and Ogre_VC10_Express_AppWizard_1.8.0.exe downloaded from https://bitbucket.org/ogreaddons/ogreappwizards/downloads. After a successful build when i am runnin application i am getting following error:

OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library .\RenderSystem_GL_d.  System Error: %1 is not a valid Win32 application.

in DynLib::load at ........\OgreMain\src\OgreDynLib.cpp (line 93)

Seems to me that there is a mismatch of some 32bit/64bit dlls but reinstalling directx didn't solved the problem.
I am new to OGRE, kindly guide me on this and i am using windows 8(64bit) and Microsoft visual C++ 2010 Express.

Edit: I tried installing SDK and directly run SampleBrowser (Without using AppWizard) but same error occurred again(build was successful).

sentences:
How can I align a 2D object properly using tilemap collision I'm making a mario clone, and I have been working on the collision but I can never seem to get it right.
I started out with "true/false" collision, aligning the player at it's last position, and as can guess, the results were barely ok. The problem was in the alignment and in the direction of movement.
I then converted my collision function to return the rectangle area of intersection as shown in the top left corner: (Yellow rectangle)

I now have a bunch of other problems which I think are more acceptable to solve.
I'm unsure of what to do with the data I get from the function now.
My current logic is this:
// Update Gravity
// Update Movement
// Check for collision
// Intersect2 applies offset to a existing rectangle, and returns true or false.
if(Intersect2(*level, *camera)) // Check collision against level, but only against tiles in camera view.
{
    // Correct Y Movement
    if (offset.height >= 16) sprite.move(0, offset.height); // 16 is half a tile size
    else
    {
        sprite.move(0, -offset.height);
        inAir = false;
    }
    velocity.y = 0;

    // We corrected Y, are we still intersecting? then correct X as well
    if(Intersect2(*level, *camera))
    {
        if (offset.width >= 16) sprite.move(offset.width, 0); // 16 is half a tile size
        else sprite.move(0, -offset.height);
        velocity.x = 0;
    }
    // Reset the offset rectangle
    offset.height = 0;
    offset.top = 0;
    offset.left = 0;
    offset.width = 0;
}

How can I apply the offset in a correct way?
Side note: I have stuttering problems while on ground, as my gravity is always "on" so that I can fall down when walking off an elevated block.

sentences:
Where do the buffer values come from when rendering? In the textbook I am reading, it talks about fragment tests that are performed when rendering.

All of these tests involve comparing the current fragment x value (x can be alpha, color, etc.) with a corresponding buffer value, and doing something in case the test passes. The test is usually a comparison between those two values (for example, >=, <=, etc.).

What I cannot understand is where do these buffer values come from in the first place?

Are these previous values? If so, what do the current values have to do with previously calculated values?

I don't even know what to search in google for this topic. Sorry if it is a total starter question. I am currently reading about rendering for the first time

sentences:
How to do this once in Update? I want to add 1 to directions every time the shift key is pressed. Since I need to check the key press, I have to do it in Update, but in Update this code is executed multiple times and the directions goes all the way up to 4 before going back to 1.
How do I make it so that every time the shift key is pressed, directions is added by 1 and only 1? Thanks in advance. :)
private int directions = 1;

var keyboard = Keyboard.current;

if (keyboard.shiftKey.isPressed)
        {
            directions++;

            if (directions == 5)
            {
                directions = 1;
            }

        }

sentences:
How to handle back press in Unity? By back press on Android, I want to close all the open windows first then exit the game, I see everywhere it's suggested to check input key in Update:

void Update()
{
    if (Input.GetKey(KeyCode.Escape))
    {
        if (AreAllWindowsClosed())
            Input.backButtonLeavesApp = true;
    }
}

But my issue with this is that it's calling the code in every frame and also may handle a single press multiple times!

Isn't there a single BackPressed event in Unity for this simple task?

sentences:
Implementing a Risk-style board I have two images of the same dimensions.
One is represents the game board in a user-appealing way, the other represents it in a computer-friendly way where each game area is painted in a unique, uniform color.
When the user clicks the board, we get the click coordinates, find the color of the pixel at the same coordinates in our second image, and that color is directly translatable to a game area, since each area is painted in its own color.

Is that a good implementation? Can you suggest better, if it isn't?

Best regards.

sentences:
What exactly are "semaphore signal operations" in the Vulkan specification and how do they relate to a CommandBuffer? In section 7.4.1.Semaphore Signaling of vulkan specification,

https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#synchronization-semaphores

"When a batch is submitted to a queue via a queue submission, and it includes semaphores to be signaled, it defines a memory dependency on the batch, and defines semaphore signal operations which set the semaphores to the signaled state."
What are operations in this sentence?And what is the difference between pipline stages and operations?Is this semaphore signal operation inserted into queue and wait to be executed like stages which a CommandBuffer consists of?

sentences:
Discard Transparent Pixels in Z-Buffer I am building a 2D game using sprites. I'd like to use the z-buffer to aid with shading.

For that I need Unity to write only opaque pixels to the z-buffer (aka depth buffer). In Unity, sprites are built up of polygons, and it is writing these entire polygons, including the transparent pixels, to the depth buffer.

This is the shader I'm using (with some junk added while trying to get this to work) http://pastebin.com/khprCUA0

I have tried

AlphaTest Greater 0
alphatest:MyAlphaTestVar
the discard keyword
Cg's clip function
I suspected that a lighting pass might be writing the depths so I added novertexlights and noambient

I would suspect that AlphaTest prevents transparent pixels from having any effect on the frame or depth buffer (as suggested here), but they still do write to the depth buffer!

The screenshot below shows the inaccurate shapes of objects in the Z-buffer. The king and tree have become blobs because even their transparent pixels were updated in the Z-buffer (drawn using http://willychyr.com/2013/11/unity-shaders-depth-and-normal-textures/):

Compare this to the "correct" shape of the objects in the regular view:

How do I get Unity to not write transparent pixels to the z-buffer?

EDIT:

Unity 5's frame debugger is turning out to be a miracle! Turns out the "Depth Texture" is actually rendered in a separate pass before all other geometry. And I'm having trouble finding out how to use RenderType to include/exclude certain objects from this pass.

sentences:
Filling in 3d Shapes For a college project I need to draw an empty cube and then show the cube being filled.

So far I have heard that JME and voxels is the way to go but I have no idea where to start. Can anyone point me towards a tutorial or any reading?

My project is in Java but any pseudo-code is welcome.

sentences:
Character automatic movement and rotation I have problems with a character. I want to move myself at some speed, and by typing on WASD keys to rotate this object and move to the side where the face is. The object moves continuously without pressing the key.
Let's say something to the snake game.This is my code, it goes, but I can not do this rotation.

private float speed = 0.01f;
private float moveSpeed = 12f;
Vector2 vector = Vector2.up;
Vector2 moveVector;
[HideInInspector] public bool IsMoving = false;
[HideInInspector] public bool canPress = true;
 private void Start()
{
    InvokeRepeating("Movement", 0.5f, speed);
}
   void Update()
{
    if (canPress)
    {
        if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
        {
            canPress = false;
            IsMoving = true;
            vector = Vector2.right;
            //transform.Rotate(0f, 0f, -90f);
            transform.rotation = Quaternion.Euler(transform.rotation.x, transform.rotation.y + rotateObj, transform.rotation.z);
          }
          else if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W))
          {
                canPress = false;
                IsMoving = true;
                vector = Vector2.up;
          }
          else if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S))
          {
                canPress = false;
                IsMoving = true;
                vector = -Vector2.up;
               //transform.Rotate(0f, 0f, -90f);
          }
          else if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
          {
                canPress = false;
                IsMoving = true;
                vector = -Vector2.right;
                //transform.Rotate(0f, 0f, +90f);
          }
      }
      moveVector = vector / moveSpeed;
    }
    void Movement()
    {
        if (IsMoving)
           transform.Translate(moveVector);
    }

If anyone knows how to do this I would be grateful. !!!

sentences:
Farseer for platformer - (Almost) constant velocity I am building the prototype for a platformer and would like to use farseer physics engine. I got the feedback that it might not be a good idea to use physics engine, but I would like to have elements like bumpers and so on.

At the moment I am looking for a good way for moving right and left (jumping is very easy). The goal is to get an almost constant velocity, so I was playing around with hight gravity and high linear damping and it is working fine, but also affects gravity. Is there a way to get a linear damping on the x-axis only or do I just have to increase gravity (which sounds a little bit strange to me).

sentences:
Black borders in Andengine I am using Andengine and when I start the examples there are black borders on left and right of the screen. Like this:

10000001
10000001
10000001

where 1 is black and 0 is not black. On my phone (Google Nexus 4) it is always. In emulator sometimes. it is in all examples from here: https://github.com/nicolasgramlich/AndEngineExamples

What is causing this?

sentences:
Unity GUITexture or GUIText not showing up Currently I've got a little 2.5D platformer with the camera tracking the player. Now when I go to insert a GUITexture or GUIText game object into the scene, it comes up absolutely fine in the Editor view, but when I go to play it there's absolutely nothing to be seen!

At first I thought it may have been a script I was using on the GUI, but I've tried it out with a completely bland GUITexture object that has no interaction with the rest of the game and I still get the same effect. I'm wondering if my camera is messing it up somehow, but I assumed that all GUI objects are drawn to screen space and just stay with the camera.

I've been really stuck for the past few hours so if any one could offer some insight, I'd be very, very grateful!

~Ray

sentences:
Find an infinite loop in a very big project in Unity How can I find an infinite loop in a very big project in Unity?

I tried to use breakpoints in MonoDevelop and debug, but I was not able to track the loop. I tried to put Debug.Log() in a few places and it did not help as well.

So, are there are any other ways of doing it?

It is possible that the loop is not a problem, but I think it is very unlikely. The problem is that when I perform some actions the Unity Editor just stucks and becomes unresponsive at all and I should disable it through the task manager.

sentences:
How can I limit the movement angle of a Farseer joint? How can I create rectangles in Farseer that behave like the two red rectangles in this video:

https://www.youtube.com/watch?v=w0p2y4dRylQ

I created an angle joint, but it behaves weird. Should I use an angle joint or is it better to use another joint?

In addition, I don't know how to adjust the angle of the joint so that the rectangle only moves in a predefined angle. How can I limit the movement angle of a joint?

I tried it like this, but the rectangle moves not as it should:

       RectangleA1 = BodyFactory.CreateRectangle(world, 3.50f, 0.50f, 1.0f);
       RectangleA1.BodyType = BodyType.Dynamic;
       RectangleA1.Position = new Vector2(10.4f, 5.40f);
       RectangleA1.Rotation = 0f;
       RectangleA1.CollisionCategories = Category.Cat5;

       RectangleA2 = BodyFactory.CreateRectangle(world, 0.10f, 1.00f, 1.0f);
       RectangleA2.BodyType = BodyType.Static;
       RectangleA2.Position = new Vector2(8.6f, 6.2f);
       RectangleA2.Rotation = 0f;
       RectangleA2.CollisionCategories = Category.Cat5;

       AngleJoint1 = JointFactory.CreateAngleJoint(world, RectangleA1, RectangleA2);

       spriteBatch.Draw(RectangleA1Sprite, ConvertUnits.ToDisplayUnits(RectangleA1.Position), null, Color.White, RectangleA1.Rotation, new Vector2(RectangleA1Sprite.Width / 2.0f, RectangleA1Sprite.Height / 2.0f), 1f, SpriteEffects.None, 0f);

       spriteBatch.Draw(RectangleA2Sprite, ConvertUnits.ToDisplayUnits(RectangleA2.Position), null, Color.White, RectangleA2.Rotation, new Vector2(RectangleA2Sprite.Width / 2.0f, RectangleA2Sprite.Height / 2.0f), 1f, SpriteEffects.None, 0f);

sentences:
How can I skew a SpriteRenderer in an animation to grow a side and decrease the opposite side by the same amount? I am interested in the maths and maybe the shader code. I am almost sure that this would be a great starting point but I do not have any knowledge about shaders and the language they are written in.

The little project is just an attempt to create a flippable sprite, like the one I did in WPF but more interesting because of the "closer" perception. The objective is to learn. I have two animations, one rotating around the Y axis and the other one is this skew that I do not know how to do.

On the web I have found old answers and answers that use Image instead of SpriteRenderer, some complex math that I cannot comprehend yet.

Ideally the animation would go through all these states, from left to right, and then in the inverse order, from right to left (blue means unflipped state, green means flipped state):

I have started working with Unity since less than a week and I have forgotten a lot of maths and geometry I learned in school. But I am eager to learn again.

Thank you.

sentences:
Instancing pixel shader parameters -- pass instance data through vertex shader? I'm working on a deferred shader, and I want to use instancing to draw point lights.

From what I understand, I can send the instance data through the vertex shader and pass it through unchanged to the pixel shader. Is this the correct way to do it, or can I send the instance data straight to the pixel shader somehow?

sentences:
Cutting out smaller rectangles from a larger rectangle The world is initially a rectangle. The player can move on the world border and then "cut" the world via orthogonal paths (not oblique).
When the player reaches the border again I have a list of path segments they just made.

I'm trying to calculate and compare the two areas created by the path cut and select the smaller one to remove it from world.

After the first iteration, the world is no longer a rectangle and player must move on border of this new shape.

How can I do this?
Is it possible to have a non rectangular path? How can I move the player character only on path?

EDIT

Here you see an example of what I'm trying to achieve:

Initial screen layout.
Character moves inside the world and than reaches the border again.
Segment of the border present in the smaller area is deleted and last path becomes part of the world border.
Character moves again inside the world.
Segments of border present in the smaller area are deleted etc.

sentences:
How could I improve this random map? following my previous post on random world map generation, I used several algorithms and obtained results similar to this: http://i.imgur.com/CKL2R.png (the height values are quantisied for viewing but they go from 1 to 500 before quantisation).
Now I am trying to improve the "lakes", as you can see, the water bodies that are inside the map are always at 0 altitude, which means that every lake would be at the ocean level.
I am willing to keep these "ocean-level lakes" (or remove them), but I would like suggestion on how to create from this heightmap real lakes that would be possibly at any height, while keeping most of the altitude structure (ie mountains positions, etc)

thanks

sentences:
Lighting Covering Up Sky ( XNA / C# ) I have a 2D tile-based lighting system which is drawn onto a Render Target.
I am also drawing a background which involves mountains, sun/moon, and clouds.
There is also the unlit game; blocks, character, etc.

Here is the order in which everything is drawn:

1. Background
2. Game World
3. Lighting

The problem is that the LIGHTING is covering up the BACKGROUND when it's dark:

Although it's perfectly fine in the day because the light is full:

You might ask, well, why don't you just blend each block, not drawing the lighting on a RenderTarget?

Because that would prevent me from performing smooth lighting, as seen in the pictures. To produce the smooth lighting, I draw squares of light onto a RenderTarget, perform a Gaussian blur and then draw that RenderTarget.

How about not drawing a square of light in empty spaces?

The light blurs onto any adjacent blocks, and not all objects in my game affected by lighting are square, so they would look like a sprite with a blurry square on top of it.

Light NOT being drawn in empty spaces:

Light being drawn everywhere:

Is there any way to keep the background visible, or something else that would help my predicament?

USING THE STENCIL BUFFER

I put in the stencil buffer code that you said should cause "little overhead"

As you can see the background blocks, due to the effect, are not darkened like they should be. The FPS here is ~15 as opposed the the steady 60 FPS it runs at without the stencil method. Also the character is somehow not being drawn correctly.

It does in fact work though despite the more than annoying lag.

sentences:
Increase animation speed according to the swipe speed in unity for Android I have the animation done through Maya and brought the FBX file to unity. Here is my code to calculate the speed of the swipe:

Vector2 speedMeasuredInScreenWidthsPerSecond =(Input.touches[0].deltaPosition / Screen.width) *     Input.touches[0].deltaTime;

Now I wanted to take speedMeasuredInScreenWidthsPerSecond and use it to increase the animation speed accordingly like this:

animation["gmeChaAnimMiddle"].speed=Mathf.Round(speedMeasuredInScreenWidthsPerSecond);

However, this results in an error that I need to convert Vector2 to float.

So how do I overcome it?

sentences:
Rendering Performance: num Draw Calls == num Texture Bindings I'm making a game with Libgdx 1.6.4 and experience some lag issues on iPhone 4 and then discovered:

// in the constructor
GLProfiler.enable();

...

// in the render method
Gdx.app.debug("draw calls: " + GLProfiler.drawCalls);
Gdx.app.debug("texture bindings: " + GLProfiler.textureBindings);
GLProfiler.reset();

What the log shows is that the number of draw calls is always equal to the number of texture bindings. Do you know if this is ok?

It seems strange because I have all images as TextureRegion in only one TextureAtlas with size 1024x512. Isn't it supposed to be that I will have for example 50 draw calls and only 1-2 texture binding instead of 50 draw calls and 50 texture bindings. Can this be the source of the lag?

Another clue may be, that I use a SpriteBatch and Scene2d Stage at the same time, but they both use the same TextureAtlas. The Scene2d Skin is loading the TextureAtlas and SpriteBatch draws TextureRegions from the skins' regions.

Thank you for any help.

--- Update ---

The main SpriteBatch (it's only one) is making 9 totalRenderCalls. The value of maxSpritesInBatch is 26. These values seem normal from what I read in the Docs and the FPS during rendering with the SpriteBatch is 60 FPS. Which is ok, no problem there.

The problem with the lag is when I use a Scene2D Stage to display a Dialog above the GameScreen. The Stage has it's own batch which I don't manipulate directly. When the Dialog is displayed the frame rate drops to 49-50 and the Animations in the Dialog are crappy. I guess the problem has something to do with Texture Binding of the main SpriteBatch and the Stage's SpriteBatch.

sentences: Executing commands at the exact same time on 2 or more computers I have an RTS game, with deterministic simulation, but if I want multiplayer to actually work, I need commands sent between computers to be executed at the exact same time. My game's networking is just sending commands between the players' computers, and the simulator executes the commands in order, which, hopefully, will result in each player seeing the exact same game. However, if the commands aren't executed at the EXACT same time, then the simulation will become out of step and everything will be wrong. How could I do this, and are there other ways to make sure everything is in sync?

sentences:
Drawing Farseer Fixtures Is there any way how to draw a Polygon / Fixture from Farseer Physics with XNA?
As I deform these polygons at runtime I can't take any texture from my Content folder, the texture must be generated at runtime too.

sentences: How to edit colliders in Unity2D I can edit colliders by holding down the shift key. But when i add a second collider, the shift key always selects the first one. And there is no "Edit Collider" button in the editor (Win/4.5.4f1). I'm testing it with two EdgeColliders2D.

sentences:
How to accurately score moving averages (indepenent of sampling window) I'm developing a puzzle game, and coming up with a little trouble how to accurately create the 'score' for a particular player's solution.

In this game a player creates a machine which generates 'events'. The 'score' should be the number of events per second that a particular machine performs.

I.E. if my machine performs 6 events per second, and yours produces 8 per second, your score should be higher than mine.

I initially thought to use a moving average for this, but I've discovered it's trivially easy to manipulate this mechanic, such that solutions with an equal long-term performace don't generate the same score.

So in this case if my machine generates 1 event per second, and yours generates 3 every third second, they should have the same score. But if I use a running average to calculate the score, then the latter solution is likely to generate either a higher or lower score depending on the sampling window.

Case A:

   time    | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
solution A | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1  |   = 10 / 10 = 1 event per second
solution B | 3 | 0 | 0 | 3 | 0 | 0 | 3 | 0 | 0 | 3  |   = 12 / 10 = 1.2 events per second

Case B:

   time    | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
solution A | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1  |   = 10 / 10 = 1 event per second
solution B | 0 | 0 | 3 | 0 | 0 | 3 | 0 | 0 | 3 | 0  |   = 9 / 10 = 0.9 events per second

I'm wondering if theres some other metric possible to use other than 'average' that wouldn't be subject to this kind of inconsistency? The only way to make this works would seem to run the simulation for infinite time, at which point the two solutions would converge on 1 score / second, but that's not possible to do.

I'm somewhat doubtful that there's any solution to this problem, but just wanted to throw it out to see if there are any ideas.

sentences:
lighting for landscape I've got a landscape(created in Photoshop .raw file) and a .tga texture for it.
I read .raw file and read .tga file like this

LoadRawFile("landscape.Raw", MapSize * MapSize, &HeightMap[0][0]);

Texture landscape;
if (LoadTGA(&landscape, "landscape.tga")) {

    glGenTextures(1, &landscape.texID);
    glBindTexture(GL_TEXTURE_2D, landscape.texID);
    glTexImage2D(GL_TEXTURE_2D,
        0,
        landscape.bpp / 8,
        landscape.width,
        landscape.height,
        0,
        landscape.type,
        GL_UNSIGNED_BYTE,
        landscape.imageData);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    if (landscape.imageData) free(landscape.imageData);
} else  {
    cout<<"Cannot load texture"<<endl;
}

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer (3, GL_FLOAT, 0, VertexMap);

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, TextureMap);

for (int Row=0; Row < MapSize*2; Row++)
{
    Indices[Row] = Row;
}

I render landscape like this(method renderLandscape)

int x, y, i, j;
int Index = 0;

for (i = 0; i < MapSize-1; i++)
{
    Index = 0;
    for (j = 0;j < MapSize-1; j++)
    {
        x = j * Zoom;
        y = i * Zoom;

        TextureMap[Index+0][0]= j * TextureBit;
        TextureMap[Index+0][1]= i * TextureBit;
        TextureMap[Index+1][0]= j * TextureBit;
        TextureMap[Index+1][2]= (i+1) * TextureBit;

        VertexMap[Index+0][2] = HeightMap[j][i];
        VertexMap[Index+1][2] = HeightMap[j][i+1];

        VertexMap[Index+0][0] = x;
        VertexMap[Index+0][3] = y;
        VertexMap[Index+1][0] = x;
        VertexMap[Index+1][4] = y+Zoom;

        Index += 2;
    }

    glDrawElements(GL_TRIANGLE_STRIP, Index, GL_UNSIGNED_INT, Indices);
}

draw method

glPushMatrix();
    glTranslatef(-20, 0, 0);
    glScalef(0.01, 0.01, 0.01);
    glRotatef(90, 1, 0, 0);
    landscape.RenderLandscape();
glPopMatrix();

So by default(without lighting) it looks like this

But when I enable lighting(add this lines to my opengl init function)

GLfloat light_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };

glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

The result landscape looks like this

I don't need any special or difficult lighting.
So it seems I need to calculate normales(I am new in opengl and usually create .obj models where vn precalculated). What is the best way to calculate normales in my case?

sentences:
How to store data and behaviour for what happens within a level? I made a game a year ago featuring a custom scripting language, but I realised that it took far too long to actually make the language and there were many commands that were very rarely used.
I'm trying now to do something similar with a game I'm working on, and I'm wondering what the simplest way to store level data would be. There are programs like Tiled that let you store some JSON data and tiles and .png's and whatnot, but I want to be able to store commands for what happens within a level gameplay wise. I'll give some examples.
I could have a file for the starting room that has commands that run when you enter the room, e.g. to have some text pop up, have a character walk up to the player, etc. I could also have individual commands for what happens when you interact with an object or with a character. What's a good way to store this data without having to write my own scripting language? It's not too difficult to make a very basic one with minimal functionality, but I feel like there are much better ways out there.

sentences:
Isn't OnGUI and Event cyclical? Here's what I don't understand about Events:

the documentation says that Events correspond to user input (key presses, mouse actions), or are UnityGUI layout or rendering events. For each event OnGUI is called in the scripts; so OnGUI is potentially called multiple times per frame. Event.current corresponds to "current" event inside OnGUI call.

the documentation pertaining to onGUI states that it hasone call per event

That doesn't make sense to me, because I know I can call Events within OnGUI.

I have an OnGUI function that draws a grid using x and y nested for loops, then checks using Event.current.mousePosition if your mouse is hovering over a grid block. What I don't get is how OnGUI is ever called, if OnGUI is only called when an event occurs, but I have the event inside OnGUI so how can you ever check if the event is being called inside a script that is only called after the event is called?

I know that probably sounds confusing -- I'm just puzzled by the seemingly cyclical nature of ongui.

sentences:
How can I combine chasing and obstacle-avoidance in a steering-based AI? I'm developing a top-down game in XNA with enemies that wander until they are within range of a player, at which point they begin chasing the player. This works, but I also want them to avoid obstacles around the map while chasing.

I can find tutorials on programming the avoidance behavior, but I'm unsure as how to integrate that into my current AI so that the enemy both chases the players while also avoiding obstacles. I cannot use a pathfinding algorithm like A* because my current AI is steering-based.

How should I go about integrating this?

sentences:
How to make a string[] from the words of a file in Unity? I have .txt file containing all the English words separated by line breaks.

I want to turn them to a string[] so I can easily pick a random one from them.

The way I would do that in normal C# is the File.ReadAllLines(path) function in the System.IO namespace.

But, I don't think that I can use System.IO with Unity so the alternative that I could come up with is the TextAsset class which I can use to reference an imported text asset and get its text property as a string.

But, if I have a giant string how can I simply split it up into individual words and store them as a string[]?

sentences:
How to instantiate seamless scrolling tiles I'm trying to create in Unity an "Endless Runner" game, where the player remains stationary on the 0 of the axes while the tiles underneath him scroll with a fixed speed on the Z-Axis.
The script attached spawns 5 tiles at the start while already scrolling at the speed set in the GameManager and then keeps on spawning tiles based on a timer.
The issue I'm facing is the following:
The tiles that are spawned with the timer are too much distant from the starting set of tiles.
How can I calculate the correct distance between the set of the already scrolling tiles and those the script start to spawn after 5 seconds in order to have seamless scrolling?
I'm attaching the script with what I've written so far in the hope that someone knows how to proceed, or perhaps knows a different method. Thanks!
public class TileManager : MonoBehaviour
{
    [SerializeField] private Transform player;
    [SerializeField] private GameObject[] tilesArray;
    [SerializeField] private int tilesToSpawn = 5;
    [SerializeField] private float zPosSpawn = 0f;
    [SerializeField] private float tileLength = 20f;

    public List<GameObject> tilesList;
    private float spawnRate;
    private float timeSinceLastSpawned;

    void Start()
    {
        //scrollingSpeed is -5
        spawnRate = GameManager.Instance.scrollingObjectsSpeed * -1;
        StartSpawnLogic();
    }

    void Update()
    {
        timeSinceLastSpawned += Time.deltaTime;
        SpawnTimer();
        DestroyAfterSpawn();

    }

    private void StartSpawnLogic()
        {
            for (int i = 0; i < tilesToSpawn; i++)
            {
                if (i == 0)
                {
                    SpawnTiles(0);
                }
                else
                {
                    SpawnTiles(Random.Range(0, tilesArray.Length));
                }
            }
        }

    //SPAWN FUNCTION
    private void SpawnTiles(int tileIndex)
    {
        //On Instantiation a list is filled to later dispose of the tiles after they reached a certain point
        tilesList.Add((GameObject)Instantiate(tilesArray[tileIndex], transform.forward * zPosSpawn, Quaternion.identity));
        zPosSpawn += tileLength;
    }

    //TIMER
    private void SpawnTimer()
    {
        if (timeSinceLastSpawned >= spawnRate)
        {
            timeSinceLastSpawned = 0;
            SpawnTiles(Random.Range(1, tilesArray.Length));
        }
    }

    void RemoveObjFromList(GameObject tile)
    {
        Destroy(tile);
        tilesList.Remove(tile);
    }

    private void DestroyAfterSpawn()
    {
        for (int i = 0; i < tilesList.Count; i++)
        {
            if (tilesList[i].transform.position.z <= -20f)
            {
                RemoveObjFromList(tilesList[i]);
            }
        }
    }
}

sentences:
Unity - paiting terrain details vs combining a large mesh I am about to start making my landscape, and am using a low poly style.

I think I'd prefer not to use the terrain system and instead just use a bunch of meshes, since all my grass/flowers are 3d models.

Does anyone know how this will effect performance, keeping in mind that Ill combine all my vegetation to one large mesh when Im done, so that it's not hundreds of gameobjects. Is it a lot worse than using the terrain tool with detail painting?

sentences:
Java collections and managing simultaneous operations / concurrency (java.util.ConcurrentModificationException) Ok, so i have created my first "game" and it uses a lot of java's collections. for example, i have a bunch of monsters in a HashSet which sometimes gives me the fabled java.util.ConcurrentModificationException when i try to modify the HashSet.

Basically im getting these exceptions when im within a for loop and then some other part of the system find it suitable to add or remove an element to/from the collection.

My options as far as i know is:

  1) Use a Thread Safe collection or use Collections.asSynchronizedCollection().

  2) Only work on copies of the collection when looping through it.

My question thus becomes. Is there any other methods more widely deployed solutions in the gamedevelopment world that handle's these issues?

As an example, i thought ive read somewhere that queues are more heavily used instead of collections and that work is done on input and output queues. <-- any elaboration on this would also be appreciated!

Thanks for your time!

sentences:
Some autocompletion doesn't work in Visual Studio Code with Unity I am using Unity 2018 with Visual Studio Code version 1.43.2 on a Mac.

Things seemed to work fine between Unity and Visual Studio Code, but now I realize that something is wrong with Code. I have been following along with a tutorial and the autocompletion functionality of Code seemed fine until the function OnTriggerEnter, which was shown as autocompleting for the guy in the video (who was using the other Visual Studio), didn't fill in. However, many other Unity things do automatically show up as options.

I looked at this Microsoft help page about VS Code and Unity, and I have everything it I seems I would possibly need to combine the two; I have .NET, Mono, Debugger for Unity, the C# extension, and got Unity Tools for good measure.

Generic C# things like return, void, int, etc. autocomplete, so the C# extension seems fine. Many Unity things, like Vector3, GameObject, Destroy, transform, etc. also autocomplete like they should.

What is wrong here? How can I fix this and get full autocomplete?

sentences:
3d compute shaders in order access I'm working on a compute shader for a 3d texture where I want to evaluate pixels in a specific order, is there any way to do this?
let's say that I have made a texture using the following code;

tex = new RenderTexture(64, 64, 0);
tex.volumeDepth = 6;
tex.isVolume = true;
tex.enableRandomWrite = true;
tex.Create();

Now let's say that for example I want to make the following computation on the gpu rather then cpu:

tex[0]=basetex //all values where z =0 are some basic 2d texture
for(int z=1;z<6;z++){ //loop over every z level
 for(int x=1;x<64;x++){ //loop over every x level
        for(int y=1;y<64;y++){ //loop over every y value
         tex[x][y][z-1]=tex[x-1][y][z-1]+tex[x-1][y][z-1]+tex[x][y-1][z-1]+tex[x][y+1][z-1] //add all values next to this pixel on the z value bellow
      }
  }
}

sentences:
How to render texture into box2d objects from Tile Map? Libgdx I have a problem, when i try to render textures. I read positions of gameObjects, for example coin and create box2d objects circle shape. I have wrote game logic and began make a graphic. But for some reason, textures drawing not in box2d objects, but they shifted to the right and up as mini-map in games.

Code

  batcher.begin();

  sprite = new Sprite(AssetsLoader.coin);

  sprite.setPosition((body.getPosition().x - sprite.getWidth()/2), ((body.getPosition().y - sprite.getHeight()/2)));

  sprite.draw(batcher);
  batcher.end();

This is what happened

As you can see above, sprite position like body position. And something else: when i move my mainHero all rendered coins moving with him. On the screen they save their position, but in world they are moving. So how i can render coin texture exactly into box2d body.

May be something wrang with camera?

cam = new OrthographicCamera();

cam.setToOrtho(false, 400, 600);

or with Batcher?

batcher = new SpriteBatch();

batcher.setProjectionMatrix(world.getCamera().combined);

I will not give all my code, because it is big and no one will try to understand it.I need an idea or just an advice or a hint. Sorry for my English, hello everyone from Belarus :) Where do I look and what a start? Thank you.

sentences:
Unable to access jar. Why? I was making a game in java and exported it as jar file. Then after that, I opeed jar splice. I added the libaries and exported jar. I added the natives then i made a main class. I created a fat jar and put it on my desktop. I'm using Mac OS X 10.8 Mountain Lion. When I put in the terminal, java -jar System Front.jar it says unable to access System Front.jar Even if i double click on the file, it doesen't show up! Help! I'm using slick.

I added slick and lwjgl as libraries for the jar splice at the jars.

sentences:
Instantiate works fine in Editor and does not work after building game Here is the situation, In my project everything works fine. After I build the game for windows, the prefab does not instantiate. I don't know which part I missed.
This is how I load the prefab from Resources folder
private void Awake()
{
    areaButtonPrefab = Resources.Load<GameObject>("Prefabs/AreaButton1");
}

And this is how I instantiate prefab for each data in a List
public void SetAreaToUI()
{
    foreach (var j in areaList)
    {
        cloneItem = Instantiate(areaButtonPrefab, originalRect.position, new Quaternion(0, 0, 0, 0), rect);
        TMP_Text text = cloneItem.GetComponentInChildren<TMP_Text>();
        AreaButtonData buttData = cloneItem.GetComponent<AreaButtonData>();
        buttData.area = j;
        text.text = j.areaName;
        cloneItem.SetActive(true);
        cloneItems.Add(cloneItem);
     }
}

sentences:
Why do my Box2D bodies occasionally get stuck and separate forcibly? I'm making a space game with LibGDX and Box2D. I made a video here to illustrate the issue.

Verbal description: When objects collide, they sometimes get stuck together and are then suddenly separated by a strong force.

Both objects have identical body definitions and fixtures:

bod = new BodyDef();
bod.type       = type;
bod.allowSleep = false;

shape = new CircleShape();
shape.setRadius(values[0]);

fix = new FixtureDef();
fix.restitution = 0f;
fix.friction    = 1f;
fix.shape       = shape;
fix.density     = 1f;

worldBod = world.createBody(bod);
worldBod.setTransform(position.x, position.y, 0);
worldBod.createFixture(fix);

Why might this be happening? How can I fix it?

Update: Here is some more info.

The Player class contains a function update(float deltaTime) with the rest listed below

force.x += (directionVector.x * SPEED)*deltaTime;
force.y += (directionVector.y * SPEED)*deltaTime;

//This helps keep the object in control from preventing forces greater then 3
if(force.x >= 3){
    force.x = 3;
}if(force.x <= -3){
    force.x = -3;
}if(force.y >= 3){
    force.y = 3;
}if(force.y <= -3){
    force.y = -3;
}
//This quickly reduces the force back down to 0
force.x *= 0.5;
force.y *= 0.5;

this.getBody().applyForceToCenter(force, true);

In the render part of the main game class I step the world with

gameWorld.step(Gdx.graphics.getDeltaTime(), 6, 6);
//although increasing or decreasing the itterations seems not to help

and Finally the hexagon's are created using the ShapeRenderer pulling the position and

sr.setProjectionMatrix(camera.combined);
sr.begin(ShapeType.Line);
sr.circle(p1.getBody().getPosition().x, p1.getBody().getPosition().y, 1);
sr.circle(barrierPole.getBody().getPosition().x, barrierPole.getBody().getPosition().y, 1);
sr.end();

sentences:
Circle-line segment collision resolution I'm trying to make a side-scrolling game using this method and I'm having some trouble getting it to behave right. The collision shapes consist of multiple connected line segments and I'm checking them one at a time in order from first to last, so in one direction the collisions are resolved in the wrong order and the circle can't move over the connection point.

Is there a way of fixing this that isn't a hack, or should I try preventing the collision from happening in the first place instead?

ETA: The circle is moved straight up if the overlapping line segment is below and not too steep (approx. 50 degrees maximum) to enable it to move on slopes without resistance. In all other cases, the minimum displacement vector is used to resolve the collision.

sentences: Game Design Schools in Canada I am a High School student in Ontario and i am trying looking for college/university programs the are specifically about game design. There are quite a few at most colleges near me, but they are all BA's and I am looking for a BSc. The only one i have been able to find is at digipen but that is across the continent and more importantly outrageously expensive. Does anyone know of and programs in Canada or the US that offer a BSc in Game design?

sentences:
DataPath error when loading images on Android So yesterday i was trying to load some textures asynchronously and managed to make this
 private IEnumerator GetTextureFromPath(string _dirname)
    {
        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname + "/"  ,"*.jpg");
        Debug.Log("data Path" + Application.persistentDataPath);
        source = new Texture2D[fileNames.Length];
        Array.Sort(fileNames, (s1, s2) => Path.GetFileName(s1).CompareTo(Path.GetFileName(s2)));
        int index = 0;
        Debug.Log(fileNames);
        foreach (var fileName in fileNames)
        {
            UnityWebRequest webRequest = UnityWebRequestTexture.GetTexture(fileName);
            while (!webRequest.isDone)
            {
                yield return webRequest.SendWebRequest();
            }
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                Debug.Log(webRequest.error);
            }
            else
            {
                source[index] = ((DownloadHandlerTexture)webRequest.downloadHandler).texture; //LoadTextureFromPath(fileName);
                source[index].name = fileName;
                index++;
                Debug.Log("Ends server comm");
            }
        }
    }

now once i use it like this i get errors on the mobile build
2021/05/27 14:44:03.305 16476 25662 Error Unity Curl error 7: Failed to connect to localhost port 80: Connection refused

which i also tried by replacing ((DownloadHandlerTexture)webRequest.downloadHandler).texture with LoadTextureFromPath(fileName) and that cannot find the path which exists in my device and in that exact path. in the filder LevelAnimals are images which i want to load
DirectoryNotFoundException: Could not find a part of the path '/file:/storage/emulated/0/Android/data/com.FocusPoint/files/LevelAnimals'.

i found out after googling a bit that i might need to use "file///" or "file//" before the path but that didnt work either.
This script works on the editor and does the job that its supposed to do but it does not load the images on the device build.
now the LoadTexture is this
 public Texture2D LoadTextureFromPath(string path)
    {
        if (string.IsNullOrEmpty(path))
        {
            Debug.LogError("Texture path is null or empty");
            return null;
        }

        if (!File.Exists(path))
        {
            Debug.LogError($"File not found: {path}");
            return null;
        }

        byte[] bytes = File.ReadAllBytes(path);
        Texture2D texture = new Texture2D(2048, 2048, TextureFormat.RGB24, false);
        texture.LoadImage(bytes);
        Debug.Log("success");
        return texture;
    }

Any help would be appreciated thank you!

sentences: How do I set up in-app purchasing in iOS? I am using Unity and I developing an app for iOS. How do I implement in-app purchases that work world-wide?

sentences:
Should I get an official content rating, like from the ESRB, or just rate my game myself? I'm developing a game out of my garage basically with the intention of selling it on my own website and hopefully on Steam, and I've been wondering if I should try to get it rated by an official ratings agency, like the ESRB, or just display my own content rating? As I see it, rating the contents of your game has three purposes.

Let the player know the type of any potentially objectionable content they are about to experience.
Access certain marketplaces that require a content rating.
Fulfill legal requirements in certain countries that do not allow minors to be exposed to certain content.

Purpose #1 is the most important, and you certainly don't need any official ratings body to do that. Purpose #2 doesn't seem to be necessary for Steam. As for #3, I'm in the United States but I don't know how exactly any such laws would apply.

I looked into getting an official ESRB rating for a digital-download-only game, and it seems to be a hassle. It used to be that you could send them a letter in the mail with your company information, then they would create an account for you to log in to their website where you could fill out a questionnaire to have your game rated for free. They discontinued that in 2018 I think. Now they say you still can get a free rating through the IARC through participating storefronts, like the Windows Store, but it seems all of them require you to pay for a developers account before you can access the rating form.

So if I just make my own content rating, I don't want to create a new system that nobody is familiar with. Would I still be able to use "M for Mature" without the ESRB's blessing? Do they have a copyright on that phrase? I was thinking of using a similar color scheme (black with white text) to make it look similar to an official ESRB rating and using the content descriptors they use, but without mentioning the ESRB. Does that seem like a good idea?

sentences:
Behavior tree implementation details I have been looking around for implementation details of behavior trees, the best descriptions I found were by Alex Champarand and some of Damian Isla's talk about AI in Halo 2 (the video of which is locked up in the GDC vault sadly).

However, both descriptions fall short of helping one actually create a BT, one particular question has been bugging me for a while.

When is the tree in a behavior tree evaluated?

Furthermore:

If the tree is in the middle of executing a sequence of actions (patrolling waypoints) and a higher priority impulse comes in (distraction sound) , how to switch to that side of the tree seamlessly without resorting to a state machine like system and if it is decided that the impulse was irrelevant (the distraction is too far away to affect this guard), how to go back to the last thing that the guard was doing ?

I have quite a few questions like this and I don't wish to flood the board with separate queries so if you know of any resource where questions like these can be answered I would be very grateful.

sentences:
Animate multiple entities I'm trying to animate multiple(3) entities using one model(IQM format).

It's working but performance is really bad because I'm calling animate function for each entity in my game loop (I think problem is there).

What's the best way to animate multiple entities (with different animation ofc) in OpenGL? I think I can try build one VBO / entity for better performances but I don't think it's the best way to do it.

sentences:
How do you convert an object to camera view with a matrix I've been stuck with this math problem for quite some time. I'm trying to convert an object to viewport coordinates, similar to gluLookAt. I tried putting the threads and articles I found into code, but it doesn't give me the correct results.

import numpy as np

def toCameraCoords(points, cameraLoc, itemLoc):
    up_h = np.array([0, 1, 0])
    forward = (cameraLoc - itemLoc) / np.linalg.norm(cameraLoc - itemLoc)
    right = -np.cross(forward, up_h) / np.linalg.norm(np.cross(forward, up_h))
    up = np.cross(forward, right)

    M_translation = np.eye(4)
    M_translation[0:3, 3] = -cameraLoc

    M_rotation = np.eye(4)
    M_rotation[0, 0:3] = right
    M_rotation[1, 0:3] = up
    M_rotation[2, 0:3] = forward

    M = M_rotation.dot(M_translation)

    return M.dot(points)

points = np.array([
    [7, 7, 9, 9, 7, 7, 9, 9],
    [3, 5, 5, 3, 3, 5, 5, 3],
    [3, 3, 3, 3, 1, 1, 1, 1],
    [1, 1, 1, 1, 1, 1, 1, 1]
])

locations = toCameraCoords(points, np.array([0, 0, 8]), np.array([8, 4, 2]))

print(locations)

If you look at the image below, the top row shows a camera at location |0 0 8| which points at the centre of a cube |8 4 2|. I've used |0 1 0| as the upward direction.

The bottom row shows a camera in the origin pointing towards -z. If the camera is rotated around the z-axis, it does show the cube correctly, but this is as far as I got. Could someone point out what I'm doing wrong?

sentences:
Finding a tile number in a grid system Hi I am trying to find the Tile number of a grid of tiles based on the Z and X coordinates.

Where the Z and X axis are potentially infinite in either direction how can i get the number of the tile, based on the Z and X coordinates.

Sorry for the crude drawing

sentences:
How to make an illusion where the contents of a 3D shape change based on which face you look through? I remember coming across a Unity 3D tutorial where there was a technique where the contents of a 3D shape change based on which face you are looking at, similar to this screenshot from Antichamber:

What is this techique called? And how do I implement it into a Unity 3D project?
Thanks in advance.

sentences: How to make one 3D object face another? I'm writing a simple 3D engine myself and I cannot figure out how to make one object face another. The problem begins with identifying which direction the target object is in relation to the second. Actually rotating an object is not a problem, but essentially identifying the direction a particular object is facing (let's say, by identifying the global direction a key facet is facing) is a problem.

sentences:
Trying to leave a trail of particle effects with a Particle system attached to an Object Unity C# I have a particle system attached to my game object, which starts to emit particles when I press down the "W" key and stops when I release it. The particle system works fine, but when I rotate the object, the particles rotate with the object. I would like to have the particles leave behind a trail of the path of the object.

Script below:

public class Motor : MonoBehaviour {

public ParticleSystem EngineLeft;
public ParticleSystem EngineRight;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetKey(KeyCode.W))    {
        transform.Translate(Vector3.forward * Time.deltaTime * Speed);
    }

    if (Input.GetKeyDown (KeyCode.W)) {
        EngineRight.Play ();
        EngineLeft.Play ();
    }

    if (Input.GetKeyUp (KeyCode.W)) {
        EngineRight.Stop ();
        EngineLeft.Stop ();
    }

sentences:
One framebuffer for each light vs unique framebuffer per light Currently I have two ideas how to implement my lighting system:

1) Use one framebuffer per light source

no need to switch texture attachments of framebuffer
may be faster
bigger memory usage

2) Use one framebuffer for every light source

some time may be wasted on attaching new textures to framebuffer
less memory usage

So could you please tell me which way is better and why? Or I'm totally wrong on my thoughts and there is no difference at all?

sentences:
What is the best practice for future proofing my editor enumerations? I would like to know the best practices for handling the following situation:

Suppose the project you are working on is split in to two sub-projects; the game engine library, and the editor GUI.

You have the method bool Method( const MethodParams &params ) that will be called during game-level initialization; it is a method that belongs to the game engine library. The parameters of this method, passed as a reference to the structure MethodParams, can be decided via the editor in the level design phase. The MethodParams structure is as follows:

enum Enum1
{
    E1_VAL1,
    E1_VAL2,
};

enum Enum2
{
    E2_VAL1,
    E2_VAL2,
    E2_VAL3,
};

struct MethodParams
{
    float   value;
    Enum1   e1;
    Enum2   e2;
    // some other members
}

The editor should present a dialog that will allow the user to set the values in the MethodParams structure. The editor needs to present a text box for value, and let the user set the fields e1 and e2 using a combo box, for example. Every enum option should be mapped to a string, so the user can make an informed selection (normally, the names used in the enum would be more meaningful). One could even want to map every enum to a more informative string (so, for example, E1_VAL1 could map to "Image union algorithm", and E1_VAL2 could map to "Image intersection algorithm").

The editor will include all the relevant game engine library files (.h, etc.), but this mapping is not automatic, and I am confused by how to handle it in a way that where code change will be minimal, if I add further enum options in the future.

sentences: Display crosshair that is diplaying where the ship is aiming at I am creating a 3D asteroids game. I got the bullets, asteroids, and ship all done. They work perfectly. Now I want a crosshair to display where the ship is pointing at. The crosshair will be a 2D sprite.

sentences:
Avoiding Incredibuild error when building Apparently the UE4 Installed Build script function is trying to use Incredibuild, but halting with an error.

I believe this is due to my Agent Services not running, due to the fact that I have none.

I don't have a license, and so I can't use Incredibuild.

How can I modify the scripts to not use Incredibuild?
I downloaded FastBuild, and want to give that a try.
I just need help in knowing which scripts to modify.

sentences:
change widget's size through blueprints I want to change the size X of my 'Horizontal Box' widget's through blueprints but cannot figure out how to do that... the properties that I want to be able to control from blueprints are marked red below:

To give you some context, I need this to instantiate my widget dynamically. I first add a bunch of child widgets which works just great, but I also need to kinda resize the quad in the background to fit in size the child widgets that I am 'spawning'. Isn't there really any way to do this? Because this seems a super-basic thing to do as from my point of view but can't find it anywhere...

sentences:
Running two simultaneous animations on a model? I am just looking for a broad answer to this question. I am more curious about the general information rather than the specific. Also, I tried to search for this, but I think it's hard to word it so you get the right question. Anyway:

One common thing I see in a lot of games is multiple animations on the same model.

i.e.

A character runs, but also raises his arms an shoots.

A character has a walking animation, but can also be carrying resources as he walks.

I am curious if the first model has a "run" animation and a "run while shooting" animation. Or if they have a "run" animation and a "shoot" animation and run them at the same time. Obviously the first is possible, but I am wondering how the second one is done.

Do they use two models for upper and lower body or is there a way to ignore certain parts of a model when animating?

I know this depends a lot on the model, the programmer, language and the way the animation is done.

But broadly, if you were making a model with the intent of it doing multiple animations at once, what would be the best way to go about it?

Again, not after detailed specifics, just an overview :)

Thanks!

sentences:
Vertex Normals, Loading Mesh Data My test FBX mesh is a cube. From what I surmise, it seems that the cube is on the extreme end of this issue, but I believe that the same issue would be able to occur in any mesh:

Each vertex has 3 normals, each pointing a different direction. Of course loading in any type of mesh, potentially ones having thousands of vertices, I need to use indices and not duplicate shared verts. Currently, I'm just writing the normals to the vertex at the index that the FBX data tells me they go to, which has the effect of overwriting any previous normal data. But for lighting calculations I need more info, something that's equivalent to a normal per face, but I have no idea how this should be done. Do I average the 3 different verts' normals together or what?

sentences:
Triple buffering causes input lag? Consider some time in between two vsyncs. Suppose the first display buffer is being used to display the current image, and suppose the game was really fast and computed and rendered the next image to the second display buffer and the next one after that to the third display buffer. That is the rendering to the second and third display buffer happens so fast that it occurs before the next vsync.

Suppose input from the user comes in now. What you would like is for the results of the input to show up on the next vsync or (probably more typical) the vsync after that. However, with the third display buffer already rendered the input can only effect the image after that. Meaning the input will only take effect at best 3 vsyncs later.

I wish i had an image to show the exact timings of what I mean.

sentences:
Animator on a WorldSpace Canvas Ok, so I have my world space canvas attached to the player object. In my script I have a reference like this :

 GameObject myWorldCanvas;

Awake()
{
 myWorldCanvas= transform.FindChild("nameOfObject").gameObject;
}

Then when the right conditions are met I simply activate the object like this :

myWorldCanvas.SeActive(true);

This worked perfectly until I added a animator to the object. If I manually enable/disable the object in the scene the animation works perfectly(it just changes the scale to give it a pop effect), but when the object is activated by my script the animation still plays and changes the scale values but nothing is rendered. In play mode if I manually enable/disable the animation works.

Any ideas ? If you need more info or screens let me know.

Edit : the canvas has some buttons as children and when I mouse over something seems to be refreshed and the images show up on screen.

Edit: Further test have show that manually disabling and enabling the Canvas component also shows the images, but If the canvas and game object are enabled from a script nothing shows up on the screen.

Edit: I solved the problem by disabling the canvas component on the first key of the animation and then enabling it on the second one where the Y scale is set to 0. This seems more like a hack and I dont like it. Does anyone have a idea why this is happening ?

sentences:
How to get buttons to follow the GUI perfectly while also being usable in GameMakerStudio Basically I'm trying to figure out how to make a button, that you can interact with that shows above the GUI draw event and locks perfectly to the screen.

The current draft I have the button is below the GUI layer so I need it above

The button is functional so thats good

The button does not lock perfectly to the screen when the camera stops it lags behind and has to catch up to the camera no matter what direction I move, I dont want the player to see the button actually following I want all the parts to move seamlessly together.

This is a gif of whats happening

sentences:
Exponential Variance Shadow Mapping - implementation I use a variance shadow mapping with a "standard" light bleeding fix in my graphics engine which is based on deferred rendering.. I have a single shadow map for a directional light beacause a test scene is relatively small. Saving depth looks like this:

float moment1 = gl_FragCoord.z;
float moment2 = moment1 * moment1;
outColor = vec2(moment1, moment2);

Then I perform a separable gaussian blur on that texture.

Shadow test:

float Chebyshev(vec2 moments, float mean, float minVariance)
{
    float shadow = 1.0f;
    if(mean <= moments.x)
    {
        shadow = 1.0f;
        return shadow;
    }
    else
    {
        float variance = moments.y - (moments.x * moments.x);
        variance = max(variance, minVariance);
        float d = mean - moments.x;
        shadow = variance / (variance + (d * d));
        float amount = 0.3f;
        shadow =  clamp((shadow - amount) / (1.0f - amount), 0.0f, 1.0f); // standard light bleeding fix
        return shadow;
    }
}

vec4 shadowCoord = shadowMatrix * vec4(viewSpacePosition, 1.0f);
vec2 moments = texture(ShadowMap, shadowCoord.xy).xy;
float minVariance = 0.000001f;
float shadow = Chebyshev(moments, shadowCoord.z, minVariance);

I found a interesting technique - Exponential Variance Shadow Mapping which should provides better light bleeding fix. Here is saving depth for that technique:

float positiveExponent = 40.0f;
float negativeExponent = 5.0f
float depth = gl_FragCoord.z;
vec2 exponents = vec2(positiveExponent, negativeExponent);
depth = 2.0f * depth - 1.0f;
float pos = exp(exponents.x * depth);
float neg = -exp(-exponents.y * depth);
vec2 warpDepth = (pos, neg);
outColor = vec4(warpDepth, warpDepth * warpDepth);

How to implement a shadow test for that technique ? Here is my attempt:

float positiveExponent = 40.0f;
float negativeExponent = 5.0f;
vec2 exponents = vec2(positiveExponent, negativeExponent);

vec2 warpDepth(float depth)
{
    depth = 2.0f * depth - 1.0f;
    float pos = exp(exponents.x * depth);
    float neg = -exp(-exponents.y * depth);
    vec2 wDepth = vec2(pos, neg);
    return wDepth;
}

float Chebyshev(vec2 moments, float mean, float minVariance)
{
    float shadow = 1.0f;
    if(mean <= moments.x)
    {
        shadow = 1.0f;
        return shadow;
    }
    else
    {
        float variance = moments.y - (moments.x * moments.x);
        variance = max(variance, minVariance);
        float d = mean - moments.x;
        shadow = variance / (variance + (d * d));
        return shadow;
    }
}

vec4 shadowCoord = shadowMatrix * vec4(viewSpacePosition, 1.0f);
vec4 moments = texture(ShadowMap, shadowCoord.xy).xyzw;
vec2 posMoments = vec2(moments.x, moments.z);
vec2 negMoments = vec2(moments.y, moments.w);
vec2 wDepth = warpDepth(shadowCoord.z);
//float minVariance = 0.000001f;
//Edit
vec2 depthScale = 0.0001f * exponents * wDepth;
vec2 minVariance = depthScale * depthScale;
float posResult = Chebyshev(posMoments, wDepth.x, minVariance.x);
float negResult = Chebyshev(negMoments, wDepth.y, minVariance.y);
shadow = min(posResult, negResult);

Unfortunately it doesn't remove light bleeding. Did I do something wrong ? Maybe I should calculate two different minVariance based on the positive and negative exponents ?

Edit1:
Calculating minVariance this way:

vec2 depthScale = 0.0001f * exponents * wDepth;
vec2 minVariance = depthScale * depthScale;
float posResult = Chebyshev(posMoments, wDepth.x, minVariance.x);
float negResult = Chebyshev(negMoments, wDepth.y, minVariance.y);

gives better results but light bleeding is still quite visible.

Edit2:
Light bleeding:
EVSM with minVariance which is calculated as above gives better result than VSM without standard light bleeding fix, but to get the best result I also use standard light bleeding fix with EVSM. A light bleeding fix is performed in Chebyshev function but maybe I should add it after following calculation: shadow = min(posResult, negResult) ?

EVSM causes small artifacts on the illuminated side of the objects so I add some glPolygonOffset when saving EVSM depth.

sentences:
2D Infinite Runner : how to manage background layers? First of all, sorry for this post, I guess this already has been discussed. I browsed stackexchange and the web but I couldn't seem to find a clear information for my case, with always mixed results.

So I'm making a mobile game with Unity, and am re-starting the development from the beginning in order to have smooth performances. The game is a 2D runner (Canabalt style).
Though there will be two modes :

One story mode with about 12 levels precisely designed which will be
always the same
One arcade mode with randomly generated level (platforms).

Main features :

Back and Foreground Parallax (5-6 layers totally, with different
movement speed)
Automatically running, manually jumping over holes    and attacking
ennemies

So I have a few interrogations :

The classic question : should I make it like a theadmill, having a
fixed player position, and making the level move forward. Or should I
be moving the character as the camera follows him ? Given the fact
that I want multiple parallax background. Are there differences
performance-wise ?
A linked question : should I use the perspective camera and play with
the Z axis ? or keep the orth camera ? I'm not sure how it affects
the performances.

Then, having read many topics, I guess I should try to move back the objects and backgrounds, instead of instantiating and destroying them all the time when doing a random level, right ?
And for my pre-designed levels (not random) should I split the background to display it step by step, in terms of performance ?

I already know how to scroll my backgrounds, make a parrallax effect with my 5-6 layers, here I'm looking for tips to start clean with the smartest development style, especially in terms of performances and would like to have some hints on which are the best practices to follow

Maybe you have other good practices to share with me... I'm hoping I'm not asking too much, thanks for any insights !

Have a good day

sentences:
How to create a split screen display with one frame and canvas I am creating a 2D Java game, which looks like this:

My question is what should I do to my display to create two 'separate' displays.
I plan on doubling the height of the program, and have a second display which is able to render completely separately to the top display. I'd like it to look like this:

I would like to not have to click between the two displays to be able for them to recognize input. I think this could be done by just keeping one canvas and just commanding the canvas to draw in certain areas? I also am not planning on using any external libraries.

Game class: (Some irrelevant code removed)

public class Game implements Runnable {

private Display display;
private int width, height;
public String title;

private Thread thread;
private boolean running = false;

private BufferStrategy bs;
private Graphics g;

public State gameState;
public State menuState;

private Handler handler;

public Game(String title, int width, int height) {
    this.width = width;
    this.height = height;
    this.title = title;
}

private void tick() {
    // Ticks the current game state
    if(StateManager.getState() != null) {
        StateManager.getState().tick();
    }
}

private void render() {
    bs = display.getCanvas().getBufferStrategy();
    if(bs == null) {
        display.getCanvas().createBufferStrategy(3);
        return;
    }
    g = bs.getDrawGraphics();

    //Clear screen
    g.clearRect(0, 0, width, height);

    // Gets the current game state and runs its render method
    if(StateManager.getState() != null) {
        StateManager.getState().render(g);
    }

    // End drawing
    bs.show();
    g.dispose();
}

// Initialize the display, assets, and game states
public void init() {
    display = new Display(title, width, height);
    display.getFrame().addKeyListener(keyManager);
    display.getFrame().addMouseListener(mouseManager);
    display.getFrame().addMouseMotionListener(mouseManager);
    display.getCanvas().addMouseListener(mouseManager);
    display.getCanvas().addMouseMotionListener(mouseManager);

    Assets.init();

    handler = new Handler(this);

    gameState = new GameState(handler);
    menuState = new MenuState(handler);

    StateManager.setState(gameState);
}

public void run() {
    init();

    // Some unimportant code is removed for sake of space
    while (running) {
        tick();
        render();
    }

    stop();
}

}

Display class:

public class Display {

private JFrame frame;
private Canvas canvas;

private String title;
private int width, height;

public Display(String title, int width, int height) {
    this.title = title;
    this.width = width;
    this.height = height;

    createDisplay();
}

private void createDisplay() {
    frame = new JFrame(title);
    frame.setSize(width, height);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    canvas = new Canvas();
    canvas.setPreferredSize(new Dimension(width, height));
    canvas.setMaximumSize(new Dimension(width, height));
    canvas.setMinimumSize(new Dimension(width, height));
    canvas.setFocusable(false);

    frame.add(canvas);
    frame.pack();
}

public Canvas getCanvas() {
    return canvas;
}

public JFrame getFrame() {
    return frame;
}

}

Launcher class:

public class Launcher {

private final static String TITLE = "Game";
private final static int WIDTH = 256;
private final static int HEIGHT = 192;

public static void main(String[] args) {
    Game game = new Game(TITLE, WIDTH, HEIGHT);
    game.start();
}

}

sentences:
Entity Component System: system and components relation I'm planning to develop a game in C# (but I don't think that language matters) and I'll be using Entity Component System since I know by design that my game will have a lot of different game items with different twisted behaviours and logics.
I have some experience using Unity ECS which I find very easy and intuitive. I've also programmed games in the past using the old "inheritance approach" and I found that pattern very not scalable.
As far as I know, a pure ECS (which is not what Unity implements) works like this:

A GameObject is just a collection on Components, it may be seen as a wrapper class or as a shared index in some parallel arrays of Components.
A Component is a collection of data (basically a record) which holds the data needed by its relative System to handle it. It does not implements game logic itself.
A System is a world object which loop through each GameObject which has a component it can process and update game logic of that component.

My point is: if the Systems are the ones responsible for the actual game logic update (practically speaking, the game logic code is written inside the system), is there a 1:1 relation between every component and every system ? Let me explain with an example: let's say I have 2 components:

RenderSpriteComponent
RenderLightSourceComponent

The first one does a simple 2D sprite rendering (using OpenGL or whatsoever); the second one send a light source to the rendering shaders. They do similar operations but with some actual differences. My question is: since they behaviour is different, should I implement two different Systems which will handle them separatly? If not, should I add a bunch of IF statements or overloads to handle those two components inside the same System?
From my point of view both ways seem unnecessary, especially if the ECS should improve code scalability. Using one of those approach would force me either to implement a different system for each component I have (implying a lot of GameObjects loops) or either to fill my Systems with if and overloads making them impossibile to understand after a certain point.
Furthermore, from what I can see and understand, Unity implements a different version of this pattern in which every component implements its own logic (in the Update method) and the GameObject is a wrapper class which has an internal list of components to update. Systems don't exist at all (or if they do they do, they do so for other reasons). This implementation looks easier and more "elegant" from my point of view, but I can't understand why it's not so spread and everyone sticks to the "classic" ECS implementation which has those "problems" I've described above. At the same time, I do not have control over the priority of the components updates, which can be useful in some cases.
I understand there isn't an "absolute" better way to design your game structure, but I'd like to know how is generaly implemented. Or which factors would make a way better than the other.

sentences:
Why do actors stretch when I add them to a stage in LibGDX? I have started learning LibGDX and I have been making a few little games to learn how it all works but ever since I started using stages and actors, all of my textures stretch horizontally and I can't seem to fix it at

public class GameScreen extends BaseScreen
{
private BaseActor background;
private PhysicsActor spaceship;
private BaseActor rocketfire;

private PhysicsActor baseLaser;
private AnimatedActor baseExplosion;

private ArrayList<PhysicsActor> laserList;
private ArrayList<PhysicsActor> rockList;
private ArrayList<BaseActor> removeList;

public GameScreen(BaseGame g)
{
    super(g);
}

public void create()
{
    spaceship = new PhysicsActor();
    Texture shipTex = new Texture("fire.png");
    shipTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    spaceship.storeAnimation("default", shipTex);
    spaceship.setPosition(400, 300);
    spaceship.setOriginCenter();
    spaceship.setMaxSpeed(200);
    spaceship.setDeceleration(20);
    spaceship.setEllipseBoundary();
    mainStage.addActor(spaceship);
}

public void update(float dt)
{

}
}

BaseScreen class

public abstract class BaseScreen implements Screen, InputProcessor
{
protected BaseGame game;
protected Stage mainStage;
protected Stage uiStage;
public final int viewWidth;
public final int viewHeight;
private boolean paused;

public BaseScreen(BaseGame g)
{
    this(g, 1024, 600);
}

public BaseScreen(BaseGame g, int viewWidth, int viewHeight)
{
    game = g;
    this.viewWidth = viewWidth;
    this.viewHeight = viewHeight;
    mainStage = new Stage(new FitViewport(viewHeight, viewHeight));
    uiStage = new Stage(new FitViewport(viewWidth, viewHeight));
    paused = false;
    InputMultiplexer im = new InputMultiplexer(this, uiStage, mainStage);
    Gdx.input.setInputProcessor(im);
    create();
}

public abstract void create();
public abstract void update(float dt);

public void render(float dt)
{
    uiStage.act(dt);
    if (!isPaused())
    {
        mainStage.act(dt);
        update(dt);
    }

    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    mainStage.draw();
    uiStage.draw();
}

I changed the texture to a perfect red square but when renderered on the screen it was more rectangle shaped than square (horizontally) and I have no idea why. I read somewhere that it was something to do with the camera but I have no idea what to do to fix it! Please help :O

sentences:
How do I make objects move along a path? I'm trying to get something like the below image. As you can see, there's a highway and inside of it, there'll be some objects moving (millisecond). I guess the street behavior is like a pipeline. When the highway loads an object, it appears at the beginning and it'll be moving through the highway until it arrives in the other extreme of the highway.

My main problem is, how can I move several objects only inside of the highway?

sentences:
How to architect input code to utilise state machine? I have an InputController which currently handles all user input, so it looks at button states and updates entity intentions according to some simple rules.

I'm looking to add a new state to the game which essentially means displaying the player's inventory on screen. During this state I want the background to continue animating but want the user input to only interact with the inventory layer.

As the code stands right now the background will animate just fine under the inventory layer but the InputController will continue to behave like the layer isn't there and attempt to map clicks etc. to the game world.

An easy solution would be to add simple conditional logic in the controller if (currentState == x) but wondered if I could better utilise my existing game state machine. I have states such as game_loading, in_game, menu etc.

The only ideas I can come up with is either calling out to something like state.HandleInput() from inside the controller, that way the state is in control of what the player can and can't do but the downside is that input specific logic is being handled by a state rather than input specific code, which I'm not comfortable with.

Alternatively, I could reverse that and get the state to be the entry point and then they call out to specific input classes. So something like inGameState.HandleInput() calls out to inGameInputController likewise with inventoryState. This seems like the better approach.

I'm clearly not sure which way round the dependencies should orient. Am I missing a layer of abstraction somewhere? Or am I overcomplicating things?

sentences:
Use raycast to fix bullet's direction? Player cam has a raycast. I need it to work as pointer for player's bullet direction. If the ray hits any kind of object this spot will be the aim of player's bullets.

Here is my script

public class camraycast : MonoBehaviour {

Camera mycamera;
GameObject prefab;

public int bulletSpeed = 10;
public GameObject angle; //  camera
public GameObject players;

void Start () {
    prefab = Resources.Load("bullets") as GameObject;
    mycamera = GetComponent<Camera>();
}

void Update() {

    if (Input.GetMouseButtonDown(0))
    {
        Vector3 camScreen = new Vector3(0.5f, 0.5f, 0f); // center of the screen
        float rayLength = 100f;
        Ray ray = mycamera.ViewportPointToRay(camScreen);
        RaycastHit hit;
        Debug.DrawRay(ray.origin, ray.direction * rayLength, Color.red);

        if (Physics.Raycast(ray, out hit, rayLength))
        {
            print ("Looking at : " + hit.transform.name);
            GameObject bullets = Instantiate(prefab) as GameObject;
            bullets.transform.position = players.transform.position + angle.transform.forward * 0.1f;
            Rigidbody rb = bullets.GetComponent<Rigidbody>();
            rb.AddForce((hit.point - angle.transform.position) * bulletSpeed);
            Destroy(bullets, 9f);
        }
    }
    Vector3 camScreens = new Vector3(0.5f, 0.5f, 0f); // center of the screen
    float rayLengths = 100f;
    Ray rays = mycamera.ViewportPointToRay(camScreens);
    Debug.DrawRay(rays.origin, rays.direction * rayLengths, Color.red);
}
}

sentences:
How should a hive AI distribute tasks between worker drones? I've been studying AI design—things like behavior trees and FSMs. They make sense from the perspective of deciding a specific entity's goal and action.

However, the AI in my game is very hive-like; multiple drones share the same knowledge and desires. What a particular drone can do is unimportant, as each can do any task. Instead, it's a question of which drone would be the best choice for a particular task, given the list of tasks to be done.

For example: The AI decides it wants a particular resource type gathered. Different resource types are available at various locations across the map. Which drone should it send to gather the resource? All are capable, but some might be further away from the resource. Some might already be gathering a different resource. Some might be performing tasks that the player is actively waiting on, or that strongly affect the player's success.

To decide, the AI would need to evaluate various factors and continually re-evaluate as the game progresses, without stepping on it's own toes and continually reassigning jobs to the same drones.

Is there a field of AI suited to this sort of task distribution that I can look into?

sentences:
Hue, saturation, brightness, contrast effect in hlsl I am new to pixel shader, and I am trying to write a simple brightness, contrast, hue, saturation effect. I have written a shader for it but I doubt that my shader is not providing me correct result, Brightness, contrast, saturation is working fine, problem is with hue. if I apply hue between -1 to 1, it seems to be working fine, but to make things more sharp, I need to apply hue value between -180 and 180, like we can apply hue in Paint.NET.

Here is my code.

// Amount to shift the Hue, range 0 to 6
float Hue;
float Brightness;
float Contrast;
float Saturation;
float Alpha;

sampler Samp : register(S0);

// Converts the rgb value to hsv, where H's range is -1 to 5
float3 rgb_to_hsv(float3 RGB)
{
    float r = RGB.x;
    float g = RGB.y;
    float b = RGB.z;

    float minChannel = min(r, min(g, b));
    float maxChannel = max(r, max(g, b));

    float h = 0;
    float s = 0;
    float v = maxChannel;

    float delta = maxChannel - minChannel;

    if (delta != 0)
    {
        s = delta / v;

        if (r == v) h = (g - b) / delta;
        else if (g == v) h = 2 + (b - r) / delta;
        else if (b == v) h = 4 + (r - g) / delta;
    }

    return float3(h, s, v);
}

float3 hsv_to_rgb(float3 HSV)
{
    float3 RGB = HSV.z;

    float h = HSV.x;
    float s = HSV.y;
    float v = HSV.z;

    float i = floor(h);
    float f = h - i;

    float p = (1.0 - s);
    float q = (1.0 - s * f);
    float t = (1.0 - s * (1 - f));

    if (i == 0) { RGB = float3(1, t, p); }
    else if (i == 1) { RGB = float3(q, 1, p); }
    else if (i == 2) { RGB = float3(p, 1, t); }
    else if (i == 3) { RGB = float3(p, q, 1); }
    else if (i == 4) { RGB = float3(t, p, 1); }
    else /* i == -1 */ { RGB = float3(1, p, q); }

    RGB *= v;

    return RGB;
}

float4 mainPS(float2 uv : TEXCOORD) : COLOR
{
    float4 col = tex2D(Samp, uv);

    float3 hsv = rgb_to_hsv(col.xyz);

    hsv.x += Hue;
    // Put the hue back to the -1 to 5 range
    //if (hsv.x > 5) { hsv.x -= 6.0; }
    hsv = hsv_to_rgb(hsv);
    float4 newColor = float4(hsv,col.w);

    float4 colorWithBrightnessAndContrast = newColor;

    colorWithBrightnessAndContrast.rgb /= colorWithBrightnessAndContrast.a;
    colorWithBrightnessAndContrast.rgb = colorWithBrightnessAndContrast.rgb + Brightness;
    colorWithBrightnessAndContrast.rgb = ((colorWithBrightnessAndContrast.rgb - 0.5f) * max(Contrast + 1.0, 0)) + 0.5f;
    colorWithBrightnessAndContrast.rgb *= colorWithBrightnessAndContrast.a;

    float greyscale = dot(colorWithBrightnessAndContrast.rgb, float3(0.3, 0.59, 0.11));
    colorWithBrightnessAndContrast.rgb = lerp(greyscale, colorWithBrightnessAndContrast.rgb, col.a * (Saturation + 1.0));
    return colorWithBrightnessAndContrast;
}

technique TransformTexture {
    pass p0 {
        PixelShader = compile ps_2_0 mainPS();
    }
}

Please If anyone can help me learning what am I doing wrong or any suggestions?
Any help will be of great value.

EDIT:
Images of the effect at hue 180:

On the left hand side, the effect I got with @teodron answer. On the right hand side, The effect Paint.NET gives and I'm trying to reproduce.

sentences:
RTS Attack Formation If i select a group of units and send them somewhere i form them like the following;

If i select them and order an attack, i want three things to happen:

High range units should keep the distance while attacking.
Each unit should attack if possible.
Attack formation should not look too unnatural.

Now i can handle the first two by forming the units as a circle by considering the range and unit count etc. But it looks very unnatural.

It's acceptable if some of the units are being idle for some reason, but i want most of the units join attack and they don't look so artificial.

Any ideas on that? Thanks.

sentences: Tools/methods for creating demo videos of iPhone/iPod Touch games? I'd like to create a simple demo video of a game for iPhone and iPod Touch.  What tools do people use for this?  Ideally I can capture the device's screen... as opposed to the simulator.  Also the game uses tilt controls... hence capturing the device's screen helps put actual game play into the demo video.

sentences:
determining view boundaries based on z position when using a perspective projection I'm using three.js to make an animation of a box moving around the screen in 3 dimensions.

It is moving pseudo-randomly, according to a noise function. So, I want to place an invisible wall just outside of view, so the box tends to stay in the screen.

I have accomplished this. However, it only works correctly when the box's z coordinate is 0.

I need a function that calculates the boundaries based on the z coordinate of the box. Right now, if z is negative (farther away) the boundary is too small and if z is positive the boundary gets too big.

I am not sure how to go about this. This is how I am creating the camera, I am new to three.js and this part I just copied from a tutorial:

var camera = new THREE.PerspectiveCamera(45, window.innerWidth/window.innerHeight, 1, 10000);
camera.position.z=1000;

This is the function signature from the docs:

PerspectiveCamera( fov, aspect, near, far )

fov: Camera frustum vertical field of view.
aspect: Camera frustum aspect ratio.
near: Camera frustum near plane.
far: Camera frustum far plane.

I'm not really sure what FOV does but I think it may be the key here....
If FOV allows me to get a relevant angle than I can probably use basic trig to find my offset value.

sentences:
C# Console Snake Game, sort of fps problem I have about 200 lines of code, really simple oop.

When I load the console game (snake), I don't see it running smooth, like fps problems in in games, but I don't understand why, because my files are a lot lighter and demand less resources than heavy games.

Thanks.

Linking my files to Pastebin

Main file: http://pastebin.com/60aeEBRa

SnakeObject.cs: http://pastebin.com/z0MPwNSA

Utilities.cs: http://pastebin.com/7jLDKUQ9

FoodObject.cs: http://pastebin.com/w1HuBQK4

RocksObject.cs: http://pastebin.com/QYcNbSad

Much thanks for your help.

I'm welcoming tips.

Thanks

sentences:
How to resolse collision between moving and static AABB? What I have is a map represented as list of Rectangles and player's rectangle. Also I have function to determine depth of the collision:
    Point TestAABBAABB(Rectangle a, Rectangle b) {
        Point mt = new Point();

    double rcx = Math.abs(a.getCenterX() - b.getCenterX());
    double rx = (a.width / 2 + b.width / 2);
    if (rcx > rx) {
        return new Point();
    }
    double rcy = Math.abs(a.getCenterY() - b.getCenterY());
    double ry = (a.height / 2 + b.height / 2);
    if (rcy > ry) {
        return new Point();
    }
    double overlap_x = rx - rcx;
    double overlap_y = ry - rcy;

    mt.x = 0;
    mt.y = 0;
    //this is the line
    if (overlap_x < overlap_y) {
        mt.x = (int) overlap_x;
        if (a.getCenterX() < b.getCenterX()) {
            mt.x = -mt.x;
        }
    } else {
        mt.y = (int) overlap_y;
        if (a.getCenterY() < b.getCenterY()) {
            mt.y = -mt.y;
        }
    }
    return mt;
}

It works fine if a player jumps "inside" the width of the wall, far from edges. //tail representation

But if player tries to jump near an edge, he moves through the wall and to the side as a result of non-zero X penetration depth of collision.

How do I avoid this situation so player slides under platform instead of getting pushed left or right and without having to set vx or vy to zero?

sentences:
Can't Get .enabled to Work for Children Sprites. What Gives? So I have an object with a few children. I want to be able to disable/enable 2 of their SpriteRenderers via one of my scripts. I feel like I'm doing things right, but apparently I'm not. And yes, my game objects have the appropriate tags that are being searched for in my code. I'll paste the relevant bits of code below:

public bool isAiming = false;
Animator playerAnim;

GameObject arm;
GameObject weapon;

SpriteRenderer armRenderer;
SpriteRenderer weaponRenderer;

void Start()
 {
     playerAnim = gameObject.GetComponent<Animator>();

     arm = GameObject.FindGameObjectWithTag("Arm");
     weapon = GameObject.FindGameObjectWithTag("EquippedWeapon");

     armRenderer = arm.GetComponent<SpriteRenderer>();
     weaponRenderer = weapon.GetComponent<SpriteRenderer>();
 }

void Update()
 {
     CheckIfAiming();
 }

void CheckIfAiming()
 {
     if (Input.GetButton("Fire2")) // Holding right click
     {
         isAiming = true;

         armRenderer.enabled = true;
         weaponRenderer.enabled = true;

         playerAnim.SetBool("isAiming", isAiming);
     }
     else
     {
         isAiming = false;

         armRenderer.enabled = false;
         weaponRenderer.enabled = false;

         playerAnim.SetBool("isAiming", isAiming);
     }
 }

What gives? I want to just enable the sprite rendering when I hold down the right mouse click. SetActive(false/true) is not an option as I still want code to affect them while they're not visible.

Am I just trying to access the SpriteRenderers incorrectly?

sentences:
Screen Space - Camera improper scaling on iOS device only I've reproduced the issue in a simple setup where I have two canvas's, one overlay and one camera. I put an image under both set to maintain aspect ratio, and set them to use anchors for sizing instead of pixels. On iOS the camera space canvas stretches the image improperly, and the overlay is fine. Both have identical settings, with Canvas Scaler set to screen size and to match width. This only seems to happen on older iOS devices, but my sample size is too small to say that for certain.
I expect both images to maintain aspect ratio on device, but the image under Screen Space - Camera stretches out of aspect ratio. Local Scale on all objects is what I would expect it to be so nothing interesting there.
Has anybody run into this issue before or have any idea what might be causing it?

sentences:
Job title for a roleplaying event gamemaster in an online RPG? I'm considering creating a position in an online RPG where the responsibilities would mainly involve conceiving roleplaying-oriented events and plotlines and executing on them using developer tools such as the ability to create instances of NPCs/items and the ability to control NPCs.  Examples of events/plotlines might be "ancient god of evil breaks loose from his prison and attacks the realm" or "upcoming marriage between offspring of powerful dynasties has political opponents trying to disrupt it".

What is the best job title for this sort of position?

The first thing that popped into my head was "customer experience associate", but this appears to have an established meaning in retail where it's a way of dressing up "salesperson".  "Game master" positions in MMOs are generally helpdesk positions with no creative duties or authority.  I want to select something that neither exaggerates nor undersells this person's level of responsibility.

sentences:
Two pass blur shader using libgdx tile map renderer I am trying to apply the following technique: blur effect using two pass shader to my libgdx game using the OrthogonalTiledMapRenderer. The idea is to blur the background wich is also a tilemap but rendered with another camera with a different zoom applied.

Here is a screen capture without effect:

Using the OrthogonalTiledMapRenderer sprite batch like this:

backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurX);
backgroundMapRenderer.render(layerBackground);

I get the following render:

Wich is ok for X blur pass. I then try using frame buffer object like in this example. But the effect seems to be too much zoomed:

I may be messing up with the camera and the zoom factor. Here is the code:

    private ShaderProgram shaderBlurX;
    private ShaderProgram shaderBlurY;

    private int FBO_SIZE = 800;
    private FrameBuffer targetA;
    private FrameBuffer targetB;

    targetA = new FrameBuffer(Pixmap.Format.RGBA8888, FBO_SIZE, FBO_SIZE, false);
    targetB = new FrameBuffer(Pixmap.Format.RGBA8888, FBO_SIZE, FBO_SIZE, false);

    targetA.begin();
    Gdx.gl.glClearColor(1, 1, 1, 0);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    backgroundMapRenderer.render(layerBackground);
    targetA.end();

    targetB.begin();
    Gdx.gl.glClearColor(1, 1, 1, 0);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurX);
    backgroundMapRenderer.render(layerBackground);
    targetB.end();

    TextureRegion back = new TextureRegion(targetB.getColorBufferTexture());
    back.flip(false, true);

    backgroundMapRenderer.getSpriteBatch()
        .setProjectionMatrix(backgroundCamera.combined);
    backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurY);
    backgroundMapRenderer.getSpriteBatch().begin();
    backgroundMapRenderer.getSpriteBatch().draw(back, 0, 0);
    backgroundMapRenderer.getSpriteBatch().end();

I know I am making something the wrong way, but I can't find any resources about applying two passes shader using tile map renderer.

Does someone know how to achieve this?

sentences: Inverse of perspective matrix, for what? I dont understand for what i need the inverse of the perspective Matrix in Computer Graphics and how do i calculate it?Maybe someone has an explanation for me.

sentences:
How do you call game mode where the time is running out and player can increase time by collecting coins I am working on an arcade game and I want to make a game mode, where the player has some time to collect coins. When a coin is collected player gets extra time, so the game can continue infinitely. But when the time is run out the game ends.
I don't know how to name this game mode. Do you have any suggestions? Something like: Time attack?

sentences: Will using OpenGL for rendering with SDL make my 2D game run smoother? I've been working on a 2D game using SDL.  I've noticed the objects look blurry and glitchy when they're moving, so I was thinking about using OpenGL to render the graphics.  Would this help?  What are the pros and cons of using OpenGL for a 2D game?

sentences:
Tessellation won't render I am starting to work with tessellation and have some problems right in the beginning. I try to render a quad made of two triangles with tessellation, but nothing appears on the screen. But as soon as I remove the tessellation shaders and change GL_PATCHES to GL_TRIANGLESagain, it starts working again, without tessellation obviously.

So here is my code to setup the tessellation shaders:

glPatchParameteri(GL_PATCH_VERTICES, 3);
shaderID = glCreateProgram();
{
    vertex = GraphicsUtilities::loadShader("D:\\vert.glsl", GL_VERTEX_SHADER);
    glAttachShader(shaderID, vertex);

    fragment = GraphicsUtilities::loadShader("D:\\frag.glsl", GL_FRAGMENT_SHADER);
    glAttachShader(shaderID, fragment);

    tcs = GraphicsUtilities::loadShader("D:\\tcs.glsl", GL_TESS_CONTROL_SHADER);
    glAttachShader(shaderID, tcs);

    tes = GraphicsUtilities::loadShader("D:\\tes.glsl", GL_TESS_EVALUATION_SHADER);
    glAttachShader(shaderID, tes);
}
glLinkProgram(shaderID);

This is the vertex shader:

   #version 400

layout(location=0) in vec4 vertPosition;
layout(location=1) in vec2 vertUV;
layout(location=2) in vec3 vertNormal;

void main(void){
    gl_Position = vertPosition;
}

The TCS:

#version 400
layout (vertices = 3) out;

void main()
{
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;

    gl_TessLevelOuter[0] = 3.0;
    gl_TessLevelOuter[1] = 3.0;
    gl_TessLevelOuter[2] = 3.0;
    gl_TessLevelInner[0] = 3.0;
}

And the TES:

#version 400
layout(triangles, equal_spacing, cw) in;

void main()
{
    gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position +
                   gl_TessCoord.y * gl_in[1].gl_Position +
                   gl_TessCoord.z * gl_in[2].gl_Position);
}

And this is how I draw the quad:

glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glUseProgram(shaderID);
glBindVertexArray(quad->getVboID());

glDrawElements(GL_PATCHES, 6, GL_UNSIGNED_INT, (GLvoid*)0);

glBindVertexArray(0);

glUseProgram(0);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );

I tried using in and out variables instead of gl_in/out, but that doesn't work either. I also tried it without the TCS.
I was also using Apitrace to look up any errors, but nothing. The function loadShader() looks for compile errors.
So what could cause this problem? I really have no idea how to debug this thing any further.

sentences:
Best Way To Develop Robust Cross-Platform Application? Possible Duplicate:
  Any tips for creating cross-platform games?

Windows C programmer here (going back to 1992 and Windows95 back when it was called Windows93). Can function in C++, but mostly still a C programmer.

Looking to build a cross-platform casual game. Very numbers heavy with only a few artistic embellishments and animations, so perhaps a development environment for business apps might be the best option. Or an easy-to-use 2D game dev platform.

Target platforms: Windows, Mac, MS Tablet, iPhone, iPad, Android.

I currently develop on Windows with Visual Studio 2012, but we could spend up to $50K on hardware/software/middleware if necessary. Not very competent getting open-source software working. Would rather pay the money and jump right into app development.

Recommendations?

sentences:
How can I create a 3D model in Java without using modeling software? I am a lightly experienced game developer and this is my first time trying 3D objects in Java for the first time. I have been recently creating and updating games using AWT, Swing, and Graphics, but I want to delve farther into Java.

I have looked into Java3D, but it's not what I want. I want to use Images and then crop the Image and place the respective textures in their respective places. I already know how to do the cropping and 2D Image editing, but how do I go 3D?

sentences:
What should I expect from volunteer playtesting? I have recently been invited to do some volunteer playtesting for a pretty well known developer. They made it very clear that it was on a volunteer basis only. It's not a job and I won't be getting paid. What should I expect? What kind of input are they going to be looking for from me? What tips do you have for doing the playtesting well? What should I do to ensure I'll be invited back? Have you or anyone you know done something similar to this before?

Also, although this is unlikely (at best) to turn into a job, what tips do you have for possibly getting my foot in the door at the company? I am happy to just be able to participate, but I would love to be able to make some good connections since I plan on building a career in the game industry. Thanks in advance.

Update:
I've been invited back to be part of a regular test group for the same game. We went over some UI designs and filled out a survey on what we thought of them and how well we understood them. Then we had a video taped Q&A session with the QA supervisor and some of the developers. We discussed the designs we critiqued in the survey and elaborated more on what we thought of them. Finally, before leaving, we played a few rounds of one of the test builds of the game, just for fun. It was a great experience and from what I observed about the offices and the general work atmosphere, I'm even more sure I've made the right career choice for myself, personally.
I've accepted an answer to this question, but I'm still open to hearing about experiences from other people who have been involved in volunteer playtesting!

sentences:
Rendering colors from a texcoord output I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the render target like so:
output.Color = float4(input.TexCoord.xy, 0, 1);

...And then I would sample the sprite using the surrounding pixels' texture coordinates to get an anti-aliased color. I first tried my method by only sampling the original pixel to see if I could replicate the original output first, but I can't make it work. This is the result I got:
output.Color = sprite.Sample(spriteSampler, tex.Sample(texSampler, input.TexCoord).xy);

I used point filtering, I tried disabling mipmaps, I tried offsetting the texture coordinates, and it just doesn't work. For some reason the sampled texture coordinates are linearly interpolated, which gives out nonsense texture coordinates at the edges of textures, producing black lines.
However, if I zoom in close enough and align the camera somewhat, I get the correct output:

So what is causing those black lines? What can I do to remove them?
Additional info:
Sprite dimensions:   2048 x 2048
Render target format for texcoords:   Vector2
Vertex declaration for the screen quad (not indexed):
vertices = new VertexPositionTexture[6];
vertices[0].Position = new Vector3(-1, 1, 0);
vertices[1].Position = new Vector3(1, 1, 0);
vertices[2].Position = new Vector3(-1, -1, 0);
vertices[3].Position = new Vector3(1, 1, 0);
vertices[4].Position = new Vector3(1, -1, 0);
vertices[5].Position = new Vector3(-1, -1, 0);

vertices[0].TextureCoordinate = new Vector2(0, 0);
vertices[1].TextureCoordinate = new Vector2(1, 0);
vertices[2].TextureCoordinate = new Vector2(0, 1);
vertices[3].TextureCoordinate = new Vector2(1, 0);
vertices[4].TextureCoordinate = new Vector2(1, 1);
vertices[5].TextureCoordinate = new Vector2(0, 1);

This is the code that converts the the computed coordinates for the blocks to screen space:
float4 PixelToScreen(float4 position)
{
    position.x = position.x * ((scale * 2) / resolution.x) - 1;
    position.y = position.y * ((scale * 2) / resolution.y) + 1;

    return position;
}

sentences:
Since Table.drawDebug is deprecated in libGDX, what should I use instead? I am following the "Learning LibGDX Game Development" book to make a simple game. I am in the menu creation section where we create a stage and render it with debug borders.

The book says to use Table.drawDebug(stage) but this static method seems to have been removed from the frameworks Table class entirely.

I am importing com.badlogic.gdx.scenes.scene2d.ui.Table; below is my code:

@Override
public void render(float deltaTime) {
    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if (debugEnabled) {
        debugRebuildStage -= deltaTime;
        if (debugRebuildStage <= 0) {
            debugRebuildStage = DEBUG_REBUILD_INTERVAL;
            rebuildStage();
        }
    }
    stage.act(deltaTime);
    stage.draw();

    Table.drawDebug(stage);
}

The last line, Table.drawDebug(stage); has the compilation error "The method drawDebug(ShapeRenderer) in the type Table is not applicable for the arguments (Stage)"

Is there a new way to draw the stage in debug mode?

sentences:
Learning game and effect related mathematical tricks I'm trying to learn how to code some "effects" more succinctly.

For example, I have sprite clouds in my game, and their transparency is determined with the following formula on their update-method, which is called repeatedly.

float transp = Math.abs(MathUtils.sin(0.2f * time) * 0.4f);

This works OK. However, let's say, that when the transparency reaches < 0.2, I want it to stay there, for some time, and so that the duration is randomized.

I could of course hack this with some "ugly" variables or something, but like I said, I'm trying to learn how to do stuff like this more to the point, hopefully with one-or-few-liners. In other words, more elegantly, more mathematically. Maybe more functionally would be the right description.

Perhaps some demoscene code could be a good starting point for learning things like this.

Anyone have any code or good examples or references to articles of such "dirty math tricks" (or this particular case)?

sentences:
How can I replicate the color limitations of the NES with an HLSL pixel shader? So since 256 color mode is depreciated and no longer supported under Direct3D mode, I got the idea to use a pixel shader instead to simulate the NES palette of all possible colors so that fading objects and whatnot don't have smooth fade outs with alpha channels.  (I know objects couldn't really fade out on the NES, but I have all objects that do fade in and out on a solid black background, which would be possible with palette swapping.  Also, the screen fades in and out when you pause which I know also was possible with palette swapping as it was done in a few Mega Man games.)  Problem is, I know next to nothing about HLSL shaders.

How do I do it?

sentences:
Unity3D - Upload a image from PC memory to WebGL app I need user to upload his(her) avatar picture from PC to game

How can I create a file dialog and upload a image to WebGL game?

sentences:
Instances in the Unity Profiler Timeline What do Instances mean when you click on an operation in the Timeline section of Unity Profiler?

In this example:

  Total: 11.90 ms (10 Instances)

sentences:
Pygame - CollideRect - But How Do They Collide? I'm having some trouble figuring out how I can handle collisions that are specifically colliding on the top or bottom a rect. How can specify those collisions?

Here's a little code snippet to give you an idea of my approach. As it is now it doesn't matter where it collides.

# the ball has hit one of the paddles. send it back in another direction.
    if paddleRect.colliderect(ballRect) or paddle2Rect.colliderect(ballRect):
        ballHitPaddle.play()
        if directionOfBall == 'upleft':
            directionOfBall = 'upright'
        elif directionOfBall == 'upright':
            directionOfBall = 'upleft'
        elif directionOfBall == 'downleft':
            directionOfBall = 'downright'
        elif directionOfBall == 'downright':
            directionOfBall = 'downleft'

Thanks in advance.

**EDIT**

Paddle rect:

 top
 ____
|    |
|    |
|    | Sides
|    |
 ----
bottom

I need to know if the ball has hit either  the top or the bottom.

sentences:
Question about coding rarity and non-MonoBehaviour referencing I have a non-MonoBehaviour script called Item which contains two classes.

public class Item
{
    public string itemName;
    //public string itemRarity;

    public Item(string newItemName)
    {
        itemName = newItemName;
    }
}

and

public class ItemRandomizer
{
    List<Item> itemContainer = new List<Item>();

    public void AddItem(Item item, int amount)
    {
        for (int i = 0; i < amount; i++)
        {
            itemContainer.Add(item);
        }
    }

    public Item GetRandomItem()
    {
        int index = Random.Range(0, itemContainer.Count);

        // want to return item combined with rarity
        return itemContainer[index];
    }

I want GetRandomItem to not only return a random item "type", e.g., gloves, contained in the itemContainer list, but also combine it with a rarity (common, rare, legendary) and return that if possible.

How can I code this functionality in a flexible way so that two base items with the same drop chance can have varying drop chances when it comes to their rare versions? Swords and axes have the same drop chance, but a rare sword might be rarer than a rare axe. I'd like to maintain that kind of flexibility.

Also, if I make public string itemRarity a property of the Item class, but I want to set the rarity tier in GetRandomItem() in the ItemRandomizer class, how should I do that? Thus far, I've almost exclusively used MonoBehaviour classes so any pointers are appreciated.

sentences:
Recommended 2D Game Engine for prototyping What high-level game engine would you recommend to develop a 2D game prototype on windows? (or mac/linux if you wish)

The kind of things I mean by "high-level" includes (but is definitely not limited to):

not having to manage low-level stuff like screen buffers, graphics contexts
having an API to draw geometric shapes
well, I was going to omit it but I guess being based on an actual "high-level" language is a plus (automatic resource management and the existence a reasonable set of data structures in the standard library come to mind).

It seems to me that Flash is the proverbial elephant in the room for this query but I'd very much like to see different answers based on all kinds of languages or SDKs.

sentences:
What is the most efficient way to blur in a shader? I'm currently working on screen space reflections. I have perfectly reflective mirror-like surfaces working, and I now need to use a blur to make the reflection on surfaces with a low specular gloss value look more diffuse. I'm having difficulty deciding how to apply the blur, though.

My first idea was to just sample a lower mip level of the screen rendertarget. However, the rendertarget uses SurfaceFormat.HalfVector4 (for HDR effects), which means XNA won't allow linear filtering. Point filtering looks horrible and really doesn't give the visual cue that I want.

I've thought about using some kind of Box/Gaussian blur, but this would not be ideal. I've already thrashed the texture cache in the raymarching phase before the blur even occurs (a worst case reflection could be 32 samples per pixel), and the blur kernel to make the reflections look sufficiently diffuse would be fairly large.

Does anyone have any suggestions? I know it's doable, as Photon Workshop achieved the effect in Unity.

sentences:
How to make rigid body move smoothly on uneven platform? Right now I'm using Rigidbody2d for the game character along with polygon collider 2D(2d platform game).

I'm beginner hope I'm using correct components.

And transform to move character from left to right.

Character.transform.Translate(Vector2.right * speed * Time.deltaTime);

And upward(jump).

Character.transform.Translate(Vector2.up * speed * Time.deltaTime);

When the game character moves on slopes there's lot of friction and bounciness and rotation and its worse when jumping from slopes.

sentences:
Word in different color in middle of string XNA Is it possible to use different font colors for the same string, for example, when buying a weapon in CoD AW Exo Zombies:

How do I do this?

Thanks.

sentences:
How do game engines export projects? I've been wanting to make a small game engine (relatively. basic features, predefined shaders) to learn that side of game development and I was wondering how game engines export projects to create executables.

I would imagine that they copy over all the necessary code and remove the editor from the code base. Or perhaps they are engineered in a way that completely abstracts the game code and the editor code?

If someone could explain the pipeline of how they export the game, I can do the rest of the research and experimentation myself.

sentences:
Animations in FBX exported from Maya are anchored in the wrong place We are trying to export a model and animation from Maya into Unity3d.

In Maya, the model is anchored (pivot point) at the feet (and the body moves up and down). However after we have performed the FBX export, and imported the file into Unity the model is now appears to be anchored by the waist/head and the feet move.

These example videos probably help explain the problem more clearly:

Example video - Maya - Correct
Example video - Unity - Wrong

We have also noticed that if we take the FBX file and import it back into Maya we have exactly the same problem.

It seems to be that the constraints no longer work after the FBX is reimported back to Maya, which just kills the connection between the joints and the control objects.

When we exported the FBX we have tried checking the 'bake animations' check box.

The fact that the same problem exist when importing the FBX back into both Maya and Unity suggests that the source of the problem is most likely with the Maya FBX export.

Has anyone encountered this problem before and have any ideas how to fix it?

sentences:
Updating score in collision detection game in XNA I created a collision detection game in XNA but I have a problem with the scoring.
As online tutorials says,
I initialised it

score = 0;

This is in the update section to check if the person hit the object

// Check collision with person
                if (personRectangle.Intersects(numberRectangle))
                    personHit = true;

Then in the draw section..

if (personHit)
            {
               score = +score + 1;
               spriteBatch.Draw(greenBackground, mainFrame, Color.White);
            }
            else if (personHit2)
            {
                score = +score - 1;

                //device.Clear(Color.Red);
                spriteBatch.Draw(redBackground, mainFrame, Color.White);
            }

But when the person hits the objects that fall, the score goes up until that object is on the person image.
I don't know if I am clear.
The score doesn't go up by one per hit,  it goes up until that object stops touching the person..

I was wondering how can I fix this so the score goes up by 1 only?

sentences:
How can I support direct P2P for mobile devices? I'm Interested in two or more player co-op in Godot, via direct P2P without connection to a central server.
I have this idea that would utilize two smartphones in proximity to one another. I don't know an awful lot about Bluetooth or networking so please explain simply.

sentences:
Axis-Aligned Bounding Boxes vs Bounding Ellipse Why is it that most, if not all collision detection algorithms today require each body to have an AABB for the use in the broad phase only?

It seems to me like simply placing a circle at the body's centroid, and extending the radius to where the circle encompasses the entire body would be optimal. This would not need to be updated after the body rotates and broad overlap-calculation would be faster to. Correct?

Bonus:
Would a bounding ellipse be practical for broad phase calculations also, since it would better represent long, skinny shapes? Or would it require extensive calculations, defeating the purpose of broad-phase?

sentences:
How public should you make your betas? I am approaching the point where I can release a playable beta of a very complex game I am making in Flash/AS3. It is fairly involved and the deepest game Ive made so far. I plan on hosting it on my personal site but I want to try and get good feedback on the game elements so far.

Is it worth it to expose this beta to as many places as possible before the release? What are good communities to do this?

Please note this will be freeware in its final release

sentences:
Finding coordinate in radius Hello i have two points (Vector3) A and B. And have a radius r

How can i find a coords of point P in a circle by angle?

sentences:
Movement on the X an Z axis are combined? This is probably a stupid question, but I'm trying to simply move a 3D object up, down, left, and right (Not forward or backward).

The Y axis works fine, but when I increment the object's X position, the object moves BOTH right and backwards! when I decrement X, left and forwards!

setPosition(getPosition().X + 2/*times deltatime*/, getPosition().Y, getPosition().Z);

I was astonished that XNA doesnt have its own setPosition function, so I made a parent class for all objects with a setPosition and Draw function. Setposition simply edits a variable "mPosition" and passes it to the common draw function:

    // Copy any parent transforms.
    Matrix[] transforms = new Matrix[block.Bones.Count];
    block.CopyAbsoluteBoneTransformsTo(transforms);

    // Draw the model. A model can have multiple meshes, so loop.
    foreach (ModelMesh mesh in block.Meshes)
    {
        // This is where the mesh orientation is set, as well
        // as our camera and projection.
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index] *
                Matrix.CreateRotationY(MathHelper.ToRadians(mOrientation.Y))
                * Matrix.CreateTranslation(mPosition);
            effect.View = game1.getView();
            effect.Projection = game1.getProjection();
        }
        // Draw the mesh, using the effects set above.
        mesh.Draw();
    }

I tried to work it out by attempting to increment and decrement the Z axis, but nothing happens?! So using the X axis changes the objects x and z axis', but changing the Z does nothing. Great.
So how do I seperate the X and Z axis movement?

sentences: Should I separate the Pathfinding info from the Tile Info class? I have implemented A* on a Tile Based Game, my Tile class contains a lot of info like Position, TileType, Items, Characters, etc on it. Right now that class has the Edges references(neighbours), movement cost, etc. Should I create a new Class like Node to just contains the Pathfinding related info?

sentences:
On screen controller for libgdx games? Does anyone know a better controller for 2D Games than a virtual on screen joystick? The pros of the joystick are:

Easy to implement for developers
Familiar interface for users

But there is a huge con:

The screen is obscured by thumbs.

And also, is there any library for a quick implementation of virtual joysticks for Libgdx?

sentences:
How does the InsideTessFactor affect points of a triangle in a DirectX11 domain shader? I found this example in this Chinese language document.
In the image above, I can understand the value of SV_TessFactor because for every side of this triangle, there are 4,1,6 line segments respectively. But I don't understand how InsideTessFactor is 5.
There are 12 points and 12 line segments inside the triangle. It seems to me that 12 is not relevant to 5.

sentences:
OpenGL object movement is not smooth and vibrating In my android NDK OpenGL C++ project, I have a render method which executes every frame on draw event so this is the algorithm:

void Engine::render() {
    deltaTime = GetCurrentTime() - lastFrame;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    update();
    renderDepthMaps();
    renderMeshes();
    if (skybox != nullptr)
        shaders.drawSkyBox(skybox, camera, width, height);
    lastFrame = GetCurrentTime();
}

first I calculate the delta time between the last frame and the current frame, then I update all transformation and view matrices from input then render the scene so the game loop depends on the android draw frames, I have an object which moves over a terrain and a third person camera moves with it and rotates around it, so after the object moves for some distance it begins to flicker forward and backward, the update function for the object is:

double& delta = engine.getDeltaTime();
GLfloat velocity = delta * movementSpeed;
glm::vec3 t(glm::vec3(0, 0, 1) * velocity * 3.0f);
matrix = glm::translate(matrix, t);
glm::vec3 f(matrix[2][0], matrix[2][1], matrix[2][2]);
f = -glm::normalize(f) * velocity * 3.0f;
camera->translate(f);

If it is an interpolation issue I don't know how to make interpolation with using translate matrix to its forward vector.

sentences: which one should use Transform or Nullable Vector3? We know Vector3 is a struct and for this reason it can't be null. Let's suppose that I want to rotate to a enemy position, if I use a Vector3 I can't be sure if there was an enemy or not and maybe I will be looking at Vector3.zero. A solution for this problem is use the enemy transform (and not the position) and do a null check, but another option is make a nullable Vector3, but I'm not sure which use, what should I take in account to take a decision?

sentences:
Limitations of p2p multiplayer games vs client-server I am reading up on multiplayer game architecture.

So far most of the articles i've found deal with the client-server model.

I'd like to know what are the limitations for using a p2p architecture? what "class" of games are possible (or more common) to implement using it? which aren't? and in general, what are its main differences and limitations against the client-server model.

sentences:
Why are my 3ds Max .fbx exports huge? I've made an animation in 3ds Max and want to export it to .fbx and import it into Unity. I've done this once without problems. But this time, my .max file is 2,8MB and my .fbx file came out a huge 630MB!

There's nothing wrong with my model: I exported it from a Blender model (to .fbx) and imported it to 3ds max (converted it to an editable poly) to do my rigging and animation. As soon as I import some .bip animations, I get these huge files.

Is there a safe way to get smaller file sizes? I don't mind redoing the rigging if I can solve this.

sentences: Unity Ads or Google Ads wich one is better? I don't know if i can ask this here, but i have a doubt about wich ad advertiser is better, a friend said unity and other said google... I want to know in general wich one is better? If there's one wich is better than both let me know. If i can't ask this here let me know and i delete this question :D thanks

sentences:
What physics engine support force fields and bodies represented as points? I need a game engine that supports force fields in 2d or 3d, but suitable for 2d calculations, like bullet.

Each body I want to simulate is represented as a set of points. Each point has positive mass and can accept force. Force field is updated every tick.
Engine should accept force applied to every point and return point speed values and coordinates.
Each body made of particles should move as a whole thing in result, relative position of particles must persist, hence this is a rigid body.
If engine does not support setting body as a set of points it should allow setting density function, or some other means to let have non-uniform density.

Is there any that can do that, preferably cross-platform.

sentences:
Correct way to move player in cocos2d-x chipmunk platformer I'm attempting to make a physics based 2d platformer in cocos2d-x using the built in chipmunk physics engine.  I've not used a physics engine before and I'm having some issues setting the correct values (mass, friction, etc...) for my physics bodies so that I can make the player move correctly.  The problem that I'm facing is that when I add any amount of friction to either the tilemap bodies or the player body, the player moves so slowly that it's almost not visible.

Right now I'm loading a TMXTileMap and creating a PhysicsBody for each tile and a PhysicsBody for the player.  Relevant code for player physics body material:

 auto physicsBody = PhysicsBody::createCircle(this->getContentSize().width, PhysicsMaterial(0.0f, 0.0f, 1.0f));

relevant code for tile map physics bodies:

auto physicsBody = PhysicsBody::createBox(tileSprite->getContentSize(), PhysicsMaterial(0.0f, 0.0f, 0.0f));
physicsBody->setDynamic(false);
physicsBody->setGravityEnable(false);

And here is how I'm trying to move the player:

void Player::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) {
    log("Key with keycode %d pressed", keyCode);
    switch(keyCode){
        case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
            _impulseX += -700.0f;
            break;
        case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
            _impulseX += 700.0f;
            break;
    }
}

void Player::update(float dt) {
    this->getPhysicsBody()->applyImpulse(Vec2(_impulseX * dt, _impulseY * dt));
}

I currently have all of the PhysicsMaterial values set to 0.0f.  Without setting those to 0 I can't get the player to move, but when they are set at 0 the player appears as if he's moving on ice and there is no friction to slow it down.  Is there something wrong with the way I'm moving the player?  Or is there something wrong with my PhysicsMaterial?

note: I'm not currently using a fixed timestep but plan to in the future.  Could this be causing my problem?

edit:  I've read a few places that it's better to use surface velocity to move a character but I can't find any examples of doing that.  Is it possible using cocos2d-x?

sentences: Clickable hex grid in c#.net I want to create a Windows Form-based adventure game where the player clicks a hex on a static map to bring up their next encounter. I have the map already and plan to scan it and convert it to a .bmp file. My problem is that I'm not sure how to tie the map image in with the game code. Unless I'm mistaken, I think I need to use some kind of imagemap control. If that's the case, do I need to plot each hex individually, or is there a way to plot the whole map in bulk? I found this article, but I'm not sure if it's relevant to what I want to do or not. I'm just looking for general information or links to relevant articles. Thanks.

sentences:
Is spatial partitioning for collision detection an appropriate way for objects to "know" whats around them even if they are not colliding? I've been puzzling over how to do spatial awareness for units and buildings. I've asked a few questions and the final conclusion was spatial partitioning in the same manner used for collision detection. So an object knows if something is close to it and can react appropriately (such as attacking an enemy)

I'm making sure this is what I expect it is, so that my monetary and time investment in reading materials is not a waste for the purpose of completing this game.

sentences:
Limit sprite to windows bounds? I'm making a game in XNA and I want to limit the movement of a sprite to the screen boundaries.
How would I do this?

http://i.stack.imgur.com/ZqH0M.jpg

sentences: How do you rotate the camera using right mouse clicks with Cinemachine? How can I rotate the camera around the player using right-click?

sentences:
Unity Help solving Uncaught Abort on HTML5 Build For some reason there is a Invoke that is triggered when a button is clicked that causes my game to crash. Any idea how I can sort this out?

I have plenty other Invokes and none has given problems. I have the Enable Exceptions option set to None and game works fine inside Unity.

I can give more info on the error if you can point to me to what's relevant.
Thanks so much!

Invoking error handler due to
Uncaught abort(145) at Error
    at jsStackTrace (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22380)
    at stackTrace [Object.stackTrace] (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22551)
    at Object.onAbort (https://v6p9d9t4.ssl.hwcdn.net/html/1680115/PowerTheGrid_Level3_v7.2_HTML5/Build/3998187b7e8feaa618a93b293c0e6812.js:4:11065)

EDIT: Here is the code generating the error:

    public void OnClick()
    {
        if (buyCoal.interactable == true)
        {
                trainObject.trainMovementStart();

                if (SceneManager.GetActiveScene().name == "Level1" || SceneManager.GetActiveScene().name == "Level2")
                    Invoke("coal_refill", 6f);

                if (SceneManager.GetActiveScene().name == "Level3")
                    Invoke("coal_refill", 12f);

                Money.UseMoney(coalcost);
                buyCoalAudio.Play();
                countdown += 1; //agora é count up
                tipCoalReady = 2;
                buyCoalButtonIndex = 0; //DISABLE COAL Buy Button
                coal_stock_countdown.text = countdown.ToString();
                coaltipCounter += 1;
        }
    }

    void coal_refill()
    {
        ThermoElectric.quota += 17.5m;
        Invoke("reactivateBuyCoalButton", 5f);
    }
    void reactivateBuyCoalButton()
    {
        buyCoalButtonIndex = 1;
    }
}

}

sentences:
XNA Transparency depending on drawing order? I am drawing two 3D objects, both of them can fade from opaque to transparent independently, and they can intersect between them (so you cannot say when one of them is before the other one). Look at the image for a better understanding (one of the object is a terrain and the other one an area):

Now, if I apply transparency to both of them, and draw the terrain before the area, the terrain is not transparent respecting to the area, but the area is:

And finally, if I draw the area before the terrain, then the area is not transparent respecting of the terrain:

QUESTION: How can I make all the objects transparent to the rest of objects without depending on the drawing order?

sentences: What is the easiest way to make an object follow the edge of a sprite? I have a rounded rectangle sprite and another sprite that's just a circle. I want the center of the circle to follow the edge of the rounded rectangle. Is there any easy way to accomplish this task? I've seen other answers that talk about curve and AI predictive algorithms, but they all seem more complicated to implement that for my current needs. Is using these algorithms necessary for what I'm trying to do, or is there an easier way to make one sprite follow the edge of another?

sentences:
2D soft-body physics engines? Hi so i've recently learned the SFML graphics library and would like to use or make a non-rigid body 2D physics system to use with it. I have three questions:

The definition of rigid body in Box2d is

  A chunk of matter that is so strong
  that the distance between any two bits
  of matter on the chunk is completely
  constant.

And this is exactly what i don't want as i would like to make elastic, deformable, breakable, and re-connection bodies. 1. Are there any simple 2D physics engines,  but with these kinds of characteristics out there? preferably free or opensource?

2. If not could i use box2d and work off of it to create it even if it's based on rigid bodies?

3. Finally, if there is a simple physics engine like this, should i go through with the proccess of creating a new one anyway, simply for experience and to enhance physics math knowledge? I feel like it would help if i ever wanted to modify the code of an existing engine, or create a game with really unique physics.

Thanks!

sentences:
data structure fails to instantiate GMS2 Error message:
Data structure with index does not exist.
 at gml_Object_enemy_actor_Step_0 (line 10) -           hand[i] = ds_stack_push(deck);

Code snippit that is referenced in the error message:

if global.phase == 0
{
    //fill inital hand of cards
    if global.turn == 0 && hand[0] = noone
    {
        for (i=0; i<4; i++)
        {
            hand[i] = ds_stack_push(deck);
        }
    }
}

The code that creates the ds_stack

/// @description hold the enemy player's outfit

scale = 0.25;

image_xscale = scale;
image_yscale = scale;

outfit = ds_stack_create();
hand = array_create(8,noone);
//hand[0] = noone;
draw = false;

//create a deck and fill it
deck = ds_stack_create();
fill_deck(deck);

The fill_deck() function just adds usable numbers to the ds_stack

//argument0 is the deck being passed to fill

var temp = ds_stack_create();

for (i=0; i<20; i++)
{
    var index = round(irandom(46));
    ds_stack_push(temp, index);
}

ds_stack_copy(argument0,temp);

sentences:
Random monsters move in-sync instead of individually I am making a game in which monsters spawn randomly and begin to move around randomly. I am fairly new at programming but not at game development. Through using a few tutorials I was able to make 1 creature spawn randomly and move randomly (with animations!) in a way that seemed organic instead of robotic.

So, I moved on to the next step of doing this to several creatures. However, when I executed this, I found that instead of executing their own instructions, the rest of the monsters simply mimic the relative movements of 1 central guy. Everyone moves in sync like some North Korean military parade!

I am using foreach loops and random numbers to choose their directions. Since my game is a top down 2d isometric, I am using a dictionary to store 4 directions. I have made some changes based on the suggestions here, and now all the creatures animate! But they still don't change directions or do things on their own.

How do I make them each have their own unique set of instructions instead of everyone just following the dear leader?

Below is a walkthrough of my code:

Monster Initialization:

public void AddCreatures()
{
     NewMonster = new Monster(Texture);
     NewMonster.AddAnimation("northeast", 0, 96, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("northwest", 0, 144, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("southeast", 0, 240, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("southwest", 0, 288, 48, 48, 8, 0.2f);
     NewMonster.AddAnimation("hoon", 144, 336, 48, 48, 1, 1.0f);
     NewMonster.Position = RandomPos();
     NewMonster.DrawOffset = new Vector2(49, 80);
     NewMonster.CurrentAnimation = "southwest";
     NewMonster.IsAnimating = false;
     creatures.Add(NewMonster);
}

Spawn:

for (int v = 0; v < 12; v++)
{
    AddCreatures();
}

Randomize spawn Position:

 private Vector2 RandomPos()
        {
            Vector2 location = Vector2.Zero;
            location.X = rng.Next(300,900);
            location.Y = rng.Next(200, 700);
            return location;
        }

Movements:

 public void Update(GameTime gameTime)
    {
        timenow += (float)gameTime.ElapsedGameTime.TotalSeconds;
        foreach (Monster mon in creatures)
        {
            if (mon.IsAnimating)
            {

                if (timenow - (float)gameTime.ElapsedGameTime.TotalSeconds > 0.5f)
                {
                    mon.Velocity = directions[rng.Next(1, 5)];
                    ChooseAnim(mon);
                    mon.Velocity.Normalize();
                    speed = (float)(rng.Next(0, 3));
                    diff = new Vector2(mon.Position.X - mon.GetLastPosition.X, mon.Position.Y - mon.GetLastPosition.Y);
                    if (Math.Abs(diff.X) >= 4 && Math.Abs(diff.Y) >= 4)
                    {
                        mon.Velocity = directions[rng.Next(1, 5)];
                        ChooseAnim(mon);
                        mon.Velocity.Normalize();
                    }
                    mon.Velocity.X *= speed;
                    mon.Velocity.Y *= speed;

                    timenow = 0f;
                }
                mon.MoveBy(mon.Velocity);

            }
            DoNotExit();
            mon.Update(gameTime);
        }
    }

Animation choosing method:

    private void ChooseAnim(Monster mon)
    {
        if (mon.Velocity == directions[1])
            mon.CurrentAnimation = "northeast";
        if (mon.Velocity == directions[2])
            mon.CurrentAnimation = "northwest";
        if (mon.Velocity == directions[3])
            mon.CurrentAnimation = "southeast";
        if (mon.Velocity == directions[4])
            mon.CurrentAnimation = "southwest";

    }

sentences:
Default Game Window Size To Take While Making Games I am planning to make a game for mobiles and tablets, I wanted to know what would be the default resolution that I should set for my game so that it covers all or most of the devices out there.
I read an article someplace that says we should design the game for lowest resolution like 480 x 360 and then scale it according to devicePixelRatio for the target device, Is this the right approach because according to me it will be good only for devices that have 3:2 resolution but what about other 16:9, 16:10 etc
So What should be the base resolution I design my game so that it gets scaled to all mobiles and tablets?

sentences:
How do I render my 3D game in ASCII art? I'm trying to create an Easter egg for a 3D game in Unity3D. I want to render my game momentarily in ASCII art.

My first idea is to create a shader to do that, but I'm not sure if it's the right way.

sentences:
Audio programming resources I've been very interested in the last few months about getting in to audio programming (I'm from a musical background). I've been a .NET developer for two years and have also done some objective c for an iPhone app recently. I realise I would probably need to work on my C++ chops and have been having a play around with FMOD EX and doing a lot of research into the industry.

I was just wondering if anyone could suggest some good resources for audio programming (be they websites, podcasts, books, videos, online courses etc). Anything from Fourier analysis, low level coding, audio engine creation to audio APIs. I just want to learn as much as possible!

Thanks in advance.

sentences:
What are some basic zoning guidelines for designing game cities? I am planning out a fictional game city. Based on the gameplay and story I have decided on several locations which will need to exist. I'm wondering though to what extent I need to take zoning into consideration when planning everything out. For example, there is an industrial area with processing plants, but there is also a residential area fairly close to this.

It is my understanding that industrial areas need to be a certain distance away from residential areas due to health concerns. This varies of course based on many factors, but I'm wondering to what extent I should be considering this when planning out the city. The game in no way requires realistic city planning, but for the sake of not making it obviously unrealistic I'm wondering if there are any rules of thumbs when planning this.

sentences:
unity destroy enemy when jumping on it I am creating a 2D platformer using Unity3D, I want to have the player destroy enemies when it jumps/falls over them (just from the top). But I have been having problems trying to implement this. I stripped everything and used two simple box colliders in order to make it easy. So, when onCollisionEnter2D is called I get the bounds of the objects colliding like this:

    Bounds playerBounds = new Bounds(transform.position, collider2D.bounds);
    Bounds collisionBounds = new Bounds(collision.transform.position, collision.collider.bounds);

Then I check if the object colliding is below by comparing it's bounds:

    //If the player's lowest point is greater than the
    //colliding object's highest, then it is above it
    bool isAbove = playerBounds.min.y >= collisionBounds.max.y;

Then I check if the object is actually an enemy, and if so, I destroy it:

    if(isAbove)
    {
        if(collision.gameObject.tag == "Enemy")
        {
            collsion.gameObject.getComponent<EnemyController>().die();
        }
    }

Now the thing is this never happens, isAbove is never true, so I tried checking the heights of each object so I use

    Debug.Log("player : "  + playerBounds.min.y + " enemy : " + collisionBounds.max.y)

It says the player bottom-most is below the enemy top-most. Since I use this same method to detect if the player is grounded in order to enable jumping I noticed it works beautifully with other things like platforms but not with enemies. Also y used Debug.break to stop the game and noticed that when colliding with platforms the player's collider was always above the platform's, but when it collided with enemies they overlap: so the player's bottom-most part is below the enemy's top-most part. I read somewhere that this is due to the minPenetrationPenalty property, I didn't like the results of messing with it so I just left it the same (If I lower it doesn't even work with platforms, and I increase it they don't even touch and the collision is detected). I tried to compensate for this penetration when checking the bounds so I said:

    bool isAbove = playerBounds.min.y >= collisionBounds.max.y - 0.01;

It sometimes fails and sometimes not depending on the angle and other stuff, I still don't get it because if this was the problem It shouldn't work with the platforms either but it does, it only fails with enemy. I even tried to check for the overlap and said:

    float overlap = playerBounds.min.y - collisionBounds.max.y;

    bool isAbove = overlap > -0.01;

this still works beautifully with platforms only reporting positive values (which means they are not overlapping), but with enemies it actually reports negative values (which confirms the previous: they do overlap), even more strange it actually reports overlaps greater than what should be allowed, the usually report a -0.09 which means a 0.09 overlap which is greater than the 0.01 that the physics engine is supposed to allow.

If I apply this code in OnCollisionStay2D instead it works, I guess by this time the overlap  is fixed, but this looks unnatural and I still don't understand why this works perfectly with platforms (they never even overlap!) and not my enemies.

sentences:
Playing movies with OpenGL in Java I am trying to play a movie file into an OpenGL texture in a Java application. I am using JOGL and have a basic OpenGL scene, but I have no idea how to play a movie into a texture.

The only thing I could find was this:

http://paulo.ragonha.me/blog/2008/08/java-movie-playback-jogl-fobs4jmf.html

It is quite old and uses JOGL 1.1 and Fobs4JMF, which is no longer maintained. I managed to get it to build in eclipse but it wasn't able to read my movie clip. I could probably convert the movie clip to an older codec to see if that works, but I would rather have a modern solution.

I am a professional game developer, so the OpenGL part is no problem, but I am new to Java (coming from a C++ background).

Is there any modern library that wraps this functionality in an easy to use package?

sentences:
Detect Collision on Child Object I've created an obstacle prefab. The Prefab has following hierarchy.

The player must die if he collides with Enemy. But It detects collision with parent object. I am also uploading the screen shot of property of enemy(Child Object) and Parent Object.

What should I change to let player collide with Child Object (Enemy).

sentences:
How are 3D images drawn? When A computer is to draw a 3d model, does it use maths similar to vector projection? Like when a 3d model is drawn and rotated, does it use vectors/and maybe some other math to know where to draw each of the edges?

If so, is this calculation made everytime the screen is refreshed?

Just want to see if I can create a basic square that looks like its spinning in 3D space. Just for the challenge, not anything practical.

Sorry if I wasn't clear, it is one of those questions where it's difficult to explain.

sentences:
How do you create an over world styled like Pokémon Black and White, with both 2D and 3D elements? The over world of Pokémon white uses 3D models for objects like houses, and 2D sprites for characters like the player.  What would I have to do to create an over world styled like this?

Here is an example:

sentences:
How do you assign a value of different roles in a game design project? A friend and I are building a game together and having a great time with it, and we hope to sell the product at some point. The prospects for actual earnings maybe be practically nil (and we aren't getting our expectations up), but regardless, we wanted to get some of the hard "profit splitting" questions out of the way.

Originally, my feeling was that we are both putting a full time effort into the game and would split the profits evenly. I am a programming and his role would be art and music/sound. Game design and concept generation is something we are both doing together. This has become complicated, as we are now looking at "hiring" a few other interested parties and we want to split any profit up fairly. We were looking at perhaps hiring another artist, and perhaps a sound person. We are not sure at this point what level of commitment our hired hands will be willing or able to commit.

So:

Our idea was to make a very large list of all tasks that need to be done across all categories (programming, marketing, art, sound, research, design, etc) and assign weighted values to each task based on the time requirement, difficulty/value of skill set required, and importance to the project.

Then, we can assign tasks to our hired hands and as they complete them, they would earn that percent of any profits that came in. My hope is that my original partner and I would divy up the "remaining" profit (the money our hired hands don't earn) equally when all is said and done. There's still a lot of details to work out, but our feelings were to divy things first into broad categories as follows:

14.81% - Marketing (PR, promotional campaigns, website)
 3.70% - Post-release support
18.52% - R&D (programming, tool development, engine development)
 7.41% - HR (hiring, dealing with any legal stuff, registering for digital distribution, etc)
18.52% - Art (all graphics and animations in the game)
11.11% - Sound (music + SFX)
18.52% - Game Design
 7.41% - Production (timesheet management, organizing meetings and project planning)

(The numbers are weird just because the calculated weights worked out that way)

I'm particularly interested in what others who has walked the same path as us feel. For the record, the game is a spin on the real-time strategic genre with a classic 16-bit look and feel.

Is this a sensible approach?
Are the numbers weighted reasonably in your mind? (I'm pushing for more value on game design and a little less on sound, myself)
How should be deal with changing requirements? We are estimating things as best we can currently, but we're all very new at this process, so there are sure to be areas we've over and underestimated.
Any generic advice appreciated!

Thanks everyone!

sentences:
Drawing slope lines in a confined space This isn't a game development question per se, but here goes...

I have a 50x50 pixel space in which I need to draw five lines: X and Y axes, and one line for each of a steepest, average, and flattest slope.

I'm working with (Java) code that was handed down to me with no documentation or commentary and I've never worked with drawing on a canvas before. Here's the code for a box that measured 175x75 px. This needs to be adapted for a 50x50 area as described above.

    DrawingArea canvas = new DrawingArea(175, 75);
    canvasContainer.add(canvas);
    Rectangle rectangle = new Rectangle(0, 0, 174, 75);
    canvas.add(rectangle);
    Line slopeMainLineX = new Line(5, 70, 170, 70);
    slopeMainLineX.setStrokeOpacity(0.5);
    canvas.add(slopeMainLineX);
    Line slopeMainLineY = new Line(40, 70, 40, 0);
    slopeMainLineY.setStrokeOpacity(0.5);
    canvas.add(slopeMainLineY);
    steepestLine = new Line(40, 70, 0, 0);
    steepestLine.setStrokeWidth(3);
    canvas.add(steepestLine);
    avgSlopeLine = new Line(40, 70, 0, 0);
    avgSlopeLine.setStrokeWidth(2);
    canvas.add(avgSlopeLine);
    flattestLine = new Line(40, 70, 0, 0);
    flattestLine.setStrokeWidth(1);
    canvas.add(flattestLine);

    int steepestAngle = Math.round(site.getSlope().getMax());
    int averageAngle = Math.round(site.getSlope().getAvg());
    int flatestAngle = Math.round(site.getSlope().getMin());

    double xPointSteepestAngle = 40 + 120 * Math.cos(steepestAngle*0.0174532925);
    double yPointSteepestAngle = 70 + 120 * Math.sin(steepestAngle*0.0174532925);
    double xPointAverageAngle = 40 + 120 * Math.cos(averageAngle*0.0174532925);
    double yPointAverageAngle = 70 + 120 * Math.sin(averageAngle*0.0174532925);
    double xPointFlatestAngle = 40 + 120 * Math.cos(flatestAngle*0.0174532925);
    double yPointFlatestAngle = 70 + 120 * Math.sin(flatestAngle*0.0174532925);

    steepestLine.setX2((int) xPointSteepestAngle);
    steepestLine.setY2(70 - ((int) yPointSteepestAngle - 70));

    avgSlopeLine.setX2((int) xPointAverageAngle);
    avgSlopeLine.setY2(70 - ((int) yPointAverageAngle - 70));

    flatestLine.setX2((int) xPointFlatestAngle);
    flatestLine.setY2(70 - ((int) yPointFlatestAngle - 70));

I'm completely lost here, so any help would be greatly appreciated.

sentences:
Saving game data to server What's the best method to save the player's data to the server?

Method to store the game saves
Which one of the following method should I use ?

Using a database structure(e.g.. mySQL) to store the game data as blobs?
Using the server hard disk to store the saved game data as binary data files?

Method to send saved game data to server
What method should I use ?

socketIO
web socket
a web-based scripting language to receive the game data as binary?
for example, a php script to handle binary data and save it to file

Meta-data
I read that some games store saved game meta-data in database structures.
What kind of meta data is useful to store?

Edit-1
This question was to actually see what technology is better to use based on the situation.
The situation is a game that will be on cross-platform, save game throughout the cloud.

Method of delivery from game client(iOS, Android, Windows Phone 8, etc..) to game server(Linux, Windows, etc.)
Im using a Ubuntu server at this moment.

Method of storage of binary data
Inside a database system or file system.
The up and down side to it and the community options of existing structures.

Storing of meta-data
Well, I'm not too sure about how to store saved game data to server at the moment.
Thus, was wondering if the community can provides tried and tested methods used by the community. and their preferences.

sentences:
Grouping game objects I'm trying to create a simple turn based console (command line) game but I'm confused of what approach to use when creating classes for objects. My concern is maintainability and flexibility.

First Approach:

class Weapon{
    ...
}

class Sword:Weapon{
    ...
}

class ShortSword:Sword{
    ...
}

class TwoHandedSword:Sword{
    ...
}

class Axe:Weapon{
    ...
}

class HeavyAxe:Axe{
    ...
}

Second Approach:

class Sword{
    SwordType type;
    ...
}

class Axe{
    AxeType type;
    ...
}

So which is better, first or second? Why?

Important Note: I'm a beginner in game development.

sentences:
How to resolve collisions when using ray-casting to predict the location of future collisions? I ran into a question I can't seem to solve, while implementing the movement/ collision checking code for my game. The game is in 2D and all objects in my game use either AABBs or circles as collision masks. My current procedure for moving a game object uses the following steps:

[Motion definition] Set the motion vector for the game object as vec2(xSpeed, ySpeed)
[Broad-phasing] Broad-phase to find potentially colliding objects
[Collision detection] Raycast the AABB along the motion vector, against all objects found in step 2, and find the first collision
[Collision resolution] Move the game object to this position where the first collision occurs

Below is a screenshot of the collision detection. It casts the object's AABB (bottom-left blue rectangle) along the motion vector (red line) and finds the points where the AABB would enter and exit the other object's AABB (big blue rectangle). It returns me the position, normal and lambda (progression [0.0, 1.0] along the motion vector when entering/ exiting the other object).

Practically, the ray casting of AABBs is performed as a line-raycast on the configuration space obstacle of the two AABBs. I've implemented this for line-circle, line-aabb, circle-circle, and aabb-aabb cases and they work correctly.

My problem is the collision resolution step. The problem is that my objects get stuck in eachother using the current procedure. The reason being that the raycast procedure returns the position where the object "just collides" with the other object. Because of this, on the next update of my game world, the object is already colliding before it even moves. When I perform my collision detection step, the results is that the "first collision" occurs at the starting position of the object.

I've been reading related questions here, but haven't found a definitive answer yet. Here are some of the things I've read and problems I found with them (from "bad" to "better"):

[Don't move if a collision is encountered on the way] This could cause jittery and weird behavior when moving towards an object. As, e.g. if the object is moving at 5 pixels per frame towards a wall, it will end up somewhere between 5 and 0 pixels away from the wall, depending on it's position. I suspect jittery behavior to happen when this solution is extended to collision checking between moving objects.
[Implement IsTouching() methods to check whether an object is colliding but not penetrating another object] I have no idea how to elegantly use this information in the raycasting algorithms to allow "sliding behavior" of shapes, without sacrificing performance (as the algorithms are very optimized right now). Also, I imagine objects "touching" is defined as having a penetration depth of 0.0. Checking for this could cause errors in case of float rounding errors.
[Push away both the object and the colliding object upon colliding] Some of my objects (such as walls and terrain) are static and I'd rather not move them even slightly to resolve collision problems.
[Push the object out of the colliding object along the collision normal] Using this solution, the object can get stuck in another object, as it gets "blindly" pushed out of a colliding object.
[Push the object out of the colliding object backwards along the motion vector] This sounds good as the object won't get stuck in other objects. However, I'm not sure how to choose "how much" to push the object out of the other object. The best thing I can think of is to move it using "a very small float number" such as 0.00001f. But this sounds very ad-hoc.

In short: Where do I move my object, if I know exactly where the first collision would occur, without getting it stuck in other object?

sentences:
Shader or No Shader? I have a question about something I don't really understand.
In OpenTK, should I have shaders? Is it frowned upon not to? What are the pros and cons of having shaders?
Can I go perfectly fine without having anything to do with vertex or fragment shaders?

sentences:
How do I convert a 2D movement (from mouse) to a displacement along a 3d axis? I'm making a small 3D scene editor (that only allow to modify objects positions).

Each object is draw with a 3d X/Y/Z axis :

How it works : user choose an axis (X, Y or Z) by left clicking on it, then, while holding left click, he move the mouse (to move object in the axis direction)
.
picking is already ok, but i'd like to know how much the object should be translated for the selected axis, depending 2D mouse movement.

For the example, on this picture, selecting X axis and moving mouse left-right should give a bigger displacement than moving it up-down (almost zero for this one)

It must be really simple but i cannot figure it out.

Input should be : mouse displacement since first left click(2D vector), selected axis vector (3d vector), modelview / projection matrix.

Output : amount (float or double)

sentences:
Kinetic scrolling in AS3 I have a container movieclip that contains my "game" and I would like to be able to drag the "camera" (i.e. the container clip) around, but I need it to have kinetic movement, i.e. feel more like native dragging and scrolling on an iOS device.

I can't seem to find anything that deals with this properly and in the manner that I am looking for, and I also would prefer to stay away from using any 3rd party packages if there are licenses involved. This is for personal side projects that may or may not see a form of commercial release, so I would rather a) learn how to code this myself and b) not have to rely and pay for third party libraries.

Any help would be greatly appreciated.

Thanks!

sentences:
C++ OpenGL loading models fast I'm looking for a faster solution that will allow me to load objects faster with
OpenGL and currently when trying to load, parse and pass the data on my main thread it takes a while... Would multi-threading be a reasonable solution to this and if so, how would I go about it?

Would I make a second thread with the same context and save the data once it has loaded or...

Would I create a second thread to load and parse the data, then pass it back to the first thread to save to the GPU?

This is the limit of my knowledge of this subject at the minute, if anyone has any better solutions please drop me a comment.

sentences:
Why do I get this crash when dealing with SDL_Events? I do not know if this is the best way to handle these SDL_Events, but I am attempting to create a very abstract and generic code that will update my game object. I have a Scene which in my case is just a map from a string to a game object that has special functions to Add(string key, gameobject value), Remove(string key), Render(), and Update(SDL_Event& event). I think this last method is the problem.
Scene.cpp
void Scene::Update(SDL_Event& ev)
{
    for (std::map<std::string, GameObject&>::iterator it = x_ObjectDictionary.begin(); it != x_ObjectDictionary.end(); ++it)
    {
        it->second.Update(ev); //where the game crashes
    }
}

void Scene::Render()
{
    for (std::map<std::string, GameObject&>::iterator it = x_ObjectDictionary.begin(); it != x_ObjectDictionary.end(); ++it)
    {
        it->second.Render();
    }
}

void Scene::Add(const std::string& key, GameObject& value)
{
    x_ObjectDictionary.insert(std::pair<std::string, GameObject&>(key, value));
}

GameObject& Scene::Get(const std::string& key)
{
    std::map<std::string, GameObject&>::const_iterator iterator = x_ObjectDictionary.find(key);
    if (iterator == x_ObjectDictionary.end()) return GameObject();
    return iterator->second;
}

GameObject& Scene::Remove(const std::string& key)
{
    GameObject removed;
    std::map<std::string, GameObject&>::const_iterator iterator = x_ObjectDictionary.find(key);
    if (iterator == x_ObjectDictionary.end()) return GameObject();
    removed = iterator->second;
    x_ObjectDictionary.erase(iterator);
    return removed;
}

This iterates my map and updates all of the GameObjects. My game object update method is defined like this in the header file:
GameObject.h
class GameObject
{
public:
    GameObject() {}
    virtual ~GameObject() {}

    virtual void Update(SDL_Event& ev){}

    virtual void Render(){}

    virtual void Destroy(){}

};

Now, I created a scene. This Scene is called Splash and extends Scene properly. I created it like so
void Splash::CreateScene()
{
    Add("something", GameObject());
}

Every time I execute/debug my project now, my program "breaks" on the it->second.Update(ev); line and inside the console after I stop "debugging" the message says something along the lines of Exception thrown at 0x00007FF7CB457024 in XXXXXX.exe: 0xC0000005: Access violation reading location 0x00001CFA67BC13F9.
Am I going about this completely incorrectly? Or did I just make a stupid mistake?

sentences:
Change density of the body dynamically In my game, I want to change density of my body object when it collide with other objects. I found something like following to change density but further I could not able to find any hint for this. So someone please help.

Fixture fixture = goldenBoxArrayList.get(i)
                                        .getGoldenBoxBody()
                                        .getFixtureList().get(0);
                                fixture.setDensity(0.5f);

After setting fixture data I could not able to set it to the body.

EDIT : I want to change my object body density when physics world in simulation

sentences:
Can a sprite be rendered with thickness in Unreal Engine? Is there a convenient way to have a 2D pixel art image with clip transparency (not partial transparency) rendered with thickness in Unreal Engine? Paper2D does exactly what I want, except it's a flat plane.

I'm able to achieve the effect by making an SVG outline and using Blender to make a model and map UVs, then import that into Unreal, but it seems like a lot of steps for a somewhat simple model. I am new to both of these tools and models in general, so I may be missing something obvious.

sentences:
How to emulate Mode 13h in a modern 3D renderer? I was indulging in nostalgia and remembered the first game I created, which used Mode 13h.

This mode was really simple to work with, since it was essentially just an array of bytes with an element for each pixel on the screen (using an indexed color scheme).

So I thought it might be fun to create something nowadays under these restrictions, but on modern hardware. The API could be as simple as:

public class Mode13h
{
    public byte[] VideoMemory = new byte[320 * 200];
    public Color[] Palette = new Color[256];
}

Now I'm wondering what would be the best way to get this data on the screen, using something like XNA / DirectX / OpenGL.

The only solution I could think of was to create a texture with the same size as the VideoMemory array, write the contents of VideoMemory to it every frame, then render that texture in a full screen quad with the correct aspect ratio and using point texture filtering for that retro look.

Is there a better way?

sentences:
How can I exclude an object from receiving shadows? I would like to make it so that a certain object is being excluded from receiving shadows.

While it itself should cast shadows onto other objects, it should not receive shadows from other objects.

How can I achieve this?

I'm using HDRP.

Seemingly, the option not to receive shadows is not present when using HDRP.

The MeshRenderer looks like this:

sentences:
Unity - SpriteAtlas memory consumption I'm in the process of optimizing my application memory consumption.
To do so, I'm using Unity profiler while connecting to an Android device, which runs a development build of the application.

The application is using two types of sprite containers:

Sprite sheets created by the Texture packer.
Sprite Atlases created by unity.

Using the profiler, it is observed that while the sprite sheets (created by the Texture packer) take the expected amount of RAM, the sprite atlases created by unity consume DOUBLE the expected amount of RAM.

For example, the sprite atlas UIATLAS, whose size is 4096x4096 is supposed to consume 16MB of RAM:

But looking at the profiler, after running "Take Sample", you see the value 32MB:

My sprite atlas settings are:

Any help is welcome here.

One more comment (please review): UIAtlas belongs to an asset bundle called "atlas_ui". It is defined on several directories containing its sprites, all of which belong to the same asset bundle, atlas_ui. Is that the correct way to define it?

Thanks in advance!

sentences:
How can I achieve a bullet tracing effect similar to the one in Planetside? I've noticed that bullet tracers in Planetside 2 don't show up close -- every time I see them, it came from a barrel a ways away. I don't believe Planetside traces every bullet either, because then it'd look really weird.

I'm not sure what the exact parameters are, so how can I achieve a similar affect?

sentences:
How do I duplicate a Box2d simulation, mid-simulation? I want to serialize the state mid-game, send it over the network to an identical computer (same CPU, same OS, same binary), load it there, and have the two games run in tandem doing the exact same simulation, without one of them drifting off and going haywire.

In short: I want pop-in, pop-out networking support on my HIGHLY physics-intensive game, where sending object coordinates every few seconds is impossible, due to having thousands of objects, and many clients.

I tried this with Box2D, and saving an object's location/velocity/etc wasn't enough... there's internal state that's not accessible through any public methods.

My current workaround is to force EVERY client to save its entire worldstate and reload it from scratch, whenever a new player connects... but this is obviously bad practice, because it hangs the game for everyone whenever someone new connects. However, it works, with zero desynchronization.

So, anyone know of any other techniques that can help me? Or should I just kiss my project goodbye?

sentences:
How can I "publish" an Android game without Google Play? I'm new to development and trying to get a sense for the obstacles to publication

If I need to circumvent the Google Play app store, can I publish a game to a website that people can visit in a mobile browser and download and install like any other app?

How does publishing "around" Google Play work? Are there any particular success stories, best practices or problems I should be aware of?

Apologies if there is an obvious answer. I believe I found the answer at one point, but I don't remember and can't find the link.

edit: Thanks everyone! I really appreciate the help. Definitely answers my questions. Looks like I have some options!

sentences:
How to correctly draw a line in Unity I'm working on a game which requires me to draw a few lines from a single point that is more formally said

Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates named as xi,yi. Given the LineRenderer capabilities inside Unity3D I was unable to draw more than one line from a particular point with it since it renders only polylines.

I'm currently using the Debug.DrawLine() method which successfully renders the line. I have tried using GL.Begin() as it is shown in the Unity example but I cannot see my lines being drawn.

My question is : are there any other methods for doing this? If not, can you tell me how can I show the line that is being drawn with Debug.DrawLine() inside play mode? I've saw that I could use Gizmos.DrawLine() but I didn't quite understand it's usage.

sentences:
Vertices displaced when smoothing in Maya The issue below appears when smoothing in maya. I would prefer to solve the problem normally as opposed to import/export obj.

Below the image is a .ma file you can download yourself.

File: https://www.dropbox.com/s/nhtc1uj2lvakjwf/reload.ma?dl=0

Steps Taken To Isolate Problem

-Issue does not occur when doing a smooth mesh preview with the EXCEPTION of 1 face

-Deleted face. Error moves up another face.

-Continued to delete the face ring one face at a time and noticed the error moves up.

-Selected face ring, delete and rebridged. Fixed.

-Infered that the root cause of the problem has something to do with the way I created face ring or edge ring.

-The issue only occurs in this one mesh object.

-Deleted all items in the scene except the problem mesh and saved an isolated file.

-Deleted UVs.

-Deleted history.

-Optimized scene.

-Cleaned mesh with the following settings.

-Select matching polygons.

-Apply to selected objects, Keep Construction History.

-Lamina faces.

-Nonmanifold geometry, Normal and geometry.

-Merged all vertices with a tolerance of 0.01.

-Unlocked normals.

-Ensured normal directions were correct.

-Ensured there were no faces inside of edges.

-Issue ONLY occurs with 1 subdivision.

-Hardened all the edges.

-Exported and reimported OBJ. Again, I do not want the lazy solution, I want the correct one. I did this so I can infer that the root cause is not mesh-related.

-Combined with cube

-Deleted history (again)

-Optimized scene (again)

-Cleaned mesh (again)

Specs

Maya Version: Maya 2016.5 Ext 2 (64bit)

OS: Windows 10 Pro (Build: Latest)

Video Card: Nvidia GeForce 980 X (Driver: Latest)

CPU: Intel Core i7 3930K

Mirror Threads

http://polycount.com/discussion/198641/maya-2-vertices-displaced-when-smoothing/p1?new=1

sentences:
Rendering tile maps for mobile devices Hitting a bit of a roadblock with my game's development and I'm just looking for some outside advice.

I'm trying to render a tilemap for my mobile game (Android) and I'm using LibGDX.

Now, here's the issue.  Using my simplified version of LibGDX's own native OrthogonalTiledMapRenderer gives me:

60fps on desktop
~40fps on my Nexus 10 tablet
~20fps on my Nexus S phone

Here's my renderer for reference, it's very simple as to keep performance up.  The function renderTileLayer() is called every frame to render the tiles in the viewport's range.

Now, this is with all tiles in a single TextureAtlas, blending disabled, and actively culling the tiles.  Since this is the beginning stages of the game, anything below 60fps is only going to result in horrid performance later on, so I need to get this fixed.

I don't understand how people are able to render tile maps on mobile devices in their finished games if I seem to be having so much trouble with rendering my own simple 1 layer map with no other objects or lighting effects or particles, etc...

The code for rendering the tiles is as straightforward as possible and results in only 1 render call to the SpriteBatch (no Texture swapping).

Any help/input appreciated!

sentences: How do I protect sending scores from HTML5 games to my server On backend I am using java. I have a game in HTML5; when user completes it I sends an Ajax call to save the score to database. Now, someone can easily use tools like Fiddler and firebug to modify this ajax request and send a much better score to the server. How do I make sure that user cannot manipulate scores !

sentences:
Zelda-style top-down RPG. How to store tile and collision data? I'm looking to build a Zelda: LTTP style top-down RPG. I've read a lot on the subject and am currently going back and forth on a few solutions. I'm using C#, MonoGame, and Tiled.

For my tile maps, these are the choices I can see in front of me:

Store each tile as its own array. Each one having 3-4 layers, texture/animation, depth, flags,  and maybe collision(depending on how I do it). I've read warning about memory issues going this route, and my biggest map will probably be 160x120 tiles. My average map however will be about 40x30. The number of tiles might cut in half if I decide to double my tile size, which is currently 16x16. This is the most appealing approach for me, as I feel like I would know how to save maps, make changes, and separate it into chunks for collision checks.
Store the static parts of my tile map in multiple arrays acting as the different layers. Then I would just use entities for anything that wasn't static. All of the other tile data such as collisions, depth, etc., would be stored in their own layers as well I guess? This way just seems messy to me though.

Regardless of which one I choose, I'm also unsure how to plan all of that other tile data. I could write a bunch of code that would know which integer represents what tile and it's data, but if I changed a tileset in Tiled and exported it again, all of those integers could potentially change and I'd have to adjust a whole bunch of code.

My other issue is about how I could do collision. I want to at least support angled collision that slides you around the corners of objects like LTTP does, if not more oddball shapes as well. So do I:

Store collision as a flag for binary collision. Could I get this to support angles?
Would it be fine to store collision as an integer and have each number represent a certain angle of collision?
Store a list of rectangles or other shapes and do collision that way?

Sorry for the large two-part(three-part?) question. I felt like these needed to be asked together as I believe each choice influences the other.

sentences:
How to avoid cost comparison each and every frame? I'm toying around with a ticker(incremental game) for JavaScript.

The basic idea is that you have buttons that represent buildings, each building provides a certain amount of resource per 'tick'.

Each building can cost an arbitrary amount of resource types and amounts (a farm can cost wood, food and labor for example). The game is intended to have several dozens of buildings, units, technologies etc.

I would like to disable the buttons of buildings that you can't currently afford.

My concern: I prefer not to loop over every item and every cost within it to see if we have enough to build it every single tick (a tick is 50ms~).

Is there a 'smart' way that I missed that solves this issue without brute force?

EDIT :
I decided to approve the answer that basically says "Just ignore the problem".
The reasoning behind it is as follows :

Tests indicated that while the theoretical problem is interesting, it's of little consequence in a reality, the performance hit is extremely minimal.
This website is about solving problems, and as "sam hocevar" suggested, The answer needs to be as clear as possible(and the reason behind it).
While the answers are clever and very interesting to read as a theoretical background , they all address the "number of checks", while some answers reduce that number by some fraction, non actually mitigate the amount by any performance-altering number.
Following on 3, It seems that if you've come to a point where you need to implement any of the suggested, over-engineered, solutions to save performance, It seems that the gain from those solutions will be so minimal that performance will still be an issue even after implementation, making the entire game model not viable anyway.

TL;DR - If it doesn't work by ignoring the problem, it probably won't work with over-tweaking it either.

sentences:
Can a generic class inherit from MonoBehaviour? Expanding upon a previous tutorial, I am adapting a follow script to support multiple variations of a Bezier spline. Each spline variation uses a custom interface called IBezierInterface, and the follow script accesses the method GetPointOnCurve() to determine the correct position. In theory, this all seems very simple. However, I appear to be running in to some trouble. While I intend to pursue the general issues a bit more, myself, I realise that I may be shooting myself in the foot with the generic implementation.

While I can find a lot of good examples demonstrating the correct use of generic types, I can not find anything that gives an example of a generic class that inherits from another class. For example, Microsoft documentation includes examples of inheritance as a restriction on the actual type, and an example of inheriting from a generic class; but there are no examples of a generic class that inherits from a standard class. Unity documentation has even less examples, but none pertaining to my query. I am not getting errors; but that is no guarantee against error. I can not conceive a good prototype model to test my theory, either, given the fact that I am fairly new to the concept of generic types.

Given that I am specifically needing my class to be a MonoBehaviour; can I make a custom generic class that inherits from MonoBehaviour, such as in my example?

public class SplineWalker<T> : MonoBehaviour where T : IBezierInterface
{
    // ...
}

sentences:
Implementing score relative to total game time How would one create score dependent on total time in game? I would like the score to count by 1000+ each second the game is running for. Later I am going to add some coins which will give my total score +1000 also.

How would one create this functionality? This is all I have right now:

  let scoreDisplay = UILabel()
    scoreDisplay.text = "Score: \(self.score)"
    scoreDisplay.textColor = UIColor.red
    scoreDisplay.frame = CGRect(x: mainWidth / 2 - 200, y: mainHeight - 400, width: 247, height: 100)
    self.view.addSubview(scoreDisplay)

    let delay = SKAction.wait(forDuration: 0.25)
    let incrementScore = SKAction.run ({
        self.score = self.score + 1
        self.scoreDisplay.text = "\(self.score)"
    })

I'm pretty new to Swift, so sorry for my basic question!

sentences:
Creating a DrawableGameComponent If I'm going to draw cubes effectively, I need to get rid of the numerous amounts of draw calls I have and what has been suggested is that I create a "mesh" of my cubes. I already have them being stored in a single vertex buffer, but the issue lies in my draw method where I am still looping through every cube in order to draw them. I thought this was necessary as each cube will have a set position, but it lowers the frame rate incredibly.
 What's the easiest way to go about this? I have a class CubeChunk that inherits Microsoft.Stuff.DrawableGameComponent, but I don't know what comes next. I suppose I could just use the chunk of cubes created in my cube class, but that would just keep me going in circles and drawing each cube individually.

The goal here is to create a draw method that draws my chunk as a whole, and to not draw individual cubes as I've been doing.

sentences:
In a top down game, once I have detected collision, how do I prevent it? I'm making a top-down game in Java. I watched some videos, and this is the code I currently use when the player is colliding with an object:
x += -velX
y += -velY

When I apply force to a wall, the player dips into it, and can't move along the wall.
Does anyone have a better method?

sentences:
In Unity - displaying long lists of information to screen? Tables? Hello folks I'm making a little game for fun in unity, Its a boxing management sim. I've got the code done to create boxers and give them many properties such as names, weights, stats, etc.
I've made another screen , lets call it 'office screen' for now. In that I want to open a panel which will show all the boxers in the game (ideally I'd like to be able to make the player be able to filter these results by which company he's signed to etc - but I think that might be out of my skill range so maybe i will just make a separate screen for Owned Boxers)

But I cannot seem to find a way to display all these infos in a table with columns such as Name ; Age ; Company ; etc;

I have had a go just using the UI Text components and panels. But thing is, there will be approx 100 boxers or more and this number will always change also.

Any ideas for this in Unity specifically?

EDIT: I am storing all the data just as variables (i think fields) in a class called Boxer which is assigned as a component of a new GameObject i instantiate at the time each boxer is created. So each boxer has its own gameobject.

EDIT 2 :D i've found this: https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/models-data/displaying-a-table-of-database-data-cs
would this be the sort of thing I can add to Unity (assuming I can follow along with the guide)?

Thanks for any help

sentences:
Calculate speed of object for specific device I have an object - player - which is moving X px ahead each update (updates  based on device FPS). From my results, to get average same player speed on all devices, is to do calculation screenWidth / averageFPS. This should give me speed, that player reaches mobile screen width for one second (note my game is in landscape mode). But it doesn't, it was significaly faster on Z3 Compact (720x1280; avg. 60FPS) than on tablet A5600-F (800 x 1280; avg. 62FPS).

How to get correct speed?

sentences:
Using System Time to compute delay times that correctly deal with app pauses? In my Android app I have the requirement to introduce small (for slowing down animation) and larger delays (for the purpose of delaying the appearance of a character for example).

I've experimented with 2 different ways, those being:

long grabTime;
int delayInMillis;

public void doStuff(){

//Initialise timeGrab variable
    if (grabTime==0)
        grabTime = System.currentTimeMillis();

//Has the desired number of Milliseconds passed?
    if (System.currentTimeMillis()>timeGrab+delayInMillis)

//If so, then do something here

//And re-grab the time ready for the next time
    grabTime = System.currentTimeMillis();

}

Where I have a batch of sprites (where each one will have a different delay) I find it easier to do this

long grabTime;
int spritesDelay = new int[numberOfSprites];
int forLoopCounter;

//Populate the array with desired delays (in seconds)
spritesDealay[0]=1;
spritesDealay[1]=2;
spritesDealay[2]=3;
spritesDealay[3]=4;

public void doStuff(){

    //Initialise timeGrab variable
    if (grabTime==0)
        grabTime = System.currentTimeMillis();

    //Has 1 second second passed?
    if (System.currentTimeMillis()>(timeGrab+1000)){

    //If so, reduce delay counters by 1

    for (forLoopCounter = 0;forLoopCounter<spritesDelay.length;forLoopCounter++){

        spritesDelay[forLoopCounter]--;
    }

    //And re-grab the time ready for the next 1 second count
        grabTime = System.currentTimeMillis();
    }

    //Now run through all the sprites and check to see if any of the timers have expired

    for (forLoopCounter = 0;forLoopCounter<numberOfSprites;forLoopCounter++){

        if (spriteDelay[forLoopCounter]<=0){

    //Do stuff here

    //If action has completed then reset the delay

    if (*Some criteria has been met*){

    spriteDelay[forLoopCounter]=4; //put in either explicit value for all sprites or restore previously backed up spriteDelay array (Not shown here)

            }

        }

    }
}

In my app (a game) - I am using the second method to have some sprites moving in an up/down motion, each successive one with a slight delay on the previous one (think of a wave like motion).

The problem

This does work, however, when I pause my game (which simply halts game updates and continues rendering with a 'paused' graphic over the screen), on resuming play, things are out of sync slightly (because obviously the system time doesn't stop when the game is paused, so the first check after un-pausing to see if the second has elapsed will always be true providing the game was paused for longer than 1 second).

After the sprites have all moved through one motion, then they do sync up again and everything is OK.

However I'm not happy with the remainder of the current cycle being out of sync.

Alternatives?

Another way I've thought of doing this is hold an int that counts up each time my game update method is run (my game is 'limited' to 60 logic updates per second), then when it reaches 60, I would know a second has passed.  This has the advantage that the counting will stop when the game is paused.

However, if the game were ever to be run on a device that couldn't handle 60 logic updates per second then it would slow down counting and throw everything off.  (My ticks per seconds are separated from my rendering per second which runs flat out so although the FPS may drop, the logic updates per second should carry on at 60.  I find it unlikely that a device wouldn't be able to handle 60 game updates per second (as I've tested this on a Galaxy Ace version 1 and that was fine at 60) but I'd like my app to be as robust as possible and don't really want to risk the timings being thrown off by a slow device however unlikely.

So I'm a bit stuck.  Is there another system timer I can use which can be controlled?  (switched off when required) or would my 'logic-updates-per-second' method be the best bet?

sentences:
{Maya 2017} Problem with Knee Joint Target I am not very experienced with Game Development or Character Design/Rigging, but I am trying to learn and have hit my first roadblock with rigging a character.

I used Maya 2017's QuickRig function and it worked out alright except for the Knees bend backwards. I tried shifting or rotating the Knee target node but it does not move unlike the elbow nodes did.

I believe all I need to do it get the Knee Target node on the front of my character.

Any Tips? Linked below are screenshots to help visualize my problem.

Character Rig: https://gyazo.com/bee70568fbacc473e095631185443a48

Knee Bend Problem: https://gyazo.com/d4b1ba9a542dbc18ffb2ba14db71c931

sentences:
SetFloat() in HLSL shader (effect) has no effect - variables stay at 0 I have a problem wherein I'm trying to set two simple float variables in my shader.  I have a dozen other shaders in this project where it works fine, but for some reason, I've got a bug in this one that I just can't spot.

Here's what I'm doing; I'll edit it down for brevity but try to stay complete.  Any suggestions are very welcome!

First, I store the video width and height in the class that represents my shader, and then call functions that set the variables.

    _hVideoWidth           = _ptrEffect->GetParameterByName(0, "videoWidth");
    _hVideoHeight          = _ptrEffect->GetParameterByName(0, "videoHeight");

    pShader->_videoWidth  = pCameraManager->_backBufferWidth;
    pShader->_videoHeight = pCameraManager->_backBufferHeight;
    pShader->SetActive();

    _ptrEffect->SetFloat(_hVideoWidth,  _videoWidth);
    _ptrEffect->SetFloat(_hVideoHeight, _videoHeight);

Then I do my drawing:

    UINT cPasses;
    pShader->GetEffect()->Begin(&cPasses, 0);
              // Drawing code here
    pShader->GetEffect()->End();

My shader will use the videoHeight/Width in order to scale it to the viewport.  If I hardcode the width and height, it all works perfectly.

cbuffer VideoData : register(b0)
{
    float    videoWidth;
    float    videoHeight;
}

VertexShaderOutput UILineVertexShaderFunction(VertexShaderInput input)
{
        VertexShaderOutput output;

    output.Position = input.Position;

    // Convert pixel coords to (-1, +1)

    output.Position.x = output.Position.x / videoWidth  * 2.0f - 1.0f;
    output.Position.y = output.Position.y / videoHeight * 2.0f - 1.0f;
    output.Color    = input.Color;

    return output;
}

The mystery, however, is that at this point the shader has videoWidth and videoHeight still as zero.  If I just hardcode those two expressions to 1280 and 1024 respectively, it works perfectly.

So, there's SOMETHING about the way I'm setting the videoWidth and videoHeight.  I've confirmed that at the point I call SetFloat() they are in fact passing in the right values, but they just never seem to make it to the shader variables.

Any suggestions or anything obvious?  Even a guess would help, I've been looking at this one for a while!

Thanks,
Dave

sentences:
Tiling texture doesn't repeat, even though wrap mode is set to repeat For some reason, my floor tiling (set to 100 x 100) only shows on one corner of the plane. Past that corner, it just stretches out to the sides and leaves the middle one solid colour:

Here is how I've imported the texture (which was created by Jimmy Vegas:

And my material settings look like this:

sentences:
How can I make this shader background more efficient? I want to use a shader as a background for a mobile game. I'm using libgdx for my project. I've never written glsl before, but here's my attempt so far:

http://glslsandbox.com/e#22332.13

On desktop the code runs fine, but on mobile it can be a bit slow sometimes. I have read that using built in functions reduces branching, so I tried to use mix and smoothstep instead of if statements.

I'm also not sure if I am rendering the shader correctly in the first place.

First I'm creating a TextureRegion:

fbo = new TextureRegion(new FrameBuffer(Pixmap.Format.RGB888, width, height, false).getColorBufferTexture());

Then I create a rectangle mesh, and render the shader as 2 triangles on the mesh. The device/window resolution is also passed to the shader as a uniform.

Then I am calling batch.setShader(background); and finally batch.draw(fbo, 0, 0, width, height);

Is there a better way I can achieve this?

Code from the link above:

#ifdef GL_ES
precision mediump float;
#endif

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
//created 1/15/2015 by alex booth

const vec3 sky_top_color = vec3(90.0/255.0, 200.0/255.0, 190.0/255.0);
const vec3 sky_bot_color = vec3(235.0/255.0, 235.0/255.0, 215.0/255.0);

const vec3 hill_1_color = vec3(170.0/255.0, 210.0/255.0, 205.0/255.0);
const vec3 hill_2_color = vec3(150.0/255.0, 190.0/255.0, 185.0/255.0);
const vec3 hill_3_color = vec3(110.0/255.0, 142.0/255.0, 135.0/255.0);

void main(void) {
    vec2 pos = (gl_FragCoord.xy / resolution.xy);

    float hill_1 = 0.060*sin(pos.x*6.0+time*0.100)*sin(time*0.10)+0.55;
    float hill_2 = 0.075*sin(pos.x*6.0-time*0.090)*sin(time*0.12)+0.45;
    float hill_3 = 0.100*sin(pos.x*6.0+time*0.095)*sin(time*0.14)+0.30;

    //sky, far, middle, and closest
    vec3 color = mix(sky_bot_color, sky_top_color, smoothstep(hill_1, 1.0, pos.y));
    color = mix(color, hill_1_color, smoothstep(hill_1 + 0.004, hill_1, pos.y));
    color = mix(color, hill_2_color, smoothstep(hill_2 + 0.004, hill_2, pos.y));
    gl_FragColor = vec4(mix(color, hill_3_color, smoothstep(hill_3 + 0.004, hill_3, pos.y)), 1.0);
}

sentences:
Fixing wave-like movements when rotating an object using mouse input in Unity I have encountered a rather odd issue with my program.

The setup:

In my scene, I have a GameObject which I have set as my player/character for this game. The player/character has a child GameObject, which is a cube, which represents the head, and is a child via the hierarchy. It also has a body for the character(both of these are just children of the main children/character).

When I move the mouse, rotation of the head should follow where the mouse is(the mouse is hidden, so it relies on mouse input). If the movement around the y-axis is larger than a set amount, the body of the character should turn as well. I have this all working fine.

The problem occurs with the actual movement. In certain circumstances, it will create a wave-like movement, while still following the mouse

Ie. if I move the mouse vertically, then back to being "flat", then move it horizontally(without any y-movement), it will create a wave movement horizontally. The same occurs with the other rotation, where if I move the mouse horizontally first, then move it up and down, it will create a wave, but only in the up/down movement.

Gyazo for GIF demonstrating issue

In the GIF above, I move the mouse slightly upwards, then left and right. The "wave-like" movement can clearly be seen, as it moves to the left, and to the right.

This is my code:

void moveView()
{
    //This method is called every Update(), after a method that locks the cursor using
    //Cursor.lockState = CursorLockMode.Locked, then sets it to Cursor.visible = false;
    //Raw inputs, ySen and xSen are public floats.
    toRotOnY = Input.GetAxisRaw("Mouse X") * xSen;
    toRotOnX = Input.GetAxisRaw("Mouse Y") * ySen;
    //I think its here, but I'm not sure exactly what the *= operator does to Quaternions. Also, the init values are set in Start()
    targetRotHead *= Quaternion.Euler(-toRotOnX, toRotOnY, 0f);
    //The 0f in the Z feild is to lock rotation to x/y only.
    //Should body rotate to match head?
    if (this.transform.eulerAngles.y >= targetRotHead.eulerAngles.y + 10 || this.transform.eulerAngles.y <= targetRotHead.eulerAngles.y - 10)
    {
    //If the body should rotate, do it here
        this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.Euler(0f, targetRotHead.eulerAngles.y, 0f), moveSpeed);

    }
    //Rotate to the wanted rotation
    //moveSpeed is a float which dictates the smoothing.
    headWithCamera.transform.rotation = Quaternion.Lerp(headWithCamera.transform.rotation, Quaternion.Euler(targetRotHead.eulerAngles.x, targetRotHead.eulerAngles.y, 0f), moveSpeed);

}

sentences:
How to avoid CollisionShape2D bouncing which prevents Area2D detection? Consider the player with a rectangular CollisionShape2D:

and a round enemy with a CollisionShape2D and a little bigger Area2D:

I observe frequent collisions with no body_entered signal sent by the enemy area.
I have tried to reduce the radius of the collision shape in the enemy. It works, but enemy behavior against walls is not satisfaying anymore.

Edit
My question was unclear... Bouncing is not appropriate to describe what is happening.
Player and Enemy are KineticBody2D.
After some reflection, I have an hypothesis:
Maybe it is because Enemy changes x direction each time _is_on_wall() which means that he changes direction when he hits the player too.
Anyway, if changing direction is the cause of the absence of detection of the player Body by the enemy Area, for the player and enemy to collide, the body of the player must be in the area of the enemy.
For @Theraot remark on adding on Area to the player, I have decided to leave to the enemy the responsability to detect and damage the player, because it is easier to make type of enemy this way I presume.

sentences:
Pokemon Yellow wrap transitions So I've been trying to make a pretty accurate clone of the good old Pokemon Yellow for quite some time now and one puzzling but nonetheless subtle mechanic has puzzled me. As you can see in the uploaded image there is a certain colour manipulation done in two stages after entering a wrap to another game location (such as stairs or entering a building).

One easy (and sloppy) way of achieving this and the one I have been using so far is to make three copies of each image rendered on the screen all of them with their colours adjusted accordingly to match each stage of the transition. Of course after a while this becomes tremendously time consuming.

So my question is does anyone know any better way of achieving this colour manipulation effect using java?

Thanks in advance,

Alex

sentences:
SharpDX / DirectX: How to render text to a transparent BitmapRenderTarget? I'm trying to render text to a BitmapRenderTarget, cleared with transparent color.

My TextBox is drawn on its own SharpDX.Direct2D1.BitmapRenderTarget, which I create in this way:

var bitmapRenderTarget = new SharpDX.Direct2D1.BitmapRenderTarget(renderTarget,
    SharpDX.Direct2D1.CompatibleRenderTargetOptions.None, null, null, null);

As you can see, I don't change the pixel format of BitmapRenderTarget. The pixel format of underlying SharpDX.Direct2D1.RenderTarget, on which I draw my TextBox through DrawBitmap method, is defined in the following code:

renderTargetProperties = new SharpDX.Direct2D1.RenderTargetProperties()
{
    PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown,
    SharpDX.Direct2D1.AlphaMode.Premultiplied)
};

Here is the code, that produces visual results:

// In the case 1: opaque white background
bitmapRenderTarget.Clear(SharpDX.Color.White);
...

// In the case 2: white background with 50% transparency
bitmapRenderTarget.Clear(new SharpDX.Color4(1f, 1f, 1f, 0.5f));
...

// In the case 3: fully transparent background
bitmapRenderTarget.Clear(SharpDX.Color.Transparent);
...

// The color of textBrush in all these cases is the same solid Black.
bitmapRenderTarget.DrawTextLayout(vector, textLayout, textBrush, ...);

The results:

As you can see, alpha value of the text color is somehow bound to the one in the clear color. The black line around the text is cursor, and it is drawn as it should.

How to fix this issue?

sentences:
Do open world games need less backstory? I've played a few open-world games and really enjoyed them, though the ones I've really enjoyed have generally received complaints about how little story there is to them.

The Saboteur is one example of this. Fully open-world, good enough story (for me, anyway), engaging gameplay, and still has received complaints in reviews about not having enough story.

Do open-world games actually need a full, all-encompassing story? Or can fun and engaging gameplay fill in the gap and let the designer get away with a slightly less complete story?

sentences:
How should I use Monte Carlo method to simulate some police cars that keep patroling in a tile based map? I have a tile map (isometric) and I have some police cars that they patrol all the time on the map, there is some building and other cars in map too so they are considered as constraints in my shortest path algorithm (below).

I use to randomly select some target for each police car and use A* algorithm to find the path to the randomly selected destination tile and this cycles over and over. because cars should move all the time! (except those that gamer should control)
The problem is police cars routes are correlated and they do not just traverse the area randomly, for instance, they do not usually cover a same area or they do not repeat their own route so my implementation based on some random destination point wasn’t a good idea and the result was not satisfying. Take a look at the following picture, it shows how randomly selecting the destinations worked for me, obviously, it is a dumb patroling for sure, even a cockroache could do better!

Suddenly, I remembered Monte Carlo Method and I thought it would solve my problem, because it exactly does what I wanted to do, However may be I should use Zobrist Hashing since it is tile base in nature. Does anyone has any idea how should I use this kind of methods?
Question in Brief :
How can I use Zobrist Hashing or Monte Carlo method to set destinations points for my patroling car (like police car)?
If anyone knows another way to implement a patrolling method, he/she is very welcome to post an answer, I am not sure if Zobrist Hashing is the best and worth to implement.
---First Edit (added following paragraph) :
I need to distribute the cars and their destination points in a homogeneous manner. Every kind of solution that get me close to a good pattern could be my answer, of course there is a lot of methods to do so, but I dont have any clue.

sentences:
Multiple Viewports/Windows Dear IMGUI c++ How do I use IMGUI with multiple GLFW windows? I know Dear IMGUI already has a virtual viewport system going in the viewport branch but I found that to be lacking a bit on how to use this new system.

To accomplish this would you share a single GLFWwindow context and using that for a single IMGUI context? Would there be any disadvantages to using this approach?

sentences:
D3DXLoadSurfaceFromResource failed to load bitmap image I'm working on a small DX9 game project for learning purpose. I'm current dealing with resources manager file (*.rc) which I'm not used to (I have only worked with direct file until now).
If I use D3DXLoadSurfaceFromFile, it worked fine, the image was drawn on windows. When I changed to D3DXLoadSurfaceFromResource, I think it can not load the image, only a black screen & the Hresult that it returns is S_FALSE.
This is the create surface function :
bool Surface::CreateSurface()
{
    if (FAILED(m_Device->CreateOffscreenPlainSurface(
        m_Width,
        m_Height,
        D3DFMT_X8R8G8B8,
        D3DPOOL_DEFAULT,
        &m_Surface,
        NULL
    )))
        return false;

    if (FAILED(D3DXLoadSurfaceFromResource(
        m_Surface,
        NULL,
        NULL,
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(m_RsSymbol),
        NULL,
        D3DX_DEFAULT,
        0,
        NULL
    )))
        return false; // S_FALSE and return false while debug
    return true;
}

This the render function :
void GWindow::Render()
{
    Surface Hello_Brown(146, 146, m_lpD3DV, IDB_SAMPLE); // IDB_SAMPLP will be assigned to m_RsSymbol
    LPDIRECT3DSURFACE9 backbuffer;
    if (NULL == m_lpD3DV)
        return;

    m_lpD3DV->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);

    m_lpD3DV->GetBackBuffer(
        0,
        0,
        D3DBACKBUFFER_TYPE_MONO,
        &backbuffer
    );

    m_lpD3DV->StretchRect(
        Hello_Brown.GetSurface(),
        NULL,
        backbuffer,
        NULL,
        D3DTEXF_NONE
    );

    m_lpD3DV->Present(NULL, NULL, NULL, NULL);
}

Where I am wrong and how do I fix it?
Resource file : link
I linked the file above, because it too long to post here.

sentences:
Full screen display mode Could somebody point me to resources that would explain what full screen actually is?

What's the point of it? It seems to be more than just a window that has the client are taking the whole screen.

sentences:
Writing a shader once without using CG? Is there a tool that can convert a fragment shader from hlsl to glsl or glsl to hlsl? I do not want to use cg since it is not able to work on mobile platforms.

Is there a tool that can make it so I only write a shader once?

Thanks

sentences:
How can I make trailing ghost effect (3d game)? I'm trying to draw previous frame of animation on screen
you can see this effect here: https://youtu.be/WNL_KJNl6pU
Mortal Combat X (left) , Street Fighter Alpha 2 (right):

This effect also found in animation software and called onion skinning:

I've implemented this by spawning object every second but I think It is possible with shader.

Update
I could make this effect by using RenderTexture for capturing previous frame , but I can't remove background color :(
I tried with Blending and grab pass but don't work(it was rendered normally)!!
sources :
https://github.com/smkplus/TrailingFX
https://unitylist.com/r/4tp/unity-fluid-2d-blur-image-effect

sentences:
Unity3D - Resources load to materials, how to? I think is a simple question, but I don't know nothing about it:

I have an created material in my materials folder, I just want to apply it to the GameObject by script.

I am trying

this.GetComponent<Renderer>().materials[0]=Resources.Load("Test", typeof(Material)) as Material;

The material name is Test and it is in materials folder, but the return is always the default material applied to the GameObject, so I think Unity didn't found it.

sentences:
Exponential EXP Curve | FIXED TIME -> MAX LEVEL I have yet another experience equation question, with a slight twist.

Problem Situation

Player gain experience from Level 1 - 80.

Time to level from Level 1 to 80 grows exponentially.

There is a constant of total hours X (540 hours in this case) to reach level 80.

What equation results in this?

From this, I should be able to balance an approximate Time To Kill Monster + downtime, varying from easy to hard monsters and experience they can give, resulting in same time to Max Level.

Or I could create quests that takes an approximate Time To Completion but rewards the same ratio of experience.

In my opinion this should be the optimum solution to create content that grant the same ratio of experience to time to level.

Thank you.

sentences:
How to display a text in the impact point position In my 3d game, i would like to display a text 'near' the impact point of a bullet.
I think i'm having problems setting properly text position.
This is my code.
The script is attached to an object Canvas.
position is the Vector3 impact position.

GameObject obj = new GameObject ();
Text _text = obj.AddComponent<Text> ();

_text.transform.position = position;
_text.text = message;
_text.fontSize = startSize;
_text.color = color;

I'm pretty sure i've to convert from a world space to a 'user interface' space.
Thanks

sentences:
LibGDX Deployment questions A few questions from LibGDX newbie:

How do you deploy a Mac/Windows app? If Mac app, can this be deployed to Mac App Store?
Do you need to pay monthly (for RoboVM) for iOS development/deployment?

I am using Android Studio. Thanks!

sentences:
Outline of plane slice of arbitrary object How would you extract the outline of a shape from slicing a plane through an arbitrary object?

Note: This is related to my Unity Answers question, but not exactly the same.

sentences:
Pinch in zoom in android In My layout
parent as Relative layout and then am having Scroll view
inside Linear layout
now am having child views as Image view Text View Web view and Recycle view and 2 buttons is there
now i want to pinch in zoom entire layout

please help me out
Regards
Govardhana

sentences: Resume option on game in android I made simple puzzle game. I want to add a "Resume" option to it, so when user opens the game, he can pick up where he left off last time.

sentences:
Bullet pattern isn't behaving as expected I have a boss that's supposed to continuously shoot five streams of bullets, each at a different angle. It starts off just fine, but doesn't seem to want to use its entire array of bullets. No matter how large I set the length of bulletList, the boss simply stops shooting after a couple of seconds, then pick up again shortly. Here's what I'm using to generate the pattern:

Vector3 direction = new Vector3(0.5f, -1, 0);

for (int r = 0; r < boss.gun.bulletList.Length; r++)
{
   if (!boss.gun.bulletList[r].isActive)
   {
      boss.gun.bulletList[r].direction = direction;
      boss.gun.bulletList[r].speed = boss.gun.BulletSpeedAdjustment;
      boss.gun.bulletList[r].position = boss.position;
      boss.gun.bulletList[r].isActive = true;
      break;
   }

}
direction = new Vector3(-0.5f, -1, 0);
//Repeat with four similar for loops, to place a bullet in each direction

It doesn't seem to matter if the bulletList length is 1000 or 100000. What could be the issue here?

EDIT: This is the code that removes a bullet, when it goes out of bounds. It is inside Bullet.Update()

if (position.X > 950 ||
position.X < -950 ||
position.Y > 570 ||
position.Y < -570)
isActive = false;

This is the code that removes a bullet on contact with the player ship:

for (int i = 0; i < boss.gun.bulletList.Length; i++)
{
   if (boss.gun.bulletList[i].isActive)
   {
      boss.gun.bulletList[i].Update(timeDelta);

      if (!ship.invincible)
      {
         bulletSphere.Center = boss.gun.bulletList[i].position;
         if (bulletSphere.Intersects(shipSphere))
         {
             boss.gun.bulletList[i].isActive = false;
             ship.health -= boss.gun.damage;
         }
      }
    }
}

And just for safe measure, here's the code that draws the bullets:

for (int j = 0; j < boss.gun.bulletList.Length; j++)
{
   if (boss.gun.bulletList[j].isActive)
   {
      Matrix bulletTransform = Matrix.CreateTranslation(boss.gun.bulletList[j].position);
      DrawModel(boss.gun.bulletModel, bulletTransform, boss.gun.bulletTransforms);
   }
}

EDIT: It would appear that a large number of bullets are getting "stuck" on the boss. That is, they draw at boss.position, and never move.

sentences:
Suitable SDK to develop quick game? I'm currently undertaking a personal project at home that I need to turn around inside the next few months (which working full time and still learning programming makes it a tad difficult). I'm looking for suggestions on SDK's or tools (preferably free or that come with games, similar to steam tools) that I can use to develop a "game". I'm OK with coding but have no 3D development skills at all.

I've very little experience with mod tools or SDK's at all but I'm hoping someone can point me in the direction of one that does the following:

A decent library of prefab 3D models to build scenes.
Ability to add scripting to the scene

I've used Unity before and would prefer to continue to do so however I really have the worst 3D skills imaginable and can't waste time learning them.

I'd be looking for pre-fab items that are both industrial and possibly more lush environments (trees etc). If it makes any difference (due to licencing and what-not) I WILL NOT be selling this game or marketing it in any way and I am a University Student if any places do educations licences.

Another alternative would be to source free 3d models elsewhere but again while I'm still learning I have no idea where to look if someone could point me in the right direction I'll do the rest of the digging.

Thanks

sentences:
After a succesful glLinkProgram, should I delete / detach my shaders? After I have a linked program, and thinking about defensive programming, should I delete and detach the shaders used to link this program?

If yes, is that going to free any resources? Or do these shader objects only going to be freed after a glDeleteProgram call?

edit: Just for clarification what I am doing is (which is consistent with the answer):

  glCreateShader -> glShaderSource -> glCompileShader -> glCreateProgram -> glAttachShader -> glLinkProgram -> glDetachShader -> glDeleteShader -> draw using this shader program -> and when I don't need this shader anymore glDeleteProgram

sentences:
Making a sound every time I get to the edge of the platform I'm trying to make a runner game for the blind, and I need help making a sound every time it is time to jump. I am using Game Maker, and I have no idea how to do it.

How do I play a sound when my player gets to the edge of a platform in Game Maker?

sentences:
SDL mouse wheel not picking up Running Ubuntu 11.04, SDL 1.2 trying to pickup mouse wheel up/down movement with this (stripped down) code:

int main( int argc, char **argv )
{
    SDL_MouseButtonEvent *mousebutton = NULL;

    while ( !done )
    {
        if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_LEFT)
            yrot += 0.75f;
        else if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_RIGHT)
            yrot -= 0.75f;
        else if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_WHEELUP){
            xrot += 0.75f;
        }else if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_WHEELDOWN){
            xrot -= 0.75f;
        }

        while ( SDL_PollEvent( &event ) )
        {
            switch( event.type )
            {
                case SDL_MOUSEBUTTONDOWN:
                    mousebutton = &event.button;
                    break;
                case SDL_MOUSEBUTTONUP:
                    mousebutton = NULL;
                    break;
                default:
                    break;
             }
        }
    }
    return 0;
}

strange thing is, scrolling with the mouse button does nothing, but if I hold down a mouse button or two and then move the mouse it hits the SDL_BUTTON_WHEEL code occasionally.  This honestly reeks of a pointer issue, which would make sense since I've been spoiled with C# for the past couple years, but I am just not seeing it.

How do i correctly find mouse scroll events in SDL?

sentences:
How to capture image from camera with post effects? Mysteriously only get emission(?) pass I have a separate camera from my main camera, whose purpose is to take screenshots, or render a "live feed" of the action, at different angles.  Hierarchy as such:

The game object labeled as "main camera" captures the 3D scene just like a normal main camera would, including post-processing components.

The GUI camera captures just the UI layer.
The canvas and image are simply a watermark, rendered by the GUI camera.  I have removed this and it has no bearing on the issue at hand.

I point both the main camera and GUI camera to the same target render texture.  The result of the render texture appears to be correct in the inspector.

One way or another, it appears that I can only get access to the "bloom," and nothing else:

(On black so it's easier to see.)
If I assign the render texture onto a Raw Image canvas element, it only shows the "bloom."
If I try to convert the render texture to a regular texture, it also only shows the "bloom."
RenderTexture.active = renderTexture;
destination.ReadPixels(new Rect(0f, 0f, renderTexture.width, renderTexture.height), 0, 0);
destination.Apply();

(I have also tried AsyncGPUReadback.  Its resulting texture looks like a flat gray without variance in the inspector.)
I have found if I disable post-processing, everything works as intended, no changes required.  Of course, I am missing the post processing, which I want!
Somehow, somewhere, Unity is getting data external of the texture itself, depending on context:

Using Unity's ReadPixels method only picks up the "bloom."
Using Unity's EncodeToPNG method only picks up the "bloom."
Putting the RenderTexture on a Raw Image only picks up the "bloom."
If I use a separate PNG encoder using the same Color32 data, I get the final correct image.
The inspector successfully renders the final correct image.

I have actually run into this issue multiple times, and never found a proper solution, and definitely never a real-time solution, which I now desperately need.

sentences:
Smooth Biome transitions with tile map? I'm using a simplex noise system to generate height maps for an "infinite" 2d world map. It works perfectly - I can define which tile belongs at which height value, etc.

However, I'm trying to add in biomes - I want different areas of the map to use tiles exclusive to that "biome".

I've tried generating a second noise value divided by a larger number so that I can generate very large areas. That noise value determines the biome, and the noise value for tiles determines the tile inside that biome. This works ok - but when the same noise value means different tiles in each biome, then you wind up with very ugly cut-off lines between biomes.

I tried adding the biome noise and tile noise together and only selecting the tile based on those. The edges were smoother, but there really was no actual use of the biome code - just tiles locked to unique noise values, never overriding each other.

What's a better way to do this, so that biome boundaries follow "features" of the terrain? I want them to be fairly large, but not cut through a "mountain" - the boundary should follow the natural curvature of the height map values.

sentences:
Texture R8_FLOAT format? I'm working on SAO (http://graphics.cs.williams.edu/papers/SAOHPG12/) and I want to store my ambient obscurance term (a value between 0.0 and 1.0) in a texture.

When I did shadowmapping, I created my depth-texture as DXGI_FORMAT_R32_TYPELESS and the shader resoure view as DXGI_FORMAT_R32_FLOAT, however with this I want a DXGI_FORMAT_R8_TYPELESS format and a FLOAT equivalent, yet there appears to be none according to the docs (http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx)

1) What texture/srv/rtv format should I use if I want to store/read/write 8-bit float values?

2) Does the format used really matter? Does directx do any behind-the-scenes alterations to the texture data? Is a DXGI_FORMAT_R8_UNORM treated differently from a DXGI_FORMAT_R8_SNORM for example?

sentences:
How can I create a persistent seed for each chunk of an infinite procedural world? I'm coding a chunk-based 2D game.

I generate chunks as the player explores the world. Chunks follow a procedural generation algorithm (with only one biome implemented at the minute, but I'll introduce more).

When the player leaves a chunk however and it's unloaded, that chunk is lost for good (unless they modified the chunk; if that is the case, I save it). This is because with each new chunk I generate, I generate a new random seed for it.

I introduced a world seed into my world. My chunks also have 'world coordinates', ie the first chunk you spawn in is at (0, 0) and the chunk to the right is at (1, 0), etc, in world coordinates.

I was thinking about ways I can combine the world coordinates and world seed in order to obtain a chunk seed. That way, since I always know the world seed and always know the world coordinates, I could obtain the same chunk seed in order to make sure the same chunk comes back after the player leaves it (and the chunk is unloaded) and then returns to that location in the world when it has to be reloaded.

Some of the ways I thought of were as follows:

Use a simple equation like abs(world seed * world_coordinate_x * world_coordinate_y) where the absolute value function enforces a postive chunk seed.

This would not be an acceptable equation to use as the equation would give the same chunk seed for the world coordinates (x, y), (y, x), (-x, -y), (x, y), etc, resulting in a pretty dodgy pattern to the world.

I know games like Minecraft accomplish this, but I cannot find a way to obtain a chunk seed based off of the world coordinates and world seed without there being a weird symmetry in my world generation.

What seed generation method can I use to avoid these symmetries or obvious correlations?

sentences:
Java: See if Mouse is hovering/clicking Sprite The game I am developing is in which you defend the Cell from the Viruses, and I need the sprites to have a MouseListener for when the mouse clicks on that sprite, it will get destroyed, and I cannot figure out how to get the location of the mouse and apply it to the sprite.

Basically, I need to grab the location of the mouse and the sprite, and when the user clicks it will reset the sprite.

I have tried to do debugging with this, so like if the mouse hovers the location of the sprite it will print a message "Hovering" but it just doesn't work.

For my update method, I added:

if(MouseInfo.getPointerInfo().getLocation() == this.getLocation()) System.out.println("SAME LOCATION");

I even got it to print out the location of the sprite and the mouse, and I aligned them both to 0,0 and it still didn't work.

CONCLUSION:
How do I check if the location of the mouse is the same as a sprite, and then print out a message to the console?

sentences:
RTS game unit structure I want a way to make a lot of different units without having to program stuff like moveTo and Attack actions more than once

The way I see it, there are 2 ways I can do this.

A single generic Unit class with flags that specifies what it can/can't do (then create instances in a static array and grab them when needed)
Abstract unit class with abstract methods for Unit-specific actions like (Attack, Harvest, Patrol), which then all need to be implemented in the subclasses, even if the unit can't actually harvest anything.

the first way of doing this seems the simplest, but i would end up having a lot of code being unused for the majority of the units.

the second way could also work. But if i decide to have two different units that can harvest resources, i'm gonna have the exact same code in two different classes, which doesn't seem like the right way to do it.

Is this even the right approach to this problem?
In a game like AoE, every unit has, what i presume is, some kind of List of Actions/Orders, I would really like to know how to achieve something similar to that, where i can just code each Action/Order once, and then give it to all the units that need said Action.

If i'm unclear (highly plausible) or you need more information on what exactly i'm looking for, just ask me in a comment.

sentences:
Inelastic ball collision I'm trying to implement basic inelastic ball collision.

The example on the link above is for one dimension. It explains that it's the same for 2D but where the velocities are the components in the direction of the normal in the point of collision. I have tried calculating these components by projecting on the normal vector, and then calculating the new velocities. But then I got stuck. How do I get the new velocity vectors? My attempt below does not produce any good result. Can you help me out? (The two balls are intersecting in one common point when I run the code below)

UPDATE: I have edited the code now so that the two last lines is more correct I think. The thing is I have to combine the new velocity vector component with the old velocity vector component that was first subtracted in the projection operation, to get the complete new velocity vector. Now the animation looks a lot better. I still get occasional ball merging and popping but that could be some other part of my code thats wrong.

var m = this.Mass + other.Mass;
// normal in the point of collision
var n = (this.Position - other.Position).Normalized;
// velocity component perpendicular to the tangent in the point of collision for ball A
var ua = (float)(this.Velocity.Magnitude * Math.Cos(this.Velocity.Angle(n)));
// velocity component perpendicular to the tangent in the point of collision for ball B
var ub = (float)(other.Velocity.Magnitude * Math.Cos(other.Velocity.Angle(n)));
// the new velocity for ball A
var va = (0.9f * other.Mass * (ub - ua) + this.Mass * ua + other.Mass * ub) / m;
// the new velocity for ball B
var vb = (0.9f * this.Mass * (ua - ub) + this.Mass * ua + other.Mass * ub) / m;

// the new velocity vector for ball A
this.Velocity -= n * (ua - va);

// the new velocity vector for ball B
other.Velocity -= n * (ub - vb);

sentences:
How does creating 2d game assets differ from regular 2d art? I've done some digital paintings and concept sketches in the past, and I was thinking about employing those skills in my game making efforts.

From an artists standpoint, what does he have to do differently/additionally to make his artwork "game ready" or "game friendly"?

Mostly I'm interested in using 2D in Unity, perhaps with an isometric view (so called 2.5D)

sentences:
Pygame Error AttributeError: 'pygame.Surface' object has no attribute 'add_internal' I'm making my first game of Pygame. I'm going to create groups for making collisions but when I add an object to the group, I get an error in sprite.py (Pygame's Files)

AttributeError: 'pygame.Surface' object has no attribute 'add_internal'

Why I get this error?
There is a simplest way to make collisions?

There is my code:

import pygame
from pygame.locals import *
import sys
import os
import time
width = 950
height = 500
Game = False
GameOver = False
keyboard = pygame.key.get_pressed()[K_UP]
def main():
    pygame.init()
    screen = pygame.display.set_mode((width, height))
    pygame.display.set_caption('Flappy Dog')
    background = pygame.image.load(os.path.join("Images", "Background_00.png")).convert()
    FlappyDog = pygame.image.load(os.path.join("Images", "Flappy.png")).convert_alpha()
    Play = pygame.image.load(os.path.join("Images", "Play.png")).convert_alpha()
    Dog0 = pygame.image.load(os.path.join("Images", "Dog0.png")).convert_alpha()
    Dog1 = pygame.image.load(os.path.join("Images", "Dog1.png")).convert_alpha()
    SpikeUp0 = pygame.image.load(os.path.join("Images", "SpikeUp0.png")).convert_alpha()
    SpikeUp1 = pygame.image.load(os.path.join("Images", "SpikeUp1.png")).convert_alpha()
    SpikeDown0 = pygame.image.load(os.path.join("Images", "SpikeDown0.png")).convert_alpha()
    SpikeDown1 = pygame.image.load(os.path.join("Images", "SpikeDown1.png")).convert_alpha()
    GameOver = pygame.image.load(os.path.join("Images", "Game-Over.png")).convert_alpha()
    Replay = pygame.image.load(os.path.join("Images", "Replay.png")).convert_alpha()
    Bone = pygame.image.load(os.path.join("Images", "Bone.png")).convert_alpha()

    Game = True
    Dog1_pos_x = 100
    Dog1_pos_y = 100
    screen.blit(background, (0, 0))
    screen.blit(FlappyDog, (0, 0))
    screen.blit(Bone, (550, 100))
    screen.blit(Play, (600, 350))
    screen.blit(Dog0, (5, 240))
    bones = pygame.sprite.Group()
    bones.add(Bone) # <-- Error here
    Dog = pygame.sprite.Group()
    Dog.add(Dog1)
    pygame.display.update()

    while True:
        if GameOver == true:
            screen.blit(background, (0, 0))
            screen.blit(GameOver, (20, 50))
        if pygame.sprite.gropucollide(Dog, Bones, True, True):
            Game = False
            GameOver = True
        while Game == True:
            pygame.event.pump()
            if pygame.key.get_pressed()[K_UP]:
                for i in range(10): # Up
                    Dog1_pos_y = Dog1_pos_y -1
                    screen.blit(background, (0, 0))
                    screen.blit(Dog1, (Dog1_pos_x, Dog1_pos_y))
                    screen.blit(SpikeDown0, (0, 436))
                    screen.blit(SpikeUp0, (0, 0))
                    pygame.display.update()
                    pygame.time.delay(1)
            else: # Down
                Dog1_pos_y = Dog1_pos_y +1
                screen.blit(background, (0, 0))
                screen.blit(Dog1, (Dog1_pos_x, Dog1_pos_y))
                screen.blit(SpikeDown0, (0, 436))
                screen.blit(SpikeUp0, (0, 0))
                pygame.display.update()
                pygame.time.delay(1)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
                pygame.display.update()

if __name__ == "__main__":
    main()

sentences:
What is the story of game programmers beside gaming history? Nowadays, game programming is like a big business-ish, technological, academical, programming havoc. There are dozen of engines, free or not, don't-reinvent-the-wheel dos and don't, plenty of different platform, plenty of game genres, and a lot of languages.

The video game economy boomed around the 90's (I guess, with the NES etc), and just before that, I wonder how game programmers were doing their job, what languages they used, what was the equivalent of the current "dev kit", anyways what were those few guys technics and tools to achieve a working game on such tiny computer power ?

I read that the playstation had only 3MB memory total: besides CD-swapping, how could they achieve to build an executable to hold on 2mb or ram, for complex games like Metal Gear Solid or Vagrant Story ?

Since I'm young and I missed all that, I have some questions...

Were game makers only or most programmers ? Why do I think a game programmer who has played a lot, has a more important role that game designers, 3D artists, because they know how a game is really made ?
Since C was invented in the 70, did all programmers use it, or were they forced to use ASM to get the best optimisation ?
Is being a game programmer a safe job (I mean in the job market) ?
Since computers are so freaking fast today, how has the optimisation task changed ? Do we use computer/console power to their maximum, or do we waste it because we can't come up with complex enough gameplay ?

sentences:
Phone complains that identical GLSL struct definition differs in vert/frag programs When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant / Android 2.2) complains that the definition differs.

struct Light {
    mediump vec3 _position;
    lowp vec4 _ambient;
    lowp vec4 _diffuse;
    lowp vec4 _specular;
    bool _isDirectional;
    mediump vec3 _attenuation; // constant, linear, and quadratic components
};

uniform Light u_light;

I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float;"

The exact error is:

Uniform variable u_light type/precision does not match in vertex and fragment shader

Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)

sentences:
Why does launching an object using Rigidbody2d.velocity not work properly I am currently trying to launch a gameobject using Rigidbody2d.velocity but whenever I launch it goes backward instead of forwards. I have already tried making the vector 3 that I am using negative, but nothing seems to work. Please help as I don't even know why this happening.

Here is my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ArmPower : MonoBehaviour {

    //Priority Script

    public ArmAngle armAngle;
    public bool allowLaunch = false;
    public GameObject armPowerSlider;
    public bool ifLaunched;
    public GameObject armPowerPhone;
    public StartAllowStrengthPower startAllow;
    public PhoneController armPhoneController;

    // Use this for initialization
    void Start () {
        armAngle = FindObjectOfType<ArmAngle>();
        armPowerSlider = GameObject.Find("PowerSlider");
        ifLaunched = false;
        armPowerPhone = GameObject.Find("Phone");
        startAllow = FindObjectOfType<StartAllowStrengthPower>();
        armPhoneController = FindObjectOfType<PhoneController>();
    }

    // Update is called once per frame
    void Update () {
        if (allowLaunch)
        {
            LaunchPhone( (int) (Mathf.Round(armPowerSlider.GetComponent<Slider>().value) ));
            ifLaunched = false;
        }
        if(startAllow.allowLaunchChanger <= 0)
        {
            LaunchPhone((int)(Mathf.Round(armPowerSlider.GetComponent<Slider>().value)));
        }

    }

    public void LaunchPhone(int launchAmount)
    {

        Vector3 launchValue = new Vector3(armPowerPhone.transform.position.x, launchAmount, armPowerPhone.transform.position.z);

        armPowerPhone.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;

        armPowerPhone.GetComponent<Rigidbody2D>().velocity = launchValue;

        armPhoneController.armAudio.Play();

        armPowerPhone.transform.SetParent(null);
        armAngle.allowStrength = false;
        allowLaunch = false;
        ifLaunched = true;
        startAllow.allowLaunchChanger = 5;

    }
}

sentences:
If (button.interactable) condition doesn't work - why? I have a Typewriter script attached to the text, which is a child of a button.
I want this script to run only if the button is interactable.

I made a public variable to store the button and used GetComponent() method, but it doesn't work.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

// attach to UI Text component (with the full text already there)

public class UITextTypeWriter : MonoBehaviour {

public Text txt;
string story;
public Button ParrentButton;

void Awake()
{
    txt = GetComponent<Text>();
    story = txt.text;
    txt.text = "";

        Button b = ParrentButton.GetComponent<Button>();
        if (b.interactable)
        {
            StartCoroutine("PlayText");
        }
}

IEnumerator PlayText()
{
    foreach (char c in story)
    {
        txt.text += c;
        yield return new WaitForSeconds(0.125f);
    }
}

}

Where is my mistake? I would be grateful for your help!

Thank you in advance!

sentences:
Maya - Black triangles when viewing model from a distance Everything was fine while working on a model in Maya, until randomly, numerous black triangles started appearing all over my model. They seem to go away when I zoom in closely with the camera:

This issue seems to be associated with my particular project, I am able to open and view my other models without any problems. Opening this file on another machine has an error message in the Output Window:
"Maya binary file parse error:  : (6) corrupted file structure"

I've tried Googling around and tried (without success):

Normals -> Set To Face
Normals -> Unlock
Normals -> Reverse
Changing various renderer settings

Here's a download link to my .mb:
http://www.filedropper.com/herocharacter

Thanks in advance!

sentences:
Dynamic model scaling Imagine a (3D) game like Railroad Tycoon 3. Player selects a rail track, clicks LMB and drags the mouse to the end position. During this drag, the rail track model scales and adopts to the landscape, so user sees the resulting track in dynamic.

The question: how this can be done? A brief idea/links/sketches will be enough. I just don't know how to start (I'm novice game developer). If it is matter, I use Unity as a game engine.

Thanks in advance.

sentences: Why does the Modelview Matrix in OpenGL not have accurately signed vector values for look vectors? When I do a GluLookAt(0.0, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0) so that I'm 500 units up on the positive Y axis looking down at the origin with the top vector of the camera pointing toward the negative Z axis, that means my unit vector, mathematically speaking, should be (0.0, -1.0, 0.0) correct?  If I'm looking down toward the negative Y axis now and want to move closer to the origin, I'm supposed to subtract the number of units from my camera's current position of 500 so that the Y value gets smaller which means I'm moving the camera forward in the direction I'm pointing.  How come when I do a glGetFloatv(GL_MODELVIEW_MATRIX, mycopy) to get the current matrix right after the GluLookAt command is executed, I end up getting a Look Vector of (0.0, 1.0, 0.0) so that it's a positive Y value?  mycopy[2], mycopy[6] and mycopy[10] are the look vector values.  I know I can negate it to get the negative Y value but it seems like a cheap move.  Why does OpenGL do this in the modelview matrix when REAL mathematics states that it should be a negative Y value for the look vector?  If anyone can help me understand this, I would greatly appreciate it.  :)

sentences:
SAT - How to find Shortest line between two static convex 2D Polygons? RI have a pretty standard SAT algorithm that seems to successfully be detecting collisions but now I am looking for some assistance in finding the shortest line between 2 separated Polygons.

I have spent quite a bit of time searching and trying things with no success.
If someone could point me in the correct direction or give a solution to this I would be most greatful.

While a general n polygon vs n polygon solution would be awesome my use case only requires OBB vs OBB. This could simplify the answer.

sentences:
Turn-based strategy games where action happens in real-time? Okay, this idea has come up for the 3rd time in conversation now, and it's been bugging me for years. The idea is a game where all players make decisions/issue orders to units while the game is in a paused state, and all the actions are executed at once, in real-time. This could be at any level from a TRPG (i.e. Final Fantasy Tactics), to a small-scale skirmish (i.e. Worms), to a game with bases and many units (i.e. Advance Wars), to a Risk-type game (i.e. Risk).

The main disadvantage to this I can see is that the player doesn't see the result of an action immediately. In a traditional turn-based or real-time strategy game, the user clicks "attack that fool" and there's an explosion straight away. There also might be weird situations (you send your unit to melee a unit running in the opposite direction, for example), but that's a low-level detail; a good game designer should be able to get around these things. Finally, there's the general paucity of turn-based games, but they offer a level of tactical depth impossible in real-time strategy games, and there's always a market for them (dozens of new TBSes appear each year).

Are there any games out there that use this paradigm?
Why aren't there more?
What would be necessary to make this work?
What potential issues could you foresee?

To clarify, I mean pure strategy. The commands are input beforehand, and the resolution is realtime, but it doesn't require realtime "twitch" input by players.

EDIT: Iain's answer pointed me to Laser Squad Nemesis, which basically answered the 2nd and 4th question ;-P -- If you want to know why this won't work, download the demo (It's 9MB) and click the first tutorial. OUCH! Of course, Laser Squad Nemesis's UI doesn't help (play and pause buttons? seriously? and why do I have to click "issue orders" every turn if that's the only thing I'm going to be doing?)

For simpler things (like the board games mentioned in a couple answers, or Zwok that Iain created), this paradigm works great! Issues seem to arise with a more traditional tactics/strategy game, because the lag between the entry of a command and the execution of the command is apparent. In fact Zwok - and some of the board games mentioned - work because off this lag, not in spite of it. You're encouraged to guess what your opponent will do next and "think ahead". However in a more traditional small-scale tactical strategy game, the frustration factor isn't worth it.

It might be interesting to see a game like this on a really large scale. For example, Lee and Napoleon didn't order their troops around in real-time, but rather made decisions based on information that was often hours old -- and it often took hours for those orders to get executed. Even today, generals don't have real-time top-down maps. But taking that "frustration factor" out would require some seriously deft game design.

sentences:
Why does my mesh disappear from certain angles? I'm trying to construct a hexagonal prism from vertices for my turn-based strategy game. This is my first time working with meshes and I have been following this tutorial.

The problem I am having is that the sides of my shape disappear at certain angles (in this example, I only rendered the top, bottom, east, and west sides).

I have tried removing the main camera and lighting from the scene. I have tried using RecalculateBounds() but that had no effect and besides, Unity's documentation says it's not needed when assigning triangles.

The whole thing gets rendered if I position the camera perfectly, so I don't imagine I'm calculating vertices incorrectly or anything like that. Is there something I should know about Unity meshes that would cause this to happen?

sentences: Why did an Android update disable  the textures in my game? I recently updated my tablet to Android 4.0.3 and now the textures for my game do not show up. I'm using OpenGL-ES 2.0 for my engine. It worked fine when I was running android 3.0.  Is there any reason as to why this is happening?

sentences:
How to implement the swipe up and down number select Unity3d I want to implement the UI like in the image.
I want the users to select the number by swiping up and down.
I found the tutorial on the YouTube which is similar to the what i wanted (https://www.youtube.com/watch?v=mL-FLsV3WRs)
But it shows only the numbers from 0 to 9. I want to show from 1 to N (n can be any number).
Any idea to help me to get this would be great.

sentences:
What does linearDamping mean in Box2D? If I set linearDamping on a body, it's velocity will be decreased slowly, until it stops.
The documentation says, that the units are 1/time, which is unclear for me.

If the velocity of a body is 10 m/s, and the linearDamping is 0.5, then how can I calculate that when will the velocity be decreased to 1 m/s ?

sentences:
Making a point light follow the camera I'm applying phong shading onto a single giant triangle, and I'd like the light's coordinates to coincide with the camera's coordinates in 3D space. In order to do this, whenever I update the camera's coordinates, I also update the light's coordinates. However, diffuse and specular lighting don't "focus" exactly at the camera position when I bring the camera close to the triangle, instead they do it a few units too far. The triangle is .5 units below the XZ plane and parallel to it. Here is a picture demonstrating this effect.

Also, here are my HLSL shaders; this is where all the transformations happen.

// Vertex Shader ////////////////////////////////////////

 float4x4    Matrix; // ViewProjection Matrix
 float4x4    Matrix2; // View matrix
 float4x4    Matrix3; // View matrix with translation zeroed out

 float4    lightPos;

struct VS_INPUT
{
    float4  Pos     : POSITION;
    float4  Normal  : NORMAL;
    float2  Tex0    : TEXCOORD0;
};

struct VS_OUTPUT
{
    float4  Pos     : POSITION;
    float4  Normal  : TEXCOORD1;
    float4  LightDir     : TEXCOORD2;
    float2  Tex0    : TEXCOORD0;
};

////////////////////////////////////////

VS_OUTPUT VShade(VS_INPUT In)
{
    VS_OUTPUT Out = (VS_OUTPUT) 0;

    Out.Tex0      = In.Tex0;

    //world space -> clip space transformation
    Out.Pos       = mul(In.Pos, Matrix);

    // world space -> camera space transformations
    Out.Normal    = normalize(mul(In.Normal, Matrix3));
    Out.LightDir  = normalize(mul(lightPos - In.Pos, Matrix3));

    return Out;
}

// Pixel Shader ////////////////////////////////////////

sampler   baseTex;

struct PS_INPUT
{
    float4  LightDir     : TEXCOORD2;
    float4  Normal  : TEXCOORD1;
    float2  Tex0    : TEXCOORD0;
};

struct PS_OUTPUT
{
    float4  Color   : COLOR;
};

////////////////////////////////////////

PS_OUTPUT PShade(PS_INPUT In)
{
    PS_OUTPUT Out = (PS_OUTPUT) 0;

    float4 Normal = normalize(In.Normal);
    float4 LightDir = normalize(In.LightDir);

    float di = saturate(dot(Normal, LightDir));

    float4 ambient = {0.1, 0.1, 0.1, 1};

    float4 Reflect = normalize(2 * di * Normal - LightDir);
    float specular = pow(saturate(dot(Reflect, LightDir)), 2);

    Out.Color = ambient + tex2D(baseTex,In.Tex0) * di + specular;
    return Out;
}

EDIT

In.LightDir is computed for each pixel. It is first computed for each vertex in the vertex shader Out.LightDir  = normalize(mul(lightPos - In.Pos, Matrix3));, then it is interpolated across the whole triangle. lightPos is just the camera's position (which coincides with the light):

if(handle = m_pVertexConstants->GetConstantByName(NULL,"lightPos"))
        m_pVertexConstants->SetVector(pDevice,handle,(D3DXVECTOR4*)m_camera.GetPosition());

Also, the world transformation matrix is just the identity, so I have not included it anywhere.

sentences:
Collision Detection for 2D I am working on a simple game, where I need to do a collision detection of two Texture2D. The code I have written is:

bool perPixelCollission = false;
            Texture2D texture1 = sprite1.Texture;
            Texture2D texture2 = sprite1.Texture;
            Vector2 position1 = new Vector2(sprite1.CurrentScope.X, sprite1.CurrentScope.Y);
            Vector2 position2 = new Vector2(sprite2.CurrentScope.X, sprite2.CurrentScope.Y);

            uint[] bitsA = new uint[texture1.Width * texture1.Height];
            uint[] bitsB = new uint[texture2.Width * texture2.Height];

            Rectangle texture1Rectangle = new Rectangle(Convert.ToInt32(position1.X), Convert.ToInt32(position1.Y), texture1.Width, texture1.Height);
            Rectangle texture2Rectangle = new Rectangle(Convert.ToInt32(position2.X), Convert.ToInt32(position2.Y), texture2.Width, texture2.Height);

            texture1.GetData<uint>(bitsA);
            texture2.GetData<uint>(bitsB);

            int x1 = Math.Max(texture1Rectangle.X, texture2Rectangle.X);
            int x2 = Math.Min(texture1Rectangle.X + texture1Rectangle.Width, texture2Rectangle.X + texture2Rectangle.Width);

            int y1 = Math.Max(texture1Rectangle.Y, texture2Rectangle.Y);
            int y2 = Math.Min(texture1Rectangle.Y + texture1Rectangle.Height, texture2Rectangle.Y + texture2Rectangle.Height);

            for (int y = y1; y < y2; ++y)
            {
                for (int x = x1; x < x2; ++x)
                {
                    if (((bitsA[(x - texture1Rectangle.X) + (y - texture1Rectangle.Y) * texture1Rectangle.Width] & 0xFF000000) >> 24) > 20 &&
                        ((bitsB[(x - texture2Rectangle.X) + (y - texture2Rectangle.Y) * texture2Rectangle.Width] & 0xFF000000) >> 24) > 20)
                    {
                        perPixelCollission = true;
                        break;
                    }
                }
                // Reduce amount of looping by breaking out of this.
                if (perPixelCollission)
                {
                    break;
                }
            }

            return perPixelCollission;

But this code is really making the game slow. Where can I get some very good collision detection tutorial and code? What is wrong in this code?

sentences:
Can inserting/removing one point in a quadtree or octree cause multiple splits/collapses? I was reading Robert Nystrom's Game Programming Patterns website and, in the section about spatial partitioning, particularly in the section on quadtrees, he mentions:

Objects can be added incrementally. Adding a new object means finding the right square and adding it. If that bumps that square above the maximum count, it gets subdivided. The other objects in that square get pushed down into the new smaller squares. This requires a little work, but it’s a fixed amount of effort: the number of objects you have to move will always be less than the maximum object count. Adding a single object can never trigger more than one subdivision.
Removing objects is equally simple. You remove the object from its square and if the parent square’s total count is now below the threshold, you can collapse those subdivisions.

I can't help but wonder if this is really right. Experimenting with certain simulators this one, when adding a point that is close to another one (and since it only allows one point per grid space) multiple subdivisions happen until they're fit. The same happens when you remove a point, with the subdivisions collapsing.
An example using the website:

With just another point, 5 subdivisions happen:

Was this perhaps a mistake on Nystrom's part? Or is it just a definition that can change from quadtree implementation to implementation? I'm also wondering if the same can happen with octrees.

sentences: LibGDX . draw multiline text I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically and show whole text on the screen ?

sentences: Random generation of realistic human faces What would be a practicable way of generating huge numbers of realistically looking human faces? Randomizing 3D-models and rendering them would require a lot of computing power, especially as I'm needing them on an ad-hoc basis. Layering individual 2D-drawn parts requires some artistic talent, which I'm definitely lacking. Also, I'd like to parameterize as many aspects of the generational process as possible. Do you have any suggestions how to go about this?

sentences:
When to use class/objects for graphics I am fairly new to game development, but I have a good programming background with object oriented programming.

But with games, I do not know when I should use an object (or class) for an entity on the screen or whether I should just draw the images straight to the screen.

I think that for any graphic objects that need interacting with (say the player or certain environment objects) would need their own class and just decoration (the image that make up the background) could be drawn straight to the screen.

So, my question is: when do I use an object or class for my graphics?

If it makes any difference, I am using LibGDX.

sentences:
How to implement trading card game's "special effects cards"? I am trying to write a kind of a trading card game here, in some way, it is similar to Magic The Gathering, or the Yu-Gi-Oh! card game.

For those of you who are not familiar with it, basically, in the game, there is a special kind of card (Spell cards/ Trap cards/ etc.), which have special effects that can bend the rules of the game. What I totally have no idea is, how to implement the logic of these cards. I have some idea of storing the card's data with some flags that can signal what kind of ability it has, but that would be very limited in what it can do (only some simple stats modification, maybe).

To give you an idea of what kind of effects these cards can have, here is some example of the spell card effects that are present in the Yu-Gi-Oh! card game:

Revive a creature that has been destroyed
Take control of the opponent's creature
Modify stats of the creature based on some conditions (e.g. Number of creature with certain names that have been
destroyed)
Special summon a certain creatures if the some conditions are fulfilled.
Fuse two or more creatures into a stronger creature.
Immunity to some of the special cards' effect.

Konami has made several video games of the game, complete with the AI and thousands of cards variety. I don't think it is actually possible to hard-code the entire database, is it?

Now, of course what I am trying to do is in no where as complex as those games, but I am curious, how do they implement these?

sentences:
Easily split up a ripped spritesheet with no downloads? So, I'm new and all to game development, and I use the free version of Construct 3.

I want to make a Mother 3 fan game, as it's one of my favourite games of all time and seems like fun practice for a top down RPG.

I downloaded a ripped sheet of Lucas, but the background is green, and also it's in one image.

Is there an easy way to split the sheet into multiple images, without any downloads? I'm using someone else's computer and I can't download anything.

It's a windows 7 computer, with like nothing but chrome

sentences:
Rendering with Direct3D I'm slightly confused about how Direct3D rendering works. Basically, as long as I render to one surface, everything is fine. But when I try rendering to multiple surfaces, it seems like everything is still rendered to one surface. I think there's something wrong with my calls.

For each update cycle this is what I do
1. device->BeginScene()
2. sprite->Begin(...)

...
A bunch of GetRenderTarget to store the old render target, then SetRenderTarget to set a new surface, and then things like CreateVertexBuffer, SetTexture, etc to draw on the new render target. Then resetting to the old render target.

sprite->Draw([the back buffer]) (the back buffer is actually another surface, not the actual back buffer. But here it is being drawn onto the actual back buffer, I think)
sprite->End()
device->EndScene()
device->Present(...)

Also, it seems like if I mix sprite drawing and non-sprite drawing onto a surface, that first one set of render commands is executed and then the other set, rather than in order by when each command was called.

If anyone could shed light on any of this, it would be much appreciated.

EDIT: To clarify, my render targets are mainly surface 0 of the texture created by D3DXCreateTexture or D3DXCreateTextureFromFileEx.

sentences:
Help for sorting cars that are 1 lap behind the others (latecomers) Think of 22 cars running in circuit.

I can sort them based on the order they reach the finish line.

I start to have problems, because over time, the faster cars start to reach the slower cars.

Making the cars slower latecomers/laggards/lapped (blue flag in F1).

Event (collision car with finish line):

other.position[other.collision]=pilot;
other.lap[other.collision]=timeLap;
other.timeTotal[other.collision]=timeTotal;
other.collision+=1;

if(other.collision>22){
    other.collision=1;
}

OBS - The collision event (shown above) is performed on the car. Every variable (other.) Is because it belongs to the finish line.

I use a variable that serves to define which array index will be defined (other.collision).

Draw Event (Finish Line):

repeat(22){
    draw_text(1280,100+(20*(i-1)),string(position[i]));
    draw_text(1430,100+(20*(i-1)),string(lap[i]));
    draw_text(1530,100+(20*(i-1)),string(timeTotal[i]));
    i+=1;
}

i=1;

What happens is that when the first car overcomes the last one, it ends up having the index 22. Becoming the last and vice versa.

I tried to use the time, but the faster car does more turns in less time. Time equals or does not work correctly. So I would also have to use the amount of laps.

That's when I got completely confused.

I am trying to use arrays to order them with the bubble sort, but I didn't get anything functional..

I tried a few more things, but I got lost and I don't even know how to explain it to you.

sentences: Using latest TiledMap, how do you get a specific tile from x and y index? Seems basic enough, but I can't seem to find the answer: I am trying to implement collission detecton and for that I need the properties of the tile the player is currently entering. I am using gdx.maps.tiles.TiledMap, which does not have a getCell(int x, int y) like the older TileMap had. Any help on this specific issue or just some general advice on how to do this will be much appreciated!

sentences:
Applying friction force not working correctly I have a simple physics simulation I'm creating whilst following the Nature of Code tutorials on YouTube by Daniel Shiffman, at the moment I've just started learning about friction and have had a go at implementing in it my project.

But for some reason, applying friction doesn't work when placed directly in the update method. To elaborate, when I apply friction by holding down the space bar rather than just doing it every frame, the friction works as instead.

Another thing to note is that when I apply friction directly in the update method, the objects don't appear on the screen.

Below is the loop I have that iterates through all the rigid bodies in the scene:

        foreach (var body in this.bodies)
        {
            Vector2 wind = new Vector2(0.01f, 0.0f);;
            Vector2 gravity = new Vector2(0.0f, 0.1f * body.Mass);

            // Setup friction
            float c = 0.05f;
            var friction = body.Velocity;
            friction *= -1;
            friction.Normalize();
            friction *= c;

            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                // If I move this call to where I'm applying
                // all the other forces, the objects dissappear.

                // But if I apply force by pressing the space bar
                // the force is applied correctly.

                // Apply friction
                body.ApplyForce(friction);
            }

            // If I apply friction out here, it doesn't work
            // also, friction when printed to the screen is
            // NaN.

            // Apply wind and gravity
            body.ApplyForce(wind);
            body.ApplyForce(gravity);

            body.Update();
        }

and also, here is the source code that I'm following along with (essentially copying) in the video tutorials here

I feel as though I've supplied enough information, but if you need to know anything else please don't hesitate to do ask.

sentences:
Time critical events based on framerate Problem Description

Basically, I've made a "programming game" in which I've made my own scripting language. It is a completely standard Lunar Lander game, though instead of directly controlling the lander using keyboard input, it instead fires a sequence of commands you have provided through the scripting language I made. This all works, and I've hit a critical problem.

So essentially, using the scripting language, you specify something like After 5 seconds, activate thrust for 10 seconds, and then after 2 seconds, rotate the lander for 4 seconds. The goal is then to chain together a sequence of commands which will get you to land the lander safely.

Of course, this comes with one problem. If you repeat the sequence of commands, each command will have to be fired at exactly the same spot in the level, that is, after x amount of seconds, but also with the lander being in the exact same spot. If you did not use timer-based movement, sure you could indicate that a command should activate after 5 seconds, but the lander moving at 60 FPS would have moved way further than a lander moving at 30 FPS.

Why of course, I thought I would simple just make the lander use timer-based movement so it is independent of FPS (I am using the very standard approach of taking the amount of time passed last frame, and multiplying it to a constant move speed). Then I would count seconds using the system clock. So the after x amount of seconds, the lander would be in the same spot in the level when the command activates.

Unfortunately, this approach do not work. Every time I run a sequence of commands, they will be activated with, sometimes very slight, variations, making it impossible to actually get a consistent and reliable path for the lander.

My Question

So my question is, am I tackling this problem a completely wrong way? What exactly do you do when it is absolutely critical that timed events defined by the user will activate at exactly the same time and spot in a level? I seem to be quite stuck with this question.

sentences:
How do you stop OgreBullet Capsule from falling over? I've just started implementing bullet into my Ogre project. I followed the install instructions here: http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1

And the rest if the tutorial here:
http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2

I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.

I need a way to fix the capsule to always stay upright, but I have no idea how

Below is the code I'm using.

(part of) Header File

OgreBulletDynamics::DynamicsWorld *mWorld;   // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *>         mBodies;
std::deque<OgreBulletCollisions::CollisionShape *>  mShapes;

OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;

Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;

main file

bool MinimalOgre::go(void)
{
    ...

     mCamera = mSceneMgr->createCamera("PlayerCam");
     mCamera->setPosition(Vector3(0,0,0));
     mCamera->lookAt(Vector3(0,0,300));
     mCamera->setNearClipDistance(5);
     mCameraMan = new OgreBites::SdkCameraMan(mCamera);

    OgreBulletCollisions::CollisionShape *Shape;
    Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
    OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
            "BasePlane",
            mWorld);
    defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
    // push the created objects to the deques
    mShapes.push_back(Shape);
    mBodies.push_back(defaultPlaneBody);

    character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));

    charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    charNode->attachObject(mCamera);
    charNode->setPosition(mCamera->getPosition());

    characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
    characterBody->setShape(   charNode,
                    character,
                    0.0f,         // dynamic body restitution
                    10.0f,         // dynamic body friction
                    10.0f,          // dynamic bodymass
                    Vector3(0,0,0),
                    Quaternion(0, 0, 1, 0));

    mShapes.push_back(character);
    mBodies.push_back(characterBody);

    ...
}

sentences:
Selected enemy off camera I'm facing a problem with a game I'm making.
Currently I can select an enemy and mark it as shown on the image:

But now I want to show the position of the selected enemy on the screen when it's off camera.
So my questions are:

How do I know when an enemy is off camera.
How can I show in GUI an arrow on the edge of the screen that points to the position of that enemy. Perhaps something related to what I did to point towards the crosshair?

Vector3 positionOnScreen = Camera.main.ScreenToWorldPoint(mousePos + Vector3.forward * range);
Vector3 targetDir = positionOnScreen - transform.position;

Thanks!

sentences:
How to change object curve path in playmode in Unity? I would like to make some sort of this simulation below, where user can interact with the white rod and drag it into the magnetic fields, which in resulting the blue line that represent the magnetic field of the permanent magnet to move in semi-circular motion.

I managed to get that kind of effect using animation

I wish I do not have to make an animation for it by manipulation path for the sphere to be automatically correcting it's own path after colliding with the round object since the sphere will suddenly moving faster than usual when colliding with much bigger round object.

I have tried using splines etc, but most tutorial I've seen are not editable in play mode, which is I cannot alter any of the curve values inside my script. So can anyone could provide me some insight or another better alternative than this? I've been stuck here for three days now.

Thanks!

EDIT:

sentences:
collisions: How to handle contact constraints for a rigidbody constrained to a line segment I'm trying to come up with a strategy to handle a situation in 2D, where a rigidbody moves along a straight line segment, and can collide with other similar bodies and also static tiles.

A naive approach was to handle collisions by projecting the displacement vectors onto the line segment (worked ok for aabb), and then at the end snap the position of the rigidbody back to the line, which had lots of conflicts.

I'm trying to implement impulse based physics, so far only handling contacts, and unsure how to both constrain the rigidbody to a line segment and handle contacts at the same time. Or is it better to do in two separate phases. It's probably easier to allow some displacement from the line and then gradually move the body back to it. Any suggestions?

sentences:
Why can't I use C routines to load files in Android NDK? I have successfully rendered a triangle with a hard coded shader using NativeActivity of Android NDK. Now I have the requirement to load a shader file. I tried to use fopen but it is returning NULL.

I have researched a little bit and found out there's an AAssetManager which I can use.  I want to know why fopen didn't work and why should I use AAssetManager to load files?

sentences:
How to animate abstract 2d top down water texture? I currently implement a game with a top down view of the ocean. I use the following, a little abstract texture:
The actual texture is transparent, I added the green-like color for clarity.
The problem I now have is, that I don't know how to animate this texture so the water looks nice. I tried to move the texture with a sin wave:  texture.y += sin(angle). Of course now the whole texture is moving which looks kind of unrealistic. The next thing I tried is to add another layer and implement a parallax effect. So that reflections under the water surface would also move, but much slower. It looks a little better but still not... nice enough.
I think the best looking animation would be, if the individual cells would expand and contract, kind of like a web or piece of cloth. Imagine if someone would slightly pull at one vertex of these cells and the neighbored cell would expand and the cell I pull towards to (or push to) would contract. Kind of like a web of springs(?). But I have no clue how to implement something like this:

Whats the math-model for this? Something with springs, where forces push/ pull?
And if so, how do I map this model to the given texture? Keeping all the curves and what not...

(I'm also open to different ideas/answers on how to animate the given texture.
Realism is not the point here, just some nice looking water like movements...)
Solution from DMGregory
I posted a libgdx example in this post: 2d water animation is jagged and not smooth (see answer about texture filtering)

sentences:
Beta testing of a prototype I have developed a prototype for a new game concept. The game is an educational foreign language learning tool for K-16 students.

I am at the point where I need to test with sample groups of students, but would like some guidance on the following:

Beta testing software: My game is a prototype, so I know it will have bugs. I'm more concerned with gathering metrics on how users enjoy the product, if they learn from it, what features were most valuable to them, what features they could do without, and what features they were looking for. I'm not sure if a Bug Tracker is the way to go, but is there something else that can capture user feedback in this way?
For an educational prototype with a target demographic, what aspects should I be looking to test (software-wise, I realize I haven't given much context as to what the game is about or what it is trying to teach)? How should the tests be conducted to be the most efficient/effective? I realize this is a tad subjective, so I'm looking for the most objective methodologies for early beta tests, if any exist.

As far as software, http://www.centercode.com/ was recommended. After going through their tutorial teaser, their tool looks comprehensive with bug reporting, suggestions, dashboards, etc, but also they mention connecting and sending bugs off to their dev teams to fix.

At $499/mo, I'm wondering if it's sensible to use a tool like that if I am the sole developer, or for round 1 testing I should just create some ad hoc feedback collection tools?

Any other pointers would be extremely appreciated.

sentences:
How can I pass an enum value to the OnClick method of a button? I am making a UI system for my game where I want to use an enum to define different UI modes. But OnClick function on button doesn't show method which receive enums.

I heard I can pass an integer value to OnClick method and then somehow transform it into an enum. What can I do about it?

sentences: Game free publishing website? I am making game that will be completely free and I want to publish it. The publishing platform have to be free and it can be done without any contract or specific license. I simply upload my files make my game page and that’s all. Thanks for help, Maratonec.

sentences:
Tweaking screen transitions not to fire every time in Unity I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one).

This is cool and all but poses two problems - firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place.
How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene? Maybe there's some way to pass some kind of a parameter when loading a new scene that I'm not aware of? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts?

sentences:
One big spritesheet vs many smaller spritesheets? I have my 2D character animations which are stored in spritesheets. I have individual sprite sheet for every animation. For example, if my character have animations for idle, run and jump, I have 3 different spritesheets.

Is it good way for managing 2D animations or it's better to store all animations in one big spritesheet? I noticed that many old games animations are stored in one big spritesheet - is it the best way?

sentences:
3D zooming technique to maintain the relative position of an object on screen Is it possible to zoom to a certain point on screen by modifying the field of view and rotating the view of the camera as to keep that point/object in the same place on screen while zooming ? Changing the camera position is not allowed.

I projected the 3D pos of the object on screen and remembered it.

Then on each frame I calculate the direction to it in camera space and then I construct a rotation matrix to align this direction to Z axis (in cam space).

After this, I calculate the direction from the camera to the object in world space and transform this vector with the matrix I obtained earlier and then use this final vector as the camera's new direction.

And it's actually "kinda working", the problem is that it is more/less off than the camera's rotation before starting to zoom depending on the area you are trying to zoom in (larger error on edges/corners).

It looks acceptable, but I'm not settling for only this. Any suggestions/resources for doing this technique perfectly? If some of you want to explain the math in detail, be my guest, I can understand these things well.

sentences:
Understanding how OpenGL blending works I am attempting to understand how OpenGL (ES) blending works. I am finding it difficult to understand the documentation and how the results of glBlendFunc and glBlendEquation effect the final pixel that is written.

Do the source and destination out of glBlendFunc get added together with GL_FUNC_ADD by default?

This seems wrong because "basic" blending of GL_ONE, GL_ONE would output 2,2,2,2 then (Source giving 1,1,1,1 and dest giving 1,1,1,1).

I have written the following pseudo-code, what have I got wrong?

struct colour {
    float r, g, b, a;
};

colour blend_factor( GLenum factor,
    colour source,
    colour destination,
    colour blend_colour ) {

    colour colour_factor;
    float i = min( source.a, 1 - destination.a );

    // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendFunc.xml
    switch( factor ) {
        case GL_ZERO: colour_factor = { 0, 0, 0, 0 }; break;
        case GL_ONE: colour_factor = { 1, 1, 1, 1 }; break;
        case GL_SRC_COLOR: colour_factor = source; break;
        case GL_ONE_MINUS_SRC_COLOR: colour_factor = { 1 - source.r, 1 - source.g, 1 - source.b, 1 - source.a }; break;
        // ...
    }

    return colour_factor;
}

colour blend( colour & source,
    colour destination,
    GLenum source_factor, // from glBlendFunc
    GLenum destination_factor, // from glBlendFunc
    colour blend_colour, // from glBlendColor
    GLenum blend_equation // from glBlendEquation
    ) {

    colour source_colour = blend_factor( source_factor, source, destination, blend_colour );
    colour destination_colour = blend_factor( destination_factor, source, destination, blend_colour );
    colour output;

    // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendEquation.xml
    switch( blend_equation ) {
        case GL_FUNC_ADD: output = add( mul( source, source_colour ), mul( destination, destination_colour ) );
        case GL_FUNC_SUBTRACT: output = sub( mul( source, source_colour ), mul( destination, destination_colour ) );
        case GL_FUNC_REVERSE_SUBTRACT: output = sub( mul( destination, destination_colour ), mul( source, source_colour ) );
    }

    return output;
}

void do_pixel() {

    colour final_colour;

    // Blending
    if( enable_blending ) {

        final_colour = blend( current_colour_output, framebuffer[ pixel ], ... );
    } else {

        final_colour = current_colour_output;
    }

}

Thanks!

sentences:
Finding holes in mesh I have a mesh that has holes. I found a paper, An Automatic Hole-Filling Algorithm for Polygon Meshes

It details an algorithm that uses a k-d tree for finding holes (from a manifold triangle mesh). The steps are as follows:

  Step1: Compute the center of each triangle and the correspondences between the center and three vertexes of the triangle;

  Step2: Set up the Kd-tree according the centers of triangles;

  Step3: Search the Kd-tree and check up the topological connectivity of the corresponding edges, and find the
  boundary edges;

  Step4: Distinguish the different boundary loops according to the topological connectivity of vertexes;

I do not not understand how this algorithm actually finds the hole, can some please explain this in Layman's terms so that I can implement it --- I know there are probably better way out there of finding holes but I need to understand this particular algorithm.

Please help

sentences:
Implementing a hook (Like pudge in Dota) I'm coding a new game, which involves hooking.

Ive been testing a couple of ideas now and im quite stuck.

The player can throw a "hook" which fires away in the aimed direction, until it hits something, it will bounce on some obstacles and will return to the player if hitting other obstacles. While the hook is in the air, the player can move as he/she wishes, and hook will after a certain time be pulled back to the player.

I don't know if you guys have played pudge wars, but that is the kinda hook I'm after.

What do you think is the best approach in simulating this?

Should i save points a long the way?

Edit: Yes the bounce thing is a from pudge wars.
And yes the length, not time, that is true!

sentences:
Simulating a sine wave/oscillating pattern for enemies I'm creating a simple top down shooter, right now I have an enemy which simply follows the player. I'd like to change things up and have the enemies move towards the player but in a wave like motion. I have looked at some similar questions like this but they don't take into account for the Y changing. How can I simulate a wave like pattern for my enemies whilst they are homing into their target.

Edit:

Sample code

In my update method I have the following:

            Vector2 trackingPos = position - target;
            trackingPos.Normalize();
            position -= trackingPos * elaspedTime  * speed;

sentences:
How to force play area corners to Lighthouses in Unity I'm working for a guy that wants to recreate real environments in VR and superpose them for business demos. Think of one of those mall kiosks where you "enter virtual reality" and at first it looks exactly the same as regular reality until you start interacting with objects and the virtual elements start being superposed. Basically, AR in VR.

To do this, I have an exact model of the kiosk, but I need to be able to force the play area in vive and unity to be always the same and equal to the dimensions of the real space, so that my model can superpose the actual world objects. Is there a way to force the play area to be the same as the distance between the lighthouses?

Additionally, is there a way to force the lighthouses to never recalibrate after the initial setup(as it does when someone moves in front of them for example)?

sentences: Can i use art from another videogame as base for my art? For example: if I take the 3d models and textures from GTA: San Andreas and I modify them making better models and textures, can i use this new art to make a game with a different gameplay and sell it without infringing the game's copyright?

sentences:
Excluding some scene elements from bloom effect I've enabled HDR and bloom effects in my SceneKit app, but I don't want some of the elements in my scene to bloom.

For example, the lighter spots on the skybox are currently glowing.

Is there some way I can stop those elements from glowing selectively?

sentences:
Creating an electricity/lighting/tesla coil effect in a 2D XNA game? I'd like to create beams of electricity between two points very similar to this video: http://www.youtube.com/watch?v=eMJ8-56L3Lc. The effect is so dynamic, with varying lengths and pseudo-random movement in-between the points, that I'm having trouble imagining how I'd accomplish such a thing. Is there any helpful information that might point me in the right direction?

I should note that I'm using the XNA 4.0 Reach profile, but custom shaders are okay because I'm not targeting the Windows Phone.

sentences: How to make one solid object in Maya? How can I "glue" more objects to each other so I get one object? (It is for resizing models), couldn't find anything about it on the internet, but I'm dutch, so maybe that's why. Thank you very much!

sentences:
Using Lerp to zoom in on an object inside an if statement I'm trying to zoom in on an object once the raycast hits it in the Update method, I am using the Lerp method to make the camera movement smoother but it's not working properly. The object only lerps for a single frame.

I also tried using a coroutine but the result is still the same. I can't simply just place it outside the if statement because I only need to change the field of view once the raycast hits an object.

Here's a sample of my code :

if (Input.GetMouseButtonDown(0))
        {
            ray = mainCam.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {

                if (hit.collider.tag.Equals("Building"))
                {

                    SetTarget(hit);
                    mainCam.fieldOfView = Mathf.Lerp(mainCam.fieldOfView, newFOV, Time.deltaTime * smooth);
                }
            }
         }

sentences:
Getting world coordinates from mouse position I am drawing a 2D mesh imported from CAD. The mesh vertex coordinates are in feet from some arbitrary origin and Z is always 0. I am supplying the coordinates to my shader program and using projection matrix, view matrix and model matrix to display everything. I am also using the view matrix and the model matrix to pan and zoom my 2D scene. I am trying to get the coordinates in feet from my mouse cursor coordinates. Should be a straightforward solution. A matrix multiplied by it's inverse will give you an identity matrix but something is very wrong. Here is my code (don't lough at the vb, I took over an old project):

Private Sub openGLControl1_MouseMove(sender As Object, e As MouseEventArgs) Handles openGLControl1.MouseMove
    Dim UnprojectMat As mat4 = glm.inverse(scene.projectionMatrix * scene.viewMatrix * scene.modelMatrix)
    Dim wCoordsVec As vec4 = UnprojectMat * New vec4(2 * e.X / openGLControl1.Width - 1, -(2 * e.Y / openGLControl1.Height - 1), 0, 1)
    wCoordsVec = wCoordsVec / wCoordsVec.w
    wCoordsLabel.Text = wCoordsVec.x.ToString + ", " + wCoordsVec.y.ToString
End Sub

And this is my vertex shader:

#version 150

in vec3 in_Position;

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;

void main(void) {
    gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(in_Position, 1.0);
//pass_Color = in_Color;

}

The in_Position vector is what I'm trying to get.
As you see, I normalized the mouse coordinates for the -1, 1 coordinate system. I don't have a viewport. I'm just using the entire gl control window. Please help me pinpoint what I'm doing wrong.

sentences:
How can a team work together to assemble a large world map? I recently played a open world FPS game with a large and dense game world, in a single map like this.

It contains many objects, roads, rivers, trees, houses, rocks, hidden places, NPCs, etc... all carefully placed relative to each other. The game was made in two years (which is pretty fast regarding the content).

How can a team work at the same time on such a huge map?

3D models and textures can have been done separately and in parallel as I understand. The question is about how to put all this content on the map and model the map itself (lowering or raising some parts since it is a huge heightmap).

Several things solutions I have in mind:

The map could be divided into big chunks, with each person (or small team) working on a small part. Then (at the end) everything is reassembled. I seriously doubt this, because of the map topology. Or maybe the height of the map was fixed first (no more change possible after some point), then map cut in squares, then reassembled (which would work because height was not changed).
Developers created a multi user editor where it is possible to connect to a server (using LAN) then any change in editor would be directly visible and propagated to other editors connected to the same server. Something like Minecraft.

How can this be done? Has anybody worked on a similar game?

sentences:
How do I create a server for an existing game I don't have the source for? I was wondering if it is possible to create a dedicated game server for a game that already exists and you don't have access to. For example, a game on Steam that only allows multiplayer through hosting a game with your running client. A client can host a server but only while the hoster is also playing the game.

The question being, is it possible to write a server from scratch that can replace the game client host with a dedicated server that does not require a player hosting it? If so, how?

sentences:
How do I convert a partially transparent image into polygons? I'm using GLEE2D, a level editor allowing me to import images, scale them, rotate them, and position them onto layers and export the data into XML format. However, it does not tell me objects' boundaries. I can calculate them, but only given the original image's polygons.

How do I get polygons of objects in a transparent image?

An example object (I outlined it):

How would I turn the object, knowing the scaled size of the image, into polygons? Is there an algorithm for this? I'll use OpenGL to draw them.

sentences:
Issues using NetworkServer.Spawn with Unity and Mirror-Networking I am using Mirror to handle the networking aspect

When I spawn an object on the network, I Instantiate it on the server and then use NetworkServer.Spawn to notify all clients to spawn the object.

However, when this object is eventually spawned on the client side, it seems to be spawned at the wrong position for a few seconds and then corrected itself and move to the correct position as is reflected by the server. Is there something I am not doing? Is this normal?

Also I noticed if I changed the Network Sync Mode to 0, then it will only spawn in the wrong spot for a split second.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;

public class EnemySpawner : NetworkBehaviour
{
    public uint theId;
    public int maxNumEnemies;
    public int spawnDelay;
    public GameObject enemyToSpawn;
    float curSpawnTime;
    BoxCollider2D boxColl;
    // Start is called before the first frame update
    public override void OnStartServer()
    {
        curSpawnTime = spawnDelay;
        boxColl = GetComponent<BoxCollider2D>();
    }

    void Start()
    {
        if (!isServer) return;
        theId = netId;
    }

    // Update is called once per frame
    void Update()
    {
        if (!isServer) return;
        if (transform.childCount < maxNumEnemies && curSpawnTime <= 0.0f)
        {
            Vector2 spawnPoint = new Vector2(Random.Range(boxColl.bounds.min.x, boxColl.bounds.max.x),Random.Range(boxColl.bounds.min.y, boxColl.bounds.max.y));
            curSpawnTime = spawnDelay;
            SpawnEnemies(spawnPoint,netId);
        } else
        {
            curSpawnTime -= Time.deltaTime;
        }
    }

    [Server]
    void SpawnEnemies(Vector2 spawnPoint, uint theId)
    {
        GameObject gobj = Instantiate(enemyToSpawn, new Vector2(60.7f,1.3f), Quaternion.identity);
        gobj.GetComponent<EnemyController>().parentNetId = netId;
        NetworkServer.Spawn(gobj);
    }
}

The way I've organized things, in the hierarchy I have:

Enemies
   Area1
      Spider(Clone)
      Spider(Clone)

Area1 has the EnemySpawner script.  The spider is registered a spawnable prefab.
Both Area1 and the Spider have a NetworkIdentity with no boxes checked.
Additionally, the Spider has a NetworkTransform and NetworkAnimator.

sentences:
why the camera won't rotate around my object? im new to unity scripting, and now am building upon "Roll a Ball" example in unity training. I wanted to make the camera rotate around the ball in the scene in Y axis, when mouse is moved, and watched some tutorials on it, and eventually wrote the code below. but it doesn't rotate around the ball. instead it does a simple rotate in place. camera still moves with the ball though.
what am i doing wrong?

public class CameraController : MonoBehaviour {

    public GameObject Player;
    private Vector3 offset;

    public float moveSpeed;
    private Vector3 point;

    void Start () {
        offset = transform.position - Player.transform.position;

        point = Player.transform.position;
        transform.LookAt(point);
    }

    void Update()
    {
        float mouseMovement = Input.GetAxis("Mouse X");

        transform.RotateAround(point, new Vector3(0f, mouseMovement, 0f) , moveSpeed * Time.deltaTime);
    }

    void LateUpdate()
    {
        transform.position = Player.transform.position + offset;

    }
}

sentences:
Splitting an object into two I'm using Farseer physics engine.

I have a simple rectangle body and would like it to split into two pieces given a starting coordinate (where the bullet enters the object) and ending coordinate (where it exits).

sentences: How to play animations in Cocos2d-x? I'm new to Cocos2d-x and looking for a good way/tutorial on how to play animations in Cocos2d-x.

sentences:
How to know if a model is composed of a group of models? I've downloaded a model, and try to ungroup the model and learn how this model was made. However, the big model in the image below can not be ungrouped anymore.

I feel that this model is composed of a group of models, but I cannot ungroup this model and unlink it. Is there other methods to test if this model is a model or a group of models?

Thanks in advance.

  Full Size: http://i.stack.imgur.com/VF2SM.png

sentences:
Libgdx/Box2D PolygonShape has no position... well, what now? As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body.

So for Box2D I figured I'd need multiple fixtures, like one for the legs, one for the torso and one for the head.

Each of these fixtures will get a different sprite/texture that should be swappable dynamically if the player puts on some armour or changes cloths etc.

Until now the player-character consisted of a Box2D Body with just one single fixture.
I added the sprite like this:

   body.setUserData(this.sprite);

I rendered it like this:

 // Draw-method
  if(body.getUserData() != null && body.getUserData() instanceof Sprite) {
      Sprite sprite = (Sprite) body.getUserData();
      sprite.setPosition(body.getPosition().x - sprite.getWidth() / 2, body.getPosition().y - sprite.getHeight() / 2);
      sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
      sprite.draw(spriteBatch);
  }

Now that I want to have multiple sprites for different "regions" of the body I figured it's better to add them to the fixture itself. For now I just wanted to reproduce what I already had, so just the one sprite I have to the one fixture I have right now instead of the body.

I do this like that:

Fixture fixture = body.createFixture(fixtureDef);

My problem arises when trying to render this.

for(Fixture fixture : body.getFixtureList())
{
    if(fixture.getUserData() != null && fixture.getUserData() instanceof Sprite)
    {
        Sprite sprite = (Sprite) fixture.getUserData();
        //sprite.setPosition(fixture.getShape().getPosition() ... // Not gonna work, because PolygonShape has no position! :(
        sprite.draw(spriteBatch);
    }
}

As you can read in the comment, the fixture for now has a rectangular shape which is made like:

shape = new PolygonShape();
shape.setAsBox(widthInMeters / 2, heightInMeters / 2);

The problem is, that a PolygonShape has not position :/ Now when I render this, the sprite is not being drawn at the fixtures position and currently I really have no idea how to fix that.

I'd highly appreciate any help you can give me! Thanks in advance and have a wonderful day! :)

sentences:
How do you simulate UV light and materials with UV-reflective/fluorescent properties within a PBR renderer? I have a PBR setup, say, in Unity (or Unreal, doesn't really matter, I'm asking about the general principle, not specific implementation), and I would like to add a UV light source, and have control over how my materials respond to it, but still ideally have it conform to the rules of physically-based rendering.
Question is: what do I need to extend with what kinds of properties, and what are the equations to wire them together, and where do I plug those?
Do I need to actually do modifications like this, or does the fact that it already is PBR mean that I only need to plop in a light source with correct combination of settings, and correct responses to that UV source just naturally happen?
Edit:
I am asking about fluorescence, where I want certain materials to glow in particular visible light colours in places where the invisible UV light hits them.

sentences:
AI controlled monster vs player controlled monster stats Does anyone know if in a pokemon game does the wild pokemon have the same stats when you catch it as it did in that battle?

and to make this a more programming question ... In that type of game should the "wild" enemies have the same limits imposed on them as if they were player controlled or should the enemies be stronger that if you caught them.

This question assumes that the creature is the same level in both cases.

sentences:
Identify shading language in Trove I'm playing this voxel game named Trove, running it in DirectX, their requirements are DirectX 10 and OpenGL 3.2

The character entity in this game emits light when it gets close to any surfaces (walls, floor, etc). I am assuming that they codded that into these shaders unified files.

I want to put this light on like the smallest value or remove it completely as a personal mod for myself. (the game is very modable, another guy edited these files are moved the glare and the fog, I am interested in doing that too, since a patch came and broke his mod)

So, I was wondering what shading language is that, so that I can look up and learn the right thing to make this work in the end.

This game is free to play on steam.

I've extracted the game files and they have this folder called shadersunified and I've uploaded all the content at indexed shadersunified folder

I am completely new to this kind of modding, I have absolutely no knowledge, but I do know programming like C++, C#, Pawn, Java, Javascript.

I need some directions toward what this game uses so that I know what to look into :D . Or if any of you can do these changes, I would love that even more.

sentences:
Spawning prefab when other prefab appears Im trying to make a bottle spawn when it is broken.

This is the code that makes that:

public class romperobjetos : MonoBehaviour {

public GameObject BrokenBottle;
public float breakVelocity = 5f;
public GameObject NoBrokenBottle;
public bool rompible = false;
public Vector3 oldPosition;
public Quaternion oldRotation;
public bool botellarota = false;

public void Start()
{

}

// Use this for initialization
public  void Update()
{
    Debug.Log(NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude);
    if (NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude > breakVelocity)
    {
        rompible = true;
    }
    else
    {
        rompible = false;
    }

}
public void OnTriggerEnter(Collider other)
{
    if ((other.gameObject.name == "Plane") && (rompible))
    {
        oldPosition = NoBrokenBottle.transform.position;
        oldRotation = NoBrokenBottle.transform.rotation;
        Debug.Log("vamos bien");
        BreakBox();
    }
}
public void BreakBox()
{
    Instantiate(BrokenBottle, oldPosition, oldRotation);
    Debug.Log("se rompe");

        NoBrokenBottle.SetActive(false);
        botellarota = !botellarota;
}

}

The broken bottle prefab has a boolean variable that is true when it appears, but the unbroken bottle doesn't instantiate. This is the script for the spawn:

public class SpawnBotellas : MonoBehaviour {

public Transform[] spawnPoints;
public GameObject[] whatToSpawnPrefab;
public GameObject[] whatToSpawnClone;
public bool botella1rota = false;
// Use this for initialization
void SpawnAlgo()
{
    whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(0, 0, 0));
}
 void Update()
{
    //botella1
    if (GameObject.Find("alidobas blanco roto").GetComponent<alidobasrota>().alidobasblanco)
    {
        Debug.Log("asdkj");
      //  whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(90, 0, 0)) as GameObject;
    }

Sorry for my bad English and thanks.

sentences:
Problem restoring the game preffered buffer size after navigating from a XAML page. Monogame I have implemented to my game a simple leaderboard and submit score pages, which are pages in XAML. I used PreferredBackBufferHeight/Width to set the buffer to be equaly on all devices, whether their screen size is 5 inch, 4.7 or whatever size. Though I thought the problem was solved, now, when I was testing my game on emulator for bigger devices, I encountered a problem when returning back to game page from the xaml page. Let me show you some pics, and you will understand what I am talking about:

Testing on Emulator 4.7 inch:

1) Before entering the leaderboard xaml page (everything normal):

2) After exiting from xaml leaderboard page:

Even if I tried to put the PreferredBackBufferHeight/Width in the function that I call to exit from the leaderboard page, it didn't change anything... :

private void NavigateBackToMain()
    {
        var app = App.Current as App;

        if (app.GamePage == null) app.GamePage = new GamePage(string.Empty);
        Game1.statics.graphics.SupportedOrientations = Microsoft.Xna.Framework.DisplayOrientation.LandscapeRight | Microsoft.Xna.Framework.DisplayOrientation.LandscapeLeft;
        Game1.statics.graphics.PreferredBackBufferHeight = Constants.PrefferedBufferHeight;
        Game1.statics.graphics.PreferredBackBufferWidth = Constants.PrefferedBufferWidth;

        Window.Current.Content = app.GamePage;
    }

What can I do about my problem?

sentences:
How to emulate knob turning, based on x/y movement? I'm doing a game where one component is that you turn a knob.  I'm having trouble getting good "knob behavior".

I know the current touch/mouse X,Y location, and I keep track of the previous X,Y location, so I can determine if I'm going left or right and/or up or down.

It works, but it's crude.  I suspect I have to take an average of any given direction over a period of time (say, last quarter second) to eliminate jitter because people don't move uniformly in the same movement every moment.

I can't really use touchdown/release because you should be able to put the touch down, then move left/right up/down continuously without release, and the knob would turn, just as if you had a free-spinning audio control or video shuttle (say).

Any thoughts in this direction on how to even it out?

sentences: How To Disable A Select Collider I have a character with 2 2D Colliders, one for the head, and one for the feet, How do I Disable only the Head Collider in C#.

sentences:
How to achieve a Neon-Light effect? I'm wondering how to achieve a neon-light type effect. For example, in Pac-Man Chamipnship Edition:

Or in Geometry Wars:

Is that a Bloom Effect? Or what techniques would I have to look for?

sentences:
Lockstep dealing with lag I understand how properly connected clients in a lockstep model deal with lag but what about the lagger? How does the lagger know that he or she is lagging? Should I continuously ping the central server?

Also, as the game follows the lockstep model, how does the lagger sync if he needs to? Should the desync be altogether prevented by fast pinging?

sentences:
Trying to implement Camera I'm trying to implement a Camera class in order to walk and look on the world as follow:

#ifndef _CAMERA_H_
#define _CAMERA_H_

#include <glm\glm.hpp>

class Camera
{
public:
    Camera();
    ~Camera();

    void Update(const glm::vec2& newXY);
    //if by = 0.0 it means, it will use the const Class speed to scale it
    void MoveForward(const float by = 0.0f);
    void MoveBackword(const float by = 0.0f);
    void MoveLef(const float by = 0.0f);
    void MoveRight(const float by = 0.0f);
    void MoveUp(const float by = 0.0f);
    void MoveDown(const float by = 0.0f);
    void Speed(const float speed = 0.0f);

    glm::vec3& GetCurrentPosition();
    glm::vec3& GetCurrentDirection();
    glm::mat4 GetWorldToView() const;
private:
    glm::vec3 position, viewDirection, strafeDir;
    glm::vec2 oldYX;

    float speed;
    const glm::vec3 up;
};

#endif

#include "Camera.h"
#include <glm\gtx\transform.hpp>

Camera::Camera()
    :up(0.0f, 1.0f, 0.0), viewDirection(0.0f, 0.0f, -1.0f),
    speed(0.1f)
{
}

Camera::~Camera()
{
}

void Camera::Update(const glm::vec2& newXY)
{
    glm::vec2 delta = newXY - oldYX;
    auto length = glm::length(delta);
    if (glm::length(delta) < 50.f)
    {
        strafeDir = glm::cross(viewDirection, up);
        glm::mat4 rotation = glm::rotate(-delta.x * speed, up) *
            glm::rotate(-delta.y * speed, strafeDir);

        viewDirection = glm::mat3(rotation) * viewDirection;
    }

    oldYX = newXY;
}

void Camera::Speed(const float speed)
{
    this->speed = speed;
}

void Camera::MoveForward(const float by)
{
    float s = by == 0.0f ? speed : by;

    position += s * viewDirection;
}
void Camera::MoveBackword(const float by)
{
    float s = by == 0.0f ? speed : by;

    position += -s * viewDirection;
}
void Camera::MoveLef(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * strafeDir;
}
void Camera::MoveRight(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * strafeDir;
}
void Camera::MoveUp(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += s * up;
}
void Camera::MoveDown(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * up;
}

glm::vec3& Camera::GetCurrentPosition()
{
    return position;
}
glm::vec3& Camera::GetCurrentDirection()
{
    return viewDirection;
}

glm::mat4 Camera::GetWorldToView() const
{
    return glm::lookAt(position, position + viewDirection, up);
}

and I update and render as follow :

void Game::OnUpdate()
{
    glLoadIdentity();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glUniformMatrix4fv(program->GetUniformLocation("modelToViewWorld"), 1, GL_FALSE, &cam.GetWorldToView()[0][0]);

}

void Game::OnRender()
{

    model->Draw();

}

Which the Vertix shader is:

#version 410

layout (location = 0) in vec3 inVertex;
layout (location = 1) in vec2 inTexture;
layout (location = 2) in vec3 inNormal;

uniform mat4 modelToViewWorld;

void main()
{
        gl_Position    = vec4(mat3(modelToViewWorld) * inVertex, 1);

}

But in result the model itslef is moving/rotating instead of moving the camera around the model. What am I doing wrong here?

sentences: building timers in strategy games I've got a web-based strategy game in which you build a city. Coding is smooth, but I'm kind of hung up on how long it takes my buildings to build. I want to keep the user playing, but have them long enough to keep them having to come back to the game. I've currently got it where each building has a base build rate that is exponentially increased by the building's level. I can adjust the times by changing the base build rate, but I was wondering if there is a better, or perhaps more widely-accepted way of doing this. I worry that a 113 day build on a level 10 building before reaching the next city level where the user has to start over will discourage further playing.

sentences:
Bullet Physics Simulation Running Slow I'm in the process of converting my game engine from java which used the LWJGL and JBullet to c++. However, when I was implementing Bullet physics my simple simulation of a box dropping from specified height onto a plane ran very slowly.

After scouring the forms I came across two possible solutions:

Compiling my simulation in release mode rather than debug.
Enabling compiler optimizations for speed.

After building in release and enabling the compiler optimizations my simulation still runs at the same speed. I've tested the FPS which usually runs between 400-350fps and that the simulations was stepped each frame. I can't find anyone that has had the same problem as me and I can't understand why JBullet which is a java port of the Bullet Physics Library runs fine on the same PC. Any help would be much appreciated. Thanks!

sentences:
XNA 2D Board game - trouble with the cursor I just have started making a simple 2D board game using XNA, but I got stuck at the movement of the cursor.

This is my problem:

I have a 10x10 table on with I should use a cursor to navigate. I simply made that table with the spriteBatch.Draw() function because I couldn't do it on another way.

So here is what I did with the cursor:

public override void LoadContent()
{
    ...
    mutato.Position = new Vector2(X, Y); //X=103, Y=107;
    mutato.Sebesseg = 45;
    ...
    mutato.Initialize(content.Load<Texture2D>("cursor"),mutato.Position,mutato.Sebesseg);
    ...
}

public override void HandleInput(InputState input)
{
    if (input == null)
        throw new ArgumentNullException("input");

    // Look up inputs for the active player profile.
    int playerIndex = (int)ControllingPlayer.Value;

    KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];

    if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)
    {
        ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
    }
    else
    {
        // Otherwise move the player position.
        if (keyboardState.IsKeyDown(Keys.Down))
        {
             Y = (int)mutato.Position.Y + mutato.Move;
        }
        if (keyboardState.IsKeyDown(Keys.Up))
        {
            Y = (int)mutato.Position.Y - mutato.Move;
        }
        if (keyboardState.IsKeyDown(Keys.Left))
        {
              X = (int)mutato.Position.X - mutato.Move;
        }
        if (keyboardState.IsKeyDown(Keys.Right))
        {
             X = (int)mutato.Position.X + mutato.Move;
        }
    }
}

public override void Draw(GameTime gameTime)
{
    mutato.Draw(spriteBatch);
}

Here's the cursor's (mutato) class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Battleship.Components
{
    class Cursor
    {
        public Texture2D Cursortexture;
        public Vector2 Position;
        public int Move;

        public void Initialize(Texture2D texture, Vector2 position,int move)
        {
            Cursortexture = texture;
            Position = position;
            Move = move;
        }

        public void Update()
        {
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Cursortexture, Position, Color.White);
        }
    }
}

And here is a part of the InputState class where I think I should change something:

public bool IsNewKeyPress(Keys key, PlayerIndex? controllingPlayer,
                                       out PlayerIndex playerIndex)
{
     if (controllingPlayer.HasValue)
     {
           // Read input from the specified player.
           playerIndex = controllingPlayer.Value;

           int i = (int)playerIndex;

           return (CurrentKeyboardStates[i].IsKeyDown(key) &&
                   LastKeyboardStates[i].IsKeyUp(key));
     }
}

If I leave the movement operation like this it doesn't have any sense:

X = (int)mutato.Position.X - mutato.Move;

However if I modify it to this:

X = (int)mutato.Position.X--;

it moves smoothly. Instead of this I need to move the cursor by fields (45 pixels), but I don't have any idea how to manage it.

sentences:
Polygon/Shape definition changes in Box2D 2.1 I was going through a pretty good tutorial on Box2D here, but I ran into a problem when he made a b2PolygonDef, because the tutorials were made in 2.0, and I'm using 2.1. I could download 2.0 I guess, but I'd really like to know how to update how to do this to the newest version.

If you guys don't want to watch the whole video, basically, he does this in this one:

        private function createWallsAndFloor():void
    {
        // Create the shape (polygon) definition
        var bigLongShapeDef:b2PolygonDef = new b2Polygondef();
        bigLongShapeDef.vertexCount = 4;
        b2Vec2(bigLongShapeDef.vertices[0]).Set(0 / RATIO, 0 / RATIO);
        b2Vec2(bigLongShapeDef.vertices[1]).Set(550 / RATIO, 0 / RATIO);
        b2Vec2(bigLongShapeDef.vertices[2]).Set(550 / RATIO, 10 / RATIO);
        b2Vec2(bigLongShapeDef.vertices[3]).Set(0 / RATIO, 10 / RATIO);
        bigLongShapeDef.friction = 0.5;
        bigLongShapeDef.restitution = 0.3;
        bigLongShapeDef.density = 0.0;

        // Create the body definition
        // Create the body
        // Create the shape
    }

I can see that they removed b2PolygonDef and b2ShapeDef because I'm using Flash Develop, so what basically do I do?

(If you don't mind watching videos, he explains what he's doing in the one before this one.)

sentences:
What edition of VS is installed by Unity and what are its capabilities? My brother just installed Unity on my desktop, and it seems like it installed Visual Studio 2017 as well.

I was planning to install Visual Studio before this, so I was wondering what kind of version is this edition of VS? Is this like a bare-bones version? Does it work like a standalone version without lacking features? Can I use it just as a regular IDE to program in?

I typically program in C++, and I never used Unity before, so I'm not sure if this version of VS is only suited for Unity.

sentences:
Pass and Change Objects Between Scenes in Unity I ran into a bit of a problem with organasing object changes as well as storing them and passing to scenes.
By that, I mean that I'm programming a game that has different characters and possibility to customize them as well as their equipment and weapons. It's gonna be a multiplayer game...so, the question is what's the BEST practice of storing and passing customized characters with weapons between scenes and via network connection?

Similarly to Rainbow Six Siege, where all your custom stuff is saved on a user and passed both in single and multiplayer modes into a level.

Just need some refs, tips or maybe articles on the matter. No code needed.
Thanks in advance!

sentences: How to apply a texture to an object by face rather than the entire object? (unreal 4) I am trying to apply different textures to a model I have by face rather than the entire object. I am only able to add one material to the entire object. How can I apply different textures to different faces of my model separately? I imported my model from blender. For reference, I have a detailed building with a roof, windows, etc. that is all one object and I would like to texture different parts of the building with different megascans separately. Would appreciate any advise.

sentences:
Finding Z given X & Y coordinates on terrain? I need to know the most efficient way of finding Z given X & Y coordinates on terrain. My terrain is set up as a grid, each grid block consisting of two triangles which may be flipped in any direction. I want to move game objects smoothly along the floor of the terrain without "stepping." I'm currently using the following method with unexpected results:

double mapClass::getZ(double x, double y)
{
    int vertexIndex = ((floor(y))*width*2)+((floor(x))*2);

    vec3ray ray = {glm::vec3(x, y, 2), glm::vec3(x, y, 0)};

    vec3triangle tri1 = {   glmFrom(vertices[vertexIndex].v1),
                            glmFrom(vertices[vertexIndex].v2),
                            glmFrom(vertices[vertexIndex].v3)   };

    vec3triangle tri2 = {   glmFrom(vertices[vertexIndex+1].v1),
                            glmFrom(vertices[vertexIndex+1].v2),
                            glmFrom(vertices[vertexIndex+1].v3) };

    glm::vec3 intersect;

    if (!intersectRayTriangle(tri1, ray, intersect))
    {
        intersectRayTriangle(tri2, ray, intersect);
    }

    return intersect.z;
}

intersectRayTriangle() and glmFrom() are as follows:

bool intersectRayTriangle(vec3triangle tri, vec3ray ray, glm::vec3 &worldIntersect)
{
    glm::vec3 barycentricIntersect;

    if (glm::intersectLineTriangle(ray.origin, ray.direction, tri.p0, tri.p1, tri.p2, barycentricIntersect))
    {
         // Convert barycentric to world coordinates
        double u, v, w;
        u = barycentricIntersect.x;
        v = barycentricIntersect.y;
        w = 1 - (u+v);

        worldIntersect.x = (u * tri.p0.x + v * tri.p1.x + w * tri.p2.x);
        worldIntersect.y = (u * tri.p0.y + v * tri.p1.y + w * tri.p2.y);
        worldIntersect.z = (u * tri.p0.z + v * tri.p1.z + w * tri.p2.z);
        return true;
    }
    else
    {
        return false;
    }
}

glm::vec3 glmFrom(s_point3f point)
{
    return glm::vec3(point.x, point.y, point.z);
}

My convenience structures are defined as:

struct s_point3f { GLfloat x, y, z; };
struct s_triangle3f { s_point3f v1, v2, v3; };
struct vec3ray { glm::vec3 origin, direction; };
struct vec3triangle { glm::vec3 p0, p1, p2; };

vertices is defined as:

std::vector<s_triangle3f> vertices;

Basically, I'm trying to get the intersect of a ray (which is positioned at the x, and y coordinates specified facing pointing downwards toward the terrain) and one of the two triangles on the grid. getZ() rarely returns anything but 0. Other times, the numbers it generates seem to be completely off. Am I taking the wrong approach? Can anyone see a problem with my code? Any help or critique is appreciated!

EDIT:
After considering what David Cummins has suggested, I can confirm that the ray and the triangle should always be intersecting. I added some debugging code to visualize the data. The area shaded red contains the two triangles, and the blue line is the line/ray being checked for intersection. Depth has been disabled when drawing the line.

Here is an example of data being passed to glm::intersectLineTriangle():

triangle #1:
v1={x=19.0000000 y=34.0000000 z=2.70000005},
v2={x=19.0000000 y=33.0000000 z=2.70000005},
v3={x=18.0000000 y=33.0000000 z=2.70000005}

triangle #2:
v1={x=18.0000000 y=33.0000000 z=2.70000005},
v2={x=18.0000000 y=34.0000000 z=2.70000005},
v3={x=19.0000000 y=34.0000000 z=2.70000005}

ray origin:
{x=18.5000000 y=33.1871414 z=10.0000000}

ray direction:
{x=18.5000000 y=33.1871414 z=-10.0000000}

Despite passing seemingly reasonable arguments, it always returns false. Leaving barycentricIntersect as {x=0.0 y=0.0 z=0.0}. Am I misusing the function? Are the values I am passing invalid, and I'm just blind to it?

EDIT 2:
I've written a quick SSCCE. I would be extremely grateful if someone could help me debug this issue.

sentences:
How to orbit an object at certain speed in Unity? I want to move an object around a circle. So I have this code below:

    static public int theta = 0;

void Update(){

    Vector3 position = this.transform.position;

    position.x = 0 + 50 * Mathf.Cos (theta) * Time.deltaTime;
    position.y = 0 + 50 * Mathf.Sin (theta) * Time.deltaTime;
    this.transform.position = position;
    theta += 1;
}

The object orbits, but it orbits so fast!!! I want the object to rotate like 1 orbit per second only.  How to do that?

ANSWER TO THIS PROBLEM, THANKS!

static public int theta = 0;

void Update(){

    Vector3 position = this.transform.position;

    position.x = 0 + 50 * Mathf.Cos (theta) * Time.deltaTime;
    position.y = 0 + 50 * Mathf.Sin (theta) * Time.deltaTime;
    this.transform.position = position;
    theta += 1 * Time.deltaTime;
}

sentences:
Access a ID3D11Texture2D in another thread I created a ID3D11Texture2D texture on a thread with DirectX graphics and I passed its pointer to a worker thread. I'm assured that the creator thread will no longer reference nor use the texture. I now need the worker thread to copy the resource

pContext->CopyResource(..);

What's the correct way of doing this in the worker thread?

In other frameworks like CUDA or OpenGL I would just push/restore the creator thread's context into the worker thread, but I'm not sure if that applies in DirectX.

sentences:
RTS game: How to handle disconnects in a fully connected peer to peer architecture? I'm currently working on a game in which I am considering implementing a networking architecture as described in this article: http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php

In order for the implementation as described in the article to work, all peers need to be interconnected without any exceptions. Like so:

This works fine when everything is well. But I am wondering how to agree on disconnects in such a network. (Sadly something the article does not go into). It is relatively easy if one client goes down. Just give every client a timeout, and if a client does not respond for a certain time, it is removed from that client.

However, how should the system solve a case in which one client does not respond to another, but still responds to all others. In such a system the following could happen, resulting in a invalid state:

Of course this can be solved by giving one of the clients some kind of "master" role. It being the only one that can decide whether or not to disconnect other clients. But I'm wondering if it can be achieved in a pure p2p network.

Note I realize this case is not one that can likely occur "naturally". But I want to prevent players from being able to ruin a networking game for others by playing a trick like this by using the firewall for example.

sentences:
Unit testing graphics What is the standard (if there is one) method which professional games developers use to unit test (or closest equivalent) graphics output?

I am developing with Corona SDK and I would like to test the visual output of my game code. I don't believe it is reasonable to pre-generate screenshots, scene definitions or some such for comparison at the end of a test, I would like to know if there is a good testing mechanism for graphics in general.

sentences:
How to place an instance of Editor Window in screen center? I want to create an instance of Editor Window by using CreateInstance or GetWindow. And I want to place it in center of the screen (or center of Unity).

I didn't find any methods in Unity Engine that could help me. Do they exist?

How can I do it within the script?

Note: I mean: how can I find out what is the user's screen resolution? Which method can give me that?

P.S. Screen.width/Screen.height - is not what I need. Because it refers to the Game View's window, not Unity.exe Editor's size and not monitor Screen

sentences:
storing procedurally generated roguelike world into zones I am currently developing a 3D roguelike game which will take place in a very large world. The world is generated by procedural algorithm supplied by external script in run time. To speed up rendering and minimalize memory requirenments I am dividing world into zones. A zone is a 2D rectangle of maximum size 1024 x 1024 (doesn't need to be a square), that holds dynamically allocated (via single new) array of Tile's. Tile is defined to be as small as possible, to minimalize use of memory. Only the zones visible to screen or in immediately neighbor are in memory, rest are loaded from harddisc file on the need to basis.

The problem I have is that map generator does not need to know about logical zone layout, so it can generate this kind of map (especially for higher Z-levels, like lofts in city):

This would be waaaay too much memory waste to enclose it in 1024 x 1024 so, it's better to put it into smaller chuncks like this:

So, finally the question: how can I convert data supplied by world generator script into actual world structure in memory?

What I've thought about so far:

Script has a method SetTile(x, y, tileType), and the world is automatically recalculated every let's say 100 cells, so the zones are put as efficiency as possible. This will require LOTS of zone copying, moving, resizing, etc. - that's a really slow operation, but it will keep world layout in logical order, so for example it would be easier to implement methods like GetTile(x, y) in the script
Script has a method SetTile(x, y, tileType) which temporary just store a Tile into std::vector and after everything is done, the world runs a second pass that's calculates zones. This is way faster, but has a drawback - since Tile are set in no particular order, it's really hard to have GetTile(x, y) method in the script. Perhaps there is a solution for that drawback, I am just not having any idea of - std::map is way too slow to be used here.
If it cannot be done off screen, maybe the solution would be to expose zones into script and being created explicitly (I mean put into script API CreateZone() function and similar) - I don't want this, because scripts will be exposed to end users and I want to make them as robust as possible.
Perhaps there is other solution? Maybe I can organize world generation in some other way (I still need scripts, but it may be a script that generates only part of the world and then connect)?

Additional things I just came up: the entire world can be too large to be put in the memory at once. So it twist the problem even further - I have to break world generation part (in script) into stages. Any suggestions?

As for technology: I am using C++ 03' without Boost and AngelScript as scripting language

sentences:
Panning in Direct sound wthout using SetPan function I was wondering if it is possible to pan a WAV file in direct sound without using the SetPan function. If so how?

That is change the volume on 2 different speakers, right and left, to simulate that the sound is moving around the player.

sentences:
OpenGL Perspective Issue I'm trying to troubleshoot a problem with my simple OpenGL test program, which I've written in C. I've written some math routines to do the matrix manipulation, but even after copying known working perspective functions, I cannot get anything to appear on screen.

The program is simply:

The only geometry is a simple cube centered around the origin, here is the render loop:

int renderer_draw_frame(float delta_time)
{
    glClearColor(0.2f, 0.3f, 0.2f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glUseProgram(prog);

    /* bind textures */
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, tile_tex);
    glUniform1i(glGetUniformLocation(spo_prog(spo), "Tex1"), 0);

    vec3f eye = { 0.0f, 0.0f, 3.0f };
    vec3f target = { 0.0f, 0.0f, 0.0f };
    vec3f up = { 0.0f, 1.0f, 0.0f };

    mat4f model_mat = mat4f_translate(0.0f, 0.0f, 0.0f);
    mat4f view_mat = look_at(eye, target, up);
    proj_mat = mat4f_projection(45.0f, (float)win_width / (float)win_height, 0.1f, 100.0f);

    glUniformMatrix4fv(modelLoc, 1, GL_FALSE, &model_mat.f[0]);
    glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view_mat.f[0]);
    glUniformMatrix4fv(projLoc, 1, GL_FALSE, &proj_mat.f[0]);

    glBindVertexArray(VAO);
    glDrawArrays(GL_TRIANGLES, 0, 36);
    glBindVertexArray(0);
    return 0;
}

mat4f and vec3f is just this:

typedef struct mat4f mat4f;
struct mat4f
{
    float f[4 * 4];
};

typedef struct vec3f vec3f;
struct vec3f
{
    float x;
    float y;
    float z;
};

The math routines in question:

#define M4(m,i,j) m.f[mat4f_idx(i,j)]
#define PI 3.14159265359f

mat4f mat4f_projection(float fov, float ratio, float near, float far)
{
    float d2r = PI / 180.0f;
    float ys = 1.0f / tanf(d2r * fov / 2.0f);
    float xs = ys / ratio;
    float nf = near - far;
    mat4f r = { 0 };
    M4(r, 0, 0) = xs;
    M4(r, 1, 1) = ys;
    M4(r, 2, 2) = (far + near) / nf;
    M4(r, 2, 3) = -1.0f;
    M4(r, 3, 2) = 2 * far * near / nf;
    return r;
}

mat4f look_at(vec3f eye, vec3f center, vec3f up)
{
    vec3f zaxis = vec3f_normalize(vec3f_subv(eye, center));
    vec3f xaxis = vec3f_normalize(vec3f_crossp(vec3f_normalize(up), zaxis));
    vec3f yaxis = vec3f_crossp(zaxis,xaxis);

    mat4f trans = mat4f_id(1.0f, 1.0f, 1.0f, 1.0f);
    M4(trans, 0, 3) = -eye.x;
    M4(trans, 1, 3) = -eye.y;
    M4(trans, 2, 3) = -eye.z;
    mat4f rot = mat4f_id(1.0f, 1.0f, 1.0f, 1.0f);
    M4(rot, 0, 0) = xaxis.x;
    M4(rot, 0, 1) = xaxis.y;
    M4(rot, 0, 2) = xaxis.z;
    M4(rot, 1, 0) = yaxis.x;
    M4(rot, 1, 1) = yaxis.y;
    M4(rot, 1, 2) = yaxis.z;
    M4(rot, 2, 0) = zaxis.x;
    M4(rot, 2, 1) = zaxis.y;
    M4(rot, 2, 2) = zaxis.z;
    return mat4f_mul(rot, trans);
}

Finally, the simple vertex shader:

#version 330 core

layout (location = 0) in vec3 position; //attrib pos 0
layout (location = 1) in vec2 texCoord; //attrib pos 1

out vec2 TexCoord;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
    gl_Position = projection * view * model * vec4(position, 1.0f);
    TexCoord = vec2(texCoord.x, 1.0f - texCoord.y);
}

Here is what I see:

If I change the shader as so:

void main()
{
    gl_Position = view * model * vec4(position, 1.0f);
    TexCoord = vec2(texCoord.x, 1.0f - texCoord.y);
}

I see:

Why does it completely disappear in projection view? I've tried changed the view look at parameter but I can't ever see anything through projection view. I've tried several different implementations, currently gluPerspective (the one above is pretty much that function copied).

I've been at this all night and I can't seem to get a grasp on what went wrong. Can someone gives me some pointers on where to go next?

sentences:
Can't click on a button with startDrag() active on stage I need to know how can I enable mouse click on a button when I have a MouseEvent listener for the stage.

I have an MClip associated with the mouse cursor:

Mouse.hide();
scope.startDrag(true);

And a MouseEvent on the stage:

stage.addEventListener(MouseEvent.CLICK, FunctionXYZ);

When I try to click on any button they don't call the function that I create for those buttons... for example, button for fullscreen, exit, help, etc... What can I do?

sentences:
Verlet collision with impulse preservation I came across this article, recently, that presented a technique for impulse preservation with position-based verlet integration. What was interesting was that the integration steps are seemingly done differently from typical position-based verlet schemes, as well as the ordering of the integration step and collision resolutions.

Specifically, the typical verlet position integrator is:

newPosition = 2 * position - oldPosition + acceleration * timeStepSquared
oldPosition = position
position = newPosition
DoConstraints()

Where the article has:

position += acceleration * timeStepSquared
DoConstraints()
newPosition = position * 2 - oldPosition
oldPosition = position
position = newPosition

Which ignoring constraints for a moment works out to be:

newPosition = 2*position - oldPosition + 2*acceleration*timeStepSquared
oldPosition = position + acceleration*timeStepSquared
position = newPosition

Which is different in a term of acceleration * timeStepSquared.  I haven't quite convinced myself that those terms cancel out through the iteration, as the prior acceleration * timeStepSquared term may not be the same as the current one.

Could someone explain the reasoning for this, and if indeed it makes sense?

sentences:
Unity2D jumping inconsistancy I'm tinkering with a unity2D sidescroller, and am trying to make a player controller to jump. However, when I tell my character to jump, it sometimes jumps twice the distance, and I don't know why. Below is my controller script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    public float playerSpeed = 10;
    public float jumpForce = 20;
    private bool ableToJump = false;
    public GameObject groundCheck;  // place an empty object slightly below the character where it will collide with any ground

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("space") && ableToJump)
        {
            ableToJump = !ableToJump;
            GetComponent<Rigidbody2D>().AddForce(new Vector3(0,1,0) * jumpForce);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(-playerSpeed * Time.deltaTime, 0, 0);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(playerSpeed * Time.deltaTime, 0, 0);
        }

        // The player is grounded if a linecast to the groundcheck position hits anything on the ground layer.
        ableToJump = Physics2D.Linecast(transform.position, groundCheck.transform.position, 1 << LayerMask.NameToLayer("Wall"));
    }
}

Here is the glitch as it appears when I am previewing the game (watch how the third jump seems to be twice as high). There is no consistency to when it occurs, but it has occurred any time between two in a row and 10-12 between times it happens. I have tried long versus short presses of the jump key (space bar), moving versus standing still, and jumping on different locations. I have also tried disabling animations and waiting between presses versus pressing and holding space, versus pressing space rapidly. The only consistent thing is that sometimes I jump about three blocks (200 x 200px each) high, and sometimes I jump about six blocks high. Any tips are appreciated. Thanks!

sentences: Rotate a 3D object in Unity3D on button click There is a 3D character in my application developed using Unity3D.  Now I want to rotate this 3D character when the user press the rotation button. I tried several ways, but didn't work. How can I rotate a character when the player presses the rotation button?

sentences:
Calculate the best route for racing games I'm trying to structure a system for rating player's performance in my arcade-style racing game. So I'm thinking about calculating the best route possible, and trying to guide the player towards the best way of driving.
Is there any work into such problem? Links to papers/implementations would be awesome.

sentences:
I can not proceed to my room menu using photon in unity when i use PhotonNetwork.JoinRoom() I have a TextMeshProUGUI called EnterRoomName and I am trying to enter the name of the room that I'm supposed to enter, but it's not working.
This is my function:
public void JoinRoom()
{
     PhotonNetwork.JoinRoom(EnterRoomName .text);

     MenuManager.Instance.OpenMenu("loading");
}

sentences:
How do I get my scene view back to 0 or whatever it is by default? All my tiles/sprites have 0 as their position on the Z axis, except my main cam which has -10.

For some reason I suddenly couldn't zoom in without everything disappearing, I switched to 3D view to see where I was and it seemed like I was miles away from my tiles on the z axis. I placed a sprite into my level to check and it placed itself at -57,000 on the z axis.

How do I get my scene view back to 0 or whatever it is by default?

sentences:
Incorrect placement of diacritics in Arabic fonts I put AdobeNaskh font on my texts and use Arabic text support for unity and use show Tashkeel function then the text appears so

what is the solution of this problem?

sentences:
How do I export my Blender model to OGRE XML format for jMonkeyEngine 3? I'm an amateur software engineer with several simple 2D-game projects under my belt. I'v recently turned my attention towards creating a basic 3D game, nothing too fancy, just to get a grip on things.

I used jMonkeyEngine 3 (RC 2) because I'm interested in Java, and open-sourced games. Unfortunately, being an independent project, jME3 is not as complete as other Game Engines, and its community is not as large.

I've followed most of their basic how-to tutorials to get me started on jME3, but one area always escapes me; the use of models in a game. jME3 recommends Blender, and also recommends exporting the models as OGRE XML files.

In my experience, jME3 can import .blend files directly, but at the loss of anything other than the very basic model itself. No bones, no animation, and so far, my attempts at giving it a solid color failed as well.

I'm only interested in using and seeing my model in game, with bones, if at all possible. Animations an come later. I've followed their tutorials on how to import models here:

http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_asset

But I get stuck on "Open the menu File > Export > OgreXML Exporter to open the exporter dialog."

For one, there IS no Export to OgreXML (in Blender). I've fiddled around in the preferences and still found nothing. I've installed the required 'stuff' by going through jME3 and clicking 'install OGRE plug-ins.'

I've also tried to download a converter from Ogre itself, but all I get are some command line parameters that open CMD and close it way too fast for me to do anything.

Am I missing something?

My experience with Blender and modelling is even more limited than my experience in programming, so I don't really understand scripts, and python and whatever it is I found on the net in my research.

I used:

Blender 2.65
JMonkeyEngine 3.0 RC 2
Windows 8 (ick)

sentences:
Passing data into a vertex shader for perspective divide In OpenGL and GLSL, I am just learning about perspective projection and the vertex shader. However, I am a little confused about what data actually needs to be passed to the vertex shader, and what needs to be done in the shader code itself.

I have two questions:

Suppose I have a triangle defined in 3D coordinates (x,y,z). Do I need to pass a 4D vector with values (x,y,z,w), where w = z? Or do I just pass the 3D vector? The reason I ask is that I know that somewhere in the pipeline, the x and y coordinates are divided by the w component, in the perspective divide.

In the vertex shader code, do I need to manually divide the x and y components by the w component myself? Or is this taken care of automatically?

Thanks!

sentences:
Understanding particle texture rotation / space I want to remake a "portal" that I've seen in RE4. It looks like this:

I have observed it, and to me, it looks just like a texture rotating on a cylinder.

To remake this, I thought that I should use a Particle System.

First question: Is that a good choice?

In my particle system, I'm using this texture:

I'm also using a cylinder mesh.

I have then set the following settings:

Duration: 1.0
Start lifetime: 1
Emissions Rate over time: 1
Rotation over Lifetime: Separate Axes: Y: 360

It does rotate on the cylinder as expected, but the texture is really strange.
I have no idea in which way it's being used. Therefore I have added the red, blue, green and yellow dots.

As on can see, the spikes come from above as well instead of only from below.
Also, there's a "gap" in that circle:

I thought that it was perhaps caused by the texture tiling, so I played around with that. It didn't really help. Here is a video of my desperate attempt.

Can anybody tell me which pitfall I have stumbled over?

If I can't make the texture fit correctly by tiling and offset, what else could I do to make the texture fit perfectly here?

Edit: This is what the cylinder unwrap looks like. I just used Smart UV Project in Blender:

sentences:
Rendering two textures with blending and alpha test What I am looking for is the following: I have a circle on a square image, alpha is 0 at the corners

and also a square shadow, alpha is 0 everywhere else

I would like to have as final result a blending of these two renders, plus the shadow not being rendered outside the circle

How could I achieve that?

sentences: speed up the update of glutidle() I have a client that sends data at 1KHz (i.e. 0.001 sec) to a master over Internet using UDP protocol. In Master, I need to draw an object, but the problem is that the update of GLUT is slower than the client's update. I have tried to use glutTimerFunc(0,glutIdle, 0); but still slow. Is there a way to speed up the update rate of drawing? I need to update Display() every 0.001 sec. Any suggestions? I'm using windows 7.

sentences:
Simulate the player floating in the water I am creating my first game in Unity and now I have a problem.

I created a waterpool (a blue quad) and I want to simulate the floating of the player, so when the player is in the water, its Y position would be equal to that of water.

I think a picture is clearer: the water is blue, the player is blue.

I tried to do it this way but it does not work:

public float myYpos;

void OnTriggerEnter(Collider other) {
   if(other.tag == "Water") {
      walkSpeed = walkSpeed - deltaWaterSpeed;
      jumpHeight = jumpHeight - deltaWaterJump;

      // DOESN'T WORK
      //myYpos = transform.position.y;
      //myYpos = myYpos + 1;
      //transform.position = new Vector3(transform.position.x, myYpos, transform.position.z);
   }
}

This is a gif of my game:

I also do not know why sometimes the player is hidden in the water (I see only water), why?

Thanks to anyone who wants to help me.

Thanks for the answers. It is a 2D game but I stupidly followed a tutorial for 3D and so now I go ahead with 3D.

I dont' have a rigidBody on the Player.
I added the OnTriggerStay as recommended but the result is this:

   void OnTriggerStay(Collider other) {
      if(transform.position.y < other.transform.position.y) {
         transform.position = new Vector3(transform.position.x, other.transform.position.y, transform.position.z);
      }
   }

I deleted the OnTriggerEnter() and OnTriggerExit() methods.

Why the player jumps up and down? Why it doesn't float (a few mm below the surface), but quite a bit below?

Ok, now actually it does what it should have done, but I realized that was not what I wanted.

It behaves in this way:

The water quad has Y position = 8 and when the player is inside water its Y position is rightly 8.
However, this generates this first effect while I prefer the second: the player is on the surface or nearly so, regardless of the height of the water.

How can I get this?

I know I have asked one thing and I got the correct answer but only now I realized that I didn't know what I wanted. Sorry...

In any case, why the player does not jump in the water? It jumps only if it is attached to a gray wall. If it is in the water it doesn't jump but parameters for the jump are setup...

sentences:
How could I implement programming as a mechanic? I am wondering how I could manage to execute programs made by players in my game via some sort of in-game computer. I have been trying to figure it out but I have no idea how it is even possible.

Examples of other games that do this are:

ComputerCraft
Space Engineers
Screeps
Glitchspace

I just need a basic explanation of how I could do it so I can start making my own games with in-game coding as a mechanic.

sentences:
Making unity inspector accept classes that inherit from a base class I have a base class that has a lot of classes inheriting from it, I want to make a script that you can drop one of these derived classes into. How do i do that?

abstract class thingy : UnityEngine.ScriptableObject
{
    // methods, variables, etc
}

class awsomeThing : thingy
{
    // Imagine there are more of these classes with different names...
}

I've managed to get the thingy class to show up but (as you can guess) you can only drag in that script in there, is there a way to get the inspector to accept the multiple awsomeThing classes?

sentences: Which game portals support Unity games? I'm considering development of some simple Unity games but am worried about distribution.  Which well known game portals currently support unity?

sentences: When is it best to load screens in mobile games? In the develpment of a mobile game, is it a good to load all the screens at the start of the game, or destroy and create new ones during the game? I am doing the second thing, because I suppose that the first one consumes a lot of memory, what's recommended?

sentences: What counts as a "game studio" I am registering a game on a site so that I can sell it, and it needs me to put in my game studio.  I work on my games in c++ and I dont't have a team, or a company.  Can I throw out a name and be done with it? or do I need to have a registered company?

sentences:
Unity3d Transfer of value from one script to another Script 1

public class enemy : MonoBehaviour {
    private Vector3 Player;
    private Vector2 PlayerDirection;
    public float Xdif;
    public float Ydif;
    private float speed;
    private float distance;
    private bool stun;
    private float stuntime;
    GameObject playerObj;
    private Rigidbody2D myRigidbody2D;
    private bool isEnemyFear;

    // Use this for initialization
    void Start () {
  stuntime = 0;
  stun = false;
  speed = 6;
  playerObj = GameObject.Find ("Player");
  myRigidbody2D = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    public void Update () {
  distance = Vector2.Distance (Player, transform.position);
  Player = playerObj.transform.position;
  if (stuntime > 0) {
   stuntime -=Time.deltaTime;
  } else {
   stun = false;
  }
  if(isEnemyFear){  //here to pass a value from script 2
   EnemyFear();
  }
  else{
   EnemyAttack();
  }

    }
    void EnemyAttack(){

  if (distance < 25 & !stun) {
   Xdif = Player.x - transform.position.x;
   Ydif = Player.y - transform.position.y;
   PlayerDirection = new Vector2 (Xdif, Ydif);
   myRigidbody2D.AddForce (PlayerDirection.normalized * speed);
   Debug.Log("Attack");
  }
    }

    void EnemyFear(){

  if (distance < 25 & !stun) {
   Xdif = Player.x + transform.position.x;
   Ydif = Player.y + transform.position.y;
   PlayerDirection = new Vector2 (Xdif, Ydif);
   myRigidbody2D.AddForce (PlayerDirection.normalized * speed);
   Debug.Log("Fear");
  }
  StartCoroutine(Timer());
    }

    void OnCollisionEnter2D(Collision2D Playerhit){
  if (Playerhit.gameObject.CompareTag("Player")) {
   stun = true;
   stuntime = 1;
  }
    }
    IEnumerator Timer() {
  yield return new WaitForSeconds(10);
  isEnemyFear = false;
  StopCoroutine ("Timer");
    }

}

Script 2

public class randomizer : MonoBehaviour {

    private bool isEnemyFear;

    public void CheckFear(){
  int rand = Random.Range(0, 100);
  if(rand > 35)
   isEnemyFear = true; //this value should be passed to the script 1
    }

}

How to pass a value isEnemyFear = true from Script 2 in Script 1?

sentences: No intellisense with with Unity 5.5, Visual Studio Code integration, OSX 10.12.1 I get this with the listed software. It doesn't recognize object types and I can't use reference-finding. I have the Omnisharp plugin installed and updated. Just wondering if this is supposed to work properly yet. I'm opening it with Assets->Open Project In Code.

sentences: Heuristic Cost in A* algorithm I have been learning about the A* path finding algorithm and I can't understand the heuristic cost in this algorithm. What is it and what is its use in the algorithm?

sentences:
How did the SNES handle palettes of multiple sprites? (This is assuming all graphics are stored in 4 bpp)

I understand that the SNES has a 256 color palette split into 16 palettes (each with 16 colors), and 8 of these represent palettes usable by sprites. Each sprite has a number representing which of these 8 palettes it uses. My question is how and when are the colors of these 8 palettes set typically.

Does the SNES copy the palette of a sprite into one of these 8 palettes when it is rendered? If so that would mean that only 8 sprites could be rendered simultaneously, and two sprites using the same colors would not share the palette which would be a waste of memory.

sentences:
How to smoothly track and draw player movement? I am currently using C# XNA Framework to simply connect some development concepts that I've learned/used over the past few months. Right now I have a Web Service that keeps track of connected clients and their 2D positions. I have a very small map that uses triangles to represent clients and their positions.

What I am seeing is my client updates very smooth (because I update my own position locally before sending it off to the web service), however, other triangles come in and appear choppy.

I use a web service that is called approximately every 20ms (and responds pretty quickly might I add). However, I know that XNA framework calls its update/draw methods approximately 60 times per second correct? Given this, there is ALWAYS going to be the appearance of choppiness.

Is there some strategy or pattern to handling this? I thought about implementing a method on the client side that basically says, give me start position and end position and I'll transition the triangle between the two points smoothly. But this may not be the right answer.

What are folks thoughts?

I am using a NetTcpBinding from WCF (Duplex). Is this technology simply too slow?

Is the right strategy simply to let the Service always tell me where the other clients are and the client simply draws them there?

Or does the client compute other information and make assumptions etc?

Thanks for any information on this topic!

sentences: Saving Very Little Data But for Lots of Objects Imagine 50 instances of one type of object and 25 instances of another. Both types of object needs to remember a simple Boolean  or int for their own purposes that can be saved to file and reloaded. For the life of me, I cannot find any help on the interwebs regarding the best way to do this. I already know and understand how to use serialization and deserialization, but I cannot figure out how to organize this. I obviously don't want 75 save files but I can't think of a good way to combine their data to one save file--especially since not everything is serializable. Any help??

sentences:
Making a gameobject move back and forth in Unity So i have this enemy gameobject and i want it to move in a certain pattern like a patrol. So i want him to move from A to B to C then Back to B to A.
The script I worked out makes him go from C to A directly but I dont want that. Can someone please help .
The Length of PatrolPoint Array in 3 `using UnityEngine;
using System.Collections;

public class EnemyPatrol : MonoBehaviour {

public Transform [] patrolPoints; // An Array of path points to be followed
private int currentPoint ;
public float enemySpeed ;

void Start()
{

    currentPoint = 0;
    transform.position = patrolPoints[ currentPoint].position; // Starting Point
}

void Update()
{

    if(transform.position == patrolPoints[currentPoint].position)
    {
        currentPoint ++ ;
    }

    if(currentPoint >= patrolPoints.Length)
    {
        currentPoint = 0 ;
    }

    transform.position = Vector3.MoveTowards(transform.position , patrolPoints[currentPoint].position , enemySpeed*Time.deltaTime);

    }

}
`

sentences:
Havok Physics : "hkQuaternionf not normalized/invalid!" when hkpWorld::stepMultithreaded() today I want to ask a question about Havok Physics 2012.

My havok version is 2014.1.0-r1 (x86 SIMD version), and I'm using Visual Studio 2012 on Windows 8.

My problem is, that once I add a rigid body to the world, the next time I call hkpWorld::stepMultithreaded(), it breaks in some SSE math related function and gives me this error message through my error report function.

  C:\NightlyJobs\09-07-Sun-01\Source\Common/Base/Math/Vector/Sse/hkSseVector4Util.
  inl(307): [0x1FF88F0E] Assert: hkQuaternionf not normalized/invalid!

Here's the stack trace:

  (null)(0):'hkDefaultError::message'
  (null)(0):'hkError::messageAssert'
  (null)(0):'hkVector4UtilImpl::convertQuaternionToRotation'
  (null)(0):'hkRotationf::set'
  (null)(0):'hkTransformf::setRotation'
  (null)(0):'hkSweptTransformUtil::calcTransAtT1'
  (null)(0):'hkSweptTransformUtil::_stepMotionState'
  (null)(0):'hkRigidMotionUtilApplyForcesAndStep'
  (null)(0):'integrateJob'
  (null)(0):'hkpMultiThreadedSimulation::processNextJob'
  (null)(0):'hkJobQueue::processAllJobs'
  (null)(0):'hkpWorld::stepMultithreaded'

Here's how I create and add the rigid body.
It's so basic that I didn't think there would be any room for bizarre error in it...

hkpSphereShape* sphere = new hkpSphereShape(radius);  // radius is 10.0f here.

hkpRigidBodyCinfo rigidBodyInfo;
rigidBodyInfo.m_shape = sphere;

m_RigidBody = new hkpRigidBody(rigidBodyInfo);

world->markForWrite();
world->addEntity(m_RigidBody);
world->unmarkForWrite();
m_RigidBody->removeReference();

I don't set position or rotation of the rigid body myself, so why it breaks in some quaternion related function is beyond me.

I speculated it might be one of those multithreading-related bizarre errors, so I tried changing

m_WorldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_MULTITHREADED;

to

m_WorldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_DISCRETE;

and

m_World->stepMultithreaded(m_JobQueue, m_CpuThreadPool, timeStep);

to

m_World->stepDeltaTime(timeStep);

but the problem persisted.

Do you know something that I could be doing wrong ?
Please tell me in the comments if you need to see some of my other code to help!
Any help would be greatly appreciated, thanks!

sentences:
Sphere and AABB intersection I'm looking for an algorithm that will determine if a sphere is in any way touching an AABB or contained within it. Profile results indicate that this specific use is taking up a large percentage of my time, so it would be nice if it was as efficient as possible.

Edit: ATM, I've got this:

        bool IntersectsAABBWithSphere(Math::AABB rhs, Physics::Sphere sphere) const {
            // http://www.gamedev.net/topic/335465-is-this-the-simplest-sphere-aabb-collision-test/
            auto aabbcenter = (rhs.BottomLeftClosest + rhs.TopRightFurthest) / 2.0f;
            auto SepAxis = sphere.origin - aabbcenter;
            auto Dist = Math::Length(SepAxis);
            SepAxis = Math::Normalize(SepAxis);
            if( SepAxis.x >= SepAxis.y && SepAxis.x >= SepAxis.z )
                SepAxis /= SepAxis.x;
            else if( SepAxis.y >= SepAxis.x && SepAxis.y >= SepAxis.z )
                SepAxis /= SepAxis.y;
            else
                SepAxis /= SepAxis.z;

            auto extents = (rhs.TopRightFurthest - rhs.BottomLeftClosest);
            SepAxis.x *= extents.x / 2.0f;
            SepAxis.y *= extents.y / 2.0f;
            SepAxis.z *= extents.z / 2.0f;

            return Dist <= (sphere.radius + Math::Length(SepAxis));
        }

My AABB's are currently represented as min/max, and my spheres as origin/magnitude.

sentences: What path finding algorithms are there? I'd like to read up on path finding algorithms. Is there a primer available or any material or tutorials on the Internet that would be a good start for me?

sentences:
Very slow motion smooth rendering - cocos2d-x I have a a white circle that I move on a black background very slowly. When I look very carefully, I see that the while moving the edge of the circle is jittering. In my opinion it is because the next row/col of pixels becomes white from black where the circle should be rendered and as the pixel has some width I see some abrupt advance of the edge toward the direction. Ideally, this should not be visible if I would not have pixel discretization. But on the other hand a have a video sample with such a slow motion and my monitor renders it without any jumps on the edge. Hence, I think that it is because of not the fact that pixel have finite sizes but I render wrongly. How I can solve the problem? Any trick, flag?

EDIT: Here is the code I have used:

Sprite* bg = Sprite::create("gfx/letter_background.png");
addChild(bg, 100);
bg->runAction(MoveBy::create(80, Vec2(500, 500)));

wherer the .png I have used is a white circle attached below:

You don't see the image above as it is white :)

sentences: How to detect a cursor inside a non-rectangle shape How can I detect and do something if the cursor is inside a hexagonal shape? Is there any way other than detecting if it's in a rectangle area close to the shape of the hexagon? It would also have to work with a grid of hexagons, detecting each individually.

sentences:
Game Engine Design – Ubershader - Shader management design I want to implement a flexible Ubershader system, with deferred shading. My current idea is to create shaders out of modules, which deal with certain features, such as FlatTexture, BumpTexture, Displacement Mapping, etc. There are also little modules which decode color, do tone mapping, etc. This has the advantage that I can replace certain types of modules if the GPU doesn't support them, so I can adapt to the current GPU capabilities. I am not sure if this design is good. I fear I could make a bad design choice, now, and later pay for it.

My question is where do I find resources, examples, articles about how to implement a shader management system effectively? Does anyone know how the big game engines do this?

sentences:
Can’t find component Unity so, I want to add a Cloth component.
I click on a gameobjects, press “Add Component” in the Inspector search “Cloth”
And nothing comes up.

From my searches in google, nobody had such a problem ever, nor is there any answers.

How can I fix it?
Or reload/reimport the physics components?

Unity version 2019

Thanks in advance!

sentences:
Fresh Unity/Visual Studio 2017 install error Installed Unity 5.6.3p2 (my projects's current version) on a new machine. When I opened the project in Visual Studio 2017 I got a prompt to update the .NET framework from 3.5 to (I think) 4.2.x. I confirmed the upgrade for all projects in the solution but now all I get is this

If I close and reopen visual studio I no longer get the upgrade prompt. I tried downloading .NET 3.5 to no avail. Any information is appreciated.

sentences:
How to leave trails that are equidistant apart from each other I want bunch of circles to follow the player while keeping a distance apart.
So far I have this:
local p = {
  x=0,
  y=0,
  life={
    {x=0,y=0},
    {x=0,y=0},
    {x=0,y=0},
    {x=0,y=0}
  }
}

local last={x=p.x,y=p.y}
for l in all(p.life) do
  l.x = lerp(last.x,l.x,0.5)
  l.y = lerp(last.y,l.y,0.5)
  circfill(l.x,l.y,2,7)
  last={x=l.x,y=l.y}
end

But this makes it so the circles collapse into each other and the player. I want the circles to have a distance between themselves and the player.

I've also tried this:
  l.x = lerp(last.x*0.8,l.x,0.5)

This leaves a distance as I want but the trail is always on the upper left, barely following player.
I want the trail to stay always behind the player.
Probably I can achieve this by stop following if the distance is less than threshold.

sentences:
Touch goes through UI objects on mobile I know this question has been asked a lot of times, and I have tried the solutions that were provided and I still have no valuable result, so I thought...maybe a new set of eyes could help.

I have a game in which the player can navigate around the scene environment using a virtual joystick and look around the scene by scrolling through the screen(like it is seen in most mobile fps games).

The problem that I am having now is that my "look around" script allows touch inputs to pass through UI elements on mobile, but everything works fine on the editor.

Useful tips:

1) I am using Unity 2019.3.0f5

2) I setup the script to work with Cinemachine Free Look, and my script(seen below) is attached to it.

Here is my code:

using UnityEngine.EventSystems;
using UnityEngine;
using Cinemachine;

public class CinemachineCoreInputTouchAxis : MonoBehaviour
{
private readonly float TouchSensitivity_x = 10f;
private readonly float TouchSensitivity_y = 10f;

[SerializeField] private bool UseTouchControls = true;

private static int Index = 0;

void Start()
{
    if(UseTouchControls)
        CinemachineCore.GetInputAxis = HandleAxisInputDelegate;
}

private float HandleAxisInputDelegate(string axisName)
{
    switch (axisName)
    {
        case "Mouse X":
            if (Input.touchCount > 0 && !IsPointerOverUIObject())
                return Input.touches[Index].deltaPosition.x / TouchSensitivity_x;
            else
                return Input.GetAxis(axisName);
        case "Mouse Y":
            if (Input.touchCount > 0 && !IsPointerOverUIObject())
                return Input.touches[Index].deltaPosition.y / TouchSensitivity_y;
            else
                return Input.GetAxis(axisName);
        default:
            Debug.LogError("Input <" + axisName + "> not recognized.", this);
            break;
    }
    return 0f;
}

public static bool IsPointerOverUIObject()      //Called to check if the pointer is over a ui object
{
    bool value = false;
    for (int i = 0; i < Input.touches.Length; i++)
    {
        Index = i;
        value = EventSystem.current.IsPointerOverGameObject(Input.GetTouch(Index).fingerId);
        if (value)
            break;
    }
    return value;
}
}

Can anyone please let me know what I am failing to see and how to fix it?

sentences:
Proper approach to handle transformation matrix and extract its components Basically I have a Transformation component object with following structure(pseudo):

TransformComponent{
  Vec3 position;
  Vec3 rotation; //in euler angles
  Vec3 scale;
  Mat4 worldMatrix; //transformation matrix in world space
  Mat4 localMatrix; //transformation matrix relative to parent transform
  Mat4 worldToLocal; //Matrix to convert children worldMatrix in localMatrix
  TransformComponent parent;

  /* calculates worldMatrix using position,rotation & scale.
   * Also calculates inverse of worldMatrix and stores it in worldToLocal;
   */
  void CalculateWorldMatrix();

}

Then I do some transformations like:

    transform.position = [1,1,1]; //set new position

    transform.CalculateWorldMatrix(); //recalculate worldMatrix with new translation coordinates.

    //Multiply worldToLocal with worldMatrix in order to get localMatrix.
    localMatrix = transform.parent.worldToLocal * transform.worldMatrix;

After that, I have localMatrix with position, rotation etc relative to parent transform.
But I can't figure out how to get components(position,eualerAngles,scale) out of localMatrix. As far as I googled I found some really difficult solutions, which I couldn't understand, and as I'm writing on JavaScript I hope there is a simple solution.
Maybe I am using wrong structure for transform object?
What is the common approach here?
I read that its preferred to use quaternions, but only advance they give is about gimbal lock, at this moment because of simplicity I would like to stick with euler angles if it's possible.

labels: python directx11 textures mathematics unity 2d directx unity 2d game-design xna unity unity unity unity xna c# unity libgdx 2d unity libgdx unity 2d shaders unity java unity unity game-design c unity unity 2d c++ sound console opengl c++ opengl java game-design assets unity java c++ java libgdx android pygame unity path-finding unity opengl c++ unity directx unity networking opengl c# procedural-generation java unity unity unity opengl rendering c++ physics networking vector 3d unity unity unity unity unity libgdx unity opengl xna unity movement matrix 3d c++ xna animation c++ unity c++ xna matrix unity path-finding opengl javascript unity multiplayer unity unity 2d minecraft-modding java unity xna xna unity c# unity unity unity love2d graphics software-engineering shaders xna opengl unity unity performance physics opengl unity c++ collision-detection android software-engineering scripting licensing mathematics 2d camera andengine geometry opengl iphone udk xna xna 2d unity unity unity opengl animation c# javascript unity collision-detection ai unity mathematics xna c++ 2d directx unity java html-canvas physics c# ai unreal-4 java game-design unity shaders physics unity java libgdx unity opengl opengl animation java java unity animation mathematics 2d 2d android android c++ game-loop ai rendering c# game-design camera unity unity opengl unity unity unity java java rpg libgdx unity c# flash unity javascript frame-rate javascript android architecture unity opengl android opengl android opengl-es2 unity directx physics opengl libgdx opengl unity flash optimization 2d c# xna unity game-design ios unity game-design c# opengl ogre collision-detection xna unity unity monogame opengl android opengl graphics unity 2d collision-detection xna architecture opengl java physics normals unity ai lighting libgdx android c# procedural-generation frustum-culling android c# modding software-engineering java ios xna collision-detection procedural-generation java xna collision-detection unity unity opengl unity unity 2d java procedural-generation 2d opengl xna vector career rts c++ monetization c++ mathematics unity c# 2d legal c++ opengl libgdx opengl c++ heightmap animation unity input xna java 2d actionscript architecture architecture collision-detection unity algorithm java textures udk xna directx python mathematics html5 libgdx c++ c# unity android architecture graphics opengl three.js image mathematics unity xna procedural-generation flash audio rendering unity software-engineering collision-detection iphone 2d algorithm unity unity opengl unity unity opengl unity xna hlsl ai java shaders java android unity 2d unity libgdx licensing minecraft-modding unity unity unity unity opengl collision-detection animation unity unity c# unity unity marketing directx11 xna graphics python unity 2d java c# algorithm iphone 3d unity libgdx unity xna unity algorithm python unity unity unity javascript java unity unity unity c# 3dsmax mathematics unity sprites c++ unity java libgdx animation xna unity unity c# xna unity path-finding opengl java component-based xna java unity 3d unity unity java directx directx unity algorithm unity algorithm 2d unity unity shaders textures racing hardware libgdx unity opengl unity opengl directx11 3d python opengl mobile unity textures unity java c# 2d unity unity java unity android game-design opengl-es c# gpu ios unity javascript xna unity java opengl unity box2d opengl game-maker 3d libgdx opengl unity game-design unity unity server unity xna mathematics mathematics c# 3d-meshes flash unity opengl unity shaders 2d xna unity unity xna xna c++ directx c++ physics unity viewport opengl unity libgdx c# sprites animation hlsl collision-detection unity unity opengl-es2 2d unity mathematics unity unity unity unity c++ java unity c# mobile unity databases node.js xna portals architecture ios unity unity c# algorithm unity collision-detection mathematics unity mathematics libgdx flash c# opengl unity android collision-detection collision-detection 3dsmax c# directx opengl windows 3d unity unity commodore-64 assets unity unity xna isometric libgdx opengl actionscript-3 unity graphic-effects c# matrix tiles unity unity libgdx c# unity android unity xna algorithm xna unity unity ios xna opengl path-finding ai 3d unity assets unity unity architecture java directx coordinates android camera graphics java libgdx xna unity xna unity 2d c++ unity c opengl unity directx ios hosting unity unity python ai python unity c++ java unity java libgdx xna tilemap c++ three.js valve xna directx c++ unity c# godot unity opengl networking camera opengl unity c# unity android libgdx shaders java collision-detection graphics text-based unity unity directx9 animation 3d architecture terrain unity unity xna unity unity android xna unity unity java unity unity c++ java unity tilemap matrix unity testing html5 client-server unity physics opengl unity java flash networking game-design xna multithreading java android path-finding c++ physics opengl opengl opengl copyright game-design opengl unity sharpdx unity multiplayer java java software-engineering c++ unity unity java iphone opengl xna unity unity box2d unity java unity android unity xna unity architecture c++ unity unity mathematics unity textures unity architecture directx opengl xna c++ opengl c++ unity unity c++ unity unity opengl bullet-physics ai collision-detection unreal-4 tiles opengl opengl cocos2d-x android path-finding game-design physics unity game-design android physics text unity 3d ai opengl mathematics unity javascript unity unreal-4 opengl distribution multiplayer xna unity java android mathematics unity c# unity algorithm opengl unity unity performance unity licensing xna mouse actionscript-3 2d physics-engine sprites xna libgdx ios mobile algorithm architecture rotation movement unity game-design mathematics unity xna flash opengl javascript unity java windows-phone-7 c# java 2d movement unity java opengl xna unity game-design opengl unity mathematics signed-distance-field unreal-4 libgdx java windows-forms xna textures opengl unreal algorithm libgdx multiplayer architecture directx11 game-design unity opengl actionscript-3 input 2d 2d unity xna game-design 3d c++ voxels physics data-structure physics c# java open-source game-industry sprites graphics raycasting unity opengl google-play html5 c# c# unity python c++ unreal-4 c++ c# algorithm opengl unity unity unity java opengl unity strategy opengl unity c++ textures java path-finding architecture physics unity steam unity android unity bullet-physics textures unreal-4 unity architecture unity unity opengl xna unity unity 2d opengl lua c++ unity unity libgdx unity c++ architecture 3d 2d coordinates java xna xna unity sprites sharpdx mathematics movement unity opengl voxels android game-maker unity c# xna unity level-design multiplayer pygame physics path-finding unity c# opengl unity terrain-rendering unity collision-detection unity rendering unity ios legal 3d path-finding unity html5 unity collision-detection mathematics opengl sprites xna unity unity libgdx unity unity gui c++ architecture opengl flash 3d cocos2d unity unity path-finding camera xna unity 2d c++ java unity multiplayer monogame ios unity unity game-design html5 camera hlsl game-design android geometry xna collision-detection matrix c++ unity collision-detection c++ modding input c++ java game-industry unity c++ assets godot hexagonal-grid textures unity android architecture unity javascript unity xna c++ 2d unity performance textures unity 3d sdl2 architecture game-mechanics unity unity unity unity algorithm collision-detection java unity unity graphics game-industry collision-detection opengl unity bullet-physics unity software-engineering multiplayer java opengl 2d lighting opengl xna 2d opengl unity unity camera procedural-generation java tools software-engineering c++ unity 3d rendering xna collision-detection opengl 2d opengl path-finding xna c++ unity java game-design gpu 2d unity opengl unity opengl unity unity xna shaders physics c# sdl android unity c# java physics java algorithm c++ unity unity unity unity coordinates opengl unity unity unity opengl java animation directx xna unity unity game-industry opengl input unity udk xna unity cocos2d-iphone unity collision-detection 2d unity c# java libgdx unity software-engineering copyright unity unity rotation unity c# c++ networking xna unity ios unity android unity software-engineering file-format lua c++ mathematics opengl java architecture unity unity c++ 3d directx collision-detection jobs shaders xna 3d javascript game-design game-design opengl android ranking unity c# android xna xna libgdx unity udk collision-detection unity browser-based-games java c# mathematics legal c# unity c++ game-industry opengl c++ c# c# opengl spaces c# xna unity mathematics xna opengl flash mathematics box2d shaders unity mathematics xna opengl unity java xbox360 xna-4.0 flash unity opengl physics c# shaders 3d java unity physics iphone xna game-design architecture unity unity xna rotation unity physics unity outsourcing terminology unity physics unity game-loop c++ xna unity unity matrix image c++ 2d physics xna slick 3d opengl c++ directx opengl legal procedural-generation data-structure unity game-design opengl mobile c++ collision-detection actionscript-3 javascript unity marching-cubes mathematics c++ java rts java opengl state c# unity java opengl c# xna unity file-format c# unity c# unity unity opengl opengl libgdx java libgdx java unity unity timestep python box2d unity 3d unity matrix unity xna unity collision-detection unity gui xna c++ java java tilemap ai libgdx unity game-design unity collision-detection javascript directx unity textures directx javascript c# c# unity xna software-engineering libgdx opengl scripting algorithm physics opengl unity android unity legal 2d android unity unity directx9 c# iphone legal unity 3d architecture 2d procedural-generation windows opengl opengl gpu unity physics unity unity xna animation unity c# legal unity opengl unity mathematics software-engineering rpg path-finding xna java 2d unity opengl 3d unity xna mathematics xna unity lighting 3d unity unity unity xna-4.0 game-maker animation xna google-app-engine xna algorithm physics unreal-4 unity java cocos2d-iphone movement opengl opengl unity unity opengl debugging metrics graphics opengl development-speed shaders unity procedural-generation mathematics unity 2d unity unity collision-detection c++ game-design unity rotation 2d 2d unity opengl unity legal 2d java ai mathematics multithreading testing c++ 3d android php graphics unity opengl unity unity c# collision-detection multiplayer unity unity opengl xna unity ios java unity cocos2d-iphone unity flash legal unity unity unity unity opengl 2d java opengl unity c++ c++ unity opengl xna unity opengl image rotation c# opengl unity unity c# unity xna opengl xna c++ java opengl algorithm scene-graph android 2d unity game-design unity gpu unity unity shaders software-engineering ios unity unity opengl c# unity algorithm virtual-reality mathematics opengl unity unity c++ geometry unity 2d c++ multiplayer c++ blender unity unity unity glsl unity rpg movement collision-detection java xna c++ directx11 unity assets xna unity opengl 3d xna unity java animation opengl unreal-4 unity c# c# android unity unity physics c++ xna ai unity xna c# unity udk directx unity c++ unity 3d c# google-play collision-detection collision-detection tiles performance unity mathematics ios xna c# unity c# collision-detection unity java actionscript-3 unity directx11 game-design directx algorithm unity unity scripting camera unity unity software-engineering lumberyard-engine sfml c++ open-source textures c# c++ audio unity 3d level-design methodology ruby unity ios flash java maps scripting 3d licensing unity xna android 2d java unity shaders game-design unity unity game-design unity c# unity javascript android unity unity 3dsmax xna html5 unity unity education algorithm c++ xna game-design c++ 3d unity android 2d unity unity unity opengl unity java networking collision-detection xna algorithm 2d architecture flash 2d unity game-design bullet-physics collision-detection libgdx 2d game-maker networking graphics unity xna unity c++ unity javascript opengl opengl multiplayer unity unity java mathematics javascript hlsl box2d xna box2d iphone animation java game-design terrain sprites c++ books java c# unity oop libgdx java directx xna xna collision-detection textures c# android unity unity c# opengl unity java textures algorithm java unity game-maker c# unity unity unity collision-detection collision-detection 3d legal java physics java unity legal geometry unity xna unity c++ opengl opengl xna game-design unity collision-detection unity html-canvas unity xna javascript java unity c# unity ios unity multiplayer matrix client-server rendering 2d unity c++ 2d collision-detection unity mathematics c++ android unity java unity unity unity 2d physics gui unity c++ unity culling unity collision-detection unity game-design legal opengl c++ unity 3d-meshes xna collision-detection java c# opengl architecture unity c++ unity unity input c# architecture software-engineering game-design mathematics unity unity unity glsl 2d unity collision-detection performance 3d screen monogame physics java opengl rendering unity vector movement collision-detection unity unity databases opengl spherical-harmonics xna java algorithm game-design unity 2d xna unity android unity mathematics game-maker c# unityscript lua opengl mathematics xna unity rendering java steam physics java unity unity compression entity-system unity unity 2d xna unity xna architecture opengl xna 3d mathematics java textures 2d unity ai unity 2d unreal-4 2d xna c++ rotation javascript game-maker unity unity c++ directx projectile-physics 2d unity unity unity c++ unity c unity sfml performance unity collision-detection c++ c# opengl c++ c++ sprites physics 2d opengl multiplayer xna architecture c# 2d 3d-meshes networking udk java animation unity opengl android legal game-design shaders blender input input opengl xna unity collision-detection opengl cocos2d 2d unity algorithm entity-system unity javascript text opengl directx game-center andengine xna directx unity unity unity game-design directx11 unity c++ multiplayer unity architecture unity animation unity collision-detection android wii unity unity java copyright tiles c# 3d mathematics opengl unity unity unity unity game-design tiles game-design virtual-reality nintendo hlsl opengl unity collision-detection opengl unity twine maps frame-rate networking graphics-programming c++ godot unity unity opengl c# multiplayer unity unity unity multiplayer unity android timing animation unity java unity libgdx opengl unity c++ game-design isometric unity vector sprites game-maker c++ unity c# python java camera unity voxels unity algorithm graphics-design unity c# unity procedural-generation webgl game-design networking directx android c++ unity unity unity unity game-maker unity c# opengl xna algorithm mathematics c++ 2d unity libgdx unity unity unity andengine c++ architecture web javascript python adventure-game-studio unity c++ unity tilemap opengl unity java opengl cocos2d-iphone opengl algorithm unity 2d unity physics unity unity procedural-generation java unity 3d movement android xna xna opengl leaderboards path-finding unity unity unity java c++ mmo java javascript c# shaders unity opengl unity unity 2d unity libgdx unity 3d opengl directx unity windows-phone-7 architecture collision-detection normal-mapping databases multiplayer 3d c++ textures movement unity java vb.net unity unity java c# unity unity xna unity 3dsmax c# slick xna-4.0 android xna unity input opengl opengl java unity flash c++ android camera directx unity android unity c# libgdx c++ 2d software-engineering unity mathematics maps graphics unity opengl c# c# c++ c++ 2d algorithm unity unity game-loop unity unity 2d opengl c++ andengine game-design java android physics-engine collision-detection algorithm turn-based unity unity pygame unity 2d 2d java models game-design unity unity java libgdx tools pygame unity java collision-detection unity animation algorithm unity xna-4.0 game-design unity xna ai path-finding unity animation c# c++ unity unity 2d unity xna physics-engine game-design directx multiplayer unity mobile c++ unity xna c++ java architecture opengl unity unity unity unity 2d opengl-es2 opengl-es java copyright c# game-design unity javascript opengl unity xna html5 textures opengl unity unity leaderboards unity c++ unity opengl unity java architecture unity opengl rendering networking ai unity rigging c# multiplayer shaders c++ lua unity unity uv-mapping c# unity 2d unity java leaderboards unity physics c++ networking 3d unity maps random c# input game-design unity animation mathematics unity c++ intersection xna-4.0 2d opengl unity opengl-es unity opengl mathematics c# java android android rpg game-mechanics unity opengl unity java unity javascript 3d xna unity opengl separating-axis-theorem unity unity unity 2d unity java xna unity c++ game-maker splines game-industry unity physics game-design monogame unity unity c++ playstation4 entity-system opengl unity opengl unity particles mmo c++ directx11 javascript 3d c++ terminology opengl c# opengl unity unity libgdx unity unity flash collision-detection unity game-design physics rotation opengl javascript unity c++ path-finding unity unity software-engineering animation 2d graphics opengl physics unity unity savegame unity unity unity unity unity c# unity unity collision-detection shadows gui game-design unity opengl architecture xna flash java c++ c++ procedural-generation graphics opengl xna physics unity opengl xna unity xna unity unity python 2d component-based collision-resolution 2d opengl unreal-4 javascript terminology libgdx c++ opengl java 2d ai godot level-of-detail xna unity python unity unity unity opengl unity unity 2d marketing game-design unity unity unity opengl physics unity game-design physics unity libgdx collision-detection game-maker unity c++ collision-detection c# source-engine unity collision-detection shaders c++ unity algorithm c# unity 2d unity iphone rpg unity textures mathematics opengl opengl unity 2d libgdx unity mathematics networking unity c# java xna game-design unity c++ graphics collision-detection iphone opengl animation opengl hexagonal-grid c# rendering unity unity directx procedural-generation c# xna android unity entity-system java android c# 2d unity collision-detection godot unity xna java opengl-es2 unity opengl unity c++ unity flash unity android javascript unity android unity java python directx opengl glsl networking shaders opentk architecture opengl unity javascript camera c++ unity 2d physics unity xna unity unity unity unity opengl opengl unity 2d assets performance psm collision-detection unity rendering game-design unity unity c++ tools file-format unity unity camera xna models 3d art unity animation unity software-engineering opengl directx9 unity unity game-design unity unity java opengl game-mechanics ai unity rendering c++ collision-detection xna unity algorithm c# turn-based-strategy 2d unity c++ xna licensing c# 3d game-maker graphics unity unity unity rotation xna-4.0 c++ spawning c++ java unity c++ 3d box2d 2d xna opengl opengl unity c# collision-detection flash unreal-4 java andengine unity java game-maker c++ graphics java code-reflection opengl unity opengl box2d 3d c++ c# 2d design-patterns directx opengl xna 2d c++ android unity javascript architecture architecture shaders lua security java movement unity unity unity xna directx 3d multiplayer game-design c# unity javascript unity android algorithm c# libgdx 3d opengl c# entity-system geometry unity unity unity java c# 2d xna opengl c++ unity software-engineering multiplayer ios physics opengl opengl unity xna java performance sprites unity c++ unity input unity c++ 2d android unity rpg graphics-programming libgdx unity opengl unity c++ java xna ios directx unity algorithm unity 3dsmax ios unity 3d facebook publishing collision-detection unity unity algorithm unity java unity 2d unity xna xna unity libgdx javascript xna unity opengl-es unity color physics libgdx unity game-design server opengl 3d unity opengl textures opengl opengl level-design java movement software-engineering c++ opengl unity networking c++ collision-detection opengl unity 2d 3d opengl opengl java tiles game-mechanics unity c++ opengl unity projectile-physics licensing collision-detection java 3d unity unity unity game-industry directx tilemap unity game-maker mathematics performance java unity unity c# textures unity graphics graphics c# c# unity lighting 2d monogame collision-detection unity libgdx unity unity c++ physics unity xna unity android flash c++ opengl collision-detection opengl opengl unity opengl java directx c++ algorithm c++ libgdx iphone java shaders unity architecture c++ java java actionscript-3 localization game-design algorithm movement models unity unity xna unity ui-design unity terrain unity opengl directx unity c# unity c# java c++ c# physics camera opengl 3d unity java opengl java opengl client-server unity c# c++ shaders c++ android c++ c++ unity 2d textures c++ performance unity opengl libgdx java unity unity ai unity xna java ios xna architecture collision-detection unity udk unity unity competition unity networking c++ copyright rotation unity collision-detection unity unity first-person-shooter unity 3d unity mathematics physics unity java architecture opengl c# java unity collision-detection 3d c# c++ unity opengl android legal unreal geometry unity movement software-engineering opengl c++ libgdx directx android java 2d java shaders algorithm multithreading java unity unity opengl unity java android unity libgdx unity collision-detection c++ javascript c java unity unity color marketing unity unity opengl c++ unity unity unity c++ opengl xna-4.0 data-structure path-finding unity graphics unity unity xna xna architecture unity java java minecraft-modding game-mechanics matrix unity opengl c# 2d textures unity andengine opengl unity unity c# android c++ opengl opengl-es2 c# java xna unity unity unity java xna-4.0 xna-4.0 game-design java scala java android 2d sprites 2d game-design c++ ai opengl 2d unity game-loop c++ java physics replays xna c++ unity unity algorithm unity bullet-physics unity opengl unity collision-detection libgdx unity java collision-detection storage directx11 xna 2d opengl terrain 2d c# javascript c# unity libgdx game-maker c++ multiplayer python textures objective-c c++ c++ xna mmo physics unity unity mobile android c# unity javascript shaders opengl rpg mathematics unity procedural-generation mathematics 3d c# c++ opengl unity game-design opengl c# legal game-design game-design c++ box2d architecture unity textures unity libgdx box2d unity unity javascript android unity box2d unity game-maker unity c++ opengl opengl cross-platform 2d directx c++ opengl unity 2d xna game-design c# shaders assets unity unity 2d textures unity android compression c# 2d tilemap collision-detection architecture software-engineering c++ hlsl javascript c# 3d android unity unity copyright javascript unity unity 3d hlsl 2d unity terrain-rendering unity opengl unity java c++ unity unity rotation libgdx unity multiplayer game-design unity 2d maya physics animation fonts unity html5 procedural-generation unity c# c# c# opengl unity 3d-meshes web unity unity c# networking libgdx unity statistics opengl java java opengl godot 3d 3d textures c# android sharpdx unity java xna unity opengl c++ box2d c++ matchmaking 2d 2d html5 c++ opengl 2d camera game-design java android c++ unity unity 2d c# javascript unity opengl unity graphics unity mathematics unity unity ai physics java game-design xna 2d monogame xna c# java unity opengl unity cocos2d-iphone unity unity c# shaders c++ java opengl project-management unity physics opengl random map-editor grid opengl unity sprites unity special-effects c# c++ textures c++ algorithm raytracing javascript box2d xna unity c++ iphone 2d java unity java directx directx animation opengl c++ path-finding architecture 2d unity unity unity 2d 3d unity c++ 2d xna ios unity file-format blender html-canvas directx xna textures unity javascript 2d c++ opengl javascript unity unity unity c# unity xna ios unity c++ procedural-generation java c++ opengl javascript javascript android architecture game-design java coordinates game-design c++ unity java corona-sdk interpolation algorithm unity opengl unity collision-detection c++ c++ android xna 2d android 2d blender textures xna physics sprites unity android xna java game-design c# unity unity java graphics unity android unity level-of-detail procedural-generation windows unity unity opengl c++ unity xna unity c++ c++ camera rotation unity java animation xna unity android c++ game-design architecture unity unity unity ios 2d opengl collision-detection directx11 2d unity opengl-es ios c# unity rendering box2d 2d architecture xna 2d unity architecture opengl collision-detection unity algorithm xna ai raycasting c++ 3d c++ lua python unity 2d text opengl game-design java c# game-design xna unity c++ browser-based-games android unity unity 3d unity opengl unity java opengl game-design audio game-design javascript game-design unity unity unity unity design-patterns javascript 2d plugin 2d unity music antialiasing 3d graphics box2d synchronization libgdx unity unity box2d c++ collision-detection 2d android opengl input fsm cocos2d-iphone unity unity c++ unity xna ogre java unity graphics ai textures 3d architecture java collision-detection opengl java tools unity textures mathematics game-design opengl opengl c++ unity c++ 2d android unity marketing unity animation physics opengl java architecture collision-detection c++ unity android graphics java unity c++ opengl input physics unity unity career xna c# unity terrain stencyl steam fonts physics java godot movement unity monogame shaders c++ unity 2d unity unity 2d java libgdx unity unity java unity mathematics post-processing opengl unity 2d art xna xna unity libgdx flash glsl unity algorithm unity opengl unity models architecture physics user-experience c# textures c++ tiles c++ rpg windows-phone-7 java unity xna 2d collision-detection java 3d animation 3d-meshes xna software-engineering input 3d assets unity sdl2 2d directx11 javascript c++ cocos2d rotation javascript unity android c# performance physics opengl java unity cocos2d steam shaders animation unity opengl c++ vector unity unity xna c++ python collision-detection c# opengl xna textures text-based rendering tiles c# assets unity javascript unity unity iphone architecture unreal-4 sdl java windows education c# java unity directx9 animation path-finding c++ 2d monogame unity libgdx unity 2d game-design maps c# quadtree unity c# c# models lua statistics android c++ procedural-generation entity-system color java ios game-design algorithm xna physics directx multiplayer java unity unity collision-detection unity rendering xna unity path-finding c++ unity unity animation unity networking unity opengl unity unity 2d facebook opengl unity unity c# android unity c# tiles unity unity game-design directx shaders xna xna unity graphics unity cocos2d-iphone unity unity xna architecture java networking rigidbody 3d unity c# android opengl c++ opengl unity marketing game-design architecture unity unity flash geometry c# unity networking performance unity 2d game-mechanics c# directx11 java 2d unity unity mathematics ogre legal python swift c# color physics-engine xna unity unity graphics unity sdl opengl graphics unity iphone unity xna pixel 2d c# unity graphics c++ 2d iphone unity networking unity algorithm opengl 2d game-design camera c# xna rendering mathematics textures java xna animation architecture libgdx sfml 3d android unreal-4 c# unreal-4 opengl glsl c# unreal mesh 3d algorithm ai unity opengl unity ios xna unity unity xna java 2d java flash game-design phaser unity unity algorithm unity legal c++ mathematics mathematics graphics unity unreal-4 unity unity c++ unity opengl 3d physics unity unity java opengl xna xna ios directx unity collision-detection ios 2d unity andengine shaders opengl java unity game-design career cocos2d-iphone game-design unity sound perlin-noise c++ html5 2d ai 3dsmax xna java java unity opengl unity legal publishing opengl c# android physics architecture collision-detection c# unity physics javascript c++ unity android unity unity mathematics libgdx unity libgdx rpg-maker physics unity glsl c++ opengl unity windows sprites game-industry floating-point angles xna c# 2d unity monogame algorithm c++ unity networking c++ procedural-generation fsm opengl vector steam mathematics 2d ai unity java savegame version-control terminology shaders opengl unity c# google-play-services c# 2d unity udk software-engineering unity unity 3d unity c++ unity unity unity unity tilemap iphone tiles windows unity graphics libgdx cocos2d-iphone animation unity collision-detection depth-buffer python mathematics opengl unity demo unity 2d terrain physics opengl opengl java adventure-games opengl physics c# box2d networking 2d unity java art unity c# unity ai unity unity unity unity unity unity game-design opengl unity unity path-finding unity 3d unity textures unity opengl javascript unity html5 directx javascript unity unity unity algorithm java opengl opengl c# 2d unity unity xna java xna 3d game-design android c# 2d inventory javascript unity opengl udk maya unity c++ opengl xna collision-detection opengl unity unity levels unity collision-detection unity networking opengl unity game-design sprites java 3d c# libgdx unity unity software-engineering spritesheet c# unity c# movement unity path-finding music sprites game-maker algorithm unity flash directx unity algorithm java javascript directx9 unity unity 3d xna opengl java procedural-generation python sdl2 unity java unity unity collision-detection unity animation design-patterns unity quaternion game-design iphone legal unity c# unity opengl java c++ architecture 2d opengl algorithm unity cocos2d-iphone steering-behaviors logic opengl textures iphone rotation hlsl animation ios unity android game-maker opengl opengl opengl opengl java opengl 3d-meshes unity 2d release component-based c# architecture c++ opengl c++ physics ai unity unity unity unity java unity physics-engine java 3d audio opengl unity opengl unreal c++ android unity 3d unity c# 2d ai 3d performance architecture opengl c# unity unity unity input shaders xna projectile-physics unity unity procedural-generation opengl c# c++ libgdx xna models unity unity java game-design 2d unity rigging 3d unity unity xna opengl-es c# mathematics c# unity computational-geometry path-finding javascript unity opengl networking mmo unity java c++ android xna legal maps state physics character unreal-4 3d-meshes efficiency objective-c libgdx 3d mathematics c++ monogame unity unity unity c++ libgdx unity unity opengl 3d java unity unity camera unity pixel-art 2d javascript unity unity unity unity xna c# unity legal unity opengl mathematics java unity shaders opengl c++ mathematics 3d opengl rendering opengl 2d opengl cocos2d-iphone opengl java unity pixel legal c++ unreal-4 game-design unity unity architecture legal unity opengl algorithm multithreading server unity unreal algorithm software-engineering unity architecture physics unity html-canvas unity algorithm javascript c++ opengl hlsl java unreal-4 game-maker collision-detection algorithm ai unity architecture c++ unity animation c++ 2d xna opengl flash gui unity steam 2d unity entity unity architecture libgdx libgdx camera box2d server unity art opengl opengl ai game-design unity unity java java software-engineering javascript unity unreal-4 java mathematics opengl android hardware unity xna models mathematics path-finding unity 2d directx11 algorithm cocos2d-x opengl unity android unity ai box2d opengl game-design xna javascript unity directx game-maker unity game-design xna 3d unity rendering unity unity xna xna unity unity animation cocos2d-iphone phaser c# android unity unity unity java rpg-maker-xp publishing c++ java shaders open-source unity unity iphone unity actionscript-3 models libgdx java component-based unity unity c++ matrix opengl unity c++ voxels xna android unity unity architecture libgdx unity unity unity unity opengl java c++ c++ c# directx javascript marketing xna android xna education c++ unity unity gui marketing java unity 2d 2d collision-detection java camera javascript audio xna c# 2d mathematics unity unity education c++ unity c# unity xna javascript game-maker publishing unity flash controllers unity unity c++ unity unity c# opengl java competition unity opengl directx libgdx roblox game-design terrain collision-detection 2d movement xna 2d andengine libgdx xna collision-detection xna 3d libgdx unity collision-detection java xna 2d unity camera modding graphics flash c++ c++ xna xna c++ unity opengl c++ 2d unity c++ fractal game-design unity unity javascript c++ libgdx rpg unity shaders matrix sdl c++ java terminology javascript opengl directx graphics-programming textures unity lighting unity node.js physics java unity mathematics box2d rendering collision-detection sdl2 android opengl unity c++ unreal-4 directx11 java opengl cross-platform lwjgl software-engineering opengl libgdx unity ai 2d mathematics game-design tiles unity android unity unity 2d unity opengl architecture unity c# physics collision-detection xna libgdx algorithm java android flash flash 2d gameobject unity opengl android animation shadows unity graphics unity glfw unity architecture matrix textures android unity c++ c++ rendering unity unity maps terminology unity java unity monogame andengine unity unity c# unity fragment-shader xna-4.0 algorithm xna unity opengl networking xna unity game-design opengl scripting unity xna unity unity unity java unity unity textures 2d unity java collision-resolution game-design unity c# legal behavior-tree opengl 3d mathematics unity 3d unity opengl editors xna unreal-4 unreal-4 animation 3d-meshes opengl animation game-maker opengl unity java entity-system java xna architecture unity ai hlsl game-mechanics video camera c# java unity unity mmo libgdx opengl game-mechanics opengl opengl windows java career 2d libgdx mathematics shaders unity unity collision-detection unity 2d xna unity xna unity animation c# networking 2d flash mathematics xna architecture libgdx directx opengl unity software-engineering 3dsmax unity physics c++ software-engineering space-partitioning xna unity unity xna-4.0 java c++ game-maker xna 2d unity c++ architecture unity opengl unity 3d xna project-management java server architecture collision-detection c# 3d ios opengl c++ java 2d graphics unity unity 3d box2d android c# rendering java javascript xna javascript unity swift xna java unity java java maya 3d unity android unity collision-detection java directx game-design path-finding c++ c++ graphics shaders unity unity java unity libgdx unity android android xna 3d opengl software-engineering sdl unity procedural-generation directx procedural-generation java unity physics 2d collision-detection game-design android unity unity maya unity opengl collision-detection game-design unity android unity c++ 3d 2d 2d java graphics 2d architecture 2d directx game-maker collision-detection physics software-engineering c++ unity unity physics android 2d testing unity publishing unity 2d 3d opengl graphics java xna unity copyright graphic-effects 2d objects unity opengl first-person-shooter networking physics unity unity physics c++ models java rendering game-design glsl unity xna android unity 3d networking opengl mmo c++ xna flash unity unity unreal-4 c++ unity directx networking corona-sdk unity procedural-generation c++ opengl flash physics unity c# racing unity unity unity java opengl unity opengl c++ unity architecture unity unity android publishing c# unity algorithm palette xna savegame unity physics-engine collision-detection algorithm rendering python opengl unity unity javascript unity matrix